“HANDS UP!”…”GET ON THE GROUND NOW!”…”DON’T MOVE OR
Ah yes, classic lines from some of my favourite cop shows. The drama and excitement of policing is fun to watch from afar, but I don’t think I’ve got the plums to do that job myself.
For those of us hiding in the safety of our living rooms, there is a way to feel like you’re riding the ‘blues and twos’…albeit a bit of a nerdy way…
Let’s make a badass crime-busting police car project with the Wemos D1 Mini, some LEDs and buzzers!
Getting into Character
We can’t do this whilst we still feel like helpless civilians, so I refer you to my brother from another mother KRS-One to get you into street cop mode *whoop whoop*:
What We’re Making
This project hooks up two buzzers and LEDs, and with some simple
The buzzers make use of a nifty Arduino ‘tone’ command which makes it easy to pump different tones out of the buzzers.
Here’s a video showing my finished project in action (it’s noisy, careful now!):
What You’ll Need
This is a nice simple project, requiring readily available and affordable parts:
- Wemos D1 Mini ($3.50, AliExpress.com)
- Medium (320-point) Breadboard (£3, ThePiHut.com)
- 2x Piezo Buzzers (£1 each, ThePiHut.com)
- 1x Blue LED + 1x Red LED (£6 300 LED kit, ThePiHut.com / eBay for smaller quantities)
- 4x resistors (£6 575 resistor kit, ThePiHut.com /
eBay for smaller quantities ) - Some jumper wires (£6 120 pack, ThePiHut.com)

How to make it
Here’s a Fritzing diagram showing how I have my circuit hooked up:

Thanks to Fritzing.org for the fantastic software
Here’s my breadboard project to give you an idea of what that looks like in real life:

So it’s simple enough – each of the LEDs has the negative leg going from GND through a resistor, and the positive leg runs to a GPIO pin. The buzzers are the same just without the resistors. Easy!
Some pointers:
- Buzzers have a set polarity (+ and -). Any half-decent buzzer should have a longer positive leg just like an LED, and should also have a ‘+’ printed on the top.
- LEDs also have a set polarity of course. The longer leg is the positive (+) leg. Get this wrong and you’ll kill your LED.

How to Code it
If you haven’t yet set up your Wemos D1 Mini in the Arduino IDE – check out my post on that here.
We’re going to be turning the GPIO pins on/off to make our LEDs mimic a hot
We’re also using the Arduino ‘tone’ command to produce a different tone for each buzzer. This should give us the unmistakeable ‘
Here’s the example code which is used in the video above. Check out the comments for tips, and play around with different tones until you’re happy with it (see tone codes at the end of this page):
// This initial section gives our GPIO pins some familiar names for use later on // Don't forget that Wemos GPIO pins don't use the board numbering in code. // For example, the D5 you see on the Wemos is actually GPIO 14. // See the Wemos pinout for more info: https://wiki.wemos.cc/products:d1:d1_mini int LED1 = 16; // D0 int LED2 = 14; // D5 int Buzzer1 = 12; // D6 int Buzzer2 = 13; // D7 // the setup function runs ONCE when you press reset or power the board void setup() { // initialize digital pins as outputs: pinMode(LED1, OUTPUT); pinMode(LED2, OUTPUT); pinMode(Buzzer1, OUTPUT); pinMode(Buzzer2, OUTPUT); } // the loop function runs over and over again forever void loop() { // Both buzzers play tones and LED1 turns on. LED 2 is turned off: tone(Buzzer1,370); //(F#4 note) tone(Buzzer2,466); //(A#4 note) digitalWrite(LED1, HIGH); digitalWrite(LED2, LOW); // Wait half a second delay(500); // Both buzzers play different tones and LED2 turns on. LED 1 is turned off: tone(Buzzer1,415); //(G#4 note) tone(Buzzer2,494); //(B4 note) digitalWrite(LED1, LOW); digitalWrite(LED2, HIGH); // Wait half a second delay(500); }
Where to use it
Whatever you do with this, I think it’s an easy and engaging beginner project for kids or new makers. I hadn’t done much with buzzers previously, so I used this as a fun way to learn (whilst also learning about the handy Arduino tone command).
I like the thought of integrating it into a police-bot – a police-themed robot project with something like this sitting on top. People keep making the same old robot projects without any thought for theme or style.
How about a bedroom alarm? Your little brother won’t snoop around your room if you have this going off (in conjunction with a PIR sensor). You could even take advantage of the
Now go catch the bad guys!
Rich
Love it. Gotta try these little boards out.
Still laughing from “Remove seal after washing” label on the buzzers, not the first time I’ve seen that 🙂
Yeah what’s with that? I don’t even wash fruit before eating!
I’ve always assumed something to do with the production process, but it’s funny none the less 🙂
Nice project.
Can you please send me the Fritzing part of the buzzer?
Thanks a lot.
I’m pretty sure I did the Buzzer using Gimp 2.0 as there isn’t a breadboard buzzer option in Fritzing (this surprised me)