A complete navigation and control system for small-scale smart cars using a Raspberry Pi Pico W microcontroller and a React web application interface. This project enables precise GPS-based navigation, real-time tracking, and remote control via WiFi.
This system consists of two main components:
- Hardware (Pico W): A microcontroller setup running embedded C code to control motors, read sensors, and communicate wirelessly
- Web Application: A React-based dashboard for tracking and controlling the car with an interactive map interface
The system enables a small car to navigate autonomously between GPS coordinates with accurate rotation calculations and real-time position updates.
- Raspberry Pi Pico W microcontroller
- Servo motor (for steering)
- DC motors (2x) for drive
- Motor driver board
- GPS module (NEO-6M)
- Gyroscope/IMU (LSM6DSL)
- Battery pack
- Car chassis
- Internal GPIO 6
- Connect red wire to 3.3V
- Connect brown wire to GND
- Connect orange wire to D3 (GPIO 15)
- Motor 1:
- PWM Pin: GPIO 16
- Direction Pin 1: GPIO 19
- Direction Pin 2: GPIO 18
- Motor 2:
- PWM Pin: GPIO 13
- Direction Pin 1: GPIO 11
- Direction Pin 2: GPIO 12
- UART RX: GPIO 5
- UART TX: GPIO 4
- I2C SDA: GPIO 12
- I2C SCL: GPIO 13
The microcontroller runs C code with FreeRTOS for concurrent task management:
- Navigation calculations (bearing, distance, rotation)
- Motor control
- GPS and IMU data processing
- WiFi server for communication
A modern React application with:
- Interactive Google Maps integration
- Real-time car position tracking
- Destination selection via map clicks
- Compass integration (on supported devices)
- Dark/light mode theme support
- Install the Pico SDK:
git clone https://github.com/raspberrypi/pico-sdk.git
cd pico-sdk
git submodule update --init
export PICO_SDK_PATH=`pwd`
- Clone the repository and build the firmware:
git clone https://github.com/yourusername/uber-smart-car.git
cd uber-smart-car
mkdir build && cd build
cmake ..
make
- Connect the Pico W to your computer while holding the BOOTSEL button
- Copy the
uber_car.uf2
file to the mounted RPI-RP2 drive
- Navigate to the web app directory:
cd uber-car-webapp
- Install dependencies:
npm install
- Create a
.env
file with your Google Maps API key:
VITE_GOOGLE_MAPS_API_KEY=your_google_maps_api_key
- Start the development server:
npm run dev
- The web app sends destination coordinates to the Pico W via HTTP
- The car calculates:
- Distance to destination
- Bearing angle
- Required rotation
- Estimated time to reach destination
- The car executes:
- Initial rotation to face destination
- Forward movement for calculated time
- Continuous adjustments based on gyroscope data
The Pico W hosts a simple HTTP server that accepts JSON payloads with:
- Current location (latitude, longitude)
- Destination (latitude, longitude)
- Heading (compass direction)
The server responds with a confirmation message once the navigation command is processed.
- Obstacle avoidance using ultrasonic sensors
- Path planning with waypoints
- Battery level monitoring
- Enhanced error handling
- Real-time position updates
- Multi-car tracking on the same interface
The system uses Euclidean distance calculations to determine the straight-line path between points and calculates bearing using trigonometric functions. The car rotation is managed through differential drive control of the motors.
METERS_PER_DEGREE_LAT
: 111320.0 (approximate meters per degree latitude)APPROX_AVG_SPEED
: 1.1498 (meters per second)APPROX_AVG_ANGULAR_SPEED
: 234.0 (degrees per second)
This project is open-source and available under the MIT License.
Contributions, issues, and feature requests are welcome! Feel free to check the issues page for open tasks or submit your own ideas.
- Raspberry Pi Foundation for the Pico W
- Google Maps Platform for location services
- All contributors who helped build this system