Energy harvesting alternative for bikes including data logging, smart illumination system and Power Distribution Board for powerbanks

Similar projects worth following
The aim of this project is to provide a cost-effective alternative to power generation on bikes using conventional stepper motors while adding other capabilities, such as:

- An integrated data logging system to monitor power generated on each trip.

- A smart lighting system with addressable LEDs, working as indicators, braking lights and headlights, incorporating Light Dependant Resistors (LDRs) to sense the environment and to reduce the risk of glare.

- Power Distribution Board (PDB) to charge two different/generic powerbanks. While one powerbank is charged, the other one is used to supply energy to the system.

Please bear in mind that I am currently testing quick prototypes that may compromise the bike reliability in some cases (aka 'learn by doing'). No stress, compression, bending or torsion analysis have been carried out yet on the power generation stage, so use all this project content at your own risk.


Power generation on bikes has been widely implemented throughout years using dynamos. A dynamo working principle is the same as the electric motor. Electric motors use electricity to produce mechanical motion, while dynamos use mechanical energy to produce electricity. Electric motors can be used as generators (like a dynamo) as long as the input source of energy is mechanical.

Dynamos can be attached to the bike's fork, so the shaft will be continuously in contact with the tyre. The wheel hub can also be replaced by using an in hub dynamo, where the dynamo will be fully integrated on the bike, so it looks more aesthetic and it solves any possible contact issues. However, in hub dynamos are more expensive, they make one rotation per wheel rotation (more poles need to produce the same energy) and the drag feeling is also noticeable.

In addition, there is no integrated solution that also includes a power management device, so the generated energy can be safely stored while cycling (e.g. powerbanks, phones, etc) or used to feed other electrical sources in the bike like a lighting system.

imPulse offers a cost-effective alternative to power generation on bikes using conventional stepper motors while being able to store the generated energy using almost any powerbank available in the market. imPulse also offers a smart and fully integrated lighting system powered by a second powerbank, so while one powerbank is used for charging, the other one will act as the system’s main source. All of this is easily managed by an integrated power distribution board.


  • Power Generation Stage (To be upgraded)
  • Data Logger Stage (To be upgraded)
  • Smart Lighting System (Current stage)
  • eBox Stage (-)


What is the difference if a conventional dynamo hub is compared to imPulse?

In a few words, a dynamo hub will make one rotation when the bike wheel makes one rotation. There is no gear system embedded to increase power generation while keeping wheel rotations. The power generation stage in imPulse has a gear ratio of 4.5:1, so the pinion attached to the motor will rotate 4.5 times while the spur gear will rotate only 1. Please feel free to check logs for more information.

Can I install imPulse on ANY bike?

This system has been tested only on bikes with braking discs as the power generation stage uses the braking disc and braking caliper mounting points. Headlight and rear light can be easily adapted to any steering wheel and seat available in the market as they were designed to be versatile. The eBox can be fitted on the water deposit mounting bracket as this mounting point should be the same in most of bikes. 

Why a stepper motor?

Because it is cheap, it has more poles than a conventional DC motor and I wanted to use devices that I already had available.

How can I identify phases in a bipolar stepper motor?

Grab a multimeter and switch it to resistance measurement mode. Now take two random cables and measure its resistance. If those cables are part of a coil, they must show a resistance value (value depends on the motor size).


CAD of the headlight

iges - 1.19 MB - 07/15/2018 at 23:35



CAD of the rear light

iges - 431.94 kB - 07/15/2018 at 23:35



CAD of the rear light bracket

iges - 198.75 kB - 07/15/2018 at 23:35



Code needed to implement the smart Lighting System in the bike

ino - 3.89 kB - 07/15/2018 at 23:27



Same code as testSensors.ino, but implementing the uSD Card reader module in Arduino IDE

ino - 2.47 kB - 07/08/2018 at 13:30


View all 9 files

  • 1 × NEMA 17 Stepper Motor 17HS4417, 1.7A @12-48 Vdc
  • 4 × M3 screws for the stepper motor
  • 5 × M3 screws and nuts for the headlight They should be long enough. Check CAD files
  • 3 × Light Dependant Resistor (LDR)
  • 1 × 10x10 WS2812B programmable LED matrix

View all 17 components

  • eBox Stage

    Javier Betancor07/15/2018 at 23:21 0 comments

    I am creating this entry in order to show you how all different stages are being merged into a main system, the eBox. The eBox is the brain of the bike, a box that gathers, process and stores all data. It also has the ability to process commands from sensors, like a car ECU (lets call it bECU)!

    Hence, let me start with the diagram of the system:

    Please bear in mind that this schematic may change (a lot) as I am currently creating a Prototyping Board with all modules embedded.

    I would like to clarify a few things before going mad:

    • D stands for 'Diode' and I will show their specifications asap.
    • R stands for 'Resistor'. R1 is 1KOhm, R2-R4 are 220Ohm and R5 is 10KOhm.
    • C stands for 'Capacitor'. C2 is needed to smooth power surges if any (I may remove it).
    • FL stands for 'Front Light'
    • RL stands for 'Rear Light'
    • RI stands for 'Right Indicator'
    • LI stands for 'Left Indicator'
    • B stands for 'Brake'
    • MS stands for 'Main Switch'

    Q&A Section

    How many controllers are being used on this project?

    At the moment only one. However, I could appreciate some lag when testing the light system. I will merge all the code and see how it goes but I believe one MCU will be for data logging an another one for the system management.

    Whe a diode in the Vin pin?

    From previous experiences I have observed that Vin also provides 5V. This will avoid any possible issue.

    A box in a bike like in the pictures?

    Well, yes and no. I need a waterproof container to install all the electronics. This eBox needs to be compact, modular, small and also needs to use a common fixation point that all bikes have. The bottle cage mounting point is my first choice.

    I know, it is still a box but I have some nice designs in mind, and you should be able to still use the mounting point for its original purpose.

  • Smart Lighting Stage

    Javier Betancor07/15/2018 at 21:32 0 comments

    It is time to upgrade the current setup with a smart lighting system!! The aim here is to use one of the batteries to power up a headlight and a rear light. One of the three Light Dependant Resistors (LDRs) will be used to sense the environment. The other two will be used in order to decrease the light intensity when another car/bike is coming from the opposite direction (other features will be added soon).

    On the other hand, I would like to outline the usage of programmables LEDs. You can literally program anything! And I have some ideas in mind...I will keep you updated.

    Please find below the list of components needed for this stage:

    • 3D printed headlight and rear light.
    • 5 x M3 Screws and nuts
    • 3 x LDRs
    • 3 x 1 KOhm resistor
    • 10x10 WS2812B programmable LED matrix
    • Single core wire
    • 2 x 220 Ohm resistor
    • 4 x JSP 2.54mm XPH-3 housing (male and female) male and female connectors
    • Black/Red/Blue 22 AWG silicone wire
    • Different sizes of heatshrink
    • Hot glue gun
    • Soldering iron + soldering material
    • Patience and be willing to improve your soldering skills!

    First of all, I would like to show you the schematics of this stage. As I mentioned before, my aim is to show you how I am building this system, not to teach you how schematics should be represented.

    Having said that, I want you to imagine that you are currently on the bike. Now, I guess the arrow labeled as 'FRONT' makes sense. I know I mentioned 3 LDRs and I am showing only one as I managed to implement this one (I need more time!) only but the setup for the rest of them should be the same. Below you will find the list of abbreviations:

    • RI - Right Indicator
    • LI - Left Indicator
    • B - Brake
    • FL - Front Light
    • RL - Rear Light

    Let's start with FL and RL. I tried to make a simple design for ease of printing. However, it is not an easy task if we start thinking about the number of wires coming out and how to route them. Let me tell you something, I hate wires as they really affect aesthetics and no matter how you sort them, they are not part of the design when you first think about it. Wire routing is art, so my plan is to make them disappear!

    As it can be seen, I have also added the LED matrix, but all rows still need to be connected. Now, patience and start soldering! I will treat the LED matrix as a single line of LEDs, so only one 'for' loop will be needed to address all of them instead of two (rows and columns).

    The best way I found to solder this LED matrix is to use some 'blu tack' or similar, so the matrix will be firmly attached to the bench. 

    Next step was to find a good library for Arduino. FastLED seemed to be a great choice, so I decided to check each LED to see if all of them are well connected. There is an example named 'Blink' that can be used to activate one LED each time and also to get familiar with the library itself. If you want to go further, I would suggest you to add a potentiometer to the setup, so you should be able to activate as many LEDs as you want by adjusting the knob.

    I have to say that it was a pain!! Well, I managed to finish, so lets see how it looks like o the bike, but first check out the coupling system of the headlight. Different brackets would make it easier to adapt the system to other bikes. As it can be seen, two rows of headlight were tilted 30deg to provide light close to the bike too. I will give further details on this idea as soon as I test the light on real conditions.

    I know they are very basic and it would be nice to make nicer designs, but I am now focused on making a working setup...

    Read more »

  • Data Logger Stage

    Javier Betancor07/06/2018 at 08:17 0 comments

    In this part of the project  I am going to focus on building and calibration of the data logger for the bike. I would like to measure the current generated at a certain voltage and save it on a uSD card module. From there I should be able to get the power generated on each trip. In other words, I should be able to validate my setup!

    I know I could add GPS, speedometer and cadence sensors, but we are on the wearable era! I think it is more useful to use your watch rather than add a lot of circuits to your setup that would increase the space needed, the cost of the overall project and will also use more energy. This could be saved for future implementations, but for now lets stick to basics. First walk and then... run!!

    Components needed:

    • uSD card reader module for Arduino (or similar).
    • 2 resistors to build a voltage divider
    • ACS712-30A current sensor or similar
    • Arduino MCU or similar
    • Time...plenty of time!

    VOLTMETER (voltage divider)

    My question at this stage was very simple, how could I build an accurate voltmeter with a voltage divider? And I found out that it depends on a lot of factors, so...hands on with electronics!

    My aim with all diagrams at this stage is to show you how I did things (the big picture). I am not trying to draw ideal and standardised schematics as I believe it would be harder to understand. Who knows if the next 'Einstein' will read this and based on the level of difficulty will give up or continue learning about these little things! In other words, things as simple and easy as possible. It will help others to discover new areas of interest.

    Coming back to the main topic, it is possible to design a digital voltmeter with two resistors in series (voltage divider). If you have a look on the diagram, I have also connected a standard voltmeter in parallel, so I can validate my voltmeter. I finally attach Vout wire to an Analog Input (A/I) on the Arduino.

    Now lets look at this setup in a more 'specific' way. A/I pins on the Arduino are able to read a signal of max. 5V and the resolution of the Analog to Digital Converter (ADC) is 10 bits or 1024 divisions (2^10 bits = 1024 divisions). Remember that in programming the range would be from 0 to 1023 divisions. In my case, I am planning to read a maximum of 25V for safety, so Vin will be 25V. Vout should be less than 5V, so I set Vout to be 4V when Vin is 25V. That is how a voltage divider 'should' work.

    Next step...resistors! (R1 and R2). I had available some 1 KOhm resistors, so I grabbed a multimeter and measured its real value. The real value for R1 was 994 Ohm. Now, I assume that there is no multimeter and MCU in the diagram. Applying Kirchhoff's voltage law we get two equations and two unknowns:


    An this is how the value of R2 is calculated. In my case, the ideal value of R2 should be equal to 189.3 Ohm. As it is fairly difficult to find a standard resistor with that value, I decided to approximate the value so R2 is 220 Ohm. Wait a second! Grab the multimeter and measure the real resistance! The real value for R2 was 217.3 Ohm. Now it is very important to check that Vout will never reach 5V, so rearranging from above equations:

    If the value is less than 5V, you are good to go (mine was 4.4898V).

    Now, last thing before proceeding with the calibration as with this little tweak you will avoid a huge headache. If you connect Arduino to the computer (as we all do) and check voltage in Vref pin by choosing GND as the the usual Arduino one, you will realise that this voltage is less than...

    Read more »

  • Power Generation Stage

    Javier Betancor06/26/2018 at 23:47 2 comments

    Welcome to the first stage!

    The main aim is to design the system that will generate energy while cycling. Items needed:

    • Stepper motor - I am using a spare bipolar NEMA 17 (17HS4417) that I already had. It needs 1.7A (0.85A/phase) @12-48 Vdc
    • 4 x M3 screws
    • Calliper or similar for measurements
    • 3D printed gear system and motor bracket (files uploaded using .IGS format)
    • 6 x washers for the spur gear
    • Bike - I am currently using my own bike

    Nowadays, most of bikes incorporate disc brake systems, so I decided to design a spur gear to be fixed using the same screws as the brake disc and brake calipers. I chose the rear side of the bike as it is easier to modify, so I can fit the motor bracket without adding extra components. However, since I am planning to 3D print first versions, I will not be able to fix all components as tight as it needs to be. 3D printed parts may brake under high pressure.

    So, I made some measurements and designed a quick prototype. Measurements depends on what is the size of your brake disc, the available space between the disc and the bike frame, and the size of the selected stepper motor. 

    I will use ANSI metric standard to design the gear system. In other words, both gears must have the same modulus (M), which is the selected circle pitch diameter (D) over the number of teeth (T) (figure below):

    In my case I manage to obtain a gear ratio of 4.5 and have some space left so it could theoretically fit smaller break discs as there are many variations.

    So far, I have been working on the second version. The motor bracket needed extra modifications as it needed to be reinforced with a rib. It also has been printed from one side so the filament direction will not be compromised under oscillations. The spur gear has been thickened compared to the first version and the use of washers was also very helpful.

    Figure below shows the previous design (right hand side) and the improved design (left hand side). I still need to go through a third version regarding the motor bracket because the motor shaft was touching the brake disc. I am sure you will notice it on the next picture.

    The next step was to assemble all components. It still needs some minor modifications, but it looks promising! As I said, only four extra screws are needed to fix the motor.

    I tested the system by connecting both phases of the motor in series to a capacitor, then DC/DC step down converter and a generic powerbank at the end.

    Do not forget to watch the video! Unfortunately, the first time I had a 50V capacitor instead of a 25V one. I think I do not have to explain what happened to the DC/DC step down converter. However, I could still use it as a 'circuit load', so I managed to check how much current was generated. The multimeter is connected as an Ampmeter (series) after the capacitor, so as far as I know it should show the current generated at 25V (units shown are Amperes).

    As it can be seen, 700mA were easily generated @25Vdc. This seems quite logical for me as each phase of the motor requires 850mA to work (I will update the video as soon as I get more DC to DC converters)

    Looking forward to make more tests...on the road!!

    UPDATE - 2/7/2018

    Yesterday, my partner and me decided to meet some friends in London. I could not see a better chance to test what I have been working on for the last few days. Well, I did not have anything installed on the bike but the motor and gears, so I opted for a quick solution by designing a PCB and putting altogether in a plastic box.

    I know, I know...the box looks ugly...

    Read more »

View all 4 project logs

Enjoy this project?



hex4def6 wrote 07/10/2018 at 16:58 point

"Unfortunately, the first time I had a 50V capacitor instead of a 25V one. I think I do not have to explain what happened to the DC to DC step down converter." ... 

If you're implying that having a higher rated capacitor damaged your DC-DC converter, you're mistaken. The voltage rating of the capacitor is maximum voltage that it can sustain before being damaged, not the guaranteed voltage that it will output. Therefore, there is no downside to using 50V capacitors (except them being bigger / more expensive).

  Are you sure? yes | no

electrobob wrote 07/16/2018 at 07:55 point

the 25V cap might have limited the voltage from the generator if it was stressed beyond the rating. See here what happens: 

Ideally, there should be some over voltage limiting element from the generator, like a zenner diode.

  Are you sure? yes | no

Javier Betancor wrote 07/17/2018 at 22:06 point

Hi Hex4def6,

Thanks for your comment and also for reading my logs!

I might have missed some details about what happened. There was no load after the capacitor and I was messing around with the bike. I connected the USB module and 'pop'. I assumed the capacitor was fully charged or the module could be faulty. 

Any suggestions? I am planning to add a zenner diode as Electrobob suggested. 

  Are you sure? yes | no

hex4def6 wrote 07/17/2018 at 22:53 point

I think a zener is a pretty good / easy way to deal with it. It's possible that the 25V was protecting it in the manner he suggested (although this is still bad -- the capacitor will eventually fail)

I would suggest measuring the output voltage when you are cycling at top speed without the DC-DC connected. If it's generating substantially above the rated voltage, a zener diode is going to get very hot / act like a big load, which is inefficient. If that is so, you may need to either adjust the gearing ratio, or choose a converter with a bigger input voltage range.

  Are you sure? yes | no

K.C. Lee wrote 07/17/2018 at 23:21 point

You'll need to size the protection circuit to the amount of power that can be generated from the generator.

Zener diodes are reasonably prices to may be 5W ($1.25), but they can get expensive or hard to find beyond that.  You might want to look at a crowbar circuit:    

Use figure b to boost the wattage.  Transistors are reasonably cheap and you can get them mounted on a heatsink easily.  Add a fuse on the input side too so if it get bad enough, the fuse would blow to protect the rest of your circuits.

  Are you sure? yes | no

K.C. Lee wrote 07/17/2018 at 23:24 point

50V caps in general have lower ESR than 25V and have higher ripple current rating.  They are not be the reason why things blow up.

  Are you sure? yes | no

Javier Betancor wrote 07/06/2018 at 07:40 point

Hi Electrobob!

Thanks for spending some time reading this post! I am glad you find it interesting because I really like it!

So far, I cannot feel any drag on the bike thanks to the gear system. You may notice that I had both diode bridges connected in series but I decided to connect them in parallel (more current generated). I can easily generate 16W (1A@16V) which I think it should be enough for the system. I am sure you can install a bigger motor and a bigger gear, but I am getting good results with this setup. 

I should have some data available soon, so you should be able to see that it really works...

  Are you sure? yes | no

electrobob wrote 07/09/2018 at 11:21 point

Thanks! Waiting for more data.

The thing works as it is, but if you want to get every bit out of it you might try to use a MPPT converter and charge the battery with it directly. 

Also highly recommended: add some over voltage protection, like a zenner diode across the generated power, so you don't go over the maximum input of the DC/DC converter. 

  Are you sure? yes | no

Javier Betancor wrote 07/17/2018 at 21:44 point

Hi Electrobob!

Sorry for the late reply...loads of work.

Love the idea of using MPPT! I will make a note for future improvements.

Voltage protection is a must! And I missed it...well I am learning.

Thank you for your comments, they are very helpful! Hope I can help you the same way!

  Are you sure? yes | no

electrobob wrote 07/05/2018 at 09:10 point

This is a very cool project. It seems you are getting more power than the classical 3W dynamo. 

What is your experience with the drag added by the motor?

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates