09 November 2012

Raspberry Pi!


I got a new job at the Biomechatronics Group in the MIT Media Lab. But that's not what this post is about, it's about the 
RASPBERRY PI!

What is a Raspberry Pi, you ask? 

SO CUTE! ^_^


A Raspberry Pi is a full Linux computer the size of a wallet. Its 700MHz (256MB RAM) ARM CPU/GPU runs off a 5-volt 1-amp power source, like a phone charger. It has a built-in ethernet, USB, HDMI or composite video out, a useful GPIO (So you can set use IO pins like an Arduino, use UART, SPI, I2C, and other communication protocols). You can plug in a USB hub to use flash drives, keyboard and mouse, a WIFI adapter, an external hard drive...

It's supposedly $25.00 from the manufacturer, but an Amazon search puts us at $79.95 for the latest one, Rev B. Not bad for Amazon Prime free 2-day shipping. As for availability, it tends to go out of stock often. I feel this was a bigger issue in the past, though. 

I also highly recommend purchasing Raspberry Pi User Guide, written by Eben Upton, Co-Creator of the RPi. It not only details the RPi itself, but the recommended modified version of Debian Linux it runs. The Raspberry Pi and this book is an excellent way for anyone to become learned in Linux and python, two skills I deem highly valuable in being able to get things done. 

The Raspberry Pi is a really nice next step up from an Arduino in terms of DIY Electronics projects. The RPi is perfect for hobbyists looking to use the massive catalog of software available for Linux with the simplicity and speed of Arduino. Funny thing is, this Raspberry Pi is being used for Legit Research. (We're using a $800.00 Maxon motor, a $740.00 Servo Driver/Controller, an external fabrication shop to make our parts...)

After a few attempts to flash the RPi "Raspian" Raspberry-infused Debian OS onto a 32GB SD Card (The main storage method of an RPi), I managed to get write the image in Windows. 

After booting up the Pi, you log in with user "pi" and password "raspberry", and are at the main command line. To start the LXDE GUI, type in "startx". 
YAY!
It comes with Python IDLE, Midori web browser, and other useful little tidbits. It's an $80 Linux box the size of a wallet running on all solid state hardware (No spinning hard drives to deal with). Catch is, it's SLOW. 

Doing anything on this reminds me of back when my primary computer ran Windows ME. Those were dark days indeed...

However, this thing is so tiny, so cute, so inexpensive, so available, and so powerful for the size, that I am SO putting one of these on a robot one of these days.

05 November 2012

Solidworks to URDF Exporter! (& Future Projects)

I use Solidworks extensively in my mechanical designs, and I've used ROS before in the context of mobile robotics. Given my love for armature robotics, I will soon be using ROS for visualization, control, and planning. 

Now imagine my glee when Willow Garage announces the fruit of one of their summer 2012 interns's efforts: a Solidworks to URDF Exporter!




URDF is an xml-style file format for representing the mechanical properties constraints of your robot. For example, you can have a number of links tied by some revolute joints (generic serial link robot), or a base link with many children and degree constraints for each DOF (Like a robotic human hand). Mobile robots can even utilize URDFs for determining where certain sensors are relative to the base link, etc. TurtleBot's pre-written URDF file contains information on where the wheels are relative to the base link, as well as the position of the Kinect, for the odometry and vision code to use when calculating position or detecting objects. 

For more information on URDF, check out this presentation from ROSCon 2012: 




And It's available like right now right now. I download the file in the above link and try to install it, but: 



DAMMIT. I'm running an x86 OS (32-bit) and this program requires a 64-bit OS. I may try to rebuild it from the available source (YAY OPEN SOURCE!) or even modify the code if need-be. Or I can wait until the 32 bit version is released, even email the developer and see if he needs help/motivation in the 32-bit implementation. 

Also, I want to intern for Willow. They're a kick-ass company, and I believe in their vision for how (the royal) we will advance the field of robotics, through corporate backing open source research. I'm a bit nervous to apply just yet, because I feel I can offer them so much more to judge me by if I apply after I've finished playing with my TurtleBot and using ROS to command TinyArm and design and build DeltaBot and-

DeltaBot? What's that?! 

DeltaBot is a future personal project of mine, scheduled to be completed by the end of January 2013 at the latest. 

It's this: 



A Delta robot is a parallel linkage robot used in manufacturing which has 3 DOFs, X Y and Z. No rotation in this configuration. 
But mine will be on the scale of this one:



Which is a design I really like and am going to use as my main reference. In fact, I want to contact the make of the above little Delta robot and commend them on how nice their design is. When you stand on peoples' shoulders, best thank them and let them know what cool things their efforts paved the way for =].

Mine will be commanded by 3 of the 7 Pittman motors I bought a couple weeks ago. They will be geared down to allow a higher encoder resolution and payload, and controlled by my trusty XMega16a4u because I have experience with the chip, it runs at 32 MHz leaving me plenty of speed for high-precision motion, has 3 built-in quadrature encoder decoders, and I still have a bunch leftover from my TinyArmTroller project. 

OH and I got a few samples of these from TI, which have integrated gate drivers and everything. At 12 A peak, 6A continuous, these are perfect for the 10A peak Pittman motors.

SO MUCH BLOGGAGE COMING SOON! ENCODER DECODING! MOTOR CONTROL! KINEMATICS! YAY!

Oh, and I want to control it with this interface: 



Yupp. Freaking sick, right? The future is bright! Blog post on DeltaBot's design coming as soon as I design DeltaBot ^_^!

31 October 2012

The Spoils of Swapfest: MOTORS!

(Sounds like a book title, or something.)
MOTORS!
ALL THE MOTORS!


I found these gems from a couple of vendors at Swapfest. THREE MAXON MOTORS! THE BIG PITTMAN ONES HAVE 100 CPR QUADRATURE ENCODERS IN THEM!! I HAVE SEVEN OF THEM!!! *NERDGASMMMMMM!!!!!!*



SWAPFEST!

Swapfest is a monthly flea market hosted at MIT, where ass-tons of electronics and other hardware is sold from sketchy surplus purchasers. 



Look at all them electronics. 



Back to why I am so excited: 

Pittman/AMETEK... This is the same company that makes the two $200.00 gearmotors that I used in 6.141 last Spring. The same motor whose amazing quadrature encoders gave us insanely precise odometry. I basically own seven of the 6.141 motors, minus the heavy gearing (which I can easily do myself).


Here you can see the Quadrature Encoder connector, with the dark green shield cable
Some of you may be asking, what the is a quadrature encoder, anyway? Well a regular encoder is a system you attach to a shaft to measure rotation. Inside there's a small disk with holes cut out of it that looks like this: 

A light source and sensor pair are placed at the same radius away from the center shaft as the track, on opposite sides of this disk. As the beam is broken by the wheel, an interrupt is sent to whatever microcontroller is processing the encoder data and a counts value is iterated. 

But Dan, how do I know if it's spinning one way or the other? If I move the shaft back and forth, the micro will just keep adding values!

That's why the word Quadrature is so special. Quadrature encoder wheels look like this: 


They have two tracks on the disk, and have two light sensors instead of one.

First of all, this quadruples your resolution (hence the name "quadrature"). The tracks are 90-degrees out of phase, so every four ticks the pattern of Channel A to Channel B repeats: Black Black, Black White, White White, White Black. If you parse this correctly, you can determine which direction you're spinning. YAY!

With a strong build and an insanely high quadrature encoder resolution of 1000 counts per revolution The possibility of these motors are endless. I can put two of these on a mobile robot more powerful than TurtleBot's iCreate (In fact, I should start working on an Open-Hardware iRobot Create replacement Turtlebot-Compatible mobile platform!). I can use a few of these to make a low-DOF high-power manipulator. I can use all seven of them to make a high-quality 7-DOF manipulator comparable to the Barrett WAM arm
Woah...

So what exactly can these motors do?

Here's a laser Tachometer that measures how often a reflective tape passes its lens in RPM. I placed some aluminum tape over one side of a motor's output shaft. 


I hooked up a motor to a variable power supply and pointed the Tachometer to it, and did some Science. 


I took down my measured RPM at a range of voltages for the motor. The slope of the best fit line created by plotting these points will be the motor constant in RPM/Volt, seen here in cell A12. 
The data also makes for a pretty graph. Look at how linear DC motors are!

By taking the inverse of Kv, you can find Kt. This led me to the following  empirically-tested parameters:



Kv = 340.327 RPM/Volt = 35.639 radians per second per volt
Kt = 0.1763 newton meters per ampere

In order to get a VERY rough estimate of the max torque output of this thing, I held onto the motor shaft and applied some voltage until I couldn't hold it by hand anymore without hurting myself. I applied around 12V (which is good, I would probably use this off of an ATX power supply in the future) and read the current output as I stalled the shaft. The current went up to approximately 3 Amps. 
Kt * maxCurrent = .1763 Nm/A * 3 A = 0.5289 Nm at 12V



For teh lulz, I wanted to see if it could pick up a soda can. 

Soda can mass: .390kg =~ 1lb

Soda can gravitational force: .390kg*9.8m/s^2

.5289Nm/(.390kg*9.8m/s^2) = 5.45 Inches

This thing can cantilever a 1-lb load at almost 6 inches by my sketchy calculations. NICE!

Still curious to see what these motors could REALLY do, I decided to call up Pittman/Ametek to see if the datasheet was available on their end. Joe from their engineering tech support dept. was able to pull it up in seconds and email me the file, which contained a scan of an old-looking printout with some handwriting on it. The sheet is dated 1992, way back before human beings were civilized and purchased things on the internet.

Turns out their motor constant was ~ 332RPM/volt, so I'm pretty damn close. Their rated stall current is 10 Amps, so my 3-Amp estimate is way underrating the kind of power this thing could put out at 19.1 Volts! These are some kick-ass motors! 

AND I HAVE SEVEN OF THEM!



What's better than Pittman motors? Maxon Motors. Maxon is a Swiss company that makes beautiful motors for precision control, usually with planetary gearing and encoders built in. I first ran into them my first summer at MIT, working the for Media Lab Personal Robotics Group as a solder/code monkey on the team that made this adorable and cuddly robot. 

They're also hella expensive. A brushed Maxon gearmotor on their catalog today of this size (16mm diameter) will run you like $70.00. I got these for $5.00 each!

I'm too lazy to do the Tachometer thing with these motors, so I'll probably call up Maxon and try to get the datasheet somehow, because Maxon is notorious for taking their older model motors' datasheets offline.