New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EEPROM-based calibration system with serial line interface #23

Open
wants to merge 4 commits into
base: master
from

Conversation

Projects
None yet
2 participants
@psychogenic

psychogenic commented Jul 29, 2014

Greets!

I've been using AHRS and love it, but for the need to recompile when calibrating.

I've created this patch which enables eeprom-based sensor calibration, and also provides a means to view and set calibration values using the serial line/terminal.

All the basic calibration values are supported, though I wanted some feedback before proceeding to implemented the extended magnetometer stuff (the system currently accommodates the values, it just doesn't support setting them through the serial line yet).

Here's a sample of my interaction with the IMU through the serial Monitor (comments in [brackets]):


[Example Serial Line interaction with EEPROM calibration system]

ch [Show calibration help]

***** Calibration Help *****
All commands prefixed with '#c' followed by:
* get or set [g/s]
* accel, magn, or gyro [a/m/g]
* coord: x,y, or z [x/y/z]
For accel and magnetometer:
* min or max [m/M]

Examples:
Get acceleration x max: #cgaxM
Set acceleration y min: #csaym -244.00
Set gyro z: #csgz -39.9

Current calibration values may be dumped with #cd or #cD (includes calculated values)

cd [Dump calibration values]

*** Current Calibration ***

  • Accelerometers
    x: min: -260.000
    max: 257.000
    y: min: -250.000
    max: 266.000
    z: min: -284.000
    max: 240.000
  • Magnetometers
    x: min: -531.000
    max: 700.000
    y: min: -476.000
    max: 436.000
    z: min: -590.000
    max: 320.000
  • Gyros
    x: -39.350
    y: -3.580
    z: 29.140

csgz 28.666 [Set gyro z value to 28.666]

cd [Calibration values dump]

*** Current Calibration ***

  • Accelerometers
    x: min: -260.000
    max: 257.000
    y: min: -250.000
    max: 266.000
    z: min: -284.000
    max: 240.000
  • Magnetometers
    x: min: -531.000
    max: 700.000
    y: min: -476.000
    max: 436.000
    z: min: -590.000
    max: 320.000
  • Gyros
    x: -39.350
    y: -3.580
    z: 28.666

[success!]


Please let me know what you think and if there's anything you'd need to get this pushed onto the main trunk.

Regards,
Pat Deegan http://flyingcarsandstuff.com

psychogenic added some commits Jul 29, 2014

Created an eeprom-based sensor calibration system. It allows for stor…
…ing of all sensor calibration values in eeprom, as well as queries and setting values through the serial line.

[Example Serial Line interaction with EEPROM calibration system]

***** Calibration Help *****
All commands prefixed with '#c' followed by:
	* get or set [g/s]
	* accel, magn, or gyro [a/m/g]
	* coord: x,y, or z [x/y/z]
For accel and magnometer:
	* min or max [m/M]

Examples:
Get acceleration x max: 	#cgaxM
Set acceleration y min: 	#csaym -244.00
Set gyro z:			#csgz -39.9
Current calibration values may be dumped with #cd or #cD (includes calculated values)

*** Current Calibration ***
* Accelerometers
x:	min: -260.000
	max: 257.000
y:	min: -250.000
	max: 266.000
z:	min: -284.000
	max: 240.000
* Magnometers
x:	min: -531.000
	max: 700.000
y:	min: -476.000
	max: 436.000
z:	min: -590.000
	max: 320.000
* Gyros
	x: -39.350
	y: -3.580
	z: 29.140

*** Current Calibration ***
* Accelerometers
x:	min: -260.000
	max: 257.000
y:	min: -250.000
	max: 266.000
z:	min: -284.000
	max: 240.000
* Magnometers
x:	min: -531.000
	max: 700.000
y:	min: -476.000
	max: 436.000
z:	min: -590.000
	max: 320.000
* Gyros
	x: -39.350
	y: -3.580
	z: 28.666

[success!]
Changes made to enable use of the new eeprom-based Calibration settin…
…gs system. Moved the calibration related defines (ACCEL_X_MIN, etc.) out, added instructions/help and included functionality to handle "#c"alibration serial line requests.
@DougF42

This comment has been minimized.

DougF42 commented Nov 22, 2015

Psychogenic - I was about to try to implement this myself when I found your contribution. For the record, I pulled a copy and loaded it into a NANO with a GY-85 board, and it seems to be working well.
I hope this change it makes it into the master.

Three thoughts:

  1. Suggestion: Add a command (e.g.: #cr ) to reset the eeprom to defaults. This would help with debugging, testing, etc.
  2. It seems to me that the min and max values would be set together in normal usage, not separately. Would it make more sense (and simplify the command line) if the Min and Max values were always set in one command? (E.G: Set accel x value Min and Max to -240/250:) #cax -240.00 250.00
  3. I'd also like to see the extended magnetometer settings added to the command line interface. For the interface, my suggestion would be to enter the ellipsoid data on a single command line as a triplet, and the transform as three separate commands, each defining one triplets.

In any case - thanks for the fine work!
*** Doug

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment