RC Robot
A hardware project that uses an Arduino and Raspberry Pi to control a robot and its motors.
Materials
- Arduino
- Power source (for Raspberry Pi)
- Power bank
- MicroUSB or USB-C cable depending on Raspberry Pi model
- Motors with encoders (2)
- Relays (2)
- Breadboard
- Wires
- Round wheels (2)
- Freely spinning wheels (1-2)
Software Setup
Optional .env
file or environment variable SERIALPORT_PATH
for changing path of the serialport in /dev
- Connect Arduino to computer and upload code from the
Arduino/
folder - Upload code from the
RaspberryPi/
folder to the Raspberry Pi - Install dependencies on Raspberry Pi with
npm install
- Start code on Raspberry Pi with
npm start
after hardware set up (Arduino starts automatically)
Hardware Setup (So far)
Complete after completing the software setup.
- Power Arduino with an outlet during testing
- Power a set of the breadboard's power rails with 12V
- Power the other set of the breadboard's power rails with the Arduino's 3.3V
- Power two relays using the 12V rails on the breadboard
(The left relay will be for the left motor and the right relay will be for the right motor) - Connect relays to their respective motors
- Connect gate ground from both relays to 3.3V ground power rail on the breadboard
- Connect gate for left relay to pin 5
- Connect gate for right relay to pin 6
- Attach motor encoders to Arduino (Instructions WIP)
- ...
- Power Raspberry Pi with a power bank
- Connect the Arduino to the Raspberry Pi via USB port
- Run the project on the Raspberry Pi with
npm start
and enjoy!