DUCK!

.jpg)



DUCK! is a vending machine like no other. Falsely advertising snacks of the highest demand, this machine is secretly armed with the pawns of the Master Fowl. Getting angry at the fake display and hitting the machine will not bode well for you, unless you can endure the annoyance that is the Master Fowl's favourite tune. Finally fed up with this useless piece of furniture? Feel free to walk away, but make sure to watch your back... or be ready to react when someone yells, "DUCK!"
Supplies

Mechanical Components:
x1 Arduino Uno
x1 830 tie points breadboard
x1 Mini breadboard
x1 Piezo pressure sensor
x1 Active buzzer
x1 Ultrasonic distance sensor
x1 Solenoid
x1 Flyback diode
x1 TIP120 transistor
x1 12V battery case (fits 8 AA batteries)
x8 AA batteries
x1 9V DC battery
x1 9V battery adapter
Jumper wires (as needed)
Male to female jumper wires (as needed)
Building Materials:
x3 1/8 in. (3 mm) birch plywood (18 in. x 32 in.)
x1 1/4 in. (6 mm) clear Plexi-Glass (8 in. x 10 in.)
x1 Printed photo of the highest demand vending machine snacks
x1 3D printed Master Fowl (or machine topper of your choosing)
x5 1" diameter rubber-duck bouncy balls (or any pawn of your choosing)
x3 Door hinges
x1 Empty paper towel roll
Electrical tape
Superglue
Equipment:
Computer
3D Printer
Laser Cutter
Printer
Computer Programs:
Arduino IDE
TinkerCad
Rhinoceros 3D
Virtual Understanding


We recommend using TinkerCad to assist in the design of the circuit and avoid physical damage to components, an example of our circuit is included above for your reference. The DUCK! machine utilizes two sensors and two actuators:
Sensors:
- Piezo pressure sensor - notices when machine is hit out of frustration
- Ultrasonic distance sensor - recognizes when user walks away from machine
Actuators:
- Active buzzer - plays 3 of the Master Fowl's favourite tunes, each sound is triggered by the piezo sensing a first, second and third hit to the machine
- Solenoid - retracts and releases, hitting loaded pawn and launching it at the retreating user, triggered by the ultrasonic distance sensor noticing user leaving
Method:
Testing the sensor-actuator functions and relationships step by step is, from our and the Master Fowl's experience, the most efficient way to troubleshoot and arrive at the final circuit which should work something like:
The piezo pressure sensor is the first in the lineup, sensing the primary user interaction: hitting the machine. Since the piezo senses variance in force and vibration through pressure changes, it picks up the vibration of the hit to a variable degree of sensitivity of your choosing. This sets off our first actuator, the active buzzer.
The active buzzer plays a different tune for for each hit (for up to 3 hits of the machine), the final being the Master Fowl's top song of choice, to annoy the user enough for them to leave, enacting the secondary user interaction. The ultrasonic sensor, our second sensor of the machine, notices when the user begins to retreat, through the time increasing between the transmission and reception of emitted ultrasonic waves. When the user reaches a specified distance away (the time to receive the emitted waves reaches a certain value) our second actuator is triggered and the moment is here for... THE PAWN ATTACK!
At the distance of choice, specified by you (or your machine Master), the solenoid leaps in action, propelling the loaded pawn out of the vending machine and towards the unsuspecting back of the retreating user.
For your convenience, or incase you have a machine Master even more impatient than ours, our final code is attached below.
Now, you just have to build it!
Downloads
Assemble Mechanical Components





Replicate the TinkerCad circuit using the mechanical components listed under Supplies.
A few things to note:
- Attach the piezo sensor to the breadboard with long wires - to allow for placement where the machine will be hit (on a wall, on the roof, or under your machine topper)
- Place the ultrasonic sensor on the edge of the breadboard - so it can be positioned to see out of the front of the machine encasement when assembled
- Use extra long, or attachable wires (male to female jumper wires or alligator clips) to connect the solenoid to the breadboard - to allow for easy movement and flexible placement).
Troubleshooting:
- Piezo not sensing accurately? Try changing the sensitivity or placing it between two objects!
- Solenoid not pushing your pawns with enough force? Try using a transistor that amplifies the weak electrical signals by a greater amount or a higher voltage power source!
- Pawns not launching high enough? Try increasing the angle of your ramp to increase the height of the pawn's apex!
- User not leaving? Play a more annoying song! - Courtesy of the Master Fowl
Design and Build the Vending Machine











NOTE: It will be helpful to have the mechanical components fully assembled and nearby for this stage.
We decided to work with the Master Fowl and the rest of the design was based on what he desired.. feel free to work with a less controlling vending machine Master, or none at all, and base your design on your heart's (or your snack's) desires. Following the Master Fowl's requests we modelled the vending machine in Rhino 3D and set up a laser cutting file. After laser cutting, it's a relatively simple assembly process (we used superglue and just followed our model and laser layout) - organizing your laser cutting layout in a way that is clear for assembly will save time and confusion in the assembly process.
The important design features to include, regardless of who's calling the shots, are:
- Faux display of your choice of top tier vending machine items
- Top shelf for the Arduino Uno and breadboard to sit on, located at a suitable height for the piezo to reach the location you wish the machine to be hit
- Holes cut in the front panel, lining up with the ultrasonic distance sensor
- Loading channel for the Master Fowl's pawns (rubber-duck bouncy balls)
- Launch ramp (located under the loading channel) with a dock for the solenoid at the back, a small lip to keep the loaded pawn from rolling backwards and walls to keep the pawn moving straight
- "Make sure to angle this up towards the front so the pawns launch upwards at the impatient, ungrateful, easily annoyed, weak, retreating user" - the Master Fowl
- the Master Fowl is right, albeit rudely, but you may need to experiment with the angle to find an appropriate balance between angle and clearance of the loading channel
- Faux snack outlet cutout in the front panel for the pawns to discreetly launch from
- Attach the back panel with hinges to allow access to the mechanical components and to reload the pawns
If you seem to find yourself here under similar circumstances (being controlled by a wrathful duck) feel free to follow the laser cutting guide and colour coded assembly attached below, we wish you and your mental health luck with your duck!
Downloads
Installing the Circuit







Once your vending machine enclosure is built, install your mechanical systems where you've allotted space. This is where you can experiment with the placement of boards and length of wires for elements such as the piezo sensor and solenoid.
In this stage you may encounter some design malfunctions, feel free to add or edit your design to make your circuit system fit in a way that works for you!
A few things we modified:
- A sliding locking system on the back door to keep the Master Fowl from messing with the wires
- Extra support underneath the ramp and breadboard for more stability
Conclusions
Throughout the process of the DUCK! machine design and construction, many lessons were learned... such as picking a more cooperative team lead (don't tell the Master Fowl). Some of the technical lessons include:
Setting the sensitivity of the piezo sensor
Difficulties
- This was an important aspect to figure out as it determined how hard and where to hit the machine. We played around with this feature and ended up attaching it to the roof underneath the Master Fowl as the pressure from pressing him set off the sensor.
- A higher sensitivity means a light and off target hit will trigger the piezo sensor
- A lower sensitivity means a harder hit on the location of the piezo will be necessary to trigger the piezo sensor
Realizations
- If we were to recreate this project we would ensure the piezo sensor had a more secure placement to increase the consistency in the received sensor readings
Increasing the force of the solenoid launch
Difficulties
- This proved to be a difficult task as the solenoid, despite being quite compact in size, required a much greater voltage input than we initially thought in order to hit the pawns with enough force to launch them properly. We arrived at using a TIP120 transistor and a 12V power source (instead of the original 2N2222 transistor and 9V power source)
Realizations
- If we were to recreate this project we would use a stronger solenoid to produce a greater power output for the launch.
Perfecting the launch ramp
Difficulties
- Arriving at the desired launching ramp angle was a process of trial and error. The most successful set up included an angle of around 45 degrees, this positioned the pawns at a great enough incline to launch them up into the air.
- Additionally, we needed to alter the location of the side walls to make sure the pawns were being loaded into and staying in the middle of the ramp and thus being struck in the center by the solenoid.
Realizations
- If we were to recreate this project we would look into moving the dispenser void higher up the machine, this would further increase the pawn's initial height and maximum launch range.
Solenoid overheating
Difficulties
- An issue we kept running into was the solenoid overheating and malfunctioning, we did our best to work around this by letting it cool between trials
- we also tried using a stronger resistor but this led to further malfunctions
Realizations
- To solve this problem in the future we would use a better suited resistor and use a larger solenoid which could handle the prolonged period of use and trials.
Wiring malfunctions
Difficulties
- As with many small circuit projects, the wiring for this machine was rather sensitive and we ran into issues of wires disconnecting and shifting
- We did our best to solidify the connections through the use of electrical tape wrappings and using male to female jumper wires
Realizations
- To fix this problem in the future we would utilize stronger connection methods, such as soldering, and full length wires to avoid connecting multiple wires together
Next Steps
Feeling fancy? Have an ambitious (and supportive) team lead and want to take it to the next level? Try adding some of these features to elevate your useless vending machine to a new tier:
- Add another interaction - maybe the user needs to push some buttons
- Add a variety of output objects - multiple points of launch and multiple types of pawns
- Have fun and use your imagination.. but make sure it's still useless!
Credits
Team: Nathania Nagarajah, Ailsa Li, Zahra Robertson, Chloe Punkari
Class: ARC385: Physical Computing - John H. Daniels Faculty of Architecture, Landscape and Design
Professor: Maria Yablonina
TA: Brian Slocum