Auto Bike Light: On When Moving Off When Not

If you’re plagued by perpetually dead bike light batteries you’ll like this one. It’ll also fix the problem of remembering to turn the lights on in the first place. This hack uses an accelerometer to switch the light when the bike is in motion.

In this case the bike light was chosen for its ability to fit the control board inside the case. But with this proof-of-concept you can easily spin a tiny board with uC and accelerometer to replicate the functionality (the Bluetooth module shown above is going unused in this application). Many accelerometer chips have low-power mode that can be used to was a uC so we could easily see this having very little impact on the normally battery life of your light. The one caveat being the need to regulate the voltage as many of these lights take a 12V cell.

The other alternative is to make sure your battery is always charging during the day. This solar setup is one way, but then you won’t want to leave the thing unattended.


72 thoughts on “Auto Bike Light: On When Moving Off When Not

      1. I would make it more than 60 seconds for cutoff but other than that it is not a bad idea. BTW I ever forgot to turn off my light but that is just me.
        Also a reed switch like a speedo might be a simpler solution.

      1. There’s probably a perfectly fine magnet & reed switch arrangement on the front wheel, use that.

        (Downside is worst case may take a full rotation of the wheel – 2 metres – before the lights come on.)

        1. Ok, now you need a switch that can be activated no matter which way the pedal is facing (excluding cleats etc) plus two more batteries that need to be replaced/charged.


  1. The blinky ball idea is good, in the KISS mode.
    I never have to turn my light off even in the daytime, it’s a dynamo light. KISS!
    Having a handy switch is good for being able to flash to get attention in special circumstances like a horn, as using a strobe light is basically illegal if not highly irritating.

  2. I used to have a front wheel hub generator, one night I was riding into the city and a “lovely” police “man” stopped me in a patrol car.
    My light of course went out,
    he said, “Your lights aren’t working”
    I picked up the bike, span the front wheel, lights came up, “See, they work!”
    Putting my bike down, the lights go out.
    “Your lights don’t work”

    Anyway, after more bullshit, I ended up with a traffic expiation notice for $75
    When I took it to court, along with my bike, the Judge was just as big an ass and it ended up turning into a $150 fine.

    1. Move to central or even eastern Europe (i mean Poland, Ukraine, Belarus, Czech Republic and so on). Life is safer (no guns, no *minorities*, no *minorities* with guns), we have pretty decent law and there’s no problem with police brutality.

    2. Bicyclists and police are notorious for those sort of run-ins. At least around where I am. Last years fight is an obscure law requiring bikes to have brakes on the front and rear axles or tires. No problem for most except couriors biking around the city on stripped down BMX-like bikes with rear peddle brakes and no front. Police were giving out tickets for lack of brakes. Fight went on for nearly two years until it dawned on someone that the police weren’t handing out tickets to young children who also only have one brake.

      The new fight is a new law that went into affect Oct 1st. Bicyclists and cars need to be separated by 3 feet. It’s backfiring since it is impossible for motorists or cyclists to comply when bicyclists weave in and out of traffic. Who gets the ticket? When is the ticket issued? What if the motorist is at a light and the cyclist comes within three feet?

      In a city where spare space is measured as three inches or less, finding three feet of space for anything, much less as a gap between moving objects, is an exercise in futility.

      1. Well, having only rear peddle brakes is very silly idea. Wait till the chain snaps (yes, that happens). Or the cog ring breaks (I’ve seen that as well). And then what? Hip and stuff is all cool, but this is also about safety of other people, who may not necessarily share the same “ah, it’ll be fine” pov.

        1. “Hip”?????

          rear wheel, back pedal to brake is called a coaster brake, they’ve been around since bikes were invented!!!

          Most bike shops sell single speed, coaster brake bikes

          1. Pretty much all kids bikes are coasters brakes.

            When you grow up you realise they’re crap, although some people never figure out it’s the front brake that stops you, not the rear one.

      2. Bikes shouldn’t be weaving in and out of traffic anyway. You’re a vehicle on the road, so play by the same rules as the other vehicles. (i.e. you’re NOT a “vehicle or pedestrian, whichever suits your mobility at this point in time”)

    3. UK law requires you to have a rear reflector for the very reason that when stopped at a junction your (traditionally dynamo powered) rear light would go off. Front reflectors are common but not (AFAIK) a legal requirement.

    4. @cyberteque
      How is that being an ass? You’re no less invisible at night when stopped than when moving, so having a light that goes out whenever you stop isn’t terribly useful.

      Unless you never stop, in which case you’re running stop lights/signs.

      1. I know they have gone out of fashion (thank freak) but remember those dynamo light sets, that used to come fitted on some bikes when you bought them?

        As for not being visible when stopped, intersections with traffic lights tend to be well lit, also that’s why we have reflectors!

        I should mention when I paid the fine at the cop shop, the desk copper asked if it was a candy striped station wagon
        When I told it was, he said “yeah, sorry mate. Those idiots are mad keen to fill their quota”

        I don’t know what it’s like where you live, but here cops are required by the department to get a set quota of fines issued

  3. Nice build. Rather than using the microcontroller as a momentary switch, you could program it to delay a few minutes before turning the light off. That way you won’t get run over stopped for a light.

    1. Most dynamo lights have a standlight function. There’s also a neat product called reelights, which use induction power generated by a large magnet on the spokes to charge a cap that powers them.

  4. Is it really that hard to turn the light on when you’re riding, and off when you’re not? I’ve been biking for many many years and mastered that vastly difficult maneuver in just under a minute. I love technology and making life better, but come on, are people really that stupid now days that they need help turning a light on and off?

    1. You could ask the same question about people forgetting to turn car lights off – and yet, it happens every so often. Not everybody is as consistently mindful of every little thing as you are.

  5. My old bike has the simple version of this, spring and a pole. It goes out after a minute or two of being stopped. The battery must be five years old. These are extremely common in parts of the world that ride bicycles a lot, or that never stopped.

    Anyway, I understand why he did it as the functionality is useful. If I were to have to make one of these, I would opt for the simple route. Maybe the hacker could use it log how many G’s they pull in a corner or something?

    1. You can get sealed versions of those now. Look on eBay for ‘vibration sensor’, they’re about 10 cents each. Also PCB versions that stretch the pulse for you.

      Tap them and you can feel the spring vibrating (some have balls, but they’re usually tilt sensors).

  6. Neat idea, but probably could be simplified. What about a microswitch in the seat? Drill a small hole through the underside of the seat moulding and position so it’s spring loaded or adjustable, and hook it up to a 3-minute timer.

  7. I very much like the idea – and I disagree that any of the various electromechanical solutions make it any simpler.

    The only problem I have with it is that unless your lights are actually bolted to your bike (and maybe even then), you’re going to have to take them with you when you park anyway, or someone will steal them.

      1. when I went to buy a CatEYE brand, I asked if they had improved the case design to make it more water proof

        The bike shop guy said “How much water are you going to ride through?”
        At the time it was mid-winter and I lived on a farm with a 5Km ride on dirt roads to get to town.

        I didn’t spend the $35 on a CatEYE, I ended up getting a really waterproof one from the local Jaycar store, which was $15, with 2x 3W cree LEDS

    1. That is really very cool. I can’t visualise how it works, though. What form does the induced magnetic field take? Where are the poles? How does the stationary coil generate energy from it?

      1. Try search “Eddy current” on Youtube, lot’s of videos explanning how it work,
        I was surprised how efficient it is,
        It can even stop a roller-coaster in high speed :-)

        1. I understand the general principle of eddy current – I just don’t understand how it’s used in this case. For a coil to generate a current, it needs a changing electric field. Where’s the changing field in this application?

          1. Ah. They don’t explicitly say they rotate, but that’s a bearing in the middle. Very clever.

            Surely there’s a way to do this without an extra moving part, though?

            I’d love to know where they get their claims of efficiency from, too.


        We’ve discussed Reelights and Magnic lights before, when HaD featured Berto and what seemed like a new kind of generator he’d invented for his bike. It’s all there.

        I’ll recap anyway. The generator works in the same way as an electric guitar, if you know how that works.

        Basically the Magnic device is a fixed magnet next to a coil. As the spokes move past the magnet, since they’re moving metal, a current is induced in them. This current in the spokes gives them their own magnetic field. The spokes’ magnetic field moves past the coil, which of course induces current in it. You take the current from the coil and use it to power things.

        It’s like a 2-stage indirect sort of generator.

        In an electric guitar the spokes would be the strings.

        1. The Magnic clearly uses the rim, not the spokes, to generate power, though. And judging by the patent, it does this by causing a ring of arc magnets with alternating poles to turn due to eddy current, and uses a coil of wire around them to produce AC power.

  8. A long time ago I read an article in the UK magazine “Everyday Electronics”. The article described a project with a control board and some NiCd batteries. You hooked it up to your bike dynamo and light.

    As you were cycling, the dynamo would power the light and charge the batteries. When you stopped, the batteries would power the light for a few minutes (long enough for most traffic light stops) and then turn off. Its operation was completely automatic.

    I built one and it worked, but I have never seen the circuit again. I thought it was quite cool. Anyone seen anything similar?

        1. not a link, but I could maybe dig up that issue of every day electronics.

          The circuit from memory was basically a charge pump with some current limiting into the NiCd or NiMh batteries.

          One thing I did notice was “torch” bulbs seem to last a lot longer if you put DC through them.

          I was going to build another one for my MTB, but bottom bracket dynamo’s don’t fit on MTB frames and I haven’t seen a hub dynamo in 30 years!

          1. Ok. I think I lost my copy of the magazine, but I thought the design was quite elegant (and useful). I don’t want to make one at the moment, but I think it’s one of those things that really ought to exist in the world consciousness as a Good Idea that anyone can take advantage of.

            There are only a few projects I feel this way about, but that is definitely one of them. Thanks.

  9. There is a way to do this using a ball bearing in a conductive tube. When the ball bearing runs to one end, it completes a circuit that energizes some relays and a capacitor. The capacitor acts as a timer. When the voltage drops too low, it cuts power to a relay that turns the system off. As long as the ball bearing goes back and forth at a fast enough rate, the system stays powered. Besides losses in the relays, it is very efficient.

  10. I went for a simpler solution: the hub dynamo turns on a MOS switch, with a capacitor keeping it on a couple of minutes after power is lost.
    Power is supplied from 2 sources: dynamo and batteries. When I am riding the power comes from the dynamo, while the batteries only kick in for the short time while you stopped. This way battery life is great, i replace them less than once a year.

    1. Actually no.

      Try building your idea.

      First you need to find a switch. Is there a commonly available one that clamps to the the handlebars, or are you doing to drill a hole through them to mount it? End cap mount is out because that’s where the mirrors go. Stock switch with a custom 3D printed housing perhaps?

      Of course the switch needs to be waterproof.

      Then you need to route the wire from the switch to the frame. If the switch body is inside the bars, that’s another hole you need to drill.

      The wire now needs to be run down the frame (where? how?) to the lights (front & rear) and attached. Those connections need to be waterproof and that gets so much harder if you want the light to be removable.

      So yeah, simple ain’t as simple as it seems.

      Personally I’d use a vibration switch (spring as has been mentioned) with a master on/off switch for the occasions when you really want it to be off (transport etc). Oddly enough that’s the scheme the commercial units use.

    1. With so much drag it’s like riding up a steep hill all the time, you can even use them for an emergency brake!

      But they still don’t get past the problem of ass hat coppers giving you a traffic infringement notice for your lights not working when you stop

    2. i was going to write this, too :D
      in germany law even forces you to use a dynamo, because it doesnt depend on batterys. The LED is power with a goldcap for abaout a minute when the bike is not in motion.

      only the oldest dynamos can be used as an “emergency brake”, i have a “nabendynamo” (hub dynamo?), and i basically have the light on all the time… you dont even feel the difference…

      honestly, i am surprised they didnt use a RPI for this *facepalm*

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.