Friday 1 June 2012

Messing with LEDs

LED specifications. Don't you just love a good chart?
All this information is readily available on the internet, just Google it!
I have never been interested in electronics for electronics sake. Perhaps I should have been, as I would know a lot more about the general stuff now. For me, the electronics were a means to an end. I would build a kit or follow a diagram without really understanding how it worked, being satisfied in the knowledge that it did what I wanted it to do.

Way back in the days of rebuilding and tinkering with my old 1970 Ford 1600E Cortina (remember those?) I wanted to add intermittent wiper control. I could have just bought a unit and screwed it in place. In those days there were car accessory shops and/or motor factors on every corner. There was very little in the way of electronics built into a car then, even a top of the range model like my 1600E. The systems were mostly, if not totally, electro-mechanical. The wiper control had two speeds, too fast and too slow! Most cars of the period were similar so aftermarket bolt-ons were readily available and popular.

Not being one to go down the bolt-on-goody route I saw a project in Practical Wireless on building one. It looked simple, and it was, just a few components soldiered to a printed circuit board (supplied by PW) and it was done. The parts were duly acquired; the unit was built and installed. It worked fine and was still in the car when I sold it some years later. Yes, I had built it, and installed it but I had not bothered to find out how it worked. It probably explained all that in the original article but I would of skipped that bit at the time being more interested in improving the performance of the wipers than understanding how it worked.

Forty years on my attitude and interest has changed somewhat. For a start our vehicles are very different today. There are few places to buy car parts or accessories as most cars come with everything under the sun including hot and could swinging doors! And, they are full of electronics. The net result being, in the past I could strip down and rebuild a car (every last nut and bolt) and be confident that it would start when the key was turned. Not any more. Even the van has all sorts of electronic engine management systems incorporated and buried in the most inaccessible places. I now leave the automotive stuff to others and concentrate on the model making – much cleaner! These days I have the time and the inclination to try and understand what is going on, hence my revived interest in electronics.           
The LDR is located in the frog's mouth

Do you remember that pound-shop croaking plastic frog? I decided to have a go at using the croak output to drive an LED as had been suggested by someone on the EEV blog forum. I ‘extracted’ the PCB, battery box and speaker from the frog and discovered the LDR in its mouth was hard-wired and needed the application of the wire cutters to remove it. To test the theory, I set up a little experiment on a piece of breadboard to see what, if anything, would happen. A pair of leads were soldered to the speaker terminals and the other ends are plugged into a couple of tracks of the breadboard with an LED places across them.

Snip! that could almost make your eyes water!
I had already cut the LDR from the circuit while extricating the guts of the frog. I replaced the LDR trigger with a read switch, that just happened to be handy, as any movement was causing the LDR to trigger the frog into making three double croaks, driving me nuts! The read switch made it much more controllable. I could of used anything that would ‘make’ the circuit. The LDR has a minimum resistance if full daylight of approximately 100 Ohms and maybe I should have incorporated a 100 Ohm risister in series to the reed switch but it seemed to do the job without.

This is what a frog's croak looks like! I know, I must sort out some video...
 I should also of added a resisters to limit the current being supplied to the LED but I think the IC under the ‘blob’ must have provided some current limiting as it too seems to work OK. Measuring the voltage being applied I get an approximate maximum voltage of around 4V. A red LED of this size (5mm) is happy to operate at around 20mA (.02A) and has a forward voltage about 2V. All this information is available from data sheets or charts, readily available on the web, like the one illustrated at the top of this post. The voltage across the LED is Vs – Vf (supply Voltage – forward voltage) in our case this is 4 – 2 = 2. Using Ohms law (V=IR) transformed to R = V/I to work out the value of the resistor required:

R = (Vs - Vf) / A  =  (4-2) / .02  2/.02  =  100 Ohms

Now all I need to do is find a use for my discovery… Glowing embers, or a dodgy flickering light in the station’s waiting room.

LEDs and Meccano


Moving away from the model railway applications, Sue has always been keen on lighting our Meccano models. Suggesting she uses her 1935, boxed and strung, lighting kit may lead to a cries of “How could you?” and result in me having to cook my own tea for a week or so. Better look at a more 21st century solution. 3mm LEDs will, with a bit of persuasion, mount in a Meccano hole using a 3mm plastic LED clip. This is intended to fit into a 4.4mm hole but a spot of ‘percussive maintenance’ (to use a Dave Jones, of EEV blog, phrase) will get the thing seated. With this in mind, I decided to get the Arduino and breadboard out and have a go at prototyping the electronics. My mate Tim (chief programming nerd and all-round techie-geek) was here last week messing with stepper motors and we had the Arduino out to drive them – but that is another story – When he had gone the stuff was still sitting there next to the computer so I refreshed myself with what was going on and saved the ‘sketch’. Why Arduino insist on calling programs ‘sketches’ has passed me by. Maybe I am just getting old…

Four LEDs running light only needs one resistor
The Arduino software comes with several example sketches (Grrr!) one of which is an array of LEDs. The example sketch was written for six LEDs and the run is supposed to reverse, lighting the LEDs in a 12344321 sequence but I wanted to use two groups of four to simulate a simple running light by running in a 12341234 sequence. Having messed with the Arduino for about 36¾ minutes in total, I now consider myself an expert and duly modified the sketch to suit my needs – Confirming my total understanding of the subject the modifications worked first time – Nobody was more surprised than me! I now had my little experiment working using four LEDs and one resistor as only one LED is lit at a time.

Running lights working wired in parallel - not the best solution
Next, I need to expand the idea further. Initially, to extend the LED run I added the extra four LEDs in parallel to the existing array. Although this did work, as I discovered later, it is not the correct way to do it. Further reading illustrated that wiring LEDs in parallel is not a good idea. I am not going to try and explain the ins and outs here, as I am only a beginner on this subject myself. If you want to know more take a look HERE at The Electronics Club. This is a really good website for just telling you the basic facts and pointing the reader in the right direction.

That's better now wired in series pairs - works a treat!
A simple bit of rewiring and a recalculation of the resister value gave me four pairs of LEDs wired in series with a 68 Ohm resister. Calculating LEDs in series is simply a matter of adding the Vf of each LED and deducting it from the Vs. This figure, in this case  5 – (1.9 x 2) = 1.2, is then divided by the preferred current of 20mA (0.02A) giving a resultant figure of 60. As there is not a standard resister value of 60 Ohms the next higher value (68 Ohms) is used. I plugged it back into the power and off it went.

One more small step forward and some more knowledge gained has given me a sense of achievement. That’s enough electronics for now, time to get back to the modelling!

Ralph.

No comments:

Post a Comment