Reading I2C Sensor with Arduino Pro Mini

My project involves reading data from a Freetronics Barometric Pressure Sensor into memory on an Arduino Pro Mini. This is an addition/extension to reading temperature and humidity from a DHT22 sensor.

This barometric sensor has I2C capability so I am intending to use the SCL and SDA pins (A4 & A5) on the Mini but I am not simply using Serial Output to publish the data. My intention is to store the data and transmit same to the home station using the nRF24LO1+ RC breakout.

Can anyone tell me the data format needed to store the data from the BARO? I can't find that information anywhere.

Data is data.
The nrf module does not care at all whether you transmit ASCII format or binary or whatever format - it just sends and receives ones and zeros, usually in groups of 8 (a byte).

wvmarle:
The nrf module does not care at all ...

It is not the transmission of the data that concerns me, it's the format of the data that is read in from the BARO. DHT22 data is in float format and can be stored (and transmitted) as a struct of float

/* Data structure to hold sensor output when read. */
struct sensorReadingsStructure
{
  float temperatureCelsius = 0.0;
  float humidity = 0.0;
};

What I need to know is the format of the data read from the BARO. Is it also float? Is it some other type?

From https://github.com/freetronics/BaroSensor/blob/master/BaroSensor.h

/* Return temperature in C or Fahrenheit */
  float getTemperature(TempUnit scale = CELSIUS,
                       BaroOversampleLevel level = OSR_8192);
  /* Return pressure in mbar */
  float getPressure(BaroOversampleLevel level = OSR_8192);

  /* Update both temperature and pressure together. This takes less
     time than calling each function separately (as pressure result
     depends on temperature.) Returns true for success, false on an
     error */
  bool getTempAndPressure(float *temperature,
                          float *pressure,
                          TempUnit tempScale = CELSIUS,
                          BaroOversampleLevel level = OSR_8192);

Whichever method you use, the results are type "float".

What is your "home station"? If that is another Pro Mini or other atmega-based Arduino, then you should be ok. But if not, the home station may have difficulty understanding the format of the float, and it would be better to send the values as text.

If you are not using a dht22 any more, then you will not need the 5V regulator. The Freetronics module can run on 3.3V. If you also need humidity, then don't use the Freetronics module or the dht22. Get a BME280 sensor, which can measure temp, humidity and pressure.

PaulRB:
From https://github.com/freetronics/BaroSensor/blob/master/BaroSensor.h

I'm afraid my C++ is a bit strained with that, but I get the idea.

PaulRB:
Whichever method you use, the results are type "float".

That solves my problem. Thanks

PaulRB:
What is your "home station"?

The home station will either be another Pro Mini or a UNO. Haven't got that far in worrying yet. ::slight_smile:

PaulRB:
If you are not using a dht22 any more, then you will not need the 5V regulator. The Freetronics module can run on 3.3V. If you also need humidity, then don't use the Freetronics module or the dht22. Get a BME280 sensor, which can measure temp, humidity and pressure.

I'll got for a BME280 when I'm playing for keeps. :wink: I'll be happy to get this beginner's version working. :smiley:

Thanks for that

Have you seen Robin2's nfr24 tutorial? There may be information that you can use.