Unfortunately I don't have a picture as this was my final year project at my school and I haven't been given it back yet, but anyway, here goes. Hopefully it'll get me my GCSE A* in Electronics...
For the project I decided to design a bike light which would automatically switch on when light levels got below a certain level. Essentially it consisted of three boards, one board with the light sensing circuitry, one board with a PICAXE micro, and one board with six LEDs on it. All boards were tightly packed in a plastic case, and the circuit was powered by 3x or 4x AA cells, rechargeable batteries being an option. All boards were stripboard, designed in a CAD program and soldered by hand, and the components were all chosen to be commodity components. I used a PICAXE micro because that was all my school had. I had a PICkit2 at home and a few PIC's (mostly PIC16F690's); I considered programming my own micros in C or assembly, but I decided just to use flowcharts+PICAXE as those were the norm and the school had all the gear...
I have attached a schematic drawn from memory.
The circuit uses the 555 timer as an inverting Schmitt trigger. The capacitor C2 and the resistors LDR1, R1, and R2 add an element of delay. The rate of delay changes depending on the light levels. Recall that a 555 switches on at 2/3rd supply and off at 1/3rd. I could have also used an opamp, but a 555 was simpler, cheaper, and more familiar, plus it had lower power consumption with the CMOS variant.
If for example you enter a tunnel the output will switch on quickly (<1 sec) and when you exit the tunnel the output will switch off quickly (<1 sec). However if the light change is less sudden, for example going under a diffused street light the delay will be about 5 seconds, and if you are just riding past them then it will not usually trigger.
This feature obviously has safety benefits as you do not have to remember to switch your bike light on and you do not need to worry if the batteries are flat because you left the light on by mistake. (Of course, in the standby mode, the device draws a small current, so the batteries will eventually go flat, after about 6 months.)
The main purpose of capacitor C2 is to slow down the Schmitt trigger, which makes the output relatively slow to change. It will not suddenly change unless an extreme change of light is sensed, like going from darkness to full brightness. This means that if you are cycling along and it is just getting dark it will not switch on and off as the light level varies because of e.g. clouds, your position or even if the LEDs themselves contribute to illuminate the sensor.
The output of the timer goes through a NPN transistor because the TLC555 cannot pass the 50 mA or so needed by the PICAXE + LEDs. Now importantly the NPN drops voltage. So running at 3 volts it drops about 0.7 volts. Which means the PIC only gets 2.3 volts or so, and the LEDs only get 2 volts (because of the poor Rds(on) of the PIC's output MOSFETs... about 20 ohms.) The PIC is rated to go down to 2 volts and I have seen one working on a single AA at 1.5 volts, but the LEDs generally require 3 volts to work brightly, which is why I chose to work from 4.5 volts or 6 volts. It will still work at 3 volts, it just won't be very bright.
The pattern is chosen by pressing the pattern change button. All buttons, the main power switch and battery pack were hidden in an old water bottle, wires coming out of the lid. An idea I had was to add the option of a dynamo board, which would convert AC from a 12 volt dynamo into the 4.5 to 6 volts required by the circuit, essentially making it always functional (no need to check the batteries), but I did not have time.
Most of this circuit could have been supplemented by using the PICAXE's ADCs, however I decided to aim for a dual analog-digital design for some extra marks. So don't expect to see something like this in a production bike light.
Enjoy, I welcome feedback...
For the project I decided to design a bike light which would automatically switch on when light levels got below a certain level. Essentially it consisted of three boards, one board with the light sensing circuitry, one board with a PICAXE micro, and one board with six LEDs on it. All boards were tightly packed in a plastic case, and the circuit was powered by 3x or 4x AA cells, rechargeable batteries being an option. All boards were stripboard, designed in a CAD program and soldered by hand, and the components were all chosen to be commodity components. I used a PICAXE micro because that was all my school had. I had a PICkit2 at home and a few PIC's (mostly PIC16F690's); I considered programming my own micros in C or assembly, but I decided just to use flowcharts+PICAXE as those were the norm and the school had all the gear...
I have attached a schematic drawn from memory.
The circuit uses the 555 timer as an inverting Schmitt trigger. The capacitor C2 and the resistors LDR1, R1, and R2 add an element of delay. The rate of delay changes depending on the light levels. Recall that a 555 switches on at 2/3rd supply and off at 1/3rd. I could have also used an opamp, but a 555 was simpler, cheaper, and more familiar, plus it had lower power consumption with the CMOS variant.
If for example you enter a tunnel the output will switch on quickly (<1 sec) and when you exit the tunnel the output will switch off quickly (<1 sec). However if the light change is less sudden, for example going under a diffused street light the delay will be about 5 seconds, and if you are just riding past them then it will not usually trigger.
This feature obviously has safety benefits as you do not have to remember to switch your bike light on and you do not need to worry if the batteries are flat because you left the light on by mistake. (Of course, in the standby mode, the device draws a small current, so the batteries will eventually go flat, after about 6 months.)
The main purpose of capacitor C2 is to slow down the Schmitt trigger, which makes the output relatively slow to change. It will not suddenly change unless an extreme change of light is sensed, like going from darkness to full brightness. This means that if you are cycling along and it is just getting dark it will not switch on and off as the light level varies because of e.g. clouds, your position or even if the LEDs themselves contribute to illuminate the sensor.
The output of the timer goes through a NPN transistor because the TLC555 cannot pass the 50 mA or so needed by the PICAXE + LEDs. Now importantly the NPN drops voltage. So running at 3 volts it drops about 0.7 volts. Which means the PIC only gets 2.3 volts or so, and the LEDs only get 2 volts (because of the poor Rds(on) of the PIC's output MOSFETs... about 20 ohms.) The PIC is rated to go down to 2 volts and I have seen one working on a single AA at 1.5 volts, but the LEDs generally require 3 volts to work brightly, which is why I chose to work from 4.5 volts or 6 volts. It will still work at 3 volts, it just won't be very bright.
The pattern is chosen by pressing the pattern change button. All buttons, the main power switch and battery pack were hidden in an old water bottle, wires coming out of the lid. An idea I had was to add the option of a dynamo board, which would convert AC from a 12 volt dynamo into the 4.5 to 6 volts required by the circuit, essentially making it always functional (no need to check the batteries), but I did not have time.
Most of this circuit could have been supplemented by using the PICAXE's ADCs, however I decided to aim for a dual analog-digital design for some extra marks. So don't expect to see something like this in a production bike light.
Enjoy, I welcome feedback...
Attachments
-
209.8 KB Views: 424
Last edited by a moderator: