Autonomous Mobile Sensor Buggy & Dual-PIC Embedded C System
Autonomous corridor navigation buggy powered by dual Microchip PIC16F873 microcontrollers, HC-SR04 ultrasonic sonar obstacle avoidance, ADC thermistor sensing, and dual LCD status displays.

Project Overview
An autonomous mobile robotics platform built and programmed in bare-metal Embedded C (Microchip MPLAB XC8) for the second-year Embedded Systems 2 module at the University of Brighton (First Class 79% / A).
The brief required designing, wiring, and programming an autonomous buggy capable of navigating a corridor, detecting and avoiding obstacles with ultrasonic sonar, sampling ambient temperature via an analogue thermistor, displaying live telemetry on dual LCD screens, and returning safely.
Physical Hardware & Dual Microcontroller Architecture
To keep real-time motor control and ultrasonic ranging decoupled from temperature sensing and display updates, the hardware was split across two Microchip PIC16F873 microcontrollers, each paired with its own Hitachi HD44780 LCD module:
Dual PIC Task Allocation
- Microcontroller 1 (Navigation & Motor Control): Drives the differential DC motors with PWM speed scaling, triggers the HC-SR04 ultrasonic sensor, measures returning echo timings, and updates LCD Screen 1 with live directional status.
- Microcontroller 2 (Environmental Sensing & Telemetry): Samples the analogue NTC thermistor voltage divider via the PIC’s internal 10-bit ADC (
ADRESH/ADRESL), computes calibrated Celsius readings, and updates LCD Screen 2.
Circuit Schematics & Breadboard Layout
The build combined analogue sensor conditioning, motor drive stages, and digital logic across a dual-rail breadboard setup:
Figure 1: Circuit schematic showing dual PIC16F873 wiring, crystal oscillators, thermistor voltage divider, LCD connections, and H-bridge motor drive interfaces.
Figure 2: Labelled breadboard wiring layout showing separate power/logic rails and motor noise isolation.
Analogue Temperature Sensing & Ultrasonic Obstacle Avoidance
Ambient temperature was monitored using an NTC thermistor voltage divider digitised through the PIC16F873’s internal 10-bit ADC (GO_nDONE conversion polling, reading ADRESH/ADRESL and formatting Celsius output for the LCD).
Obstacle detection used an HC-SR04 ultrasonic sensor: the microcontroller generated a trigger pulse and timed the returning echo pulse to detect nearby barriers, transitioning into a braking and pivot manoeuvre when an obstacle entered the threshold range:
[ FORWARD TRAVEL ]
│
Obstacle Detected?
┌─────┴─────┐
YES NO
│ │
▼ ▼
[ REVERSE BRAKE ] [ CONTINUE CRUISE ]
│
[ PIVOT SCAN ]
│
Clear Path Found?
│
▼
[ RESUME FORWARD ]
Technical Specifications
| Parameter | Specification |
|---|---|
| Microcontrollers | Dual Microchip PIC16F873 |
| Firmware Language | Bare-metal Embedded C (MPLAB XC8 Compiler) |
| Display Output | Dual Hitachi HD44780 Character LCDs (using an adapted I2C backpack library) |
| Obstacle Sensing | HC-SR04 Ultrasonic Sonar (Echo Pulse Timing) |
| Environmental Sensing | Analogue NTC Thermistor with Internal 10-Bit ADC |
| Steering Control | Differential DC Motor Drive with PWM Speed Control |
| Project Team | Harry Rogers & Albie Gullis (University of Brighton) |
Source Code & Attribution
- Target Hardware: Microchip PIC16F873
- Toolchain: Microchip MPLAB X IDE, MPLAB XC8 C Compiler
- Attribution & Academic Integrity: Embedded C motor control, ultrasonic ranging, ADC thermistor sensing, and circuit wiring were built by Harry Rogers and Albie Gullis for Embedded Systems 2 at the University of Brighton. The character LCD backpack driver (
lcd.c) was adapted from a tutorial by Khaled Magdy (DeepBlueEmbedded). Standard Microchip XC8 header directives and registers are copyright Microchip Technology Inc.