HomeArduino Projects How to Make Simple DIY Bluetooth Control Car with Mecanum Wheel...

[APP Link Included] How to Make Simple DIY Bluetooth Control Car with Mecanum Wheel using Arduino UNO R3 and L293D Motor Driver?

-

‘Arduino

Mecanum Wheel Robot:

Normal Traditional wheels principle is easy you can go front and back by rotating the wheels clockwise or counter-clockwise but the this Mecanum Wheels are a little bit different. These wheels are placed in an “X” configuration. And this movement of the wheels is also different You can move the wheels in the following directions to go to different sides. These are the 12 following Combinations of movement that can be achieved from Mecanum Wheels.

Credit: servomagazine.com

Watch YouTube Video:

Mecanum Wheel Robot Circuit Schematics:

Mecanum Wheels Bluetooth Control robot Car Code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
/*
Code Name: Arduino Bluetooth Car with Mecanum Wheel
Before uploading the code you have to install the "Adafruit Motor Shield" library
Open Arduino IDE >> Go to sketch >> Include Libray >> Manage Librays...  >> Search "Adafruit Motor Shield" >> Install the Library
Author: Make DIY
Description: This program is used to control a Mecanum Wheel robot using an app that communicates with Arduino through an HC-05 Bluetooth Module.
Version: 1.0
License: Remixing or Changing this Thing is allowed. Commercial use is not allowed.
*/
   
#include <AFMotor.h>
   
//initial motors pin
AF_DCMotor motor1(1, MOTOR12_1KHZ);
AF_DCMotor motor2(2, MOTOR12_1KHZ);
AF_DCMotor motor3(3, MOTOR34_1KHZ);
AF_DCMotor motor4(4, MOTOR34_1KHZ);
   
int val;
int Speeed = 255; // Change this value between 0 to 255 for speed
   
void setup()
{
  Serial.begin(9600);  //Set the baud rate to your Bluetooth module.
}
void loop(){
  if(Serial.available() > 0){
    val = Serial.read();
       
    Stop(); //initialize with motors stoped
       
          if (val == 'F'){
          forward();
          }
   
          if (val == 'B'){
          back();
          }
   
          if (val == 'L'){
          left();
          }
   
          if (val == 'R'){
          right();
          }
          if (val == 'I'){
          topright();
          }
   
          if (val == 'J'){
          topleft();
          }
   
          if (val == 'K'){
          bottomright();
          }
   
          if (val == 'M'){
          bottomleft();
          }
          if (val == 'T'){
          Stop();
          }
  }
}
            
   
  /*
    Motor1= Top Left
    Motor2= Bottom Left
    Motor3= Bottom Right
    Motor4= Top Right
 
    Motor1, Motor4 are forward 2 Motors
    Motor2, Motor3 are backward 2 Motors
 
    If any of your motor is not rotating in right direction
    then please check the Wire connections.
     
    If you connect the Motor points as same I showed
    in the Schematics then this code is enough
    to run your car.
 
  */         
   
   
   
void forward()
{
  motor1.setSpeed(Speeed);
  motor1.run(FORWARD);
  motor2.setSpeed(Speeed);
  motor2.run(BACKWARD);
  motor3.setSpeed(Speeed);
  motor3.run(FORWARD);
  motor4.setSpeed(Speeed);
  motor4.run(BACKWARD);
}
   
void back()
{
  motor1.setSpeed(Speeed);
  motor1.run(BACKWARD);
  motor2.setSpeed(Speeed);
  motor2.run(FORWARD);
  motor3.setSpeed(Speeed);
  motor3.run(BACKWARD);
  motor4.setSpeed(Speeed);
  motor4.run(FORWARD); 
}
   
void left()
{
 
  motor1.setSpeed(Speeed);
  motor1.run(BACKWARD);
  motor2.setSpeed(Speeed);
  motor2.run(BACKWARD);
  motor3.setSpeed(Speeed);
  motor3.run(BACKWARD);
  motor4.setSpeed(Speeed);
  motor4.run(BACKWARD);
 
   
}
   
void right()
{
 
  motor1.setSpeed(Speeed);
  motor1.run(FORWARD);
  motor2.setSpeed(Speeed);
  motor2.run(FORWARD);
  motor3.setSpeed(Speeed);
  motor3.run(FORWARD);
  motor4.setSpeed(Speeed);
  motor4.run(FORWARD);
   
}
   
void topleft(){
 
  motor1.setSpeed(Speeed);
  motor1.run(FORWARD);
//  motor2.setSpeed(Speeed/3.1);
//  motor2.run(FORWARD);
  motor3.setSpeed(Speeed);
  motor3.run(FORWARD);
//  motor4.setSpeed(Speeed);
//  motor4.run(FORWARD);
 
}
   
void topright()
{
 
//  motor1.setSpeed(Speeed);
//  motor1.run(FORWARD);
  motor2.setSpeed(Speeed);
  motor2.run(BACKWARD);
//  motor3.setSpeed(Speeed/3.1);
//  motor3.run(FORWARD);
  motor4.setSpeed(Speeed);
  motor4.run(BACKWARD);
   
}
   
void bottomleft()
{
 
//  motor1.setSpeed(Speeed);
//  motor1.run(FORWARD);
  motor2.setSpeed(Speeed);
  motor2.run(FORWARD);
//  motor3.setSpeed(Speeed/3.1);
//  motor3.run(FORWARD);
  motor4.setSpeed(Speeed);
  motor4.run(FORWARD);
 
   
}
   
void bottomright()
{
 
 
 
 
  motor1.setSpeed(Speeed);
  motor1.run(BACKWARD);
//  motor2.setSpeed(Speeed/3.1);
//  motor2.run(FORWARD);
  motor3.setSpeed(Speeed);
  motor3.run(BACKWARD);
//  motor4.setSpeed(Speeed);
//  motor4.run(FORWARD);
   
 
}
   
   
void Stop()
{
  motor1.setSpeed(0);
  motor1.run(RELEASE); //stop the motor when release the button
  motor2.setSpeed(0);
  motor2.run(RELEASE);
  motor3.setSpeed(0);
  motor3.run(RELEASE);
  motor4.setSpeed(0);
  motor4.run(RELEASE);
}

Things Needed to Make DIY Arduino Mecanum Wheels  Bluetooth control car using Arduino UNO, L293D Motor Driver, HC-05:

Amazon.in Links:

Amazon US Links:

Banggood Links:

Download App:

HashTag:

#DIYProject #ArduinoProject #MecanumWheels #BluetoothCar #L293D

RELATED ARTICLES

- Advertisment -

YOU MIGHT LIKE