Build a Robot Police Patrol Dog with a Controller & Servos
A fun, beginner-friendly DIY project using Arduino, a wireless joystick controller, and servo motors to build a robot dog that rolls on patrol, wags its tail, and flashes police lights when it's "on duty."
Why We're Building This
A Robot Dog on Patrol 🚓🐾
This project combines two favorite robotics ideas — a cute robot pet and a remote-controlled vehicle. Our Patrol Pup is a wheeled robot dog you steer with a wireless joystick controller. Its head turns to look around, its tail wags as it moves, and when you press the "patrol" button, its back lights flash red and blue with a siren sound, just like it's on duty! You'll learn how servos, wireless radio modules, and motor drivers all work together.
The Big Idea
How Does the Patrol Pup Work?
Two small computers — a controller and the robot itself — talk to each other wirelessly.
1. The Controller
A joystick and button send your commands (move, turn, siren on/off) through the air using a radio module.
2. The Dog's Brain
An Arduino on the robot receives your commands and decides how fast to drive, turn, and move its servos.
3. Servos, Wheels & Lights
Servo motors wag the tail and turn the head, wheels drive the body, and LEDs + a buzzer create the patrol siren.
Gather Your Gear
What You'll Need 🧰
You'll build two small units: the robot dog itself, and a handheld controller.
🐕 For the Robot Dog
- 🔷Arduino Uno BoardThe dog's brain
- 📶nRF24L01 Wireless ModuleReceives controller signals
- ⚙️L298N Motor Driver ModuleControls the two wheel motors
- 🛞2x DC Gear Motors + WheelsDrives the robot forward and turns
- 🦾2x Micro Servo MotorsOne for the head, one for the wagging tail
- 🔴🔵Red & Blue LEDsThe flashing patrol light bar
- 🔔Small Piezo BuzzerThe siren sound
- 🐶Dog-Shaped Body/ChassisCardboard, foam, or 3D-printed shell
- 🔋Battery Pack (4xAA or 7.4V Li-ion)Powers the whole robot
🕹️ For the Controller
- 🔷Arduino Nano or UnoThe controller's brain
- 📶2nd nRF24L01 Wireless ModuleSends commands to the robot
- 🕹️Analog Joystick ModuleSteers the robot's direction
- 🔘Push ButtonToggles "patrol mode" siren
- 🔋9V Battery + HolderPowers the handheld controller
Safety First, Grown-Ups Needed!
- Build and wire with an adult, especially when connecting motors and batteries.
- Always connect the nRF24L01 module to 3.3V, never 5V — it can be damaged by too much power.
- Test wheels off the ground first, so nothing runs away before you're ready!
- Keep the siren buzzer at a comfortable volume, especially indoors.
Wire It Up
The Circuit Diagram 🔌
Here's how the robot dog's parts connect to its Arduino. Color-coded wires make it easy to follow!
| Part | Pin | Connects to Arduino |
|---|---|---|
| L298N | IN1 / IN2 | D2 / D3 |
| L298N | IN3 / IN4 | D4 / D7 |
| L298N | ENA / ENB | D5 / D6 |
| nRF24L01 | CE / CSN | D9 / D10 |
| nRF24L01 | MOSI/MISO/SCK | D11 / D12 / D13 |
| Head Servo | Signal | D8 |
| Tail Servo | Signal | A0 |
| Red / Blue LEDs | Signal | A1 / A2 |
| Buzzer | Signal | A3 |
Let's Build!
Step-by-Step Instructions 🛠️
-
1
Build the dog's chassis
Cut or assemble the body and mount the two DC motors underneath, wheels attached, so the robot rolls forward smoothly.
-
2
Wire the motor driver
Connect both motors to the L298N, then wire IN1–IN4 and ENA/ENB to the Arduino as shown in the diagram.
-
3
Attach the servos
Mount one servo at the neck for the head and one at the back for the tail. Connect their signal wires to D8 and A0.
-
4
Add the police lights and siren
Fix the red and blue LEDs to a small light bar on the dog's back, and mount the buzzer inside the body. Wire them to A1, A2, and A3.
-
5
Connect the radio module
Wire the nRF24L01 to the Arduino's SPI pins (11,12,13) plus CE and CSN on D9 and D10 — remember, it needs 3.3V power, not 5V!
-
6
Build the handheld controller
On a second Arduino, wire the joystick's X and Y pins to A0 and A1, the push button to D2, and its own nRF24L01 module the same way.
-
7
Install the RF24 library
In the Arduino IDE, go to Library Manager and install the "RF24" library by TMRh20, plus the built-in "Servo" library.
-
8
Upload both sketches
Upload the receiver code to the robot dog's Arduino, and the transmitter code to the controller's Arduino.
-
9
Test your patrol pup!
Power both units, push the joystick to drive, and press the button to switch on the flashing police lights and siren.
Program the Brains
The Code 💻
Two sketches make this project work — one for the handheld controller, and one for the robot dog itself.
// Patrol Pup — controller (sends joystick + button data) #include <SPI.h> #include <RF24.h> RF24 radio(9, 10); // CE, CSN const byte address[6] = "PDOG1"; struct ControllerData { int joyX; int joyY; bool siren; }; ControllerData data; void setup() { pinMode(2, INPUT_PULLUP); // siren button radio.begin(); radio.openWritingPipe(address); radio.setPALevel(RF24_PA_LOW); radio.stopListening(); } void loop() { data.joyX = analogRead(A0); data.joyY = analogRead(A1); data.siren = !digitalRead(2); // pressed = LOW radio.write(&data, sizeof(data)); delay(50); }
// Patrol Pup — robot dog (drives, wags tail, runs siren) #include <SPI.h> #include <RF24.h> #include <Servo.h> RF24 radio(9, 10); const byte address[6] = "PDOG1"; struct ControllerData { int joyX; int joyY; bool siren; }; ControllerData data; #define IN1 2 #define IN2 3 #define IN3 4 #define ENA 5 #define ENB 6 #define IN4 7 #define HEAD_SERVO_PIN 8 #define TAIL_SERVO_PIN A0 #define RED_LED A1 #define BLUE_LED A2 #define BUZZER A3 Servo headServo; Servo tailServo; unsigned long lastSirenToggle = 0; bool sirenState = false; int tailAngle = 90, tailDir = 1; void setup() { pinMode(IN1, OUTPUT); pinMode(IN2, OUTPUT); pinMode(IN3, OUTPUT); pinMode(IN4, OUTPUT); pinMode(RED_LED, OUTPUT); pinMode(BLUE_LED, OUTPUT); pinMode(BUZZER, OUTPUT); headServo.attach(HEAD_SERVO_PIN); tailServo.attach(TAIL_SERVO_PIN); radio.begin(); radio.openReadingPipe(0, address); radio.setPALevel(RF24_PA_LOW); radio.startListening(); data.joyX = 512; data.joyY = 512; data.siren = false; } void loop() { if (radio.available()) radio.read(&data, sizeof(data)); driveFromJoystick(data.joyX, data.joyY); wagTail(); if (data.siren) runPoliceLights(); else { digitalWrite(RED_LED, LOW); digitalWrite(BLUE_LED, LOW); noTone(BUZZER); } } void driveFromJoystick(int x, int y) { int speed = map(y, 0, 1023, -255, 255); int turn = map(x, 0, 1023, -255, 255); int leftSpeed = constrain(speed + turn, -255, 255); int rightSpeed = constrain(speed - turn, -255, 255); setMotor(leftSpeed, IN1, IN2, ENA); setMotor(rightSpeed, IN3, IN4, ENB); headServo.write(map(x, 0, 1023, 60, 120)); } void setMotor(int spd, int inA, int inB, int enPin) { digitalWrite(inA, spd >= 0); digitalWrite(inB, spd < 0); analogWrite(enPin, abs(spd)); } void wagTail() { static unsigned long lastMove = 0; if (millis() - lastMove > 15) { lastMove = millis(); tailAngle += tailDir * 2; if (tailAngle >= 120 || tailAngle <= 60) tailDir *= -1; tailServo.write(tailAngle); } } void runPoliceLights() { if (millis() - lastSirenToggle > 200) { lastSirenToggle = millis(); sirenState = !sirenState; digitalWrite(RED_LED, sirenState); digitalWrite(BLUE_LED, !sirenState); tone(BUZZER, sirenState ? 800 : 600, 150); } }
Did You Know?
Real police departments use trained dogs — and sometimes real robots! — to patrol areas, sniff out hazards, and keep communities safe. Your robot version uses the same "sense, decide, act" pattern that real security robots follow.
Level Up
Make It Even Smarter 🚀
Add an Ultrasonic Sensor
Mount one on the head so the dog automatically stops or barks (buzzer!) before bumping into something on patrol.
Auto-Patrol Mode
Program a "patrol route" so the dog drives a set path on its own and only needs the controller for emergencies.
More Servo Motion
Add leg-like servo panels on the sides for a walking wiggle motion instead of plain wheels.
Questions & Answers
Patrol Pup FAQ
Do I need two Arduino boards for this project?
Yes — one goes inside the robot dog (receiver), and one goes inside the handheld controller (transmitter). They talk to each other wirelessly using the nRF24L01 modules.
Can I use a phone app instead of a physical controller?
Yes! You can swap the nRF24L01 setup for a Bluetooth module (like HC-05) and control the dog from a Bluetooth RC app on your phone instead of a joystick.
Why does the nRF24L01 need 3.3V power?
This wireless module is more sensitive than most Arduino parts — connecting it to 5V can damage it. Always use the 3.3V pin, and add a small capacitor across it if the connection seems unstable.
Is this robot a real security device?
No — it's a fun educational toy that mimics the idea of patrolling with lights and sound. It's not intended for actual security or law-enforcement use.

Comments
Post a Comment