Ever since I saw these LED Candles I wanted to pick them up and connect them to a WiFi enabled micro controller to make an IoT LED Candle. Recently while browsing through the local Walmart I noticed one of these with the “Try Me” button. I had no choice but to pick it up and get my IoT itch over with. In the end it was pretty straight forward with the help of the awesome Adafruit IO.
I wanted to be able to program the ESP8266 based NodeMCU board with the Arduino IDE. This is how I setup the environment and had the NodeMCU blinking.
Installing NodeMCU Board
- Install latest version of Arduino IDE
- Add the Esp8266 board manager. Here is a list of all the unofficial board managers that can be used with Arduino IDE.
- Start Arduino and open Preferences
- Look for “Additional Board Managers” field and enter <code>http://arduino.esp8266.com/stable/package_esp8266com_index.json</code>
- Open Tools>Boards>Board Manager
- Choose “esp8266 by Esp8266 Community” and install. Its about 160 MB install.
After Installation these are the boards I could see in Boards menu under ESP8266:
You should now be able to connect your NodeMCU to the PC and verify. Be aware of two things:
a) You might have to install the Silicon Labs CP210x Serial Driver if you can not see any COM Port listed on the Ardunio> Tools> Ports menu
b) It might a silly thing. But make sure you use the right USB cable. There are too many USB cables in my toolbox. Once in my ignorance about USB cables I used a power only USB charging cable (one that has only the two wires for power connected and no data wires) and struggled a while on COM port not appearing.
Once the Port appears in the Arduino IDE menu, choose the right board. In my case its NodeMCU 0.9 board.
Choose File>Examples>ESP8266>Blink sketch. Press Upload. The blue led on the ESP8266 should blink rapidly indicating communication status. Once sketch is successfully uploaded I could see the on board red LED connected to GPIO 16 blink (D0 on the board).. Pin out below.
Now that my Arduino IDE is setup to be used for NodeMCU programming, time to explore further.
In the earlier posts here, here and here, I was leading up to this build: The Color Catcher and Thrower. A Pro Trinket based glove that captures colors with TCS34725 and sends it out as MQTT message through ESP8266 for my WiFi Christmas Tree and other light fixtures to consume.
In my last two posts I covered how I setup the Eclipse Ponte Bridge locally and how my Arduino Yun was reading a MQTT topic from the Ponte Bridge using HTTPClient. In this post I will cover how I used an ESP8266 with Arduino Uno to publish a MQTT message with RGB values.