Group riding would be much safer if bikes had brake lights.  The lack of brake lighting on bicycles has lead to the audio cues of "SLOWING" or "STOPPING" being shouted at every turn.  While this may enhance safety, it certainly cuts into the serenity of a ride.

This project offers a viable solution that can increase both safety and serenity on a group ride.  With embedded programming made easy by the Arduino integrated development environment, electronics getting smaller, more capable, and cheaper, this project is possible for the do-it-yourselfer.

BEBL Challenge!  Be the first, and get your hardware cost reimbursed.  I will award a $35 reimbursement, by mail or PayPal, to the first person to post a video online that demonstrates a functioning and mounted Bar End Brake Light made from these plans.  Looking forward to seeing your project.

Design Criteria
Other than the obvious criterion -- light up when braking, I wanted this light to look cool, cool enough to mount on any expensive racing bike.  This rules out any visible wiring.  I also wanted the light to be portable, meaning it will work on more than one bike.  Thus no brake-lever specific triggering should be used.

The final design is centered around a 3-axis accelerometer board provided by Pololu.com.  This product is simple to use with an Arduino, small enough to fit inside the handle bars, and best of all cheap at $15.  Also, this accel has an on-board voltage regulator that we will take advantage of to power the whole circuit.

The processing takes place in an ATmega328 programmed with Arduino.  These chips can be also be programmed directly in C, but Arduino takes care of a lot of setup and generally makes programming less tedious.  Arduino has everything this project needs.  The ATmega168 would probably suffice for this project but the ATmeta328 at $1 more, provides 2X the program space.

Mounting the computer inside the handlebars provides an enclosure for the project. 

Step 1: Schematic, Layout, and Bill of Materials

The schematic and layout are included here for those who don't want to wade through detailed instructions.  This schematic is for a potential printed board in the future.  There was no room for the serial interface on this wired board so these elements can be ignored.  I've indicated the unnecessary parts on the schematic and have omitted them from the layout.  The slave LED D2 is not shown in the schematic but is placed in parallel to D1 as otherwise indicated.

Let me know if you are interested in a printed board.  We can combine orders and save!

Accel -- 3-axis accel breakout $15
6V battery -- Lithium 28L $5 each

S2 -- Surface mount right angle switch $1
IC1 -- AVR ATMega328 w/ arduino bootloader $5.50 (Consider getting this from ladyada.com, for her supped up bootloader)
LED1 -- Super bright LED red $1 each x 2
Osc1 -- 16 MHz oscillator  $1
28-pin DIP socket $1.50

Radio Shack
C1, C2 -- .1 uF ceramic cap
R1, R2 -- 220 Ohm resistor
Project board $2

Bar tape and plugs.

Total cost around $35, battery included.  I'm not including the cost of the bar tape, since you need to have that anyway.
<p>Hi Justin,</p><p>The IMU is no more available at Polulo. Which one can i use instead of that?</p><p>I`m currenly building a Segway and found that really cool as breaklight.</p><p>Best regards</p><p>Leo</p>
<p>Why not set it so that if acceleration is increased, you need a delay before the brake light turns off? Half a second should prevent flickers.</p>
<p>Hi WyoJustin,</p><p>I'm trying to make your brake system but with an other accelero (adxl335), I have change midpoint and sensitivity but i'm wondering about some calculations on the code: </p><p>- what info are down_x dans down_z ?</p><p>- what is the aim of this operation : val = -x * down_z + z * down_x;</p><p>- Why don't you only use X acceleration and trig this info ? On a bycicle you can only decelerate 'forward'? Do you have notice any false 'brake' during climbing on high grade hill ? </p><p>Thanks,</p><p>RzBo</p>
The link to the Arduino code is broken. Any chance you can post it here?
still here: <br>https://docs.google.com/document/preview?id=1o03JNsczAHO_7AqnSu-AJvdP9GMzGC792b4w4MKlCio
Am I the only one who looked first picture (especially the small one) and thought &quot;Who the hell wants Arduino powered Fleshlight?&quot;
Hey Justin-I own a bike shop in Austin, and I would love to get my hands on a printed circuit board to show some of my customers. Is there any way I can get a few.
Very good i'ble. Prize well deserved.<br /> Whenever trying to get a cord through any type of tube, get a vacuum cleaner at the other end and it will suck the cord trough! Done!<br /> I once succeeded to pass a cord through 15 meters of plastic pipe like this. In&nbsp; case of long pipes it is better to do any type of not at the front end (or tie any light plastic part) to increase air resistance.<br />
Thanks and great idea with the vacuum.&nbsp; I'll update the 'ible!<br /> <br /> Justin<br />
&nbsp;Very nicely done. &nbsp;Congrats on your win. &nbsp;I was asked to be a contest judge for the first time, and your project was my number one pick. &nbsp;Not only was it a great idea and a well written instructable, but Michael Jackson's &quot;Don't Stop 'Til You Get Enough&quot; put you over the top.
We were just discussing what might have put BEBL over the top!&nbsp; Thanks so much, I was truly surprised and am still in shock.<br /> <br /> Coming soon: a helmet mounted version.<br /> <br /> Thanks again!<br /> Justin<br />
*high-fives*!<br /> <br /> Way to go winning <a href="https://www.instructables.com/id/Light-Up-the-Night-Contest-Winners/" rel="nofollow">the contest!</a><br />
ill vote for this.<br />
<div style="margin: 0.0in 0.0in 10.0pt;"><span style="font-size: 12.0pt;line-height: 115.0%;">Great idea. Very interesting homemade project!</span></div>
Thanks for checking it out!<br /> <br /> Justin<br />
I love this 'ible!<br /> Instead of an arduino, (which I have NO experince with), would a small pressure xducer between the brake pad and its holder work to act as the switch?<br /> <br /> ... just thinkin'...
Thanks norrski,<br /> I think the best place for a switch is some where on an exposed piece of cable.&nbsp; You could attach a wire that will become disconnected when the cable is pulled for instance.&nbsp; Or if you could use a magnet and detector instead of a switch.<br /> <br /> Justin<br /> <br />
brilliant!&nbsp; I like the magnet idea... probably easier for me to configure than an arduino or pressure transducer... thanks again for some great ideas!
spark fun sells Hall effect sensors for ~$2 which goes high when a magnent is near.&nbsp; Same thing you bike computer uses. or you could use a reed switch...<br />
I woud totaly do this but I have bar-end shifters and you used an arduino.<br />
Perhaps I am not understanding the project, but wouldn't it just be easier to have the brakes trigger the brake lights like in a car? a microswitch mounted near one of the front brake arms would do the trick. <br /> <br /> I like the lights in the bar ends idea, I wonder if you could do a combo brakelight/headlight and use the arduino for triggering the headlight(s) when it gets dark.<br />
This is a great idea!. There are a couple of things you might consider.<br /> <br /> &gt;Are the lights visible from the vantage point of different types of vehicles? With only one LED per BEBL the range of visibility might be limited because the levels of the eyes of other drivers might not be in a direct line of sight.<br /> <br /> &gt;Have you considered that lights brake lights on most vehicles are located on the rear of the vehicle? Brake lights located on the ends of the handlebars might give a false impression of location to other drivers on the road. Remember, your safety is important. A slightly different example: remember when the brake lights of vehicle were located on on the bumpers or vertical trunk area? I believe the rear window brake light was an addition that greatly improved the braking visibility to other drivers.<br /> <br /> On the other hand, a BEBL is probabaly a good idea to keep so that when other vehicles draw near to the side of&nbsp;your bike, they can see you beside them.<br /> <br /> &gt;Dynamo vs battery - why not both? Recharge the battery with a dynamo.
playinmyblues,<br /> Thanks reviewing this instructable.&nbsp; This is actually a early prototype of the SharkFin helmet mounted brake light, which will be visible from the back of a large pack of riders.&nbsp; I like the bars in the mean time to provide a ready made, free project case.<br /> <br /> I agree, if your going to use a dynamo, use it to charge a battery!<br /> dynamo + battery = awesome<br /> <br /> Justin<br />
Hi,<br /> Instead of powering it with a battery - why not use a small dynamo/generator that is powered by the bikes movement ? <br /> - after all, this really good idea would only make real sense if/when the bike is moving.<br /> <br /> Removing the need for a battery (that most likely have gone dead by the time you need it)&nbsp;would make this practically maintenance free.<br /> <br /> You should try to make this a commercial product - lots of potential, mate&nbsp;!<br />
yes, but then, when you brake, it would stop charging, and the lights circuit would shut off due to lack of electricity, which would defeat the whole purpose. it would only work if you are moving, but if you are slowing, it would not work as efficiently.
Braking would make it stop though - your still moving.<br /> <br /> I also think there is enough gadgets around that would allow enough charge to be stored so even if the bike comes to a stop it will still work for x time.<br /> <br /> The point I tried to get across is that the battery would be the weakest link - try to find a way to make it almost maintenance free.<br /> <br /> cheers<br />
yes, now that I think(wow!) you could have a supercap or something.
yepp, and if you tie the supercap to a small generator (solar is popular to :) and remove the need for a battery you would be able to store a lot of power - practically maintenance free, mate!<br /> I&nbsp;guess the little wiring needed easily could be sitting inside a standard bike frame - no exposed wires.<br /> <br /> I&nbsp;think you should try to make this commercial - if nothing else you ought to protect the the idea - then sell it to some rich Chinese company for big $$$$ - When you do I&nbsp;wouldn't mind getting a share :) - At least so I&nbsp;can send my kids to a good school or something :)<br /> <br /> cheers<br />
lol, I know right? big $$$$$$ :)
...and here's another novel expansion to this - why not connect it to a relay that allows the lights to flash - like a warning hazard<br /> - You could create a small semi flexible rubber/plastic extension that would fit into a standard handle bar (standard bar i.e a straight one commonly used on most street bikes (non racing ones)<br /> The bend should be pointing backwards once its inserted into the handle bar - Alternatively this could also be a complete replacement hand grip- I've tried to draw a rough sketch on what I&nbsp;am thinking.<br /> <br /> <br />
ghostWolf59 --<br /> <br /> I like your idea of using a dynamo.&nbsp; A friend had the same suggestion and I&nbsp;included it in the improvements section with a link to this <a href="http://www.peterwhitecycles.com/Schmidt.asp">power generating hub</a>.&nbsp;&nbsp; This would be a great project to add this to BEBL!<br /> <br /> Justin<br />
Using the system you have created, and the single lithium charging board from sparkfun, you could create a system for headlights and brakelights that can be charged via USB (or wall wart adapter(or). I have some 1 and 3W cree type LED torches that make good headlights, I just need to work out how to make them flash. Not a simple flash, but push the button once for full power, push again for flash etc. <br />
Cool idea. &nbsp;How does it respond to irregular pedaling, such as pedaling slowly up a steep hill? &nbsp;Also, I think that it is debatable as to weather it should blink when not braking. &nbsp;If they are intended for use within a group of riders to warn when slowing down, then I think that they should remain completely off unless slowing. &nbsp;If &nbsp;they are intended as a warning to motorized traffic, then the blinking is&nbsp;warranted. &nbsp;
claytonpbarrows,<br /> Thanks, that's the best question I've had on the BEBL. There are actually 4 IIR filters running at about 650 Hz, all on that micro! Two really low pass filters (X1 &amp; Z1 -- intrack &amp; up) track the accel due to gravity. I know the unit is to be fixed to the bike so I don't expect any really rapid changes in the down direction relative to sensor. Slow changes like transitioning from uphill to down hill are in the pass band. <br /> <br /> The other two low pass filters (X2 &amp; Z2) filter out road vibration, bumps and accelerations from peddling but braking is in the pass band.&nbsp; This causes a slight, but acceptable delay in the trigger.&nbsp; You can probably trick the brake light into coming on with slow, hard pedaling.<br /> <br /> Suppose we assume that down is given by the unit vector [X1, Z1], then forward will be orthogonal ~ F = [-Z1, X1].&nbsp; We measure breaking by dotting [X2, Y2] against F.<br /> B = [X2, Y2] . F.&nbsp; If this signed quantity exceeds a threshold of about .04 Gs we turn on the brake lights.&nbsp; Because it is signed we can distinguish between lowing down -- braking and speeding up -- accelating.<br /> <br /> You may be correct about the flashing when not braking.&nbsp; Since this is still a proto-type I like to know that the unit is at least powered up.&nbsp; I could add a jumper for flashing vs not flashing.<br /> <br /> Thanks for your comments!<br /> Justin<br />
Very well done instructable.&nbsp; First time I've seen one with debugging instructions!<br /> <br /> I'd like to make one that attaches under the seat, like most bike lights.&nbsp; This would make switching back and forth between bikes a snap.&nbsp; I&nbsp;guess you were trying to avoid the issues with building/reusing an all-weather case that could be needed there.<br />
SiliconFarmer,<br /> Thank you very much.&nbsp; I'm glad you noticed the debugging section.&nbsp; You shouldn't have much trouble with your seat post mounted version.&nbsp; The bar ends were just easier and I didn't have to tear up a functioning light.<br /> <br /> I'd like to get around to making a version that is helmet mounted which would be even more portable.&nbsp; Even more hardware is required for this solution.<br /> Justin<br /> <br />
This is cool. compact and useful.&nbsp; I&nbsp;like to see with power generated or batteries charged by bike movement. <br /> <br /> I&nbsp;like the stepwise video ...<br />
smandal,<br /> It seems like we are converging on to versions: a dynamo powered commuter version and a battery powered version.&nbsp; For the battery powered version, it seems like there is enough room to mount a mini usb port to charge a battery without dismounting the unit.<br /> <br /> Thanks for commenting!<br /> Justin<br />
Very neat. <br /> <br /> -Joe<br /> <br />
Thanks Joe!<br />
You know what would be safer? If large groups of people without lights or reflectors didn't ride at night on a dark trail, on the wrong side of the road!<br />
I had to watch the video twice to figure out where the lights were mounted.&nbsp; Ya cannot see them unless you know. Accelerometer idea is cool, 1 LED each is a bit lame.<br />
dacarls:<br /> Thanks for checking it out.&nbsp; I was actually pleased with the fact that you could see the LEDs at all, given the fact that the video was taken in broad daylight from a hand held camera from a trailing bicycle.&nbsp; TREK also used a single LED on each side in <a href="http://store.trekbikes.com/jump.jsp?itemID=1531&amp;itemType=PRODUCT&amp;path=1%2C2%2C4%2C15%2C478%2C480&amp;iProductID=1531">their light</a>.<br /> <br /> Thanks again.<br /> Justin<br />
I am not a cyclist myself, however I support several large rides with communications support in North Texas primarily the following rides: MS150, Tour de Cure, Cross Timbers Classic, Turkey Roll, and others as they are held. What I notice is that those riders are more interested in reducing their weight, going faster, and completely disobeying all road rules and even state laws.<br /> <br /> I unfortunately, can't see many of the hardcore cyclists even considering this project because of the added few ounces. <br /> <br /> From a Communications side of things I would prefer to have knowledge of where each rider is in the course, say perhaps Smart Tags?&nbsp;<br /> <br /> Neat idea, but I&nbsp;think you need to do a little refining, you have a lot that could potentially fail where simple switches could work more reliably. Also, I would recommend mounting under the seat. Wires would still be hidden but, you would have the brake lights in an area where people would be more ept to look.<br />
KD7CAO<br /> Thanks for checking out the BEBL.&nbsp; I hear you on some cyclist view on added grams.&nbsp; The BEBL is not intended for racing where weight would be of most concern.&nbsp; I've known several serious riders (and even a pro rider) who use this <a href="http://store.trekbikes.com/jump.jsp?itemID=1531&amp;itemType=PRODUCT&amp;path=1%2C2%2C4%2C15%2C478%2C480&amp;iProductID=1531">light</a> for evening and night riding.&nbsp; The BEBL would weigh about the same.<br /> <br /> Your assumptions about relyability are reversed from my experience.&nbsp; Moving parts are far more susseptable to failure than the accel or micro on the BEBL.&nbsp; <br /> <br /> Also, jerry rigging the switch posses its own problems.&nbsp; Designing a elegant solution that will work with several brake lever manufactures, mount and unmount easily posses engineering challenges far exceeding those I&nbsp;encountered developing the BEBL.<br />
Tracking riders on course can be done, Britech from Nova Scotia do this sort of thing (see Ride The Lobster)<br /> with all riders having the same additional equipment there is the same penalty to everyone.<br /> <br /> (with no knowledge of electronics) I would think a brake lever-activated brake light would be much simpler. Great for fixies though.<br />
Excellent idea.&nbsp; What if I don't really want to make this, but I do want to purchase one for my bike-riding family members? As a mom, I have always worried about the lack of a brake light and this would make me feel a&nbsp;lot better.&nbsp; Thanks for the idea.
Thanks Mom!<br />
Perhaps I missed it, but how exactly do the lights behave?&nbsp; When it senses deceleration the lights turn on, but what happens when I come to a complete stop?&nbsp; Do the lights stay on until I accelerate again, or do they turn off when stopped?&nbsp; I'm thinking of using this in traffic where an &quot;active&quot; brake light might be more useful than the super giant blinkie I already have.<br />
&nbsp;The lights flash about twice per second when not breaking. &nbsp; When braking is detected, the lights go solid red until no more decelerations are measured. &nbsp;This could be because you let off of the brakes or because you stopped. &nbsp;Then they resume flashing.<br /> <br /> I think for car traffic the giant blinky is great. &nbsp;As far as cars are concerned, you are a hazard regardless of whether you are braking or not.<br /> <br /> Thanks for commenting on this project.<br /> <br /> Justin<br />

About This Instructable




More by WyoJustin:Night and Day Clock! Bar End Brake Light: BEBL POV on Basic Stamp 
Add instructable to: