https://2019.makerfairerome.eu/en/

PRESSURE AND TEMPERATURE SENSOR

By on September 5, 2019
Pin It

 

A small jewel capable of detecting atmospheric pressure and temperature, designed for the construction of weather stations or applications where it is important to know these parameters, such as air mass meters and altimeters. Let’s try it with Arduino.

 

We know Omron for the many industrial sensors it has produced and continues to produce, which range from encoders to pressure transducers; actually, this manufacturer has recently distinguished itself for the development and the offer of PLCs and solutions for industrial automation too, but the sensors have always been its strong points. As far as pressure transducers are concerned, Omron also extended its skills to those used in machines for measuring blood pressure, so much so that it managed to develop his own models of meters for civil use.

In these pages we propose a project that makes use of a new pressure and temperature sensor, the 2SMPB-02E, proposing an application example based on Arduino, thanks to which we print on the serial monitor the values ​​read in the surrounding environment; the whole can be used for many applications, ranging from simple weather station to dynamic model aircraft and visual flight, to the realization of altimeters for every field of use, to wearable electronics and to air mass meters (to determine which the pressure is not enough but it is necessary to know also the density of the air, correlated to the temperature).

Before analyzing the circuit, we give an overview of the integrated sensor, so as to know its characteristics and use.

 

The Omron 2SMPB-02E sensor

This small technological jewel (you can see it in Fig. 1) integrates, in a metal container case with ceramic base and LGA (Land Grid Array) contacts with 9 pads, a pressure transducer and a humidity transducer both analogical, whose electrical quantities are converted to digital data through a very precise ADC with a resolution of up to 24 bits; the digital interface, which can be used for data acquisition by means of a microcontroller (which in the case of the application described is that of Arduino) is a serial bus configurable in I²C or SPI mode, which serves not only for data output but also to receive from the microcontroller any setting or data request commands.

The sensor is calibrated at the factory to make the pressure and humidity measurements even more precise and the calibration parameters are stored in an OTP memory, always in the factory.







 

Fig. 1

 

As for the pressure transducer, it is able to measure between 30 and 110 kPa (since 1 kiloPascal is 0.01 bar, the range is between 0.3 and 1.1 bar) and bears up to 800 kPa (8 bar ); to detect the atmospheric pressure it is very good and also to make an altimeter.

The tolerance on the measurement of the absolute pressure is, in an operating temperature range of 0 and 65 ° C, ± 50 Pa, while between -20 and 0 °C rises to ± 80 Pa. Instead on the relative pressure, the tolerance is ± 3.9 Pa.

The resolution (which is the minimum detectable gradient) on the pressure measurement amounts to just 0.06 Pa, which makes it more than suitable for the sensor to function as an altimeter, as it can detect minimal pressure variations that correspond to small changes in altitude such as, for example, those between one floor and another of a building.

As for the temperature measurement, the internal sensor detects (between 30 to 110 kPa) in a range between -20 and + 65 ° C, with a resolution of just 0.0002 ° C, therefore very high, and tolerance of ± 2 ° C.

As for the power supply, the sensor requires a continuous voltage value between 1.7 and 3.6Vdc, while the average absorption, assuming an operating cycle that includes 1 sample / s in Ultra High Accuracy mode (with very high precision with 24-bit data output) is just 21.4 µA, making it the ideal device for ultra-low-power, battery-powered or energy-harvesting solutions. In this regard, consider that the Omron device supports a sleep mode, in which it is brought to rest completely absorbing just 2 microamps.

 

 

As for the continuous operation, for the pressure measurement, we are on the absorption of the order of 0.64 ÷ 0.8 mA, while for the temperature measuring section we are between 0.41 and 0.52 mA; the difference depends on the sensor used.

The logic levels on the data channels consequently go to the supply voltage, therefore in output they are proportional: if we feed the 3V chip, the levels 1 and 0 will be 3V and 0V respectively.

Well, with this introduction we can proceed. Being an SMD component and therefore hard to manipulate, we planned for it a

breakout board of which we are going to analyze the circuit diagram immediately; like all breakout boards, this one also has pads on one side for mounting a pin strip.

 

 

Wiring diagram

In addition to the 2SMPB-02E sensor (signed U2), the circuit consists of a low-drop-out linear voltage regulator (U1) and a MOSFET adapter for the I²C-Bus interface, useful for translating supported logic levels from the sensor to adapt them to the standard TTL of traditional logic boards and to Arduino.







To explain how the translator works, let’s start with the clock, which on the U2 side is connected to pin 4, while towards the connection pin-strip it is connected to SCK (both lines are equipped with a pull-up resistor, ie R6 on the SCL and R7 side sensor side): when the SCL of the connector is at a high logic level, the protection diode inside the MOSFET Q2 (placed between drain and source) is inhibited because the source is negative (it is 1.8 volts) compared to the drain (which is maintained at 5 volts from R6) and even if the impulse does not reach the SCL of the U2, the latter is logic 1. Instead, when the SCK pin-strip contact is logic zero (0 V), the MOSFET is still interdicted (because its gate is polarized with 1.8 volts) but it conducts its protection diode, since the source is a 1.8 V while the cathode is at zero, therefore the low level on SCL drags the pin 5 of the U1 to logical zero (0.6 for accuracy). The SCL channel is unidirectional, so the opposite situation does not occur, ie U2 receives the clock from the host.

 

 

Now let’s move on to the SDI, analyzing the case in which the host sends the data: when SDI is at logic zero, the Q1 protection diode leads and drags the source to 0.6 V and with it the pin 3 of the ‘U2; instead when it is at 5 volts, MOSFET and diode are interdicted, therefore SD1 of U1 is brought to 1.8V (high level) by the pull-up resistor R4. If instead the U2 sensor transmits, when it sets its pin 3 to logic zero the MOSFET Q1 leads between drain and source, because its source is at zero volts while the gate is at 1.8 V, hence its current of drain pulls the SDI of the connector to about 0 V, due to the fall on the pull-up resistor R4; instead when the pin 3 of the U2 is at high level (1.8 V) the source and the gate are equipotential and the MOSFET remains blocked, leaving it to be the pull-up resistor R3 to keep at 1 logic (but at 5 volts) the SDI line that leads to the pin strip

The two-wire bus just described can be configured to work both in I ² C-Bus mode and according to the SPI protocol: the corresponding setting is made using the jumper connected to pin-strip contact 1, which allows the connection of the CSB pin (2) to ground (operation in SPI) or to VDDIO pin (I²C-Bus mode). In our application with Arduino, we will set the I²C-Bus mode, so as to directly interface to the SCL and SDA pins of the Arduino Uno board, already set up natively.

In this kind of use we do not need the SDO line, which if we had opted for SPI communication, supported by the 2SMPB-02E in the 4-line full-duplex mode, would be the data output; in this regard it should be noted that SDO has no adapters because it is an output and in case of difference between the input levels to the microcontroller that you will use to interface to the component, you will need an adapter, which is not necessary on the breakout board. However, by setting the I²C-Bus communication mode, the SDO takes on the function of address I²C pin.

Since we are on the subject of interfaces, we complete the overview on the contacts of the 2SMPB-02E with the RST (reset, contact 1): this is active with 1 logic and in our breakout board we have foreseen the possibility of controlling it with standard TTL 0 / 5V through a voltage adapter formed by the NPN T1 transistor and the resistances R2 and R3; placing the RST of the breakout board at high level, T1 saturates and its collector drags the contact 1 of the integrated circuit to about zero volts, disabling the reset, while leaving the aforementioned pad of the board logical, and the NPN remains blocked and R2 brings contact 1 of the 2SMPB-02E to a high level, ie to the 1.8V potential provided by the U1 regulator.

 

 

As for the voltage regulator, it is a MIC5504-1.8YM5-TR from Micrel and is a three-terminal LDO available in various versions with output voltages from 1.2 to 3.3V- capable of delivering 500 mA of current, encapsulated in a SOT-23-5 container and with a voltage difference of just 0.5 volts between the IN and OUT pins; it is very stable in temperature and incorporates a short circuit protection at the output and from the excess temperature, as well as one from the inversion of polarity to the input.

The integrated can be placed in shutdown (therefore, although powered it absorbs only a few fractions of microamps) via the EN: 1 logic pin active (the same is obtained leaving the EN pin disconnected) and 0 sets in shutdown).

The voltage at the LDO regulator input must not exceed 6 volts, but in our breakout board the problem does not arise, given that it receives 5V from the pin-strip. The module can be powered between 3.3V and 5V between the VIN and GND lines as a 1.8V regulator is provided on board to obtain the correct working voltage. It follows that the power supplied on the VIN to the module must be the same as that of the logical communication levels of the processor used, for example 5V using Arduino UNO, or 3.3V if applied to Raspberry Pi.

 

Arduino’s demo

Now, let’s see how we tried the breakout board in combination with Arduino Uno, which, based on the expected sketch, will acquire the data from the Omron sensor and print them on serial, so that by starting the Arduino IDE we will be able to visualize them on the Serial Monitor.

The wiring diagram you see in these pages proposes the connection of the board to the board expansion connectors. As you can see, in both of this scheme and the photos of the prototype, we use six wires for the connection, namely:

  • two for the I²C-Bus lines, since it is enough for us to be able to carry out an essential communication in order to have the measurements to pass to the serial line; to be precise, we connect Arduino SCL to the breakout board and SDA of Arduino to SDI of the breakout board;
  • a common ground for the GND supplying of the same board;
  • an additional mass to set the breakout board SDO line fixed to logical zero, since we will operate in I²C-Bus mode and place this address pin at 0, thus setting the device address to 0;
  • one that brings the Arduino 3V3 pin to the RST input of the breakout board to disable the sensor reset.

 

 

The Omron sensor management library can be downloaded free from GitHub

In order to use the library, after downloading it, you must copy the folder contained in the .zip file into the “libraries” directory where the Arduino environment is installed. Once the library is loaded into the “libraries” directory, you can open the IDE, then from the File menu, give the Examples command the name of the sensor, which will be the example to use to manage the sensor. The example sketch is ready to use, so no changes of any kind should be made, at least if what it implements is enough for you. It is initialized the connection on the I²C-Bus with a 400 kHz clock, according to the 2SMPB-02E sensor specifications. Now you can proceed to load the example sketch into Arduino.

The example sketch initializes the serial connection and then loads the I²C-Bus library to communicate with the breakout board, then starts to interrogate the latter cyclically and listen to the corresponding data; the same sketch will send the detected temperature and pressure data to the open serial port for Arduino, therefore in order to see this data you will have to open the Arduino serial monitor with a baud-rate of 9600 bps; in this way the monitor window will show the predicted data.

 

The firmware

The library we used in the sketch was taken from the repository https://github.com/akita11/Omron2SMPB02E and greatly simplifies the code. If you wanted to write the code, it is possible and all-simple added by following the guidelines in the datasheet, but you would be have to deal with such large values ​​that they cannot be accepted by the normal Arduino variables; this is why we suggest including the dedicated library “BigNumber.h” which solves this problem. We have chosen to use the library ready for use as it is well structured, complete and therefore allows us to greatly simplify the code necessary for the implementation of the application. The example code that we propose you see in Listing 1 and allows you to acquire the values ​​from the sensor and print them on the serial line to read temperature and pressure by viewing it on a serial line every 1 second. In our example it was the I²C address of 0x70h, which is obtained at the hardware level by bringing the SDO pin to GND, if instead it was connected to 3V3 or 1V8 we would have the I²C address of 0x56h.

 

 

Components List:

R1, R2: 10 kohm

R3: 3,3 kohm

R4÷R7: 2,2 kohm

C1, C2: 100 nF ceramic

C3, C4: 1 µF ceramic

Q1: BSS138W-7-F

Q2: BSS138W-7-F

T1: BC817

U1: MIC5504-1.8YM5-TR

U2: 2SMPB-02E

 

Various:

  • Printed circuit S1413 (21×21 mm)

 

Conclusions

The project described here is the starting point for the realization of systems with specific applications, where the breakout board can be useful in the prototyping phase and can be interfaced with various kinds of microcontroller or microprocessor.

 

From openstore

FT1413M sensor pressure and temperature



jlcpcb.com



https://2019.makerfairerome.eu/en/

About Boris Landoni

Boris Landoni is the technical manager of Open-Electronics.org. Skilled in the GSM field, embraces the Open Source philosophy and its projects are available to the community.

Leave a Reply