Tags:
create new tag
view all tags

Controlling the DC motors

The motors cannot be driven by the Arduino PWM outputs directly but they must pass through a motor driver boosting the signal power In our case an L298N bridge is used, which is well described on this page.

This table shows how the driver module is connected to the Arduino Uno:

EN A

IN 1

IN 2

IN 3

IN 4

EN B

11

10

9

7

6

5

The following pins on the Arduino Uno are PWM pins:

3,5,6,9,11

The IN1-IN4 pins define the direction of the movement and the EN pin, which is a PWM signal, controls the speed.

Then controlling the robot through Bluetooth then the PWM pins allow me to have values between 0 and 255. However, the motors need a certain current before they start moving. Since the motor values sent through the protocol are 9 bits (10 bit ADC on the Arduino but forward and backward on a single joystick potentiometer) I shift the forward or backward value by 1 bit and I and it with 0xC0. After that I add the left/right value shifted right by 2 bits which should allow me to increase the speed of one wheel with respect to the other and thus turn left or right.

-- Uli Raich - 2017-11-21

Comments

Edit | Attach | Watch | Print version | History: r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r4 - 2017-11-24 - uli
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback