The first thing you will need to do is purchase a Wido board. You can find them on many different websites for under $30. I've purchased some from DFRobot from this link and have been happy with the devices I have received.
When you get the Wido board it just comes with the board and a USB cable, no power supply, but pretty much any 7-12V power supply will work as long as it outputs 500mA or more current and 7-12V. Can't really complain seeing you are getting a WiFi chip and Arduino for under $30. DFRobot has a wiki with a bunch of good setup information if you get stuck following the steps here.
You will want to start by downloading the latest Arduino IDE
After installing the IDE you will also need the CC3000 library for talking to the Wifi card on Wido you can get that from here:
Next you are going to need the Wido Control software which we will compile and run on your Wido board. That can be downloaded from here:
After downloading the software you can open WidoControl_v1.ino in your Arduino IDE. You will want to modify your SSID and password for the network you want to connect to. If you want to connect directly to your phone without a network you need to make sure the SSID in the application matches with the value you input on the phone.
// Please enter the SSID and password of the router you want to connect #define WLAN_SSID "wido_connect" // Access Point Name 32 char max #define WLAN_PASS "wido_123" // Access Point Password
If you want to connect through a router rather than direct phone connection you may also need to update the security settings
// Security can be WLAN_SEC_UNSEC, WLAN_SEC_WEP, WLAN_SEC_WPA or WLAN_SEC_WPA2 //#define WLAN_SECURITY WLAN_SEC_WPA #define WLAN_SECURITY WLAN_SEC_UNSEC
Also you will need to update the hostname or IP address you want to connect to
/* Set the target ip address and connection port */ /* server_ip = cc3000.IP2U32(192,168,1,111); */ tcpClient = cc3000.connectTCP(server_ip, 5000);
After modifying your settings in the Arduino IDE simply click on Checkmark to compile and make sure there is no errors. Then plug in the Arduino board into your computer and from the menu under “Tools–>Board” select “Arduino Leonardo” which is the chip used for Wido. If you are using a different Arduino board you would select it here. Under “Tools–>Port” if your device is plugged in it should show up properly here and you can select it.
When first running you will also want to open “Tools–>Serial Monitor” this will open a serial screen where you can see prints from the Wido or Arduino board. Now click the download button which will download the application to your board. A few seconds after download has completed you will see the following messages coming up in the serial monitor:
Initializing the CC3000 WiFi module Getting IPAddr from DHCP
IP Addr: 192.168.43.17 Netmask: 255.255.255.0 Gateway: 192.168.43.1 DHCPsrv: 192.168.43.1 DNSserv: 192.168.43.1 Try to connect the Local Server Connected successfully to the server. <connect version=1.0/> <wido ver=1.0 adc=6 gpio=14 <read_config/> <value=0,0,0,0,9,9,0,9,0,0,9,0,0,0,/> <read_gpio/> <value=1,0,0,0,0,1,1,1,1,1,1,1,1,0,/> <write_config=0,0,0,0,0,0,0,0,0,0,0,0,0,0,/> <value=0/> <write_gpio=0,0,0,0,0,0,0,0,0,0,0,0,0,0,/> <value=0/> <read_adc/> <value=230,208,187,175,167,166,/>
If it is unable to find a network to connect to you will see it hang after “Initializing the CC3000 WiFi module”. Make sure your app is running on the phone at this point as well so Wido can connect to it.
The value 9 returned in read_config represents GPIO's that are used by the Wifi card and cannot be updated. If you are using Arduino or trying to override these values you will need to update the following in the code
// Setup the pins that wido uses as don't touch gpioOut[GPIO_WIDO_SD] = RESERVED; gpioOut[GPIO_WIDO_VBATT_SW] = RESERVED; gpioOut[GPIO_WIDO_SPI_IRQ] = RESERVED; gpioOut[GPIO_WIDO_SPI_CS] = RESERVED;
From Google Play store simply search and download the WidoControl application and install it to your phone.
When you open the application you will see the setup screen presented to you like below.
There are two modes to connect to the Wido.
1) First is direct connect where your phone creates a WiFi hotspot and Wido directly connects to your phone. If you are in a mobile environment you should use this type of connection. The Wifi APName and password you specify on the setting screen must match the values in the WidoControl program you downloaded. You can change these, but you need to set both.
2) Second is connect through a router. Using this method you must have your phone setup to connect to a router and Wido also connects to the same router. As long as you are on the same subnet the Wido and phone will be able to communicate. This is useful for home automation or where you may want to be able to control multiple different Wido boards.
After clicking on the connect button you will be brought to the main Wido status screen. At this point you can power up the Wido board and it will connect to your phone application. If there is a problem connecting you will see the information under “Status”.
At this point the values of the ADC's and the GPIO's will be updated in real time. You can change the values of the GPIO's by clicking on the picture of the Wido board this will bring up the GPIO settings window:
To change the value of the GPIO you will first need to change the GPIO to an output and then set the value high or low. After you have completed setting the values press the back button on your phone to take you back to the board status screen to see the updated values.
You can also connect a wire from the GPIO pin to one of the ADC pins to see it change the values.
To exit from the main board screen hit the back key on your phone which will take you back to the setup screen at which point you can click “Exit” which will terminate all threads and close the program.
If you don't have a Wido or Arduino board you can use the simulator to connect with the application on your phone. You can download the simulator source code here
You can compile this code for linux, mac or windows on your computer simply by running javac wido.java which creates wido.class. To run the simulator run “java wido”. You can tweak and modify test parameters if you would like to do any experiments.