Chapter 4 – wiring:

This chapter is about the wiring of all electronic components inside the Raspberry PI RC car. The focus of this chapter is to connect the L298 H-Bridge with the Raspberry Pi. To wire everything together the best way is to use female to female jumpers. This type of wire works best, save without loos contacts and easy. To power up the Raspberry Pi we need an USB plug with a micro USB connector. To supply the motor driver we need a 6V to 9V charger with 2A. Maybe you can use an old smartphone charger with 5V and 1 A. This would be good enough for the first tests.

ATTENTION:

From my experience the 5V out from the L298 H-Bridge is not stable enough to supply the Raspberry Pi with energy. The variations are to strong and in my case the Raspberry Pi always crashed while switching on the four motors.

Components you need:

  • Wire – Female to Female Jumper
  • 1 x charger 6V to 9V with 2 A for the motor driver
  • 1 x charger 5V micro USB for the Raspberry Pi
  • a small screwdriver
  • pliers
  • soldering iron

Raspberry Pi GPIO connectors

ATTENTION:

It is important to note the following points and to wire everything very carefully together not to burn the Raspberry Pi.

Hint 1: The Raspberry Pi is a 3.3V Linux computer. You should not use higher voltages then 3.3V on the GPIO pins.

Hint 2: The GPIO connectors are not buffered and not secured against wrong wiring. If you make a mistake and connect a wire wrong the Raspberry Pi will never forgive this failure. Take care not to fry the little computer with a short circuit.

Hint 3: There are differences in the assignment of the GPIO ports between the version A, B and B+ of the Raspberry Pi. For this HowTo papers I am using the Raspberry Pi B with 512 MB RAM. To wire everything correct it is important to know the differences in the versions which are available. For each version a GPIO diagram is available in the internet.

Raspberry PI - remote controlled car with a Raspberry Pi female-to-female jumper wires

Raspberry PI – remote controlled car with a Raspberry Pi female-to-female jumper wires


E-Book – build a remote controlled robot with a Raspberry Pi


With this e-book you can create step by step, your unique remote controlled car. The interaction of hardware, electronics and software are explained with the help of concrete examples. This makes it easy to understand the more complex parts of the project.
The e-book is available as PDF.

buy now your e-book

The e-book costs 14.90 USD inkl. 19% VAT. (Germany).
When ordering from other countries the gross price may vary since then other VAT rates apply.

Build a remote controlled car with a Raspberry Pi

Logical wiring of the L298 H-Bridge:

This section is about the wiring of the L298 H-Bridge. We need 8 GPIO pins from the Raspberry Pi to connect the L298 H-Bridge to head on the two motors ( 2 x 2 motors parallel in this case = 4 motors are connected). We need 4 pins to supply the L298 H-Bridge with the PWM signal to control the speed of the motors. Further 4 pins are needed to set the spinning direction of the motors (forward / backwards).

PWM control

PWM stands for Pulse width modulation. The Pulse width modulation is our control element to control the speed of the motors.

The next picture shows the final wiring of the Raspberry PI with the L298 H-Bridge.

Raspberry PI - remote controlled car with a Raspberry Pi wiring

Raspberry PI – remote controlled car with a Raspberry Pi wiring

The next picture shows how I connected my motors and how I will control (speed / direction) them in future. I used the jumper names printed on the L298 H-Bridge to explain everything.

L298 H-Bridge PWM assignment

For the PWM signal please use the pins ENA and ENB which are in line with the pins IN1 to IN4.

  • Motor 1
    • ENA
  • Motor 2
    • ENB

L298 H-Bridge direction assignment

  • Moto 1
    • IN1
    • IN2
  • Motor 2
    • IN3
    • IN4

[sam_zone id=”18″ codes=”true”]

ATTENTION:

It is important to connect the for example the ground pin 6 from the Raspberry Pi with the ground from the L298 H-Bridge. On the L298 H-Bridge you can use the 5V – connector. This is important to ensure that the L298 H-Bridge knows what a high signal is and what a low signal is. If you do not connect the ground from the Raspberry Pi with the ground from the L298 H-Bridge normally nothing will happen.

The picture is a little bit different to the actual wiring. The Raspberry Pi is no longer powered over the L298 H-Bridge. The 5V out from the L298 H-Bridge was not stable enough to power the RaPi. I bougth a PowerBank for the Raspberry Pi. This is the reason why the picture is not correct in the upper left corner.

Raspberry PI - remote controlled car with a Raspberry Pi GPIO pin settings

Raspberry PI – remote controlled car with a Raspberry Pi GPIO pin settings

Raspberry Pi robot-car component list:

If I could awaken you interest how to build such a robot with a Raspberry Pi computer as central controlling unit you will find a list of components on my blog to help you. The component list is an overview of electronic components or ready to assemble kits which I used by myself and which I could recommend with good conscience. I used most of the components in my own projects and checked the functionality and compatibility with a Raspberry Pi.

This is the link to the component list: component list

ZeroBorg motor controller - robot-car components

ZeroBorg motor controller - robot-car components

The next picture shows how to wire the Raspberry Pi and the L298H Bridge.

Raspberry PI - remote controlled car with a Raspberry Pi wiring motor driver

Raspberry PI – remote controlled car with a Raspberry Pi wiring motor driver

If the L298N H-Bridge is connected with the Raspberry Pi now the motors will be connected to the L298N motor driver itselfe.

Raspberry PI - remote controlled car with a Raspberry Pi dc motor wiring

Raspberry PI – remote controlled car with a Raspberry Pi dc motor wiring

 

First I connected the Raspberry Pi with the 5V power supply to check if the PI works correct. Next I connected all wires as shown in the picture above.

It does not matter how you connect the ENA1 + ENA2 as well the ENB1 + ENB2 pins with the L298H Bridge. It is only important the ENA and ENB is connected as pairs. These pins are used for the PWM signal to control the speed of the motors.

This picture shows the final setup of. Fortunately the wires are long enough to easily connect everything. I had no problems with the female to female wires.

Raspberry PI - remote controlled car with a Raspberry Pi robot car

Raspberry PI – remote controlled car with a Raspberry Pi robot car

Conclusion:

Until now everything was easy and worked very well. You can save a lot of work if you buy female to female wires. The wiring is done very fast and you have no loose contacts which causes problems. In the first setup I powered the Raspberry Pi with the 5V out from the L298 H-Bridge. But as mentioned above this doesn’t work very well. The 5V out is not stable enough to supply the Raspberry Pi with sufficient and constant current.

The next chapter is about the software setup of the Raspberry Pi and what we need to program the first script to control the L298 H-Bridge and the four motors.

Contents:


Chapter 1: Raspberry Pi WIFI radio controlled rc vehicle – introduction
Chapter 2: Raspberry Pi WIFI radio controlled rc vehicle – component list
Chapter 3: Raspberry Pi WIFI radio controlled rc vehicle – chassis
Chapter 4: Raspberry Pi WIFI radio controlled rc vehicle – wiring
Chapter 5: Raspberry Pi WIFI radio controlled rc vehicle – software installation
Chapter 6: Raspberry Pi WIFI radio controlled rc vehicle – power supply
Chapter 7: Raspberry Pi WIFI radio controlled rc vehicle – programing
Chapter 8: Raspberry Pi WIFI radio controlled rc vehicle – live video streaming
Chapter 9: Raspberry Pi WIFI radio controlled rc vehicle – web-interface and smartphone
Chapter 10: Raspberry Pi WIFI radio controlled rc vehicle – cooling with passive heat sinks
Chapter 11: Raspberry Pi WIFI radio controlled rc vehicle – startup scripts
Chapter 12: Raspberry Pi WIFI radio controlled rc vehicle – cardboard car model
Chapter 13: Raspberry Pi WIFI radio controlled rc vehicle – power consumption
(Visited 932 times, 3 visits today)