This project outlines the creation of a cartridge loaded candy dispenser with control issues. It's aim is to help make that "no" an easy choice to make.
This is my first foray into making an IoT based project and is a part of my course work for a 10 week Internet of things coding training.
Let's begin at the beginning.
This project was inspired by my daughter. She is a very thoughtful kiddo and one of the ways she like to show that she cares... is to get me candy. Very sweet!......no pun intended. For fathers day, she got me a COSTCO size container of Peanut M&M's.Those damn candies are like kryptonite for me. If the container is near... it's hard to keep my paws out of it. Over some days, I had nearly got all the way through the container when it hit me! A portion control dispenser that only allows access to the candy on a time control... and if to many requests are made, within to short a time span, it changes the room to first warn me, and then disable itself - as well as other appliances (think AC and Television) to help dissuade me from over doing it. With that, on to the build!
The code, as it is written, is meant to control various smart objects (Wemo smart outlets and Phillips Hue bulbs) around the classroom as a person interacts with the device. It can be adjusted to suit a different environment with other smart devices.
The process:
On start-up, the device displays a title screen and the skittles logo on the OLED. Then, while it connects to the local classroom network, it displays a little impatient face who'd really like to eat some candy already.
Once it's connected, an infrared detector (PIR on a chip) takes a signal from waving a hand over the detector. The machine then starts a timer and increments a counter. It also turns on couple of outlets, simulating a television and an AC unit (or fan) and turns all the light in the room green. The display shows the content face (in this case a happy peanut m&m) and If no more requests for candy are received within the allotted timer, it will reset and the state will remain green. Continued requests will increment the counter until the next value is reached. At which point, the machine will update the lights in the room to yellow and change the bitmap. What I'm calling "sus" face. Nothing else really changes, but this state serves as the warning that I am nearing a predetermined limit. Again, if I let the timer pass, the system will reset to green.
Should I persist in my ravenous candy rampage, the threshold will be met and the room condition will be set to Red. Of course, all the lights are updated to red and the bitmap is changed to "dead eyes." Upon setting the Red condition, "long" timer is started. Comfort related outlets that were turned on with the Green condition are now shut off. The machine will disable the feed screw and though it will still detect a request, it will not act to dispense anything. It will remain disabled for the duration of the long timer and once complete, the device will reset to a Blue state (blue room lights) and await an IR detection.
This Blue state closes the looped control mechanism of the device. However, there is a last feature. Any good developer builds in a back door, as a work around. Reach to the rear of the device and you'll find the over-ride button. Pressing it will unload all the candy you can handle until you let go! It also resets the system to Green and sets the counter back to zero, no matter where I am in the loop.
=D
As far as the physical device goes, it was all designed as an assembly in Solidworks and was 3D printed from PLA. I did not want to hassle with trying to design a matching thread for the plastic jar. I decided to just machine a matching hole (to the printed cartridge) in an existing lid and hot glue it in to place. Take care to align the threads before you place it! It will clock the jar based on the rotation of the cap!
The top (or cartridge loader) has a few user focused features. Firstly, the entire mechanism can act as a lid and be flipped over without spilling anything. It also has a dovetail feature that allows it to locate and slide into position accurately. Once in place, simply pull the tabbed locking plate out and listen to the candy fall into the machine ready for dispensing!!
Speaking of which, the skittles are driven out of the machine by an auger type screw, which is attached to an FS90R, continuous loop, servo. It was actually here that I ran into a bit of trouble..... The observant will have noticed that this project started out with m&m's and now I'm talking about Skittles.... As this is a first draft, prototype, the dimensions I chose were a bit too tight and instead of dispensing whole peanut m&m's intact, it was more like a chocolate/peanutbutter extrusion machine. Far too messy and very unsatisfying. The size is better and the candy doesn't smear with Skittles.... deadline approaching? PIVOT! Boom -- Skittles dispenser.
Overall, I think the device works very well. Further iterations of this project might include:
- A larger screw and accompanied tray for dispensing the intended peanut m&m's.
- A reverse function for de-jamming the screw, in the case that something sticks.
- More "living" bitmap screens - perhaps blinking eyes during various operations.
- A spill tray for the obscene amount of candy output.
Special thanks to my teachers.
Dr. Brian Rashap
Edward Ishman
Jamie Dowden-Duarte
Comments