This is the 14CORE Mini sumobot driven by Arduino Microcontroller. this bot is programmed automatically find its opponents and automatically push the opponent out of the black circle, however this robots are equipped with sensors programmed to search and look to his opponent & avoid leaving the arena, ones placed in starting position and activated, should operate under their own internal logic programmed code, without your guidance or control.
Required Components
- Arduino Microcontroller, ATMEGA328 16/12, ATMEGA32u4 16 MHz, ATMEGA250 16 MHz, ATSAM3x8E, ATSAM21 (Note: The Diagram below is using NANO. (please refer to the respective pin-outs)
- L298N (H-Bridge Motor Controller)
- Tracking Sensor / Module
- Acrylic / Plastic (Body)
- Wheels / Tire
- Roller / Rounded Plastic Cup
- Obstacle Avoidance Sensor / Module (Optional)
- Ultrasonic Sensor (HCSR04)
- Gear Head Motor
- Soldering Iron
- PCB Board
- Jumper Wire / DuPont Wire
- Solder-less Breadboard
For the assembly you can use cardboard, acrylic, aluminum plate or cardboard.
Wiring Diagram
Sketch 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 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 |
/* ============================================================== 14CORE | 2 Wheel Mini SumoBot Warning: You need to test the 14CORE robot out to get desired & Best results. if your using 4 wheeled you need to modify the behavior of the l298n. Note: You can customize the pin configuration as you want Note: Some code below is not yet calibrated. -------------------------------------------------------------- ENA - 11 ENB - 9 IN1- D8 IN2- D10 IN3- D12 IN4- D13 LED- D6 BUZ- D7 A0 - Front Left Sensor A1 - Front Right Sensor A2 - Rear Left Sensor A3 - Rear Right Sensor Front Ultrasonic - ECHO - D3 Front Ultrasonic - TRIG - D2 Rear Ultrasonic - ECHO - D5 Rear Ultrasonic - TRIG - D4 ============================================================== */ #include <NewPing.h> //#include <Automaton.h> //#include <timeObj.h> //#include <pidDriver.h> #define PulseA 11 //Optional #define IN1 8 #define IN2 10 #define PulseB 9 //Optional #define IN3 12 #define IN4 13 #define RTrigger 4 #define REcho 5 #define FTrigger 2 #define FEcho 3 //timeObj monTime (3000); //boolean monMtr = false; #define Front_Maximum_Distance 200 #define FrontMinimum_Distance 0 #define Rear_Maximum_Distance 180 #define Rear_Minimum_Diatance 0 int LineVal = 128; int ReturnPath; int Ping; const int SoundFX = 7; const int OutLedPin = 6; int FxCounter = 0; int LSFrontLeft; int LSFrontRight; int LSBackLeft; int LSBackRight; /*SOUND-FX*/ const int c = 261; const int d = 294; const int e = 329; const int f = 349; const int g = 391; const int gS = 415; const int a = 440; const int aS = 455; const int b = 466; const int cH = 523; const int cSH = 554; const int dH = 587; const int dSH = 622; const int eH = 659; const int fH = 698; const int fSH = 740; const int gH = 784; const int gSH = 830; const int aH = 880; /*END OF SOUND FX*/ int ObstacleAvoidance_Left; //Optional int ObstacleAvoidance_Right; //Optional NewPing FrontSonic (FTrigger,FEcho, Front_Maximum_Distance); NewPing BackSonic (RTrigger, REcho, Rear_Maximum_Distance); void setup(){ Serial.begin(115200); pinMode(SoundFX, OUTPUT); pinMode(OutLedPin, OUTPUT); pinMode(PulseA, OUTPUT); pinMode(IN1, OUTPUT); pinMode(IN2, OUTPUT); pinMode(PulseB, OUTPUT); pinMode(IN3, OUTPUT); pinMode(IN4, OUTPUT); } void loop(){ int front_distance = FrontSonic.ping_cm(); int rear_distance = BackSonic.ping_cm(); SoundFX1(); beep(f, 250); beep(gS, 500); beep(f, 350); beep(a, 125); beep(cH, 500); beep(a, 375); beep(cH, 125); beep(eH, 650); delay(200); SoundFX2(); beep(f, 250); beep(gS, 500); beep(f, 375); beep(cH, 125); beep(a, 500); beep(f, 375); beep(cH, 125); beep(a, 650); delay(200); if (LSFrontRight || LSFrontLeft > 100 ) { Serial.println("Starting......"); Serial.println("--------------------------"); Serial.println("14CORE | Front Sensor"); Serial.println("=========================="); Serial.println("Front Ping Value:"); Serial.println(front_distance); Serial.println("CM:"); Serial.println(); Serial.println("14CORE | Rear Sensor"); Serial.println("=========================="); Serial.println("Rear Ping Value:"); Serial.println(rear_distance); Serial.println("CM:"); if (front_distance > 25){ searchMode(); delay(100); } if (front_distance <= 25){ MoveForward(); delay(300); } else { ScapeRotateLeft(); } if (rear_distance <= 20){ ScapeRotateRight(); delay(500); MoveForward(); delay(100); FullStop(); } else { MoveLeft(); delay(300); MoveForward(); delay(200); FullStop(); } } while(1) // FRONT LINE SENSOR { LSFrontLeft = analogRead(14); LSFrontRight = analogRead(15); LSBackLeft = analogRead(16); LSBackRight = analogRead(17); if (LSFrontLeft < LineVal && LSFrontRight < LineVal){ MoveBackward(); delay(300); if (LSFrontLeft < LineVal){ ScapeRotateRight(); delay(300); } if (LSFrontRight < LineVal){ ScapeRotateLeft(); delay(300); } } //REAR LINE SENSOR if ( LSBackLeft < LineVal && LSBackRight < LineVal){ MoveForward(); delay(300); } if ( LSBackLeft < LineVal){ MoveRight(); delay(300); } if(LSBackRight < LineVal){ MoveLeft(); delay(300); } } } //START H-BRIDGE void MoveForward(){ analogWrite(PulseA, 200); digitalWrite(IN1, 0); digitalWrite(IN2, 1); analogWrite(PulseB, 200); digitalWrite(IN3, 1); digitalWrite(IN4, 0); } void MoveBackward(){ analogWrite(PulseA, 150); digitalWrite(IN1, 0); digitalWrite(IN2, 1); analogWrite(PulseB, 200); digitalWrite(IN3, 0); digitalWrite(IN4, 1); } //Turn 180* void MoveRight(){ analogWrite(PulseA, 200); digitalWrite(IN1, 1); digitalWrite(IN2, 0); analogWrite(PulseB, 200); digitalWrite(IN3, 0); digitalWrite(IN4, 1); } //Turn 180* void MoveLeft(){ analogWrite(PulseA, 200); digitalWrite(IN1, 1); digitalWrite(IN2, 0); analogWrite(PulseB, 200); digitalWrite(IN3, 0); digitalWrite(IN4, 1); } void ScapeRotateRight(){ analogWrite(PulseA, 150); digitalWrite(IN1, 1); digitalWrite(IN2, 0); analogWrite(PulseB, 200); digitalWrite(IN3, 0); digitalWrite(IN4, 1); } void ScapeRotateLeft(){ analogWrite(PulseA, 200); digitalWrite(IN1, 1); digitalWrite(IN2, 0); analogWrite(PulseB, 150); digitalWrite(IN3, 1); digitalWrite(IN4, 0); } void FullStop(){ analogWrite(PulseA, 200); digitalWrite(IN1, 1); digitalWrite(IN2, 1); analogWrite(PulseB, 200); digitalWrite(IN3, 1); digitalWrite(IN4, 1); } void chargeOpt(){ analogWrite(PulseA, 250); digitalWrite(IN1, 0); digitalWrite(IN2, 1); analogWrite(PulseB, 250); digitalWrite(IN3, 1); digitalWrite(IN4, 0); } void defenseOpt(){ analogWrite(PulseA, 200); digitalWrite(IN1, 1); digitalWrite(IN2, 0); analogWrite(PulseB, 200); digitalWrite(IN3, 0); digitalWrite(IN4, 1); delay(500); analogWrite(PulseA, 200); digitalWrite(IN1, 1); digitalWrite(IN2, 0); analogWrite(PulseB, 200); digitalWrite(IN3, 0); digitalWrite(IN4, 1); } void searchMode(){ analogWrite(PulseA, 150); digitalWrite(IN1, 1); digitalWrite(IN2, 0); analogWrite(PulseB, 200); digitalWrite(IN3, 0); digitalWrite(IN4, 1); delay(500); analogWrite(PulseA, 200); digitalWrite(IN1, 1); digitalWrite(IN2, 1); analogWrite(PulseB, 200); digitalWrite(IN3, 1); digitalWrite(IN4, 1); delay(500); analogWrite(PulseA, 200); digitalWrite(IN1, 1); digitalWrite(IN2, 0); analogWrite(PulseB, 150); digitalWrite(IN3, 1); digitalWrite(IN4, 0); } // START SOUND FX & LIGHT INDICATOR void beep(int note, int duration){ tone(SoundFX, note, duration); if(FxCounter % 2 == 0){ digitalWrite(OutLedPin, 1); delay(duration); digitalWrite(OutLedPin, 0); } noTone(SoundFX); delay(50); FxCounter++; } void SoundFX1() { beep(a, 500); beep(a, 500); beep(a, 500); beep(f, 350); beep(cH, 150); beep(a, 500); beep(f, 350); beep(cH, 150); beep(a, 650); delay(500); beep(eH, 500); beep(eH, 500); beep(eH, 500); beep(fH, 350); beep(cH, 150); beep(gS, 500); beep(f, 350); beep(cH, 150); beep(a, 650); delay(500); } void SoundFX2() { beep(aH, 500); beep(a, 300); beep(a, 150); beep(aH, 500); beep(gSH, 325); beep(gH, 175); beep(fSH, 125); beep(fH, 125); beep(fSH, 250); delay(325); beep(aS, 250); beep(dSH, 500); beep(dH, 325); beep(cSH, 175); beep(cH, 125); beep(b, 125); beep(cH, 250); delay(350); } |
Downloads
14CORE Mini Sumo Robot with Multi-senors on Arduino Microcontroller
HI, i was just wondering how heavy is this?
Its depend on how you construct the body/kit, you can use allow or light plastics or metal, motor controller can handle 24v.
Can I ask you something. If using 4 engines, you have to adjust what of the l298n
Engine? you mean motor, if your using 4 motor use PWM, coded to your MCU, see below, link.
https://www.14core.com/wiring-driving-the-l298n-h-bridge-on-2-to-4-dc-motors/
Estimado:
No logro compilar el arcchivo me tira este error:
Tone.cpp.o (symbol from plugin): In function
timer0_pin_port':
__vector_7′(.text+0x0): multiple definition of
libraries\NewPing\NewPing.cpp.o (symbol from plugin):(.text+0x0): first defined here
collect2.exe: error: ld returned 1 exit status
exit status 1
Error compilando para la tarjeta Arduino Uno.
Tendrias alguna solucion?
Muchas Gracias.