background image

www.joy

-

it.net

 

Pascalstr. 8 47506 Neukirchen

-

Vluyn

 

 

 

3. Code example

 

Now test your BMP280 with the following sample code.

 

First you create a file with :

 

sudo nano bmp280.py

 

An empty window will now open in which you can enter the following 

sample code.

 

import

 

board

 

import 

busio

 

import 

adafruit_bmp280

 

 

# Create sensor as an object depending on I2C

 

i2c = busio.I2C(board.SCL, board.SDA)

 

sensor = adafruit_bmp280.Adafruit_BMP280_I2C(i2c)

 

 

# This value must be changed to the current air pressure at your location

 

# Otherwise inaccuracies will occur

 

# Weather services can give you information

 

# 1013.25 hPa is the average air pressure at the sea level

 

sensor.sea_level_pressure = 

1013.25

 

 

# Output of the measured values

 

print

(

"\nTemperatur: %0.1f *C" 

% sensor.temperature)

 

print

(

"Luftdruck: %0.1f hPa" 

% sensor.pressure)

 

print

(

"Höhe: %0.2f m" 

% sensor.altitude)

 

Save the code example with the key  combination 

CTRL + O 

and confirm 

with 

Enter

. Exit the editor with 

CTRL + X

.

 

 

You run this program with the following command:

 

sudo python3 bmp280.py

 

3.  USAGE WITH  THE ARDUINO

 

1. Connection 

 

Arduino

 

KY052

 

5V

 

VCC, SDO, CSB

 

GND 

 

GND

 

A4

 

SCL

 

A5

 

SDA

 

Summary of Contents for SEN-KY052

Page 1: ...SURE SENSOR SEN KY052 1 GENERAL INFORMATION Dear customer Thank you very much for choosing our product In the following we will show you what has to be observed during commissioning and use Should you encounter any unexpected problems during use please feel free to contact us ...

Page 2: ...ND pin 6 GND SCL pin 5 SCL SDA pin 3 SDA 1 Connection sudo apt get install git Now you can download the required library for the sensor with the following command git clone https github com adafruit Adafruit_CircuitPython_BMP280 git Now run this command to install the library sudo pip3 install adafruit circuitpython bmp280 You also need this additional library git clone https github com adafruit A...

Page 3: ...3 install adafruit circuitpython lis3dh Then choose P5 I2C Now confirm the question with YES and I2C is activated Now you must restart your Raspberry Pi with this command sudo reboot Now open the configuration of the Raspberry Pi and activate I2C as follows sudo raspi config Now select 5 Interfacing Options ...

Page 4: ...be changed to the current air pressure at your location Otherwise inaccuracies will occur Weather services can give you information 1013 25 hPa is the average air pressure at the sea level sensor sea_level_pressure 1013 25 Output of the measured values print nTemperatur 0 1f C sensor temperature print Luftdruck 0 1f hPa sensor pressure print Höhe 0 2f m sensor altitude Save the code example with t...

Page 5: ... pins are required to interface Adafruit invests time and resources providing this open source code please support Adafruit and open source hardware by purchasing products from Adafruit Written by Limor Fried Kevin Townsend for Adafruit Industries BSD license all text above must be included in any redistribution include Wire h include SPI h include Adafruit_BMP280 h define BMP_SCK 13 define BMP_MI...

Page 6: ...atteries which are not enclosed by the device Return Options As the end user you can hand over your old appliance which has essentially the same functions as the new one bought with us free of charge for disposal with the purchase of a new device Small devices which do not have outer dimensions bigger than 25 cm can be handed in for disposal independently of the purchase of a new product in normal...

Page 7: ...e we are available by email telephone and ticket support system to answer these Email service joy it net Ticket system http support joy it net Telephone 49 0 2845 98469 66 10 17 o clock For further information visit our website www joy it net Published 18 02 2020 www joy it net SIMAC Electronics GmbH Pascalstr 8 47506 Neukirchen Vluyn ...

Reviews: