Hello,
I would like to control a BLDC Motor with hall sensor using a joystick. I’m using a electric scooter wheel (24V) with integrated hall sensor.
The idea is to control the motor with PWM. I don’t need to be fast. I mostly need torque. I don’t need to be specific either, it’s just to make a toy car for kids. So I’m not looking for speed but just enough control to get off to a good start.
I looked at how the library works in serial link but I did not understand how I could directly integrate in my code the commands to send my speed command to my motor. Until now I used an Amazon card based on the JY01 component but I would like to be able to control my motor a little better for starting and braking. The card used : https://www.amazon.fr/aqxreight-Contrôleur-moteur-balais-12V-36V/dp/B08SWJ4DWS/ref=asc_df_B08SWJ4DWS/?tag=googshopfr-21&linkCode=df0&hvadid=526041473462&hvpos=&hvnetw=g&hvrand=6303912459023188680&hvpone=&hvptwo=&hvqmt=&hvdev=c&hvdvcmdl=&hvlocint=&hvlocphy=9056335&hvtargid=pla-1150561126753&psc=1
Here is the code :
if(xPosition >=650){ // The Joystick position / value
speed= map(xPosition, 650, 1023, 0 , 100); // I transform the values 0-1023 into arduino
PWM 0-255 by limiting myself to 100 so as not to go too fast
analogWrite(pwm, speed); // I send to the board
digitalWrite(ccw, LOW); // To set the direction forward
}
I am wondering if i can use this command in my loop :
motor.move(speed);
Just for the record I plan to use the PowerShield Board. I don’t have it yet, due to broken components. I am trying to order it on easy EDA.
My goal is to be sure that I will succeed in running my engine with the code. So as soon as I receive the board I can make more adjustments. Like the PID or the R and I values of my motor.
So I wanted to know if you could help me with this project, by helping me with the code. Because I’m not sure I fully understood all the code. Thank you in advance for your help.