Jon's Place

Wednesday, February 28, 2007

More AVR

So, over the past week, I've been working in my spare time getting my ATmega168 board to do something more useful than blink an LED. I built a prototype board for the IMU, which holds the 5-axis IMU board, the one-axis gyro, and a couple switching voltage regulators. It also has a couple Bioloid bus connectors, although they are only used to provide power to the board.

I've got the first pass of the Biooid bus sensor code almost done. I can hook the ATmega168 to the bus, send it a packet, and it parses the packet, recognizes what kind of command it is (PING, READ_DATA, WRITE_DATA), and does the appropriate thing, complete with writing response packets back. I'm reading data from all six channels of the IMU, and updating the control table values where they are kept. The only real issue right now is that the UART code I am using is assuming a standard two-wire UART, so the Tx pin isn't hooked to the bus. My brother Dave, who has helped me enormously getting all this going, and provided all the support code to access the various hardware features of the AVR, is going to adapt the work he did on the ATmega128 application so the UART on the ATmega168 will work the same way.

As you can see, I've made a couple changes to the ATmega168 prototype board. I added a second bus plug, and changed the other serial port to use my "normal" DS-275 based serial adapter. This is hooked up to a normal digital I/O pin, and my brother wrote a nice little module that bit-bangs the transmit half of a serial connection user a hardware timer. This gives me the ability to log what's going on inside the chip through a back-channel, which is a huge help when I'm trying to figure out what is going on.

All of this work on the IMU module will apply almost 100% to the foot pressure module as well, so I'm really killing two birds with one stone here, in terms of the software. The code I'm writing (which I will release once it is done and fully working) will allow any kind of sensor to be hooked up to the Bioloid bus, assuming the ATmega168 can talk to it.

The control table for the IMU sensor will look like this:

0 Model Number (L)
1 Model Number (H)
2 Version of Firmware
3 ID
4 Baud Rate
5 Return Delay Time
6-15 Reserved
16 Status Return Level
17-23 Reserved

24 Reserved
25 LED
26 Forwards acceleration low
27 Forwards acceleration high
28 Sideways acceleration low
29 Sideways acceleration high
30 Vertical acceleration low
31 Vertical acceleration high
32 Pitch rate low
33 Pitch rate high
34 Roll rate low
35 Roll rate high
36 Yaw rate low
37 Yaw rate high

I may add another value, which allows you to specify one of a couple orientations that the sensor is mounted in. This will just affect which A/D port goes into which of the above control table registers.

*The BrainBot project is directed and funded by the Brain Engineering Lab and Neukom Institute

Saturday, February 17, 2007

First AVR Program

So, last night, with the help of my brother, I finally got all the issues cleared up, and got my AVR toolchain working. I'm using avr-gcc with cygwin and avrdude and an AVRispMkII programmer I picked up from Digikey. And you also have to use WinAVR (avr-gcc comes with it), and you have to have AVRStudio (to help debug programming issues).

Damn complicated, these AVR tools. Anyways, I now have an ATmega168 that can blink an LED. More importantly, I have been introduced to the (ugh) world of Makefiles, and have a pretty nice one set up for building AVR code.

Next up, I'm going to get the UART working, and then comes A/D. Once I have those working, the foot pressure sensors and a six-axis IMU will be next in line.

Wednesday, February 14, 2007

ATmega168 Prototyping Board

Last night and early this morning, I managed to solder together a prototype ATmega168 board for testing my foot pressure sensors and my IMU. You can see more details about what is on this board here.

Tuesday, February 13, 2007

AX-12 Insides

So, I decided last night to see what the inside of an AX-12 looks like. It turns out to run on an ATmega8. Interesting stuff...

Friday, February 9, 2007

Walking Faster

Another progression - same walk sequence, but running through the steps in half the time. The film is almost the same length, but he's taking six steps this time, and then crouching back down when he's done.

Go here, scroll to the bottom...

Thursday, February 8, 2007

MicroRaptor Walking

Well, last night I finally sat down and finished the motion sequences necessary for taking both left and right steps, so now MicroRaptor can walk. Its a very crude walk, and definitely needs a bunch of work, but it is clearly walking.

The thing I like about this is it looks sort of like real walking, with the feet tucked under the body, and taking great big strides. Last time I measured it, MicroRaptor's stride (the distance from the front of one foot to the front of the other while at full extension) was about 6", which is pretty good.

The feet are still sliding around a little, and I'm going to fix that pretty soon with some silicone pads on the bottom of his feet. Obviously, of course, this all needs to be tuned, but the plan is (once wifi is enabled and the IMU is in steady use) is that MicroRaptor will tune his walk himself.

Anyways, to see it in action, go to the MicroRaptor page and click on "MicroRaptor Movies". The walking one is at the bottom...

Friday, February 2, 2007

IMU and Squeak

I love Squeak. You can do really cool stuff with it. In very little time. Take this morning, for instance. I got up at 5:30, and by 8:00 I built a multi-sequence graphing window that feeds off my logs, and shows the behaviour of the IMU as the robot is moving. The image to the right is a graph of the 3-axis accelerometer readings as MicroRaptor stands up, and starts a walk sequence.

I can add more entries to these graphs as well, as the second graph shows. This graph has the full 6 axis IMU output. In case you were wondering, I'm using a 6-axis IMU borrowed from the Brain Engineering Lab. The graphs are all dynamically generated directly from the log information, with no manual interaction required.