This is a little project I made in college with a friend of mine. I don't recall which of us came up with the original idea, but wouldn't it be great if we could pour a Jack and Coke with the push of a button?
In my Intro to Microcontrollers class, we were using the Freescale (now NXP) M9HSC08QG8 chip. While only an 8-bit chip with a 40MHz clock and 8kb of Flash, it's a fantastic controller for only $1. Code can be written in assembly or C using NXP's Code Warrior software and transferred via a special board.
The user can press the red button for a standard Jack and Coke. They can press the black button for extra Jack. The processor will open gravity feed solenoid valves for the specified time to properly fill a pint glass.
The code uses for-loops to delay the processor for an amount of time long enough to pour the ingredient. The HCS08 has better timing functions, but I wrote this code before I got to that part in the class. Unlike the common microcontroller you see in Arduino or Particle, there aren't separate setup() and loop() functions, only the main(). Here you run code at the top of main(), then use a while(1) loop to perform the task repeatedly
The loop check to see which button has been grounded, then runs the respective function. Each function will open both solenoid valves at the start, then close the Jack valve a handful of seconds later, then the Coke valve seconds after that. The solenoid valves are always connected to +12VDC, but their grounds are only available through the 2N2222 transistors, which allow current flow when the HCS08 pins go high.
The hardware includes the HCS08, a 12V power supply, a 3.3V regulator with capacitors, two 2N2222 transistors, and two solenoid valves. A wood base is used to hold Jack and Coke hoppers, and PVC runs the liquid to the pint glass. The electronics are housed in a small wooden box that the pint glass sits on. Not the most beautiful or elegant, but gets the job done
There are certainly better ways to do this. This project was the first I did just for fun, not for school. The code needs better comments, there are better timing functions available on the HCS08, and better liquid distribution systems than hopper style/gravity feed. Stay tuned for my next iteration, with Particle, relays, C02, and GUI!
Comments