I ordered one, I'll have to start searching for info.
If you look at rosettacode site, it shows the same program in many languages. All the basic versions look different. Qbasic,freebasic,bbc basic. Trying to convert one to gcb would need work.Some use procedures and have floating point.
It seems a complex device to implement. Graphic lcds are complex to set up but easy to actually use when there's an include.
Using trig in gcb needs a bit of thought without decimal point. You see code with pi in it.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
"page 1 full" - Fount that putting the temperature calc in a sub must have made some room. when it compiles less than half of the program memory is used. Break up the program so a big piece don't jut over the cliff.
Worked out the pressure calculations on paper and using the windows calculator in science and programming modes.(32.64inhg 110538) doesn't come out to the local barometric press (29.73inhg 100600)? i have to do it again. probably a paranthesus some where. put enough of the important calc for pressure in the program and it comes out close to the calculated value. makes sense because i wrote it and probably made same mistakes.
i am at about 280 meters altitude.
Temperature is working good, I put the sensor next the the DHT22 and they are within tenths F.
Thanks to the wonder of antibiotics I'm feeling well enough to start thinking again. I've just printed out Mikes Code and explanation so I can get a better understanding.
Stan, I just had a look at the BME you ordered, looks like the one with 3.3v regulator on board.
I don't think it has voltage leveling on the SDA/SDL lines. I bought 2 and the one I was using (without leveler) died, an identical one I sent to Anobium seems to still be working. If I bought another one I would connect it via a 5-3.3v leveler. You can either buy one (very cheap) or make your own with either a couple of low current tranistors or Mosfets. You have 3.3v on the BME pcb so the circuit will be quite simple, a couple of resistors and a transistor/mosfet per channel. This is the circuit I used. http://www.hobbytronics.co.uk/mosfet-voltage-level-converter
The transistor version needs an extra resistor/channel.
You could also check if the BME pcb does actually change levels. 5v on the SDA/SDL input to the pcb should show as 3.3v at the BME chip, but it is rather small so finding a TP might be tricky.
Last edit: David Thompson 2017-10-24
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
There's light at the end of the funnel! Almost recovered.
I tried 3 and 4 wire SPI with my 6 pin SPI version, both worked with GCB. If you look at the back of the datasheet it only needs a couple of resistors/capacitors to make it SPI or I2C. You could configure the I2C as a 3 wire SPI if you had the need.
The £1 BMEs I ordered have arrived, they are on a pcb and at first glace seem to have an inline limiting resistor for each signal line. I'll check exactly what they do before I try to use them. My plan is to make the circuitry on the mother pcb, then I can have SPI or I2C as required, or even both on a test board.
Stan the levelers you have are likely the same as the ones I made but smaller. 1 x Mosfet and a couple of resistors/channel.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I pounded through all the equations by putting them into EXCEL. see attached
Excel certainly has much math capability. The raw adc and the parameters are listed and can be changed. Click on the numbers and you can see the equations.
If you don't have excel you can open in Open Office Calc, actually that is what I used.
Pressure is still off ~2 inHg according to local weather.
Temperature is good
My bmp280 arrived. I got the level shifter working and a 3V supply and glcd works. What a mess!. https://www.youtube.com/watch?v=xIHixIjYVOU use a 3v pic or uno easier
Using a uno I want to use hw12cfinder but it's pic. How do I define scl and sda using uno 328p? What ports are they? I want to check it's there.. i2c just works, I don't really know how.
; ----- Define Hardware settings for HWI2C2
' Define I2C settings - CHANGE PORTS if required for your specific device.
#define HI2C2_BAUD_RATE 100
#define HI2C2_DATA PORTB.5
#define HI2C2_CLOCK PORTB.7
ps how do I post photos without a web page? youtube was ott.
Last edit: stan cartwright 2017-10-25
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
stan,
looks like on the 328p the i2c is on different pins from the mosi miso of spi
portc.4 is sda
portc.5 is scl
what is your reason for choosing atmega 328p?
larger memories - yes
libraries for bmp280 - yes in arduino
signed large variables - yes in arduino
signed long variables - no in GCB
br
mike
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
No special reason for 328p, I just like the uno board for £4 and I can print to terminal through usb. I could put a 328p in a zif socket and not use uno bootloader. I'm not sure how to use in circuit programming like I use with pic...actually I use a 18f25k22 for pic as it's capable for many things.
A uno board has sockets marked scl sda and from use I remember they're a4 and a5 also. doh.
I'll see if I can get hwi2c finder working to see if it's seen.
I have trouble using right hand this year. It's carpal tunnel syndrome my doc reckons. I thought that was something to do with eyes :) Fiddly wiring with left hand :(
The trouble of no signed long vars could be done with a function/sub surely but it wouldn't be much use for converting c long vars unless you know c long vars and how they're written with rotate and boolean stuff.
I like gcb and don't want my money back :)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Progress report
The BMP280 is writng down values and I am recording local pressure to see if they follow.
Calibration chart can be made if data looks reasonable. Note the adc_P value moves inversely to the Pressure.
The temperature is agreeing with the DHT22's on my little RS422 network.
10/23/17 10pm local
adc_P 407232 calcPress 108329 31.98inHg webPress 29.76inHg
adc_T 515575 calcTemP 22.73 72.9 F
10/24/17 6am local
adc_P 408976 calcPress 108114 31.92inHg webPress 29.60inHg
adc_T 515207 calcTemP 22.63 72.7 F
10/24/17 8pm local
adc_P 405040 calcPress 108764 32.12inHg webPress 29.83inHg
adc_T 515351 calcTemP 23.66 74.6 F
10/24/17 11pm local
adc_P 404976 calcPress 108675 32.09inHg webPress 29.84inHg
adc_T 515703 calcTemP 23.77 74.8 F
10/25/17 7am local
adc_P 404568 calcPress 109336 32.29inHg webPress 29.81inHg
adc_T 512976 calcTemP 22.94 72.7 F
Put in a zero cal value....Press = Press/var1 -8294
10/26/17 7am local
adc_P 405232 calcPress 101235 29.89inHg webPress 29.80inHg
adc_T 512455 calcTemP 22.77 73.07 F
10/26/17 4pm local
adc_P 409376 calcPress 99972 29.52inHg webPress 29.59inHg
adc_T 514407 calcTemP 23.37 74.13 F
10/23/17 9pm local
adc_P 408752 calcPress 100127 29.57inHg webPress 29.55inHg
adc_T 514327 calcTemP 23.34 74.06 F
Pollingling is every 5 sec. Note the adc values roam around a lot. attached screen shot of term. The oversampling is set at 001. Haven't tried a higher oversampling.
Stan,
A lot of things are working.
1) the adc_P and adc_T are being read. That means you have the right BMP280.h file and I2C is working
2) t_fine looks reasonable, your temperature is higher than mine, is it about what you judge to be correct temperature?
3) 4294836225 is the highest number that a "long" can be. Are we bumping against the top?
Next step would be for you to "uncomment" the HSerprints in the CalcPress subroutine, then.
Unplug the 328p board and plug back in to reboot it, all the calibration factors will be printed to the terminal, and then stop it after the first calc is complete. Now your screen is full of all the calculation info , screen print it and we can run that through the excel sheet and see where it is messing up. Send me the screenprint with all the info.
BR
Mike
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi I see you've all been busy!
Mike,
Thank you very much for your input and especially the spreadsheet. I was able to find some very elusive mistakes. I don't know if you spotted it but ALL of the pressure and temperature data needs shifting right. The DS shows bits 19:12, 11:4 & 3:0 in "Description" Reading the DS is good !!!!
Useg Right shift, FNLSR after ADC_T, ADC_T_H and ADC_T_U had been given their data.
ADC_T = FNLSR (ADC_T,4) shifts all 20 bits
Finally it's amazing what a difference a * makes instead of a / but could I see it!
I'm now working at a comfortable 23.04C degrees
I'll tidy up my code and post an SPI version for Temp. Then I'll try and catch up with what you are going with pressure.
Just had a look at Stan's BMP280 code and there is an ADC_P/16 so it has been spotted. I must say I don't care for byte 0 being called ADC_P and the whole word also, I'm never sure if I've done what I hoped. Pity it couldn't be ADC_P_L for byte one.
Last edit: David Thompson 2017-10-27
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Mike etal. Interesting device. I suppose I like it warm. My finger temp on device seemed normal to a deg. yeah, vague. It was not my intention to use this device but for £2. My engineering mate who won't retire might find a use. I'm applying a glcd to show results, portable.
Nice how a uno can serprint to gcb terminal with usb lead. No rs232 ttl to usb as with pic. Why I use 328p..the board and bootloader.
I haven't used a spread sheet since frameworks...the 1986 dos version in OU course :)
It would be good if google search bmp280 basic showed gcb.
best I found was proton basic which looked hackable to gcb as for reading device bytes.
Nice Anobium sorted an include for the complicated stuff.
"Unplug the 328p board and plug back in to reboot it, all the calibration factors will be printed to the terminal, and then stop it after the first calc is complete. Now your screen is full of all the calculation info , screen print it and we can run that through the excel sheet and see where it is messing up. Send me the screenprint with all the info.
BR"......how? didn't happen.
Last edit: stan cartwright 2017-10-27
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I haven't used debug and searched gcb help but nothing.
I just had a quick browse for bmp280 and various code but didn't get as far as the conversion just reading the bytes read. Proton basic example looked easiest for checking sign.
I converted your code to ili9341 glcd
Is pressure inches Hg? I'll have to check what numbers mean.
Nice one Mike. ((1048576 - adc_P)-208 )31252......I think this where c code works in that the former would be done with shift and maybe and mask to byte etc. If you can think in binary then no mult or divide. Unfortunately I don't :)
I saw raw pressure to altitude in my searches somewhere. I don't really know what to use this for yet. I put a sink plunger over the sensor on a table and the pressure change showed. groovy
ps I changed calcpress in glcd version and in hg looks more realistic.
Just checked and blew on sensor and in Hg=31.70
waited 20s and in Hg=12682.04
re post it's 31.79 now, 2 minutes later
oh, and sunlight on the sensor changes temp above surrounding (ambient?) temp
blowing on device is increase in pressure,yes?..calibration starts at sea level..dunno...increase in pressure is below sea level? negative?..NOOO!
I think there's an overflow somewhere at around 32.06 in Hg if relevent. I get 12682.04 then back to 31.xx etc. Hardware needs refresh/clear? dunno, sorry
Last edit: stan cartwright 2017-10-28
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Stan,
Yes, I am feeling like I am drowning in work on this chip!
I have been away today and haven't had a chance to review with a fresh mind. The problem is the temperature correction and thusly the first "var1" of the pressure calc. It flips sign at 64000. I do not know the significance of 64,000 nor the ins and outs of all the calculations but I am sure they are linearizing the Pressure detector.
Did you load the new CalcPress sub? and it is still doing it?
Good news is that the new BME280's arrived and they are smaller but fully loaded with voltage reg and voltage translators. eager to try but I have several chores to do first, Daughter and family are arriving later this evening.
73
M
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Folks
I'm back in action again. Since Mike is into Pressure and I don't have a need for it, I've started on Humidity. The equation on Git hub is noticeably different to the one in the DS. Because it is much simplified I tried that 1st. It didn't work.
I'll set up the DS version in a Spreadsheet and see how I get on, it's much easier to juggle figures that way.
I've also converted the temperature part into Oshonsoft (I said I'd do that on the Oshonsoft Forum). Took me quite some time because it highlighted numerous bugs and features that just didn't work or didn't work as expected. The problem with SW implimentations is, you don't know how the author did it. Although GCB (and I sure all compilers) has a few quirks, I'm completly sold on GCB. I always thought it was a waste using SW when a device had HD on board.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I remember you being concerned about two's complement. It took this long for it to dawn on me that the correction factors could be signed. You can read things but they just don't register.
"Each compensation word is a 16-bit signed
or unsigned integer value stored in two’s complement"
For GCB this would be called an integer because we can do signed math with integers and they are +- 32000 which is held in two bytes. Not all compensation parmeter are signed though, watchout!
My new BME280 were really off in temperature and dig_T3 was 59954 which actually is -5581. Straightened that temperature calc right out. It is within a 0.1F.
Now to fix the pressure!
73
Mike
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I ordered one, I'll have to start searching for info.
If you look at rosettacode site, it shows the same program in many languages. All the basic versions look different. Qbasic,freebasic,bbc basic. Trying to convert one to gcb would need work.Some use procedures and have floating point.
It seems a complex device to implement. Graphic lcds are complex to set up but easy to actually use when there's an include.
Using trig in gcb needs a bit of thought without decimal point. You see code with pi in it.
David T,
I hope you are feeling better.
"page 1 full" - Fount that putting the temperature calc in a sub must have made some room. when it compiles less than half of the program memory is used. Break up the program so a big piece don't jut over the cliff.
Worked out the pressure calculations on paper and using the windows calculator in science and programming modes.(32.64inhg 110538) doesn't come out to the local barometric press (29.73inhg 100600)? i have to do it again. probably a paranthesus some where. put enough of the important calc for pressure in the program and it comes out close to the calculated value. makes sense because i wrote it and probably made same mistakes.
i am at about 280 meters altitude.
Temperature is working good, I put the sensor next the the DHT22 and they are within tenths F.
Here is current file and picture of terminal.
BR
Mike
Thanks to the wonder of antibiotics I'm feeling well enough to start thinking again. I've just printed out Mikes Code and explanation so I can get a better understanding.
Stan, I just had a look at the BME you ordered, looks like the one with 3.3v regulator on board.
I don't think it has voltage leveling on the SDA/SDL lines. I bought 2 and the one I was using (without leveler) died, an identical one I sent to Anobium seems to still be working. If I bought another one I would connect it via a 5-3.3v leveler. You can either buy one (very cheap) or make your own with either a couple of low current tranistors or Mosfets. You have 3.3v on the BME pcb so the circuit will be quite simple, a couple of resistors and a transistor/mosfet per channel. This is the circuit I used.
http://www.hobbytronics.co.uk/mosfet-voltage-level-converter
The transistor version needs an extra resistor/channel.
You could also check if the BME pcb does actually change levels. 5v on the SDA/SDL input to the pcb should show as 3.3v at the BME chip, but it is rather small so finding a TP might be tricky.
Last edit: David Thompson 2017-10-24
David - I have a few http://www.ebay.co.uk/itm/Bi-Directional-Level-Shifter-Logic-Level-Converter-8-Channel-8CH-for-Arduino-/401226146688 but not tried them.
I have 2 spi glcds that use 3.3v logic. One on a pic uses 2.7K in series to lines and 5.6K to ground which works and is simple, the other on a uno uses a 4050 non inverting inverter chip run off 3.3V.
The sensor might arrive tomorrow. I'm trying to get this to work with gcb. so know what fun to expect :)
https://www.ebay.co.uk/i/202040606864?chn=ps&dispItem=1&adgroupid=46622246639&rlsatarget=pla-369907356142&abcId=1128946&adtype=pla&merchantid=7126724&poi=&googleloc=1007416&device=c&campaignid=857250873&crdt=0
Stan,
The BME280 I have on order now have a voltage regulator and voltage translators on. Looks like it is only I2C because it is 4 terminal.
Please start a new thread for the time of flight.
BR
Mike
There's light at the end of the funnel! Almost recovered.
I tried 3 and 4 wire SPI with my 6 pin SPI version, both worked with GCB. If you look at the back of the datasheet it only needs a couple of resistors/capacitors to make it SPI or I2C. You could configure the I2C as a 3 wire SPI if you had the need.
The £1 BMEs I ordered have arrived, they are on a pcb and at first glace seem to have an inline limiting resistor for each signal line. I'll check exactly what they do before I try to use them. My plan is to make the circuitry on the mother pcb, then I can have SPI or I2C as required, or even both on a test board.
Stan the levelers you have are likely the same as the ones I made but smaller. 1 x Mosfet and a couple of resistors/channel.
I pounded through all the equations by putting them into EXCEL. see attached
Excel certainly has much math capability. The raw adc and the parameters are listed and can be changed. Click on the numbers and you can see the equations.
If you don't have excel you can open in Open Office Calc, actually that is what I used.
Pressure is still off ~2 inHg according to local weather.
Temperature is good
My bmp280 arrived. I got the level shifter working and a 3V supply and glcd works. What a mess!. https://www.youtube.com/watch?v=xIHixIjYVOU use a 3v pic or uno easier
Using a uno I want to use hw12cfinder but it's pic. How do I define scl and sda using uno 328p? What ports are they? I want to check it's there.. i2c just works, I don't really know how.
ps how do I post photos without a web page? youtube was ott.
Last edit: stan cartwright 2017-10-25
stan,
looks like on the 328p the i2c is on different pins from the mosi miso of spi
portc.4 is sda
portc.5 is scl
what is your reason for choosing atmega 328p?
larger memories - yes
libraries for bmp280 - yes in arduino
signed large variables - yes in arduino
signed long variables - no in GCB
br
mike
No special reason for 328p, I just like the uno board for £4 and I can print to terminal through usb. I could put a 328p in a zif socket and not use uno bootloader. I'm not sure how to use in circuit programming like I use with pic...actually I use a 18f25k22 for pic as it's capable for many things.
A uno board has sockets marked scl sda and from use I remember they're a4 and a5 also. doh.
I'll see if I can get hwi2c finder working to see if it's seen.
I have trouble using right hand this year. It's carpal tunnel syndrome my doc reckons. I thought that was something to do with eyes :) Fiddly wiring with left hand :(
The trouble of no signed long vars could be done with a function/sub surely but it wouldn't be much use for converting c long vars unless you know c long vars and how they're written with rotate and boolean stuff.
I like gcb and don't want my money back :)
oops..there's a 328p i2c finder in demos by theoL My laser range finder don't show
Hardware I2C MEGA328P
End Search
wiring error..now get
Hardware I2C MEGA328P
ID: 0x52 Unknown_Device
ID: 0x53 Unknown_Device
End Search
nice
now with bmp280 I get
Hardware I2C MEGA328P
ID: 0xEC Unknown_Device
ID: 0xED Unknown_Device
End Search
so it's working?
Last edit: stan cartwright 2017-10-26
Progress report
The BMP280 is writng down values and I am recording local pressure to see if they follow.
Calibration chart can be made if data looks reasonable. Note the adc_P value moves inversely to the Pressure.
The temperature is agreeing with the DHT22's on my little RS422 network.
10/23/17 10pm local
adc_P 407232 calcPress 108329 31.98inHg webPress 29.76inHg
adc_T 515575 calcTemP 22.73 72.9 F
10/24/17 6am local
adc_P 408976 calcPress 108114 31.92inHg webPress 29.60inHg
adc_T 515207 calcTemP 22.63 72.7 F
10/24/17 8pm local
adc_P 405040 calcPress 108764 32.12inHg webPress 29.83inHg
adc_T 515351 calcTemP 23.66 74.6 F
10/24/17 11pm local
adc_P 404976 calcPress 108675 32.09inHg webPress 29.84inHg
adc_T 515703 calcTemP 23.77 74.8 F
10/25/17 7am local
adc_P 404568 calcPress 109336 32.29inHg webPress 29.81inHg
adc_T 512976 calcTemP 22.94 72.7 F
Put in a zero cal value....Press = Press/var1 -8294
10/26/17 7am local
adc_P 405232 calcPress 101235 29.89inHg webPress 29.80inHg
adc_T 512455 calcTemP 22.77 73.07 F
10/26/17 4pm local
adc_P 409376 calcPress 99972 29.52inHg webPress 29.59inHg
adc_T 514407 calcTemP 23.37 74.13 F
10/23/17 9pm local
adc_P 408752 calcPress 100127 29.57inHg webPress 29.55inHg
adc_T 514327 calcTemP 23.34 74.06 F
Pollingling is every 5 sec. Note the adc values roam around a lot. attached screen shot of term. The oversampling is set at 001. Haven't tried a higher oversampling.
That is all.
Last edit: mmotte 2017-10-27
I changed your code to uno and tried in gcb terminal and got as in attatched jpg.
Also attatched 328p code.
Last edit: stan cartwright 2017-10-27
Stan,
A lot of things are working.
1) the adc_P and adc_T are being read. That means you have the right BMP280.h file and I2C is working
2) t_fine looks reasonable, your temperature is higher than mine, is it about what you judge to be correct temperature?
3) 4294836225 is the highest number that a "long" can be. Are we bumping against the top?
Next step would be for you to "uncomment" the HSerprints in the CalcPress subroutine, then.
Unplug the 328p board and plug back in to reboot it, all the calibration factors will be printed to the terminal, and then stop it after the first calc is complete. Now your screen is full of all the calculation info , screen print it and we can run that through the excel sheet and see where it is messing up. Send me the screenprint with all the info.
BR
Mike
Hi I see you've all been busy!
Mike,
Thank you very much for your input and especially the spreadsheet. I was able to find some very elusive mistakes. I don't know if you spotted it but ALL of the pressure and temperature data needs shifting right. The DS shows bits 19:12, 11:4 & 3:0 in "Description" Reading the DS is good !!!!
Useg Right shift, FNLSR after ADC_T, ADC_T_H and ADC_T_U had been given their data.
ADC_T = FNLSR (ADC_T,4) shifts all 20 bits
Finally it's amazing what a difference a * makes instead of a / but could I see it!
I'm now working at a comfortable 23.04C degrees
I'll tidy up my code and post an SPI version for Temp. Then I'll try and catch up with what you are going with pressure.
Just had a look at Stan's BMP280 code and there is an ADC_P/16 so it has been spotted. I must say I don't care for byte 0 being called ADC_P and the whole word also, I'm never sure if I've done what I hoped. Pity it couldn't be ADC_P_L for byte one.
Last edit: David Thompson 2017-10-27
Mike etal. Interesting device. I suppose I like it warm. My finger temp on device seemed normal to a deg. yeah, vague. It was not my intention to use this device but for £2. My engineering mate who won't retire might find a use. I'm applying a glcd to show results, portable.
Nice how a uno can serprint to gcb terminal with usb lead. No rs232 ttl to usb as with pic. Why I use 328p..the board and bootloader.
I haven't used a spread sheet since frameworks...the 1986 dos version in OU course :)
It would be good if google search bmp280 basic showed gcb.
best I found was proton basic which looked hackable to gcb as for reading device bytes.
Nice Anobium sorted an include for the complicated stuff.
"Unplug the 328p board and plug back in to reboot it, all the calibration factors will be printed to the terminal, and then stop it after the first calc is complete. Now your screen is full of all the calculation info , screen print it and we can run that through the excel sheet and see where it is messing up. Send me the screenprint with all the info.
BR"......how? didn't happen.
Last edit: stan cartwright 2017-10-27
First uncomment the HSerPrints in the CalcPress sub
Then because you already have this statement.
All the parameters will be output to HSerPrint when it goes through initialization of the BMP280 in the BMP280.h file.
So do a restart, does the uno have a reset button? i think so.
Here is my screenprint of all that stuff.
Wow! it is happening to me now! I will look and see what is going on.
BR
mike
Last edit: mmotte 2017-10-28
I found the problem. The sign changed in the first var1 calculation of the Calc Pressure.
The 4294966619 was really a minus number.
Of course this filters down in the calculations. I'll see if it can be patched.
Here again we need signed long variables.
I haven't used debug and searched gcb help but nothing.
I just had a quick browse for bmp280 and various code but didn't get as far as the conversion just reading the bytes read. Proton basic example looked easiest for checking sign.
I converted your code to ili9341 glcd
Is pressure inches Hg? I'll have to check what numbers mean.
Last edit: stan cartwright 2017-10-28
Stan,
What a pretty picture! thumbs up.
This isn't the solution but a temporary patch.
Replace the CalcPress sub
73
Mike
Nice one Mike. ((1048576 - adc_P)-208 )31252......I think this where c code works in that the former would be done with shift and maybe and mask to byte etc. If you can think in binary then no mult or divide. Unfortunately I don't :)
I saw raw pressure to altitude in my searches somewhere. I don't really know what to use this for yet. I put a sink plunger over the sensor on a table and the pressure change showed. groovy
ps I changed calcpress in glcd version and in hg looks more realistic.
Just checked and blew on sensor and in Hg=31.70
waited 20s and in Hg=12682.04
re post it's 31.79 now, 2 minutes later
oh, and sunlight on the sensor changes temp above surrounding (ambient?) temp
blowing on device is increase in pressure,yes?..calibration starts at sea level..dunno...increase in pressure is below sea level? negative?..NOOO!
I think there's an overflow somewhere at around 32.06 in Hg if relevent. I get 12682.04 then back to 31.xx etc. Hardware needs refresh/clear? dunno, sorry
Last edit: stan cartwright 2017-10-28
looked up https://www.sensorsone.com/altitude-pressure-units-conversion/ and at 32.42 in Hg ...I'm 2000 feet below sea level...
Stan,
Yes, I am feeling like I am drowning in work on this chip!
I have been away today and haven't had a chance to review with a fresh mind. The problem is the temperature correction and thusly the first "var1" of the pressure calc. It flips sign at 64000. I do not know the significance of 64,000 nor the ins and outs of all the calculations but I am sure they are linearizing the Pressure detector.
Did you load the new CalcPress sub? and it is still doing it?
Good news is that the new BME280's arrived and they are smaller but fully loaded with voltage reg and voltage translators. eager to try but I have several chores to do first, Daughter and family are arriving later this evening.
73
M
Hi Folks
I'm back in action again. Since Mike is into Pressure and I don't have a need for it, I've started on Humidity. The equation on Git hub is noticeably different to the one in the DS. Because it is much simplified I tried that 1st. It didn't work.
I'll set up the DS version in a Spreadsheet and see how I get on, it's much easier to juggle figures that way.
I've also converted the temperature part into Oshonsoft (I said I'd do that on the Oshonsoft Forum). Took me quite some time because it highlighted numerous bugs and features that just didn't work or didn't work as expected. The problem with SW implimentations is, you don't know how the author did it. Although GCB (and I sure all compilers) has a few quirks, I'm completly sold on GCB. I always thought it was a waste using SW when a device had HD on board.
David T,
I remember you being concerned about two's complement. It took this long for it to dawn on me that the correction factors could be signed. You can read things but they just don't register.
"Each compensation word is a 16-bit signed
or unsigned integer value stored in two’s complement"
For GCB this would be called an integer because we can do signed math with integers and they are +- 32000 which is held in two bytes. Not all compensation parmeter are signed though, watchout!
My new BME280 were really off in temperature and dig_T3 was 59954 which actually is -5581. Straightened that temperature calc right out. It is within a 0.1F.
Now to fix the pressure!
73
Mike