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

WPLight, a deeper look inside the project

Some more informations about the WPLight system

December 13, 2016

Connect Whistled to 220V AC light with a relay

Here is the schema to connect the Whistled, the whistle detection device sold on Tindie.com, to your 220V home power…

April 16, 2016