For this project we were prompted to create a kitchen object that uses two analog inputs/outputs. So to start, I thought about different tasks I have done in the kitchen before and decided I wanted to make something that had to do with baking desserts because this is something I really enjoy. After some brainstorming, I had the idea to make an automatic cupcake froster. This device exhibits two analog inputs/outputs by using a distance sensor to determine distance between the frosting tip and a person’s hand (input) and then translating the distance into a power for the motor that squeezes out frosting (output). So, the closer the user holds the cupcake to the frosting tip the slower the frosting is pushed out of the bag. This device allows a baker to frost cupcakes precisely without having to hold a cumbersome bag in one hand.
How does it work?
The mechanism works by measuring distance between the hand holding the cupcake and the frosting tip with a distance sensor on the bottom platform. An Arduino Uno then takes this value and outputs a step speed for the step motor to turn at. The step motor is connected to a shaft by way of a coupler, the shaft then has a piece that spins with the shaft and holds a pulley in the center of the mechanism. These aluminum robotics pieces used to create the belt system are from Actobotics. To provide the belt with tension, there is another set of couplers and a shaft at the bottom of the mechanism as seen in the picture. There are also some mounting pieces along the sides of the wood that hold the shafts and step motor in place. All of these pieces are set up to allow the device to pull a bar down that squishes the frosting bag against the wood and forces frosting out the tip
This kitchen device uses an Arduino Uno in order to function and the coding is set up in the form of a state machine with 4 states. The program uses 7 pins not including the power source/ground pins. 1 pin reads the distance sensor (analog input), 4 pins communicate to the step motor (analog output), and 2 pins read button values. The buttons act as an on/off switch and then a “reverse” function that allows the user to bring the belt and bar back up and make it easier to switch out frosting bags. The four states that the code consists of are “ONSTILL”, “ONACTIVE”, “ONBACK”, and “OFF”. The three states that start with “on” can be entered only when the on/off button has been pushed once to turn the machine on while the “OFF” state can be entered once this same button is pushed a second time. Once the on/off button is pushed to turn the machine on, it moves between “ONSTILL” and “ONACTIVE” depending on the distance sensor value input that indicates whether or not something (i.e. a hand holding a cupcake) is in the frosting space. When the “reverse” button is pushed, the “ONBACK” state is entered.
An interesting aspect of the code that I learned for this project is the stepper library. The stepper library allowed me to use functions that controlled my step motor such as “Stepper”, “setSpeed” and “step”. The “stepper” function allows you to set up the four step motor pins as one variable and the “setSpeed” and “step” functions control the motor’s movements. “setSpeed” sets the motor speed in rotations per minute, and “step” tells the motor how many ticks forward to go. Once I learned how to use these functions I was able to create the code which takes the value from the distance sensor and maps it to a representative speed value. The code set up is pictured below.
My main challenge with this assignment lied in the physical components. As seen in the video demo below, the wooden bar simply gets stuck once it reaches a certain point along the frosting bag. You can see that the motor shaft still moves at the different speeds along with the correlating distance from the distance sensor, it just is not able to move the wooden rod. I think this is due to the amount of pressure from the bag of frosting and the kcal if grip from the belt to the wooden bar. To solve this problem in the future, I would like to purchase a belt with teeth and then a more gear like piece for the shaft that’s attached to the step motor. I think this type of system would provide the bar with more strength and help to push the frosting out even with the amount of pressure that it has. I also think the wooden bar needs to be improved to be something that would hold on the the belt better and more easily slide through the tracks on either side. I hope to make these changes to my cupcake froster and hopefully get it working in the future.