Tags:
tag this topic
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 [[http://www.st.com/content/ccc/resource/technical/document/datasheet/82/cc/3f/39/0a/29/4d/f0/CD00000240.pdf/files/CD00000240.pdf/jcr:content/translations/en.CD00000240.pdf][ L298N ]]bridge is used, which is well described on [[http://www.instructables.com/id/Arduino-Modules-L298N-Dualhttp://www.instructables.com/id/Arduino-Modules-L298N-Dual-H-Bridge-Motor-Controll/-H-Bridge-Motor-Controll/][this page]]. This table shows how the driver module is connected to the Arduino Uno: <table cellpadding="4" cellspacing="0" style="width: 510px; height: 68px;"><col width="43*"></col> <col width="43*"></col> <col width="43*"></col> <col width="43*"></col> <col width="43*"></col> <col width="43*"></col> <tbody> <tr valign="top"> <td width="17%"> <p align="center">EN A</p> </td> <td width="17%"> <p align="center">IN 1</p> </td> <td width="17%"> <p align="center">IN 2</p> </td> <td width="17%"> <p align="center">IN 3</p> </td> <td width="17%"> <p align="center">IN 4</p> </td> <td width="17%"> <p align="center">EN B</p> </td> </tr> <tr valign="top"> <td height="19" width="17%"> <p align="center">%BLUE%11%ENDCOLOR%</p> </td> <td width="17%"> <p align="center">10</p> </td> <td width="17%"> <p align="center">9</p> </td> <td width="17%"> <p align="center">7</p> </td> <td width="17%"> <p align="center">6</p> </td> <td width="17%"> <p align="center">%BLUE%5%ENDCOLOR%</p> </td> </tr> </tbody> </table> 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. -- %USERSIG{UliRaich - 2017-11-21}% ---++ Comments %COMMENT%
E
dit
|
A
ttach
|
Watch
|
P
rint version
|
H
istory
: r4
<
r3
<
r2
<
r1
|
B
acklinks
|
V
iew topic
|
Ra
w
edit
|
M
ore topic actions
Topic revision: r4 - 2017-11-24
-
uli
Home
Site map
AFNOG web
Embedded_Systems web
IoT_Course_English web
IoT_Course_French web
Main web
Sandbox web
TWiki web
Embedded_Systems Web
Create New Topic
Index
Search
Changes
Notifications
RSS Feed
Statistics
Preferences
P
P
View
Raw View
Print version
Find backlinks
History
More topic actions
Edit
Raw edit
Attach file or image
Edit topic preference settings
Set new parent
More topic actions
Account
Log In
Register User
E
dit
A
ttach
Copyright © 2008-2025 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki?
Send feedback