Project tutorial
Rover with PWM

Rover with PWM © GPL3+

Adjust the speed of your car!

  • 3 respects

Components and supplies

Necessary tools and machines

09507 01
Soldering iron (generic)

Apps and online services

About this project

How to wire all things

Note: Your robot motor and directions could different from me so I don't give instructions in detail.

My things:

Step 1: Assembly the robot.

Things needed: Robot kit, soldering iron.

If you have a soldering iron, go ahead and solder the jumper wires with the motors. If not, you may need to carefully keep the wires in place and tape it.

Step 2: Wire up the L298N

Things needed: Arduino, jumper wires, L298N, battery holder

Because I want to tell you how to adjust the speed so wire up like this:

L298N = Arduino

IN1 = 3

IN2 = 5

IN3 = 6

IN4 = 9

And the power:

+12V = Positive (battery holder)

GND = Ground (battery holder) + Ground (Arduino)

+5V = 5V power rail (breadboard)

The motor pins.

If line edge is the front of the robot, wire it like this:

Power (motor left) = (left) Left terminal block

Ground (motor left) = (right) Left terminal block

Power (motor right) = (left) Right terminal block

Ground (motor right) = (right) Right terminal block

Remove the 5V enable jumper to let the logic will drive by the Raspberry Pi, not the battery that powering the motor. To let it drive the logic by the Raspberry Pi, connect a jumper wire to Raspberry Pi pin 2 to the power rail on the breadboard.

Step 2: Wire up the Arduino

Things needed: Arduino, Raspberry Pi, USB, jumper wires, breadboard.

Connect the VIN pin on the Arduino to the 5V power rail on the breadboard, the Ground pin to a ground pin on the Raspberry Pi and the USB to the Raspberry Pi USB.

Step 3: Add power for Raspberry Pi.

Things needed: 2 jumper wires, soldering iron, 1 DC-DC Step up converter, 1 battery holder.

Solder the positive wire on the battery holder to the IN+ on the converter and the ground wire to IN- on the converter. Solder the jumper wires to pin OUT+ and OUT-

Notice: Rotate the potentiometer clockwise to lower the voltage going on the OUT pins. You can use a measurement but it isn't 100% accuracy. Repeat this until you see it is 5V. Do this for prevent harm the Pi.

Connect the positive (OUT+) to pin 4 and the ground (OUT-) to the pin 6. To prevent the robot starts when wiring, remove all the batteries.

Step 4: Wire up the Distance Measurement

The mini breadboard help the wiring easier. Connect power rail on the breadboard to VCC, Trigger to pin 16 on the Raspberry Pi, Echo with the 1K resistor and a jumper wire from the resistor to pin 18 on the Raspberry Pi, connect a 2.2K resistor between the ground pin and the jumper wire to pin 18 to divide the voltage back to the Pi. And connect a jumper wire from the ground pin to a ground pin on the Raspberry Pi.

Check the robot

You must take a lot of times to check the robot to see does the robot wired correctly before powering on the robot.

Get Arduino code

Step 1: Get the library

Open up Arduino IDE and go to Sketch => Include library => Manage libraries and search for Firmata in the Library Manager install the Firmata library if you don't installed yet. After installing, the Library Manager will like this:

Step 2: Upload code

Go to File => Examples => Firmata => StandardFirmata. Connect the Arduino to your computer, check what COM is your device, choose it in Arduino IDE, check that you have corrected board name is Arduino UNO and modify the baud rate. It could find in setup() and look like this:


Deploy StandardFirmata to your Arduino and connect it back to the Pi.

Also in the app, open ComPort => ArduinoComPort and search for //TODO: in the code. Change the Baud rate to the baud rate Arduino is configured with. It will like this:

//TODO: Take note of the Baud rate
arduinoPort.Baudrate = 57600;

Deploy this to the Pi.


Similar projects you might like

M1 Rover

Project tutorial by AhmedAzouz

  • 39 respects

Gesture-Controlled Robot

Project tutorial by Youssef El-Gendy and Romina Abachi

  • 12 respects

Control your Human-Like Robot from Anywhere you Are!

Project showcase by assemblypro

  • 1 comment
  • 16 respects


Project showcase by 3 developers

  • 26 respects

Probability | Autonomous Rover

Project in progress by colepurtzer

  • 41 respects

Solar Tracker with Live Data Feed - Windows IoT

Project tutorial by Jed Hodson

  • 1 comment
  • 18 respects
Add projectSign up / Login