SparkFun Forums 

Where electronics enthusiasts find answers.

By jharris1993

A shiny new micro:bot showed up under the Christmas Tree this year - to the delight of both my granddaughters and myself!

for the time being, I am playing with it so that I can understand how to make it do what it does, so that I can explain it to the girls.

Toward that end, I wrote a small program that does the following:
  1. Set both motors to non-invert mode. (I verified that "forward" was indeed "forward" when built.)
  2. Turn both motors "off" (just in case!)
  3. Set both motors to "forward" as speed "50"
  4. Turn both motors "on"
  5. Pause for one second to allow the device to go somewhere
  6. Turn both motors "off"
  7. Set one motor to reverse, the other forward, speed "50" (this causes it to turn in-place)
  8. Turn both motors "on"
  9. Pause for [insert time here] to allow the turn to take place.
  10. Turn both motors "off" (to end the turn)
  11. Set both motors to "forward" at speed "50"
  12. Pause for one second so the 'bot can move.
  13. Turn both motors off.
The idea of this being to have the motor move forward, turn in place 180 degrees, and come back to the point of origin.

Obviously, the radial amount of the turn in degrees depends on the value of "insert time here" as well as the speed the motors are set to. Equally obvious, the exact radial degree of turn is derived by experiment, sticking one value in, trying it, sticking another value in, trying that, until the exact radial is found.

"It is also intuitively obvious", (as my Calculus professor used to say), that for any figure more complicated than a line, determining the timing for each and every turn is a non-trivial exercise.

Has anyone every tried to make some kind of "calibration chart" or "calibration curve" for the micro:bot so that someone like myself - trying to make the 'bot do something other than follow a line - can start the experimentation process with values that are reasonably close?

I am assuming it would be some kind of nomograph relating speed, time, and (possibly) battery voltage.

Jim "JR"
By jremington
In principle, you could use the compass on the micro:bit to determine the heading relative to magnetic North. IF (big if) the compass is properly calibrated, reasonably accurate turns can be judged from the change in heading.

I know nothing about using the micro:bit but perhaps there is a forum or web page that will teach you how to use the compass.

General overview and tutorial on compass calibration here: ... r-arduino/