Samstag, 26. Mai 2012

Some corrections and an appendix

With your comments on Hack a Day I found out that there are some mistakes I made in the description and that I forgot some necessary details.

1. The LEDs are mounted on the upper edge of the PCB and the PCB is inserted vertically into the ground. (not horizontally).

2. Making the PCBs waterproof and preventing scratches:
    As I mentioned in the comments already: I used a protective varnish called "Plastik 70"
    (http://kontaktspray.hu/en/?Products:Protective_coating:Plastik_70_conformal_coating) I'm not sure
    what it is... probably an acrylic laquer (?). However, I'm not sure whether it's available for purchase
    in your country. But I'd recommend some kind of coating that can take temperatures of about
    60-80°C at least, since the driveway can get pretty hot in the summer. And also: Always use a
    varnish that is designed for electronic purposes. I heard about bad test results with hairspray.
    Additionally to the varnish I used a shrink-on tube to protect the PCB from scratches.

    So far this protection was able to withstand several (>20x) rainy days and thunderstorms. But I'll still
    have to wait to see how well it can withstand freezing temperatures in the winter.
    I would have used epoxy in the first place if I would've been sure about whether it would then still fit
    in between the stones. Also: I don't know how to make a good case for the epoxy to harden in the
    right shape. Any suggestions / experiences?

 3. I am soon going to add all the details about the mircocontroller board, the LED-PCB board, and all the electronic parts.

Donnerstag, 24. Mai 2012

The Driveway Lighting Project

1. Introduction

Some people have their driveway lit-up by lamps triggered by motion sensors of via remote. But I thought was is kind of boring, and I wondered whether there is another way to light up the driveway to our house. It somehow reminds me of what Doc Brown said in "Back to the Future": "The way I see it... if you're gonna travel thorugh time, why not do it with some style". So I wanted to add some style to boring driveway lights.


2. The Project

I wanted to build LEds into the driveway so that it looks similar to the runway lightings on an airport. A strip of white LEDs on the left and the right hand side of the driveway, which are able to flash up in a certain pattern (like a bright beacon running towards the garage), some white LEds in the middle imitatinc the lane separator and some green LEDs to indicate the beginning of the "runway". Static LEDs, meaning LEDs which don't change their brightness in a certain pattern are easy to build. But if you want to have some of the LEDs light up in a certain pattern, it's a little bit more complicated. All LEDs should be place in the ground between the stones of the driveway (ours is not tarred) and should only be directly visible in daylight, when looking at the driveway closely. The whole thing should be triggered by the garage door opener.


 
3. Wriring the LEDs

There are different ways of how to wire the LEDs to a microcontroller, which enables the LEDs directly or via an amplifier (e.g. an operational amplifier or an emitter follower) as for example: Charlieplexing direct wiring or serial wiring.
Just for the challenge and less wriring effort I chose the serial wiring. Serial wiring means connecting each LED to two neighbor LEDs. The whole LED strip is then hooked onto the microcontroller. Since that way it would be impossible the address each LED separately we need a special IC, the WS2801. It is a controller, which receives +5V, GND, a clock signal and a data signal and returns the clock and the data signal, delayed by one clock cycle. The datasheet (http://www.adafruit.com/datasheets/WS2801.pdf) explains it a lot better.

With the WS2801 it is possible to address a single LED in a serially wired strip independently. Hence this allows creating lighting patters with minimum wiring. For the main microcontroller, the whole LED strip basically acts like a big shift register containing the brightness value for each LED.
Don't get confused with the WS2801, it is actually an LED driver for RGB-Pixel applications, so it has 3 channels (which is why the register for each is 24-bits long, 8bits for every channels brightness).


An excerpt from the WS2801 datasheet

Some links on Charlieplexing:
http://www.instructables.com/id/CharliePlexed-LED-string-for-the-Arduino/
http://en.wikipedia.org/wiki/Charlieplexing

For the wires of the LEd strip I used the wires from a regular twisted pair cable (LAN-cable, preferrably the stiff ones). Compared to other wires, these were quite sustainable towards bending and pulling. (the part right after the soldered part of the wire is very sensitive!)

The LED's were mounted on top of a PCB (printed circuit board), so that the PCB is stuck vertically into the ground and just the LED is sticking out a little, like this:



4. Choosing a microcontroller

The microcontroller can be a very simple one. Since I'm a fan of Atmel µCs I chose the ATMega8, which tunred out to be completely oversized for the task, but meh... the important thing is: The controller has to be able to support I2C two times (one for each strip).




5. Brightness

Fully powered the SMD-LEDs I chose (3V, 20mA) are too bright to bare for a car driver. So I had to decrease the brightness by using a PWM signal on the input of the transistor which powers all the static LEDs.
In order to adapt the overall brightness of the static LEDs and the brightness of the LED strips on the left and the right, I used two potentiometers: One for the brightness of the static LEDs and one for the brightness of the LED strips when they are not in flash mode.
The brightness of the static LEDs correlate to the PWM duty cycle and therefore to the value of the first poti by:
static_brightness_PWM_value = poti_value/4
since the ADC returns values between 0 and 1024 and the PWM in the ATMega8 went up to 256 in my case.


6. WS2801-Library

There already exists a C++ class from Adafruit for the WS2081. It's free and downloadable at:
https://github.com/adafruit/Adafruit-WS2801-Library
There's no need to explain the Lib. The h-File does that already pretty well.

IMPORTANT: Do test the Library on a test circuit on a pinboard like this one:


Don't start making the PCBs or anything before you haven't tested it. It takes a lot of time to debug this!


7. Manufacturing the PCBs

The PCBs are designed such that +5V and GND are directly fed through to the next LEd driver (thick wire on top and bottom of every PCB).
In order to creat a schematic and a PCB-layout i used the freeware version of EAGLE.
http://www.cadsoft.de/download-eagle/?language=de
To manufacture the PCBs (single layer), I went to my University. (Thanks to my brother Daniel for helping me with that matter!).

After exposure the PCBs go into the etching solution 
(this one took me over 1,5 hrs, but usually it's less)

The PCBs after drilling. Now the only thing left to do is

Separating the PCBs from each other

If you need help with the PCB schematic or layout, just contact me in the comments.

8. An important component to success

In my case the wires between the PCBs were about 50cm. At this length the inductance of the wire plays an important role, because with digital signals from the microcontroller the wire pretty much acts like a nice antenna. The consequence is the breakdown of the serial connection between the LED-drivers (WS2801).

Solution: EVERY single PCB has to have a small (!) capacitor of about 50-100nF to compensate the inductive parts from the wire. Otherwise the LED strip won't work!

Btw have fun with the soldering, it takes a lot of time

A PCB unsoldered (left) and with soldering tin (right)




9. Power supply

For the power supply I used an oly one whihc was meant for a router. It provides 5VDC and up to 500mA, which is way more than needed. I removed the case and put the power supply direct into the plastic case, together with the board where I put the microcontroller on. By the way, it is always a good thing to put a large and a small cap before the power input to your microcontroller to prevent any damage from voltage peaks.
Since the power supply does not need a lot of power, I hooked it up to the light of the garage opener (which stays on with a 2min delay, when the garage opener is triggered). That way I didn't need any remote or sensor to trigger the LEDs.


10. Mounting the whole thing

This one completely depends on how your driveway is designed and what martieal is used (tar, stone...). I used a drill to widen the gaps between the stones a little, which was necessary, because:
1. otherwise you can't get the PCB between the stones
2. the stones will move over time, slowing but with a strong force. They will crush the cap or the WS2801 easily (already happened with mine).

When everything is mounted, it looks like this:



video
video



I hope you liked my project. Leave some comments if you like.

About my electronics projects

This Blog shows various projects on electronics I've been dealing with or have been developing for the past few years. I am a fan or the Arduino board, which is why I mostly use Atmel microcontrollers for my projects. Since I always try to come up with new ideas or improve the already existent one, I would be happy for any feedback concerning this matter.

Have fun!