Make it mech
  • Home
  • How & Why
    • Arduino
    • Leapmotion with arduino
    • Sensors/Modules
    • Basic Electronics
    • NodeMcu
    • LabView
    • MATLAB
    • Industrial Automation
  • Projects
    • arduino projects
    • Brain Wave Decoder
    • Circuit Diagrams
    • Electrical
    • IEE Projects
  • Ideas
  • Videos
  • Arduino
  • Robotics
  • Circuits
  • Electrical
  • LeapMotion
  • EEG
  • IOT
  • LabView
  • MATLAB
  • NodeMcu
  • Mechatronics
  • Sensors
  • Motivation
  • Soft skills
  • Success
Make it mech
Home arduino projects

Soccer Robot Electronics Design | Soccer Robot Code

Kane Dan by Kane Dan
May 19, 2021
in arduino projects, Projects, Robotics
How to design a Robot | Omnidirectional robot | Robot design
This post is the second part of the previous tutorial we have started about making Soccer robot for Robocup. In the first part, we have discussed the mechanical parts. In this post, we will see about the Electronics part.

So here is the link for the previous part:


How To Make Soccer Robot For RoboCup


00: ELECTRONIC DESIGN


Electronic Parts

  1.  Battery
  2.  Power distribution circuit
  3.  H-bridge
  4.  Arduino
  5.  NRF-module
  6.  Boost Converter
  7.  Ball detector circuit
  8.  Solenoid

01: Battery


The battery is providing source to each component and it is selected as per requirement of
the current. We have selected the lipo battery for our robot because it’s a light weight and
provide us our required current. Our Battery consist of 5 lipo cells each cell having
3.7volts total of 18.5volts battery having 5000mAh current.
  • 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

  1.  LM7812
  2.  diode

See the Circuit Diagram:

voltage regulator

 

Related posts

220v ac to 12v dc power supply

220v AC to 12v DC Power Supply Step by Step Project

May 9, 2021
Top 10 Arduino Based Projects For Final Year Students | Arduino project ideas

10-Cool Arduino projects of all time | Arduino based Projects List

May 9, 2021
5-volt regulator circuit consists of
  1. LM7805
  2. diode
  3. capacitor

03: Arduino Development Board


I am not going to discuss the basics of Arduino here. You can read about Arduino in these following posts.

Getting-started-with-Arduino-microcontroller


04: Wireless Communication using nRF24L01


The wireless communication is done between various nodes. Since we are at the node of between receiving data from GUI, therefore wireless module is used. The controlling of the robot is being done by using a joystick. The module which we used for wireless communication is nRF24L01.
I already discussed complete details about Nrf and Arduino interfacing. Read the detailed post of nrf24Lo1+. Arduino codes for Nrf are also available in that post.

Wireless Communication using Arduino and nrf24lo1+


05: Solenoid


A solenoid consists of a coil of insulated wire. We have to design solenoid to provide strong inner the magnetic field in order to fulfill our purpose of the kicking mechanism. For this purpose Teflon the material is used on which copper is wounded when current flows through the coil then strong the magnetic field is produced within the core due to which kicking mechanism of the robot will
work. One more post is available for kicker mechanism and solenoid. You can get the design files from there.

specification of the solenoid:

  1. Wire gauge 30 AWG
  2. Input voltage 230 V
  3. Number of turns of Cu wire 1800
  4. Resistance/meter of Cu wire 0.339
  5. Diameter of Teflon 8mm

06: Ball Detector Circuit


To start the dribbler we have designed the ball detector circuit which is mounted on the sides of dribbler by using IR sensor. When there is no object the receiver receives the signal from the transmitter and when the ball comes to our robot the signal will be disconnected the receiver will not generate the output signal and then this logic is inverted through using the NOT gate and it will generate a signal to operate the motor driver for the dribbler. The circuit is shown in the figure.
See the Circuit Diagram:

07: Booster


For the kick, we have to energize our coil and to energize the coil we needed high voltages for this purpose we have designed the boost converter which converts the 12 volts into 220 volts.
See the Detailed post about Booster

Booster circuit for solenoid mechanism


08: Motor Driver


To control the direction and speed of motor we have to use motor drivers.
I have done this part using L298 is and also with L298 module.
See the related post on this part.

motor-drivers-and-dual-h-bridge-l298


09: PROGRAMMING AND ALGORITHMS


The first step was to control robot manually by using remote and wireless communication this step was done by using Arduino and Nrf we first manually control the robot and check its parts are properly working and seeing its direction by controlling motors.
Here is the Code for Arduino boards:

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


After these steps, we proceed to the Artificial intelligence, after controlling manually robot. First, we serially communicate it with GUI through NRF module. One end of NRF is interfaced with Arduino UNO R3 and on another end we used Arduino MEGA 2560.
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.

Tags: soccer robotwireless robot
Previous Post

How to Give an Effective Presentation Expert Tips the effective communication skills

Next Post

Leap Motion gesture controlled Robot | Leap Robotic Arm Processing Arduino

Related Posts

220v ac to 12v dc power supply
Basic Electronics

220v AC to 12v DC Power Supply Step by Step Project

May 9, 2021
Top 10 Arduino Based Projects For Final Year Students | Arduino project ideas
arduino projects

10-Cool Arduino projects of all time | Arduino based Projects List

May 9, 2021
Top 10 Robotic Competitions in the World | Tech Event Ideas
Ideas

Robotic Projects for Useful Applications | Final Year Robot Project ideas

May 9, 2021
robotic event ideas
Ideas

Top 10 Robotic Competitions in the World | Tech Event Ideas

May 10, 2021
Top 10 Arduino Based Projects For Final Year Students | Arduino project ideas
Arduino

Top 10 Arduino Based Projects For Final Year Students | Arduino project ideas

May 10, 2021
Mechatronics Projects for Final Year students with Industrial Aspect
Ideas

How Robots are Used in daily life | Robotic applications in human life

May 10, 2021
Next Post
Leap Motion gesture controlled Robot | Leap Robotic Arm Processing Arduino

Leap Motion gesture controlled Robot | Leap Robotic Arm Processing Arduino

BROWSE BY CATEGORIES

  • Arduino (9)
  • arduino projects (7)
  • Basic Electronics (2)
  • Brain Wave Decoder (11)
  • Breadboard Circuits (1)
  • Circuit Diagrams (5)
  • Circuits (3)
  • EEG (11)
  • Electrical (2)
  • How & Why (1)
  • Ideas (9)
  • IEE Projects (2)
  • Industrial Automation (1)
  • Inspiration & Motivation (3)
  • IOT (3)
  • LabView (3)
  • Leapmotion with arduino (5)
  • MATLAB (1)
  • Mechatronics (7)
  • NodeMcu (1)
  • Projects (11)
  • Robotics (9)
  • Self Learning (3)
  • Sensors/Modules (6)
  • Soft skills (2)
  • Success (2)

Contact us

Email: marketing[at]shantelllc.com

Recent News

  • How & Why to Use DC Motors | How DC Motor Works
  • 220v AC to 12v DC Power Supply Step by Step Project
  • Battery Level Indicator Circuit With Low Charge Alarm | Inverter Battery Circuit
  • Privacy Policy
  • About Us
  • Contact Us

© 2023 Make it mech - All Rights Reserved

No Result
View All Result
  • Home
  • Politics
  • News
  • Business
  • Culture
  • National
  • Sports
  • Lifestyle
  • Travel
  • Opinion

© 2023 Make it mech - All Rights Reserved

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In
Go to mobile version