Introduction: Shelf Accent Lighting With Arduino, Smartthings and LED Strips

About: I am by nature a geek and am not ashamed to say so. I decided to create this instructable account because I figured in my learning process I could also teach others. Feel free to look at my existing instructab…

This instructable is based on my previous instructable https://www.instructables.com/id/Arduino-and-SmartThings-LED-Strip-Lighting/ . During the previous instructable I learned a lot and it had to change pretty substantially. The purpose of this instructable is to fix the mistakes I made and combine what I learned in order to finish the accent lighting for my spouse and daughter's desk shelf. We are going to completely start over in this instructable highlighting the differences between the previous, so please follow along step by step.

Step 1: Tools Needed

For the LED/Arduino portion here is what we are going to need

  • Soldering Iron
  • Solder
  • Solid Core wire or pack of jumper wire
  • #1 phillips screw driver
  • Drill with #1 phillips bit.
  • Multi-meter with ability to check for continuity and voltage.
  • Shrik Wrap
  • Small torch or lighter for shrink wrap.

Step 2: The Materials.

We have changed some things in the instructable so we will highlight on the material differences. The green rows are are new to the instructable and the red rows are no longer needed in this version of the project.

QtyItemSourcePriceNotes
1Arduino Uno R3Amazon / Radio Shack$16.06 / $24.99Purchased on store closing at Radio Shack but now their price is high
1Arduino CaseAmazon / SainSmart$14.99 / $4.53You can get it direct from SainSmart but you have to wait longer.
1SmartThings ShieldSmartThingsCurrent Price UnknownFor some reason the option to add this to cart is not there right now. Maybe they are out of stock.
3RGB LED StripsRadio ShackNo Longer availableI got these on clearance at Radio Shack when they were closing down for like a dollar. You can use any 12v LED strip with three pins.
1Seed Studio Relay ShieldRadio Shack$19.99

Again Obtained when they were closing down. Yes I stocked up.

This was removed from the project for two reasons: It kept shutting off the relays at random intervals and because it helps simplify the project.
16 amp 12v Switching Power SupplyAmazon$6.97What ever you do make sure that you get a 2.1mm barrel jack with center pin positive. These are so cheap, might want to buy a few while you are at it.
1Pack of Male/Female Barrel JacksAmazon$8.99This is a pack of 10 each male and female. will give you some extras for later.
1Simple PCB BreadboardRadio Shack$2.49Although the are not the best quality, these are handy to have around, pick up a few.
7PCB 2 Screw TerminalsAmazon$4.99pack comes with 30 pieces
11000uF Capacitor At least 13vAmazon$3.56 I had these on hand from fixing a Samsung TV about a year ago. Pack comes with 50 / Will discuss why this was added later.
3 colors22 ga hook up wireAmazon$20.0Stranded wire works the best for the LED strips.
63 Pin JST ConnectorAmazon$9.88We use these to connect the LED strips together.
4Breadboard Jumper or Solid Core WireAmazon$7.10These are what I used / Again you can use some 22ga solid core wire and cut to length as needed.
1SmartThings HubAmazon$49.99 - $99.00Currently on sale for $49.99
50Led Strip Silicon ClipAmazon$5.30These come in a 50 pack
100#6 1/2 " to 5/8" Pan Head ScrewsAmazon$6.46These are for sheet metal but will work for wood as well.

Step 3: Powering the Arduino and LED Strips

This is the step that took a major change from the last project. In reading and learning about neo pixels I learned that rapid addition or removal of power to the LED Strips could end up damaging the first pixel and burn it out. AdaFruit recommends placing a capacitor in the circuit before the strips to prevent damage. They also recommend putting a resistor before the arduino on the data line.

So the first thing we are going to do is build or after main power power supply for the project.

Again I kind of lucked out with what I had laying around but the mounting holes on this breadboard ended up lining up perfectly with the holes on my arduino case. You can watch the video or follow along below for how to build this piece. The only thing the video doesnt cover is the resistor.

  1. First lets gather the materials. The breadboard, screw terminals, wire, and capacitor.
  2. Next we need to connect the a few wires from the common power rail in the center to the outside. Keep in mind these wires should be inserted from the bottom for clearance.
    1. Make sure that the wire on the outside is cut off just enough so it doesnt go all the way through. Enough to be in the hole but not enought to fully protrude.
  3. Now we need to do the same thing for the ground common rail. Keep in mind these wires should be inserted from the bottom for clearance.
    1. Make sure that the wire on the outside is cut off just enough so it doesnt go all the way through. Enough to be in the hole but not enought to fully protrude.
  4. Next we can bring over our small screw terminal
  5. Notice how both the Postive and Negative Rails will light up to show they are connected when you click on either of them.
  6. Now we can bring over the large section of the screw terminals to the positive rail.
  7. Again notice how everything lights up to show connection when you click on the terminal
  8. Now bring over the smaller screw terminal and put it in the negative/ground rail.
  9. Same thing occurs when clicking on one of the terminals to show connection
  10. Now we can bring over our capacitor, make sure the negative lead goes into the negative spot.
  11. Again we can check connection on both the positive and negative rail.
  12. Additonally Adafruit recommends a resistor on the data line, so we took another screw terminal and a 330ohm resistor and jumped between the two pins on the terminal.
    1. First the resistor
    2. Now the screw terminal.
      "
  13. Now that everything is on the board we need to flip it over and start soldering everything on. Once this is done. We can move on to the next step.

Step 4: Putting Electronics Together.

Now we need to build our arduino case, install the arduino into the case and put the SmartThings Shield onto the arduino. My case was not the best for this as it leaves too much space at the top and does not allow the shield to connect. I made some modifications by putting some taller standoffs under the arduino so that my shield would fit. This kind made the top of the case not sit flat but at least its somewhat covered. Again luckily my PCB breadboard perfectly fits on the arduino case so stuff isn't floating around.

Also we split our LED Strips in half so that I can put two smaller LED sections in each shelf section. then we removed the very end sections of each LED strip and soldered 3 pin JST connectors so that we can plug them together.

Now we need to move onto connecting everything. Check out the full schematic image to see how everything is connected. See the difference? We removed all of the relays and connected the LED strips in a line. With this we only need one pin to control the LEDs and we can still turn off sections if we want to through the code

UPDATE: Looking at the schematic view, I put the data wire to pin 13 on the Schematic, It should be going to pin 12 on the arduino

Also note how we run an additional power and ground to the very end of the LED Strip. Why? Well this ensures that we don't get dim LEDs at the end of the strip.

Great everything is connected, but nothing will work.Onward...

Step 5: Need to Download Some Libraries for Arduino.

We need to download two libraries for the Arduino for the SmartThings Shield and for the LED Strips.

For the SmartThings Shield go to http://docs.smartthings.com/en/latest/arduino/ to download and install the library, don't forget to download and install of their examples as well. Instructions are on the link provided

For the LED strip RadioShack did have a library but in all honesty it isn't the greatest. Last time we went and got the Pololu LED strip library. This time we switched over the the library from AdaFruit https://github.com/adafruit/Adafruit_NeoPixel because it seems to be a bit better and easier to code. Again instructions are on the link provided.

Another helpful program for the SmartThings side of things is Notepad++. With some modifications you can make the syntax highlighting work for the .groovy file we need to create for SmartThings. Or you can just use the SmartThings website which does the highlighting as well. To make it work with .groovy do a google search for ".groovy and notepad++"

Step 6: Arduino Sketch and Connecting to SmartThings.

In the last instructable we combined a few too many steps into one and I think it may have been confusing so in this step we are just going to focus on the current code and connections. You can also take a look at the

  1. First lets connect the arduino to the USB cable and to the PC.
  2. Now download my arduino sketch attached to this step.
  3. Open it in the arduino IDE
  4. Make sure that Arduino Uno is selected
  5. Along with the proper port for the connection.
  6. Upload the sketch to the arduino.

Now that we have our sketch uploaded to the arduino we need to connect the Arduino as a "Thing" to the SmartThings Hub.

  1. Open the SmartThings App on your phone or Tablet.
  2. Click the tab that says "My Home"
  3. Make sure you are on the "Things" tab and click "Add a Thing"
  4. You can let it find it automatically or Manually. Personally I find it faster for manual.
  5. Click the manual button.
  6. Scroll to the bottom and click on "Other"
  7. Now select the "SmartThings Shield for Arduino"
  8. Then "Connect Now"
  9. SmartThings should find the Arduino and add it.
  10. Create a name for your device.
  11. Click "Done"

The Arduino will have no functionality at this point. Tally-ho....

Step 7: SmartThings Device Handler

Now we need to dive into the device handler on SmartThings. I'm new to this part so this was the most difficult part for me. Some of the code might be able to be a bit cleaner but it works none the less.

Another change we made in this version starts here. Instead of having the tiles of all the colors always be the appropriate color, I wanted to be able to open the App and tell what color was currently on so we made some state changes for every color. Again you can step through the code with me on the video. Or just follow the steps below to use my code.

  1. Open www.graph.api.smartthings.com
  2. login with the same user name and password that you use in the app and when you set up your account.
  3. Click on "Device Handlers"
  4. Click on "Create new Device Handler"
  5. Click on the tab that says "From Code"
  6. Open my groovy file attached to this instructable in a text editor or if you downloaded notepad++ use that.
  7. Copy all of the code from my file
  8. Paste it into the code editor on smartthings.
  9. You can edit the name here as noted below, then click create
  10. Click on "Save"
  11. Click on "Publish" then "For Me"

Now our code is in SmartThings but the Arduino still will not do anything.

We need to change the device type of the Arduino to our new device handler.

  1. Click on "My Devices"
  2. Click on "YourDeviceName" for SmartThings Shield
  3. Once it opens click on "edit" towards the bottom.
  4. In the "Device Type" drop down select the new device type we created.
  5. You can also update the room from here by clicking on Group
  6. "Click on Update"

Hence Forth good gentle people.

Step 8: Testing Everything on the Desk

Now we need to run some tests on the bench and make sure everything works.

Yay it works!

Ahead full steam.

Step 9: Time to Mount Everything in the Shelf.

Now that everything is working we need to go ahead and mount these LED Strips and the arduino into the shelf.

I took some little rubber brackets made for LED Strips and some #6 screws to mount them into the shelf. We install one strip that has been divided into two pieces into each section of the shelf.

Since the shelf is already somewhat divided it gave me a place to rest the arduino.

Now we made an extra long power wire to run from the shelf to behind the desk and hid it with a cable hider on the white wall so it blends a little better.

Now that everything is mounted we need to hide it and make it pretty.

Step 10: Conclusion and Future - Finishing Touches on the Shelf

Our lights are now in the shelf and we need to run some tests. Take a look at the pictures and video to see how it all went.

I thank you all for taking a look at this instructable. It took a lot of time and effort and many "do overs" in order to get the documentation the way I wanted it and hopefully where it makes sense. Let me know what you think and if you made it.

Next Steps:

Now we need to add the finishing touches on the shelf. I debated a long time about how to do this and what to use. I debated about making these things myself but trying to match the color with lumber available to me was going to be near impossible. The next best thing was Michael's store and picture frames due to color matching and honestly my time constraints.

So I took some measurements of what I needed, went to Michael's and found a thick picture frame material and am having them made. I also bought some "Cracked Ice" plastic for florescent lighting fixtures from lowes and will cut it to fit the frames rather than using glass. After the frames come in I will add some hinges and magnetic catches to seal the thing off and hide any unsightly wires.

I will post some updates when the frames come in.

Make it Glow Contest 2016

Participated in the
Make it Glow Contest 2016

Epilog Contest 8

Participated in the
Epilog Contest 8

Arduino Contest 2016

Participated in the
Arduino Contest 2016

IoT Builders Contest

Participated in the
IoT Builders Contest