Ultrasonic gun from a gun toy with Arduino

Guns are always bad, I don’t like guns. This is a summary of a project born to play. I’ve found…

November 30, 2016

Guns are always bad, I don’t like guns.
This is a summary of a project born to play. I’ve found an old toy gun with a very annoying sound among the toys of my daughters and I’ve decided to modify it to turn it into a gun-tool to measure distances.

Here is my toy gun transformed:


It became a gun that makes ultrasounds like bats, shoots pulses inaudible to the human ear and reads the time it takes for the ultrasound wave bounced back on the obstacle.
By measuring the time elapsed it is possible to calculate the object distance.
Here the stuff I’ve used:

  • Arduino Nano
  • Ultrasonic sensor HC-SR04
  • backpack display 14 segments
  • two LEDs and two resistors
  • buzzer
  • 9V battery

First I’ve spent some time to make tests on a running prototype with the classical breadboard and Arduino Nano connected to the PC, then I’ve started to weld wires directly to the pins of the components, but it was a massacre! It’s really smarter and convenient to weld only where needed and use the common female-female connectors to link components with their pins.

I’ve opened the toy to be recycled and I’ve removed all the not needed anymore electronics, I’ve kept the the trigger circuit of the toy where I’ve connected the Arduino Nano.

The program I’ve made starts with the buzzer beeps, together with blinks and sends pulses with ultrasound. If he can make 3 steps with an error of plus or minus one cm in a row then shows the result on the display.

While making measurements on the display is an animation character.

More details, circuit and sources can be found here (in Italian, sorry).

Look how it works:








I'm a software engineer, an everyday web developer and a maker. I usually build sites with PHP, within or without WordPress. I build Internet of Things with Arduino and ESP8266. I'm the founder of Rockit.it and Dailybest.it and I'm actually the Chief Technical Officer of Better Days web agency.


Vintage Lael retrofit, the gallery

Pictures from the retrofitting of the old Lael voltmeter

March 10, 2017

Retrofitting of a vintage Lael Tester from 1955

I've learned a lot of things by disassembling and changing the way an old tester works

March 1, 2017

Collegare il condizionatore al wifi

Il condizionatore di casa non è connesso ad Internet e non può essere azionato da remoto, possiamo migliorarlo e renderlo IOT?

June 16, 2019

Retrofitting di una vecchia radio FM con connettività bluetooth

Trovata online per 5 euro e rivitalizzata.

September 28, 2018

Dart Fener parlante con Arduino Nano e DF player mini mp3

Un Dart Fener parlante: ti metti davanti a lui e gli parli e lui risponde con delle frasi del film, rigorosamente a caso

April 23, 2018

ESP8266-01 e schermo OLED: Mini Quiz

Collegare una scheda ESP8266-01 ad uno schermo OLED è complesso, perché la scheda ESP8266-01 ha solo 8 pin di cui solo 4 utilizzabili.

January 21, 2018