Skip to main content
Version: ACS CC

Bluetooth-Controlled Car

A Bluetooth-controlled robotic car powered by Raspberry Pi Pico 2W with obstacle avoidance.

info

Author: Stiuj Emanuel-Ștefan
GitHub Project Link: https://github.com/UPB-PMRust-Students/proiect-emanuelstiuj

Description

This project is a Bluetooth-controlled car that can be operated using an Android application. The vehicle responds to directional commands such as forward, backward, left, and right, and can also stop on demand. An onboard obstacle detection system allows the car to avoid collisions without user input. In addition to movement, the car features LED indicators for visual signaling and a basic control system that manages motor speed and direction in real time based on incoming commands.

Motivation

This project was inspired by a strong interest in cars and remote-controlled systems. It provided an opportunity to better understand how various components, such as microcontrollers, motor drivers, sensors, and communication modules, interact in a real-world embedded system. Working on this allowed for both creative and technical exploration, combining hardware and software to build something functional, interactive, and fun.

Architecture

Architecture

System Architecture

The system is built around a central microcontroller, the Raspberry Pi Pico 2W, which interfaces with multiple peripherals to enable wireless control and feedback:

  • Bluetooth (HC-05 module): Connects to the Pico via UART for serial communication, receiving commands from an Android device over the Bluetooth Serial Port Profile (SPP). The HC-05 operates typically as a slave device, allowing the phone to initiate and send control data.
  • Motor Driver (L298N): Receives PWM signals (for speed control) and GPIO signals (for direction control) from the Pico to drive DC motors. The L298N provides high-current output to the motors based on the Pico’s low-power signals.
  • IR Sensor: Outputs digital signals to a GPIO pin on the Pico when detecting obstacles within its range, enabling proximity-based decision-making.
  • LEDs: Controlled via GPIO pins to provide visual feedback on system states (e.g., power status, collision detection, or turning left/right).
  • Power Supply (2x 18650 batteries): Supplies power to the L298N motor driver directly (typically at 7.4V) and to the Pico through a voltage regulator (e.g., 5V step-down converter) to ensure stable operation.

Flow of Control

  1. The Android device sends commands wirelessly to the HC-05 module via Bluetooth SPP.
  2. The HC-05 relays these commands to the Pico over UART, where they are interpreted by the firmware.
  3. The Pico processes the commands and generates PWM and GPIO signals to the L298N, controlling motor speed and direction.
  4. If the IR sensor detects an obstacle, it sends a digital signal to the Pico, which can override the received commands to stop or redirect the motors, preventing collisions.
  5. LEDs are optionally toggled via GPIO to provide visual feedback on system states (e.g., power status, collision detection, or turning left/right).

Log

Week 5 - 11 May

Week 12 - 18 May

Week 19 - 25 May

Hardware

  • Raspberry Pi Pico 2W: Microcontroller handling communication, logic and motor control.
  • HC-05 Bluetooth Module: Wireless interface for receiving remote control commands.
  • L298N Motor Driver: Allows control of DC motors via GPIO and PWM.
  • IR Obstacle Sensor: Detects objects in front of the car and sends digital feedback.
  • LEDs + Resistors: Used as visual indicators.
  • 2x DC Motors + Wheels: Provide mobility.
  • Power Supply (2x 18650 Batteries): Delivers sufficient voltage and current.
  • Chassis, Wires, Breadboard: Assembly and connectivity.

Schematics

Schematic

Bill of Materials

DeviceUsagePrice
Raspberry Pi Pico 2W (x2)One microcontroller handles main control; the second is used for debugging80 RON
HC-05 Bluetooth ModuleEnables wireless communication with an Android app for remote control28 RON
L298N Motor DriverDrives two DC motors and also provides 5V output to power the Raspberry Pi Pico11 RON
3-6V DC Motor with Wheel (x2)Provides motion using gear-reduced DC motors30 RON
IR Obstacle SensorDetects nearby objects to support autonomous navigation20 RON
LED Headlights (x2)Indicator lights for signaling1 RON
18650 Li-ion Battery (x2)Power supply (7.4V)40 RON
Battery Holder (2x18650)Holds two 18650 batteries in series for higher voltage output4 RON
SwitchUsed to turn the power supply on or off3 RON
220Ω Resistors (x2)Limits current for LEDs1 RON
Breadboard 830pRapid prototyping and testing of circuit connections11 RON
Male–Female Wires (set)Connects modules to the Pico or to the breadboard5 RON
Jumper Wires (set)General-purpose wires for connecting components on the breadboard8 RON
Male Header Pins (40x2)For plugging Raspberry Pi Pico into breadboard2 RON
ChassisMain platform for mounting all components25 RON
Support WheelBalances and stabilizes the rear of the car5 RON

Total Estimated Cost: ~274 RON (excluding shipping).

Software

LibraryDescriptionUsage
embassyAsynchronous embedded framework in RustCore framework for async multitasking on the Pico 2W
embassy-rpRP23450-specific support for EmbassyEnables async support and peripheral access on Raspberry Pi Pico 2W (GPIO, PWM, UART, etc.)
embedded-halHardware Abstraction LayerStandard traits for embedded peripherals
embassy-timeAsync timers and delaysUsed for non-blocking delays and timeouts
embassy-executorTask executor for async EmbassyRuns async tasks in cooperative scheduling
defmtLogging for embedded RustEfficient debug output via probe
panic-probePanic handlerReports panics via probe in development
L298NMotor driver implementationSpeed and direction control
  1. Raspberry Pi Pico 2W Documentation
  2. HC-05 Bluetooth Module Guide
  3. L298N Motor Driver Guide
  4. IR Obstacle Sensor Guide