Kit Robot Build Log

When designing the frame, think about:

  • Where should the sensors go?
  • Where should the wheels go?
  • Where should the center of gravity (CG) be?
  • How much ground clearance do you need?
  • What needs to be accessible after the frame is built? (USB ports, etc)

My frame started life as some scrap from a sheet of FR4 fibreglass:

Next came the electronics. It pays to test-fit things here and figure out wire runs before doing the final build. (As you can see from my mess of wiring, I decided to forego the latter.)

I’m using the pin assignments that are compatible with the Skeleton Program:

Time for the first power-on. I could use the AA batteries that the robot is intended to run off of, but it was safer to use a current-limited power supply, with the current limit set *very* low. At least in theory, if something is wired wrong and there’s a short-circuit, the current limiter should make it so that nothing burns up.

Success! 0.05A, or 50 mA is a healthy amount of current for the robot with the Arduino powered up, but the motors sitting still. Not to finish the build by installing and wiring the sensors.

After another lab power supply test, I confirmed that the system powers up and nothing is shorted.

Software time! Since this build is deliberately pin-compatible with the Skeleton code, I should be able to use the Arduino IDE to load the skeleton code directly onto my robot.

Link to Skeleton Code.

The one caveat is that the skeleton code requires the “PinChangeInterrupt” library, which can be installed in the Arduino IDE via the Sketch menu > Include Libary > Manage Libraries…. Type “PinChangeInterrupt” into the search bar, and then use the Install button to install the correct library.

The IDE should look like this:

After using the Tools menu to select the correct board type (“Arduino/Genuino Mega or Mega 2560”), processor (“ATmega2560”) and serial port, I compiled and uploaded the code to my robot.

The skeleton code supports the following devices:

  • Two DC motors
  • One Sonar distance sensor
  • One array of 7 reflectance sensors

It also contains a library for coming up with the position of a line under the reflectance sensors.

Reflectance sensors require calibration. Each time the program starts, it goes through a calibration sequence:

  1. Wait 5 seconds (During this time you should be placing the robot on a black surface)
  2. Take measurements (LED will go on too)
  3. Beep to indicate that this phase is finished (LED will go off)
  4. Wait 5 seconds (During this time you should be placing the robot on a white surface)
  5. Take measurements
  6. Beep to indicate that calibration is finished.

If all goes well, the robot will enter it’s main loop. So far the only code here output’s some diagnostic information to the serial terminal:

It’s up to you to implement the main loop that runs your robot logic!