Introduction: USB Bike Generator

The USB Bike Generator is a small bike mounted electricity producing device optimized to provide power for two USB ports.  There are so many small electronics that can be powered or charged from a USB connection it only makes since that people might want to do this while riding a bike.  The basic idea for the USB Bike Generator is to use a suitable stepper motor as a generator and a voltage regulator circuit to maintain the 5 volts needed for the USB ports.  In this instructable I will show you how to build this generator and through testing show that it is 70% efficient at converting the power from the generator to the power needed for the USB port. 

This is the third revision of my bike generator project, the first two can be found here and here I would strongly recommend that if you plan on building this USB Bike Generator you at least look over how these past to versions went together.

This third rendition of my bike generator project came about after reading some of the comments made about my previous methods. Specifically, one comment from member ac-dc stated that my decision to use a linear regulator to go from 30 volts from the generator to 3 volts to power the light was at best 10% efficient. Now since one of the interests I've had listed on my profile since I joined this site has been efficiency I decided to read the rest of his comment after wiping the tears from my eyes. Ac-dc suggested that buck switching regulator would be better suited for a bike generator like mine. I had no idea what a switching regulator was so I started to do some research and found out that ac-dc was right and that I could significantly increase the efficiency of the electronics I was using.

In my searching for switching regulators I came across this reference from Dimension Engineering,  They offer a good explanation of the switching regulators and even sell them. 

Step 1: BikeGen Testing

If you only want to learn how I built the USB Bike Generator and not why the BikeGen system wasn't the best, you can skip this step.

In order to set a bench mark for the efficiency of BikeGen system I decided to do some testing.  In my searching for switching regulators one of the best resources I found was this article It explains how switching regulators work and how you can calculate the power lost through heat generation.  The power lost to heat can be calculated using this equation:

Power lost = (Input voltage – output voltage) * load current

So in order to find the power lost you need to know the input and output voltages as well as the load current.  Luckily, I already had the tools for this job which required 3 digital multimeters and a small drill press.  

The test setup was fairly simple, I tightened the drill press chuck onto the shaft of the stepper motor and loosely clamped the motor in a vice.  This was the same stepper motor that I have used for both the Bike Generator and and BikeGen Instructabes.  This actually works out really well for two reasons.  First the speeds that the drill press can spin are labeled and from these speeds I calculated how fast I would need to ride the bike based on how fast the generator is spinning.  So using the tire size, rim size and the diameter of the small wheel mounted on the stepper motor for the BikeGen instructable I calculated the following speeds:

Drill Press RPM            Bike Speed (MPH)
         620                                     4.7
        1100                                    8.3
        1720                                   13.0
        2340                                   17.7
        3100                                   23.4

This range of bike speeds seems very reasonable.  The second reason that using the drill press is a good representation of a bike rider is the power rating of the drill press motor.  This drill press is rated at 1/3 horse power which is roughly 250 watts, this is attainable by an average person while riding a bicycle.  

The next step was to connect 3 digital multimeters into the circuit.  I had cut some of the wires and use a few sets of alligator clips to make this happen.  Check out the picture or the Test Setup pdf to see how I connected the meters.  Basically the current meter was placed inline between the regulator and the charging circuit and the voltage meters connected after the diodes and after the regulator and were grounded at the same spot.  This measures the values I need to calculate the power lost.

Once everything was ready I plugged in the drill and turned it on.  I tested the generator at every speed the drill was capable of and found out that at the first 3 speeds (620,1100,1720 RPM) there was not enough power to consistently charge the batteries.  This was confirmed by the blinking LED on the charger.  At 2340 RPM and 3100 RPM enough power was provided by the generator to charge the batteries.  The values I measured at these two speeds are listed below:

Motor RPM                  2340       3100
Input Volts                    15.2        20.2
Output Volts                   13        12.68
Output Amps                0.29        0.28
Power Lost (W)           0.638     2.106
Output Power (W)       3.770     3.550
Total Power (W)          4.408     5.656
Efficiency                      85.5%    62.8%

The power lost was calculated from the equation I showed earlier, the other values were calculated from the following equations:

output power = output voltage x output current
total power = output power +  power lost
efficiency = output power / total power


So looking at these results I think there is something to be desired.  First there was not enough power to charge the batteries until 2340 RPM which is 17.7 mph on the bike.  This is a high speed and doesn't seem reasonable for a casual bike ride.  Of course this speed is attainable but it would be a lot of effort to maintain the speed for an extended period of time.  The efficiency  seems very good at 2340 RPM (85%) but it drops to 62% at 3100 RPM.  This is because the input voltage goes up at higher speeds which means more power is lost to heat.  So unless I want to ride the bike at and average speed of 18mph everywhere I ride I will not achieve the best efficiency possible.    

Step 2: The Tools and Parts You Will Need

Below is a list of most of the tools and parts I used to build the USB Bike Generator.


Soldering Iron
Solder Sucker
Desoldering Braid
Digital Multimeter (3 of these were used in testing)

Drill Bits
Tap (8-32 screw size)
Tape Measure


USB Car Power Adapter (read more about this in the next step)
Stepper Motor
1N4001 Diodes (8 diodes are needed)

1-1/4" x 1-1/4" x 1/16" Aluminum Angle
1/2" x 1/8" Aluminum Flat
8-32 Machine screws and nuts

Step 3: Build the Electronics

There are three major parts to the electronics of the USB Bike Generator, the stepper motor, the rectifier and the voltage regulator. 

Stepper Motor

The USB Bike Generator uses a stepper motor as a generator to produce the electricity.  In general any electric motor can be used as a generator but not all motors are well suited as generators.  The stepper motor I used in my last two instructables came from an old printer and was rated at 24 volts.  Through testing I found that this motor provided up to 48 volts when unloaded and spun at 3100 rpm.  People new to electronics should understand that high voltage doesn't always mean high power.  In order to reduce this voltage to the 12 volts needed for the BikeGen instructable the regulator just burned off the extra voltage as heat.  This meant the regulator was inefficient.  

In my searching for a new stepper motor I looked for two important aspects.  First, the voltage rating of the motor need to match the 5 volts required by the USB ports. Second, the amperage of the motor needed to be higher, meaning there was more power potential in the motor.  I found a somewhat local electronics surplus store that sells stepper motors and searched their website,  They had a stepper motor listed at 5 volts and 3.3 amps, this seemed perfect.  I went to the store and after looking at everything they had I got the motor.  I would recommend finding a local surplus store in your area if you plan on building anything electronic, they are a great resource.  


In basic terms a rectifier changes Alternating Current, AC, to direct current, DC.  The coils inside the stepper motor are energized as the motor spins causing the current in the coils to alternate.  This is the alternating current.  The 5 volts need for the USB port need to be direct current.  The rectifier, which is just 4 diodes, changes the alternating current from the stepper motor to the direct current needed for the voltage regulator.    
After doing the testing on the BikeGen regulator circuit I realized that the zener diodes I was using were getting very hot.  One of them even failed because it overheated.  I wanted to use a more suitable diode for this project and after checking back to the instructable that inspired this whole project for me,, I decided to go with a 1N4001 diode which is rated at 50V and 1 Amp.  I got the diodes in a variety pack from Radio Shack.

Voltage Regulator

The voltage regulator is a switching voltage regulator as opposed to linear regulator.  At first my searching led me to the LM2575 switching regulator and I was planning on building the circuit myself.  Just search "LM2575" and the data sheet will show up.  On the data sheet the recommend circuit for a 5 volt output is shown with recommendations for all the components.  I continued searching and found the exact circuit I needed from Lightobject,  This seemed to be a better option for me because I didn't want to have to buy all the components in much higher quantities than I needed from a electronics distributor.  

As a last resort I went to the local dollar store because they always seem to have the things I need.  To my complete surprise they had 12 volt car adapters with power for two USB ports.  So I bought two and went home to take them apart.  They had a switching regulator circuit already!  It uses a MC34063 regulator IC and has all the supporting components.  All of this for a dollar, you can do much better than that.

Follow through the notes on the pictures to see how I connected all the parts together. 


Step 4: Build the Generator Mount

To mount the stepper motor to the bike I used a method very similar to the BikeGen instructable.  A small wheel was attached to the stepper motor and the motor was mounted perpendicular to the bike wheel on the rear rack.  The small wheel on the stepper motor rubs against the braking surface of the bike wheel to spin the motor.  A  spring was used to force the stepper motor toward the bike wheel to ensure constant contact between the two wheels.  

I started by cutting two 6 in. pieces of 1-1/4" aluminum angle.  One of these pieces mounts to the rear rack and the other mounts directly to the motor.  Two sections of each piece were cut out to allow for clearance between the motor, rack and wheel.  I reused the home made u-bolts from the BikeGen instructable to mount to the rack.  Two short pieces of the 1/2" aluminum flat bar were bolted to the angle aluminum to hold the screws that retain the spring and the motor.  The small wheel attached to the motor started out as a few parts from Servocity,  They sell very nice shaft connectors and wheels that make mounting anything to a motor very easy.

While I can't offer exact dimensions for any other mounting situation I do believe this to be a fairly universal method of mounting a stepper motor to any bike with a rear rack.  I have considered many other mounting options for my bike it all my ideas seem to work back to this one.  The parts were fairly easy to make and the precision required was not that high.  I made all of the cuts with the hacksaw and drilled all the holes with my battery drill or the drill press.  Simple tape measure and sharpie to mark everything and a center punch to get all the holes right was enough.  

If anyone has any fresh ideas on the mounting of the stepper motor I want to hear them.  I would like something more permanent and rigid, while still maintaining wheel serviceability.    

Step 5: Final Results

Before I did the final assembly of everything I tested the performance of the new stepper motor, diodes and switching regulator.  I used a dead 5V 1000maH battery as a load and measured the current and voltage input and output of the regulator.  I used the drill press again to turn the generator at its 5 different speeds. The results are listed below.

RPM                           620     1100      1720     2340     3100
Vin (volt)                    5.81      6.61       7.15      7.43       7.67
Ain                              0.15      0.26       0.34      0.38      0.40
Vout                            3.70      4.21       4.55      4.78      5.05
Aout (Amp)                0.15      0.28       0.37      0.42      0.44
Input Power (W)       0.87      1.72       2.43      2.82     3.07
Output Power (W)    0.56      1.18       1.68      2.01     2.22
Efficiency                   64%       69%      69%      71%     72%

As you can see the regulator is right at 70% efficient between 1100 and 3100 rpm.  Also it generated enough power for the USB ports even at 620 rpm.  I also increased the size of the wheel mounted to the generator to slow it down compared to the old BikeGen stepper motor. 

All of the work comes to this final point. The USB Bike Generator can power two USB ports as you ride your bike, to charge your electronics.  The electronics of the system are 70% efficient above 12 mph bike speed and can generate adequate power at 7 mph.  I have tested a rechargeable battery, handheld GPS and an Eton radio with the USB Bike Generator and they all work.  I have also tested a Ipod touch 3gen and have found its is possible to charge but because of the variability of the power source and the pickyness of the Ipod its not very reliable.

I welcome all comments, questions, and suggestions. Thanks 


mattblanks (author)2013-04-17
would two of these substitute the eight individual diodes?

sveedio (author)mattblanks2016-03-22

apparently the link was time sensitive and has expired, could you repost it please.
thanks in advance,

Doug Costlow (author)mattblanks2013-04-18

Yes those bridge rectifiers are just like four diodes but in one nice package, so two of those will replace all eight diodes. Just hook the wires from each stepper coil to the AC input leads and then the positive and negative leads to the charger.

minimeccanica (author)2016-02-23

Wonderful intractable! impressive work with plenty of numbers as a base for further improvements (if possible).

One question: any advice about which type of stepper to be used? There are steppers with 4, 6 or even 8 wires, how to choose?

Any advice to be added to what said (stay above 5V and possibly with 3 Amp)?

Heartfelt thanks. Manlio

Guthix Priest (author)2015-09-11

I really like this. I also like that you were willing to read a comment, research it, and admit your design was originally ineffective, and modified it accordingly. a lot of people today don't care. mad respect.



Yonatan24 (author)2015-08-29

You should feel that it is a bit harder to pedal with this because It has friction and takes some of your energy

It is a good idea to add an option to remove it, for example: when riding uphill so It would be easier...

ao'dell1 made it! (author)2014-04-13

Fun science fair proj for my nephew thanks!

Nick28cc (author)2013-10-12

What about adding a battery pack. that way you could have a more energy for other things after a long day's ride.

Doug Costlow (author)Nick28cc2013-10-14

Check out my previous version of this generator it charged AA batteries. I think either charging batteries or powering lights directly are two very good uses for a generator like this. Powering things directly gets harder because the power output is not consistent.

Nick28cc (author)2013-10-12

Maybe it is possible to install one of these motors directly off the rotation of the crank.?

Doug Costlow (author)Nick28cc2013-10-14

Yes, maybe with another chain connected between the crank and the generator. You've got to make sure your pedaling though to produce any power and the generator needs to spin much faster than the crank, so you'll have to figure out the gearing

claudiopolis (author)2013-08-28

How about mounting it on top of the luggage tray on the back? Cut a small window in it, to allow the stepper wheel to touch the tire from the top side. You could mount the stepper directly on that luggage tray. You will loose function of that luggage tray, of course :-)

unnap (author)2013-02-13

thank you for the reply sir.

another question, can we replace it with a smaller motor having only two output terminals? i mean like a dynamo having two output terminals?

what will be the circuit configuration then if it is possible?

thanks again!

Doug Costlow (author)unnap2013-02-14

I'm assuming that by a motor with only two wires that this is a standard DC motor, not a stepper motor. In that case the rectifier diodes are not needed but using a DC motor can create other issues. You must be able to control and reduce the voltage produced by the generator, be it a stepper or DC motor, so that a controlled 5volts is delivered to the USB plug. With a DC motor this may require fewer electrical parts but will most likely be less efficient and produce less power.

I recommend using a stepper motor.

unnap (author)2013-02-12

sir, can we replace the stepper motor used in this project into a stepper motor having 5volts output and 1.1A output?

Doug Costlow (author)unnap2013-02-13

Yes, really any stepper motor that is a resonable size to mount to a bike in the fashion I have shown will work.

adrofig (author)2012-04-28

To someone who has used this, is the additional friction greatly noticeable?

Doug Costlow (author)adrofig2012-04-29

With this generator I noticed no drag while riding, but still the power was being produced. I now have a legit hub dynamo to compare to as well. When riding I still don't notice the hub but when I lift the front wheel off the ground and spin the tire by hand the drag is obvious. Both of these generators consume power on the order of a few watts, maybe 6 at most for the hub, but a normal rider can produce can produce anywhere from 150 to 250 watts. The generators power a small percentage of that and can be hard to notice but is still there.

adrofig (author)Doug Costlow2012-05-03


Chowmix12 (author)2011-11-05

Can you explain to me why you used a stepper motor? i have a regular motor, and I want to use that instead so that with a 5 volt reg.

jwelbes (author)2011-05-24

"The rectifier, which is just 4 diodes..."

you're using 8 diodes. are you using 4 sets of two diodes connected in series, effectively making them one diode?

jwelbes (author)jwelbes2011-05-24

wait hold on. you made two seperate circuits, one for each USB charger inside your 12v car adapter. am I right? this makes more sense than my last comment. that would explain why your diagram you drew has only two wires going to your car adapter, but in your photograph there are 4 wires going to your adapter.

Doug Costlow (author)jwelbes2011-05-25

There are 2 rectifiers,each consisting of 4 diodes. A "rectifier" is just the combination of the 4 diodes in the pattern shown in the picture, nothing more than that. Two rectifiers are needed because there are two separate coils in the stepper motor. The positive/negative outputs of both rectifiers are connected to the 12v adapter and the adapter converts the voltage to 5v.

jwelbes (author)Doug Costlow2011-05-26

ah. two seperate coils. ok thanks!

jwelbes (author)2011-05-24

"Follow through the notes on the pictures to see how I connected all the parts together."

I don't see any notes on the pictures.

jwelbes (author)jwelbes2011-05-24

i guess I need to be a pro member...

roland985 (author)2011-03-21

When I go for rides, I spend roughly 30 minutes each way, 1 hour. Enough to give my smartphone a full battery. I have bought a commercial version of this.

But yes, storage is desirable, make your version with storage.

thegodfather279 (author)2010-10-07

could you use a car outlet power supply that has an AC plug and a USB plug instead of the dual USB power supply?

zogworth (author)thegodfather2792011-01-19

You mean an inverter?

Most things that you could run off a small dynamo would be DC anyway, so you'd be inverting up to 110/240 VAC then recifying down to DC for your phone/satnav/what ever charger with associated wastages.

traeblain (author)2010-07-06

Last question...but why did you choose to abandon the intermediate battery approach you used on your previous generation? I would think the battery could take the flaky charge gracefully, then you'd have clean output power to your devices and would correct for issue with the ipod charging reliability?

Doug Costlow (author)traeblain2010-07-06

I think a battery could be used but I would want something to protect it and whatever device I'm using. I wouldn't want to over charge it or drain it to low. That would require another circuit to control everything, which I might try in the future.


Well obviously more research is required before you start building a battery addon for this build but I would like to point out (if its not too obvious) that modern devices with lithium batteries have a set up that prevents over charging. Maybe hacking an old device to be your bike-battery would be easier than building your own circuit? Just a thought.

tomtortoise (author)2010-07-06

can you please make a simple schematic to better explain the rectifier wiring.

Doug Costlow (author)tomtortoise2010-07-06

Will this do?

tomtortoise (author)Doug Costlow2010-11-15

thanks sorry for the late reply but i needed to make a mount first and get parts but i needed to use a different motor for my mount but the wires are weird. from the motor the order is orange, yellow, brown, green but when it goes to the white PCB mount plug it is yellow, orange, brown, green should i hook up the rectifiers in motor order or PCB plug order

Doug Costlow (author)tomtortoise2010-11-16

You should check the wires to find out which ones are connected to the same coil inside the motor. Get your DMM and set it to resistance than touch the probes to two wires. If you see a few ohms of resistance than those two wires are connected to a single coil in the motor. These are the two connect to one of the rectifiers. There are two coils in the motor that's why you have four wires. Don't go by color or connectors just measure and find out what it actually is.

mobby666 (author)2010-11-07

With the right regulator you should be getting over 90% efficiency. Using a solar cell setup & a boost regulator should give you power to supliment your generator & reduce it's drag on your wheel. Look at BEAM robotics sites for other ideas about harvesting solar power. Nice

proelectron (author)2010-10-16

Great project! I might try this, but with a smaller wheel giving the required alternator speed. Surely the output of the stepper motor is pulsed and therefore could be stepped down using a small transformer?

chadeau (author)2010-08-17

Clod Hopper-More research,you need MORE

varunmehta (author)2010-07-19

Rather than dismantling the whole male plug system (car style) on the USB charger and connect the wires, how about making a female receiver, like that in the car. You can plug this USB drive charger into it + if tomorrow you make a new enhancement or want to connect something new to it, you can reuse the same stepper motor and circuit to achieve it!

watermelonhead (author)2010-07-18

Actually, in the second rebuild of this project, he did just that... instead of directly powering the headlights, it recharged its batteries. He also says that this is not to power, but "The USB Bike Generator can power two USB ports as you ride your bike, to charge your electronics."

laznz1 (author)2010-07-10 epic win!

traeblain (author)2010-07-06

I know this is why your previous generation motor didn't work, but I think there could have been better options than moving to a new motor (although I have not built this and don't know the ins-and-outs of your work). My first question is why not try a new wheel for the previous stepper motor? My calculations (assuming you're using a 700x23 wheel and tyre) simply using an aggressive inline skate wheel (47mm) you could move your target down to 12.9mph which is pretty good for casual riding. Not sure your target speed though. It may help to understand as I believe you got the last motor from an old printer? Where this one may cost a bit more money.

Doug Costlow (author)traeblain2010-07-06

The main reason I didn't want to reuse the stepper motor from the printer was that its voltage output was to high, which caused the regulator to become inefficient. I think the goal should be to first create the voltage you need, in this case 5v, and then try to develop as much current as you can at that voltage, to get the most power and efficiency. As far as a speed target, I wanted something that would maintain high efficiency over a large speed range. I didn't want to have a really high efficiency at one certain speed because then I would have to ride at that speed all the time to get the best performance. As far as the cost goes, I spent $10 on the new stepper motor from electronics They have that same motor on sale on-line for $10 as well.

retasker (author)Doug Costlow2010-07-08

Ah, but that is the whole point of using a switching regulator. I don't know what is actually in your $1.00 USB convertor, but a properly designed switching regulator would allow you to transfer power efficiently and get more current out than you put in by operating with a higher input voltage. That is, with the proper switching regulator design including an input storage capacitor, you could use a higher voltage stepper motor to generate 12V for your convertor which would then step the voltage down to what you need. You see a tiny bit of that at the higher input voltages where you get slightly more current out than you are putting in. However, as it is now, you are barely getting enough voltage to make the switching regulator necessary. Based on the output voltages you list you would actually now be better off with the linear regulator - especially at the lower speeds. I suggest you try the old stepper motor with the higher voltage output with your new switching regulator. If you do this, make sure you don't get so much voltage that you destroy the switching regulator - I don't know what the input rating is although it is at least 15V if it is designed to operate in a car and probably more. Or try your new stepper motor setup with your older linear regulator. Additionally, you could get more efficiency by using schottky diodes for your rectifiers since they have a lower voltage drop than the 1N4001 diodes (0.4V vs 0.7V each)

Doug Costlow (author)retasker2010-07-09

Using the old stepper motor will not work, I know because I fried two of the regulators during testing. The MC34063 is rated at 40V and the new stepper motor puts out 30V unloaded at 3100 rpm. I think the high load of the dead battery is what caused the voltage to stay around 7V for the new motor, but I'm not quite sure how this works. At lower loads or lower output power the voltage will go up and the input current will decrease, right? But won't a higher load cause the voltage to drop even further because it can't compensate for the load? I guess my real question is what conditions are needed for max power output and what conditions are needed for max efficiency? Are they the same or is it a trade off.

ian_eo (author)2010-07-08

why not use a 5v regulator to regulate the voltage to 5v. its not efficient having some voltage changes during changes in speed. if you can get it to more than 5v without a regulator thats not a problem.

alzie (author)2010-07-08

The motorcycle people had this figured out Long ago. They use permanent magnet alternators very much like a 3 phase stepper. What they do to regulate voltage, is short the windings with SCR's before the bridge rectifier. The SCR's are only triggered when the system voltage becomes high enough. Shorting the windings is counter intuitive, but when you analyze the situation, a perfect inductor driven with a voltage source (induction) consumes No Real power. In reality the windings do have a small resistance, which consumes small power when shorted. Also, core losses go way down. Unloaded, core losses are way up. Your pancake stepper is Loaded with this! A hybrid stepper would do you way better. I ride a bent with a 3W 6V shimano hub gen up front. Had to make my own spokes to fit. That should be an ibble! I use this for LED lighting. Ive been thinking of pulling the above trick for charging.

rickpaulos (author)2010-07-08

There are some very nice front Hub Generators available. Not for cheap however. Schmidt ($300) & Shimano ($150) (plus wheel building labor, rim, spokes, etc if needed) make very good models that put out a nominal 6 volts/ 3 watts at about 20 kph. The huge advantage of these hub generators is you eliminate the mechanical drag you get with any tire drive system. The only drag is the electro magnetic drag which is porportional to the power consumption of the device using the power. Another huge avantage of hub generators is you can use them all night long. Most high end bicycle lighting systems have battery life listed in just a couple of hours. When on, the drag is pretty much undetectable by the rider. 3 watts is far less than what we typically put out when pedaling. Oh, yeah, they are silent too. Adding a Zenor diode would protect against over voltage. That's what most generator specific head lights use to keep the bulbs from burning out at higher speeds. The "Switching Voltage regulator" in the schematic should do the same thing. Adding a large electrolytic capactor to the full wave bridge circuit would help smooth out the 'dc' (direct current). Bicycle generators put out AC or alternating current. Seen on an oscilliscope, it looks like a sine wave, swinging from positive to negative. The frequency depends on the speed of the bicycle and the number of sets of windings in the generator. The full wave bridge circut changes the AC to pulsating DC, Looks like a bunch of Gateway Arches (st louis), lined up end to end. The Capacitor smooths that out quite a bit. The size of the capacitor would depend on the expected power output of the circuit. More power consumption, and you need a larger capacitor. Some commercial generator specific lights use capacitors to keep the tail light lit when at a stop sign or traffic light. I have one that keeps a small LED bulb going in the head lamp when stopped for a minute or so.

About This Instructable




Bio: I enjoy building things more than actually using them.
More by Doug Costlow:Pet FeederRefinish and Stain Wood SidingBicycle Cargo Trailer
Add instructable to: