Week 11 - Networking and Communications
Playing with WiFi and RF; Tutorial on ESP8266I was especially excited by this week's opportunity to play with a cheap, yet fully functional WiFi module. Compared to existing WiFi Shields or expensive Arduino boards, this seemed like a perfect solution.
But as we all know, there are no free meals. Documentation is scarce, the module is quite new and frequent changes to the module make the little information found online very misleading.
As a result, I spent the majority of this week getting the ESP8266 to work. Below I will mostly focus on my failed attempts and show some of the results, but I decided to document the successful process and provide easy-to-use serial communication modules that could save people quite some time. To see the tutorial, go here: Serial-to-WiFi Tutorial using ESP8266
A little about the process - I started this week by testing out the 2.4GHz RF module (not WiFi compatible) and the ESP8266 Module.
The first process was to test the nRF24L01+ module. This was the easiest part of the week - I used the RF24 library Ping-Pong example, and got the modules plugged in and tested.
I quickly moved to the more exciting WiFi module, because it would enable me to use any WiFi-enabled device (like my smartphone) to control the microcontroller. Real IoT!
This turned out to be more difficult than I thought. I spent a lot of time trying to understand why I'm getting gibberish in the serial output. The 'internet' claimed that either 57,600 or 115,200 baud rates are to be used, so I didn't even considering using a baud rate as low as 9,600. This has literally took hours of my life, until Palash rightfully noted that he tried 9,600 and it worked. After changing the baud rate - I began getting some real output.
The next step was to try connecting the device through a serial cable, for which I used the 3V3 FTDI cable we have at the lab. I then wrote a python program to interface with the board, connect to my AP and list the IP of the device.
Finally, after getting the device to work and understanding how to issue commands to it, I connected it through an Arduino board (which will later be replaced with a Fabduino-style board) and got it to serve a webserver that outputs sensor data to the requesting clients.
As mentioned above, if you wanna learn from my mistakes and quickly get this board working, you should check out the tutorial I put together - Serial-to-WiFi Tutorial using ESP8266.