LED Laden Bike Helmet


Helmet Plus Bike Light



http://www.sparkfun.com/tutorial/LED_Helmet/final_small.jpg


Last week I was getting tired of forgetting my bike lights at home. Here in Boulder, CO there are laws stating that if you are riding a bike at night and get hit by a motor vehicle, no matter what the cause, if you do not have a front and back light you are responsible. Besides not wanting to pay for a motorist's car, I don't wanna get HIT! So with all this in mind I started learning about LEDs with the goal of putting some on my bike helmet. 


The Basics


Not everyone here at SFE is a electronics wizz. Yea, I know a little about Arduino and I pride myself on being  'decent' with a soldering iron but that's about it. For this little project I had to learn about how LED's work, what a current limiting resistor was and how to pick one out. I'll out line this whole process below...read on!

For this project I wanted to add two sets of LEDs to my helmet, three white ones in the front and three red ones in the back. I used these because the are super bright, relatively small and don't use much current (you'll see this explained later).

I grabbed these six LEDs from the shelf and snagged a battery to start playing with this stuff. What next? I don't know. To the internet Batman...

Searching for 'LED circuit basics,' this was one of the first pages I found, the diagrams are especially helpful. As the previously linked webpage states, when making an LED circuit you first have to decide what 'type' of circuit you are going to make, a series or parallel circuit. The choice (for LED circuits) depends on how much voltage your power source can supply. From the product descriptions I saw that the white LEDs should be used at 3.4 volts and the red ones at 2.4 volts. 

As the LED tutorial examples show, if I connect all the LEDs in series (one after another) with this battery I get-

3V (and example battery power) / 6 LEDs = 0.5 V/LED = 0.5 V per LED

Will half a volt for each led light it up? No, not even close. As the description said there needs to be at least 2.4 volts to even get the red LEDs to turn on. In order to light all of these with one battery in series, I'd need a 17.4 volt battery (3 * 2.4V + 3 * 3.4V = 17.4 V). Instead of hooking up two car batteries I should look into a parallel circuit.

Further down the LED Circuitry Tutorial the parallel circuit is outlined. Reading you'll discover that LEDs set up in this manner all receive the same voltage, perfect!! Looking at the LEDs I need a battery that can supply about 3.4 volts (highest of the two voltage ratings). All of our LiPo batteries supply 3.7 volts so it was a natural choice. Plus they are pretty small, good for bike helmet mounting.

Now before we go plugging LEDs into batteries, we have to take into account how the electricity will act once the LEDs are powered up.

With electronics when you attach something to a power source, for instance if you take a wire and touch both ends to the positive and negative side of a battery (NOTE: Don't do this!! It is only an example) you'll see some sparks and probably some smoke. This is because with nothing connected to use the power the battery provides, the wire is telling the battery to 'give me all the juice you have!' It's kinda like having one of those above ground pools and cutting a hole in the side, all the water is going to rush out as fast as it can, probably splitting the side of the pool. And same as with the wire, if you plug an LED directly into a battery, all the juice will flow into the lighting element and burn the LED out. This effect in electronics is called a 'short.'

So with electronics you need to have something limiting how much power the battery can let out, similar to adding a valve to our swimming pool (instead of a hole) so you can adjust how much water flows out so the sides don't burst open. The electronics equivalent of the valve is called a limiting resistor (limiting = what it does, resistor = what the component is called). Resistors come in different values, which indicates the resistive value - ie, how much juice will be allowed through. To figure out the value you need we have to get into some math, ready? OK, go.


Ohm's Law


There is a simple equation that governs how electronics components react when power is applied to them, it is called Ohm's Law. This interaction depends on three things, the voltage (how much water is in the pool), the current (how much water wants to flow out of the pool at once) and the resistance (the size of our valve restricting the valve flow). Here is the equation in all its glory-

V = I R

Here is each variable broken down-

V = Voltage (measured in Volts (V), just like you see on batteries)
I = Current (measured in amps (A), or milliamps (mA), 1 Amp = 1000 mA)
R = Resistance (measured in Ohms (?), 1 Ohm = 1 volt / 1 Amp)

Now we can apply this to our problem. In the helmet example I have six resistors all rated at 20 mA. So we know our voltages (of the battery and the LEDs) and current requirments so we just need to find out what R is in the equation above. With a little algebra we get-

R = V / I

Now you might ask what value for 'V' do I use. In Ohms law you need to use the voltage drop in the circuit. This means the voltage the battery supplies minus the voltage the LEDs require. That's easy enough but hang on, the LED's have two different voltages (red = 2.4 V and white = 3.4 V)! Well shoot, I'll just average what the LEDs ask for and call it good-

(3.4 +2.4) / 2 = 2.9 Volts

The only other bit need is the current. This is easy, just add up the current values (I) for each LED. Handy for me they were all 20mA-

6 * 20 mA = 120 mA

In order have the units match up right the current needs to be in amps, not milliamps. This is an easy fix, just divide the millimamp value by 1000.

120 mA / 1000 = 0.12 A

 Now we are ready to plug all this into the rearranged Ohms Law-

R = (3.7 V - 2.9 V) / .12 A

R = 0.8 V / 0.12 A

R = 6.667 ?

Since the resistors are not made for every single possible value a resistance can be, its ok to use something close by. Generally, a resistor rated up to 10% over your calculated number is acceptable. Perfect, I'll just hook up a 3.7 volt LiPo battery with a 6.8 ? resistor and I should be just fine...right? Well here is what happened-

http://www.sparkfun.com/tutorial/LED_Helmet/first_try.jpg
First try lighting the LEDs...what the?!
First off you notice only three of the six lights are on and only the red ones. That's strange. Remember when doing those calculations I assumed the average voltage drop for all the LEDs? By doing that I dismissed the fact that the two types of LEDs have different resistances. In electronics, the power (current) will take the path of least resistance. Just like it's easier for the water to rush out of the hole in our pool then to hold itself together inside the pool. From the picture it seems the red LEDs have a lower resistance then the white ones. To know for sure we look at Ohm's Law again-

For the three white LEDs-

R = V / I
Ohm's Law

R = 3.4 V / (3 * 20 mA)
three LEDs at 20 mA each

R = 3.4 V / 60 mA

R = 3.4 V / .06 A
remember we have to use amps for the equation to work

R = 56.667 ?

For the three red LEDs-

R = V / I

R = 2.4 V / (3 * 20 mA)
three LEDs at 20 mA each

R = 2.4 V / 60 mA

R = 2.4 V / .06 A
  again, we need the current in amps for the equation to work

R = 40 ?

As we expected, the resistance was lower for the red LEDs then the white ones. So how is it possible to light both sets up? We'll need two resistors, one for the red set and one for the white set so that the battery detects the same power request from both sets of LEDs. Since the power will be flowing from my battery, to the white LEDs first then to the red ones, the resistors can be in line and I don't need two separate circuits (see the pictures below). Here is what happened on the second try-

http://www.sparkfun.com/tutorial/LED_Helmet/second_try.jpg
Now we're talkin!
That's exactly what I was going for. It's a little hard to see exactly how this is set up, here is a diagram that is showing how its all wired together (I'll use a bigger battery for the actual usage, this picture was just easier to use)-

http://www.sparkfun.com/tutorial/LED_Helmet/led_circuit.jpg
The parts and wiring
This is what an electronics diagram would look like if you drew out this circuit with the proper symbols for each part -

http://www.sparkfun.com/tutorial/LED_Helmet/circuit_diagram.JPG
Ahhh!! What is that?!
You can see the LEDs have an icon that looks like a little arrow (the D1s and D2s). This is because the power can only travel one direction through the LED, all electronic 'diodes' act in this manner. LEDs come from the factory with one long leg and one short one (see this on the 'parts and wiring' picture?). The positive side of the battery (usually the red wire if it has a wire lead) needs to be hooked up to the long leg of the LED. You can see this on the battery in the diagram (BAT1), it has the + and - near it. If your LEDs aren't lighting up, check this first! The little squigely lines are the resistors (R1 and R2) and the straight black lines will be wires/connections. It's also nice to have red and black wires when you are connecting the parts...helps keep things straight.


...and they put him back together again...


Now that we have all that settled here comes the fun part, adding the LEDs to the helmet! I wanted this to be as low profile and as light as possible. Here is all the hardware I chose-

http://www.sparkfun.com/tutorial/LED_Helmet/parts_small.jpg
All the parts
As well here are links to all the parts on the SFE website (in case you want a closer look of course)-
You'll also need some hook-up wire to connect the boards together.

I decided that it would be good to have a switch as well so that I could turn the lights off, say if I was riding in the daytime. Doing this changed my circuit drawing a little-

http://www.sparkfun.com/tutorial/LED_Helmet/curcuit_w-switch_small.jpg
The circuit diagram
You can see the new component in the green outlined box. Having this blue print really helps keep things straight when you actually start putting things together. The different colored outline/boxes/curves in the above drawing will be different PCBs with the enclosed components on each.

Next I laid out where on the helmet where the different parts would sit and sketched out where the wires would go. I even went as far as holding the little PCBs on the helmet and tracing out their sizes-

http://www.sparkfun.com/tutorial/LED_Helmet/helmet_traces_small.jpg
You can kinda see the white marks
Next I took an old soldering iron tip and melted little notches in the styrofoam for the wires and boards-

http://www.sparkfun.com/tutorial/LED_Helmet/helmet_etching_small.jpg
The power of an old soldering iron!
This made measuring the wire to fit much easier. Which I did and had set to the side. As I made one board, I soldered the wire segments to it before I started on the next PCB. 

Next up was soldering the battery connector, first resistor and switch to the first PCB (the green set in the wiring diagram). I kinda shot myself in the foot here picking such small components. Soldering all these little bits together on such a small board was a challenge, I actually had to re-do it once 'cause I melted the JST (battery) connector-

 http://www.sparkfun.com/tutorial/LED_Helmet/switch_front.jpg
The front of the switch board...

http://www.sparkfun.com/tutorial/LED_Helmet/switch_back.jpg
...and the back of the board
To solder these parts together I referenced the wiring diagram quite often. I made sure to connect where the red (positive) lead of the battery plugged in, out the same leg of that connection on the connector to a resistor, then to a red wire coming off the board. Then I connected from the pin on the connector that connected the black (negative) battery wire to a black wire coming off the board.

Next on the blue print is the red box. For this set I took the green PCB and cut it in half since there were only going to be three LEDs on it-

http://www.sparkfun.com/tutorial/LED_Helmet/white_front.jpg
The front...
http://www.sparkfun.com/tutorial/LED_Helmet/white_back.jpg
...and the back.
You can see this looks very similar to the wiring diagram, a good example of hooking the LEDs up in parallel with solder.

Now on to the last PCB, the purple outlined box on the schematic.  This one was a little tricky since there needed to be a resistor as well-

http://www.sparkfun.com/tutorial/LED_Helmet/back_mounted_small.jpg
The red LEDs ready to go!
As you can see, after the last PCB was finished I started to mount them from the back to the front. Hot glue worked really well for this!


http://www.sparkfun.com/tutorial/LED_Helmet/front_mounted_small.jpg
The front, white LEDs

http://www.sparkfun.com/tutorial/LED_Helmet/switch_mounted.jpg
The switch mounted

http://www.sparkfun.com/tutorial/LED_Helmet/front_view_small.jpg
With all the boards in place!
Next I mounted the battery. I decided to use Dual Lock, a 3M product. This holds like no bodies business and doesn't get twigs and pine needles stuck in it like regular Velcro does.

http://www.sparkfun.com/tutorial/LED_Helmet/battery_small.jpg
The battery in place

http://www.sparkfun.com/tutorial/LED_Helmet/battery_open_small.jpg
The Dual Lock
Once I got all the boards mounted, wired together and checked to make sure they were working (ie flipped the switch), I hot glued all the wires in place to keep any hungry sticks at bay during my bomber night time down hill rides-

http://www.sparkfun.com/tutorial/LED_Helmet/wires_small.jpg
The wires hot glued near the switch circuit
And that wraps up this edition of making LEDs turn on, if you follow these simple instructions step by step they won't let you down!

Comments 10 comments

  • pstemari / about 14 years ago / 3

    Also, putting the LiPo on the outside of the helmet is just asking for fireworks in the event of a spill. That back ledge is somewhat protected, but you still run a serious risk of burning off half of your hair should you hit the LiPo in a fall.

  • photodork / about 14 years ago / 3

    I would be careful modifying the foam of the bike helmet as it could very likely weaken it.
    Especially in the rear. Some pretty important stuff back there, especially when it comes to riding a bike!
    http://en.wikipedia.org/wiki/Cerebellum

  • Member #198795 / about 14 years ago / 1

    Is this safe from rain? I cycle and I have been wanting to make something like this too but what about rain?!? I also want to put lights on the frame of my bike but I leave my bike outdoors! I don't leave my helmet outdoors but sometimes I am forced to cycle in the rain. Is there a way to make this waterproof? I mean it never really gets submerged in water but it can get really wet..

    • Pearce / about 14 years ago / 2

      I'd say no, but you can certainly use some silicon or something along those lines to waterproof it.

  • hikebikeclimb / about 14 years ago / 1

    This was a great tut! I have never really understood what a resistor actually does and the explanation using the pool was what I needed for me to get it and for it to stick.

  • Member #163973 / about 14 years ago / 1

    Apparently LiPo batteries get really grouchy if you let them discharge below something like 3V (as well as needing special chargers, but you've obviously got one of those.) Is there any easy way to design a circuit to cut the things off if the battery's discharged too much, or do you just have to guess, and recharge it while it still works?

  • NXTreme / about 15 years ago / 1

    You could drive the LEDs at a current that would still keep them from burning out even if one got fried. Example: Lets say that your trying to light up three 3V 20ma LEDs. If you drive each at 20ma and one burns out you'll probably be putting something like 30ma though each. If you limit this to 13ma to each LED you will put 19.5ma though each if one burns out. The more LEDs you add the more current you can handle if one burns out.
    But won't my LEDs look dimmer with less current? This link explains it better than I would. http://led.linear1.org/how-is-led-brightness-related-to-current/

  • JonathanL / about 15 years ago / 1

    ==QUESTION==
    On a separate note, I have heard that it is not preferred to limit several LEDs with the same resistor, as the failure of one LED will cause the others to overload. Is there a way of avoiding this without using an individual resistor on every LED?

    • Ilektron / about 15 years ago / 1

      You are right, but you don't have the whole truth. The problem is that unlike man, not all LEDs are created equal. Each LED will have a different forward voltage, the voltage drop across each LED could vary tenths of a volt.
      An LED is fully bright in saturation. In saturation it doesn't act like a resistor. Small changes in forward voltages can result in large changes in current.
      In practical application, if you limit the current with 1 resistor to 120mA, LED 1 sinks 20mA, LED 2 sinks 20mA, and LED 3 sinks 80mA. Even if each LED can take 60mA, LED 3 will burn out prematurely. But wait! We limited the current to 120mA which meant that even if 1 LED burnt out, we'd be fine (60mA * 2 = 120mA). Once LED 3 burns out, perhaps LED 1 sinks 40mA and LED 2 sinks 80mA. Pretty soon all your LEDs are burnt out.
      The moral of the story is that the only way to control how much current goes through each LED is a current limiting resistor for each parallel leg.

  • JonathanL / about 15 years ago / 1

    Interesting little project. Planning something similar myself. A couple of comments that could improve the tutorial.
    1. You state "power will be flowing ... to the white LEDs first then to the red ones", but your diagram shows the opposite.
    2. In the first part of the tutorial you are calculating the value of the LIMITING RESISTOR. In the second part, you are calculating the resistance of the groups of PARALLEL LEDs. This is a bit confusing as for how it relates to the selecting the correct resistor values.
    Each resistor and LED combination (red or white) will see the same 3.7V from the power supply. If the resistance of the LED array is LOWER, a BIGGER resistor (or combination of resistors) is required to limit the current. For the white it will be R1. For the red it will be R1+R2. This is why the white LEDs need to be "1st". R1 is actually used by both.
    I calculate R1 = (3.7-3.4)/.12 = 2.5 Ohm and R2 = (3.4-2.4)/.06 = 16.7 Ohm (approximately)