Saturday, November 09, 2013

Dorkbot SoCal 55 on Sunday

Dorkbot SoCal 55

***** Sunday, November 10, 2013
***** 1:00 pm to 3:00pm
***** LA Biohackers Lab
***** 6th Floor, ETO Building
***** 1340 E 6th Street, Los Angeles, CA, 90013

Come meet the LA Biohackers and find out more about some of the biotech projects going on in their lab! 

Speakers to include...

Keoni Gandall
Keoni will be talking about how he is bootstrapping a synthetic bacteria using the common laboratory bacteria Bacillus subtilus. Currently there is no easy method for creating a new organism even if you have the ability to synthesize a new genome from scratch. A method Keoni is working on allows for a new genome to first be integrated into a host genome, then split off during cell division to create two daughter cells - 1 with the host genome and 1 with the new genome. This method will have great use in synthetic biology. 

Sophia Hewitt

Sophia will be talking about her research on using epigallocatechin-3-gallate (EGCG), a compound found in green tea as an anti-tumor treatment. In some types of cancer the cancer cells repair their telomeres so the cells effectively don't age, allowing the tumor to grow perpetually. Sophia is testing whether EGCG can inhibit this telomere repair mechanism and allow for treated cells to age. She is usingthe model organism called Tetrahymena thermophila which is an excellent test bed for studies on telomere length. 

Cory Tobin

Cory will be talking about his work on creating plants that make their own fertilizer. He is studying an extremophile bacteria that makes it's own ammonia (fertilizer) using water and nitrogen gas from the atmosphere. By understanding the mechanism this bacteria uses, he hopes to create plants and algae capable of synthesizing their own ammonia, negating the need to apply fertilizer to the soil. 

Monday, June 17, 2013

Lynxmotion AL5D Arm Inverse Kinetics reference material

The best theoretical analysis of inverse kinetics for the Lynxmotion AL5D robotic arm can be found here.

Furthermore, someone has already coded up the AL5D arm inverse kinetics code for Arduino.  I've ported this to Python and a quick test shows it appears to be sane (with some hack tweaks to make up for different initial angles of my servos), but I need to do more extensive testing.  I suspect the initial angles of my servos are different than most typical AL5D applications as I've set everything up to maximize reach for moving chess pieces, so I'll have to calibrate those angles into the code.

Tuesday, June 11, 2013

Arm Movement and Need for Inverse Kinetics

I extended my Arm controller Python program to be able to map and save the locations of chess board positions.

So here is a video of the "Mechanical Turk" arm moving a chess piece across the board using forward kinetics:

And here is the result of trying to move to another square:

Oops, I crashed into the board!  So I think I may have a go at calculating the inverse kinetics to avoid the arm from crashing into the board or (more likely) neighboring chess pieces.  The arm has to move the end effectors pretty much straight up a few inches to clear all the pieces, then it needs to move above all the pieces until it is directly above the destination square, then it needs to move directly vertically down.

I could probably heuristically do this with forward kinematics (for example, move up and down first by just using the elbow or such), but if I can get the inverse kinematics working OK it would give me a lot more control over the system.

Friday, June 07, 2013

Dorkbot SoCal @ Crash Space Sunday, June 9

Dorkbot SoCal 53

***** Sunday, June 9, 2013
***** 1:00pm to 3:00pm
***** Crash Space
***** 10526 Venice Blvd.
***** Culver City, CA 90232
***** (Directions)
***** No cover charge / donations to venue welcome

Come to Crash Space and learn about the hackersapce and some of their exciting projects:

Mechanical animation kit.


Crash Library
Arudino-powered outdoor mini-library that tweets when people take out a book.

Crash Inspired
Mobile interactive night club experience - 2K RGB LEDs - on a truck - controlled with Twitter!

Wednesday, June 05, 2013

New end effector

I added a new end effector to "The Turk" arm.  The Lynxmotion Little Grip has screw holes for 4-40 bolts, so I added two pieces of copper pipe hanger that just happened to be the right thickness.

Thursday, April 25, 2013

AL5D Arm Manual Control on Pi

The same Tkinter/Python manual robotic arm control program I used on my Mac also worked fine on my Raspberry Pi with the AL5D robotic arm controlled by the Pololu Maestro Micro servo controller.  I just had to change the device filename to "/dev/ttyACM0".

On the Mac side, I logged in with "ssh -X ..." and now any X Windows you open up on the Pi will come through to your Mac.  I should note that to open up a general X session on the Pi,  I use "lxsession", which seems to work better for me than "startx".  Of course I have XQuartz installed on my Mac already.

Mechanical Turk Arm First Movement

The mechanical arm of the AWS Mechanical Turk powered chess playing Mechanical Turk is now built!

Here is the arm under manual control:

I chose the Lynxmotion AL5D robotic arm to provide a reasonable reach at an affordable price.  Moving plastic chess pieces does not require much torque, so I was able to avoid using the very capable but very expensive Dynamixel servos and instead used standard cheap RC servos.  Like many folks, I purchased only the AL5D hardware kit from Lynxmotion, and purchased the RC servos from the cheapest price on Amazon.

Building the AL5D took about four hours altogether.  My only serous complaint is that while the hardware is segregated to some extent in heat-sealed plastic bags, it still is often difficult for a novice to figure out which pieces of hardware is which (for example, 2-56 x .250" steel machine screw vs. #2 x .250" steel tapping screw vs. 3mm x 8mm steel screw).  It would be useful if every heat-sealed bag section had a piece of paper identifying the hardware in that section and perhaps which part of the instructions the hardware is associated with.

Also my HS-805BB servo (that I purchased from somewhere else besides Lynxmotion) came with a horn that was not quite compatible with the servo bracket.  It turns out that Lynxmotion does appear to pack a compatible horn in the kit, but somehow I missed that, so I drilled new holes in the existing horn.  Everything worked out anyway.

All of the controllers from Lynxmotion were overpriced or difficult to interface with a Raspberry Pi, so I chose the Pololu Micro Maestro 6-channel RC controller.  I have had great experiences with Pololu servo controllers in the past.  The Micro Maestro connects to a host via USB, and costs ~$20.  It also can provide some analog or digital input as well as serial output, so it is very function-packed for the price.

Two issues with the Pololu Micro Maestro - first, to use it with a Mac or Linux, you need to run the Maestro Control Center on a PC, and under the "Serial Settings" tab you should set the Serial mode to "USB Dual Port".  Then under "Channel Settings" you should open up the "Min" and "Max" settings for the arm servos to 500µs and 2500µs to assure you can move the Hitec servos a full 180 degrees.

If you are looking for info regarding inverse kinematics of the AL5D, see this blog entry.  Also great source code for full control of the Pololu Micro Maestro can be found here.

Finally, I wrote my first Tkinter program in Python to provide a manual GUI for the arm servo controls on a Mac:

Source code below:

# for more Pololu Micro Maestro interface code # see def setpos(cha,uS): """maestro uses is 0.25us increments """ pos=int(uS) pos=pos*4 low=pos&0x7f high=pos>>7 #print low,high # cmd, chan, low, high s.write(chr(0x84)+chr(cha)+chr(low)+chr(high)) def setpos0(uS): setpos(0,uS) def setpos1(uS): setpos(1,uS) def setpos2(uS): setpos(2,uS) def setpos3(uS): setpos(3,uS) def setpos4(uS): setpos(4,uS) from Tkinter import * import serial s=serial.Serial() # this /dev/tty.usbmodem device is for my particular system # do ls /dev/tty.usbmodem* to figure out yours # in Dual USB mode, lower number is the command port s.port="/dev/tty.usbmodem00049671" s.baudrate=115200 s.timeout=1 master = Tk() w0 = Scale(master,command=setpos0,from_=500,to=2500,length=500) w0.grid(row=0,column=0) w0.set(1500) w1 = Scale(master,command=setpos1,from_=500,to=2500,length=500) w1.grid(row=0,column=1) w1.set(1500) w2 = Scale(master,command=setpos2,from_=500,to=2500,length=500) w2.grid(row=0,column=2) w2.set(1500) w3 = Scale(master,command=setpos3,from_=500,to=2500,length=500) w3.grid(row=0,column=3) w3.set(2000) w4 = Scale(master,command=setpos4,from_=500,to=2500,length=500) w4.grid(row=0,column=4) w4.set(1500) #note that the initial servo values may differ slightly between arms setpos(0,1500) setpos(1,1500) setpos(2,1500) setpos(3,2000) setpos(4,1500) master.mainloop()

Wednesday, April 17, 2013

Where the Chess Playing Turk Workers were from

I was able to directly track where the players of my first AWS Mechanical Turk chess game were from since I was using an external web site to serve up the HITs.  I used FreeGeoIP to convert the IP addresses to Lat/Long pairs, and then used BatchGeo to map them.

Here is where all 21 players were from:

Many were from the US:

And many were from India:

Monday, April 15, 2013

First Mechanical Turk Chess Game over

After some problems with my Raspberry Pi SD card blowing up, I was able to rebuild (and back up) the system, and had the first full AWS Mechanical Turk mediated chess game played out.  As you can see, it was a pretty long game, complete with pawn promotion.  The actual game time was about three days.

I paid $0.05 per move.  I suspect that in the future I should 1) pay a bonus for checkmate to get the game moving a bit quicker and 2) see if I can block workers who play for one color to also play for the other.  But glad to see that everything worked, and there was actually checkmate!

Here are the results:

8 | Q . . Q . . . . |
7 | . . . . . . . P |
6 | K . . . . . . . |
5 | P . . . . . . . |
4 | P . . . . . . P |
3 | . . . . . K . . |
2 | . . . . . . . . |
1 | . . . . . . . . |
    A B C D E F G H

1. 'e4', 'Nf6'
2. 'd3', 'd6'
3. 'a3', 'Bg4'
4. 'f3', 'Bh5'
5. 'a4', 'a5'
6. 'g4', 'd5'
7. 'Qd2', 'dxe4'
8. 'dxe4', 'Bg6'
9. 'Nc3', 'c6'
10. 'Qxd8+', 'Kxd8'
11. 'Be3', 'c5'
12. 'Bxc5', 'Na6'
13. 'Rd1+', 'Kc7'
14. 'Bxa6', 'bxa6'
15. 'Nd5+', 'Kc6'
16. 'Be3', 'Rd8'
17. 'c4', 'h6'
18. 'Nb4+', 'Kb7'
19. 'Rxd8', 'Nd5'
20. 'Nxd5', 'e6'
21. 'Nb6', 'Bb4+'
22. 'Kf2', 'Rxd8'
23. 'Ne2', 'f5'
24. 'exf5', 'exf5'
25. 'Nc3', 'fxg4'
26. 'fxg4', 'Bxc3'
27. 'bxc3', 'Rd3'
28. 'Bd4', 'Rxd4'
29. 'cxd4', 'Kxb6'
30. 'c5+', 'Kc7'
31. 'd5', 'Be4'
32. 'Rd1', 'Bh7'
33. 'Rd4', 'g5'
34. 'h4', 'h5'
35. 'd6+', 'Kd7'
36. 'Rd5', 'Bg8'
37. 'Rxg5', 'Kc8'
38. 'Rxg8+', 'Kd7'
39. 'gxh5', 'Ke6'
40. 'Ra8', 'Kd5'
41. 'Rxa6', 'Kc4'
42. 'c6', 'Kb4'
43. 'Rb6+', 'Kc5'
44. 'c7', 'Kd5'
45. 'Kf3', 'Kd4'
46. 'c8=Q', 'Kd5'
47. 'Qf5+', 'Kd4'
48. 'Qe4+', 'Kc5'
49. 'h6', 'Kxb6'
50. 'h7', 'Kc5'
51. 'd7', 'Kb6'
52. 'd8=Q+', 'Ka6'
53. 'Qea8#'

Tuesday, March 26, 2013

Chess Playing AWS Mechanical Turk Progress

I started my first "real" game of chess on AWS Mechanical Turk last night, using a Raspberry Pi as a server, and here is the progress after 10 moves:

I'm paying $0.15 per move, and getting just below 1 move per hour.  At some point I will have to investigate the relationship between payout and move speed.  Two workers have submitted two moves each, the other moves have been from different workers.

Also the robot arm to move the chess pieces is coming along as well:

My one problem is that I purchased a Hitec HS-805BB from someone else than Lynxmotion, and it appears to come with a different servo horn than the AL5D arm was expecting, so I have to figure out how to obtain the arm-compatible servo horn.

Wednesday, March 06, 2013

Visit to Dim Sum Labs, Hong Kong

I am in Hong Kong on business, and got a chance to visit Dim Sum Labs near Sheung Wan.

The key to enter the space is an Octopus Card.  Pretty much everyone in Hong Kong has one because it is the stored value card for the mass transit system, but has expanded to be used in point-of-sale at convenience stores, fast food restaurants, and parking meters.  Some can be linked to a person and used for taking school attendance or library loans.  An Octopus Card reader can be purchased for about $20 USD.

The space is mainly one large room.  Greeting you is the "Spy Cat" which meows at you when you are detected with the PIR sensor.  It also shows on the D.S.L. web site whether someone is in the space or not:

One of the neat projects there is the online Arduino.  This is an effort to make Arduino hacking easy for beginners.  Members can access a Raspberry Pi over the Internet, and then go into the Arduino IDE running on it, and can program the Arduino to do things with a dot matrix LED display:

Results of the remote hacking can be seen using a webcam on the Pi:

Of course they also have a 3D printer, CNC project, drill press, lathe, etc:

D.S.L. is on the top floor (14th floor!) of a building, so they have access to a roof-top deck space.  While not very large, it gives you a neat view of the neighborhood.  Here is the look down from the D.S.L. deck:

I got to meet several nice folks at D.S.L. including Alexander List who is working on open spectrum issues, and Katia Vega, the programmer behind a project called "Blinkifier" she did with Tricia Flanagan.  This combined skin conductive ink and conductive eyeliner to allow blinks to be translated into LED displays on the headpiece using an Arduino:

Thursday, January 24, 2013

3D Printed Robot Arm & Hand

This looks pretty interesting - a 3D printed robot arm & hand.  Worm gears are 3D printed, and the arm uses two affordable HS805BB servos.

Wednesday, January 23, 2013

Online Text to Speech portal

I had to listen to the pronunciation of an ancient Greek word recently, and came upon CWSpeak an online text-to-speech portal that does a whole bunch of languages (even ancient Greek and Lojban).

Sunday, January 20, 2013

Dead simple Ajax form validation

It took a while for me to sift through all the examples to simplify the concept down to what I needed.  I need to validate chess moves based on the current chess board before the submission of the move (or else people on AWS Turk will submit lots of badly formed moves). "" is a Python CGI program that reads the QUERY_STRING to get the move and then sends back a "t" if the move is good or "f" if it is false.

<html> <head> <script> var OK2Submit = false; function validateMove() { OK2Submit = false; document.getElementById("moveDiv").innerHTML="<i>Validating move...</i>"; var xmlhttp; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { var moveGood=xmlhttp.responseText; if(moveGood.charAt(0)=="t"){ OK2Submit=true; document.getElementById("moveDiv").innerHTML='<i>That is a valid move, you may submit it</i><br><input type="submit" value="Submit">'; } else { document.getElementById("moveDiv").innerHTML="<i>Not a valid move!</i>"; } } }"GET",""+document.forms["myForm"]["move"].value,true); xmlhttp.send(); return false; } </script> </head> <body> <form name="myForm" action="" onsubmit="return OK2Submit" method="post"> Enter Move: <input type="text" name="move" onchange="validateMove();"> <br> <div id="moveDiv"></div> <br> </form> </body> </html>

Sunday, January 13, 2013

Better web server for Raspberry Pi and Python CGI

I now suggest you use lighttpd on your Raspberry Pi. Instructions to install it are here. To set up Python for cgi-bin use with lighttpd, see here.

Friday, January 11, 2013

Mechanical Turk ExternalQuestion pointers

1) If you are going to use an ExternalQuestion with Mechanical Turk command line API, you will need to use the following in your .question file:

<?xml version="1.0" encoding="UTF-8"?> <ExternalQuestion xmlns=""> <ExternalURL>http://myexternalquestion.html</ExternalURL> <FrameHeight>400</FrameHeight> </ExternalQuestion>

2) The form action for the Sandbox is ""

Saturday, January 05, 2013

Turk Chess Progress

1) I had a hard time getting people to respond to Mechanical Turk HITs with proper FIDE chess algebra notation.  So I am considering using a Javascript chess board as a front end - perhaps this one, together with an ExternalQuestion, with an example external HTML here.

2) To serve this, I needed the secret to set up thttpd on Raspberry Pi.

Wednesday, January 02, 2013

Potential Chess Turk Arms

Here is my list of potential Chess playing Turk arms:

Lynxmotion AL5D 26cm "median reach" (whatever that means), $340
EZ-Robot 6 Servo Arm 50cm "total length"(not much info), $140
OWI-535 Arm 32cm "horizontal reach" (needs feedback system), $45
Dagu 6DOF Arm 39cm length, $275
Trossen PhantomX Pincher 28cm horizontal reach (powerful AX-12A Dyamixel actuators), $400
Trossen PhantomX Reactor 38cm horizontal reach (has a serious reach spec sheet, that shows it really can only reach out 30cm with a vertical pick-up), $550.

Then there is the 5DOF laser-cut DIY arm (requires about $40 of servos).

Some of these could be altered to provide longer reach.  A typical chessboard is 12-18 inches (30cm to 46cm), although I did find this 10.5-inch (26.7cm)board as well as this 11-inch (28cm) set.   There is a 5-inch (12.7cm) set but I am concerned that positioning to a 0.5-inch square might be tough, plus I may have to remove the magnets from the pieces in this magnetic set.  This affordable 7.5-inch (19cm) set may be a good compromise between being small and not being insanely small.

Update:  Here is a Lynxmotion AL5C playing chess...OK, I bet an AL5D could do it as well!