This week's assignment was to actuate and automate our machine. You can find the documentation of the whole machine here. Below is the description of my part of the project.
Actuation and automation of funnels for food deposition:
1. As described under Assignment 15 - Mechanical Design, I chose to use servo motors to control the opening and closing of the cover of the funnels, which were attached to the lids on top. The type of servo motors I used were Tower Pro, Micro Servo, 9g, SG90.
2. I started by learning more about that motor by reading the data sheet, which can be found here and by following a tutorial of how to control the motor with Arduino UNO here. From the data sheet I learned that the operating speed of the motor was 0.1 ms per 60 degrees which I thought was fast enough for opening and closing the cover of the funnel. From the tutorial I learned how to connect an Arduino UNO board, which we were give for this assignment, to the servo motor. Below is the schematic of the connections. I needed to connect the brown wire of the motor to the GND, the red one to the VCC and the orange one to the digital pin (PWM).
3. Below is shown how I connected the motor to Arduino UNO following the schematic.
4. I was also curious about what is actually inside of servo motor and how does it exactly works. I found some information with clear photos about it here. The photos below are from that website and show the inside of the motor. I learned that it is a standard type of a servo motor which consists of plastic gears, dc motor, potentiometer and a circuit board that controls the mechanism. The gears in the motor are supposed to transform the high-speed low-torque (torque - how much a force acting on an object causes that object to rotate) output of dc into a low-speed high-torque output of servo. The potentiometer, however, reads the orientation of the shaft connected to the gears so that the position of the shaft can be controlled. The position can be usually between 0 and 180 degrees.
5. After learning how the mechanism inside the motor works I wanted to test the code for simple 180 degree back and forth turn of the shaft. I found a standard 'sweep' code on the tutorial site mentioned before. The code starts with including a 'servo.h' library to generate signals that control servo. Then a servo object is decleared by giving it a name, in this case it's 'myservo'. For controlling the position in degrees an integer value is defined by 'pos'. Next a pin, that is connected to the servo, is declared by 'myservo.attach(pin)' under void setup. Under void loop the code tells servo to go to a position between 0 and 180 degrees with 1 degree steps with 'myservo.write(pos)' command and with 5 ms between each degree ('delay'). Then servo will go back again with 1 degree steps until it reaches 0 degrees.
6. Next I wanted to experiment with different speeds of the motor to see which speed could be better for the opening and closing of the funnels. If the funnel is open too long too many choclate sprinkles will get deposited into the lunch box, if the opening time is too short not enough sprinkles can get out. I started by testing with the 50 ms speed between each 1 degree step by chaning the delay command into 'delay(50)'.
7. 50 ms was clearly too slow, so I adjusted the speed to 5 ms to see how it affects the speed by chaning the command to 'delay(5)'. This speed was much better but might be too fast. Next I needed to assemble the whole mechanism on the machine and try it with sprinkles to find the correct speed.
8. When the code was working I proceeded to assebling the funnel with the motor and cover. I had to close half of the funnel's bottom opening (middle photo below) and attach a cover to a metal rod (left photo below) that connects the cover with the motor. First I cut out 2 half circles for the funnel filling and cover with a hole inside them, to make room for the metal rod. However, after a number of trials I had to redesign the half circle in the funnel because the metal rod kept jumping out of the hole when turning around. That was because I used a metal wire as a rod, which I couldn't make 100% straight. The way to solve it was to add a fixation point for the metal rod by extending the half circle in the centre, so that the metal rod could go through the mdf. In that way the metal rod was held in place while turning. Also attaching the metal rod to the cover (left photo below) turned out to be problematic because the connecting surfaces were very narrow. I tried to use hot glue as well as tape, but the cover kept falling off. At the end I decided to make a 90 degree corner at the tip of the metal rod to extend the area of the connecting surfaces and glue them together, which worked out fine for a prototype.
9. After the funnel was assembled, I tried out the code with the cover to see whether it opens and close as I wanted. I also added 2 x 2 sec delays into the code right after opening and closing manouvre with the 'delay(2000)' command, to leave more time for food to fall from the opening.
10. And then ran the code on Arduino UNO as seen below. The cover opened and closed quite neatly,so I was happy with the result.
11. Then I tried it out by filling the funnel with chocolate sprinkles.
12. The cover kept opening and closing fine, but the amount of sprinkles falling out was much less than anticipated. The sprinkles kept clogging up the funnel because apparently they were too long for the funnel opening. One way to fix this might be by adding an arm perpendicular to the metal rod inside of the funnel, so that when the rod turns, the arm mixes up the sprinkles inside and unclogs them.
13. When the sprinkle test was done I decided to attach the funnels onto the machine and wire them, so that we could complete the machine, as seen below on the photo.
14. Below is the machine fully assembled and filled funnels.
15. And here is the finished machine from the front.
16. And a movie of the machine working.
Download here the code: