This project provides software for controlling a robot with a differential drive.
It supports teleoperation and go-to-goal behavior, making it suitable for educational robotics applications.
.
├── lib
│ ├── AS5600
│ ├── Encoder
│ ├── InitData
│ ├── Motor
│ ├── PID
│ ├── Position
│ ├── TwoWheeledRobot
│ └── Velocity
├── scripts
│ ├── SocketClient.py
│ └── SocketServer.py
└── src
└── main.cpp
The robot includes the following components:
Component | Description |
---|---|
Raspberry pi 4 8gb | Single-board computer |
Arduino Mega 2560 | Microcontroller board |
TB6612FNG | Motor driver |
AS5600 | Hall-Effect magnetic encoder |
CJMCU-9548 | I2C Multiplexer |
XL4015 5A | DC/DC converter |
4S 40A 18650 | BMS Protection Board with balance |
NCR18650B | Rechargeable Li-ion Batteries |
-
AS5600
This code uses a third party library AS5600 licensed under the MIT License. -
For more convenient work with the microcontroller board Arduino Mega 2560 PlatformIO is used.
It provides a cross-platform build system, library manager, and integrated development environment (IDE) supportYou can download PlatformIO Core separately OR use the Visual Studio Code IDE Extension.
Note
You don't need to install PlatformIO Core separately if you're using the PlatformIO IDE.
The IDE already includes PlatformIO Core, and you can access it directly through the PlatformIO IDE Terminal.
Clone the repository:
git clone https://github.com/AZhed/differential-drive-robot.git &&
cd differential-drive-robot
Connect remotely to Raspberry Pi using SSH.
Remote control requires that the Raspberry Pi and PC are connected to the same Wi-Fi network.
- Find out the IP address of Raspberry Pi.
This can be done with the following command:
ip address show
-
Check local IP address:
inet <IP-adress>
This IP address must be specified in the scripts SocketServer.py and SocketClient.py as aHOST
variable. -
Start the Server on Raspberry Pi:
python3 scripts/SocketServer.py
- Start the Client on PC:
python3 scripts/SocketClient.py
Use the following keys on your keyboard to control the robot:
Key | Command |
---|---|
w | Move forward |
x | Move backward |
a | Turn left |
d | Turn right |
s | Stop moving |
e | Increase the speed |
q | Decrease the speed |
Ctrl+С | Terminate the Сlient or Server |
This project is licensed under the MIT license.