Build your own robot car with the Raspberry Pi!

Build your own robot car with the Raspberry Pi!

Now that all electronic components are housed in the freshly built chassis, this article deals with the cabling. It’s actually quite simple but still requires some concentration if you are doing such a project yourself for the first time. It’s just important that you take your time and check everything a few times to avoid accidentally creating a short circuit and components start smoking or sparks fly.

Therefore we will go step by step and wire everything nicely one after the other.

<Bild der Verkabelung aufnehmen>

Connecting the power supply

The power supply is realized with three 18650 LiPo batteries. These provide sufficient voltage when connected in series and have enough mAh to supply the robot car with power for a long time. Thanks to the battery holder the power supply is also very fast. Very recommendable is a switch that disconnects the battery from the vehicle. This way you can quickly switch on and off the robot car without having to remove batteries from the holder or disconnect a cable from a terminal.

The following picture shows schematically how I connected the battery to the motor driver. On the right side of the picture you can see the small pin header which is installed in the center of the robot car and offers the possibility to connect a 5V power supply with GND. The 5V is provided by the L298N motor driver and so other components like the ultrasonic sensor or the OLED display can be supplied directly with a 5V voltage. The pin header with 6 to 8 pins for GND and 5V has already proven itself in many robot projects and should always be installed centrally in the robot.

OpenBot power supply

OpenBot power supply

Connect motor driver to Arduino Nano

The motor driver is connected directly to four pins of the Arduino Nano. It is important to understand that pins IN1 to IN2 are for the left motor and pins IN3 and IN4 are for the right motor. The small table shows the wiring again with the respective pin labeling.

Pin motor driver
Pin Arduino Nano
IN1 D5
IN2 D6
IN3 D9
IN4 D10

The female-to-female jumper cables are very well suited for cabling. Only four pieces are needed to make the connections as shown in the table and on the following picture. Afterwards the motor driver is logically connected to the Arduino Nano.

OpenBot Arduino Nano L298 H-Bridge

OpenBot Arduino Nano L298 H-Bridge

Connect ultrasonic sensor to the Arduino Nano

The ultrasonic sensor is also connected to the Arduino Nano with two female-to-female jumper cables.

ultrasonic sensor Arduino Nano
TRIG D12
ECHO D11

The following picture shows the wiring once again. The connections for GND and 5V are connected to the power distributor of the robot car. So the ultrasonic sensor is still powered and can measure distances.

OpenBot ultrasonic sensor

OpenBot ultrasonic sensor

Connecting the tachometer to the Arduino Nano

Unfortunately I have not yet ordered it myself but I have already ordered it. As soon as I have installed the tachometers I will add the explanation here. Until then the explanation on the OpenBot website will help.

LEDs as direction indicator

Because I don’t have any suitable LEDs at the moment, the description here will follow a little later. Until then the explanation on the OpenBot website will help.

Connect OLED Display SSD1306 to I2C Bus

The OLED display is connected via the I2C bus of the Arduino Nano. Again four female-to-female jumper cables are required. The cabling procedure should be familiar by now.

OLED Display
Arduino Nano
SDA A4
SCL A5

Also for the OLED display, after the OLED display is logically connected to the Arduino Nano, the power supply is established via the power distributor with GND and 5V. Afterwards the OLED display is ready for use.

OLED-Display wiring

OLED-Display wiring

Wiring of gear motors

The four geared motors are connected to the L298N motor driver. The two left-hand motors are always connected together and the two right-hand motors are connected together. Because the motors are installed on the left and right side of the L298N, the connection cables have to be connected crosswise. Otherwise the motors would not run in the same direction and the car could not drive.

Note: If the motors do not run in the same direction during a test run, the error must be corrected at this wiring. This works quite well by trying and swapping the connection cables on each side.

L298N gear motor wiring

L298N gear motor wiring

If everything is wired and connected then the interior of the robot car should now look like the picture at the beginning of this article.

<Erklärbild aufnehmen>

Summary

The cabling should now be complete. Surely there are small differences if e.g. an OLED display is installed or not. But if you take your time and set all connectors in peace then it should be no problem to wire the OpenBot. In the next article we will talk about uploading the firmware to the Arduino Nano.


Article Overview OpenBot robot cuto:

OpenBot – Your smartphone controls a robot car – Introduction
OpenBot – Your smartphone controls a robot car – needed parts part 1-2
OpenBot – Your smartphone controls a robot car – needed parts part 2-2
OpenBot – Your smartphone controls a robot car – constructing a chassis
OpenBot – Your smartphone controls a robot car – Wiring
OpenBot – Your smartphone controls a robot car – Flashing the Arduino firmware
OpenBot – Your smartphone controls a robot car – Android App and first test run
OpenBot – Your smartphone controls a robot car – Record training data
OpenBot – Your smartphone controls a robot car – Set up training environment
OpenBot – Your smartphone controls a robot car – train the neural network
OpenBot – Your smartphone controls a robot car – Setting up Android Studio and your Smartphone
OpenBot – Your smartphone controls a robot car – compile your own OpenBot Android app

Planned articles in this series:

OpenBot – Your smartphone controls a robot car – End-2-End run
(Visited 289 times, 1 visits today)