Monday, March 10, 2008

Update 3/10/2008:

I been MIA working on some paying projects. After I completed that, I got drawn into a new venture with a buddy. I can't say too much about what it'll be, but in order to get ready for it I've been playing with a new chip (to me anyway). The Atmel Tiny13.

Pros:
  • 8-pin dip $1.29
  • No xtal needed has internal clocks up to 9.6MHz
  • Supports in-circuit programming
  • 1K flash, .5k EEPROM
  • 6 I/O all of which can be digital or 10-bit A2D
  • Requires a pull-up on reset
  • Uses the same GCC compiler as I am used to
Cons:
  • Internal clocks while they can be calibrated are somewhat inaccurate (thought they work fine for what I want)
  • 1K of flash goes fast :)
In a nutshell I wanted a servo tester/driver. So I surfed the web, found snippets of code here and there, and came up with a little demo. If I were to use this on my robot, I would change it to trigger a "pickup" sequence of servo moves. However, I've never really played with the A2D on an Atmel and I purchased 4 Sharp gp2d12's so I figured why not. The A2D is read about 40Hz which is also how often the servos get a new value (if required). The timer ISR is set to execute every 13us. At the end of every 20ms frame, the servo signals are turned on. Each run of the 13us timer subtracts 1 from the servo count until it reaches 0. Then the servo pin is turned off. I'm only using the upper 8-bits of the A2D conversion (16-bits adds a lot to the program size and I don't think it's needed). The most current reading is compared to the previous reading + or - 7. This is to prevent the servo from "jerking" all over the place, but it results in visible "stops" in the video.


Here is a video of the results. I may add to it, I may not. The important thing is that on a 1" square PCB I can have a multi servo controller that uses analog feedback to position the servos.

I promise to post the source code once I get it cleaned up (this was just quick and dirty) and commented.

Forward,
Jay