This is a robust low-voltage detection setup, managed with a PICAXE 08M2 microcontroller (and some supporting hardware) to manage the accessories on my motorcycle. Schematics, parts, and source code are at the end. I've also made a Custom Arduino-based LVD with the 8-pin ATtiny45, and A Simpler LVD with no microcontroller and static detection.

This project has also been set up as a "kit" at This email address is being protected from spambots. You need JavaScript enabled to view it. if you have any questions.


The problem: motorcycle batteries are barely strong enough to start a bike on the first/2nd try. The lowest-possible load on my battery is about 80-100W. High-beams are another 65W, auxiliary lighting is another 70-100W, heaters are 18-36W, plus a few watts here and there for things like brake lights, iPhone chargers, etc.

On my Bandit, this extra load can drain the battery in under 30 seconds, low enough that it can't be started. On a related note, I'm getting pretty good at push-starting this bike.

Analog LVD

I experimented with some simple LVD circuits -- see (this site is a great reference, BTW). The crux of the problem is that the load is pretty variable (see all the different potential accessories) and depending on the running state of the bike, the voltage can change fairly quickly. A static trimming POT and single detection circuit isn't enough to help determine whether it's "safe" to enable the accessories.

For instance, if the battery reads (say) 12.7V and we decide to turn on the accessory panel, the voltage will immediately drop to 12.3V or lower. The panel gets shut off, the voltage rises, and the cycle repeats. This can similarly occur while the bike is running at idle, with a sufficiently high load.

Side note: motorcycle charging systems don't really operate at idle. Most appear to be effective at roughly operating speed, which on this bike is about 4k RPM.

Microcontroller-based circuit

Based on a suggestion from Neil at REUK, I looked into the PICAXE line of microcontrollers. They're cheap, simple, and carry ADCs on board. I really only need regulated power for the part, and a transistor circuit to fire the relay.

{flickr-album}Type=Photoset, Photoset=72157627556722725, cols=5, rows=5{/flickr-album}

The source code is attached below. The algorithm is relatively straightforward -- there are set values for a cutoff voltage (immediately cut off the accessories if we measure at or below this level), a low water mark (cut off if the average level remains lower), and a high water mark (turn on the panel if the average level rises above this).

A simple queue is implemented to maintain history, and essentially buffer the on/off decision to dampen any oscillation. Between the queue and the high/low water marks, the system appears very stable.

An LED is included for feedback, with 3 flash rates, one flash per voltage sample. Faster flashing implies lower voltage. It samples / flashes fastest when below the low watermark, slowest above high. In practice this LED is not meant to be visible; primary feedback will be on power applied to the accessories.

The circuit itself contains several components:5V regulated power

      for the microcontroller, with a big (33uF) cap for conditioning the noisy bike power.

The reference voltage

      via a divider with 33kΩ and 10kΩ resistors, to bring the input voltage down to a measurable value (< 5V). Stator (battery) voltage range can vary up to 15V or higher, and the ADC measures relative to 5V.

An indicator LED

      which flashes at every sample. The software will sample frequently (every 1/2 second) while in the "off" state, and slower (~ 2.5 seconds) while "on". Net result: fast flash == testing, slow flash == on.

The switched line

      , which pulls a transistor high in the "on" state, enabling the ~ 160mA required for the relay. The transistor input (base) is pulled down with 47kΩ, and the control line has a 470Ω resistor on it.

New: a pushbutton

    for a simple interface to set new low- and high water marks.

Other interface options

Instead of encoded high/low watermarks, I could add trimmers and use two more ADCs: compare the input voltage to the high and low watermarks.

The pushbutton interface

The part comes "default" encoded with values that are probably appropriate for my bandit. But thanks to differences in bikes, or in parts in general (e.g. the 5% variance present in resistors) the values may or may not be ideal.

A single pushbutton has been added to provide live setup for the installed part.

  • the low water mark will be set with accessories on, engine off. Accessories would cut off if the battery gets this low for more than a few seconds.
  • the high water mark will be set at high idle or operating RPM. Accessories would be switched on in this range.

To set the proper low- and high water mark:

Turn on all accesories (grip heaters, lights, whatever). Press & hold to enter "set" mode, and the part will flash -- release the button. The part will:

  • flash once
  • engage the accessory panel
  • pause briefly
  • measure the low water mark
  • flash again
  • turn off the accessories

Within the next 60 seconds, start the bike (warm idle). Press the button again, and the part will measure the high water mark, and flash quickly.

If the low- and high marks look good (high > low) it will flash thrice quickly and save to NVRAM and restart.

If the high water mark isn't higher than low, it will flash slowly four times and return to normal operation.

To return the part to "factory default", press and hold the button -- it will flash once as it enters setup mode, and after 2 seconds will blink quickly and return to defaults.

The Demo:

A schematic is available in Google Docs, and there's a kit up at Club Jameco. Definitely drop me a note if you're interested in building this. It's pretty cool.