Two years ago, I bought an electric bike. I bring it everyday to go to work and sometimes (without the battery...) for a trek. Well... why an electric bike ? It is sometimes hard to have enought motivation for a 7km trip with a very difficult slope.
In France the law is very clear about electric bikes. The power is limited to 250 watts, the speed is limited at 25km/h and also you have to make a minimal effort with the pedals. It is only an assistance.
The neomouv chronos I bought
Pedelec (this is the name of the assistance) is simple and no smart at all. It would like to know if I can make something different with a throttle command.
Pedelec only mesure rotation speed. On this system, the three-phase motor is usually in the rear wheel (sometimes on the front). A controller brings the power at the right time. Behind the pedals, there is a wheel with magnets next to a hall effect sensor.
There wires are plugged : +5v, ground and signal. The signal wire is always at 3.2v, except when there is a magnet it goes down to 0v. 3.2v comes from the controller, the hall sensor is like a contact to the ground. In fact, when I made manualy some impulsions between the ground wire and the signal the wheel turn.
Plug the signal wire to a digital output on an Arduino nano does not work. The internal resistor is too high and the wheel will never start.
With a transistor it can work easily, but I only have opto-couplers. By the way, the circuit works !
In and ground connected to the arduino, out to the signal wire and the last on the ground. The 5v wire is enough for the arduino, this is the good news !
digitalWrite(2, 1);
delay(20);
digitalWrite(2, 0);
delay(400);
This code a 20ms impulsion with a 400ms low. At this point, the motor starts.
Decreasing from 400 to 60ms shows differents steps. 60ms is the minimal value for max speed.
I bought this throttle on Amazon. It is design for electric bikes, with a special "throttle" input the mine does not have.
It has 3 wires, it operates like a variable resistor.
On my arduino input the value is between 200 and 865.
// the loop routine runs over and over again forever:
void loop() {
int sensorValue = analogRead(A6);
int amplitudeSensor = sensorValue - 200;
// amplitude : 665
// amplitude : 340 factor 1.95;
int amplitudeMotor = 400 - (amplitudeSensor / 2);
// delay is from 400 to 60
digitalWrite(2, 1);
delay(20);
digitalWrite(2, 0);
delay(amplitudeMotor);
}
But this code does not work. The wheel never stop. The mistake comes from the 5v power that has variations (5.5v to 4.3v). The button is too sensitive. I added a gap with a slow mode :
// the loop routine runs over and over again forever:
void loop() {
int sensorValue = analogRead(A6);
int writeValue = 1;
// sensor is from 200 to 865
if(sensorValue < 230 )
writeValue = 0;
int amplitudeSensor = sensorValue - 200;
// amplitude : 665
// amplitude : 340 factor 1.95;
int amplitudeMotor = 400 - (amplitudeSensor / 2);
// delay is from 400 to 60
digitalWrite(2, writeValue);
delay(20);
digitalWrite(2, 0);
delay(amplitudeMoteur);
}
Works great !
Next step ? Maybe a speed regulator, or a screen on it...