From 214156b4cbd2c7f20134e5a82b444fc2f5f78593 Mon Sep 17 00:00:00 2001 From: Thomas Lambert <t.lambert@uliege.be> Date: Wed, 23 Nov 2022 11:02:18 +0100 Subject: [PATCH] fix(logg): error in current calibration --- controller/controller.ino | 2 +- controller/sensors.ino | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/controller/controller.ino b/controller/controller.ino index e0ee124..6498bb2 100644 --- a/controller/controller.ino +++ b/controller/controller.ino @@ -48,7 +48,7 @@ #define SEN0098_VCC 5 // Supply voltage of the current sensors #define SEN0098_SENSI 40.0 // Chip ACS758LCB-050B-PFF-T #define SEN0098_QUIESCENT_FACTOR 0.5 // Bidirectional chip-> V_IOUTQ = 0.5*VCC -#define SEN0098_OFFSET 0.007 // [FIXME] VERIFY! +#define SEN0098_OFFSET 0.0122 // Manually set so current is 0 when no current #define GEAR_RATIO 0.1 // Gear ratio between motor and wings diff --git a/controller/sensors.ino b/controller/sensors.ino index f206b3d..12a85f7 100644 --- a/controller/sensors.ino +++ b/controller/sensors.ino @@ -42,8 +42,8 @@ void GetPsu(byte vol_pin, byte cur_pin, float &vol, float &cur) { float GetCurrent(byte cur_pin) { float volt_raw = (5.0 / 1023.0) * analogRead(cur_pin); - float volt = volt_raw * -gCUR_QOV + SEN0098_OFFSET; // Trimming value to make current equal to 0 when no current - return volt / gCUR_FACT; // Actual current + float volt = volt_raw - gCUR_QOV + SEN0098_OFFSET; // Trimming value to make current equal to 0 when no current + return volt / gCUR_FACT; // Actual current } // Measure the tension provided by the PSU -- GitLab