sylaina / bme280 Goto Github PK
View Code? Open in Web Editor NEWUsing BME280 sensor from Bosch at AVR mikrocontrollers like Atmega328p
License: GNU General Public License v3.0
Using BME280 sensor from Bosch at AVR mikrocontrollers like Atmega328p
License: GNU General Public License v3.0
Hello,
I have been playing with your great bme280 and i2c library that I have incorporated to my personal arduino nano project with Atmel 328p and SGP30 sensor with LCD 2x16 char library. Congratulations for your work. Everything was working fine until I had the idea of placing the BME280 sensor inside my freezer. As soon as temperature went below zero degrees centigrade, it started to show strange values.
Finally I made it work making some changes in your code:
In file bme280.h:
Changed volatile uint32_t t_fine[SENSORS];
to
volatile int32_t t_fine[SENSORS];
And in bme.c, in fuction float bme280_readTemperature(uint8_t sensor):
I changed:
var1 = ((((adc_T>>3) - ((int32_t)_bme280_calib[sensor].dig_T1 <<1))) *
((int32_t)_bme280_calib[sensor].dig_T2)) >> 11;
var2 = (((((adc_T>>4) - ((int32_t)_bme280_calib[sensor].dig_T1)) *
((adc_T>>4) - ((int32_t)_bme280_calib[sensor].dig_T1))) >> 12) *
((int32_t)_bme280_calib[sensor].dig_T3)) >> 14;
to this, adding two type conversions to int32_t;
var1 =(int32_t) ((((adc_T>>3) - ((int32_t)_bme280_calib[sensor].dig_T1 <<1))) *
((int32_t)_bme280_calib[sensor].dig_T2)) >> 11;
var2 =(int32_t) (((((adc_T>>4) - ((int32_t)_bme280_calib[sensor].dig_T1)) *
((adc_T>>4) - ((int32_t)_bme280_calib[sensor].dig_T1))) >> 12) *
((int32_t)_bme280_calib[sensor].dig_T3)) >> 14;
Now it works fine.
I do not know how all this github think work, sorry if this is not the right way to do. Just I hope it helps.
Regards.
Ramiro
Good day. I can't read the values from the sensor. I'm using your example, the only thing I changed was the I2C address for the sensor. I2C_Error_code returns '24'. But Adafruit_BME280 necessary information from the sensor yet, but I want Arduino, pure C is better.Vedel would you do with it?
Hi!
In file bme280.h there may be a problem with line 143, because you wrote "bme280_readHumiditiy". Atmel Studio shows me a warning about this (implicit declaration of function..."
Jorge
Hi,
I try compile this project and I have the error
pls see the log
"**** Build of configuration Release for project TEST_BME ****
make all
'Building file: ../main.c'
'Invoking: AVR Compiler'
avr-gcc -Wall -Os -fpack-struct -fshort-enums -ffunction-sections -fdata-sections -std=gnu99 -funsigned-char -funsigned-bitfields -mmcu=atmega328p -DF_CPU=11059200UL -MMD -MP -MF"main.d" -MT"main.d" -c -o "main.o" "../main.c"
../main.c: In function 'main':
../main.c:14:3: error: too few arguments to function 'bme280_init'
../bme280.h:133:9: note: declared here
../main.c:16:3: error: too few arguments to function 'bme280_readTemperature'
../bme280.h:135:7: note: declared here
../main.c:17:3: error: too few arguments to function 'bme280_readPressure'
../bme280.h:136:7: note: declared here
../main.c:18:3: error: too few arguments to function 'bme280_readHumidity'
../bme280.h:137:7: note: declared here
../main.c:11:9: warning: variable 'humidity' set but not used [-Wunused-but-set-variable]
../main.c:10:9: warning: variable 'pressure' set but not used [-Wunused-but-set-variable]
../main.c:9:9: warning: variable 'temperature' set but not used [-Wunused-but-set-variable]
make: *** [main.o] Error 1
**** Build Finished ****
you can help me fix the problem?
best regards
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.