IOT Holiday Lights – The XMAS Tree

Living Room Lit Up

Preface

My project for the Internet of Holoday lights was based around our living room which was not very livable. It was a mess and with the upcoming holidays I wanted to set the living room in such a way that it would be suitable for entertaining guests. Additionally I wanted to accomplish the above mentioned in such a way that the holiday lighting becomes part of the living room and I don’t need to remove it after the holidays. Hence the concept of Dynamic Living-room Lighting.

In the previous posts, I have review the YUN and the infineon shield and have presented an overview of the project system. I also setup the place for the lighting with some homemade arts and crafts and give a preview of the system setup. I explained the Library I made for the Infineon Shield as well as the implementation for the MoodLights and made them Dynamic.

In this post I explain the placement of the Xmas Tree and how it fits into the living-room. The primary issue that plagues every holiday is that it goes away. I know a lot of people feel like the holidays just go away when you switch off the Xmas Tree. If only there was a way to keep the Xmas tree a part of the living room…

The tree that was… How to never leave Christmas behind!

I started with an artificial tree thats completely blank and had some bald spots. We bought some ornaments and stuff and made some of our own as well but the challenge was to light it up such that it can be reused. The whole concept of dynamic lighting is that you do not need to take down the lights completely. Trees seem awkward in the living room out of season and I needed a way to make the tree stay and become a permanent part of the living room. Now thats easier said than done and there is not much you can do to really make the tree look normal after the holidays BUT we can make the tree a little more dynamic. Once the lighting becomes part of the entire room and not just static lights that do nothing, we can take out the ornaments and make the tree as part of the home decor. That way the tree remains and the lighting change converts it into another living room decor or much much more. Lets see how we can do that.

Our tree initially looked like as shown in the image below.

d4f19e2701c44745c83a80daabcb94d5.jpg

Xmas Magic later….

I did an entire post about [Dynamic Living-Room Lights] Build Blog – Setting the stage and the result was a corner of the room which had a fireplace and a handsome tree.

745d407d79b54f52b0001f64d0cab059.jpg

The lights seen here are RGB LED strings and I used a total of 120 LEDs in this instance! They are the same as the NeoPixel from AdaFruit but I bought these from SeeedStudios. They have a single data signal connections along with a power and ground and that’s it! The ornaments are a mix of bought outs and handmade ones. My wife makes some pretty cool santa minions The gift boxes are empty element14 and Wurth Electronic boxes which I have accumulated over some time. Controlling the 120 lights is a whole other ball game. Lets see what it takes.

Tree Controller

A lot of people would say that I can use the YUN to control the lights directly but instead I had to use an arduino UNO/NANO for this task. There are two reasons why we need a separate tree controller.

The First Reason is that the YUN is expected to control RGB LED lights in accordance with the music being played. This means if I do anything else, it will cause additional delays and the whole effect will loose it’s glamor. I can use an analog circuit for the lights and equalizer but the Infineon Shield will be kicked out in that case.(DMX512- Next time baby!) Hence I need a dedicated controller for the tree lights.

The Second Reasons is that I have 120 LEDs which means that the neopixel library has to send a LOT of data on the wire which is a slow process. If I want to do something dynamic with the Lights then the code size will also be limited.

With that said, I resorted to making a individual controller for the Tree. The initial design used a wireless connection to send commands to the tree controller but I wanted to save some cost hence I resorted to using a wired USART connection. The image below shows my DIY Tree Controller in all its’ glory.

1bc2e2381d987e14b955941b12def032.jpg

The circuit and code is almost the same as the one by @sciguy14 with the difference that the tree again has Three modes  at the time of this writing.

Connectivity

The arduino YUN has an AVR who’s UART is connected to the Atheros Processor for communication which means no hardware UART. The UART on the USB is an enumerated type which means its only USB. The possible solution is to use a softserial which is to generate serial timing via software. The available libraries use timers and stuff which I don’t need. Hence I wrote the TX part in software myself because I don’t need the RX anyway. The communication is one way for now and my code uses no timers or interrupts and saves me some space too. I verified the timing using my tektronix scope which came in very handy!

33a12c3bc4484106fc5e8099065d0564.jpg

I also have a bus pirate which allows me to test some other serial stuff as well.

The YUN can hence transmit via Bit-Band UART and the NANO can receive it over it’s hardware UART. The YUN gets all the commands for itself as well as the tree over MQTT. I wrote a small protocol for sending data. In my experiment, the frame is a follows.

1. : – Start of Frame

2. I – Infineon Settings OR T – Tree Settings OR S – Shelf Settings (More on this later)

3. A – Audio Mode OR M – Manual Mode OR P – Pattern Mode(More on this later

4. R2 – Red Hundred’s Value

5. R1 – Red Tens Value.

6. R0 – Red Ones Value

7. G2 – Green Hundred’s Value

8. G1

9. G0

10. B2

11. B1

12. B0

13. # End Of Frame

Hence if I want my tree to glow white, I would send

:TM255255255# and that would make the YUN send a command to the Tree controller automatically. And if I want the infineon RGB LEDs to turn off, I would send

:IM000000000# and that will make the YUN send an OFF Command to the Infineon Shield.

The static mode

In the static mode, the tree controller receives color information and command over the serial port which makes the entire tree of the same color. This is particularly effective if I want the tree and ambilights to be of the same color. The color is selected via the OpenHAB color Picker as shown in my previous post at [Dynamic Living-room Lights] The YUN talks to OpenHAB

These lights work quite well but I needed a separate power supply for these which I did and it did and we all did!

The Dynamic Mode

In the Dynamic Mode, the audio feed coming in which makes the colors on the tree lights change accordingly. The circuit and code for this part is the same by Jeremy Blum in his tutorial and allows the whole tree to act like a graphical equalizer. I did a small video to explain the system till this point and is given below.

Beware of Bugs

I got the whole thing to work like I wanted it to but after some minor hiccups. If you want to make one of these, I suggest not making the string longer than 60. I had to reduce the clock speed to 400KHz for it to reach the entire 120 LEDs and that too was not very fast. I would recommend giving shift registers a shot at this point for the desired ‘wave’ effect. I will experiment with DMX512 and this configuration and will have a post in the future.

What Next?

I will be presenting the video demo in the final summary post and will try to setup a live video feed for the project which I will keep live for as long as possible. The next post is going to have a mood light shelf which I prepared and I will go through controlling it as well. Till then…

Cheers,

IP

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s