My PICAXE chips showed in the mail on Friday, so I soldered up a robot last night.
This morning I played with some code a bit. Well... not really code I suppose. ;-) Me and my kids have been playing with the Logicator tool on the PICAXE chips with a previous robot, so I wanted to try and use that on this initially. After playing with it a bit, I came up with a program :
Essentially it waits for a button, then turns on the motors and heads forward. If the analog input on both front sensors shows a line, it drives forward at 40% speed. If one or the other sensor doesn't detect a line, it slows one of the motors to 25% to turn back towards the line. If the line is completely lost, it turns back in the direction that it last saw the line aggressively (50% on one wheel, stopped on the other wheel). Along the way, it also turns on the LEDs based on what is being seen on the two front line sensors.
The video shows what it looks like in motion. It does well following a fairly simple line like shown in that video. It needs a little more brains to handle harder courses where there might be breaks in the line, tight corners, etc... Just a matter of adding some more code to deal with data from some of the outside sensors. It was very cool to see how quickly I could get a robot up and running with the PICAXE processor.
From the point of having the hardware finished to having that line follower running was only 20 minutes or so. I think the hardest part was realizing that I had to program the FTDI usb chip to invert the RX/TX signals so it would play nicely with the picaxe tools. A quick search in the forum showed me the error of my ways.
- Supports PICAXE28X2 3V and PICAXE28X2 2nd generation devices
- 8 line sensors on the front, covering 98.6mm side to side
- Dual 1A h-bridges
- 2 user LEDs, a speaker and a user programmable button
- IR LED power control
- on-board USB port for programming/debug and 1S LiPo battery charging
- an expansion header with single digital I/O, intended for RF debug link
- 10cm x 10cm size, wheels mounted 2/3rds of the way back from the front of the robot
The motors are mounted with sintra that I cut on my CNC mill. I pocket out a bit of the sintra so that the motors sit inside a small cavity top and bottom and can't wiggle around. It bolts together with some little 4-40 bolts right into the sintra. Nice, light and cheap. I've got a play for building some custom wheels too with sintra, o-rings and some small bolts, but didn't get a chance to play on the lathe this weekend to give it a shot. Hopefully this week...