How to control direction and speed of DC motor with joystick?

Hi, I’m a university student from Engineering faculty.
I’m trying to control my the direction and speed of my car. Now I can control only the direction but the motor still run with the maximum speed. How can I control the speed?
I use esp8266 with BLYNK to control. Help me please, if any completed code would be nice.

1 Like

Could you share what type of motor you have and whether you are using any hardware besides arduino to control the motor? How does your car work? Does it have two motors each driving one side of the wheels or does it have one motor on rear wheel and something else to control front wheel direction?

I made my car like this. It’s a back wheel drive with 2 dc motors (RS380) using L298N as a motor driver.
I’ve tried this code already but it can’t control the speed.

You have a 2-axis joystick sending x and y values. What range of values do you receive? If you don’t know put some Serial.prints in to find out.

Do you understand what the program is doing with those values now? I.e. how it is controlling direction?

Which of the values do you expect to use to control the speed? Or do you plan to send some other value/s to control the speed?


Could you please post your own code, deleting the WiFi and api information? Also make a short video for your project, how your controls translate into the car’s motions.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.