Using a pressure sensor Print
Written by Vlado Berend   

HopeRF offers many pressure sensors, besides the HP03M that I received. They also offer some with a built-in compass. Figure 1 shows the internal structure of the HP03M sensor.

Some features of the HP03M pressure sensor:

  • power supply voltage: 2.2 V to 3.6 V,
  • stand-by current: 1 µA, 500 µA during conversion,
  • air pressure measurement range: 300 – 1,000 hPa,
  • error in pressure measurement: +/- 1 hPa,
  • temperature range: - 20°C to + 60 C,
  • error in temperature measurement: +/- 0.8 °C,
  • built in 16-bit A/D converter,
  • conversion time: 32 cycles.

I became interested in this sensor due to its I2C communication bus. Most available pressure sensors generate a voltage output proportional to pressure. This requires the addition of both a high resolution A/D converter and a very stable reference voltage. Most pressure sensors do not have a built-in temperature sensor, so we would have to add it, if we want to measure altitude by measuring air pressure and temperature.

The HP03M sensor has power supply pins, I2C pins and two additional ones: MCLK (clock) and XCLR (reset).The XCLR pin resets the A/D converter when set low. It must be held high during a conversion (which typically takes 40 milliseconds). For normal operation, the sensor’s A/D converter requires a 32 KHz external clock. The HP03M also contains a built-in EEPROM, where factory constants are stored.

This EEPROM is read the same way as one would read a 24C02 EEPROM. By this I mean that the I2C Read address is the same (A1 hex). The sensor’s EEPROM stores 11 parameters that are needed for accurate calculation of air pressure and temperature. The memory map of these coefficients is shown in Table (EEPROM - stored coefficients needed for accurate calculations).

  • Co­ef­fi­ci­ent EE­PROM AD­DRESS
  • C1(MSB:LSB) (16:17)
  • C2(MSB:LSB) (18:19)
  • C3(MSB:LSB) (20:21)
  • C4(MSB:LSB) (22:23)
  • C5(MSB:LSB) (24:25)
  • C6(MSB:LSB) (26:27)
  • C7(MSB:LSB) (28:29)

  • A (30)
  • B (31)
  • C (32)
  • D (33)

We will read two parameters from the sensor:

  • D1: pressure
  • D2: temperature

These values are not direct representations of pressure and temperature, but values that are used, along with the EEPROM constants, in calculating the actual pressure and temperature.

There are two I2C addresses that are used to communicate with the HP03M’s sensors:

  • EE hex to write to the sensor,
  • EF hex to read from the sensor.

Using a pressure sensor

2012_AVR_UK_93

Continue reading

Shop area

Last Updated on Wednesday, 01 August 2012 14:40