Custom Display Case Lighting
In my last post I briefly mentioned I’d been working on a little project for myself. Well I’m at a point I’m quite happy to share the results with everyone. Basically I’ve setup some controllable display case lighting using RGB LEDs. I can control their behaviour, colours etc using a C# GUI on my laptop which communicates with an mbed microcontroller over USB. Read on if you want to find out more about the system.
Display case lighting is something I’d wanted to do for a while now because it allows me to put this ‘to be’ Electrical & Electronics degree to use and also gives me a system I can use myself without being “graded” on it. Getting the correct components together was a bit of a pain what with everything shrinking in size. I also didn’t want to be using any solder, which makes the task of getting what you need even harder (wires for example). Luckily I’d been introduced to the mbed (an ARM based microcontroller that allows for quick prototyping) through my university and stumbled across the Shiftbrite RGB LED online. I gathered together all the bit’n'bobs I’d be needing for this project and set to work. This is the general plan I was working towards:
Techno-mumbo-jumbo below if you are interested or just skip this section. Check out the linked websites if you want to find out more.
The mbed itself is a neat little microcontroller which provides a huge range of features and data buses making it ideal for rapid prototyping. The mbed can be programmed without downloading any software packages because the required C/C++ compiler is hosted online and accessed through a web browser. This has it’s disadvantages (some very big ones like no debugger!) but for small projects like this the online compilier is good enough. It also makes transferring code between machines much easier. The mbed website also allows you to publish code for others to use and search through other peoples submissions, which again helps speed up development times. Need servo motor control? just search Servo and import the program.
In order to interface with other languages, such as C#, the mbed also has a set of RPC libraries. This allows you to remotely control the mbed without having to re-download a new C program every time. The disadvantage of this however is communication is rather slow, so sending huge streams of data up and down the USB cable isn’t a clever idea. Finding the correct balance between code on the mbed and the data sent over RPC is the key to creating responsive systems.
Shiftbrites are easy to use RGB LEDs with a shift register style interface. Data is clocked into the shiftbrite module serially which allows for the changing of LED colours and other features. The advantage of using Shiftbrites is most of the components needed to get one up and running are all built into the module (current controls, voltage regulators etc). This makes interfacing with digital systems very easy for the analogue inept engineers such as myself :lol:. You can also easily chain together multiple shiftbrite units and still have full control over individual units.
I’ll skip all the coding stuff. Basically I’ve setup a system that allows me to control the mbed over USB using C#. I’ve got a piece of C code in the mbed which performs the RGB LED control; and on the host computer I’ve got some C# code which provides a GUI to change various parameters. The result; control of a lighting system from a host PC.
Here’s a snapshot of my current GUI setup. RGB values are set as 10-bit numbers (0 – 1023), Current control can be set, and a little fading algorithm can be started. You can also select RGB colours from the standard windows color dialogue (that pop-up box in Paint where you choose more colours) and values are entered for your selected colour.
Display case wiring setup:
Ontop of the display case is wiring access, a breadboard, power supply and the mbed. You’ll notice the mbed is within a little motherboard, it’s not needed, I’m just using it because I have easy access to pins via screw terminals. This board is from my university and hopefully I’ll be buying one to keep once I’ve graduated.
Check out my ub0r wiring skillz. Top shelf:
I thought it would be a good idea to wrap the glass shelves in paper so if I decide to change things I can simply rip it off without damaging the glass. You’re going to spend most of your time looking at the contents from a distance and the top of shelf as opposed to the underside anyway. Second shelf:
The wiring snakes the underside of each shelf. Third shelf:
So how does it look when the power is on?
Red (low current setting):
The “fading” algorithm I mentioned previously will transition from one colour to another random colour infinitely. It looks quite nice, but static pictures don’t capture it unfortunately. I do however have this little test video you might want to check out.
And finally a video showing the system in operation (recorded at 720p, so watch at that res to see the GUI pop-up dialogues). It shows changing the colours from my laptop and a snippet of the fading algorithm at work. I’m a chicken and didn’t appear in the video or speak, my accent sounds embarrassingly more Scottish than when I hear myself so I cut it :oops:.
In terms of future developments I hope to be able to set different shelves to different colours, since currently when I set a colour it goes to all shelves. I had a piece of code for this, but it didn’t quite turn out as expected due to unseen problems on the analogue side of things. I also want to make it so the user can specify colour combinations to fade between as opposed to transitioning between random ones. I’ve got the mbed code for this, it’s just a case of working it into the C# GUI somehow.
Overall I’m quite happy with the results. I’ve still got some other features I’d like to add in and some weird behaviours to sort out (mostly analogue type problems, urgh). Sure my wiring could be neater and glass wrapping could have been made to look better on the underside of each shelf. Now that I know the system actually works I could improve on these areas.
So, what do you think? Also if you want any further information about mbed, shiftbrites or specifically this lighting system let me know in the comments. I’ve published some Shiftbrite code on the mbed website, but I’ve yet to publish this system and the GUI.