Hello and welcome back. In this project, we will learn how to make a Bluetooth control tank with a Raspberry Pi Pico board. For that, I used the HC-5 Bluetooth module and the SriTu hobby app for controlling this tank. If you don’t have a robot tank kit, don’t worry you can also make this project on a normal car chassis. Also, I used the L298N motor driver board for controlling the gear motors and two li-ion batteries for powering up this tank.
- If you want to buy this robot tank kit, please use this link.
- How to make a Bluetooth control tank with Arduino – Click on me
OK, let’s do this project step by step. The required components are given below.
- Robot tank kit — OSEPP
- Raspberry Pi Pico x 1 — Amazon
- Bluetooth HC-5 module x 1 — Amazon / Banggood
- L298N motor driver x 1 — Amazon / Banggood
- Li-ion battery x 2 — Amazon / Banggood
- Li-ion battery holder x 1 — Amazon / Banggood
- Breadboard x 1 — Amazon / Banggood
- Jumper wires — Amazon / Banggood
Firstly, identify these components.
Secondly, install the L298N motor driver board on the robot tank or car chassis. You can use a glue gun for that.
And then, connect the gear motors to the motor driver board.
Next, install the breadboard as you like. After, place the Raspberry Pi Pico board and Bluetooth module on the breadboard.
And then, connect these components. For that, use the circuit diagram below.
Next, attach the li-ion battery holder and connect it to the motor driver board.
Now, connect this tank or car to the computer. Then, copy and paste the following script into Thonny IDE. It is as follows.
- Full details of this project — Download
# Include the library files from machine import UART,Pin, PWM from time import sleep # Set the relay pins as output pins ENA = PWM(Pin(2)) IN1 = Pin(3,Pin.OUT) IN2 = Pin(4,Pin.OUT) IN3 = Pin(5,Pin.OUT) IN4 = Pin(6,Pin.OUT) ENB = PWM(Pin(7)) uart = UART(0, 9600) # speed of this car speed = 65025 # 0 - 65025 ENA.duty_u16(speed) ENB.duty_u16(speed) def forward(): IN1.on() IN2.off() IN3.on() IN4.off() def backward(): IN1.off() IN2.on() IN3.off() IN4.on() def left(): IN1.on() IN2.off() IN3.off() IN4.on() def right(): IN1.off() IN2.on() IN3.on() IN4.off() def stop(): IN1.off() IN2.off() IN3.off() IN4.off() while True: if uart.any(): value = uart.readline() print(value) if value == b'U': forward() elif value == b'D': backward() elif value == b'L': left() elif value == b'R': right() elif value == b'S': stop()
- Now, save this script on the Raspberry Pi Pico board as “main.py”. And then, click the run button.
OK, now put the batteries into the battery holder and set up the Bluetooth controller remote. For that, follow the instructions below.
- First, download and install the “SriTu Hobby” app from the play store.
- SriTu Hobby Android App — Download
- Then, click the Control button and select Bluetooth Remote Control.
- It includes three models. That is Manual control, Gesture control, and Voice control. I used the manual control mode. And then, click the gear wheel icon and find your device and select it. In this case, turn on location and location permission.
Now you can control this tank using this remote. Ok, enjoy this project. The full video guide is below. So, see you in the next project or tutorial.
How to make a Bluetooth control tank with Raspberry Pi Pico board