My brother recently got a Yahama Bolt, a fairly new-model, medium-sized motorcycle. As is the case with most motorcycle riders, "preventing invisibility" is always a big deal as it is often the case that casual riders of bikes of all sorts (motorized or not!) tangle with a car when the driver of the latter didn't see them!
Among a few other things done to enhance safety and visibility, he wanted to "modulate" the brake light - that is, rather than just going on and off with the application of the brake, that it do "something else" as well.
It is becoming more common that some new-model vehicles blink their brake lights in some sort of attention-getting flash sequence - and doing so makes a lot of sense: The human brain is very good at detecting when something changes or is out of the ordinary so anything that stands out from the routine is likely to grab a bit of extra attention! The hope is that if even a single driver is jolted out of a sleepy stupor or their attention drawn from their texting by this sort of thing that it will be worthwhile.
First, the obligatory warnings and weasel words:
- The brake light system is a safety device on which your life - and the lives of others - may depend. Modifying it in any way runs the risk of reducing its reliability, particularly if due care has not been taken during design, building and installation to maximize reliability.
- There are no warranties or guarantees, expressed or implied, as to the suitability of this project for its intended use, or for any other use.
- Nothing in this article should be construed as offering an opinion as to the legality of the use of this sort of device. It is up to YOU to determine if this device is legal/lawful to use.
- If you choose to construct a device similar to this, it is up to YOU to make it as reliable and safe as possible and YOU assume any risks should any injury to anyone occur as a direct or indirect result of this sort of device! The author of this article will not be held responsible for any injury or damage or other liability that might result!
- Improper design, construction and wiring could result in damage to the vehicle's electrical system and/or wiring as well as other safety concerns. YOU must assure that the work/modification has been done properly to minimize any risks as well as be aware that doing so may void warranties, reduce reliability, cause damage, etc.
- Finally, the assertion that a "modulated" brake light catching the attention of other motorists and possibly improving overall safety is an opinion rather than a statement based on scientific research or fact and anyone reading this page and/or taking inspiration from it should take it as such! It is up to YOU to determine if, in fact, this sort of project has positive or negative effects on overall safety!
- You have been warned!
Figure 2: On the bench, the unit in "dim" (tail light) mode. Click on the image for a larger version. |
First, we analyzed the existing brake/tail light assembly of the Bolt after removing it from the bike.
Using three wires for connection (including a black "ground" wire) it consists of an array of 19 high-brightness red LEDs and internally, it seems to be "diode-ORed" between the two voltage sources. If voltage is applied to the tail light wire (blue), the 19 LEDs light rather dimly and the entire assembly pulls about 40 milliamps at 14 volts. If, however, you apply the same voltage to the brake wire (yellow) approximately 400 milliamps is pulled and the result is enough light to give you a bit of a headache and cause you to see red and green spots for several minutes!
Further analysis indicated that the tail light voltage was applied any time that the ignition key was on. As you might expect, the brake light voltage appeared only when you applied them: No special PWM (Pulse-width modulation) or anything else was present, this likely due to the fact that this light assembly was (probably) designed to drop in where one might have had an old-style, dual-filament incandescent lamp.
With its using only on/off voltages, this project would be easy!
The build:
Figure 3: Throwing together the code for the tiny computer. Click on the image for a larger version. |
As strange as it might seem, the easiest way to make a device that flashes the light in a particular pattern is to throw a computer at it!
Fortunately, this is something that is pretty cheap and easy to do these days and I knocked out some very quick "C" code using a compiler for a low-end PIC microprocessor - a PIC12F675. The device used was an 8-pin DIP (through-hole) processor chip (the same size as a 555 timer) that has a number of useful peripherals like A/D converters, built-in timers and a few other things - but I wouldn't need most of them: I picked it because it was the smallest, simplest microcontroller that I had laying around. Some of its features - like the watchdog timer and "brown-out reset" would be used to make sure that it "booted up" reliably and quickly within a few 100's of microseconds after power was applied, every time.
While the computer code could have been done in assembly, I used C since I have the development tools (suitable tools can also be found for free...) and it was be very easy to bang out quick, dirty, and reliable code just to blink the light!
In the code I defined an array of 0's and 1's in program memory that corresponded to the desired blink pattern (0 = off, 1 = on) and indicating the end of the array is a "255": The code would simply step through the array from the beginning and stop when it hit "255", leaving the light on. Between each step a short delay (25 milliseconds) was added to slow down the process and make the blinking perceptible: Without it, the entire sequence of blinks would have occurred in a few 10's or hundreds of microseconds and may not have even been noticeable!
Figure 4: Building the prototype on solderless prototype board for initial hardware and software debugging. Click on the image for a larger version. |
Note: In the diagram below, I happened to use pin 7 since it was closest to R3, but I could have used any one of the other output pins (shown with no connection in Figure 6) instead. Do not connect multiple pins together.
To keep the computer happy a 78L05 regulator (U1) was used to drop the 12-15 volts of the motorcycle's power bus to the 5 volts required. Because vehicular electrical systems are often "noisy" with spikes and glitches, I used a series resistor (R1, 47 ohms) and a filter capacitor (C1, 47 microfarads) to "clean up" the power applied to the regulator. These components were selected so that not only would spikes be filtered out, but even very brief taps and releases of the brakes would trigger or re-trigger the computer quickly and reliably. There is also another resistor, R4 which, should the processor NOT boot up for some reason, will pull the base of Q2 high and turn on the light since the hardware default of the processor is to have its pins in a high-Z state: After all, we do want the light to WORK if your life may be depending on it!
In just a few minutes I had a circuit and its code working on a piece of wireless prototyping board. After a bit more fiddling of the code to make it flash the desired sequence at the rate that my brother wanted, we were ready to commit ourselves to building a "permanent" version.
Once the circuit was built and tested I mixed a big blob of 5-minute 2-part epoxy and liberally coated both sides of the circuit board - this, to completely immobilize the circuitry to protect it from vibration as well as moisture. Constantly rotating the board for a few minutes to keep the epoxy from dripping off, it soon began to set up and I then used a heat gun to warm it (to about 180F) - just hot enough that I could smell the epoxy, all the while moving the board about since the heat momentarily caused it to re-flow. After 2-3 minutes of that, the hot epoxy had hardened to the consistency of a rubber pencil eraser so I let it cool. In another 10 minutes at room temperature it was almost rock-hard, the curing process having been greatly accelerated by the application of heat.
The unit was re-tested and found to be working so we could now wire and mount it within the tail light enclosure.
Figure 7: The tested and working board, now coated with epoxy and ready for install. Click on the image for a larger version. |
We now had the light on the bike and working!
What does it flash?
When programming the PIC processor, we changed our minds several times about what, exactly, it would flash. We first thought of the Morse code "V" which is "di-di-di-dahh" - like the beginning of Beethoven's 5th symphony.
We then tried the word "STOP" in Morse code and adjusted the speed to taste, ending up with a rate of about 44 words-per-minute so that the entire sequence completed in much less than a second.
Ultimately, we ended up with a different Morse message entirely, also sent at around 44 words-per-minute. This turned out to be a very short, two-word message - the first word being "OH" - the result being a very distinctive, bright, and attention-getting flash sequence.
Can you guess the rest of the message?
Getting the code:
FWIW, the HEX code for this project - targeted for the PIC12F675 and PIC12F683 - may be found at the link below.
By downloading this .HEX file you indicate your understanding and acceptance of all risks involved in using it, including those that might result in hazard to life and safety and that you have read and understood the warnings near the top of this post.
There are no warranties expressed or implied and it is up to the end user to determine the suitability and safety for their purpose!
Here are two .HEX files, one targeted for the PIC12F675 and PIC12F683. The code is identical in function, but allows the builder a choice of processors:
Note: It was "discovered" that with most programmers, the original .HEX code could not be used due to a hardware conflict with the !MCLR on pin 4. The .HEX code above and the schematic in Figure 6 have been modified accordingly by tying pin 4 to pin 1.
While I'm not prepared to build custom boards to be installed (it's a matter of time and liability) I can supply a pre-programmed chip at a nominal cost for someone who might be willing to build a board, themselves: Contact me if you are interested.