Uncategorized

Mixology Bot: Talking to Arduino ||

The Arduino Playground taught me that linux treats serial connections as a file. That means they can be read like a file and written to like a file, with a little massaging. Here’s how to work out the knots:

[code]stty -F /dev/ttyACM0 cs8 57600 ignbrk -brkint -icrnl -imaxbel -opost -onlcr -isig -icanon -iexten -echo -echoe -echok -echoctl -echoke noflsh -ixon -crtscts[/code]

Honestly? I don’t understand it. It’s deep magic that I don’t have time to get into. Something about what the serial connection should and should not deliver.

Anyways, once that’s done I told the raspberry pi to send any new data straight to my screen like this:

[code]tail -f /dev/ttyACM0 &[/code]

tail is a command to display the end of a file. The & tells it “do this in the background so I can get on with my work.”
It now shows me every message coming from the arduino, right on the command line. The very first thing I see is

[code]Mixologybot 1[/code]

1 is the firmware version. I could then echo a command to the arduino like this

[code]echo "help;" > /dev/ttyACM0[/code]

and it responded correctly, but only the first time. Looking closer at the output I realized there was a mysterious newline (the code for the return key) added after every command. My first Google hit for “echo without newline” taught me that raspberry pi needs one extra command. Now I use

[code]echo "help;\c" > /dev/ttyACM0[/code]

The \c removes the newline automatically inserted by bash and makes all communications work as expected. Hooray!

This means I can now have the RPI and the Arduino talking together. The next step is to set up a bash script that pipes commands from PHP to the arduino and back. That way a user can see that the drink robot is ready to pour and tell it what drink to make. Anyone know how to make that happen? Write me, please.

Uncategorized

Makelangelo Software v0.9.6 released

win: https://www.marginallyclever.com/other/Makelangelo.zip
osx: https://www.marginallyclever.com/other/Makelangelo.dmg
OR
win: https://www.marginallyclever.com/other/Makelangelo-0.9.6.zip
osx: https://www.marginallyclever.com/other/Makelangelo-0.9.6.dmg

change log

– open file defaults to image formats instead of ngc files.
– stopped automatically loading last file on program start (would reprocess image file every time).
– image_dpi now remembered between sessions
– image_dpi slider has more realistic upper limit
– some float values were being rounded to produce really long strings that messed up the arduino. they’ve been fixed to two decimal places.
– feed_rate is now passed to jogging controls more accurately.
– gcode is now dumped into temp.ngc every time. save the file somewhere else if you want to keep the gcode.

Notes

In using the software I found that I never reused the gcode so I stopped using it as a default option when loading files.

As of now I’ll be keeping older versions online, just in case.

The next planned updates is all about making a spray paint can holder/actuator. It shouldn’t require any change to the arduino firmware but it will mean big changes to DrawbotGUI and the physical machinery.

As always, please comment in the forums if you have any feedback. I love hearing from you and making things better.

Uncategorized

Mixology Bot: Talking to Arduino

Since my last post I’ve been doing a lot of work on the linux command line on the raspberry pi.
I hope my notes are complete. Let me know if I missed something?

Several people have suggested using the GPIO pins on the RPI to talk to the Arduino. Personally? This is a terrible solution to a non-problem. The RPI runs at a different voltage from the Arduino, which means you need a third thing in between to “translate” between each voltage or you fry the RPI. No thank you! I’m connected to the Arduino over the USB hub.

[code]sudo apt-get install picocom arduino python-serial python3-serial[/code]
In one line I install about 175mb of stuff on the SD card, all of it tools.

Then I used python easy setup to install inotools, linux command line tools that make it easy to compile and upload sketches.

I would not have known about inotools if it weren’t for kline and the other kind members of Freenode IRC #arduino channel. Linux is a bottomless pit of mystery and my only saving grace is that I know how to is ask questions politely.

Now that I’ve got intools installed uploading a script is a breeze.

[code]ino build
ino upload
ino serial[/code]

That last line lets me see any serial messages coming back from the Arduino. That’s how I know it’s working, even though my pi is at the other end of the lab.

Next up I’ll open a persistent two-way connection and send commands from the RPI to the Arduino when a button is clicked on an RPI web page. this should be interesting – I’ve never written a mini server before!

Uncategorized

Mixology Bot: First Steps

While I wait for the laser cutter I’ve been planning for the future. I’ve got my next five new robots mapped out and since I’ve got the time I’ve started on the first one, a drink mixing robot called MixologyBot. Version one will only do spirits. Version two will add sodas and syrups. Version three builds on the technology of several other robots I have in the pipeline.

I used my sketchbook to draw out several versions of the robot. I’m basing my design heavily on the the Inebriator. Check out this video of their latest in action.

Their assembly is complex, heavy, hard to ship, and gets electronics near the liquids. Also their interface is u-g-l-y. …but those are my only complaints! Their method of moving the drink under the bottles is brilliant and I’m copying the heck out of it. They also have a special nozzle that only dispenses 0.5oz each time it is pressed, making it easy for a robot to measure out drinks. Perfect! I love it.

I spent a couple hours letting my fingers do the walking, calling up local bar supply companies. Only one had 1oz nozzles in stock, the rest offered to order them in at 4x the price. No, thanks!

Once I secured the nozzles and the electronics I started to create a prototype frame from cardboard. Here’s my first draft.

drink mixing robot v1 frame, side

drink mixing robot v1 frame, end

I also got a Raspberry Pi for the first time. I’ve attended RPI night at the VHS, met the original designer, and watched my friends buy them…but until now I didn’t see a point. I’m finally warming to RPI. I’ve installed the NOOBS image and built a LAMP stack so that my robot can offer up a web page. That’s right – you’ll be able to order your drinks from your phone, or plug in a keyboard & mouse to set up the machine as a POS system. I can just imagine some enterprising person combining this with a Square account to take payments on the same phone they use to place orders. So portable!

raspberry pi

I used the “sudo apt-get install apache2 mysql-server php5 php5-mysql” command to get the default stack running. It took me longer to get the powered USB hub for the mouse and keyboard than it did to build a web server!

Here’s one of my favorite parts: You tell the robot which alcohol you loaded. Then the robot uses it’s cocktail database and automatically offers only the valid combinations. It knows how to make a gin & tonic but it won’t offer if there’s no gin.

I’ve already got a few marketing ideas planned. When you order a mixing robot the packing insulation will be cocktail napkins with marginallyclever.com written on them. There will also be a spot on every robot where you are encouraged to draw the pub sign for your machine. By customizing them and registering them on the official website (coming soon) you’ll be able to protect your investment and we promote each other at the same time. This will also be the first robot I make that can automatically update itself when there’s a software upgrade or more drinks are added to the database. If you’re one of the many people who offered to help with a Kickstarter, I’m sure your brain is now boiling with stretch goal possibilities.

Now that I’ve talked about my strengths and opportunities, let’s look at where I’m going to have to work.

If I’ve got any concern right now it’s cleanliness. Anyone who’s seen my office or how I operate knows that I have to stay extremely well organized and that means clean, clean, clean. I want the drink robot to follow the same philosophy – make the minimum mess and be easy to sanitize. I’ve planned all the expensive electronics to be far from the liquids and the bottom is so spills don’t pool in the machine. I don’t have a cable running in the middle of my drink machine like the Inebriator, either.

I’m very ignorant about mixology. I’d like to build a database of drinks that can be expanded on later, maybe even crowdsourced. Are you savvy to the bevvy? Are you mayor of SQL town? Take a look at what I’ve got. These are my tables so far.

[code]
mysql> describe ingredients;
+————-+——————+——+—–+———+—————-+
| Field | Type | Null | Key | Default | Extra |
+————-+——————+——+—–+———+—————-+
| id | int(10) unsigned | NO | PRI | NULL | auto_increment |
| name | varchar(64) | YES | | NULL | |
| description | text | YES | | NULL | |
| loaded_now | enum(‘Yes’,’No’) | NO | | No | |
| pos_x | int(10) unsigned | NO | | 0 | |
| pos_y | int(10) unsigned | NO | | 0 | |
+————-+——————+——+—–+———+—————-+

mysql> describe drinks;
+—————+——————+——+—–+———+—————-+
| Field | Type | Null | Key | Default | Extra |
+—————+——————+——+—–+———+—————-+
| id | int(10) unsigned | NO | PRI | NULL | auto_increment |
| name | varchar(64) | NO | | NULL | |
| description | text | YES | | NULL | |
| glass_size_oz | float | NO | | 0 | |
+—————+——————+——+—–+———+—————-+

mysql> describe drink_ingredients;
+—————+——————+——+—–+———+—————-+
| Field | Type | Null | Key | Default | Extra |
+—————+——————+——+—–+———+—————-+
| id | int(10) unsigned | NO | PRI | NULL | auto_increment |
| drink_id | int(10) unsigned | NO | | NULL | |
| ingredient_id | int(10) unsigned | NO | | NULL | |
| qty_oz | float | NO | | 0 | |
| pour_order | int(11) | NO | | 0 | |
+—————+——————+——+—–+———+—————-+

mysql> describe loaded_ingredients;
+—————+——————+——+—–+———+—————-+
| Field | Type | Null | Key | Default | Extra |
+—————+——————+——+—–+———+—————-+
| id | int(10) unsigned | NO | PRI | NULL | auto_increment |
| ingredient_id | int(10) unsigned | YES | | NULL | |
| pos_x | int(10) unsigned | NO | | 0 | |
| pos_y | int(10) unsigned | NO | | 0 | |
+—————+——————+——+—–+———+—————-+
[/code]

If you have any comments, ideas, or you rage at my lack of foreign keys, comment below! I’m looking to partner with people to make this the best Marginally Clever robot yet. If you feel you can contribute, drop me a line.

Uncategorized

New Vending Machine at VHS

Our new location is great but it’s a little far from food sources and it doesn’t have an easy way to buy much needed electronics like arduinos, and rasberry pi. So I took a chance and bought a vending machine. The next challenge is to make it accept bills or paypal so that it’s easy to buy $20 items without a half a pound of loose change.