Controlling throttle speed completely with Arduino

Discussions related to motors other than hub motors.
This includes R/C motors, botttom bracket, roller and geared drives.
Post Reply
ChuckB   1 mW

1 mW
Posts: 10
Joined: Jul 30 2019 8:45am

Controlling throttle speed completely with Arduino

Post by ChuckB » Sep 14 2019 5:22pm

I have a 500w non-hub motor that I want to completely control with an Arduino. I don't want to use the hand throttle. I'm going to have a program where I tell it different commands, like "go forward at x speed for 10 seconds" etc.

I have Sunfounder Mega 2560. I spent a lot of time trying to get it to control the throttle but it's not working. The best I could do was make the motor make clicking sounds. I tried to create a low pass filter with a resistor and capacitor but it didn't work. I also played around with a opticoupler.

One thing I don't understand is.. the motor controller has a positive, negative, and sensor(?) wire. If I was setting the throttle speed with the Arduino, what would I do with the positive wire on the motor controller? I'm not sure if I need to hook all the wires up to the Arduino or just the sensor and the ground wires.

If anybody could help that would be great. I spent a day working on this and it's still not working. BTW this is for a cable-car robot, not a bicycle. I hope it's ok I'm asking here. This seems to be the most knowledgeable forum.

This is a video
https://www.youtube.com/watch?v=EBIFFykNipA

Thanks

ChuckB   1 mW

1 mW
Posts: 10
Joined: Jul 30 2019 8:45am

Re: Controlling throttle speed completely with Arduino

Post by ChuckB » Sep 14 2019 7:15pm

Ok, if I hook the black throttle wire to the Arduino ground and the middle throttle wire to the Arduino 3.3v output, the motor works great. So I guess the Arduino has enough power. If I use a 100ohm resistor and 100uf capacitor, the motor just clicks. Sounds like a car that has a weak battery and the starter just clicking.

ChuckB   1 mW

1 mW
Posts: 10
Joined: Jul 30 2019 8:45am

Re: Controlling throttle speed completely with Arduino

Post by ChuckB » Sep 14 2019 8:29pm

Ok I got it working. I found a diagram online of a RC filter and it worked.

ChuckB   1 mW

1 mW
Posts: 10
Joined: Jul 30 2019 8:45am

Re: Controlling throttle speed completely with Arduino

Post by ChuckB » Sep 14 2019 8:40pm

Here's an image. The blue wire on the bottom is the center throttle wire on the controller and the white/blue stripped wire goes to the ground on the controller. I believe the resistor is 100 ohms and the capacitor 100 (not sure of the units).
arduino3.jpg
arduino3.jpg (472.36 KiB) Viewed 325 times

User avatar
DanGT86   10 kW

10 kW
Posts: 722
Joined: Sep 06 2012 9:18pm
Location: Saint Louis MO

Re: Controlling throttle speed completely with Arduino

Post by DanGT86 » Sep 15 2019 10:26am

Looks like you got it working. From what I have seen so far you can give the throttle or in your case arduino an independent 5v power source as long as the grounds are shared between the throttle and controller. The way I understand it is that the controller only cares about the voltage between the signal wire and ground.

Whats the final application for the cable car?

Animalector   10 kW

10 kW
Posts: 866
Joined: Mar 17 2012 4:50pm
Location: Mareeba - Queensland

Re: Controlling throttle speed completely with Arduino

Post by Animalector » Sep 15 2019 10:35am

Typically ebike controllers use an analogue input between 1V and 4V (ish). For a hall-effect type throttle.
Your Arduino can output PWM signal with varying duty cycle 0% to 100% pulsing 0V to 3.3V.

The RC filter averages out the % duty cycle too a voltage which becomes your throttle signal. Note Max 3.3V...

Another way you can do this is with the digital to analogue converter (I think the Arduino has a DAC ) and output the throttle signal directly.

You could also have a small op amp circuit with a 5v supply and small gain (2) to get your throttle signal up into the full usable range.

Just some thoughts
Andy

Post Reply