Jump to content

Component: Barometer (BME280) (Environmental): Difference between revisions

From Flowcode Help
m Text replacement - "width="10%" align="center" style="background-color:#D8C9D8;" align="center"" to "width="10%" align="center" class="mtx-class-macrohead""
m Text replacement - "style="background-color:#EAE1EA;"" to "class="mtx-class-propfolder""
 
(3 intermediate revisions by the same user not shown)
Line 99: Line 99:
|-
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Forced_Read'''
| width="90%" class="mtx-class-macrohead" | '''Forced_Read'''
|-
|-
| colspan="2" |  
| colspan="2" |  
Line 113: Line 113:
|-
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''I2C_Read_Register'''
| width="90%" class="mtx-class-macrohead" | '''I2C_Read_Register'''
|-
|-
| colspan="2" | Reads a byte value from a register on the device 
| colspan="2" | Reads a byte value from a register on the device 
Line 132: Line 132:
|-
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''I2C_Write_Register'''
| width="90%" class="mtx-class-macrohead" | '''I2C_Write_Register'''
|-
|-
| colspan="2" | Writes a byte value to a register on the device 
| colspan="2" | Writes a byte value to a register on the device 
Line 156: Line 156:
|-
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Initialise'''
| width="90%" class="mtx-class-macrohead" | '''Initialise'''
|-
|-
| colspan="2" | Starts up the I2C bus and initialises the pressure sensor ready for use. Returns 1 for a sucessful startup. Returns 0 for a failed startup or no device detected. 
| colspan="2" | Starts up the I2C bus and initialises the pressure sensor ready for use. Returns 1 for a sucessful startup. Returns 0 for a failed startup or no device detected. 
Line 170: Line 170:
|-
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReadHumidityFloat'''
| width="90%" class="mtx-class-macrohead" | '''ReadHumidityFloat'''
|-
|-
| colspan="2" | Reads the humidity as a floating point value in percentage 0-100%. Calls the ReadHumidityRaw function and then converts to a meaningful value. 
| colspan="2" | Reads the humidity as a floating point value in percentage 0-100%. Calls the ReadHumidityRaw function and then converts to a meaningful value. 
Line 184: Line 184:
|-
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReadPressureFloat'''
| width="90%" class="mtx-class-macrohead" | '''ReadPressureFloat'''
|-
|-
| colspan="2" | Reads the pressure as a floating point value in Bars. Calls the ReadPressureRaw function and then converts to a meaningful value. 
| colspan="2" | Reads the pressure as a floating point value in Bars. Calls the ReadPressureRaw function and then converts to a meaningful value. 
Line 198: Line 198:
|-
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReadTemperatureFloat'''
| width="90%" class="mtx-class-macrohead" | '''ReadTemperatureFloat'''
|-
|-
| colspan="2" | Reads the temperature as a floating point value in °C. Resultion sets the return bit value and conversion time. Calls the ReadTemperatureRaw function and then converts to a meaningful value. 
| colspan="2" | Reads the temperature as a floating point value in °C. Resultion sets the return bit value and conversion time. Calls the ReadTemperatureRaw function and then converts to a meaningful value. 
Line 212: Line 212:
|-
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Reset'''
| width="90%" class="mtx-class-macrohead" | '''Reset'''
|-
|-
| colspan="2" | Resets the device 
| colspan="2" | Resets the device 
Line 226: Line 226:
|-
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Uninit'''
| width="90%" class="mtx-class-macrohead" | '''Uninit'''
|-
|-
| colspan="2" | Uninitialse and release I2C resources 
| colspan="2" | Uninitialse and release I2C resources 
Line 240: Line 240:
{| class="mtx-class-macrotable wikitable"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-prop-icon.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''  
| width="90%" class="mtx-class-macrohead" | '''Properties'''  
|-
|-
|-
|-
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]]
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Connections
| width="90%" class="mtx-class-propfolder" | Connections
|-
|-
|-
|-
Line 283: Line 283:
| colspan="2" | Pin used for SCL (clock signal) 
| colspan="2" | Pin used for SCL (clock signal) 
|-
|-
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]]
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Sensor Options
| width="90%" class="mtx-class-propfolder" | Sensor Options
|-
|-
|-
|-
Line 322: Line 322:
| colspan="2" |  
| colspan="2" |  
|-
|-
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]]
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Simulation
| width="90%" class="mtx-class-propfolder" | Simulation
|-
|-
|-
|-

Latest revision as of 14:36, 13 July 2026

Author Matrix TSL
Version 1.3
Category Environmental


Barometer (BME280) component

A small PCB surface mount barometric pressure sensor with a I2C bus interface. Pressure range 300 to 1100 hPa. Temperature range -40 to +85 °C. Works with I2C interface only.

Detailed description

No detailed description exists yet for this component

Examples

BME280 Barometer plus Altitude v1.0 This example reads and displays the pressure, temperature & humidity. If the pressure is increasing then Rise will be displayed.

Alternatively if the pressure is falling, then Fall will be displayed.

The altitude displayed is calculated based on the current pressure reading.

What makes the altitude useful is the ability to tare it, then after going up or downstairs for example the feet & meters are displayed.

Note since the altitude is calculated based on pressure, then if the sensor is left at the same height, the height displayed can be different each day.

Circuit Diagram






Macro reference

Forced_Read

Forced_Read
 
- VOID Return


I2C_Read_Register

I2C_Read_Register
Reads a byte value from a register on the device 
- BYTE Address
 
- BYTE Return


I2C_Write_Register

I2C_Write_Register
Writes a byte value to a register on the device 
- BYTE Address
 
- BYTE Value
 
- VOID Return


Initialise

Initialise
Starts up the I2C bus and initialises the pressure sensor ready for use. Returns 1 for a sucessful startup. Returns 0 for a failed startup or no device detected. 
- BYTE Return


ReadHumidityFloat

ReadHumidityFloat
Reads the humidity as a floating point value in percentage 0-100%. Calls the ReadHumidityRaw function and then converts to a meaningful value. 
- FLOAT Return


ReadPressureFloat

ReadPressureFloat
Reads the pressure as a floating point value in Bars. Calls the ReadPressureRaw function and then converts to a meaningful value. 
- FLOAT Return


ReadTemperatureFloat

ReadTemperatureFloat
Reads the temperature as a floating point value in °C. Resultion sets the return bit value and conversion time. Calls the ReadTemperatureRaw function and then converts to a meaningful value. 
- FLOAT Return


Reset

Reset
Resets the device 
- VOID Return


Uninit

Uninit
Uninitialse and release I2C resources 
- VOID Return


Property reference

Properties
Connections
Slave Address
 
Channel
Channel selection 
Baud Select
Baud rate option selector 
Baud Rate
Baud rate to be used 
Stop Delay
On older microcontroller devices there is a potential for the I2C hardware channel to lock up if there is not a 10ms delay between an I2C stop event and the next I2C start event. Most modern microcontrollers will not have a problem so this property can be disabled to speed up the I2C communications.  
SDA
Pin used for SDA (data signal) 
SCL
Pin used for SCL (clock signal) 
Sensor Options
Compensation
Compensation formulas in double precision floating point or 32 bit fixed point 
Humidity Oversampling
 
Pressure Oversampling
 
Temperature Oversampling
 
Mode
 
Standby Normal Mode (ms)
 
Filter Coefficient
 
Simulation
Simulate Comms
Allows the simulation data to come from the panel GUI or relayed via an injector component. 

Component Source Code

Please click here to download the component source project: FC_Comp_Source_Pressure_Sensor_BME280.fcfx

Please click here to view the component source code (Beta): FC_Comp_Source_Pressure_Sensor_BME280.fcfx