Older blog entries for tbenedict (starting at number 33)

The AVR Dragon rocks. I used it to debug an ATtiny85 with some LED blinker code running on it, and it worked like a champ. My next project is a gravity racer (or "downhiller") for a local club challenge. The idea is to take the idea of the soapbox derby (a gravity race involving a twisting curving course) and scale it down to the size of the pinewood derby. Oh, yeah, and make a robot that drives it.

So what's the appeal? No motors! No drive wheels! So the things wind up being pretty dirt cheap. If you read all the pinewood derby forums, you'd be convinced that the Secret of Speed is smooth axles, perfectly axisymmetric wheels, low drag, etc. For this? So far the Secret of Speed seems to be not hitting stuff and tuning the servo loop that handles steering. (So far none of the ones built at our club has navigated the 8' straight track without smacking wall... This isn't that easy a challenge.)

So I'm planning to use an ATtiny84, which has the 16-bit timer I need for driving the servo. (I could do a single servo on an 8-bit timer, but I've already got servo code written that uses the 16-bit timer.) The ATtiny84 can do debugWIRE, so this'll be the perfect opportunity to try the Dragon out on a for-real project. (WOOT!)

I'm looking forward to the build and to the tuning that'll happen afterward. Should be a fun robot.

The NEXT track the club's going to run is a full-blown slalom course. I'll be curious to see if the best-tuned straight-track cars perform well at all in the curves.


Dragon Steak with some Squid

I picked up an Atmel AVR Dragon + STK500 bundle from Digikey a while back to compliment my AVRISP mkII. It's an outstanding combo for the $50 I spent on it. The STK500 came pretty much ready to go, and made it worlds easier to program the stockpile of AVR chips I've built up. I'm pleased as punch with it.

The Dragon is also an impressive piece of hardware, but I didn't really get going on it until recently. It'll do debugWIRE, JTAG programming and emulation, ISP programming, HV programming, oooh, it gives me the shivers... Except it didn't come with any cables, and you basically have to wire it up differently for each device.

I ran across a neat Instructable, though, that had a nice way to make some general-purpose cables:


I've got parts ordered to build a set of these cables.

In the process of researching all this, though, I ran across some posts on http://ww.avrfreaks.net with some great names for things. One refered to the AVR Dragon + STK500 setup as a Dragon Steak. Another refered to the breakout cables for the Dragon as squid cables. So once all the bits show up next week and I get everything crimped together, I'll have a dragon steak with a side of squid. Can't beat it.

(A quick aside: If you ever need to build a cable with a lot of tiny crimp connectors, best thing you can do is get a job at a place that has a lot of crimping tools so you don't have to shell out the $500-1500 for a tool to make a $15 cable!)

Anyway, I'm looking forward to using debugWIRE for one of the projects I'm working on. It takes over the AVR chip you're using it on and clocks it one command at a time so you can step through your code on a live, running piece of hardware. I know there are simulators for the AVR, and I use them. But it's tough to fake input to a simulated ADC. With debugWIRE I won't need to. I'll be able to see what the actual ADC is seeing: my sensors. I'm stoked.


Shallow Blue lost at UNI. Not that I was entertaining any huge hopes, but I confess to feeling a little disappointed I went out that early. (Of course I lost to 2Strong2Bad, which was pretty cool to see no matter what.) Already planning for next year. But after watching the ExSpurt Mule matches, I'm pretty sure I'll lose next year, too. Bring it on!

On another note I finished my first real honest to goodness robot using the Pololu Robotics Orangutan controller. It's a line follower I've had on my bench for months called Speedy. To be honest the Orangutan is massive overkill for the project, and I was planning to use a Baby-Orangutan (which weighs a measly 3g). But my Baby-O is tied up in another project, and I had to get it finished by Monday for a club meeting.

I learned something in the process: When you're tuning a new PID loop, ALWAYS make sure your batteries are up to snuff. I did all my tuning with a 9V depleted to 6V (little did I know), so the tuning was disappointing, the speed even more so. A battery swap this morning put a smile on my face when I saw the higher speed it was getting, and made me laugh when I thought of the time I spent yesterday doing loop tuning. Anyway, it should be a fun day of tuning.


Shallow Blue is in the mail to UNI's mail-in mini-sumo competition. Yahoo! This will be Shallow Blue's first appearance off-island, so I'm excited as excited can be.

Please please please, if you are hosting a robotic competition, consider adding mail-in entries for at least some of your events. This is my first time entering an event off-island. I hope it's not my last.


Lots has happened since the 0.2 release of Orangutan-lib. I got my ThereminVision II system, and managed to barf things up before I ever got it running (adding "Don't solder chips onto boards at 5am before I get my coffee" to the list of don'ts). I'm hoping a little creative re-soldering and maybe part replacement will get the beastie up and running. Can't wait!

In other news the last of the parts for my line follower showed up. I'm re-designing the motor mounts and bot chassis to cut weight. It's already a little too over-budget on weight for my liking. If I can shave things down under 150g with battery, I'll be happy. (If I can swap batteries and get it down under 120g, I'll be a lot happier.) I'm already looking at making custom wheels for it. Trying to get those in under 5g apiece, with tire. Only time will tell.

I'm working on the software tx-only UART code for Orangutan-lib. Doesn't look like it should be too heinous, but I'd like to leave the option open for defining more than one. This will take some testing. Might be time for another release soon!

My line follower will be the first robot I build that uses Orangutan-lib, so I'm pretty stoked to see how it turns out. The next one is going to be a downhill racer, project to be announced. And once the ThereminVision II stuff is up and running, the mini-sumo that it's destined to run on will also run on Orangutan-lib. Proof's in the pudding. Hope it all works!


The 0.2 rev of Orangutan-lib has been released:


It's a WinAVR/AVR Studio 4 library for the Orangutan family of robot controllers from Pololu. The current rev of the library include support for ADC, digital I/O, code to drive the on-board buzzer, code for the LCD, relay-style motor control, PWM motor control, pin change interrupts, code to drive up to eight R/C servos, and hardware serial UART code.


Things I've learned while working on Orangutan-lib:

* It pays to have spares: I managed to damage my one Orangutan while testing motor code. Waiting on the mail.

* It pays to do range checking: My first pass at R/C servo code didn't do any range checking because "it added too much overhead" (my own words to myself when I made that bone-headed decision.) Har de har har! The first time I passed it an out of range value it stripped gears. (My servo code now does range checking.)

* It doesn't pay to do electronics when you're sick: Loose wire. Live power. Bad judgment. Melted plastic. 'Nuff said.

* It pays to breadboard: I *thought* that resistor network I had was the type with a common ground. Luckily I learned it wasn't before I soldered anything down.

* It doesn't pay to do software development when you're sick: No melted plastic, but lots of "Aroo?" moments. Which leads me to...

* It pays to do version control: Several times now I've backed out my "Aroo?" moments by checking out a previous rev of my source. Subversion is cool!

All in all the past few weeks have been entertaining. I've learned a lot, built a lot, programmed a fair bit, and can't wait to get over this cold and go to the post office.


Two bits of news:

In the next ten days or so I'll be able to order an Orangutan-X2. My plan is to have Orangutan-lib ported to it as quickly as possible, and to make sure all future development on Orangutan-lib can run on all three Orangutan devices. This'll be fun!

The other bit of news is that after a lot of dinking around with some Parallax QTI sensors for my line follower, I finally figured out how the little beasties work. The datasheet for the QTI doesn't do a great job of explaining it. It took a fair bit of digging into the Parallax forums before I got a good handle on things:

Basically the QTI sensor is a photoreflector that feeds a charge integrator. The output pin of the QTI looks at the integrator, not the sensor itself. This is not typically how transistor-based sensors are wired up. I have my own theory as to why Parallax did things this way, but without tearing one apart I can't really test it.

Anyway, the post that unraveled this gave this advice for reading a QTI:

1 - Set your sensor's I/O line to output and bring it high.
2 - Wait 0.23ms for this to discharge the QTI's capacitor.
3 - Bring the sensor's I/O line low and switch to input. At this point the I/O line should be in tri-state mode, and present high impedence to the QTI. Essentially the QTI's capacitor is now isolated.
4 - Wait 0.23ms for the sensor to charge its capacitor.
5 - Read the I/O line through the ADC.

I really really wish Parallax had made this more clear in their documentation. I wouldn't have stumbled around as much, and I might not have even selected the QTI in the first place. I really was after a continuous analog device.

In any case my complaints have to end here. Parallax QTI sensors are in use on scads of robots, and they do a good job of keeping bots in the ring and following the line. I just wasn't using them correctly. And since I'm not using them on a Basic Stamp, I hadn't bothered to look at the sample code to see how they were reading them. My bad.

In any case Speedy is back on track, Orangutan-lib is still on track, and I might even be able to build out my 4WD mini sumo some day. Can't complain.


It's my first foray into the wonderful world of Sourceforge! I moved the Orangutan AVR library over to Sourceforge, and will continue development and support over there. The supported command set is still pretty small, but it's enough to make a robot move about and sense what's going on in the world around it:


The re-write on the library and examples is complete, so I'm back to developing new code. Command sets in the pipe include servo control, quadrature encoder feedback, and count up / count down timers. The timer code is being debugged, and the servo code is next.

Once I have working servo code and timer code, the next trick is to get a Mark III chassis, motors, wheels, sensors, and Tigerbotics tires, and see if I can make an Orangutan-based Mark III that can out-wit my existing Mark III. After that, I'll finish the 4WD rolling chassis I've been holding off on, move the sensors over to that, and go from there.


No real update on the Orangutan library. At the suggestion of Jan on the Pololu forums, I took a side tangent to turn all my earlier notes and code snippets into a series of single-file examples for how to make the Orangutan do a specific task. The idea isn't to make the library unnecessary, but to give people examples that explain how things are working "under the hood" so to speak, so if the library doesn't quite fit their needs, they know how to start tweaking (and why!) Five examples so far, plus the library itself. Now I need to replicate those examples for the library!

In any case here's where it's living:

Orangutan Library & Examples

I'll likely start this as a project as well. I've got enough of the library done to finish Speedy, my line follower. So hopefully some day soon I'll get back on that one.

Another project that's coming up is a microcontroller controlled underwater ROV. It'd still be a remotely operated vehicle, but with smarts on board the tether can be a lot lighter, and it's easier to expand the ROV's capabilities. (Want temperature sensing? Plug one in!)

Protacraft is about to start selling neutrally buoyant tether cable with two 14AWG power wires and 3 twisted pairs in it for $2US per foot. This would be a perfect tether for what I'm thinking of. With the Orangutan library coming along, the addition of serial I/O routines would let me use an Orangutan at the top and a Baby-O at the bottom. With SPI routines added to the library, I could install more A/D ports than I could reasonably use.

But that's a project for another day.


24 older entries...

Share this page