Hardware components: | ||||||
|
× | 1 | ||||
|
× | 2 | ||||
|
× | 1 | ||||
|
× | 1 | ||||
|
× | 1 | ||||
|
× | 1 | ||||
|
× | 1 | ||||
Software apps and online services: | ||||||
|
STORY
This project is about making a remote control car with a view through an attached camera.
Hardware side:
- Toy car
- Two gear motors
- Raspberry B+
- WiFi dongle
- Power bank (10A) (for Raspberry board)
- Battery (for gear motor)
- H-bridge circuit (L298N)
Software side:
- Install camera using FFmpeg (link)
- Install Local web (Apache)
- Make web page to control
- Control through Internet (by port forwarding)
Step 1: Make a Car
Install a gear motor to the toy car. It will need your clever hand and some thinking to put all the things in right way. Also, put the H-bridge inside the car.
Brief introduction about H-bridge:
H-bridge is used to control motor direction: to make the motor run clockwise, A1 and A2 must be ON; and to run counter clockwise, B1 and B2 must be ON.
The below image is of a type of Mechanical H-bridge using a relay; this project will use H-bridge from IC L298N.
The H-bridge also has 4 inputs: A1, A2, B1 and B2 (indicated in PCB as IN1, IN2, IN3 and IN4) which will triggered by Raspberry GPIO.
Make connections from Raspberry to H-bridge
Connections are as follows:
- GPIO0 – IN1
- GPIO2 – IN4
- GPIO3 – IN3
- GPIO4 – IN2
- GND Raspberry – GND H-bridge
For example, to make the car run forward ? 2 motors have to run clockwise ? IN2 & IN4 should be ON; IN1 & IN3 should OFF ? GPIO2 & GPIO4 should ON; GPIO0 & GPIO3 should OFF.
Step 2: Install camera
In the previous article, follow the instruction there to install FFmpeg into Raspberry. (Link here)
Step 3: Make a web page to control
Install Apache and PHP by following command:
sudo apt-get install apache2 php5 libapache2-mod-php5
After installation, input the Raspberry IP address (this case is 192.168.1.71
) in a web browser to see if the local web working or not. If it is working, it will have the result as shown here:
Read More: Raspberry Pi Remote Control Car Camera