Arduino Cardboard Gun(RangeFinder &Tachometer)

Introduction: Arduino Cardboard Gun(RangeFinder &Tachometer)

About: My name is Bilal Mustapha. I am a student and a hobbyist. I love to make diy projects and electronic projects.

Wouldn't be awesome to be able to measure distance while sitting comfortably on the Couch?Instead of having to use tradional tape? So today I’m going to make an arduino gun that is capable of non-contact measurement of distances from 2cm to 400cm with an accuracy of 0.3cm and also measure the revolutions per minute of a rotating body(RPM) using an ultrasonic sensor(HC-SR04) and an infrared sensor respectively. Initially, I wanted to make it capable of measuring the speed of any moving object using two additional IR sensors but I’m out of supplies due to the current pandemic. So I’m only going to use what I have. If you have them, then you can add to the gun. Here’s a link on how to do that.

Step 1: How It Works

Ultrasonic sensors work by emitting sound which travels through the air and if there is an object on its path, it will bounce back to the module. Considering the travel time, you can calculate the distance since we already the speed of sound (340m/s) using the formula: distance= velocity *time. The IR sensor purpose in this project is for object detection.IR sensor has two main parts.IR transmitter and IR receiver. The transmitter transmits IR waves and if there is an object, the transmitted wave is reflected by the object which in turn, the receiver picks-up the wave whereas if there is no object in front of the sensor, the transmitted wave is not received by the receiver and then the IR Module generates an output or pulse which is detected by the Arduino when we press the trigger button.It counts continuously for 5 seconds. So let’s start building.

<

Step 2: Supplies

MATERIALS
1. Arduino Uno (any arduino will work)

2. HC-SR04 Ultrasonic sensor

3. Arduino IR sensor

4. 16*2 LCD display module(12C)

5. Buzzer

6. 9V battery and connector

7. Perf board (optional)

8. A Pushbutton

9. Tactile switch *1

10. Slide switch *1

11. LED *2 (Preferably different colours)

12. 220ohms resistor *2

13. 10k resistor *2

14. Arduino pin headers

15. Jumper wires

TOOLS

1. Hot glue

2. Super glue(optional)

3. Soldering Iron and solder

4. X-acto knife

5. Drill(optional)

Step 3: Making the Body

1. Print out the template provided, glue it to the sheet of cardboard and then cut out the shapes.

2. Cut-out the buzzer hole, status led, power led, ultrasonic sensor, IR sensor holes and the LCD display space.

3. Use a ruler to bend all the straight lines inward and glue each section together. Do not glue the display section, handle and roof cover to the rest the gun. Glue the ultrasonic sensor and the infrared sensor into their various holes.

4. Cut-out a 3cm wide cardboard strip and cover the front and back of the handle. Glue a pushbutton to the front of the handle and run the wires through the back of the handle.

Step 4: Electronics Setup

IR SENSOR

I used the wires from a network cable since I’m out of jumper wires, then soldered the wires to a small piece of perf board which is then soldered to the three pins of the sensor.

ULTRASONIC SENSOR

I used an old connector which I inserted into the pins of the sensor.

LCD DISPLAY

I bent the pins of the LCD display so that they are straight. I then repeated the same setup as with the IR sensor.

LEDs

A 220ohms resistor is to each of the led’s cathode lead.

Step 5: Circuit

You can choose to make the circuit on a mini breadboard or preferably on a perf board. Either way, it’s up to you to decide.

Note: The arduino is powered though its VIN pin. Also mine is mounted upside down.

HERE’STHE CONNECTIONS

POWER LED

Anode----Arduino Pin 8

Cathode---220ohm resistor----Ground

STATUS LED

Anode----Arduino Pin 9

Cathode---220ohm resistor----Ground

BUZZER

Positive---Arduino Pin 11

Negative---Ground

IR SENSOR

VCC---Arduino 5V

GND---Ground

OUT---Arduino Pin 5

HC-SR04

VCC---Arduino 5V

GND---Ground

TRIG---Arduino Pin 7

ECHO---Arduino Pin 6

LCD DISPLAY

VCC---Arduino 5V

GND--- Ground

SDA---Arduino Pin A4 (analog pin)

SCL---Arduino Pin A5 (analog pin)

Trigger Button

First Leg -- ----Arduino 5V

Second Leg ---10k resistor (first leg in parallel with)---Arduino Pin 10

(Other leg of resistor to ground)

SPDT SLIDE SWITCH

Center Leg -------Arduino 5V

Left Leg -----10k resistor (first leg in parallel with)---Arduino Pin 13

(Other leg of resistor to ground)

Arduino VIN pin------First leg of pushbutton

Second leg of pushbutton-----+Ve of battery

Arduino GND pin---Battery -Ve and ground rail

Step 6: Final Assembly

Start by inserting the LEDs into their holes, followed by the buzzer, the two switches and then the LCD display into the display section. Pass the trigger button’s wire through the hole at the bottom of the display section. Glue the sensor module to the front of the gun. Glue the display section to the gun’s main body and then attach the handle underneath. Hold the rectangular roof cover with tape to the gun. This will be an access door. Now your RangeFinder/Tachometer is ready for use. Decorate as you wish.

Step 7: Code

Its a good idea to know what the code does before you start to program it. This can save you alot of headache.

Also, install the liquid crystal display library if your LCD has a 12C module. Click here to download

Here’s what the code does

1. When you turn on the gun, the power led turns on and the gun plays a beep sound for less than a second (the power led can be powered directly from the battery, but I decided to power mine from the arduino. This allows the led to be controlled)

2. Once the gun is powered up, youll have to move the slide switch either left or right to select the mode you want. Once that is done, it will display “Please Trigger button to start”. After pressing the button, the reading/measurement should start. With each button press, the status led with blink and the buzzer will beep.

Step 8: TIPS

1. When soldering the pin headers to the perf board, first insert the pin headers into the arduino pins you are using and then lower the board on top of the board with the copper side of the perf board facing up. Solder the headers in place.

2. Make a small access hole on the front side of the gun. This will be used to adjust the sensitivity of the IR sensor using a screwdriver.

3. If the code doesn’t work,

· First check your connections (especially if you used a breadboard).

· If using an old battery, replace it.

· If still doesn’t work, comment down below for assistance.

HAVE FUN WHILE STAYING AT HOME!

Cardboard Speed Challenge

Participated in the
Cardboard Speed Challenge

Be the First to Share

    Recommendations

    • Maps Challenge

      Maps Challenge
    • Fandom Contest

      Fandom Contest
    • Backyard Contest

      Backyard Contest

    Comments