Introduction: Open Hardware Rover With OpenCV

Picture of Open Hardware Rover With OpenCV

In this lines you can read how build a rover using opencv for do something detecting colors.

The work process is simple, Arduino have a basic program to the rover: forward, left and right that manages the movement in the rover.

The Arduino board is connected to a Raspberry pi by USB port and RPI send data from serial port:

For example, if the RPI process the image and the center of the target is in the left side of the image, the RPI send a command to the Arduino for move the wheels to the left. If the target is far ( the high of the object is little) the RPI send the order forward while the target isn't big.

Step 1: Materials

Picture of Materials

-Raspberry PI 2 or 3

-Raspberry PI Camera V2

-Arduino UNO,nano, MEGA....

-7.4V LiPo battery for brushless motor

-5V Power bank for Raspberry and Arduino

-2x Micro servos for Raspberry pi 2 Camera

In this case you have two options:

1.- Use RC car (this have been my option)

2.- Build your own rover platform:

2.1- using brushless motor + ESC + servo

2.2- using motor + servo

2.3- using that you want

Step 2: Installing OpenCV in Raspbian

I am assuming that you have working a raspbian distribution on your raspberry. If it isn't your case, you have to follow this downloading the latest raspbian image:

Raspbian install

This is the worst step in this tutorial. Install OpenCV in raspbian for RPI2 taked me about 3 hours.

The best thing that you can do is follow this tutorial:

When you are sure that OpenCV is working on your RPI you can continue.

Step 3: Set Up the Raspberry Pi Camera

In this tutorial from official Raspberry you can check the process.

Step 4: Set Up the Servos for Pi Camera Mount

Picture of Set Up the Servos for Pi Camera Mount

The pinout that I use for the servos in the RPI2 were the PIN 7 for data wire in X axis servo and PIN 13 for data wire in Y axis servo.

The servos' power pins to PIN 2 and 4 in the RPI2.

The servos' ground pins to PIN 14 and 9 in the RPI2.

Step 5: Arduino Set Up

Picture of Arduino Set Up

In this image you can check the pins.

If you are not using brushless motor, you will have other configuration for the motors.

In my GitHub you can obtain the simple code:


Step 6: Final Set Up

Picture of Final Set Up

In this step you have to connect the Arduino to the Raspberry Pi for USB port, because the python program use the serial port to send movements to the Arduino board.

And this is the python program that manages the opencv processing and send data to Arduino:

Python code

Now you can enjoy the project!


kksjunior (author)2017-10-04

Good work! I loved it!

frarugi87 (author)2017-10-03

In my opinion, that UNO is totally useless. You can save the money by just integrating the code inside the rPI.

Also the two batteries are useless. Just use one (either the power bank or the lipo one) and use a proper circuit to power the other part (a buck converter if you keep the lipo, a boost - if needed - if you just keep the power bank)

About This Instructable




More by Raulrb:Open Hardware Rover With OpenCVOpen Hardware Rover With Arduino and Raspberry Pi
Add instructable to: