Git Product home page Git Product logo

ad7422_sensor_interface's Introduction

About

USB interface for ADT7422 temperature sensor based on STM32F4 board by WeAct.

Sensor connection

  • PB6 - I2C Data
  • PB7 - I2C Clock

Data format

The board send temperature readings over Virtual COM-port every second. The data is being send in the following format:

Byte 1 Byte 2 Byte 3 Byte 4
Temp MSB Temp LSB CRC8 CR ('\r')

Where CRC8 is calculated by:

uint8_t CRC8(const uint8_t *data, size_t length) {
    uint8_t crc = 0;
    
    for (size_t i = 0; i < length; ++i) {
        crc ^= data[i];
        
        for (int j = 0; j < 8; ++j) {
            if (crc & 0x80) {
                crc = (crc << 1) ^ 0x07;  // Polynomial 0x07
            } else {
                crc <<= 1;
            }
        }
    }
    
    return crc;
}

Temperature conversion formula

Use the following formulas to calculate the measured temperatures in °C from the ADT7422 output codes in 16-bit format (where ADC Code uses all 16 bits of the data byte, including the sign bit):

Positive Temperature = ADC Code (Decimal)/128
Negative Temperature = (ADC Code (Decimal) − 65,536)/128

Where Bit 15 (sign bit) is removed from the ADC code:

Negative Temperature = (ADC Code (Decimal) − 32,768)/128

Build

Project can be built in Visual Studio Code with C/C++ and STM32 plugins installed.

To build and debug ARM Embedded Toolchain and OpenOCD are both required.

ad7422_sensor_interface's People

Contributors

romdnop avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.