Beagle123
10 kW
Hi:
I'm developing a dual-motor ebike with a low speed and high speed motor. I'm programming the throttle inputs using a PICAXE chip. However, I need to be able to have a speed (rpm) sensor, so I can maximize efficiency of the motors.
I have a hall sensor and a magnet already, and I can read RPMs by using the count command:
count pin5, 1000, w0
This would count the number of times the magnet passed the sensor in one second, and store the value in a variable, w0. The problem with this is that my program freezes while it waits for this count. I can't just shorten the time period because when the bicycle wheel is traveling at 10mph for example, I'd need at least few seconds to accurately measure a few turns of the wheel.
It occurred to me that there is already lots of electrical pulses in the motors that will very accurately report the speed. There are electrical pulses in the motor's sensors that fire many times for every turn of the wheel. For example, if a motor had 21 magnets in it and a gear ratio of 5:1. Then the sensors would fire 105 times (21 X 5) for each revolution of the wheel. Right?
Can I just "tap-into" those pulses, and input into a pin on my microcontroller? Since there are 3 sensor wires each one should fire 35 times per revolution of the wheel (105 / 3)
Another option could be to use one of the power wires leading to the motor. If I tapped into a power wire it should be carrying a high voltage pwm signal 35 times per revolution. If I made a voltage divider with a 10K resistor and a 5v zener diode, it would reduce the voltage down to 5v. Then I could even the signal using capacitors. (Or maybe a diode then capacitor first.)
Does anyone know exactly what's happening with these motor wires and how I can use them to get a RPM reading?
Thanks,
Eric
I'm developing a dual-motor ebike with a low speed and high speed motor. I'm programming the throttle inputs using a PICAXE chip. However, I need to be able to have a speed (rpm) sensor, so I can maximize efficiency of the motors.
I have a hall sensor and a magnet already, and I can read RPMs by using the count command:
count pin5, 1000, w0
This would count the number of times the magnet passed the sensor in one second, and store the value in a variable, w0. The problem with this is that my program freezes while it waits for this count. I can't just shorten the time period because when the bicycle wheel is traveling at 10mph for example, I'd need at least few seconds to accurately measure a few turns of the wheel.
It occurred to me that there is already lots of electrical pulses in the motors that will very accurately report the speed. There are electrical pulses in the motor's sensors that fire many times for every turn of the wheel. For example, if a motor had 21 magnets in it and a gear ratio of 5:1. Then the sensors would fire 105 times (21 X 5) for each revolution of the wheel. Right?
Can I just "tap-into" those pulses, and input into a pin on my microcontroller? Since there are 3 sensor wires each one should fire 35 times per revolution of the wheel (105 / 3)
Another option could be to use one of the power wires leading to the motor. If I tapped into a power wire it should be carrying a high voltage pwm signal 35 times per revolution. If I made a voltage divider with a 10K resistor and a 5v zener diode, it would reduce the voltage down to 5v. Then I could even the signal using capacitors. (Or maybe a diode then capacitor first.)
Does anyone know exactly what's happening with these motor wires and how I can use them to get a RPM reading?
Thanks,
Eric