Tuesday, September 30, 2008

UAV Damage Control

Rockwell Collins demonstrates adaptive control system for UAVs capable of compensating automatically for battle damage.

Rockwell Collins' Automatic Supervisory Adaptive Control (ASAC) technology Press Release

This appears to be based on a conference paper titled "Application of Relay Tuning Methods to UAV Autopilots" which was presented at the 2006 AIAA Guidance, Navigation, and Control Conference and Exhibit.

It looks like that by using relay tuning methods they are able to recompute the PID controller gains for the UAV Autopilot quickly enough to maintain stable flight, this system should also work with morphing aircraft.

A similar concept might also be applicable for ground robots being damaged or traveling on varying terrain.

Wednesday, September 24, 2008

Books for Robots: Quaternions & Rotation Sequences

If rotation matrices are not working out for you due to the gimbal lock problem or poor speed performance, you could consider using quaternions.
The advantage is that the rotation operations are much faster and more accurate due to the rotations simply being multiplications without using trigonometric functions. Strangely, quaternions use a four dimensional vector with three imaginary numbers and one scalar, whose product is non-commutative.
This book somehow does the impossible and clearly explains something that seems crazy. Additionally the book has some of the best figures for explaining Euler angles I have seen.

Saturday, September 20, 2008

Robotics Sea Snake

Amphibious snake-like robot "ACM-R5"

Developed by the Hirose Lab at the Tokyo Institute of Technology, his amphibious robotic snake moves with surprisingly natural movements on both land and underwater. The robotic snake is not quite small enough to crawl through smaller plumbing pipes. Its main body is 80mm in diameter without the fins, and has a total length of 1.75m. Interestingly it looks like it uses regular hobby servos for its joint actuators, perhaps they are using the high torque versions.

[From: Fuji Sankei Business i.]

Thursday, September 18, 2008

Wednesday, September 17, 2008

Product Design & Development Review

Product Design & Development magazine
Score: 3.8 / 5
Difficulty: 2.5 / 5

Product Design & Development magazine usually has one or two interesting articles, and the rest of it is ads and advertorials.This isn't really the type of magazine you read for the articles if you know what I mean... Every issue has at least one product listed that I had never even thought to look for that could definitely be useful for a project.
For example, I found the LSI/CSI 32-Bit Multi-Mode Counter with Serial Interface Part #LS7366R in one issue. I didn't even think to look for an integrated circuit that could interface between a quadrature encoder interface and SPI Bus. Unfortunately I found this after I implemented the same thing with a PIC microcontroller using sampling. They have full issues available online as well.

Tuesday, September 16, 2008

Analog to Digital Conversion

This tutorial covers some of the basics for connecting an analog sensor to a PIC microcontroller.

In this case we will be using a potentiometer as our sensor, but accelerometers, gyroscopes, temperature sensors, and most other analog sensors will work in a similar way.

As the potentiometer is rotated approximately 315 degrees from left to right the signal voltage will vary between 0 Volts and 5Volts, In this example the output signal will be connected to pin AN0 on the PIC microcontroller. The equivalent circuit shows how the potentiometer can be represented as a voltage divider.

By making the assumption the RL is very large, the output signal voltage is a function of the input voltage and the position of the potentiometer knob.

In practice your input voltage is almost never 5 Volts, and your sensor is never absolutely linear, so probably the best thing to do is to calibrate in software or use a high precision voltage reference. The voltage reference setup is a little more complicated so it will be left for the reader, however here is a series voltage reference from Texas Instruments that would probably work well.
2.5V 100ppm/Degrees C, 50uA in SOT23-3 Series (Bandgap) Voltage Reference
This App Note from Maxim has more information about choosing a voltage reference if you are really interested.
Series or Shunt Voltage Reference?
So ignoring the problems for now, we can determine the sensitivity of the potentiometer.

The range of motion of the potentiometer is estimated to be 315 degrees and the full voltage range is considered valid.

On a PIC 18F4550 the A/D Converter is 10 bits, on the 18F4553 it is 12 bits, these values are substituted in for n.

With these values, the number of degrees of rotation can be determined from the value returned in software by ReadADC()
Keep in mind that you will not get 12 bits of accurate data without some serious work. If you really need 12 bits then you should read the following PDF by Bonnie Baker from Microchip.
Techniques that Reduce System Noise in ADC Circuits

So again skipping the complicated bits, connect the sensor to the PIC microcontroller. In this case we are using Create USB Development boards, but there are many other choices out there.

{tex}$\theta=ADC_{in}*Resolution/Sensitivity\approx ADC_{in}*.3077${/tex}
Theta will be considered to be a positive angle when rotated clockwise from the center position, and a negative angle when rotated to the left.

Using the Microchip USB Framework here is the code fragments necessary to get things working.
the variable x listed in the code below is assumed to be a global float but if you need more speed and less accuracy you can change it.

void UserInit(void)
// set AN0 to input

// etc...

void ProcessIO(void)
// User Application USB tasks
// if((usb_device_state < CONFIGURED_STATE)||(UCONbits.SUSPND==1)) return;

if (lastcount != count) {
Delay10TCYx( 5 ); // Delay for 50TCY
ConvertADC(); // Start conversion
while( BusyADC() ); // Wait for completion
x = ReadADC(); // Read result
x -= 512; // 512 = 2.5Volts ie. Center Position
x *= 0.3077; // convert from mV to degrees
CloseADC(); // Disable A/D converter

// etc...

Monday, September 15, 2008

Cool Tool: Crazy Strippers

These strippers are great for times when, due to regulations or standards, you need to make sure your strippers only take off just the right amount.

This one likes to do two at once.

I would love to see a video of these strippers in action.

These strippers look very precise and efficient.

Saturday, September 13, 2008

Cool Tool: Screw Cutter

Cleanly cutting screws is easy when you have the right tool. Strangely enough you probably already own this tool.


To cut a screw you will need a pair of combination crimper & wirestrippers, which is probably already in your tool box. Simply thread the screw into the tool where indicated by the red arrow, and squeeze until the screw breaks. After removing the screw you may find a small burr which can be removed with sand paper.

To cut metric screws you will metric wire strippers (for metric wire), I bought mine on a trip to Europe at Praktiker Baumarkt. Unfortunately the brand I bought was not that good.

Kombizange zum Crimpen und Abisolieren
Gewinde abscherer von M2.6 bis M 5

I managed to find online nice pair of Knipex brand wire strippers online, however I doubt they ship to the US. Maybe eBay...


Friday, September 12, 2008

Robot magazine Review

Robot magazine
$5.99 Cover Price or 1 Year for $24.95 as of September 2008
Score: 3.8 / 5
Difficulty: 1 / 5

Robot magazine is the Popular Science of the robotics world. Its filled with great glossy photos, one or two equations and generally avoids getting deep into technical details. Somewhat surprisingly the ads seem to be more technical then the articles.

The magazine generally seems geared towards hobbyists and students who have competed in FIRST robotics. The main feature of this magazine is their solid coverage of robotics news and events. They have just moved from publishing semiannually to publishing bimonthly. I would probably buy it again for the pictures and the advertisements.

Wednesday, September 10, 2008

PIC USB Serial Number

The Communications device class (CDC) in the Microchip USB framework does not set iSerialNumber, so what ends up happening is that every time you plug in the device it gets a random COM port assigned to it. These code modifications allow you to set iSerialNumber from EEProm which will allow the device to come up as the same COM Port on both linux and windows. This also has the advantage that it allows the serial number to be set during testing via usb instead of compile time, which is handy if you are making a bunch of boards.


//Serial Number string descriptor
ram struct{BYTE bLength;BYTE bDscType;WORD string[8];}sd003={

//Array of string descriptors
(BYTE *)&sd000,
(BYTE *)&sd001,
(BYTE *)&sd002,
(BYTE *)&sd003


This is where the values are loaded from the EEProm.

void InitializeSystem(void)
struct dscinfo {
BYTE bLength;
BYTE bDscType;
WORD string[8];
struct dscinfo *ptr;
int i;
ptr = (struct dscinfo *)USB_SD_Ptr[3];
EECON1bits.CFGS = 0;
EECON1bits.EEPGD = 0;
for (i=0;i<8;i++) {
EEADR = 0x00 + i;
EECON1bits.RD = 1;
ptr->string[i] = EEDATA;



void USBStdGetDscHandler(void)
if(SetupPkt.bmRequestType == 0x80)

inPipes[0].pSrc.bRom = (ROM BYTE*)&device_dsc;
inPipes[0].wCount.Val = sizeof(device_dsc);
inPipes[0].pSrc.bRom = *(USB_CD_Ptr+SetupPkt.bDscIndex);
inPipes[0].pSrc.bRom = *(USB_USER_CONFIG_DESCRIPTOR+SetupPkt.bDscIndex);
inPipes[0].wCount.Val = *(inPipes[0].pSrc.wRom+1);                // Set data count
inPipes[0].pSrc.bRam = *(USB_SD_Ptr+SetupPkt.bDscIndex);
inPipes[0].wCount.Val = *inPipes[0].pSrc.bRam;                    // Set data count
inPipes[0].info.Val = 0;
}//end switch
}//end if
}//end USBStdGetDscHandler

//Array of string descriptors
extern BYTE *USB_SD_Ptr[];

Tuesday, September 9, 2008


When working in the laboratory, I often end up with unknown screws. I could use a regular screw gauge to figure out the thread profile, but often when working with robots I don't know if the screw is metric or imperial and some of the profiles are fairly close.

I use the SCREW CHEK'R screw gauge to solve this problem. This handy tool that not only identifies the screw, but also lists the drill number for threaded and through holes.

Imperial (English)
Metric 2mm - 7mm
Metric 8mm - 14mm

Monday, September 8, 2008

iRobot buys Nekton Research for 10 - 15 Million

If you want you can read the Press Release, however the pictures are probably a little more interesting. It looks like iRobot got a good deal on this acquisition, especially considering Nekton already has existing contracts.

Nekton High Speed UUV


Sunday, September 7, 2008

Sisyphean Adhesion Problems

Developing a robot comes in many stages, but I find the most common one seems to be trial & error. Let's start by looking at the simple problem of attaching a sprocket to a shaft to transmit power via chain, like on a bicycle.

Now this may initially seem like a a fairly easy problem. You could use a keyway or a set screw on the sprocket to attach it to the shaft. Maybe you could use something fancy such as a sprocket with a Fairloc integrated fastener. Maybe press-fit would be suitable for your torque transmission requirements.

What if the shaft you wanted to use was 3 millimeters in diameter? What if the shaft was stainless steel and the sprocket was made out of glass reinforced nylon (Nylatron)? Now it's time to start thinking about adhesives.

CA Glue aka Superglue aka Cyanoacrylate

CA Glue is generally good for plastics, ok for metals and bad for glass. It tends to melt plastic together, which can often be good as it will melt to pieces of plastic into one piece of plastic. I tried using this but it did not work for attaching the sprocket, probably due to the Nylatron being a glass composite and the high shear forces.

Store Brand Epoxy

Epoxy generally works best on porous materials and is also used to make carbon fiber. This didn't work because the shaft was too smooth.

Loctite® 242® Threadlocker aka Blue Loctite

Blue Loctite is generally used to keep screws from coming loose where you think you might want to take them out again. This would be great to put on a set screw to keep it from coming loose. Unfortunately it is not going to work for this project.

Hitec RCD makes servos with a plastic called Karbonite which seems to be similar to Nylatron. They offer the following FAQ Item, "Can I use loctite with my Karbonite gears?". The answer is no.

Loctite® 272® Threadlocker aka Red Loctite

Red Loctite is similar to blue Loctite except that is is used on screws that you do not ever plan on removing. One trick though for removing a screw that red Loctite was used on is to heat it with a soldering iron or heat gun.

Loctite® 680 High strength retaining compound aka Green Loctite

Green loctite is used as a retaining compound which makes it ideal for connecting gear, sprockets and bearings to shafts. There is also a primer that is suggested for stainless steel. Call the manufacturer or at least visit their website before buying this, as your problem may be slightly different then mine. Also note that there are hundreds of Loctite products.

After treating the shaft, adhering the parts and allowing them to dry, the results were tested. The results of testing showed that the green Loctite worked the best, however it failed at approximately 90% of desired torque transfer.

The solution to this adventure was to drill a 1mm hole in the 3 mm shaft and then glue it with epoxy as shown below, which unexpectedly worked.

Saturday, September 6, 2008

Nuts and Volts Review

Nuts and Volts
$5.50 Cover Price or 1 Year for $24.95 as of August 2008
Score: 4 / 5
Difficulty: 2.5 / 5

I think Nuts and Volts is a great magazine for electronics hobbyists. It's probably ideal for after you have soldered a few things together and have built a kit or two. Recently the articles tend to feature about 60% digital and 40% analog with a good mix of microcontrollers in both of those groups. Some are fairly simple such as connecting a pushbutton rotary encoder to a micro controller. Some of them are more complex such as building a spectrum analyzer.

The great thing about Nuts and Volts though is that they provide schematics and source code with the articles, but the best part is the Q&A section where readers questions are answered. Half the reason I think I buy this magazine is that the ads help fuel my gear lust.

Friday, September 5, 2008

Mechanical Parts

If you know what it's called you can probably find someone to sell it to you in the mechanical parts and tools vendor list below.

Bolt Depot
Bolt Depot has a great selection of imperial and metric fasteners, and will even sell you screws individually.

Online Metals

Online Metals is a great place to order metal as it is usually cheaper then McMaster, however they do not deliver the next day.

American Science & Surplus

Similar to electronics goldmine, but with more mechanical parts such as motors, pumps, switches, optics, batteries and power and a lot of other stuff.

Freeman Mfg. & Supply Co.

Polyurethane foam supplier.

McMaster-Carr Supply Company

They sell a multitude of materials, fasteners, fittings, measurement tools, etc.
If it is part of something, McMaster probably sells it. “Most orders are delivered the same or next business day at standard ground rates.” Usually slightly more expensive then other vendors for everything. But you get what you pay for in terms of service and delivery times.

MSC Industrial Direct Co., Inc.
Just like McMaster except their website is horrible. The website has been fixed after they bought J&L, so they are a great alternative to McMaster.

J&L Industrial Supply

MSC probably bought this company for the great website. The website also now has a new domain name with more letters. J&L mostly stocks tools and metal working supplies. Check their online sales fliers for deals on calipers and other tools.

Not quite as nice as McMaster’s website but they have a slightly different selection.

Travers Tool Co., Inc.

Travers sells similar products to MSC/J&L but it is located in Queens for my convenience. Unfortunately their website is somewhat lacking, and does not currently seem to work in Firefox 3.

Small Parts Inc.
They sell small parts. Gears, bearings, lead screws, sprockets, tubing, etc.

W.M. Berg

Berg also sells small parts, however their parts are usually more precise and expensive.

The Robot Marketplace
Robot Marketplace carries motors, electronics, wheels, gears, carbon fiber, remote controls. batteries and more.

The robotics competition for highschool students puts a ton of information online explaining how varios parts connect and lists the manufacturers who donate these parts. It is great for looking at the information for coming up with ideas and figuring our what parts are called.
10 -The Kit of Parts-RevB.pdf
2008 Tips and Guidelines RevB.pdf

80/20 Inc.

This company sell an industrial strength Erector set and offers a ton of possibilities for larger projects.

Igus Inc.

Friction is the enemy of moving parts! Fortunatly, Igus offers several low friction solutions to your sliding problems.

ServoCity carries a wide selection of electronics but its best products are a selection of mechanical parts that can be attached to servos.

Maryland Metrics
If you need something that is metric and can't find it elsewhere, this is the store for you. The website will probably make you go blind, so calling is suggested as they are quite helpful.

Thursday, September 4, 2008

Electrical Parts

If you are not lucky enough to live near a Fry's Electronics you will most likely need to order your electronics online.

FindChips.com is a great online tool for finding a vendor if you know the part number, if you don't you can try from the list of vendors below.


Digi-Key Corporation
Digi-Key is the first choice for electronic components.

Electronics Goldmine
Electronics Goldmine sells random electronics, often refurbished or pulled from discontinued products. The website is a great place to visit for ideas.

Jameco Electronics
Jameco is usually the cheapest, if they have it. That old adage about price may apply.

Mouser Electronics, Inc
If Digi-Key does not have it Mouser might.

Newark Electronics
If you still can not find the part try Newark, the shipping and handling is usually more expensive.

They sell cheap electronics kits and a great source of motor controllers. Their website has a ton of information about basic stamp microcontrollers.

Sparkfun Electronics
Sparkfun is a great small business that specializes in hobby electronics and kits. They have tons of sensors and tutorials.

Wednesday, September 3, 2008

Local Resources

Finding robot parts is not the easiest thing in the Big Apple, so here is a list of some of the many places in New York City to buy parts. Please feel free to contact us with any additional places you know of.

269 Electronics
269 Canal Street New York, NY 10013
The store is located all the way in the back and carries a variety of electronic components and tools. Limited selection, call ahead for best results.

America's Hobby Center

263 W 30th St, New York, NY
(212) 675-8922
Great hobby store that has lots of good parts such as balsa wood, motors, wheels, bearings. They may no longer have a store in Manhattan due to rent increases, so call ahead. Gone to New Jersey...

Canal Plastics Center

345 Canal Street New York, NY 10013
(212) 925-1666
This store is possibly the last surviving plastic store that is still on Canal Street. It is located about 2 blocks from Plastic Land.

Home Depot
Home repair supplies, electrical basics, lumber, fasteners. Home depot is your friend. The Home Depot website is useless, so don’t bother using it. The 23rd street Home Depot has a great selection of lighting and a poor selection of parts you might need. The “good stuff” is hidden in a back room to your left as you go down the escalator. Strangely, the 59th street store is vastly superior in every possible way. The long Island City Hope Depot is the closest full service store that is easily reachable by subway.

Pearl Paint
308 Canal Street New York, NY 10013
Phone: 212-431-7932
One of the best art supply stores in the city, carries lots of plastics, wood, foam board, and everything necessary for resin casting plastic.

Stock Drive Products / Sterling Instrument
55 South Denton Ave New Hyde Park, NY 11040
Company is based in Long Island and can be visited via the LIRR and a walk. Offers free catalogs online. These catalogs are really useful since not only do they have pictures of parts you may not know the name of, necessary when searching the internet, but the catalog also has a ton of reference information such as how to find the center distance between two gears.

T & T Plastic Land Inc.
315 Church Street New York, NY 10013
(212) 925-6376
One of the remaining plastic supply stores from Canal Street, they moved around the corner to Church Street. If you need a 6” diameter 8’ long green Plexiglas tube they probably have it or can get it.

Travers Tool Co., Inc.

Travers sells similar products to MSC/J&L but it is located in Queens for our convenience. Unfortunately their website is somewhat lacking, and does not currently seem to work in Firefox 3.


Tuesday, September 2, 2008

PIC Interrupt Calculator & Code

I find that when writing interrupt code for the PIC Microcontrollers that it is often annoying figuring out the proper values for the overflow reset TMR0.
TMR0 (or any of the other timers) are incremented at a regular interval and when the value of the timer overflows the interrupt occurs. So if for example you used a Timer0 interrupt in 16bit mode with a prescaler of 1, then every 4 clock cycles of the main clock the value of TMR0 will increase by one and when it reaches 65536 the interrupt will happen.
If we want an interrupt to occur every 0.1 Seconds we would use a prescaler of 1:128 and 16bit mode. However instead of counting from 0x0000 to 0xFFFF, we will count from 0xDB61 to 0xFFFF. The calculator helps you figure out where to start counting from.
So, to make my life and yours easier, here is a Timer Calculator and example interrupt code.

PIC Timercalc for Google Docs

Example Interrupt Code

OpenTimer0(TIMER_INT_ON & T0_16BIT & T0_SOURCE_INT & T0_PS_1_128);
TMR0H and TMR0L are circled in red
The Prescaler is circled in blue and specified by TO_PS_1_128
TO_SOURCE_INT indicates the internal oscillator
16 bit Mode circled in green is indicated by T0_16BIT
Also please note that the accuracy column is not accurate, and the best way to calibrate the timing is to use the interrupt to blink an i/o line and connect it to an oscilloscope or use counter and a timer.
// Declare count as a global variablestatic unsigned int count = 0;// Function prototype for Intewrrupt service Routinevoid timer_isr(void);// Setup High and Low Priority Interrupt Vectors#pragma code high_vector = 0x000808void high_ISR (void){_asm goto timer_isr _endasm}#pragma code#pragma code _LOW_INTERRUPT_VECTOR = 0x000818void low_ISR (void){;}#pragma code#pragma interruptlow timer_isr// Primary Interrupt Service Routinevoid timer_isr (void){if (INTCONbits.TMR0IF) { // if Timer0 Interrupt has overflowedINTCONbits.TMR0IF = 0; // Reset overflow flag// 16 Bit Interrupts overflow at 65536// so if we start counting at 64536 it will take 1000 Clock "ticks" to overflowTMR0H = 0xDB;  // Timer0 High ByteTMR0L = 0x61;  // Timer0 Low Byte// This interrupt is designed to increment count every .1 Secondscount++;}}#pragma codevoid UserInit(void){//Enable Global InterruptsINTCONbits.GIE = 1;//Enable Priority InterruptsINTCONbits.PEIE = 1;TMR0H = 0xDB;  // Timer0 High ByteTMR0L = 0x61;  // Timer0 Low ByteOpenTimer0(TIMER_INT_ON & T0_16BIT & T0_SOURCE_INT & T0_PS_1_128);/* more stuff here */}