Toy car with Picamera and Raspberry pi using python
- Raspberry Pi
- Picamera
- Motor Driver
- DC Motor(L298 H-Bridge)
- Arduino Nano(Optional)
- Car Body
- Battery and Power bank for driver motor and Raspberry Pi
- Cable Jumper
- Laptop or PC
python 3.7
python3 -m pip install -U pygame --user
python 3.8
python3 -m pip install -U pygame==2.0.0.dev6 --user
Check this Pygame installation if having troubles
Use PWM pin in Arduino to control motors speed here is the links for Arduino PWM pin and Arduino PWM tutorial
Arduino Nano ------> Driver Motor
- D11 -------------> IN1
- D10 -------------> IN2
- D9 --------------> IN3
- D6 --------------> IN4
- GND -------------> GND
- 5V --------------> 5V <<-------- to power Arduino nano with battery
here is the link for Raspberry Pi GPIO or type this in Raspberry Pi terminal
pinout
Rpi GPIO ------------> Driver Motor
- GPI0 10--------------> IN1
- GPIO 24--------------> IN2
- GPIO 27--------------> IN3
- GPIO 18--------------> IN4
- GND -----------------> GND
- Run this code from laptop/PC
play.py
- Run this code if using Arduino
car.py
or run this code without Arduino
car-without-arduino.py
- From Raspberry Pi terminal connect to Laptop/PC using IP address
-
Raspberry Pi Picamera streaming data over wifi reference or visit Picamera documentation
-
Sending data and receiving data using socket reference or visit socket documentation