After a small discussion, our group agreed on the effervescent vitamin C making-machine. The idea is simple: put a cup of water in the machine, push the button, receive a ready drink.
So, we made a short list of the parts of our machine and started to design them.
- Body - box, lasercut from 3mm MDF
- Cart with a cup holder - lasercut from 3mm MDF
- Tablet dispenser - 3d printed
- Stepper motor with threaded rod to move the cart
- Small servo-motor to move the tablet dispenser
We sketched the body of our machine in Autodesk Fusion360 and then we created a drawing in Inkscape using Tabbed box maker extension. It is not possible to create a complicated box at once, but it is possible to create several boxes and combine them in one drawing. At that point, we hadn't designed the dispenser, so all holes for it were cut after.
Programming is done in Arduino IDE as our microcontroller board is Arduino UNO. We did not used all the potential that Arduino UNO has, there is plenty of pins unused. VitaFab could be easily improved and capabilities expanded. There is plenty of space inside to add features. Device could be controlled over bluetooth or wi-fi, it could store information about amount of tablets, which were dropped or remind user about taking them once per day. Finally, it could have LCD screen with a clock and counter. In here we are leaving a lot of space for our future followers.
Let's explain the code. More detailed description might be find in Lucas documentation.
Servo motor and EEPROM libraries are imported. Then, two button pins are declared (one used to start whole procedure of making a drink, second one to check if cup holder is in correct place). Following variables are used with stepper motor driver, state of pins describes activation of steps and step direction. Sleep is additional feature in order to not draw current while stepper motor is idle.
In void setup() we are defining inputs and outputs. Inputs are our two buttons and outputs are used in order to control stepper motor driver.
Main loop is very simple. First of all we are executing function, which check if cup holder is in start position. This will prevent any failures if user managed to stop device in middle of it operation. Then it waits for an interruption (button in this case) and executes second function, which is main functionality: moving cup to right position, load the tablet, drop it to the cup and return cup to its place. Drink is done at this point.
checkSteps() is very important function for whole operation. It assumes that user is
an idiot. It is checking if button, which serves as our position sensor, is pushed. If it not, then it moves cup holder to the very left until it will be pushed. Self-homing operation assure that no one will break any walls.
runProcedure() is main part of the code. It is responsible for main operation of VitaFab. It waits for interruption from the user. When button on the top is pushed, stepper motor is waking up. Then it moves for around 18 500 iterations, which is exactly needed to cover the distance required to drop the tablet. Finally, cup is reaching right side of the device and servo motor start to operate. First, from idle position (90 degrees) it loads the tablet) 0 degrees) and push it to the hole (180 degrees), where it drops.
In the end, stepper motor driver reverse polarity and cup holder is coming back to the beginning position.
Problems and solutions
The first problem we solved was on the mechanical design stage. We got the Idea of the box we want, but we had not determined the list of all electronic parts and their places on the machine. So, mounting holes for the stepper motor, servo, tablet dispenser, and Adruino Uno were cut on main body parts afterward. To do that properly we used center engraving setting on the laser cutter and precise marks on the MDF parts.
And the second problem was the auto-homing feature. The case was that, if at the beginning of the loop the cart is not at the origin point, it will hit the right wall. So, we put a button on the left wall and right after turning on the machine, the cart is automatically moved to the left until the button is pressed. Nice and simple solution, I think.
Future development opportunities
VitaFab machine can be further developed to be a drink automate by adding e.g. a mobile app that can be used to buy a drink.
The second option is a tablet dispensing machine integrated into a smart home environment. For example, it can put in a cup all the tablets person need to take and make a signal to remind to take the medicine. It can be a very useful machine for the living alone elderly.
Here's the link to download all the design files in one archive
- inner top.svg
- machine big box.svg
- top part.svg