00: ELECTRONIC DESIGN
Electronic Parts
- Battery
- Power distribution circuit
- H-bridge
- Arduino
- NRF-module
- Boost Converter
- Ball detector circuit
- Solenoid
01: Battery
- Output voltage 18.5V
- Initial Current 5A Max
- Discharge (c) 25
- Max Charge Rate (C) 2
- Weight (g) 640
- Length(mm) 146
- Height(mm) 51
- Width(mm) 42
02: Power Distribution circuit
In the robot we needed 3 different voltages to operate our devices first our battery contains 18.5 volts which are needed to operate motors secondly we needed 12 volts to operate our motor driver IC IR2104, dribbler motor and for booster circuit because the input of our booster is 12 volts. In last we needed 5 volts to operate our controller Arduino and for ball detector
Circuit:
For this purpose, we design two regulators for step down voltages by using LM7812 and
LM7805 the circuit diagram are as follow.12-volt regulator circuit consists of
- LM7812
- diode
See the Circuit Diagram:

- LM7805
- diode
- capacitor
03: Arduino Development Board
Getting-started-with-Arduino-microcontroller
04: Wireless Communication using nRF24L01
Wireless Communication using Arduino and nrf24lo1+
05: Solenoid
specification of the solenoid:
- Wire gauge 30 AWG
- Input voltage 230 V
- Number of turns of Cu wire 1800
- Resistance/meter of Cu wire 0.339
- Diameter of Teflon 8mm
06: Ball Detector Circuit
07: Booster
Booster circuit for solenoid mechanism
08: Motor Driver
motor-drivers-and-dual-h-bridge-l298
09: PROGRAMMING AND ALGORITHMS
10: Soccer Robot Code
Transmitter Code(TX):
#include <SPI.h> #include <nRF24L01.h> #include <RF24.h> #define CE_PIN 9 #define CSN_PIN 10 #define JOYSTICK_X A0 #define JOYSTICK_Y A1 #define JOYSTICK_A A2 #define JOYSTICK_B A3 const uint64_t pipe = 0xF2E4F3F6E9LL; RF24 radio(CE_PIN, CSN_PIN); int joystick[4]; void setup() { Serial.begin(9600); radio.begin(); radio.openWritingPipe(pipe); } void loop() { joystick[0] = analogRead(JOYSTICK_X); joystick[1] = analogRead(JOYSTICK_Y); joystick[2] = analogRead(JOYSTICK_A); joystick[3] = analogRead(JOYSTICK_B); radio.write( joystick, sizeof(joystick) ); }
Receiver Code(RX):
#include <SPI.h> #include <nRF24L01.h> #include <RF24.h> #define CE_PIN 9 #define CSN_PIN 10 const uint64_t pipe = 0xF2E4F3F6E9LL; RF24 radio(CE_PIN, CSN_PIN); int joystick[4]; int x,y,a,b; // Motor A int dir1PinA = 36; int dir2PinA = 37; int speedPinA = 5; // Motor B int dir1PinB = 34; int dir2PinB = 35; int speedPinB = 4; // Motor C int dir1PinC = 24; int dir2PinC = 25; int speedPinC = 2; // Motor D int dir1PinD = 26; int dir2PinD = 27; int speedPinD = 3; void setup() { Serial.begin(9600); pinMode(dir1PinA,OUTPUT); pinMode(dir2PinA,OUTPUT); pinMode(speedPinA,OUTPUT); pinMode(dir1PinB,OUTPUT); pinMode(dir2PinB,OUTPUT); pinMode(speedPinB,OUTPUT); pinMode(dir1PinC,OUTPUT); pinMode(dir2PinC,OUTPUT); pinMode(speedPinC,OUTPUT); pinMode(dir1PinD,OUTPUT); pinMode(dir2PinD,OUTPUT); pinMode(speedPinD,OUTPUT); 43 delay(1000); Serial.println("Nrf24L01 Receiver Starting"); radio.begin(); radio.openReadingPipe(1,pipe); radio.startListening();; } void loop() { if ( radio.available() ) { bool done = false; while (!done) { done = radio.read( joystick, sizeof(joystick) ); //Serial.print("X = "); Serial.print(joystick[0]); //x=joystick[0]; //Serial.print(" Y = "); Serial.println(joystick[1]); //y=joystick[1]; //Serial.print(" A = "); Serial.print(joystick[2]); //a=joystick[2]; //Serial.print(" B = "); Serial.print(joystick[3]); //b=joystick[3]; if(joystick[0]<2){ // Forward analogWrite(speedPinA, 180); analogWrite(speedPinB, 180); analogWrite(speedPinC, 150); analogWrite(speedPinD, 150); digitalWrite(dir1PinA, LOW); digitalWrite(dir2PinA, HIGH); digitalWrite(dir1PinB, HIGH); digitalWrite(dir2PinB, LOW); digitalWrite(dir1PinC, LOW); digitalWrite(dir2PinC, HIGH); digitalWrite(dir1PinD, HIGH); digitalWrite(dir2PinD, LOW);} /downward else if(joystick[0]>1022){ analogWrite(speedPinA, 180); analogWrite(speedPinB, 190); analogWrite(speedPinC, 150); analogWrite(speedPinD, 150); digitalWrite(dir1PinA, HIGH); digitalWrite(dir2PinA, LOW); digitalWrite(dir1PinB, LOW); digitalWrite(dir2PinB, HIGH); digitalWrite(dir1PinC, HIGH); digitalWrite(dir2PinC, LOW); digitalWrite(dir1PinD, LOW); digitalWrite(dir2PinD, HIGH);} //ccw else if(joystick[3]>1021){ analogWrite(speedPinA, 120); analogWrite(speedPinB, 135); analogWrite(speedPinC, 60); analogWrite(speedPinD, 60); digitalWrite(dir1PinA, HIGH); digitalWrite(dir2PinA, LOW); digitalWrite(dir1PinB, HIGH); digitalWrite(dir2PinB, LOW); digitalWrite(dir1PinC, HIGH); digitalWrite(dir2PinC, LOW); digitalWrite(dir1PinD, HIGH); digitalWrite(dir2PinD, LOW);} //cw else if(joystick[3]<2){ analogWrite(speedPinA, 120); analogWrite(speedPinB, 120); analogWrite(speedPinC, 60); analogWrite(speedPinD, 60); digitalWrite(dir1PinA, LOW); digitalWrite(dir2PinA, HIGH); digitalWrite(dir1PinB, LOW); digitalWrite(dir2PinB, HIGH); digitalWrite(dir1PinC, LOW); digitalWrite(dir2PinC, HIGH); digitalWrite(dir1PinD, LOW); digitalWrite(dir2PinD, HIGH);} 45 else {// Stop (Freespin) analogWrite(speedPinA, 0); analogWrite(speedPinB, 0); analogWrite(speedPinC, 0); analogWrite(speedPinD, 0); digitalWrite(dir1PinA, LOW); digitalWrite(dir2PinA, LOW); digitalWrite(dir1PinB, LOW); digitalWrite(dir2PinB, LOW); digitalWrite(dir1PinC, LOW); digitalWrite(dir2PinC, LOW); digitalWrite(dir1PinD, LOW); digitalWrite(dir2PinD, LOW);} //kick if(joystick[2]<2){ digitalWrite(40,HIGH);} else{ digitalWrite(40,LOW);} } } else { analogWrite(speedPinA, 0); analogWrite(speedPinB, 0); analogWrite(speedPinC, 0); analogWrite(speedPinD, 0); digitalWrite(dir1PinA, LOW); digitalWrite(dir2PinA, LOW); digitalWrite(dir1PinB, LOW); digitalWrite(dir2PinB, LOW); digitalWrite(dir1PinC, LOW); digitalWrite(dir2PinC, LOW); digitalWrite(dir1PinD, LOW); digitalWrite(dir2PinD, LOW); Serial.println("No radio available"); } }
11: Concluding Statement
In SSL vision the camera captures the image of the robots playing and ball by using color pattern embed on them. This information is broadcasted through WIFI modem. This then is received by our PCs and this information extracted from the file provided by management of the event named as ‘protobuf.
This information is further utilized to calculate and make the strategy for our robots on the field and predict the movement of opponent and ball using Line equations and orientation. This smart intelligence is used to make a strategy.
This strategy is used to calculate the directions and PWMs of all the motors mounted on each robot. Then transmitted to our robot through NRF modules. For this AI server, we are using multi threading in C# to process for 2 robots at the same time. I hope you understand the method and sequence of steps. Half of the things I have covered in separate posts so that’s why I didn’t discuss everything here.
In coming post, we will see how to setup the field for an autonomous robot. Installation of SSL software and testing with example code. Follow for upcoming updates as still there is much more left about an autonomous robot.so we will cover up everything in coming posts. I hope you enjoyed it. keep making robots.