North Bay Python 2024 talk in progress

I am doing something new, for me, which is that I am actually writing our talk. At least so far, every word that I plan to say is written down. I am not finished with the talk, and things could become a bit looser, but I am enjoying this process.

We have a lot of slides, but a number of them are set to automatically advance in 1-2 seconds each, and the sections that I have timed seem to be coming together.

It is incomplete, but wanted a copy online.

Exploring the intersection of humanity and technology in a hedonistic context with cocktail robotics

Cocktail Robotics provides an opportunity to explore an entertaining mix of technology, computer human interaction, art, and performance. We will provide a brief history with potentially amusing stories, and an exploration of using Python to control robots.

We will have slides and stories about robots of the past, both our own and those of other people, as well as an overview of my attempt to create a 'hello world' of cocktail robotics with all of the complexities of even a rather simple open hardware project.

Return of Hello Drinkbot

We lost the .com domain, but here is a rebirth! I've copied much of the wordpress site, but there are issues, a lot of the links and the content are references to the Wayback Machine, and there are broken links. OTOH, better that the site is back with issues than still broken.

Return of Hello Drinkbot

We lost the .com domain, but here is a rebirth! I've copied much of the wordpress site, but there are issues, a lot of the links and the content are references to the Wayback Machine, and there are broken links. OTOH, better that the site is back with issues than still broken. Christine and I will be speaking about Cocktail Robotics at the North Bay Python conference June 29 and 30th 2024 (we are only speaking one of those days:-)

Hello Drinkbot sdcard image

(6/24/2024 this is borked) Disk Image

This is a zip file, so you need to unzip it. Right now this unzips to a 32 gb file, so you need free disk space and you need a 32 gb (or larger) card.

And it appears to only work on the Raspberry Pi 3b _not_ the 3b+

The Wifi is different: SSID: Hemingway Password: imathirstygirl

The Raspberry pi password and user name are the defaults: login: pi pass: raspberry

Article in Make and disk image

Welcome to people who saw the Tasty Tech article in Make Magazine.

The article says to come to this site to get the latest disk image. Unfortunately the image I currently have is huge (due to my expanding it to fill the SD Card), and I don’t know how to shrink it, and I should really create a stripped down image, and etc.

My plan is to do that. But in the meantime, if you just install a normal Raspberry Pi image you will be on your way. I will update with a full set of instructions ASAP

Workshop updates

The Maker Faire workshop was a lot of fun, and many lessons were learned!

On the plus side, I think that all of the robots went home able to dispense liquids. Yay!

I am working on some tweaks, improvements, patches, and bug fixes. I will be uploading a new sdcard image, and instructions to write it to your sdcard. Or I can send you a new sdcard. Email me at Rich.Gibson at gmail.com if you would like to swap out your sdcard.

The initial ‘big changes’ to get the Bartendro admin mode to work is to change your /etc/hosts file.

 127.0.0.1    localhost
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
127.0.0.1 hellodrinkbot

And to update your file /etc/nginx/sites-available/bartendro.conf to look like this. This is a bit of a kludge, where I am tweaking a sample conf file and I am pretty sure that there are better ways to do this. So please let me know if you have a better version.

upstream hellodrinkbot {
server 127.0.0.1:8080;
}
Listen on all interfaces of eth0
server {
root /usr/share/nginx/www;
server_name hellodrinkbot;
access_log /var/log/nginx/bartendro-combined.log combined;
error_log /var/log/nginx/bartendro-error.log notice;
location / {
proxy_pass http://hellodrinkbot;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# This allows you to use Bartendro via its IP address. This is good for setting up # for the first time: proxy_set_header Host $server_addr; # If you have set a custom DNS record for your Bartendro, uncomment the following # line and enter the DNS name for your bartendro and then comment out the· # proxy_set_header line above:· #proxy_set_header Host "bartendro.example.com"; proxy_redirect off; }
}


listen on the bartendro private wifi and redirect all traffic to bartendro
the server name here is always set the "bartendro".
server {
listen 10.0.0.1:80;
root /usr/share/nginx/www;
server_name hellodrinkbot;
access_log /var/log/nginx/bartendro-combined.log combined;
error_log /var/log/nginx/bartendro-error.log notice;
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location / {
proxy_pass http://hellodrinkbot;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host "hellodrinkbot";
proxy_redirect off;
}
}
server {
listen 10.0.0.1:80 default_server;
server_name _;
rewrite ^ http://hellodrinkbot? redirect;
}

Assembly and operation instructions as of Maker Faire 2019

Please…if you have a better way to do anything please let me know. I·
made it up as I went along…

Assembly

Laser cut case
  • 2 sides
  • 1 back, with the cutouts for the pumps and mounting screws for the Pi
  • 1 front
  • 1 top
  • 1 dispenser/tubing management
Detail of dispenser mounted on the back
Pi, motor hat, wires, standoffs and mounting hardware
Pumps, mounting screws, and tubing
Insert four M2.5-12 screws through the back for the Pi mounting
Screw four standoffs onto those screws. Hand tight is fine.
Put the Raspberry pi on those screws. Use two M2.5 nuts on the side of the· Pi with the GPIO header.br> Screw two standoffs onto the standoffs on the other side of the board.
Attach the motor hat onto the GPIO headers. Use two M2.5 nuts to secure it. Put the pumps through the holes, attach with M3-12mm screws with nuts on the inside of the case. · The rear side of the bot.
Connect the black ground wire harness to each motor. Either top, or bottom lug, just be consistent. Route the wires in a way that is pleasing to you, cable tie them if you would like. Clip them shorter to fit your desire for order.
Connect the black ground wire to either of the screw terminals labeled ‘GND’ in the left group of screw terminals. Connect the first motor to the first pin of M1, and the second motor to the second pin of M1. The third motor to pin 1 of M2, and the fourth motor to pin 2 of M2. If you have 8 motors continue that pattern on M3 and M4.

The motor hat has 4 full H bridges which allow it to control four DC motors in forward or reverse. We are splitting the H bridges into two half H bridges, allowing us to control eight motors.


Tidy enough for me.
We have 12 volt pigtails that look a little different than this. Connect the red wire to + on the motor hat, black wire to -. Route the power pigtail out the hose hole in the back. Cable tie the pigtail to one of the standoffs on the pi
The insides are complete. Make sure the sdcard is inserted. Connect 5 volt 2.5 amp Micro USB power to the Pi, and 12 volt power to the 12 volt pigtail. Attatch the dispenser, connect hoses and run them into the dispenser.
Your kit has holes on the front panel for two screws and captive nuts to hold the front in place. You can also glue the back, sides, and top of the case. You probably don’t want to· glue the front because you want to have access to the Pi.

Software

Bartendro

Web Interface

Associate with the ‘HelloDrinkbot’ access point and then go to hellodrinkbot.local
in your browser. Or 10.0.0.1.

Restful Interface

You can make drinks by calling the restful interface

Example
http://hellodrinkbot.local/ws/drink/12?booze14=75&booze11=75

Command Line

The Hello Drinkbot repository has some utility programs demonstrating how to
talk to the motor control hat from Python.

cd hellodrinkbot/software/utility

# this will test all of the pumps, turning each on for 2 seconds, and then moving to the next
python ./pumptest.py 2··

Node Red

Chatscript

Your bot has a version of ChatScript installed for the Raspberry Pi.

ChatScript is a chat engine written by Bruce Wilcox.·
The Wikipedia page has a good description.

The official pages and the Github repository are·
filled with fascinating documentations and explorations into the issues involved with using natural language.

This article How to build your first chatbot using ChatScript has a nice introduction. Shorter version:

Connect to your pi, either connect a monitor/keyboard/mouse or ssh in.
cd Chatscript
BINARIES/LinuxChatScript64 local

Enter your name when prompted (or any identifier. ChatScript maintains persistence with a user across sessions)

Interact with the bot. After a couple of questions it will ask if you want a cocktail. If you say yes
it will pour a tiny cocktail.

There are multiple ways you can interface ChatScript with your bot.

Cleaning your bot

After I am finished I run water through all the pumps, and then I run some vodka through.

Accessing the Pi

Either connect a monitor, keyboard, and mouse to it, or access via ssh.
(Putty is an ssh client for Windows)

If you connect to the Pi via wireless you can ssh to the wlan0 interface. The username
is: pi, the password is: raspbery Yes, leaving the default username and password is a·
security risk. You can change it if you want.

ssh pi@10.0.0.1

You can connect the pi to your computer or hub via ethernet cable. If you·
have a Mac enable internet sharing (System Preferences -> Internet Sharing)
Your Pi will probably get the first address 192.168.2.2

ssh pi@192.168.2.2

The pi is setup with ‘Multicast Domain Name Service’ (mDNS) and so you should be
able to connect to it as hostname.local. The hostname is set in /etc/hostname
to hellodrinkbot.

ssh pi@hellodrinkbot.local

The ssid, the access point name, is set in /etc/hostapd/hostapd.conf.·

Look at logs/debugging

You can look at the logs by ssh’ing into the pi over any interface (10.0.0.1, possibly 192.168.2.2,·
or hellodrinkbot.local)

System logs are in /var/log and the web and bartendro logs are in /var/log/nginx

The following commands may be useful

tail -f /var/log/nginx/bartendro-error.log
tail -f /var/log/nginx/bartendro-combined.log
tail -f /var/log/nginx/access.log
tail -f /var/log/nginx/error.log
tail -f /var/log/syslog

Bartendro Admin

Click on the Bartendro logo in the upper right corner of the screen.

Default password is bartendro with password boozemeup

Exit admin by clicking on ‘menu’ on the upper left

···

Upgrade Bartendro Software

Connect to Hello Drinkbot - see above


Upgrade software
+--  2 lines: cd bartendro----------------------------------------------------------------------------------------------

Add pictures to your boozes for the graphical shots menu

ssh to your robot
cd bartendro ui
sqlite3 bartendro.db

Identify your booze:
select id, name, image from booze where name like ‘Vod%’;
1|Vodka|
55|Vodka, Blavad Black |
58|Vodka, Bacon Infused|

Update the picture:
sqlite> update booze set image=’potato.jpg’ where id in (1,55,58);

Put the pictures in bartendro/ui/content/static/images/

(there should be a way to add pictures at the Booze admin screen. Patches welcome 🙂

Hello Drinkbot Bill of Materials on Amazon

Here is an Amazon list of all the parts needed for a Hello Drinkbot except wire and the laser cut frame. Here is an Amazon ‘Idea’ List.

They include a 7″ touch screen as an example. I have tried doing some prototype cases, but so far I don’t have a case which lets you cleanly mount the touchscreen. Also, if you go with the touch screen, or an external monitor, you may also want a keyboard. I have this wireless keyboard. It includes a trackpad, and has worked well so far.

Here is a google sheet with the Bill of Materials broken out on a per-bot basis.


Cutting Drinkbots!

I am a member of the Chimera Art Space in Sebastopol, California. It is an art and maker space. We have a nice wood shop, a good selection of metal machining and welding equipment, a jewelry shop which is fantastic, and relevant to my interests a 100 watt laser cutter with an almost 4 foot by 3 foot cutting area.

Here is the laser cutter and one of the work tables, and five bots dry fitted because I wanted to make sure everything was working. And also because I like seeing lots of robots in progress.

I’ve now cut parts for about 30 bots.

Kids love Cocktail Robotics

I set up a Hello Drinkbot at a part we had recently. I loaded it with various flavors of Torani syrup and set the shot size to 10 ml.

My Grandson Finn took over bartending duties and enjoyed dispensing italian soda’s for people!

The peristaltic pumps can’t dispense carbonated liquid, so people would put their own ice and carbonated water into their cups and hand them to Finn.

He used the ‘Shots’ menu of the Bartendro software. This shows a list of the loaded ingredients and lets you dispense shots from those ingredients.

Getting ready for Maker Faire

I have not been writing updates because all of my free time has been me preparing for Maker Faire.

There will be a cocktail robot making workshop at 11am on Sunday. Participants will walk away with a working four pump Hello Drinkbot.

I have the laser cutting done for close to 30 bots (the workshop should use 20 of those), I think everything I’ve ordered has arrived, and I have been working on the sdcard image.

I keep thinking of new little goodies and easter eggs to put on the sdcard. For example, it has a copy of Bruce Wilcox’s Chatscript engine compiled for the Raspberry Pi.

And then last night about ten pm I got an idea for a ‘Shorty’ version of the case, and so I have parts cut for about ten of those. This is just the top part of the normal case, which contains the pumps and electronics.

It is intended to be set on a shelve, or attached to another frame.

I will be at Maker Faire Friday by 11 (knock wood :-).

I still need to work on the instructions and presentation for the workshop, and I would like a handout about Cocktail Robotics and Hello Drinkbot for the booth.

So…busy me, happy me!