Mini gris servo calibration mode

The robot ‘brain’ (aka ATMega328) needs to know how long the servos must rotate in order to properly execute moves and turns. Hence there must be a servo timing calibration mode, and a way to initiate the mode. I’ve toyed with using a pushbutton or a magnet/reed switch in the past, but then the obvious occurred to me: why not just have a calibration mode control code?


Instead of sending path segment angle and distance information, the GRIS program will simply flash a single control code. I’m leaning toward ‘124,’ since 125 and 126 are the start and stop control codes.


In servo timing calibration mode, the robot will wait five seconds and then start traveling in a straight line. It is up to the user to measure out a distance of one meter and to shine a flashlight on the photocells when the robot reaches that distance. At which point the robot stops and stores the calibration information in EEPROM.

After another five seconds, the robot will start turning. After it has turned full circle (ie, 360 degrees), the user shines the flashlight again, and the robot stops and again stores calibration information in EEPROM.

Now the robot knows how long it takes for the servos to travel one meter and turn 360 degrees, and from that it is easy to calculate how long it will take to travel one centimeter and turn one degree. The next time the robot is turned on in regular mode, it will reference EEPROM and retrieve the stored calibration values, and multiply the path distance and turn data by the unit amounts to calculate how long the servos must rotate for each command.

No magnets or reed switches required, but I will have to revise the main GRIS program. This will keep me busy while waiting for ordered parts to arrive.

About engineerzero

Once and future engineer.
This entry was posted in Uncategorized and tagged , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s