Making a cocktail machine¶
For the mechanical and machine design week, we decided to make a cocktail machine. It will be a device that distribute a certain amount of different liquids and a mixer
This week we have to build a device in group. But the work of each participant should be autonomous… We split the work between the five of us so everyone had a specific task to do.
Here are the links to everyone’s documentations :
Stéphane : trail for the glass
Group sketch draft¶
Leo has made a first version of the enclosure that will be the structural part during mechanical design week.
We regroup our first sketches and draw on a board to see more clearly the differents constrains.
Making a cardboard model¶
Then Léo built a cardboard model at 1:1 scale to have a better idea of how to fit everything and the real size.
Making everything communicate¶
Mother board¶
Basically, the idea with this machine is to have one mother board that will talk with all of the other board in the machine.
The mother board will be based on a esp8266. This will allow us to have the possibility to create an web interface or an app to control the machine.
Then the job of the mother board is to send an action to one of the other part, wait for a receipt and pass to the next action to do. Here this is the algorithmic diagram of the process :
As you can see the idea is that every board of the machine has an address and we communicate through 2 serial communication bus (TX and RX) Then we created a starndard message composed by [start_byte, adress, parametre, end_byte].
Then we created a 2 x 3 pins connector that include 2 pins for the 12V 2 pins for the GND, 1 pin for TX and 1 pin for RX. The mother board get the 12V and then distribute it to the other boards.
Here is as an exemple the packet to start the decoration : 98 31 1 99
And finally, in order to test if the messages are well sent we used realterm. This little soft allow us to check serial communications by selecting th type of data, baudrate and lot of other settings. In our case it is setup to 9600 baud and uint8.
As you can see, when a message is sent the board answer with a receipt and then with an endstask.
An exemple of code to illustrate the explanation above : how the decoration with gears works¶
Here is the code used by the decoration step by step, so you can understand the process used to make communicate all the boards together.
-
Step 1 : Since we’re going to communicate with TX and RX, we need to upload the SerialSoftware library. And then just define which pin the motor for the gears is using. Here it is the 0
-
Step 2 : in order to communicate with one another, and to know when each slaves’ task is done, we send messages to the master board. In this block, we define each message’s name and a specific number indicating what’s happening :
- when it starts
- when it ends
- the board’s node ID
- the acknowledgment of receipt (sent to the master board whenever he sends the board a message, to tell him it received it well)
- when the task is done
- when the board is ready to receive an order
-
Step 3 : Now we have to setup, to initiate the board. In the setup the motor is put to LOW so it won’t start turning immediatly when the power supply is on.
-
Step 4 : In this function, we declare a function “sendPacket” that sends a packet, with in its parameters a destination byte and a parameter byte. With this function, we can now send packets.
-
Step 5 : This is the function controlling my motor. It says :
- in the function called motorGear that takes a parameter called boule (I changed the spelling since I can’t use bool as a variable name)
- if the variable boule receives 1 as a message (meaning the whole process of making a cocktail started), turn the motor on.
- Otherwise, turn it off.
-
Step 6 : Here is the most tricky part of the code, the void loop.
- We declare an array, where we’ll store four bytes.
- There is one big if that stores all the rest of the code. It gets activated if it received data from the serial, so if there is a trigger message from the master board.
- Here, we read the first byte that comes from the serial.
- If the byte that is read is the start byte, then we store the rest of the packet.
- We check if the packet is valid and if the packet is for this node or not. If so, it will send an acknowledgment of receipt, execute the function motorGear(); and send a message to tell the master board its job is done.
If you want to know more about what Julie did with the decoration and the gears, do not hesitate to check out her documentation.
Making the trail move and the mixer turn !¶
The trail¶
During output week he used Neil’s board with H-bridges to control a stepper motor. This time he’ll use an A4988 driver!
This little thing is very handy! Basically you just need to operate the DIR and STEP pins to make the motor turn. Then there are other pins for microstepping and a pin to disable the motor altogether. He didn’t think disabling the motor would be important but just in case he connected it to the ATTiny (spoiler alert - it was a VERY good idea).
The board is not that complicated, there are just a lot of headers. He also added 2 LEDs for debugging and a resonator to get a precise clock (we figured our communication would be better). Here is the schematic:
To see in detail how Stéphane programmed the board, do not hesitate to check his documentation
The mixer¶
The mixer has to move up and down, it’s a kind of Z axis. On the moving part a motor turn an helical form like a blender/mixer. With the group we discuss about the constrains. As it is a Z axis with a certain length, the torque should be minnimize that mean the lenght between the rail and the mixer should be minimize. So Luc has to have the dimension of the other axis and be as close as possible to it.
But as it is a group work, every one need to work and some decision can not be made from the start. So Luc decided to build small part that can be placed later at the correct position.
He had also to take in account the available material at FabLab Sorbonne, like the lenght of the shaft and the length of the threaded shaft, the size of the motor coupler, the motor size …
He began to search for the available material and check the dimensions and that everything fit together.
He slided the differents elements and screw the coupler and rotated the threaded shaft manually to begin with.
The stepper motor used to control the mixer is controlled by a specialised component that need only 2 pins : a direction and a step.
He chose the The Pololu A4988 Stepper Motor Driver Carrier. Described here
Here is the design of the circuit he made for the stepper controller :
and the whole design for the mixer board :
For the full code and explanation, do not hesitate to consult Luc’s documentation, he explains everything :)
The peristaltic pump¶
Madjid was in charge of the peristaltic pump, to push the liquid in the glass.
He did several tries, but finally it paid off :)
Here are the schematic and a picture of the board he initially made.
But after several tries, the boards doesn’t work, so he machinned the design board of the mixer.
He designed the pump first by taking the code from an openscad project and changing it so it fits the dimension of the tube and the size of the hexagon so it fits the axe of the Nema motor.
Then the fixer for the pump in Fusion360.
He then had to put the tube inside the pump, by making it role by hand and pressing it inside.
He fixed the support of the pump on the Nema motor with some screws.
And here is the result when everything is put together ! Looks great isn’t it ? :)
We had one problem thoug, the motor had not a strong enough couple to push the liquid. We had to change the motor. We used the same motor as in the decoration. And this time it works perfectly ! We even tried with liquid, and it is for slow drinking but it pumps it :)
We even tried with liquid, and it is for slow drinking but it pumps it :)
He just had to design a new support so it keeps together the pump and the motor. The group was pretty happy it came out well :)
And here is the inside of Gillou, with the board of Madjid, Julie and Luc, which are on the same level of the machine.
If you want to know more details about the long journey of doing the peristaltic pump, please check out Madjid’s documentation.
The picture of everything put together¶
You can find the video of the machine working with each part in the main page of this website. We’re proud of each other’s part of the system but also of our work as a team. We’ve shown a lot of solidarity and have helped each other every step of the way.
We worked well as a team !