Difference between revisions of "Bicycle speedometer"
(Created page with "When a student in my circuits class asked if they could build a speedometer, I began to seek a simple circuit that would include a switch, a frequency meter, some way to conve...") |
|||
Line 18: | Line 18: | ||
;Lumex LDD-M512RI-RA:This is a dual-digit, seven-segment display, where the LED's cathodes for each digit are tied together to reduce the number of pins to 10. This means that unless both digits are the same, we need to alternate rapidly between showing one and the other by allowing current into one anode or the other. | ;Lumex LDD-M512RI-RA:This is a dual-digit, seven-segment display, where the LED's cathodes for each digit are tied together to reduce the number of pins to 10. This means that unless both digits are the same, we need to alternate rapidly between showing one and the other by allowing current into one anode or the other. | ||
;Fairchild BS270:This is an N-channel MOSFET suited to switching at logic levels (3-5V). The current that goes through depends on the voltage between the gate and source. When the voltage at the gate is equal to or lower than the source, no current is allowed from drain to source. Since more current is allowed when the voltage at the gate is much higher than at the source, this N-channel MOSFET is better suited to a common cathode display. I'd like to find a better MOSFET for this common-anode display, and I welcome suggestions on the [[Talk:Bicycle_speedometer|discussion]] page. | ;Fairchild BS270:This is an N-channel MOSFET suited to switching at logic levels (3-5V). The current that goes through depends on the voltage between the gate and source. When the voltage at the gate is equal to or lower than the source, no current is allowed from drain to source. Since more current is allowed when the voltage at the gate is much higher than at the source, this N-channel MOSFET is better suited to a common cathode display. I'd like to find a better MOSFET for this common-anode display, and I welcome suggestions on the [[Talk:Bicycle_speedometer|discussion]] page. | ||
+ | ;11MHz crystal:The 2051 can run up to 24MHz. We should use the slowest possible crystal to save energy. The 2051 uses half as much energy running at 8MHz as it does running at 24MHz. At 5V with an 11MHz crystal, the chip will use about 40mW, plus whatever it takes to drive the LEDs, which is about another 40mW with the initial circuit shown. | ||
+ | ;22pF capacitors:These two capacitors keep the crystal ringing, and need to be between 20pF and 40pF. | ||
+ | ;10µF capacitors:One electrolytic capacitor is used to smooth the power supply. This is probably unnecessary if hefty batteries are used and all the connections are short and good, but I'm using a solderless breadboard. The other 10µF capacitor runs the reset circuit which ensures that the program doesn't try starting until the crystal is ringing properly. | ||
+ | ;33kΩ resistor:This resistor can be anywhere in the tens-of-thousands range, and brings the capacitor attached to the reset pin low a few milliseconds after the circuit is powered. | ||
+ | ;220Ω resistors:This array limits the current passing through each LED, as controlled by the output pins on the 2051. In combination with the BS270, the current through each LED is limited to about 2mA by these resistors. Lower resistors would allow for a brighter display, but use more power. | ||
+ | ;Reed switch:A reed switch needs to be attached to the frame of the bike so that it senses a magnet attached to a spoke of the wheel once per revolution. | ||
+ | ;Power switch:Without a power switch the circuit would consume a battery in a few days or less. It should be attached to one of the wires from the battery. | ||
+ | |||
+ | ===Power supply=== | ||
+ | We can use three AAA or AA cells which would provide 3.6V to 5.1V, or one lithium 3.7V cell. Or, we can use a 9V battery with a voltage regulator. A coin battery would not last a day if we left the switch on. | ||
[[Category:Electronics]] | [[Category:Electronics]] |
Revision as of 21:54, 6 December 2013
When a student in my circuits class asked if they could build a speedometer, I began to seek a simple circuit that would include a switch, a frequency meter, some way to convert that to a speed, and a display.
Specifications
Use a magnetic reed switch attached to the frame/fork of a bicycle. Run on a battery. Include a two-digit display. Include a power switch to save the battery. Weigh as little as possible. Use a breadboard so it can be modified.
Circuit
The circuit uses a common-anode layout since the 2051's output ports can sink up to 20mA of current. Since the digits are shown in an alternating fashion, we can use a 10-pin display or tie together parallel pins of an 18-pin display.
Components
- Atmel 89C2051
- This is a very cheap (~$1) micro-controller that can run on 2.7 to 6 volts. The C variant requires a flash programmer with a 12V power supply. There is an S variant that can be serially programmed in-circuit.
- Lumex LDD-M512RI-RA
- This is a dual-digit, seven-segment display, where the LED's cathodes for each digit are tied together to reduce the number of pins to 10. This means that unless both digits are the same, we need to alternate rapidly between showing one and the other by allowing current into one anode or the other.
- Fairchild BS270
- This is an N-channel MOSFET suited to switching at logic levels (3-5V). The current that goes through depends on the voltage between the gate and source. When the voltage at the gate is equal to or lower than the source, no current is allowed from drain to source. Since more current is allowed when the voltage at the gate is much higher than at the source, this N-channel MOSFET is better suited to a common cathode display. I'd like to find a better MOSFET for this common-anode display, and I welcome suggestions on the discussion page.
- 11MHz crystal
- The 2051 can run up to 24MHz. We should use the slowest possible crystal to save energy. The 2051 uses half as much energy running at 8MHz as it does running at 24MHz. At 5V with an 11MHz crystal, the chip will use about 40mW, plus whatever it takes to drive the LEDs, which is about another 40mW with the initial circuit shown.
- 22pF capacitors
- These two capacitors keep the crystal ringing, and need to be between 20pF and 40pF.
- 10µF capacitors
- One electrolytic capacitor is used to smooth the power supply. This is probably unnecessary if hefty batteries are used and all the connections are short and good, but I'm using a solderless breadboard. The other 10µF capacitor runs the reset circuit which ensures that the program doesn't try starting until the crystal is ringing properly.
- 33kΩ resistor
- This resistor can be anywhere in the tens-of-thousands range, and brings the capacitor attached to the reset pin low a few milliseconds after the circuit is powered.
- 220Ω resistors
- This array limits the current passing through each LED, as controlled by the output pins on the 2051. In combination with the BS270, the current through each LED is limited to about 2mA by these resistors. Lower resistors would allow for a brighter display, but use more power.
- Reed switch
- A reed switch needs to be attached to the frame of the bike so that it senses a magnet attached to a spoke of the wheel once per revolution.
- Power switch
- Without a power switch the circuit would consume a battery in a few days or less. It should be attached to one of the wires from the battery.
Power supply
We can use three AAA or AA cells which would provide 3.6V to 5.1V, or one lithium 3.7V cell. Or, we can use a 9V battery with a voltage regulator. A coin battery would not last a day if we left the switch on.