How to make a Leanlight


##There’s no new blog posts until Saturday because I am at the coast. Doesn’t mean you can’t still enjoy the old ones. ūüôā ##

This morning I was riding behind someone when they were hit by a car and it made me think about how I might be able to make something that can prevent further bicycle vs motorist incidents. I came up with a very simple and easy to make circuit called the Leanlight.

The Leanlight is a simple circuit that accepts 7-12V batteries. It lights up a bright light when the rider leans their bike to turn. The leaning motion of the bike is detected by a simple circuit with a tilt switch. The Leanlight is easy for anyone to make and use.

Parts.

Let’s start by looking at what parts you’ll need to make this simple project:

  1. Some prototyping copper stripboard or veroboard. This is what I mean:
  2. 1 nice bright LED. Choose any colour as long as it’s bright and easy to see.¬†
  3. 1 220 ohm resistor. You may need a different value depending on what LED you’re using. Check the datasheet for the LED.¬†
  4. A tilt switch. I’m using a rolling ball type. See here for more on these devices:¬†http://www.ladyada.net/learn/sensors/tilt.html¬†.
  5. 1 7805 voltage regulator.
  6. 2 10uF capacitors.

Tools.

  1. A half decent soldering iron.
  2. Some wire strippers.
  3. Some wire cutters (mine are built-in to my wire stripper).
  4. You will also need something for cutting the veroboard. I’ll be using a dremel with a flexible shaft and cutting¬†attachment.

    The cutting attachment.

    The cutting attachment.

Let’s get started

So now that we have the parts gathered we can make a start on a prototype. You don’t need to make one of these before soldering up a Leanlight as I’ve already done the testing for you. However, it might be a good idea to make one just to check that your components are working. You’ll need a solderless breadboard to do this.

The breadboard prototype hooked up to a 9V battery.

The breadboard prototype hooked up to a 9V battery.

The breadboard prototype up close. If you don't get it see the schematic below.

The breadboard prototype up close. If you don't get it see the schematic below.

The schematic:

This circuit uses a 7805 voltage regulator to power an LED that is switched on and off by  a tilt switch. The circuit accepts anywhere from 7-12V DC input voltage. The power supply circuitry is stolen from this tutorial: http://itp.nyu.edu/physcomp/Tutorials/ArduinoBreadboard .

The badly drawn schematic. It's functional not beautiful.

The badly drawn schematic. It's functional not beautiful.

The even more badly drawn computer generated protoype of the project. Fritzing still has some issues.

The even more badly drawn computer generated prototype of the project. Fritzing still has some serious issues.

You may notice in the fritzing vero board diagram above that the tilt switch is not green and both the tilt switch and the LED are wired off the board. This is to allow for a flexible setup when attaching this thing to a bike.

Laying out and soldering the veroboard circuit

I’m roughly following the layout I made in Fritzing as it has been checked with the schematic automatically (a Fritzing feature). I will however compress it slightly as you will see. Feel free to come up with your own creative layouts. Or to use multiple LEDs to indicate different turn directions. I don’t have two tilt switches so I can’t build one of those.

Let’s start by laying out our basic components:

The basic layout of the components on the veroboard.

The layout of the power components on the veroboard.

As I said above, you can lay out these components in any way you wish. As long as you follow the schematic accurately. Then solder them to the board using a good quality soldering iron. Make sure you have a window open or some other form of ventilation as solder fumes are dangerous to your health.

The parts soldered down. I know I'm no soldering ninja.

The parts soldered down. I know I'm no soldering ninja.

The next step is to solder the LED to the board. Make sure it is around the right way i.e. the short lead soldered to the capacitor’s copper rail if you follow my layout.

Make sure you solder the LED with a lot of spare wire so you can bend it to whatever position you want.

Make sure you solder the LED with a lot of spare wire so you can bend it to whatever position you want.

Now is a good time to test your circuit. Do this by soldering some power wires to the board and connecting the LED to the resistor using a scrap of wire as shown below.

Solder some black and red power wires to the board in the position shown.

Solder some black and red power wires to the board in the position shown.

Connect the red and black power wires to a 7-12V power source and connect the resistor to the LED using a piece of wire. If the LED lights up, the circuit works..

Connect the red and black power wires to a 7-12V power source and connect the resistor to the LED using a piece of wire. If the LED lights up, the circuit works..

So all good so far. if you can’t get the LED to light up, check your circuit with the schematic and check that you’ve soldered everything in correctly. Also, check to see that you have the power connected correctly.

Now solder the tilt switch to a small bit of veroboard.

The tilt switch soldered in.

The tilt switch soldered in.

Once again, I'm not a soldering ninja.

Once again, I'm not a soldering ninja.

 Cutting the board

Now it’s time for the high pitched, noisy and dangerous part. I’m not planning on having a book sized piece of board hanging off the back of my bike so I’m going to need the cut the board. I’ll be using a dremel to do this. You’ll need something to clamp the board to so it is secure when you’re cutting.

My drilling/cutting setup.

My drilling/cutting setup.

Oh and you’ll need a pair of safety glasses if you dremel is prone to coming apart at high-speed like mine is. They’re essential for safety. And for looking extremely silly.

Yeah.

Yeah.

You want to cut the board carefully as you could damage components with one wayward swipe (my nice blue LED now has a nice big scratch). You also don’t want to damage the copper rails on the board¬†because¬†they’re what makes the whole thing work.

The tilt switch cut out.

The tilt switch cut out.

The main board cut out.

The main board cut out. Notice the excessive amount of dust.

So now we have the two modules cut out, all we need to do is wire them up. This is the last bit of soldering to do.

The wires soldered to the tilt switch board.

The wires soldered to the tilt switch board.

The wires soldered to the main board.

The wires soldered to the main board.

Now all that is left to do before fitting the unit to a bicycle is one last test.

Yep, it definitely works!

Yep, it definitely works!

Here’s where the power circuit integrated into the board is useful. This project accepts any voltage from 7-12V so you can use any battery that is within that voltage. I’ll¬†personally be using an RC plane battery as it is light, fits underneath my seat and will last for ages. Plus I don’t have to pay for new batteries each time it goes flat. The battery is¬†rechargeable using a special high powered charger.

The high capacity lightweight RC battery.

The high capacity lightweight RC battery.

Well that’s about where the tutorial stops¬†because¬†everyone’s bike is different so it is hard to give you a one size fits all kind of installation guide. It’s generally pretty easy to do though. Here’s some photos of the Leanlight on my bike.

The finished project with the Rc battery stashed under the seat and the light hanging on my seatpost above my existing light. The wires for the tilt witch are strapped underneath my existing light to keep the whole project secure and vaguely neat.

The finished project with the RC battery stashed under the seat and the light hanging on my seatpost above my existing light. The wires for the tilt witch are strapped underneath my existing light to keep the whole project secure and vaguely neat. The RC battery connects easily to the project with some standard arduino style headers.

With the bike leaning as if I'm cornering.

With the bike leaning as if I'm cornering. It's a lot brighter than it looks. Trust me.

With the bike standing straight up.

With the bike standing straight up just as if I'm riding along normally.

That’s the simple operation of the project. Cyclists lean when they corner and this light detects this and turns on a blue warning lights telling motorists what they’re about to do. I’m going to see how my cycling group reacts to this next week when I show up with this. It’s going to be interesting. I’m more than happy to make them for people in Canberra and they would cost under $10.

Oh yeah, and thanks for all the pageviews today Ladyada!

Advertisements

One thought on “How to make a Leanlight

  1. Pingback: All systems are go. | Lochie Ferrier's Blog

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s