The block diagram for the system. Credit: Daniel Gharib
The required components of the machine was a Capacitive Arduino Piano, a strobe light, light detector, solenoid, metal ball, a gravity element of our choosing, and metal detector that triggers an electromagnet which triggers a final element of our choosing. We chose to have the electromagnet on initially to hold a flag in a lowered position until the ball triggers it. For the gravity element, we chose to have a metal ball pushed by a solenoid to roll down a PVC pipe and through an inductor coil used in the metal detector.
Diagram of the capacitive piano. A piezo speaker is used for the sounds.
The capacitive piano works by using and Arduino and the CapacitiveSensor library, which detects the capacitance of the human body. Foil pads connected to each of the capacitive sensors serve as the piano keys. In this part I assumed the role of lead programmer and wrote a sequence detector program in Arduino C++ that can detect a non-repeating sequence of key-presses. Once a sequence is detected, the Arduino then allows current to flow through the transistor and energize the coil on the relay. Notice the flyback diode added in for back EMF protection from the relay coil.
As the coded solution is still relevant in graded coursework, I cannot make it publically available here. However, I'd be happy to discuss it if contacted.
The completed circuit
The strobe light was constructed from the kit available here. No schematic could be found, but it uses the large capacitor to charge up to values of 100 VDC. The 9V power line is opened and closed by a relay controlled by the piano.
The light detector circuit was first prototyped in lab on a breadboard. Then a PCB was designed in Autodesk Eagle and fabricated by OSH Park. It functions on the concept of a Schmitt trigger so as to be more stable than a comparator. It triggers a relay that energizes a solenoid to push a ball down a ramp.
Prototype Light Detector output is something very close to Vcc (ideally 5V) when triggered
Prototype Light Detector output is the Vn output (ideally 0V) when not triggered.
Final Light detector with all SMD and some through-hole components added in.
PCB in solder reflow oven with SMD components
Light detector schematic
Using a 555 timer in a unconventional way, our class built a metal detector whose DIS pin frequency drops when a metallic object is inserted between an inductor coil. I programmed a frequency detection program in Arduino C++ that de-energizes the electromagnet holding a flag once a the frequency drops to a predetermined value.
As the coded solution is still relevant in graded coursework, I cannot make it publically available here. However, I'd be happy to discuss it if contacted.
The built circuit
Measuring the frequencies on an oscilloscope. About 9.49 kHz with the ball.
Schematic for the circuit
LTspice simulation of circuit without the ball.
Using the Serial Monitor to record the frequency measurements versus time from the Arduino as the ball is inserted in the detector. We find that frequency drops.