Battery-Powered Robotic Car with Raspberry Pi Pico and L298N Motor Driver
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary
This document provides a detailed overview of a circuit that includes a Raspberry Pi Pico microcontroller, an L298N DC motor driver, a 4 x AAA battery mount, two DG01D-E motors, an Adafruit Precision 9-DoF sensor, and a rocker switch. The circuit is designed to control the motors and read sensor data, with power supplied by the battery mount.
Component List
Raspberry Pi Pico
- Description: A microcontroller board based on the RP2040 microcontroller chip.
- Pins: 43 pins including GPIO, power, and ground pins.
L298N DC Motor Driver
- Description: A dual H-Bridge motor driver that allows control of the speed and direction of two DC motors.
- Pins: OUT1, OUT2, 12V, GND, 5V, OUT3, OUT4, 5V-ENA-JMP-I, 5V-ENA-JMP-O, +5V-J1, +5V-J2, ENA, IN1, IN2, IN3, IN4, ENB.
4 x AAA Battery Mount
- Description: A battery holder for four AAA batteries.
- Pins: +, -.
DG01D-E Motor
- Description: A DC motor with Hall effect sensors for speed feedback.
- Pins: Motor Power -, Motor Power +, Hall Power +, Hall Power -, Hall 1 Output, Hall 2 Output.
Adafruit Precision 9-DoF LIS3MDL + LSM6DSOX
- Description: A 9-DoF sensor that includes a magnetometer and an accelerometer/gyroscope.
- Pins: ADAG, ADM, DRDY, INTM, INT1, VCC, 3.3V, GND, SCL, SDA, INT2.
Rocker Switch
- Description: A simple on/off switch.
- Pins: 1, 2.
Wiring Details
Raspberry Pi Pico
- pin 21 connected to Adafruit Precision 9-DoF LIS3MDL + LSM6DSOX SDA
- pin 20 connected to L298N DC motor driver ENA
- pin 22 connected to Adafruit Precision 9-DoF LIS3MDL + LSM6DSOX SCL
- pin 19 connected to L298N DC motor driver ENB
- pin 17 connected to L298N DC motor driver IN3
- pin 16 connected to L298N DC motor driver IN4
- pin 15 connected to L298N DC motor driver IN1
- pin 14 connected to L298N DC motor driver IN2
- pin 7 connected to DG01D-E Hall 2 Output
- pin 6 connected to DG01D-E Hall 1 Output
- pin 36 connected to Adafruit Precision 9-DoF LIS3MDL + LSM6DSOX 3.3V, DG01D-E Hall Power +
- pin 5 connected to DG01D-E Hall 2 Output
- pin 4 connected to DG01D-E Hall 1 Output
- pin 38 connected to Adafruit Precision 9-DoF LIS3MDL + LSM6DSOX GND, DG01D-E Hall Power -, L298N DC motor driver GND, 4 x AAA Battery Mount -, DG01D-E Hall Power -
L298N DC Motor Driver
- OUT1 connected to DG01D-E Motor Power +
- OUT2 connected to DG01D-E Motor Power -
- OUT3 connected to DG01D-E Motor Power +
- OUT4 connected to DG01D-E Motor Power -
- 12V connected to Rocker Switch 1
4 x AAA Battery Mount
- + connected to Rocker Switch 2
DG01D-E Motor
- Motor Power + connected to L298N DC motor driver OUT1
- Motor Power - connected to L298N DC motor driver OUT2
- Hall Power + connected to Raspberry Pi Pico pin 36
- Hall Power - connected to Raspberry Pi Pico pin 38
- Hall 1 Output connected to Raspberry Pi Pico pin 6
- Hall 2 Output connected to Raspberry Pi Pico pin 7
DG01D-E Motor (Second Instance)
- Motor Power + connected to L298N DC motor driver OUT3
- Motor Power - connected to L298N DC motor driver OUT4
- Hall Power + connected to Raspberry Pi Pico pin 36
- Hall Power - connected to Raspberry Pi Pico pin 38
- Hall 1 Output connected to Raspberry Pi Pico pin 4
- Hall 2 Output connected to Raspberry Pi Pico pin 5
Adafruit Precision 9-DoF LIS3MDL + LSM6DSOX
- SDA connected to Raspberry Pi Pico pin 21
- SCL connected to Raspberry Pi Pico pin 22
- 3.3V connected to Raspberry Pi Pico pin 36
- GND connected to Raspberry Pi Pico pin 38
Rocker Switch
- 1 connected to L298N DC motor driver 12V
- 2 connected to 4 x AAA Battery Mount +
Documented Code
Raspberry Pi Pico Code (sketch.ino)
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
Documentation (documentation.txt)
This document provides a comprehensive overview of the circuit, including the components used, their connections, and the code running on the Raspberry Pi Pico.