Uploaded
Submitted by: amramsey Project Website: https://www.picaxeforum.co.uk/showthread.php?17613-February-Line-Followers-are-fun!![](../../thumbnail6f09.jpg)
Uploaded
Submitted by: amramsey Project Website: https://www.picaxeforum.co.uk/showthread.php?17613-February-Line-Followers-are-fun!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.
Some specs:
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...
Share