High power bicycle pedal generator for recharging batteries. Homemade generator for a bicycle (non-contact) Do-it-yourself vortex generator for a bicycle

On the Internet you can find mainly contact versions of bicycle generators, based on the use of rubbing parts. The electricity generated by such devices is sufficient to charge the battery, which powers the front and rear lights of the bicycle.

The disadvantages of such factory and homemade generators for bicycles are the resistance they create when riding and noise. Therefore, the idea of ​​a contactless bicycle generator seems useful and promising. An interesting idea for such a device for a bicycle is presented in the video, which you can watch in the article below.

The author of the idea installed a coil on the rear wheel, past which a permanent magnet flies while driving. When the wheel rotates, the magnet moves past the coil, resulting in a pulsed electric current of fairly high voltage, but with a very small amount of current, which can be used to power an LED light bulb. If you need a ready-made store-bought bicycle generator or a neodymium magnet, purchase it from this Chinese store. Generators for bicycles are also in it.

The coil is used from a small 220 volt aquarium compressor. Neodymium magnet – washer 4 mm thick and 1.5 cm in diameter.
Two 12-volt LED strips are connected in series to prevent the lamps from burning out, since the voltage generated in the pulse can reach 40 volts, while the current value is very small. If a capacitor of more than 1000 mF is included in the circuit, then the LEDs can light constantly, but their number must be reduced several times in this case.

Magnic Light

Let us pay tribute to the ingenuity of the author of an interesting innovation for a bicycle, but we must note that the idea of ​​a contactless bicycle generator is not new. Moreover, there is an original industrial development of such a device. Magnic Light is the first contactless power supply for bicycle lights without additional components in the wheels. Energy is taken from the rotating wheels of the bicycle without any physical contacts and thus friction-free.

Electricity is converted into light through the use of eddy currents generated by strong magnets (International Patent Pending PCT/EP/2012/001431). With this new technical solution, electricity can be supplied to light sources completely without batteries and without external cables, and at the same time with high efficiency.

The mechanism of action on the official website is described as follows: “as the wheel moves, magnets rotate inside a tiny generator weighing 60 grams and a built-in capacitor that keeps the light on even when the cyclist stops.”

Video dated 2014 showing some of the generator's properties Magnic Light.

The idea of ​​​​inventing an electricity generator, or dynamo, as it was first called, belongs to the Hungarian physicist and electrical engineer Anjos István Jedlik, who since 1827 had successfully developed the concept of a dynamo, but did not patent it because he thought that his idea was not new The patent for the electric generator belongs to Werner Siemens.

More powerful homemade generator.

An electrical energy generator is a device that converts chemical, mechanical or thermal energy into electrical current. Such a generator, used on bicycles to power the rear lights and headlight, is a dynamo.

Varieties

Let's consider existing species factory-made bicycle dynamos.

Bottle shop

This type of bicycle generator is the most affordable and simple. However, its power is not the greatest of all types. The generator drive roller rotates by touching the tire tread while driving.

Bush Dynamo

The hub dynamo is an axial dynamo in its design. Executions of such models can be various types. The cost of a bushing generator is quite high. Installation is more complicated compared to the bottle version.

When purchasing, you must check the number of spokes and the method of fixing the installation wheel. The advantages of a bushing generator include its protection from moisture, unlike a bottle generator, the drive roller of which slips over the bicycle tire in wet weather. The device is enclosed inside the wheel hub, and the work comes from its rotation.

The disadvantages of such a device include the fact that it is not possible to turn off the operation of the bushing generator.

Chain

The chain version of a bicycle generator is quite rare. However, there are several different versions of this type. The device can be equipped with a USB port for charging mobile gadgets.

The disadvantage of this design is its short service life, since during operation it is exposed to metal bicycle chain on the plastic elements of the generator.

Contactless

This is the original dynamo with non-contact principle actions. The bicycle wheel plays the role of a rotor. A special hoop with 28 magnets is attached to the wheel. They are arranged alternately, with different poles.

The stator is an induction coil in which electric current is generated. This system includes a battery for energy storage. According to the manufacturer, to ensure normal light flux, it is enough to move at a speed of 15 km per hour.

The advantages of this design are:
  • No rubbing elements.
  • Quiet operation.
  • Unlimited service life (except for batteries).

The disadvantage of the contactless model is the low battery capacity. It only lasts a few minutes. However, many craftsmen easily correct this deficiency. different ways, including replacing the battery with a more powerful one.

Other designs

Currently, various interesting devices that are made in China are very popular. Sometimes you see devices that have never been produced anywhere before. Even their operating principle is not always clear, but they work.

This Chinese device can easily be called the bicycle generator of the future. The dynamo from heaven looks similar to science fiction films. Judging by its appearance, it does not require contact with the wheel bar or chain to function. There are also no magnets.

The principle of its operation is not entirely clear. Perhaps this is a technological secret of the manufacturer.

Design features and operation

The most popular dynamo design on bicycles is the bottle design, followed by the hub dynamo. Other types are used much less frequently. Therefore, we will consider the most common models.

Dynamo bottle

The bottle-type dynamo runs on the side of the front tire of a bicycle. It is made in the form of a small generator of electrical energy, and is used to operate the rear light and front headlight of a bicycle, as well as charge electronic mobile devices.

Such a mini-generator can be mounted on both the front and rear wheels. In the first case, the device can be combined with a built-in flashlight. To turn off the generator, a special folding mechanism is provided, which fixes the generator housing in a position where there is no contact with the bicycle wheel tire.

The name of this device comes from the external resemblance of the shape to a bottle. The bottle generator also has another name – side dynamo. The drive rubber or metal roller is driven into rotation on the side of the wheel tire. When the bicycle moves, the tire imparts rotational motion to the bicycle generator roller, which generates an electric current.

Advantages
  • When the generator drive is turned off, there is no resistance to the movement of the bicycle. When the generator is turned on, the cyclist has to apply more force to move. A hub dynamo, unlike a bottle bicycle generator, always resists wheel rotation, although the value of this resistance is insignificant. If the bottle generator is turned on, but the lights and headlight are not connected to power, then the resistance to the movement of the bicycle is less.
  • Easy and simple installation. Such a device is easy to install on any bicycle, unlike a hub generator, the installation of which requires the assembly of the entire dynamo wheel with spokes.
  • Low cost. These models usually cost less than other types of bicycle generators, although there are exceptions to this rule.
Flaws
  • Difficult setup. Careful adjustment and adjustment of the wheel's contact with the tire at a certain angle, tire pressure, and height is required. If the bike is dropped or the retaining screws become loose, the alternator may be damaged. An incorrectly adjusted generator device will make a lot of noise, create excessive resistance, and slip on the wheel. If the fastening screws are too loose, the mechanism may move out of place and get caught in the wheel spokes, which will lead to broken spokes and failure of the bicycle wheel. Some bicycle generators are equipped with special loops that prevent them from getting into the spokes.
  • Switching requires physical effort. To activate the generator, it is necessary to move its housing until it comes into contact with the wheel. Bushing generators can be switched on automatically or electronically. You don't need to put any effort into this.
  • Increased noise. During operation, a humming noise is heard, while hub dynamos do not create noise.
  • Wheel tire wear. To operate the generator, contact with the tire is required, resulting in friction and tire wear. If you compare it with a dynamo hub, there is no friction with the tire.
  • Resistance to movement. A bottle dynamo offers significantly more resistance to the bike's movement than a hub model. However, when correct setting The resistance is insignificant, and when switched off it is absent.
  • Slipping. In wet, rainy weather, the drive roller of the bottle generator will slide on the tire tire, which reduces the generation of electric current and reduces the brightness of the headlight and taillight. Hub generators do not require good tire grip to operate and are not affected by weather or other adverse conditions.
Dynamo hub

The hub design of the bicycle generator was developed in England and produced by various companies in many countries. The power of this design can reach 3 watts at a voltage of 6 volts. Their manufacturing technologies are constantly being improved, the dimensions of the structure are becoming smaller and more powerful. Modern bicycle headlights have begun to emit more efficient light, as they are also used.

Hub dynamos do not create noise during operation, but their mass is greater than that of other models. There are no rubbing parts in the sleeve version of the device. They operate due to a magnet having many poles and made in the form of a ring. It is located in the bushing body and rotates around a stationary armature with a coil fixed on the axis. The rotational resistance of this design is very low.

Hub dynamos produce alternating current. At low speeds, more electricity is generated compared to the bottle model due to the low frequency of the current. There are rectifier circuits for a dynamo. They are made using a simple bridge circuit of four diodes.

The hub dynamo produces a low voltage, so when using silicon diodes the losses are significant - 1.4 volts. With germanium diodes, losses are reduced and amount to only 0.4 volts.

Working principle of a dynamo

A dynamo produces electric current using the effect of electromagnetic induction. The rotor rotates in a magnetic field, resulting in an electric current in the winding. The ends of the rotor winding are connected to a collector made in the form of rings. Through them, with the help of pressing brushes, electric current enters the network.

The current in the winding has a maximum value if the rotor is perpendicular to the magnetic lines. The greater the angle of rotation of the winding, the less current. Rotation of the winding in a magnetic field changes the direction of the current twice in one revolution. Therefore, the current is called alternating.

A similar generator for direct current is made on the same principle. The difference is in some details. The ends of the winding are connected not to rings, but to half rings, which are isolated from each other. When the winding rotates, the brush contacts each half ring in turn. Therefore, the current flowing to the brushes will have only one direction and will be constant.

Not every cyclist has ever heard of such a device as a bicycle generator. But even those who heard something from him do not always know on what principle his work is based and what it is needed for. However, it does provide a lot of energy saving opportunities that are worth considering.

When most people hear the word generator, they think of a fairly massive device that has a large motor and is designed to create high voltage. All this, of course, cannot be connected in any way with a small-sized bicycle, the movement of which does not require electrical energy at all. In such conditions, it would be useful to pay attention to the bicycle generator, starting with the question of why it is needed at all.

What is it for?

It's probably no secret that a bicycle moves due to the efforts of the legs turning the pedals, which, in turn, set the wheels in motion. Therefore, this device is not needed to move the iron horse from its place. The generator in this case has a different purpose. With its help, the lamps on the headlights work, illuminating the road.

This is very convenient because it allows you to provide energy to the headlights without a charger or additional source energy. The device simply allows some of the energy generated by the cyclist while riding to be used to keep the headlights burning.

What are they?

Among all this many options, you can choose several main types:

  • Dynamo-hub generators;
  • Bottle;
  • Wireless;
  • Made with your own hands.

Each of them has its own distinctive features, advantages and disadvantages, so it would be useful to pay attention to each of them separately.

At the same time, even heavy weight can be called simply a payment for reliability. In addition, this does not upset the balance in any way and does not create additional problems.

Dynamo hub

The first option is of particular interest; the operation of this type of device is distinguished by its simplicity and inconspicuousness. Unlike others, the dynamo hub is not fixed to the wheel, so it does not create unnecessary friction or any other problems. The voltage is created by the work of a magnet built into the bushing and is transmitted through alternating current circuits directly to the headlights.

Among the advantages of this option are the reliability, versatility and invisibility of dynamo hubs. At the same time, it cannot be said that the use of such a device affects the reaction speed of the front wheel and the overall weight of the bicycle. True, the last problem can be solved by using a lighter magnet.

"Bottle"

This generator, which provides charge in the headlights, is called a bottle generator not so much because of its operation scheme, but because of its appearance. It is convenient in that it is attached to the outside of the wheel, which means that if necessary, you can adjust it with your own hands, and you can also do it without special effort remove it if necessary or simply move it temporarily if its work is not required now.

This device has its own certain advantages and disadvantages that are worth paying attention to Special attention. Some of its strengths include the following:

  • Affordable price;
  • Easy to use and adjust by hand without the use of additional tools;
  • Ability to disable, remove, replace if necessary;
  • Minor impact on overall bike weight.

However, the “bottle” also has its own certain disadvantages, which are also quite sufficient:

  • Wheel tires may be rubbed due to its operation;
  • The generator hangs on one side of the wheel, thus creating an advantage;
  • At high speeds, noise is generated during use;
  • Efficiency is reduced in rainy weather.

This option is quite convenient and practical; the point is that you need to create a constant electrical voltage in conditions that are comfortable for driving short distances. In the case of those cycling enthusiasts who like to ride on any terrain and in any weather, using a “bottle” can entail certain difficulties. The same applies to those who like to drive at high speeds.

"Wireless" generator

A wireless or contactless generator is perhaps the most interesting option of all discussed in this article. It is safe to say that it has the main advantages of those that have already been described above, and at the same time is practically devoid of all their disadvantages.

Of course, a wireless device is more complex and technologically advanced, so it will cost significantly more. But it weighs very little, and the headlights are built right into it, which greatly simplifies its operation and saves a lot of energy. In addition, such an electric motor does not have any wires or cables; moreover, it does not come into contact with the wheel in any way, which means it does not create any friction or resistance.

How to do it yourself?

Not everyone can assemble a generator by hand. However, those who have already had to work with mechanics will be able to cope not only on their own, but also with their own resources, which are at hand and available at any time. For assembly you will need the following items:

  • Stepper motor - it will serve as the basis;
  • Small motor producing voltage up to three watts;
  • Transfer ring that you can make yourself;
  • Electrical block.

All these elements must be combined into a common electrical circuit, observing the sequence.

I made this friction bike generator for my bike to power my flashlight and rear lights. I found the idea and a lot of information for this pedal generator project on the Internet.



I recently bought a bike to commute to work and around town, and decided that for safety reasons I needed a light. My front light was powered by 2 AA batteries and the back light was powered by 2 AAA batteries, the instructions said the front light would last 4 hours and the back light would last 20 hours in flashing mode.

Although these are good indicators, they still require some attention so that the batteries do not run out at the wrong time. I bought this bike for its simplicity, the single speed means I can just hop on and go, but constantly replacing batteries gets expensive and makes it difficult to use. By adding dynamism to the bike, I can recharge the batteries while I ride.

Step 1: Collecting spare parts





If you want to build a dynamo machine with your own hands, then you will need a few things. Here is their list:

Electronics:

  1. 1x stepper motor - I got mine from an old printer
  2. 8 diodes - I used a personal power unit used 1N4001
  3. 1x Voltage Regulator – LM317T
  4. 1x Development board with PCB
  5. 2 resistors - 150 Ohm and 220 Ohm
  6. 1x radiator
  7. 1x Battery connector
  8. Solid wire
  9. Insulation tape

Mechanical parts:

  • 1x Bike Reflector Holder - I removed this from the bike when I connected the lights.
  • Aluminum corner blank, you will need a piece approximately 15 cm long
  • Small nuts and bolts - I used printer screws and some other used parts
  • Small rubber wheel - attaches to the stepper motor and rubs against the wheel as it rotates.

Tools:

  • Dremel - It's not entirely necessary, but it makes your life a lot easier.
  • Drills and bits
  • File
  • Screwdrivers, wrenches
  • A breadboard for testing the circuit before you put everything on the bike.
  • Multimeter

Step 2: Create a circuit







Show 10 more images











Let's make a diagram of a dynamo for a bicycle. It's a good idea to test everything before you solder everything together, so I first assembled the entire circuit on a breadboard without solder. I started with the motor connector and diodes. I unsoldered the connector from the printer's circuit board. Placing the diodes in this orientation changes the AC current coming from the motor to DC (rectifies it).

The stepper motor has two coils and you need to make sure that each coil is connected to the same set of diode banks. To find out which wires from the motor are connected to the same coil, you just need to check the contact between the wires. Two wires are connected to the first coil, and two to the second coil.

Once the circuit is assembled on a breadboard without solder, test it. My motor produced up to 30 volts during normal cycling. It's a 24V stepper motor, so its efficiency seems reasonable to me.

With the voltage regulator installed, the output voltage was 3.10 volts. Resistors control the output voltage, and I chose the 150 and 220 ohm options to produce 3.08 volts. Check out this LM317 voltage calculator to see how I calculated my numbers.

Now everything needs to be soldered on the printed circuit board. To make neat connections, I used small gauge solder. It heats up faster and provides a better connection.

In the .Pdf file you will find how everything is connected on the PCB. The curved lines are the wires and the short black straight lines are where you need to solder the jumpers. Files

Files

Step 3: Installing the Motor






The engine mount was made of an aluminum angle and a reflector bracket. To mount the engine, holes were drilled into the aluminum. One side of the corner was then cut out to make room for the wheel.

The wheel was attached by wrapping duct tape around the motor shaft until the connection was tight enough to push the wheel directly onto the duct tape. This method works well, but it needs to be improved in the future.

Once the motor and wheel were attached to the aluminum, I found a good spot on the frame to mount everything. I attached the blank to the seat tube. My bike's frame is 61cm, so the area where the generator is mounted is quite large compared to smaller bikes. Just find it on your bike the best place for installing a generator.

Once I found a suitable location, I made marks for the aluminum bracket with the reflector bracket installed so that it could be cut to fit. the right size. I then drilled holes in the bracket and aluminum and mounted the structure onto the bike.

I finished assembling the 12 volt bicycle generator by attaching the project box to an aluminum mount with two posts.

Step 4: Connecting the Wires





The bicycle dynamo is assembled, now all you need to do is just connect the wires to the light bulbs. I pushed the ends of the wires past the battery terminals to the headlight, then drilled a hole in the headlight housing to feed the wires through. The wires were then connected to the battery connector. You will also need to make holes in the project box for the wires.

Greetings, brainwashes! Homemade This brain guide has an excellent property - it allows you to combine business with pleasure, namely, by playing sports and generating electricity.

The basis homemade products- a bicycle connected to a motor, which will convert your calories into electric current. And in more detail, the rotation of the pedals is transmitted to the rear wheel, which accordingly rotates the engine shaft, as a result of which an electric current arises in the engine windings, which is supplied through the charge controller to the connected battery and “canned” there. An inverter is connected to the battery, having two socket outlets and two USB outputs. To control and monitor all electronics, an Arduino microcontroller is used, which turns on/off the charge controller and inverter, and also displays parameters from the sensors via an LCD display.

Materials and components:

Bicycle frame with rear wheel
Lumber and bolts (for stand)
Bicycle training stand
Motor 24V
Cooling system belt
Belt pulley
Battery 12V
DC-DC charger
DC-AC inverter with USB outputs and sockets
Arduino (I used Leonardo, but others will work)
MOSFET (Insulated Gate Field Effect Transistor)
LED and photodiode
Hall effect sensor
LCD screen
Toggle switch “On/Off”
Relay, 5V voltage regulator, diode, buttons and resistors

Step 1: Stand

To begin, we build a front fork stand from a piece of 60x180cm plywood, 5x10cm bars and studs with nuts. I made it because I got the bike without a front wheel and had to figure out how to fix it. Stand crafts It turned out to be functional and can withstand the pressure of even the most zealous “racers”.

For rear wheel You can also make some kind of stand, but I came to the conclusion that a bicycle stand is the most suitable option. You just need to remove the additional load on the wheel, which sometimes happens on these stands, since it will only interfere with generation.

As a generator, you can take a 24-volt motor from a scooter, which we will force not to “eat” electricity, but to generate it. We remove the tire with the camera from the rim of the rear wheel and put on a belt from the cooling system, from which we take a pulley, which we install accordingly on the motor shaft. After that, we put the belt on the pulley and tighten it, then we fix the motor in this position on the plywood base.

The design of the stand is such that it can be adjusted, and this option allows you to tighten the belt and also remove the bike if necessary.

Step 2: From Alternator to Battery

Almost any rechargeable battery can be used as a “storage”; for example, I took a 12V lead-acid battery because it was on hand. But in any case you need to know specifications and operating conditions of the selected battery for proper charge/discharge, which can be found in the technical data sheet. In my case, the battery does not “like” when the voltage rises above 14V and the current is not higher than 5.4A.

Completely discharging or overloading the battery can damage it or reduce its service life, so brain circuit an “On/Off” toggle switch is installed, which prevents current leakage under phantom loads, and an Arduino microcontroller is installed, which displays the state of the circuit.

Naturally, you cannot directly connect the battery to the motor terminals, this will simply “kill” the battery, so we install a charge controller between them, which will supply the battery with electricity of the current and voltage that it requires. The controller itself will turn on when you start pedaling homemade products, and holding the controller's start button for 3 seconds will check the battery status, and if it needs charging, it will begin. When you stop pedaling, the controller turns off.

When buying a charge controller, the main thing is to choose the necessary characteristics, that is, so that it operates in the same ranges as the generator and battery. So for my brain games You need a controller that can accept input voltage up to 24V and provide 14V with a current of no more than 5.4A. Basically, controllers have the ability to customize parameters, so I just set the current on it to 5A, as required for my brain accumulator.

Step 3: Inverter

You can’t simply connect your gadgets to a battery to charge, since this also requires a certain voltage and current, so we connect an inverter to the battery, which produces electricity with the parameters necessary for charging through its sockets and USB outputs.

Inverter for crafts should be purchased according to the battery parameters and calculated power. So the battery produces 12V, the power for charging a phone is approximately 5W, and a laptop is 45-60W. I selected an inverter with a power of 400W, 2 sockets and 2 USB outputs, although I do not plan to simultaneously charge gadgets at 400W.

You don't have to install an inverter if you plan to charge only your phone or other USB devices. Then you just need to lower the voltage from the battery to 5V and “output” it via a USB cable. With this method, electricity is not once again converted from DC to AC, and then from AC to DC, but many are still inclined to trust an inverter than an improvised USB port.

The inverter itself is connected simply: the positive input of the inverter to the positive terminal of the battery, the negative brainwalk to the negative terminal. And everything works simply: the motor charges the battery through the charge controller, the battery “powers” ​​the inverter, and it charges the connected gadgets.

Step 4: Arduino and Battery Charge

It was said earlier that in order for the battery to start charging, you need to hold down the charge controller start button for 3 seconds. This is a little inconvenient, it’s especially troublesome to explain the switching order homemade products to other people. Therefore, we will “hack” the charge controller and ensure that a simple press of a button starts the entire system and you can simply turn the pedals.

The charge controller is a “magic” box, on one side of which the positive and negative contacts from the battery are connected, and on the other side the wires from the motor are connected. Anything "between these parties" is beyond this brain guides, but still you have to open this box and touch the “magic”.

The buttons are connected to the circuit with a 5-track cable, and when one of the buttons is pressed, the signal from the fifth track passes through this button along the track connected to it to the board. We replace this 5-track cable with a bunch of five ordinary wires, that is, we unsolder the cable and solder five wires, on the other end of which we install a connector through which we connect the breadboard. On this breadboard we place 4 buttons, which are not yet connected to the microcontroller; we will control the charge controller.

IMPORTANT!!! If you decide, like me, to leave the controller board without a housing, then be sure to organize a heat sink, since during “intense” driving the controller gets very hot.

To “teach” Arduino to press the start button you need to use brain relay, which, based on a signal from the microcontroller, will withstand a 3-second “press” and turn on the controller. And although many relays have built-in diodes for protection, I still recommend installing an additional one to avoid current leakage back to the Arduino pins.

The question arises: when should the Arduino trigger signal? The answer is obvious - when you start pedaling, otherwise there is no point in starting the controller. The charge controller will not “charge” an already full battery, but you can once again not check the charge level manually, but shift this responsibility to the microcontroller, that is, make it monitor the voltage and current parameters. To do this, you can use the Arduino analog inputs, but they operate in the range from 0 to 5V, while the battery terminals are 11-14V, and the motor outputs are from 0 to 24V, so we can use voltage dividers. When connecting the battery to divide the voltage, we take one 1 kOhm resistor, and the second one, going to ground, 2.2 kOhm. Then, with a maximum voltage of 14V from the battery, the second resistor from which the reading will take place will be about 4.4V (more details in the article on dividers). When connecting the motor, we use 1kOhm and 4.7kOhm resistors in the voltage divider, then at 24V from the generator the Arduino will read as 4.2V. All these measurements in the Arduino code are easy to convert into actual values.

To prevent battery overcharging homemade products the voltage at its terminals should be less than 14V, but for the generator the parameters are more flexible - if the cyclist “generates” a voltage sufficient to turn on the controller, then the controller can charge the battery. As a result, the voltage parameters will be as follows: from the generator more than 5V, and for the battery less than 14V.

The microcontroller itself will be turned on via a “button” or something similar, since it is not reasonable to keep it turned on all the time. And it is better to “power” it not from a replaceable 9V battery, but from a 12V battery. To do this, we connect the microcontroller through a connector and a 5V voltage regulator to the battery, although Arduino supports a 12V supply voltage. By the way, you can power some other electronics from these 5V, rather than using the 5V pin on the Arduino for this. We must place the regulator on the radiator, since it gets very hot during operation.

Example code:

// complete code at the end of this Instructable

int motor = A0; //motor/generator pin on the Arduino

int batt = A1; //12V battery pin

int cc = 8; //charge controller pin

int wait = 500; //delay in milliseconds

float afactor = 1023.0; //Arduino's analog read max value

float motorV, battV; //motor voltage and battery voltage

boolean hasBeenOn = false; //to remember if the charge controller has been turned on

pinMode(motor, INPUT);

pinMode(batt, INPUT);

pinMode(cc, OUTPUT);

motorV = getmotorV(); //motovr/generator output voltage

if (motorV > 1.0 && !hasBeenOn) ( //if our DC motor gives out more than 1V, we say it’s on

digitalWrite(cc, HIGH); //the cc pin is connected to a relay

//that acts as the “Start” button for the charge controller

delay(3500); //our charge controller requires the start button to be held for 3 seconds

digitalWrite(cc, LOW); //electrically releasing the start button

hasBeenOn = true; //the charge controller should be charging the battery now

delay(wait); //we want our Arduino to wait so not to check every few millisec

else if(motorV > 1.0 && hasBeenOn)(

delay(wait); //again, we don’t want the Arduino to check every few millisec

hasBeenOn = false; //the person is no longer biking

//we wrote separate functions so we could organize our code

float getmotorV())(

return (float(analogRead(motor)) / afactor * 5.0); //the motor gives out about a max of 5V

float getbattV())(

return (float(analogRead(batt)) / afactor * 14.0); //the battery technically is~13.5V

Step 5: Arduino and Inverter

Keeping the inverter constantly connected to the battery is not beneficial for several reasons. First, the phantom load discharges brain accumulator, and secondly, you need to make “protection” from cunning people who want to recharge the gadget, but do not want to turn the pedals to do so. Therefore, we again use Arduino, which will turn on/off the inverter and thereby control the charging outputs, without relying on the honesty and technical knowledge of the users.

Integrate the inverter and Arduino as a key for it, using a MOSFET. This is essentially an ordinary transistor, but it requires small gate currents, with large passing ones (but the gate voltage must be greater than that of conventional transistors, although this is not a problem for Arduino).
We connect the MOSFET in the circuit so that the negative output of the inverter is connected to the collector, the negative output of the battery to the emitter, and the output of the Arduino to the base. When all the required parameters match (such as driving duration, applied voltage, etc.), the Arduino sends a signal to the transistor and it opens, allowing current to flow from the battery to the inverter; if the Arduino interrupts the signal, the transistor turns off, breaking the circuit, and the inverter turns off.

I note that when large currents pass through the transistor crafts it gets very hot, therefore, just like on the voltage regulator, installing a heatsink on the transistor is mandatory!

Example code:

//the bolded code

int mosfet = 7; // used to turn on the inverter

unsigned long timeOn, timecheck; // for time checking

if (motorV > 1.0 && !hasBeenOn) (
timeOn = millis();

inverterControl();

// the separate function

void inverterControl() (

battV = getbattV(); //check the battery voltage

timecheck = millis() - timeOn; //check how long the user has been biking

/* We want the user to have biked for a certain amount of time

before allowing the user to charge the user’s electronics.

We also need to be sure that the battery isn’t undercharged.

if (hasBeenOn && (battV > 10.0) && (timecheck > 5000) && !mosfetOn) (

digitalWrite(mosfet, HIGH); //the inverter is on when the Arduino turns on the MOSFET

mosfetOn = true;

else if ((battV<= 10.0)) { //turns off inverter if the battery is too low

digitalWrite(mosfet, LOW);

mosfetOn = false;

else if(timecheck<5000) { //turns off if the user stopped/hasn’t biked long enough

digitalWrite(mosfet, LOW);

mosfetOn = false;

Step 6: Arduino and Feedback

As feedback during training, you can take the values ​​of the rotation speed of the rear wheel, that is, the “cyclist” will not only charge the battery, but also receive information about the intensity of his workout. To count the revolutions of the rear wheel, you can use an optical sensor and a Hall sensor.

Optical sensor

In his brain work I went by installing an optical sensor to read the number of revolutions of the rear wheel, and made this sensor from parts that came to hand. The idea is simple: an opaque object is attached to the wheel rim, here thin painted plastic, which, when rotated, periodically interrupts the LED-photodiode beam. The photodiode and LED themselves are installed in a piece of foam with a selected cavity in which the wheel rotates (see photo). Due to the flexibility of the foam, it is easy to place and configure the LED-photodiode system in it, namely, placing them on the same line, this is important, since photodiodes are very sensitive to the angle of the incident beam. As a result, when the plastic rotates, it should not interfere with the rotation of the rim itself and interrupt the beam.

The diode connection diagram is also simple: both diodes are supplied with 5V from the microcontroller, but it is necessary to install a resistor in the LED circuit, since the LED has low resistance and this means the current flowing through it will be large and the LED will simply burn out. Therefore, we mount a 1kOhm resistor in series with the LED, and then the current through the LED will flow approximately 5mA. The principle of operation of a photodiode is the opposite of that of an LED, that is, light is used to produce voltage, and not vice versa. And, therefore, in the circuit the photodiode must be installed in the opposite direction than the LED. The voltage created by the photodiode is measured across a resistor connected after the photodiode, and the magnitude of the voltage is not important, because we only care about interrupting the beam from the LED. The value of the resistor after the photodiode must be selected so that even if light from lighting lamps hits the photodiode, the voltage will be equal to 0. By brain experts I selected a 47 kOhm resistor, and when the LED beam is blocked, the voltage is 0, and when the beam hits the photodiode, a voltage sufficient for reading is generated. Thus, when the voltage is zero, the Arduino understands that the wheel has completed one rotation.

Hall Sensor

To read the wheel revolutions crafts You can also use a Hall sensor, which reacts to changes in the magnetic field incident on it. This means that in order to read the revolutions in this way, you can place a magnet on the rim, and install the Hall sensor in approximately the same way as the LED from the previous method. The principle of operation of the Hall sensor is that it produces a voltage proportional to the magnetic field applied to it, that is, every time a magnet passes near the sensor, the Arduino reads the voltage change.

Example code:

//the complete code can be found at the end of this Instructable
//the bolded code is what we add to the code from above

int pdiode = A3; //photodiode for rpm

int photodiode;

int cycle = 0;

int numCycle = 20; // for averaging use

float t0 = 0.0;

float t1;

pinMode(pdiode, INPUT);

if (motorV > 1.0 && !hasBeenOn) (

cycle = 0;

t0 = float(millis());

getRpm();

void inverterControl() (

else if(timecheck<5000) {

cycle = 0; //this is a safety since arduino can’t run multiple threads

t0 = float(millis());

void getRpm() (

//may want to consider an if else/boolean that makes sure increasing cycle only when biking

if (t0 == 0.0) ( //safety for if the arduino just started and t0 hasn’t been set yet

t0 = float(millis());

photodiode = analogRead(pdiode);

if (((photodiode != 0) && (analogRead(pdiode) == 0)) || ((photodiode == 0) && (analogRead(pdiode) != 0))) (

cycle++;

t1 = float(millis());

if (cycle > numCycle) (

rpm = (float(cycle)) / (t1 - t0)* 1000.0 * 60.0; //conversion to rotations per minute

cycle = 0;

t0 = float(millis());

Step 7: Arduino and Current Sensor

Our charge controller homemade products displays the current coming from the battery, but you can also use the current as an indicator of workout intensity. And for these purposes we will use the Hall effect mentioned in the previous step, that is, by passing current from the charge controller through a special sensor with the Hall effect, which generates a voltage proportional to the magnetic field created by the passing current, we can indirectly measure the current flowing to the battery. To process the obtained values, unfortunately, there are no specific tables of the ratios of generated voltages and currents, but this brain puzzle can be solved by passing known currents through the sensor and measuring the voltage generated by the sensor. Based on the data obtained in this way, the voltage and current ratios are derived.

This current can be converted into other statistics - energy supplied to the battery and total energy produced. That is, by comparing the energy going to the battery and the energy consumed to charge connected devices, you can determine whether the battery needs to be charged if the connected devices consume more energy than the battery can provide.

Example code:

/the complete code can be found at the end of this Instructable

//the bolded code is what we add to the code from above

int hall = A2; //for current sensing

floatWh = 0; //for recording the watt-hours generated since Arduino has been on

pinMode(hall, INPUT);

else if(motorV > 1.0 && hasBeenOn)(

getCurrent();

void getCurrent())( //the current going into the battery

current = (float(analogRead(hall))-514.5)/26.5; //equation for current from experimental plot

Wh = Wh + float(wait)/3600.0*current*13.0; // calculation for watt-hour

//assume 13V charge controller output into battery

Step 8: LCD Display

There are many options for outputting information using Arduino and LCD. The screen I chose has 2 lines with 16 characters each, 4 direction buttons, a select button and a reset button. To simplify coding, I only used directional buttons in the code; the code itself is quite “raw” with approximate values ​​for many parameters. If you speak C++, you can write your own more professional braincode. I wanted the “cyclist” to have saved statistics about the best time of one ride, the total distance, the total number of Watts/hours since the start of use crafts. During the race, I planned to display on the display the time of the race, the speed in km/h, the power generated and the energy in Watts/hours generated during the race. If this is your first time using an LCD display in your homemade, then it’s useful to get acquainted with this.

It is not difficult to calculate the necessary data: to obtain the rotation speed and km/s, you need to divide the number of wheel revolutions by the time spent to complete this number of wheel revolutions and convert into the appropriate units of measurement. Measuring the radius of the rear wheel, it is equal to 28 cm, we obtain a circumference of 175.929 cm or 0.00175929 km. Next, using the formula “speed*time=distance” we get the distance traveled. Using the formula “current * voltage” we calculate the power, and to obtain the energy value using the Riemann sum, we multiplied the instantaneous power by the elapsed time (0.5 s) and added every half second of pedal rotation.
Regarding the menu, I indexed each display and used a dummy variable to navigate through the displays.

For menus, each screen is indexed and a count dummy variable is used to navigate across screens. "Up" and "Down" will raise or lower the dummy variable, "Left" takes you to a menu of more top level, and “Right” leads to a submenu.

Menu scheme:

Main menu
> Best time
>> Show value
> Total distance
>> Show value
> Power generated
>> Show value
>Oh
>> Any information about the bike.
//Full code can be found at the end of this brain guides

//the bolded code is what we add to the code from above

// include the library code:

#include

#include< Adafruit_MCP23017.h>

#include< Adafruit_RGBLCDShield.h>

//This portion is taking word for word from Adafruit’s tutorial, which we linked above

// The shield uses the I2C SCL and SDA pins. On classic Arduinos
// this is Analog 4 and 5 so you can’t use those for analogRead() anymore

// However, you can connect other I2C sensors to the I2C bus and share

// the I2C bus. Adafruit_RGBLCDShield lcd = Adafruit_RGBLCDShield();

// These #defines make it easy to set the backlight color

#define RED 0x1

#define YELLOW 0x3

#define GREEN 0x2

#define TEAL 0x6

#define BLUE 0x4

#define VIOLET 0x5

#define WHITE 0x7

//here starts the part we coded

int ptr = 0; // menu pointer

int mins, secs, kmh;

//long term storage variables

int timeAddress = 0;

int distanceAddress = 1;

int powerAddress = 2;

byte timeValue, distanceValue, powerValue;

boolean isHome = true;

lcd.begin(16, 2);

lcd.print("Hello, world!");

lcd.setBacklight(WHITE);

timeValue = EEPROM.read(timeAddress);

distanceValue = EEPROM.read(distanceAddress);

powerValue = EEPROM.read(powerAddress);

root(); //set display to root menu

uint8_t i=0;// we put this in because the tutorial included it (not exactly sure what it’s for)

menuFunction(); //see if button is pressed

if (motorV > 1.0 && !hasBeenOn) (

lcd.clear();

lcd.setCursor(0,0);

lcd.print("Warming up...");

lcd.setCursor(0,1);

lcd.print("Keep pedaling.");

lcd.setBacklight(GREEN);

digitalWrite(cc, HIGH); //press start on charge controller

lcd.setBacklight(YELLOW);

delay(3500); //press start for 3.5 seconds

digitalWrite(cc, LOW); //stop pressing start

//battery should now be charging

lcd.clear();

lcd.setCursor(0,0);

hasBeenOn = true;

lcd.print("Charging battery");

lcd.setBacklight(RED);

lcd.setCursor(3, 1);

timeOn = millis();

//time of how long the person has been pedaling

lcd.print((millis()-timeOn)/1000);

isHome = false;

else if(motorV > 1.0 && hasBeenOn)(

secs = int((millis()-timeOn)/1000);

mins = int(secs/60);

secs = int(secs%60); //this could also be written as a separate function

lcd.clear();

lcd.setCursor(0, 0);

lcd.print(mins);

lcd.setCursor(2, 0);

// print the number of seconds since start biking

lcd.print(":");

lcd.setCursor(3, 0);

lcd.print(secs);

lcd.setCursor(9, 1);

lcd.print(rpm);

lcd.setCursor(13,1);

lcd.print("RPM");

isHome = false;

getCurrent(); //this prints W, Wh

getkmh(); //this prints km/h

if (timeValue > (millis()-timeOn/1000/60))(

timeValue = int(millis()-timeOn/1000/60);

EEPROM.write(timeAddress, timeValue);

root();

void getkmh() (

kmh = rpm*60.0*revolution;

lcd.setCursor(0, 1);

lcd.print(kmh);

lcd.setCursor(2,1);

lcd.print("km/h ");

void getCurrent())(

current = (float(analogRead(hall))-514.5)/26.5;

lcd.setCursor(6, 0);

lcd.print(int (current*13));

lcd.setCursor(8,0);

lcd.print("W");

Wh = Wh + float(wait)/3600.0*current*13.0;

lcd.setCursor(10,0);

lcd.print(Wh);

lcd.setCursor(13,0);

lcd.print("Wh");

void menuFunction() (

delay(200);

uint8_t buttons = lcd.readButtons();

if (buttons) (

if (buttons & BUTTON_UP) (

scrollUp(ptr);

if (buttons & BUTTON_DOWN) (

if(ptr >0)(

scrollDown(ptr);

if (buttons & BUTTON_LEFT) (

if(ptr >=1 && ptr<=4){

root();

else if(ptr >= 5)(

menu();

if (buttons & BUTTON_RIGHT) (

scrollRight();

void menu() (

lcd.clear();

lcd.setCursor(0, 0);

lcd.print("MENU (scroll V)");

lcd.setCursor(0, 1);

lcd.print("Top times");

ptr = 1;

void root() (

lcd.clear();

lcd.setCursor(0, 0);

lcd.print("Bike to Charge!");

lcd.setCursor(0, 1);

lcd.print("Menu (Right >)");

ptr = 0;

isHome = true;

void scrollRight() (

Serial.println(ptr);

if(ptr == 0)(

menu();

else if(ptr == 1)(

lcd.clear();

lcd.setCursor(0, 0);

lcd.print("Top time");

lcd.setCursor(0, 1);

lcd.print(timeValue); // RECALL NUMBER!!! TOP TIME

lcd.setCursor(13,1);

lcd.print("min");

ptr = 5;

else if(ptr == 2)(

lcd.clear();

lcd.setCursor(0, 0);

lcd.print("Total distance");

lcd.setCursor(0, 1);

lcd.print(distanceValue); // RECALL NUMBER!!! TOTAL DISTANCE

lcd.setCursor(14,1);

lcd.print("mi");

ptr = 6;

else if(ptr == 3)(

lcd.clear();

lcd.setCursor(0, 0);

lcd.print("Total energy");

lcd.setCursor(0, 1);

lcd.print(powerValue); // RECALL NUMBER!!! TOTAL WATCHOURS

lcd.setCursor(15,1);

lcd.print("J");

ptr = 7;

else if(ptr == 4)(

lcd.clear();

lcd.setCursor(0, 0);

lcd.print("Scroll down to ");

lcd.setCursor(0, 1);

lcd.print("read more!!! (V)"); // RECALL NUMBER!!! TOTAL WATCHOURS

ptr = 8;

void scrollDown(int i)(

Serial.println(i);

if (i == 1)(

lcd.setCursor(0, 1);

lcd.print("Total distance ");

ptr = 2;

else if (i == 2)(

lcd.setCursor(0, 1);

lcd.print("Total energy ");

ptr = 3;

else if (i == 3)(

lcd.setCursor(0, 1);

lcd.print("About!");

ptr = 4;

else if (i == 8)(

lcd.clear();

lcd.setCursor(0, 0);

lcd.print("Electronics bike");

lcd.setCursor(0, 1);

lcd.print("worked on by: ");

ptr = 9;

else if (i == 9)(

lcd.clear();

lcd.setCursor(0, 0);

lcd.print("A. McKay '13");

lcd.setCursor(0, 1);

lcd.print("J. Wong '15");

ptr = 10;

else if (i == 10)(

lcd.clear();

lcd.setCursor(0, 0);

lcd.print("A.Karapetrova'15");

lcd.setCursor(0, 1);

lcd.print("S. Walecka '15");

ptr = 11;

else if (i == 11)(

lcd.clear();

lcd.setCursor(0, 0);

lcd.print("S. Li '17");

lcd.setCursor(0, 1);

lcd.print("N. Sandford '17");

ptr = 12;

else if (i == 12)(

lcd.clear();

lcd.setCursor(0, 0);

lcd.print("For His Majesty ");

lcd.setCursor(0, 1);

lcd.print("Dwight Whitaker ");

ptr = 13;

else if (i == 13)(

lcd.clear();

lcd.setCursor(0, 0);

lcd.print("Phys 128 ");

lcd.setCursor(0, 1);

lcd.print("Pomona College ");

ptr = 14;

else if (i == 14)(

lcd.clear();

lcd.setCursor(0, 0);

lcd.print("Paid for by the ");

lcd.setCursor(0, 1);

lcd.print("SIO and Dept of ");

ptr = 15;

else if (i == 15)(

lcd.clear();

lcd.setCursor(0, 0);

lcd.print("Physics and ");

lcd.setCursor(0, 1);

lcd.print("Astronomy.");

ptr = 16;

void scrollUp(int i)(

if (i ==2)(

menu();

if (i>2)(

scrollDown(i-2);

Step 9: General Diagram and Code

95% of our circuit is assembled on a circuit board, and sensors and other electronic components are connected through pin connectors, which is very convenient. The full code is attached as a file or posted


The final step brain project is the “cultivation” of the craft, that is, giving it a completed look.

We simply carefully collect the wires into bundles and hide them in a box in the front part of the stand. We hide the wires going to the back with half a PVC pipe, which we then attach to the base. We also hide the battery - we place it in a box, we mount a plastic stand for a book or phone on the steering wheel, and we attach an LCD display to it. We isolate the toggle switch from Step 2, which protects against phantom loads, and attach it to the steering wheel handle.

And as a final chord, we paint homemade in any chosen color (without painting, of course, electronics and moving elements).

Ideas for improvement crafts:
Heat sink for charge controller
Protection from environmental influences (to use the homemade product outdoors)
Installing a Hall sensor to read wheel revolutions
More functional book stand, cup holder
Expanded and more convenient menu
More advanced code

So, brainy-the bicycle generator is ready, I hope it was useful!