Introduction: Conveyor Counter With an Ultrasonic Sensor (by Jeppe Andersen)
Have you ever wanted to count some going by for some statistics reason.
Then this is maybe the 'droid' your looking for.
With this guide you can only not count objects going by, but also timestamp the objects.
For the following guide you will need the this equipment.
- 1 x Arduino Uno R3
- 1 x Groove kit
- Use the Groove shield and the ultrasonic sensor
- USB cable (USB-A to USB-B - male & male) - you might know this as a standard printer cable.
- Conveyor (instruction for this is NOT included in this guide).
- Some objects to count - I use some 38x57mm wood in different lengths. (mine was about 40, 50 and 70mm)
Step 1: Assemble the Components
With the Groove kit you can easily assemble this kit.
Start by adding the Groove board to the Arduino UNO R3.
Next - insert the Groove cable into D7 (digital pin no. 7) and insert the other end to the Ultrasonic Sensor.
At last, connect the Adafruit SD shield to the Groove kit.
Watch this gif I made: Assemble displayed with a gif
Optional: Insert a CR1220 batteri in the battery slot for the RTC to function correctly.
Step 2: Insert the Code
Please note that the file is commentet a lot. This is generally not a bad thing, but the comments are in danish. I suggest that you simply delete all the text side the // or */ /*
I did not include day, month, year for my experiment. I have included the code in a comment section for the first if function.
Download the .ino file (arduino IDE software generate file).
I have made a small screen record of the serial monitor. Here you can see the code in use.
If you like to expand the project, you can add the SD logging function. Sadly I didn't get mine to work, but maybe you have more luck!