Offset Dummy Cell
Opened this issue · 2 comments
Hi,
I recently got my Rodeostat (Hardware Variant: 10V_10MilliAmpV0.2 Firmware:FW0.0.9). I run a test with the dummy cell 50k. I expected that a 0V also the current 0uA is, but at 0V there is a current flowing of -14uA and 0 current flow occurs at 0.65V.
Is there any option to adjust something to get 0 current at 0V?
Best regards
Chris
I found a solution for the offset issue. I added a compensation factor to the ADC read and DAC write commands.
see the new define MID_ADC_OFFSET and MID_DAC_OFFSET in the file ps_analog_subsystem.h
#elif defined DEVBOARD_ITSY_BITSY
static const uint16_t DefaultAnalogWriteResolution = 12;
static const uint16_t DefaultAnalogReadResolution = 12;
static const eAnalogReference DefaultAnalogReference = AR_DEFAULT;
// Define mid-point ADC offset
#define MID_ADC_OFFSET +23
// ----------------------------------------------------------------------------------------------
// Temporary - to check system prior to changing resistor values
// ----------------------------------------------------------------------------------------------
static const uint16_t MaxValueAin = uint16_t((uint32_t(1) << DefaultAnalogReadResolution) -1);
static const uint16_t MaxValueDac = uint16_t((uint32_t(1) << DefaultAnalogWriteResolution)-1);
//static const uint16_t MaxValueAin = 1489;
//static const uint16_t MaxValueDac = 1489;
// ----------------------------------------------------------------------------------------------
static const uint16_t MidValueDac = MaxValueDac/2;
// Define mid-point DAC offset
#define MID_DAC_OFFSET -9
#endif
in the file ps_analog_subsystem cpp I added the values to the read ADC and write DAC.
float AnalogSubsystem::getCurr() const
{
// Get current measurement from working electrode
return SignCurr*currRange_.intToValue(getTransAmpAin()+MID_ADC_OFFSET);
}
void AnalogSubsystem::setValueDac(uint16_t value)
{
// The value of the output voltage Dac
valueDac_ = min(value,MaxValueDac)+MID_DAC_OFFSET;
analogWrite(DAC_UNI_PIN,valueDac_);
}
Hi Chris,
Regarding the current offset you are seeing. The Rodeostat uses amplifier circuits to set the gains and to scale and shift the values to the appropriate ranges for the inputs and outputs of the microcontroller. The components used by the amplifiers, in their feedback networks, etc, have a specified tolerance. For the Rodestat these components are typically either 0.1% or 0.5% depending on where they are used. This tolerance will set the accuracy over the full scale range of the input/output.
In your example you are using the +/- 1000uA current range - so the full scale range is 2000uA. The current offset you are seeing about 14uA. This is an error of 0.7% which is roughly what we would expect given the 0.1% to 0.5% component tolerances.
I agree that having a system which allows users to add a custom calibration to account to the component errors would be great - thanks for sharing your solution. I've actually been thinking about ways of modifiying the firmware and Python API to allow users to set custom calibrations for both the different output voltage ranges and the current ranges. Ideally users would be able to set there own calibrations and save them to nonvolatile memory. I think it would also be nice to have a protocol for creating the custom calibrations, e.g. here are the step you need to go through to calibration an output voltage, here are the steps for a current range, etc.
Best,
Will