Hello. I need to control ebike throttle. It has 3 pin throttle (5V, GND, Signal) and controller.
When I connected throttle signal to arduino analog pin (and common ground) I can read correct values 0.8V - 4V according on throttle level.
float in = analogRead(0) * 4.65 / 1023.0;
But to modify throttle level I need to send it from arduino back to controller.
When I try to use arduino digital pin PWM (3, 6, 9, 11) motor just twitch and does not run.
pinMode(3, OUTPUT); float out = in * (255.0 / 4.65); analogWrite(3, (int) out);
I tried with constant values to avoid any mistakes and removed all code from sketch.
I tested arduino PWM output voltage by cheap multimeter (voltmeter) and it is showing correct voltage (+- 0.01V), but motor just twitch.
I am using Arduino Nano ATMEGA238P.
I also tried digitalWrite / delayMicroseconds but no success, motor just twitch once or every second for a very short moment.
Do I need RC Low Pass Filtering?
What I might be doing wrong? Thanks in advance.