IoT Bluetooth NeoPixel Lamp

A Bluetooth Low Energy / Internet connected light can be used for all sorts of things. As a status indicator, it could be used to let you know when something has occured. With Adafruit IO, this can combined with IFTTT( If This Then That) so the colors of the NeoPixel ring can reflect a change.

Prerequisite Guides

It's a good idea to walk through the following guides to get familiar with the libraries, software and components.

Tools & Supplies

Bluetooth Controlled NeoPixels

This particular sketch for the Arduino allows you to change the color of the NeoPixel LEDs and trigger animations using the Adafruit Bluefruit LE Connect app for iOS or Android.

Once you get this working, you can connect the lamp to the Internet thru your phone by using our MQTT gateway capability of Bluefruit Connect - for more details check out this tutorial for details.

Arduino Libraries

To use the Adafruit Feather 32u4 BLE sketch you'll want to make sure you're using the latest version of the Arduino IDE (1.6.5 at the time of this writing).

If you're totally new to Arduino take a little time to go through some introductory tutorials like how to make a LED blink.  This will help you understand how to use the IDE, load a sketch, and upload code.

Next you'll need to make sure the libraries used by the sketch are installed.  With the latest Arduino IDE you can use its library manager to easily install libraries, or check out this guide on how to manually install a library.  You'll want to install the following libraries:

  • Adafruit BluefruitLE nRF51
  • Adafruit NeoPixel

Search for the libraries in the library manager and they should be easy to find and install.

Adafruit AVR Boards

Next, you'll need to install the Adafruit AVR boards package from the Boards Manager. Open the Boards Manager and search for Adafruit AVR. This includes all of the boards from Adafruit and will make Arduino compatabile with them. The  BLE sketch was tested with version 1.4.0.

All this is covered in the Bluefruit Feather tutorial guide!

Uploading Sketch to Adafruit Feather BLE

This sketch will run the Bluetooth controlled LED program to the NeoPixel strips that are mounted in the lamp

To load the sketch make sure the libraries above are installed, and the Arduino is connected to the computer through a USB cable.  Under the Tools -> Board menu make sure the Adafruit Feather 32u4 is selected, and under the Tools -> Port menu the serial port for the Adafruit Feather is selected.  

Then press the upload button or click the Sketch -> Upload item to send the code to the Arduino.  Woo-hoo the sketch should be running.

Connect Adafruit BLE Mobile App to Adafruit Feather BLE

Download the Adafruit BLE Connect app for iOS or Android. Under the peripherals list, tap the connect button on the Adafruit Bluefruit LE item. Make sure the Feather board is powered on. Select "Controller" and choose either Control Pad or the Color Picker.

Control Pad

Buttons 1-4 will trigger an animation.

  1. larsonScanner
  2. color wipe
  3. rainbow gradient
  4. rainbow cycle

Color Picker

Here you can change the brightness or RGB value of the leds. 

Uploaded Code

With the Arduino sketch uploaded to the Adafruit Feather 32u4 Bluefruit LE, proceede to the circuit digram page for prototyping the circuit.

Reference Connections

Use the circuit diagram to reference for connecting the components together. The diagram does not depict exact wire lengths or size of components.

  • EN from Feather to Switch
  • GND from NeoPixel to Switch
  • GND from Feather to GND on NeoPixel
  • 3V from Feather to PWR 5V+ on NeoPixel
  • #6 from Feather to Data Input NeoPixel
  • JST connector from Battery to JST on Feather
The 500mAh battery only gives you about an hour of use. Use the diagram below if you'd like to use USB Power.

Longer Usage

If you're planning to leave the lamp on for extended periods of time, it's best if you power the circuit via 5V USB power supply. You can use your computer's USB port, USB hub or dedicated 5V power supply.

Build a Prototype

If this is your first electronics project, it's a good idea make a prototype before mounting the components to the enclosure. You can use alligator clips to make quick connections without having to solder any wires. The idea here is to test the code and components to see if everything works as expected. You can ommit wiring the slide switch to the 500mAh battery in the prototype - Plugging the male JST connector from the battery to the Adafruit Feather board will prompty power the micro-controller on, unplug to power it off.

Alternatively, a breadboard is meant for prototyping, but soldering headers and desoldering headers can be a bit of a challenge. 

Once you have uploaded the Arduino sketch to the Adafruit Feather 32u4 Bluefruit LE and test connected the NeoPixel Rings and 500mAh battery, verify everything works. With that, you can proceede to the 3D printing and assembly.

Filament Options

We recommend using PLA material for this project. You can use ABS or other type of filaments but may require a heated bed. PLA prints with minimal warping and doesn't necessary require a heated bed.

Slice Settings

The table below is a general reference for slice settings. Every 3D printer is slightly different, so you might want to use settings you're familiar with. 

case-top.stl

220c
10% Infill
0.1mm Layer Height
No Supports/Raft
90/150 mm/s Speeds

Twisty top part connects to case.

case.stl

-

Main case holds components.

voronoi-shade.stl

Print in a white or a translucent colored filament.

Connects to twisty top part.

shade-bottom.stl

Print in a white or a translucent colored filament.

-

Download, Modify, Remix Design

The parts were modeled in Autodesk Fusion 360 and available to download, modify and remix. The parts can be exported in several file formats - great if you're using a different CAD package.

Prep Wires

For this project we'll need 5 wires. Start off by measuring 8cm of length and cut 5 pieces of 26AWG wires. I recommend using Silicone-coated stranded wires. Remove about 4mm of insulation from the tips of each wire using wire strippers. Then, apply solder to the tips so they don't fray - this makes it easier to connect to the components as well. 

Slide Switch

The slide switch comes with three legs, remove one of them using snips (we only need two). Trim the remaining two short (about half the length).Then, apply solder to them. Secure the switch to pair of Helping Third Hands to assist you. Get two of the five wires you made and solder them to the two legs of the slide switch. Add pieces of heat shrink tubing to insulate the exposed connections.

NeoPixel Wires

The remaining three wires will be used to connet the 24 x NeoPixel ring to the Adafruit Feather 32u4 Bluefruit LE.

Connect Wires to NeoPixel

Secure the NeoPixel ring PCB to a pair of Helping Third Hands. Apply solder to the Pwr 5V+, GND, GND and Data Input pins. Then, solder the three wires into them.

NeoPixel Wires and Switch

Now our NeoPixel PCB and Slide Switch are wired up.

Connect Wires to Feather

Secure the Adafruit Feather to the Helping Third Hands and apply solder to the EN, GND, 3V and #6 pins. Now we can solder up the following connections. 

  • Pwr 5V+ from NeoPixel to 3V on Feather
  • GND from NeoPixel to GND on Feather
  • Data Input from NeoPixel to #6

Connected Switch to NeoPixel

Solder one of the two wires from the slide switch to the remaining GND pin on the NeoPixel ring. Then, solder the remaining wire from the Slide Switch to the EN pin on the Adafruit Feather.

Test Circuit

Now all of our wires and components are connected. It's a good idea to test out circuit before mounting things to the enclosure. Plug in the JST connector from the 500mAh battery into the JST port on the Adafruit Feather board. Flip the slide switch on and you should see red LED's flashing on the Adafruit Feather.

Install Mounting Screws

Grab the two #4-40 3/8 machine screws and tap the two mounting holes near the microUSB port of the Adafruit Feather. Do this very slowly and try to fasten them in as straight as possible. Fasten the two screws until they slightly protrude the bottom of the PCB.

Install Feather to Case

Insert the Adafruit Feather board into the case with the microUSB port facing the cutout. Adjust the Feather board so the machine screws are seated into the holes of the two standoffs. Hold the PCB onto the case and fasten the screws so they go into the case - You only need about 3-4 turns. Don't try to fasten them all the way through or you could poke through the bottom of the case.

Install Switch

Carefully insert the slide switch into the cutout on the opposite end of the microUSB cutout. Press it through the opening until the switch slightly sticks out the other side.

Install Slide Switch

The slide switch should hold in place with friction, but if you find it loose, you can use adhesives to permanently mount in place.

Install Battery and NeoPixel

Next up, place the 500mAh battery over the Feather board. Route the wire from the battery through the cavity and press it down so it's nested inside. Then, adjust the wires so the NeoPixel ring can sit on the circular mount. Make sure not to kink any of the wires.

Screw Top

Lay the top part over the case and start twisting it until the threads meet and fasten the two parts together.

Install Cover Diffuser

Lay the diffuser cover over the opening of the case.

Install Voronoi Lamp Shade

Now you can press the lamp shade down top the top cover pieces.

Finished Assembly

And thats it! Now you have a pretty cool looking lamp shade. If you've made one, we'd love to see and share about it on the blog! You can post a "make" on the Thingiverse project page.

Trouble Shooting

If you have any technical issues or questions, please post them up in the Adafruit Forums so our dedicate engineering support team can assist you.

This guide was first published on Feb 18, 2016. It was last updated on Feb 18, 2016.