Two-path Ultrasonic Object Counter w/ Display
Developed to count the number of golf balls that take each path in a mini-golf hole that asks golfers to "vote" for Trump or Clinton, by choosing their path. Uses an Arduino Uno and two HC-SR04 ultrasonic sensors to count the balls passing through each path and displays the vote count on a 20x4 LCD display. Developed for the Haunted Mini-Golf fundraiser at Warner Library in Tarrytown, NY. Hole design and construction by Jay Schulz.
This is an Arduino Uno-based two-path object counter using two HC-SR04 Ultrasonic sensors that displays the results to a 20x4 LCD. This project was developed to seperately count the number of golf balls travelling two different paths on a Decision2016 mini-golf hole designed to have players choose between voting for Trump or Clinton. The hole was developed for the Warner Library Haunted Mini-Golf fundraiser in Tarrytown, NY, September 2016. The physical hole and props were designed and built by Jay Schulz.
The inspiration for using ultrasonic sensors as an object counter came from "Count objects using Arduino and Ultrasonic sensor on a production conveyor" by KEAprojects; found at http://www.instructables.com/id/Arduino-using-Ultrasonic-sensor-to-count-log-objec/.
To build this project you will need:
-Two HC-SR04-type Ultrasonic sensors
-20x4 LCD (16 pin)
-At least one breadboard (I used a second mini as well for power for the ultrasonic sensors)
-Extra wire (as needed for your project)
1. Depending on where you get your display, you will probably need to solder the pins to the display. Do that first.
2. Attach the LCD display to the last column of a breadboard. It is helpful if the pins line up with rows 1-16 of the breadboard. Wire the display as seen in the breadboard diagram and commented in the Arduino program. Uses digital pins 7-12 on the Arduino, plus 5V and GND. NOTE: If you are getting power to the LCD screen, but no apparent writing, adjust the potentiometer to adjust the contrast.
3. Wire the ultrasonic sensors as seen in the breadboard diagram. Each sensor will connect VCC to 5V and GND to GND. The TRIG pins will connect to digital pins 3 and 4 on the Arduino and the ECHO pins will connect to digital pins 2 and 5 on the Arduino.
3b. If your project (like mine) requires the HC-SR04 sensors to be quite a ways away from the Arduino and the LCD display, you will probably need to splice longer wires to the leads from the Ultrasonic sensor plug. Trim the wires as long as you can and then strip the coating from the end. Google instructions online for soldering two wires together.
4. Install your Ultrasonic sensors at the desired height for your project. You will then need to adjust the IF-ELSE IF statement in the program to work with your project given the distance to the floor and the height of the object you wish to detect. In my case, the distance to floor is 101mm and the objects are standard size golf balls (roughly 42.7 mm at center), so (distance < 80) will not cause a false detection of the floor, but will still pick up passing golf balls.