Hi, pedaling in bike in the dark can be dangerous because we can't see the others and the others can't see us, sometimes we forget to turn on the lights and we often find tons of dead batteries to change. So let's see how to build a solar automatic night lights system .

## Step 1:

Most city bikes are already equipped with headlights on batteries, in my case 2AA in front and 3AAA in rear.

The rear lights are simply 3 red leds, each with its own 40Ohm resistor in series, this leads to an average consumption of 2.5V/0,04k=62mA, 20mA each led, the voltage of the red leds is about 1.8V so in a total average of 2.5V, the leds absorbs only 1.8/2.5=70% and 30% is wasted on resistance.

## Step 2:

So I choose a voltage that was fine for all the leds without much losses, 4V and I putted two pairs of red leds in series, I used four identical high-brightness leds and I fixed them with hot glue.

The front lights are 5 white led high brightness all in parallel, the leds require 3.3V, then about 80% on the leds, which is already better, there are no large losses so i decided to remove the microcontroller and the button for the flashing, and keep these soldered in parallel as these are, in series with the white leds I putted a diode BYV95C and i connected all in parallel with the red leds.

## Step 3:

I've bought two solar panels from eBay for a few dollars, the panels are 12V polycrystalline (in parallel), about 1.5W each, approximately 14V without load and 150mA in short circuit, I have chosen them so can fit on the rear rack and these have a bit of power even when cloudy and I fixed them, in series of 1N4007 diodes with silicon directly on the rack.

I used the phone cable that I had to do all the wiring.

## Step 4:

To reduce and stabilize the voltage to 5V I used an usb car charger, you can find it on eBay or Aliexpress for about 1 dollar, then you can take the only step-down circuit .

## Step 5:

I had a phone lithium-ion battery with its integrated protection circuit, which I putted in the front headlight with the dc/dc converter with a 1N4007 diode to charge the battery.

The protection circuit will limit the under and overcharge of the battery, in addition to the protection circuit, under 3,8V the lights turn off and not consume anything.

## Step 6:

I've got a reed contact on eBay (10 pcs for about 1 dollar) and a mini Neodymium magnet from a broken CD player, and I set the sensor on the wheel with hot glue and clamps.

## Step 7:

At this point I needed a circuit to turn on and turn off the lights only in darkness and bikes on the move, so I created this circuit.

It work so: when the wheel rotates, through the reed switch and the 10K resistor the capacitor is charged, so a low p mosfet Gate turn on the lights but only when it is dark, in fact, in this situation the photoresistors (ldr) in parallel to the capacitor will made almost an open circuit and the capacitor will not be discharged, otherwise the capacitor discharge and turn the led off, bringing the Gate to high level, when the wheel does not rotate, the reed switch is open and no current flows to charge the capacitor, then the p mos does not conduct and the lights will stay off, I used a p mos to maintain common ground with the voltage converter.

You can modify the values, the resistance of 500k sets the minimum threshold power of the leds and decreases the day power consumption, adding photoresistors in series increases the on period of the lights, decreasing the 10k resistor increases the charge time of the capacitor but also will increase the current consumed in moving.

## Step 8:

In moving and in daylight the circuit consumes a bit of current (but very little), let we see how, suppose a discharged capacitor, 4V/10k=0.4 mA, suppose a use of 5 hours the bike, it's about 2mAh, the reed switch will not always stay closed but suppose that covers (like piece of cake) 1% of the entire wheel, then 2mAhx0,01=0,02mAh=20uAh (even less thanks to 500k), however, in daytime is there the charging of the solar panels, while the rest of the time consumption is zero (thanks to reed switch open), except for the battery self-discharge, the only thing you have to check is when you don't use the bike, the sensor should not be near to the magnet.

I hope you like it.