Intro: Arduino Robotic Bartender - 3D Printable & Bluetooth
Build yourself a low-cost easy to assemble bluetooth controllable robotic bartender using an Arduino Uno. This easy Arduino based project can be 3D printed and is a cool Arduino project for beginners.
The aim of this project was to create a bar robot that was low cost and easy for anyone to write their own programme for. Many others out there soon get very expensive and often requires mains electrics - this is cheaper by design and runs entirely on 8 AA batteries. (Also makes it easy to take into the garden or a friends place).
List of items used in this project and where to find them (the links are Amazon affiliate links and financially support this channel at no cost to you)
Arduino Uno: http://geni.us/ArduinoUno
Motor driver: http://geni.us/ArduinoUno
Contact Switch: http://geni.us/ArduinoUno
Linear Bearings: http://geni.us/ArduinoUno
Stepper Motor: http://geni.us/ArduinoUno
Timing Belt and Pulley (2m version): http://geni.us/ArduinoUno
Timing Belt and Pulley (5m version): http://geni.us/ArduinoUno
HM10 Bluetooth Module: http://geni.us/HM10Bluetooth
Step 1: Videos If You Prefer..
I've created a set of four step-by-step videos that you can follow along if you prefer to. I'd also recommend having at least a glance so you can see how this design functions.
Now for the written version...
Step 2: Creating a Base
I used a piece of wood 18mm thick, 120cm long and 45cm deep. (The wood I used was 18mm MFC but any type would be fine as long as it is sturdy enough to be used as a table top). I then bought four table legs from IKEA which I screwed to it.
Step 3: Print and Assemble the Idler
You'll need to print the first two printed parts. You can find them over on the projects Thingiverse page:
The first two parts are called 'idler.stl' and 'Rod_Clamp_V5.stl'.
Once both prints are complete you need to attach the idler to the rod clamp using a long M4 bolt and nut. Don't over tighten this as it need to be able to spin freely.
You also want to insert a nut into the gap indicate (check the images) and part thread a longer bolt onto this. Later we will use this to help create tension on a timing belt (the rubber band with teeth on it used to pull the drinks paddle back and fourth along the steel rods).
This then screwing down onto the table top, 3 cm from the Left hand short end and 5cm from the front edge.
Step 4: Print and Assemble the Motor Mount
The file for the motor mount is 'X_Axis_Motor_Mount.stl'
Once printed this one needs to be positioned 95cm opposite the idler assembly, and 5cm from the front edge. There are three screw holes for fixing this component to the table.
Step 5: Add the Steel Guide Rods
Now we can add two steel rods to the assembly. Mine are 1m long (this can be altered if you want your bar robot to have more or less optics - just remember to also reduce the space between the two components which we have already screwed down into the table).
Slide them into their holders and then use a M4 nut and bolt to tighten the grip of the printed part. You'll need to fix these bolts into four places in total. One set at both ends of each rod.
Step 6: Prepare the Status LED
We will be using a RGB LED (this is one with Red, Green and Blue emitters all in one component which share a common cathode). You'll need to solder a wire to each of the LEDs legs. The wires need to be 180cm or greater as they will have to run through the drag chain to our Arduino Uno. I'd recommend using four separate colour wires so that you can follow the wiring through later.
After you have soldered them together, wrap some insulation tape around each leg to prevent any short circuits.
Step 7: Assembling the Drinking Glass Platform/paddle - Part 1
We now require another printed part, the drinks paddle. This is file 'slider_base_v3.stl'.
Once printed, insert the LED through it's hole from beneath and use some hot melt glue to fix it in position.
Now we can fit our two NEMA 17 stepper motors. Thread their leads though the cable outlet in preparation for connecting them - ensure you the get the cable the right way around (the end with the white connector. Pop them into their respective positions (see the image above) ensuring that their cable connections are both facing inwards. Turn the paddle over and we can hold these in place with some M3x10mm bolts. Put a couple of washers on each bolt before screwing in to help secure the motor.
You can then connect the leads for the steppers to the stepper. :)
Step 8: Assembling the Drinking Glass Platform/paddle - Part 2
Now locate the three linear bearings on the underside and fix these in place with 4 X M4 x 25mm screws.
(This was a nice short step!)
Step 9: Building the Drag Chain
Now we need to begin to print pieces of the drag chain. This is where we will contain all our electrical wires between the Arduino and the moving paddle. You'll need a fair few of them.
They snap together, it may be difficult to do so take your time. I used some pliers to help 'close' on part temporarily so it can fit between the dimples of the other.
Once you have joined them all together (you can always add more later if your chain is too short) thread the wires through them and attach one end to the paddle. Starting to look cool huh? :)
Step 10: Fixing Down the Drag Chain and Adding the Paddle
You'll need to make a hole through the table top about 16 mm wide halfway along the distance of the steel rods. The centre of the hole needs to be 25mm back from the front rod. This is important so that the chain is not twisted in relation to where it exits the paddle.
Remove both rods from the right hand side of the barbot and thread them through the linear bearings. You need to do this carefully so as not to dislodge any of the balls from inside the bearings. When inserting the paddle make sure the short side with the chain attached is facing the hole we just drilled.
Now we can print and add a guide tube into the hole we drilled to help smarten it up a bit. The file to print is 'Table_Tidy.STL'. You should be able to just push it into the hole - make sure that the flat edge is facing away from the paddle and chain we've been working with.
Thread all the cable down through the hole and then curl the cable chain under itself back towards the cable tidy as shown in the images. You can fix this in place against the flat edge of the cable tidy with a screw through the hole in the last piece of the cable chain.
The last image shows how your should look so far.
Step 11: Mounting the Contact Switch
We now need to make another 16mm hole at the right hand end, the location is not so important but near where I have drilled mine is ideal. Then we can print another tidy and insert it 'Table_Tidy_End.STL'.
Use some glue to attach the end stop switch in the same orientation as mine. When you slide the paddle along it should make contact with the switch and close it.
Now we will solder three 1m cables to this switch. If you have three different colours it's bet to use each of them so we can trace the wires with more ease later. Once soldered to the switch you can thread them though the adjacent cable tidy to keep them out of our way.
Step 12: Mounting the X Axis Motor
Position our final motor in it's holder with the cable connector facing downwards.
Use two M3 x 10mm bolts to secure it in place from the other side.
Step 13: The Timing Belt Assembly
Take the pulley for the timing belt and attach to the shaft of the stepper motor for our X axis. (Don't forget you can find a link to all the parts at the top of this guide). Ensure one of the grub screws is firmly attached to the flat side of the shaft.
Add the cable for this motor and thread the other end down through the cable tidy.
We can now take one end of the teethed belt and thread this thought the horizontal slot on one end of the paddle, push it through, wrap it around the pin so that the teeth come together and lock in the middle. Push this into the groove and this will hold it into place.
Take the other end, thread it around the pulley wheel on our stepper motor shaft and then bring it back to the paddle. You then need to thread it through the other horizontal slot and push it in until it appears out the other side of the paddle. Grab this and then again take it to the other end of the robot and thread it around our plastic idler wheel we printed.
Bring it back to the paddle one more time and thread it through the top horizontal slot. Pull it through and then trim it to length leaving enough to wrap it around the pin again and have it's teeth interlock with itself in the narrowest part of the passageway.
You can then use the bolt on the idler end of our belt to add some more tension to the belt if it's needed.
Step 14: Finish Z Axis
We'll now require two threaded rods to be printed. That's file 'main_rod2.3.STL'. It's worth taking the time to print these with a detailed layer height to help reduce any friction. You'll also need to print 'Dispenser_Paddle_V2.STL' again use a detailed enough layer height. This part will also require supports.
Thread both of the rods into the paddle and then place them onto the shafts of the two stepper motors protruding from the raft.
Step 15: Wiring Up the RGB LED
The RGB LED we used has four legs on it which connect to the three colours and one common emitter (ground).
If you don't have a note of which wire is connected where (or if you used four wires all of the same colour) we'll figure out which is connected to what now. You'll need an Arduino Uno, Mini breadboard, three 270 Ohms resistors and some jumper wires to do this.
We'll first connect the 5v connection to the breadboard and then add one of the resistors to this. Then connect the ground from the LED to another section of the breadboard.
One by one, connect the other wires to the resistor and note which wire lights up which colour on the LED. For me it went like this:
Purple wire --> Red LED
Orange wire --> Blue LED
Red wire --> Green LED
Now we know which connect to what we can solder it to our motor shield.
Take four more wires, each about 15cm long and preferable the same colour as those used on your RGB LED and solder them all follows:
Matching colour wire for Red LED (in my case purple) to pin D9
Matching colour wire for Blue LED (in my case orange) to pin D10
Matching colour wire for Green LED (in my case red) to pin A1
Matching colour for ground wire (in my case yllow) to a GND pin.
Step 16: Adding X-axis Contact Switch
We will now connect the contact switch to the motor driver board using the other ends of the wires we passed through the table earlier.
The first image show you where each wire is going to be connected:
Top wire --> Ground
Middle wire --> 5v
Bottom wire --> Digital pin number 2
Once you have this connected you can check all your connections according the second image.
Step 17: Complete the Breadboard
Now we can assemble the remaining components onto a mini breadboard. Take a look at the image to see how it needs to be wired.
Once you have completed the wiring, peel off the self adhesive backing on the bottom of the breadboard (you can use glue if yours is not self adhesive) and attach it to the table roughly in the position shown. This will end up being behind the back board an thus hidden from site. :)
Step 18: Mounting the Arduino
Print the Arduino mounting plate and then screw this down to the table adjacent to the breadboard we glues in place in the previous step.
Add some glue to the mounting pin holes and then attach the Arduino Uno by positioning it onto of the glue.
Once the glue has cooled you can seat the motor shield onto the Arduino Uno - take care not to bend any of its pins.
Step 19: Connect the Arduino to the Breadboard
First connect the wires for the LED circuit. I used matching colours for my wires so they are connected up with the resistors between them. (See first image).
The second image shows connecting the wires from the contact switch. Double check you connections before moving onto the next step.
Step 20: Run Test Scripts for LED and Switch
Connect a USB cable between the Arduino and your PC that you'll be using to upload your programs with. We can then upload code to check everything so far.
You'll find a link to the code on my thingiverse page: https://www.thingiverse.com/thing:2478890
Run the 'LED Test' code and you should be abel to see your LED cycle through several colours.
The next script to upload is the 'Contact_switch_test' script. Once you have uploaded it open the serial monitor and you should see that each time you press the contact switch it registered the push.
If either of the above don't go to plan it's a very good idea to go back and figure out what's gone wrong so far before you continue.
Step 21: Connect X-axis Stepper
Find the cable coming from your X-axis stepper motor (thats the one which will be pulling and pushing the paddle along the two steel rods.). Glue this to the edge of the table near the end of the motor shield above the USB port of the Arduino.
Use four short wire to connect it to the motor shield in the order shown in the image.
Step 22: Connect Z-axis Stepper Motors
I've turned my table onto its side so that I can wire my two Z axis stepper motors together on the underside of the table. First I glued them both on the underside in close proximity to one and another.
You'll then need four 60 cm lengths of wire and two about 8cm long. If you can match the colours of the 80cm wires to those used on the cable that came with your stepper motor then things will be a little easier later.
First take the two small 8cm wires and connect them as shown in the image. Make sure when you do this that your lead ends have been glued to the table in the same orientation (so that the colours run in the same order from left to right on each).
Now connect each of the 60cm wires to their respective colours on the remaining connections.
Step 23: Adding Some More Power
Before we work on adding the power for the project you need to remove the shown jumper from the motor shield. This will isolate the power from the Arduino to that on the stepper motor (as we will be using 12v to power the motor shield and this is no ideal for the UNO).
You'll then need a battery holder and 8 AA batteries to go into it.
Connect the positive and negative wires to their respective terminals on the motor shield and insert the batteries. When you're not using the bartender you can remove one for the batteries to break the circuit.
Step 24: A More Interesting Test Script
Connect the USB to the Uno again and upload the code 'test 1'. All going well your robot should spring into life, light the RED LED and home it's X axis against the contact switch. It will then turn green to show it's homed and will then try to dispense an imaginary drink. If it has - well done all is going just swell! :)
Step 25: Add the Optic Back Wall
To assemble the optics and backboard you'll need something to use as a frame we can attach the optics to. I have chosen to use another piece of 18mm MFC, it needs to be about 40cm high and the same length as your table.
To attach this to the table I'm using some generic low-cost shelf support brackets. First I screw them onto the new backboard. As you can see in the photos I used a peace of scrap wood when attaching the brackets to ensure they are fitted in the correct position.
Now we are rest to fix this to the rest of the barbot we need to ensure it is secured in the correct position. Place it on the desktop and then slide the paddle on its rods all the way to one end and use a ruler to position this new backboard about 26mm from the rear of the paddle. Repeat this at the other end of the metal rods.
Once your happy with its position you can then fix it down though the brackets from behind.
Step 26: Mount the Optics on the Wall
To be able to position the optics correctly you need to move the drink paddle all the way towards the contact switch then move it about 1cm away. This will be the position of the first optic.
Next we need to level the paddle, place a straight object such as a ruler across the two threaded uprights and turn them behind until the two uprights and the optic pusher are all level with one another. At this point you can position the first optic on the backboard so it is about 5/7mm away from the optic pusher and tops of the rods. (As they all must be able to pass under it).
After using a spirit level to ensure the optic holder is vertical you can then fix it into pace on the backboard. We'll done that's the first one done.
Continue repeating this process for the remaining optics, you'll want to space them about 12cm apart depending on the size of the bottle you'll be mounting in them later.
Step 27: Uploading the Main Program and the Drinks Order
Before you upload the main program you should remove all the optic and the optic pusher from the paddle. As we have not yet tweaked the code for your robot we want to avoid any collisions that might damage something.
If at any point you want to stop your robot immediately just pull the USB cable out of the Arduino Uno.
Now upload the main code to your Uno using the Arduino IDE, you'll find a link to it on my thingiverse page: https://www.thingiverse.com/thing:2478890
The robot should then spring into life and home its x axis. If this is done correctly the LED will turn blue and serial monitor will let you know it is complete.
The Arduino receives it's drinks orders as a CSV over its serial connection. For a good explanation of how this work see my video below, about 1:55 in.
We will send the requested drink to the Arduino using its serial connection we send the drinks order there's a series of values separated by commas also known as a CSV this is an example order it consists of six groups each with free values each group represents an optic on our barbot.
My robot has six optics fitted so there'll be six groupings of three in its request.
Let's look at the first grouping of three. The first number 50 in this case represents the distance the Barbot has to move from its current position to reach this optic. As this is our first optic it is the distance from the contacts switch. This is recorded as tens of steps so this 50 represents 500 steps of the stepper motor.
The next value represents how long to dispense a drink for, by that I mean once the paddle is on the optic how long it should wait before retracting and closing the optic again. This is recorded as tenths of a second. This example therefore represents a one-second pause. The optics that are designed to dispense a measured amount of alcohol and will only dispense that amount but when we get to the free-flowing optics we can increase this delay to increase how much is dispensed.
The last value represents how many times this measure should be dispensed this should be set to zero for optics which you don't want to dispense from in which case the Barbot will pass right by without stopping.
So that's the breakdown of the CSV I'll go over how to refine it for your specific machine next.
Step 28: Tweaking the Code for Your Robot
Copy and send the following CSV to your Arduino through the serial monitor:
If the paddle goes to far past the first optic before it tries to dispense form it the you need to decrease the first number (the 50), if it didn't go far enough increase it and if it's spot on then lucky you you can leave it as it is.
Copy your updated CSV, restart your Arduino and send the list of values. The first optic should be aligned nicely this time. Wait for it to move to the next. Again make the same adjustments if you overshoot or undershoot - no adjustments are required if lady luck is on your side.
Repeat this all the way through making sure to reset the Arduino each time before attempting to tweak the location of the next optic.
Step 29: Programming Your First Drink
The first drink I'm going to programme is a simple rum and coke. I've added a bottle of rum to the first optic and a bottle of coke to the second. The bottle of coke has been fitted with a 'free flow' optic. This is one that continuously flows whilst pressed in rather then just dispensing a measure amount.
Carbonated drinks have a problem of building up pressure in the bottle and then forcing them selves out where they shouldn't be. To overcome this I drilled a hole in the base of the coke bottle after it was mounted.
Now we can add the dispensing paddle back onto the threaded rods and level it again with a flat object. I used my metal ruler.
Now you can send the following CSV to the machine to dispense your first drink (don't forget to add a glass first!).
Substitute the #'s above with the values you calculated for your machine earlier.
Step 30: Adding Bluetooth Connectivity
We wil use a HM10 bluetooth module. The HM05 is fine but it cannot be used to connect to an iPhone.
We'll be connecting it to pins on the motor shield. Solder three short wires (maybe about 10cm long each) to the pins 0, 1 and 3.3v on the motor shield.
Connect a fourth to the common ground connection we already have on our breadboard. This will save us some soldering.
You can then connect the other end of these four wires to the HM10 module. I used male-to-female jumpers so I can just slide them onto the HM10. If you used standard wire you can solder them to the pins.
HM10 -- > Arduino Shield
RXD ------> TX
TXD -------> RX
GND ------> Ground
VCC ------> 3.3v
Step 31: Connecting the App
I have an iOS device so have installed 'hm10 bluetooth serial lite' from the app store. You should be able to find an equivalent from the Android app store.
Once installed open the app and press 'Connect'. You should then be able to select your HM10 module. If it asks for a pinched try '0000' or '1234'.
Now reset the Arduino using its 'reset' button onto of the motor shield.
You should now see some messages print to the screen of your phone as the barbot homes itself. Once this is done, type in your CSV you worked on earlier to dispense a rum and coke and press send. VOILA! :)
There is a paid for version of the app with allows you to save custom buttons which will submit the CSV to the robot when pressed. This is ideal as you can make a preprogrammed button for each drink you're like your new robot to make for you.
Step 32: Finished!
Well done good job, why not relax have your new robot make you a drink? :)
If you've enjoyed this project please subscribe to me on Instructables or over on Youtube to see more as they're released: https://www.youtube.com/channel/UC3jc4X-kEq-dEDYh...
You can also help the channel by making a small donation on Patreon: https://www.patreon.com/diymachines