## How to "calibrate" a micro:bot?

Have questions about a SparkFun product or board? This is the place to be.

Moderator: phalanx

jharris1993
Posts: 4
Joined: Tue Oct 09, 2012 5:25 pm

### How to "calibrate" a micro:bot?

Greetings!

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.

Question:
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"

jremington
Support Volunteer
Posts: 2327
Joined: Fri Jun 15, 2007 9:41 pm
Location: Eugene, Or

### Re: How to "calibrate" a micro:bot?

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: https://thecavepearlproject.org/2015/05 ... r-arduino/

jremington
Support Volunteer
Posts: 2327
Joined: Fri Jun 15, 2007 9:41 pm
Location: Eugene, Or

### Re: How to "calibrate" a micro:bot?

Note: any magnetic or iron containing materials, as well as current carrying wires near the compass will distort the Earth's magnetic field, and so calibration must be performed in place. In some cases, calibration may not even be possible due to such environmental interference.

See https://support.microbit.org/support/so ... ll-screen-