Introduction: Bluetooth Controlled NeoPixel Christmas Tree

About: I'm a 21 years old Robotics Engineering student from Brazil. Since I was a kid, electronics and programming were always my passion which I still keep on working. I am a curiosity driven person who loves to DIY…

Have you been wondering how to add IoT (Internet of Things) in your Christmas tree this year? Well, it's totally possible! I personally call this project "ArduXmas", and it consists of a RGB NeoPixel led strip controlled by an Arduino board via Bluetooth. This is a beginner friendly project and a great introduction to Arduino e IoT, so get your tools and let's make it!


For this project you'll need:

  • Arduino (I used Nano, but any version will work, just make sure to properlly power your board)
  • NeoPixel WS2812b LED strip
  • HC-06 Bluetooth module
  • 5V 2A DC power supply
  • DC Barrel Power Jack/Connector
  • Phenolite plate for holding the components
  • Enclosure case
  • Android smartphone with Blynk app installed

Step 1: The Circuit

The electronics of this project are very simple. The Arduino, Bluetooth module and LED strip are powered by the 5V supply (make sure all GNDs are connected together). The Arduino board is powered through the 5V port (ATTENTION: Powering the Arduino using the 5V port can damage your board if you're not carefull. Make sure you're using a 5V regulated power supply and don't mix up the +5V and GND wires). The current provided by your power supply will depend on the length of your LED strip. I'm using 180 leds with 40% of the full brigthness and 2 amps are holding well, but always make sure to supply the necessary current (REMEMBER: Each RGB LED uses around 20mA + 20mA + 20mA = 60mA).

The HC-06 Bluetooth module is connected to pins 0 and 1 (RX, TX) of the Arduino, just remember that to use this module, the HC-06's RX pin is connected to the Arduino's TX and the HC-06's TX pin is connected to the Arduino's RX. These are the serial connection pins of the board, and are used in order to receive the commands from the smartphone. I added a switch to easily turn the module on/off thus I can turn it off when programming the board, otherwise the computer can't communicate with the Arduino.

In the circuit the data out pin going to the LED strip is the digital pin 2, but you can choose any PWM pin and change it accordlingly in the code (REMEBER: NeoPixel's LED strips have a direction for the data signal. Always look for the arrow icons in your strip).

In order to make the connections I'm using a phenolite plate with holes in it so it's easy to solder and take it apart next year.

Step 2: The Enclosure

For the enclosure I'm just using an old notebook's power supply case that fits nicely the components. Secure everything with hot glue, and leave holes for the Arduino's USB port, HC-06's switch, DC connector and LED strip connector.

Step 3: Blynk App

For communicating with the Arduino we're using the Blynk app. With Blynk you can easily create interfaces to send data from the smartphone to the hardware or the other way around, it's also possible to directly control the microcontroller's ports without changing one line of code!

DISCLAIMER: Unfortunately this application will only work for Android smarphones because the Bluetooth feature is still in Beta and not available for IOS yet, this also means that it won't be possible to export the project as a standalone app.

Set up your app to receive the authentication token for your project in your email inbox (this auth will be needed later at the Arduino's code). The Blynk's website has a great step-by-step tutorial about this, check it out:

For this project I'm using two buttons for switching on 2 pre-coded light animations; one RGB component to set the LED strip's color; one slider to control the brightness and one bluetooth component to connect to the Arduino. Check the images to see how each component is configured. Pay attention to the pins used for this project as we're using Blynk's Virtual Pins, this is a nice feature that allows to send data from the app to the hardware. For more information about Virtual Pins:

Step 4: Arduino Code

It's time to get some code done! The file I provided has the basic structure to run the project, but you can change it as you desire. In order for it to work properly however, you need to replace the auth[] char with the token you received in your email inbox. Also remember to change the LED_PIN and LED_COUNT variables according to your setup.

The behavior of the LEDs is dictated by the anim variable that changes when a request is received by the app. You can add as many possibilities for animations as you want, just add your function to the switch structure in the toggleAnimation() function and assign the corresponding Virtual Pin reading at the top of the code.

The animation running in loop() is tied to a timer running in 100ms intervals. This is necessary, and I don't recommend changing it, because it interferes with the command and the connection is shut down if the Blynk library detects too many requests in a short period of time.

Step 5: Light It Up and Happy Holidays!

Now just attach your LEDs to the Xmas tree, plug your circuit, power it up and run the app! Enjoy your new IoT Christmas Tree!

Holiday Decorations Speed Challenge

Participated in the
Holiday Decorations Speed Challenge