Mecanum Wheel... Omni Direction Wifi RC Car
Step by step how to build an RC Car with Mecanum Wheel. It makes the car can go to any direction by pressing the smartphone's buttons
Components and supplies
1
Arduino Nano R3
1
Battery Holder, 18650 x 2
1
Dual H-Bridge motor drivers L298
1
Wemos D1 Mini
Project description
Code
Sketch after modified
arduino
Sketch Arduino after Modified
1/* 2 -- 4wd -- 3//YOUTUBE.COM/LIGHTTUBES 4//PONCOLHIJAU.WEB.ID 5 This source code of graphical user interface 6 has been generated automatically by RemoteXY editor. 7 To compile this code using RemoteXY library 3.1.6 or later version 8 download by link http://remotexy.com/en/library/ 9 To connect using RemoteXY mobile app by link http://remotexy.com/en/download/ 10 - for ANDROID 4.7.12 or later version; 11 - for iOS 1.4.7 or later version; 12 13 This source code is free software; you can redistribute it and/or 14 modify it under the terms of the GNU Lesser General Public 15 License as published by the Free Software Foundation; either 16 version 2.1 of the License, or (at your option) any later version. 17*/ 18 19////////////////////////////////////////////// 20// RemoteXY include library // 21////////////////////////////////////////////// 22 23// RemoteXY select connection mode and include library 24#define REMOTEXY_MODE__ESP8266WIFI_LIB_POINT 25#include <ESP8266WiFi.h> 26 27#include <RemoteXY.h> 28 29// RemoteXY connection settings 30#define REMOTEXY_WIFI_SSID "RemoteXY" 31#define REMOTEXY_WIFI_PASSWORD "12345678" 32#define REMOTEXY_SERVER_PORT 6377 33 34 35 36// RemoteXY configurate 37#pragma pack(push, 1) 38uint8_t RemoteXY_CONF[] = 39 { 255,5,0,0,0,53,0,13,13,1, 40 1,1,42,47,12,12,2,31,84,0, 41 1,1,26,51,12,12,2,31,70,0, 42 1,1,26,75,12,12,2,31,66,0, 43 1,1,14,63,12,12,2,31,76,0, 44 1,1,38,63,12,12,2,31,82,0 }; 45 46// this structure defines all the variables and events of your control interface 47struct { 48 49 // input variables 50 uint8_t button_t; // =1 if button pressed, else =0 //turning 51 uint8_t button_f; // =1 if button pressed, else =0 //forward 52 uint8_t button_b; // =1 if button pressed, else =0 //backward 53 uint8_t button_l; // =1 if button pressed, else =0 54 uint8_t button_r; // =1 if button pressed, else =0 55 56 // other variable 57 uint8_t connect_flag; // =1 if wire connected, else =0 58 59} RemoteXY; 60#pragma pack(pop) 61 62///////////////////////////////////////////// 63// END RemoteXY include // 64///////////////////////////////////////////// 65 66 67 68//LIGHT================ 69//output to motor 70#define mfr1 D5 //motor front right 1 71#define mfr2 D6 //motor front right 2 72#define mfl1 D7 //motor front left 1 73#define mfl2 D8 //motor front left 2 74#define mbr1 D1 75#define mbr2 D2 76#define mbl1 D3 77#define mbl2 D4 78 79 80//LIGHT================ 81 82void setup() 83{ 84 RemoteXY_Init (); 85 86 //LIGHT================ 87 //output to motor 88 pinMode (mfr1, OUTPUT); //motor front right 1 89 pinMode (mfr2, OUTPUT); //motor front right 2 90 pinMode (mfl1, OUTPUT); 91 pinMode (mfl2, OUTPUT); 92 pinMode (mbr1, OUTPUT); 93 pinMode (mbr2, OUTPUT); 94 pinMode (mbl1, OUTPUT); 95 pinMode (mbl2, OUTPUT); 96 97 //LIGHT================ 98 99 // TODO you setup code 100 101} 102 103void loop() 104{ 105 RemoteXY_Handler (); 106 107 //LIGHT================ 108 109 110 if (RemoteXY.button_f == HIGH) //forward 111 { 112 digitalWrite(mfr1, LOW); 113 digitalWrite(mfr2, HIGH); 114 digitalWrite(mbr1, LOW); 115 digitalWrite(mbr2, HIGH); 116 117 digitalWrite(mfl1, LOW); 118 digitalWrite(mfl2, HIGH); 119 digitalWrite(mbl1, LOW); 120 digitalWrite(mbl2, HIGH); 121 } 122 123 else if (RemoteXY.button_b == HIGH) //backward 124 { 125 digitalWrite(mfr1, HIGH); 126 digitalWrite(mfr2, LOW); 127 digitalWrite(mbr1, HIGH); 128 digitalWrite(mbr2, LOW); 129 130 digitalWrite(mfl1, HIGH); 131 digitalWrite(mfl2, LOW); 132 digitalWrite(mbl1, HIGH); 133 digitalWrite(mbl2, LOW); 134 } 135 136 else if (RemoteXY.button_l == HIGH) //slide left 137 { 138 digitalWrite(mfr1, LOW); 139 digitalWrite(mfr2, HIGH); 140 digitalWrite(mbr1, HIGH); 141 digitalWrite(mbr2, LOW); 142 143 digitalWrite(mfl1, HIGH); 144 digitalWrite(mfl2, LOW); 145 digitalWrite(mbl1, LOW); 146 digitalWrite(mbl2, HIGH); 147 } 148 149 else if (RemoteXY.button_r == HIGH) //slide right 150 { 151 digitalWrite(mfr1, HIGH); 152 digitalWrite(mfr2, LOW); 153 digitalWrite(mbr1, LOW); 154 digitalWrite(mbr2, HIGH); 155 156 digitalWrite(mfl1, LOW); 157 digitalWrite(mfl2, HIGH); 158 digitalWrite(mbl1, HIGH); 159 digitalWrite(mbl2, LOW); 160 } 161 162 else if (RemoteXY.button_t == HIGH) //turning 163 { 164 digitalWrite(mfr1, LOW); 165 digitalWrite(mfr2, HIGH); 166 digitalWrite(mbr1, LOW); 167 digitalWrite(mbr2, HIGH); 168 169 digitalWrite(mfl1, HIGH); 170 digitalWrite(mfl2, LOW); 171 digitalWrite(mbl1, HIGH); 172 digitalWrite(mbl2, LOW); 173 } 174 175 else { 176 digitalWrite(mfr1, LOW); 177 digitalWrite(mfr2, LOW); 178 digitalWrite(mbr1, LOW); 179 digitalWrite(mbr2, LOW); 180 181 digitalWrite(mfl1, LOW); 182 digitalWrite(mfl2, LOW); 183 digitalWrite(mbl1, LOW); 184 digitalWrite(mbl2, LOW); 185 } 186} 187 188//LIGHT================ 189 190// TODO you loop code 191// use the RemoteXY structure for data transfer 192// do not call delay() 193
Sketch after modified
arduino
Sketch Arduino after Modified
1/* 2 -- 4wd -- 3//YOUTUBE.COM/LIGHTTUBES 4//PONCOLHIJAU.WEB.ID 5 6 This source code of graphical user interface 7 has been generated automatically 8 by RemoteXY editor. 9 To compile this code using RemoteXY library 3.1.6 or later 10 version 11 download by link http://remotexy.com/en/library/ 12 To connect 13 using RemoteXY mobile app by link http://remotexy.com/en/download/ 14 - for 15 ANDROID 4.7.12 or later version; 16 - for iOS 1.4.7 or later version; 17 18 19 This source code is free software; you can redistribute it and/or 20 modify 21 it under the terms of the GNU Lesser General Public 22 License as published by 23 the Free Software Foundation; either 24 version 2.1 of the License, or (at your 25 option) any later version. 26*/ 27 28////////////////////////////////////////////// 29// 30 RemoteXY include library // 31////////////////////////////////////////////// 32 33// 34 RemoteXY select connection mode and include library 35#define REMOTEXY_MODE__ESP8266WIFI_LIB_POINT 36#include 37 <ESP8266WiFi.h> 38 39#include <RemoteXY.h> 40 41// RemoteXY connection settings 42#define 43 REMOTEXY_WIFI_SSID "RemoteXY" 44#define REMOTEXY_WIFI_PASSWORD "12345678" 45#define 46 REMOTEXY_SERVER_PORT 6377 47 48 49 50// RemoteXY configurate 51#pragma pack(push, 52 1) 53uint8_t RemoteXY_CONF[] = 54 { 255,5,0,0,0,53,0,13,13,1, 55 1,1,42,47,12,12,2,31,84,0, 56 57 1,1,26,51,12,12,2,31,70,0, 58 1,1,26,75,12,12,2,31,66,0, 59 1,1,14,63,12,12,2,31,76,0, 60 61 1,1,38,63,12,12,2,31,82,0 }; 62 63// this structure defines all the variables 64 and events of your control interface 65struct { 66 67 // input variables 68 69 uint8_t button_t; // =1 if button pressed, else =0 //turning 70 uint8_t button_f; 71 // =1 if button pressed, else =0 //forward 72 uint8_t button_b; // =1 if button 73 pressed, else =0 //backward 74 uint8_t button_l; // =1 if button pressed, else 75 =0 76 uint8_t button_r; // =1 if button pressed, else =0 77 78 // other 79 variable 80 uint8_t connect_flag; // =1 if wire connected, else =0 81 82} RemoteXY; 83#pragma 84 pack(pop) 85 86///////////////////////////////////////////// 87// END 88 RemoteXY include // 89///////////////////////////////////////////// 90 91 92 93//LIGHT================ 94//output 95 to motor 96#define mfr1 D5 //motor front right 1 97#define mfr2 D6 //motor front 98 right 2 99#define mfl1 D7 //motor front left 1 100#define mfl2 D8 //motor front 101 left 2 102#define mbr1 D1 103#define mbr2 D2 104#define mbl1 D3 105#define mbl2 106 D4 107 108 109//LIGHT================ 110 111void setup() 112{ 113 RemoteXY_Init 114 (); 115 116 //LIGHT================ 117 //output to motor 118 pinMode (mfr1, 119 OUTPUT); //motor front right 1 120 pinMode (mfr2, OUTPUT); //motor front right 121 2 122 pinMode (mfl1, OUTPUT); 123 pinMode (mfl2, OUTPUT); 124 pinMode (mbr1, 125 OUTPUT); 126 pinMode (mbr2, OUTPUT); 127 pinMode (mbl1, OUTPUT); 128 pinMode 129 (mbl2, OUTPUT); 130 131 //LIGHT================ 132 133 // TODO you setup code 134 135} 136 137void 138 loop() 139{ 140 RemoteXY_Handler (); 141 142 //LIGHT================ 143 144 145 146 if (RemoteXY.button_f == HIGH) //forward 147 { 148 digitalWrite(mfr1, LOW); 149 150 digitalWrite(mfr2, HIGH); 151 digitalWrite(mbr1, LOW); 152 digitalWrite(mbr2, 153 HIGH); 154 155 digitalWrite(mfl1, LOW); 156 digitalWrite(mfl2, HIGH); 157 158 digitalWrite(mbl1, LOW); 159 digitalWrite(mbl2, HIGH); 160 } 161 162 163 else if (RemoteXY.button_b == HIGH) //backward 164 { 165 digitalWrite(mfr1, 166 HIGH); 167 digitalWrite(mfr2, LOW); 168 digitalWrite(mbr1, HIGH); 169 digitalWrite(mbr2, 170 LOW); 171 172 digitalWrite(mfl1, HIGH); 173 digitalWrite(mfl2, LOW); 174 175 digitalWrite(mbl1, HIGH); 176 digitalWrite(mbl2, LOW); 177 } 178 179 else 180 if (RemoteXY.button_l == HIGH) //slide left 181 { 182 digitalWrite(mfr1, LOW); 183 184 digitalWrite(mfr2, HIGH); 185 digitalWrite(mbr1, HIGH); 186 digitalWrite(mbr2, 187 LOW); 188 189 digitalWrite(mfl1, HIGH); 190 digitalWrite(mfl2, LOW); 191 192 digitalWrite(mbl1, LOW); 193 digitalWrite(mbl2, HIGH); 194 } 195 196 else 197 if (RemoteXY.button_r == HIGH) //slide right 198 { 199 digitalWrite(mfr1, HIGH); 200 201 digitalWrite(mfr2, LOW); 202 digitalWrite(mbr1, LOW); 203 digitalWrite(mbr2, 204 HIGH); 205 206 digitalWrite(mfl1, LOW); 207 digitalWrite(mfl2, HIGH); 208 209 digitalWrite(mbl1, HIGH); 210 digitalWrite(mbl2, LOW); 211 } 212 213 else 214 if (RemoteXY.button_t == HIGH) //turning 215 { 216 digitalWrite(mfr1, LOW); 217 218 digitalWrite(mfr2, HIGH); 219 digitalWrite(mbr1, LOW); 220 digitalWrite(mbr2, 221 HIGH); 222 223 digitalWrite(mfl1, HIGH); 224 digitalWrite(mfl2, LOW); 225 226 digitalWrite(mbl1, HIGH); 227 digitalWrite(mbl2, LOW); 228 } 229 230 231 else { 232 digitalWrite(mfr1, LOW); 233 digitalWrite(mfr2, LOW); 234 digitalWrite(mbr1, 235 LOW); 236 digitalWrite(mbr2, LOW); 237 238 digitalWrite(mfl1, LOW); 239 240 digitalWrite(mfl2, LOW); 241 digitalWrite(mbl1, LOW); 242 digitalWrite(mbl2, 243 LOW); 244 } 245} 246 247//LIGHT================ 248 249// TODO you loop code 250// 251 use the RemoteXY structure for data transfer 252// do not call delay() 253
Downloadable files
Schematic
Schematic

Comments
Only logged in users can leave comments