Skip to content

Possibly incorrect emissivity setting method #3

@CrouchingPanda

Description

@CrouchingPanda

In the application note it says to enter EEPROM address 0x0F unlock key and then to change both 0x0F and 0x04 registers for MLX90614xCx type models, which is one used on your evaluation board.

It seems this is not being followed in your setEmissivityCorrectionCoefficient method:

void DFRobot_MLX90614::setEmissivityCorrectionCoefficient(float calibrationValue) {

A snippet from Melexis' oficial repo:

int MLX90614_SetEmissivity(uint8_t slaveAddr, float value) 
{
    int error = 0;
    uint16_t data;
    uint16_t curE;
    uint16_t newE = 0;
    float temp = 0;
    
    if(value > 1.0 || value < 0.05)
    {
        return -6;
    }
    
    temp = value * 65535 + 0.5;
    newE = temp;
    
    error = MLX90614_SMBusRead(slaveAddr, 0x24, &curE);
    
    if(error == 0)
    {
        error = MLX90614_SMBusRead(slaveAddr, 0x2F, &data);
        
        if(error == 0)
        {
            temp = curE*data;
            temp = temp/newE + 0.5;
            data = temp;
            
            if(data > 0x7FFF)
            {
                return -6;
            }
                    
            error = MLX90614_SendCommand(slaveAddr, 0x60);
            
            if(error == 0)
            {                
                error = MLX90614_SMBusWrite(slaveAddr, 0x24, 0x0000);
                
                if(error == 0)
                {
                    error = MLX90614_SMBusWrite(slaveAddr, 0x24, newE);
                    
                    if(error == 0)
                    {
                        error = MLX90614_SMBusWrite(slaveAddr, 0x2F, 0x0000);
                        if(error == 0)
                        {
                            error = MLX90614_SMBusWrite(slaveAddr, 0x2F, data);
                            
                            if(error == 0)
                            {
                                error = MLX90614_SendCommand(slaveAddr, 0x61);
                            }
                        }       
                    }
                }       
            }        
        }            
    }
    
    return error; 
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions