Today the color is…

Orange!! ūüėČ

 

Well, it could just as well have been any other color of the 256*256*256 colors these RGB LEDs can produce, but since today is Koninginnedag, Orange was the most appropriate color I could think of for today.

The last 2 days I started with putting these RGB LEDs in the ground, under the gazebo.

Removing the stones to get the 20 meters of cable under the terrace, grit around the poles and putting everything back in place took me 2 days and I’m still not completely done yet; I think I need another afternoon for the ‘finishing touch’.

 

 

Just for fun I made a small beginning with controlling these LEDs from my system by using scenarios or lighting sequences; here’s what the “random” color scenario looks like:

 

I’m also going to use a remote for these RGB LEDs; I still have an old 433 MHz remote with 8 buttons that can be re-used to select the different scenarios. This remote will be attached to one of the poles of the gazebo so we won’t need to go inside to change the lighting.

With the Arduino acting as web-interface to the hardware, my domotica system and this remote I think we can really enjoy these RGB LEDs during those many upcoming long, hot summer nights!

Broken cables and Ethernet Shield trouble

It’s time for some work outside.. Last summer the play set ¬†in our garden with slide and swings was hardly used, so I guess the kids won’t miss it. The swimming pool has to be filled with water again, the pump has to be put back in its place, the terrace needs some adjustments and of course, the gazebo RGB LED project needs attention cause the¬†crate with the 6 RGB LEDs, DMX decoder & Arduino has been standing in the office since the end of last summer, so it’s time to finally complete this and get those 6 RGB LEDs where they belong – in the garden. I started with the last job ūüėČ

The first thing I did was completing the indoor part of it all, e.g. putting the adapter, DMX decoder, Arduino with 2 shields (DMX & Ethernet) in a enclosure.¬†This whole setup has already been tested with something I developed last summer. It had a Colorwheel control with which it was very easy to pick a color and control the RBG LEDs. But this is not enough; I still needed to integrate those RGB LEDs into my Domotica system. By doing that, my system is now in full control over the RGB LEDs and they can be controlled based on events, from the GUI (touchscreen) in the living room etcetera. This integration involved creating a Device Class for the RGB LEDs and a suitable interface to ‘talk’ to the hardware.

But not all things went as smooth as I had hoped. First, a power adapter cable was broken, which made the whole setup stop working every few minutes or so. It cost me half the afternoon to find out it was just a piece of cable that was bugging me…

I also applied the ‘Ethernet-shield-powered-from-the-adapter-plug’ fix I wrote about before, but it didn’t help enough. Sure, 4 out of 5 times it worked, but not always. And that’s not good enough, so I searched for another solution and I found one here, and this one worked always – well, successfully¬†powering up 30 times in a row convinced me that this works well enough. So now there’s a wire going from the RESET pin to pin 4 (the Ethernet shield is underneath the DMX shield).

Ethernet Shield fix

The code that comes with it is simple but very effective:

void init_ethernet()
{
 pinMode(DO_RESET_ETH_SHIELD, OUTPUT);      // sets the digital pin as output
 digitalWrite(DO_RESET_ETH_SHIELD, LOW);
 delay(1000);  //for ethernet chip to reset
 digitalWrite(DO_RESET_ETH_SHIELD, HIGH);
 delay(1000);  //for ethernet chip to reset
 pinMode(DO_RESET_ETH_SHIELD, INPUT);      // sets the digital pin input
 delay(1000);  //for ethernet chip to reset
 Ethernet.begin(mac,ip,gateway,subnet);
 delay(1000);  //for ethernet chip to reset
 Ethernet.begin(mac,ip,gateway,subnet);
 delay(1000);  //for ethernet chip to reset
}

Calling the init_ethernet() function from the setup() is all that’s needed to get a fully functional Ethernet Shield. Finally this RGB LED project is finished; well, I still have to dig 6 holes and get the RGB cable under the terrace – after that, summer can begin!

 

Success and failure

Today I continued with my “RGB LEDs for the gazebo” job; what would those 6 LED spotlights bring, in terms of light? How would it look? Well, here some images:

 

 

 

 

 

 

 

 

 

 

 

 

I wanted to see the result before I would start digging holes, laying cables under the pavement etcetera. Based on what I saw after sunset, the conclusion can only be: we have a Go! It’s exactly what I had in mind; which is a big relief actually, cause those 6 LED spotlights were quite an investment. But the result is wonderful, these LED spotlights light up the gazebo just the way I want.

I did have a big issue with controlling those LEDs though.. All the tests I did in my office with the LEDs on the desk next to me never failed. But today, with the LEDs, DMX decoder, Arduino+Ethernet shield+DMX shield outside it didn’t work anymore!? Everything was set up and ready to go, but I couldn’t even ping my Arduino anymore!

My first thought was that the new CAT5 cable of 20m length was broken, or the RJ45 connectors didn’t make good contact; but this was not the case, the cable was OK. Maybe it was the new Gigabit switch I received 2 days ago which hadn’t been used until now? Nope. What is this??

I took the Arduino back to the office, connected it to my PC for power and to the switch. And it worked again, just like it always did… although I did see the LEDs on the Ethernet Shield behave differently. Well, I won’t go into all the details, but eventually I found out that it was the USB connection that made the difference! Without a USB connection, I had to push the reset button on the Ethernet shield to make the shield work. With USB, the Ethernet shield worked immediately. Go figure..

What has USB got to do with a (dis)functioning Ethernet shield?? A lot, so it seems. What is this, a hidden feature? By design? I must have missed the addendum to the manual that says “This shield will only function with your Arduino USB port connected”… After I knew what was causing this problem, it didn’t take long before I found a solution – phew, this issue could have been a real party pooper! I haven’t tried the workaround yet, but I will. Very soon, as in tomorrow first thing!

Here you see me testing some colors, sitting behind my laptop under the gazebo:

 

Arduino DMX encoder on the test bench

Today I started testing my DMX project. The ingredients:

  • Arduino Duemilanove with Ethernet shield and DMX shield;
  • DMX decoder PX24500;
  • 24V PSU;
  • 6 x Artecta RGB LED;
  • some wires;
  • a sketch running on the Arduino;
  • UTP cable;
  • software tools.

After connecting all the wires, switching on the PSU, starting the Arduino and checking if the Arduino was succesfully connected to my LAN by pinging it, I was ready. I opened the Arduino IDE Serial Monitor so I could see what my sketch was doing and sent a “command” to the Arduino. For that I used wget, a non-interactive network retriever; most people who know Unix-like OS-es will probably know about its existence but it’s less known¬†among the Windows folks. Well, in just a few words it’s a tool with which you can store the results of a HTTP call into a file and do all kinds of other handy stuff .

I started carefully; the first command sent to the Arduino was:

 wget 

What this should do is change the R-value from its current value to 10 in 0.5 (5*0.1) seconds. G and B values are set to 0 immediately.

What the  Arduino webserver will receive is the following:

 GET /10,0,0,5,0,0 HTTP 1.1

 ....etc, the rest is all standard HTTP headers

After parsing the request and figuring out what to do, the Arduino starts changing the LED colour by issuing DmxSimple commands according to the values received in the HTTP call.

Ok, the moment of truth is here… will the LEDs start producing light or not? Yeah, they did!¬†Tadaa…

This is not Red (nor is it a pipe)

The moment I saw this working, I felt the need for a more sophisticated way to control the RGB values, so I wrote a small tool in Delphi to help me pick the right color:

ColorWheelToEthernet

With a mouse click I can now select the color; the rest is done automatically: calculating the R-, G- and B-value and performing the HTTP call. And all it took was 10 lines of code (with the help of Indy and a very nice Color Lib made by Marco Binic). This allows me to choose a color much quicker and more precise than by editing numeric values on a command line ūüėČ

I did find some issues during my first DMX adventure, so I haven’t reached the phase yet where I can start digging holes in the ground; I’m not totally satisfied yet – more on those issues later, when I’ve hopefully fixed them.

 

Stacked stock

Stacked shieldsHere you see an Arduino Duemilanove, an Ethernet shield and a DMX shield. Well to be honest, the top shield is 1 day old; the rest has been on the shelf for more than a year. I wanted to start using some of the stuff I bought in the past but never used, so with the need for a DMX encoder to control 6 RGB LED spotlights, I decided to do it this way.

It was a bit annoying that I had to deal with how the Arduino platform works with shields and that you have to find out whether you can stack more than 1 of them on top of the Arduino and not have pin conflicts between the shields you want to use; this can happen so it’s always good to have a look at the pins all the shields use and see if there are any conflicts. In my opinion, the JeeNode concept is much smarter and easier in this perspective – and documentation is much better too!

Now back on topic again… as I said, this combination of boards is going to be used as an Ethernet enabled DMX encoder with integrated web server. Sounds difficult? It’s not, actually…

The DMX shield (from the Arduino store, made by Tinker.it) uses the DMXSimple library and indeed, it’s very simple. All the hard work is hidden and all you have to do is use 2 or 3 simple functions to get DMX encoding working.

The same goes for the Web server part; the Ethernet library makes it as simple as it possibly can.

So all I had to do was write some code to parse the values I wanted to send to this DMX encoder (R-, G- and B-values and some time values to soften color changes); and now I’m waiting for the LED spotlights to arrive, cause I’m ready for it! Yep, that’s the other side of the story; you can build cool stuff in a matter of minutes, add your own code for some extras¬†and it works!

LED lighting for our gazebo

GazeboDespite all the Domotica stuff going on every day, I was able to find the time to build a gazebo in our garden this summer. I finished this gazebo in late June. Well, not quite; I still have to take care of the lighting. And somehow, everything I build or do in my spare time just has to have a Domotica touch¬†ūüôā This time, it’s the lighting. I could have chosen the easy way and just put a big bright light bulb in the middle for when it gets too dark outside, but that’s too ugly, easy and no fun at all.

So I contacted Marco Versluis of Mood LedLight and he offered to come over and have a look at the gazebo and discuss some options for some nice and good lighting. Although I’m not the type of guy who decorates the entire home inside and outside with flashing lights at Christmas time, I do like to have nice lighting in the garden during the time that it’s dark and we’re still downstairs; an example of this is a previous garden lighting project.

This time we chose to do the lighting with 6 RGB LED spotlights.RGB LED spotlight

At each of the 6 poles of the gazebo there will be a RGB LED spotlight which will light the pole and the inside of the roof. That should be sufficient to give good lighting while sitting under the gazebo on warm nights as well as a nice view from the living room when we’re inside.

OK.. I admit it, I just couldn’t resist buying a DMX decoder for those 6 RGB LED spotlights – so I can produce 256 x 256 x 256 colors, who wouldn’t want that in his back yard? ūüėČ And of course, these LED spotlights need to be controlled from my Domotica system, otherwise it wouldn’t be much fun, right?

I’m not worried about accomplishing this. I found a Arduino DMX shield that should take care of the DMX encoding. And since it’s an Arduino shield and I have some unused Arduinos here, this will be plug & play, hardware-wise. Developing a sketch to control it all from my domotica system shouldn’t be that hard either.

No, the thing that I’m thinking about most of the time is: what color should these LED spotlights produce? Just pick a color I (ehh, we) like? Neh, too easy. And I certainly don’t like some predictable color scenario that repeats itself every x minutes. Yuck!

Come on, my Domotica system has almost 900¬†device values, why can’t I create some RGB values out of all that constantly changing data and produce a real geeky lighting? (ah, that reminds me: I need a motion sensor for the gazebo and/or a button to override the geek-lighting scheme with something that’s more moderate and acceptable for non-geeks¬†… ūüôā

So basically, I’m looking for “something” that should produce a smooth changing, unpredictable RGB value based on device values originating from our house… There’s enough to choose from I guess… like using door/window open/closed status as bits for one of the 3 RGB bytes, or on/off statuses, ¬†motion detection, total power usage for the R value, water usage for the B value… ¬†well, I’m still thinking what to choose – suggestions are welcome!