{"id":23384386,"url":"https://github.com/michal34512/magnetometer-calibration","last_synced_at":"2025-04-11T02:21:07.230Z","repository":{"id":246593158,"uuid":"821578800","full_name":"michal34512/Magnetometer-calibration","owner":"michal34512","description":"magnetometer calibration algorithm with light weight linear algebra library","archived":false,"fork":false,"pushed_at":"2024-08-20T15:21:42.000Z","size":45,"stargazers_count":2,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-24T23:41:27.605Z","etag":null,"topics":["accelerometer","calibraition","eigen","ellipsoid-fit","imu","least-squares","light","linear-algebra","magnetometer"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/michal34512.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-06-28T21:48:02.000Z","updated_at":"2024-10-24T15:48:32.000Z","dependencies_parsed_at":"2024-07-09T23:58:43.159Z","dependency_job_id":"b5f1d16f-715e-4fca-a656-d80e321dfb0d","html_url":"https://github.com/michal34512/Magnetometer-calibration","commit_stats":null,"previous_names":["michal34512/magnetometer-calibration"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michal34512%2FMagnetometer-calibration","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michal34512%2FMagnetometer-calibration/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michal34512%2FMagnetometer-calibration/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michal34512%2FMagnetometer-calibration/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/michal34512","download_url":"https://codeload.github.com/michal34512/Magnetometer-calibration/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248328398,"owners_count":21085312,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["accelerometer","calibraition","eigen","ellipsoid-fit","imu","least-squares","light","linear-algebra","magnetometer"],"created_at":"2024-12-21T23:19:42.122Z","updated_at":"2025-04-11T02:21:07.211Z","avatar_url":"https://github.com/michal34512.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Magnetometer calibration\nMagnetometer calibration algorithm using ellipsoid fit and least squares method with light weight linear algebra library. Unlike similar algorithms, it \u003cb\u003edoes not\u003c/b\u003e require external linear-algebra library thus it's perfect for:\n\u003cul\u003e\n  \u003cli\u003eESP32\u003c/li\u003e\n  \u003cli\u003eArduino\u003c/li\u003e\n  \u003cli\u003eLightweight applications\u003c/li\u003e\n\u003c/ul\u003e\n\n\u003cp align=\"center\"\u003e\nVisualization (graphs not included in the code)\n\u003cimg src=\"https://github.com/michal34512/Magnetometer-calibration/assets/136522993/7fc41cf1-9d9d-41d6-8e2c-825d0499b35d\" border=\"10\"/\u003e\n\u003c/p\u003e\n\n\n\n# How to use\n```c\n// data arrays\ndouble x[231] = {18.923634, 20.785405, 23.265396, ...};\ndouble y[231] = {94.943907, 103.939205, 113.472091, ...};\ndouble z[231] = {27.951207, 32.958822, 31.772349, ...};\n\n// Create vector based on data arrays\nVector vx = vec_from_array(x, 231);\nVector vy = vec_from_array(y, 231);\nVector vz = vec_from_array(z, 231);\n\n// Fit best ellipsoid to the data and save offest vector, translation matrix   \nCallibration_t calib = calib_calibrate_sensor(vx, vy, vz);\n\n// Print the result\nvec_print(calib.offset);\nmat_print(calib.transform);\n\n// Compensate new data point based on calib\n// new data = calib.transform*(old data - calib.offset)\nVector new_data_vector = vec_new(3);\nVEC_X(new_data_vector) = 18.923634;\nVEC_Y(new_data_vector) = 94.943907;\nVEC_Z(new_data_vector) = 27.951207;\ncalib_calibrate_point(calib, new_data_vector);\n\n// Print calibrated vector\nvec_print(new_data_vector);\n```\n# Algorithm perfomance\nAverage variance of points length in relation to calibration data noise (random mag. 100 data points):\n![image](https://github.com/michal34512/Magnetometer-calibration/assets/136522993/df930068-2c8a-4ca8-b1ef-d4f1a6730eee)\n\nAverage chance of algorithm failure in relation to data point count (random mag. data with 10% noise):\n![image](https://github.com/michal34512/Magnetometer-calibration/assets/136522993/df975675-cb75-4c7f-963d-f025fb2569e8)\n\nExample of data calibration with 50% noise:\n![image](https://github.com/michal34512/Magnetometer-calibration/assets/136522993/9752cadd-9f7c-496e-8559-d9e351b3e218)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichal34512%2Fmagnetometer-calibration","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmichal34512%2Fmagnetometer-calibration","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichal34512%2Fmagnetometer-calibration/lists"}