![]() |
Forum Index : Microcontroller and PC projects : Ambi-Mon display of data via HC-12
Page 1 of 2 ![]() ![]() |
|||||
Author | Message | ||||
Andrew_G Guru ![]() Joined: 18/10/2016 Location: AustraliaPosts: 871 |
Hi. There are some threads going discussing HC-12s and how to minimise power to remote sensors. I've attached some photos of an LCD backpack running my current version (Mk2) of Ambi-Mon which uses this data from remote temperature sensors (#2, 3 & 4 in the photo below). I'm more than happy to provide details if people are interested. (I must emphasise that it relies heavily on the work of Geoffg and many others on TBS). I'm awaiting delivery of some weather station sensors (wind/rain/humidity) that will form the basis of Mk3. Cheers, Andrew ![]() ![]() ![]() ![]() |
||||
Grogster![]() Admin Group ![]() Joined: 31/12/2012 Location: New ZealandPosts: 9610 |
Very nice. ![]() ![]() Smoke makes things work. When the smoke gets out, it stops! |
||||
Geoffg![]() Guru ![]() Joined: 06/06/2011 Location: AustraliaPosts: 3292 |
Yes, great job. Congratulations. I like how you put the temperature onto the clock dial. Geoff Geoff Graham - http://geoffg.net |
||||
Bizzie Senior Member ![]() Joined: 06/07/2014 Location: AustraliaPosts: 192 |
Andrew, Looks great! What sort of rain gauge are you intending to use? Regards Rob Rob White |
||||
RonnS Senior Member ![]() Joined: 16/07/2015 Location: GermanyPosts: 121 |
great work ..i like it Ron |
||||
Andrew_G Guru ![]() Joined: 18/10/2016 Location: AustraliaPosts: 871 |
Thanks folks. I'm away for the weekend and only have limited mobile coverage so I'll give you proper answers on Monday pm. Geoff - thanks, I created my own font - possibly a little too big? I'll post it when I get to my PC. Rob - it's a tipping bucket type, part of a unit that includes anemometer and vane - I'll post the URL. Delivery keeps being pushed back - it is now December. I've done a fair bit of the code to display the data and will probably use a solar panel for the outdoors unit and either HC-12 or cable to the inside display. Andrew |
||||
Bill7300 Senior Member ![]() Joined: 05/08/2014 Location: AustraliaPosts: 159 |
I have had mixed results with a tipping bucket type, mainly due to spiders. On one occasion it was teeming with rain but my Jaycar supplied weather station insisted that there was no rain. Once on the roof I soon discovered why. A large black female spider was sitting in one bucket, her weight perfectly balancing the rain water in the other bucket. It really needs some form of insect screening to keep her and her sisters out. Actually, I had a number of issues with that weather station, with its 433 MHz wireless link back to the console. Every time I keyed a 2 metre transceiver, it recorded half an inch of rain, with or without the spider. Then the anemometer stopped reading wind speed, despite the stiff breeze at the time. It is a little vertical oriented ducted-fan type arrangement that I found seized up on its shaft. Eventually the cause emerged - another species of spider, a red-orange colour this time and tiny enough to take up residence between the shaft and the housing, stopping all rotation and giving rise to the most prolonged period of windless days I had recorded up to that point. With that, I threw in the towel, departed the roof and left the arachnids to it. I am about to try again though, this time using better sensors, including some from a Dallas Semiconductor kit I accumulated years ago, before a snap decision to try the Jaycar unit as a turn-key solution. I intend to mount the new station at the windsock location on the airstrip, about 600 metres from the house and use the LoRA 915 MHz modules I have on order from China to communicate back to the house. No doubt I will get to meet still more exotic species of spider and may be some of the local ants, both of which we seem to have in every variety known to science in this part of the world. Bill |
||||
Bizzie Senior Member ![]() Joined: 06/07/2014 Location: AustraliaPosts: 192 |
Yes Andrew I can identify with all your stories. I used to be involved with the maintenance of a series of weather stations for CSIRO back in the eighties (comms by phone modem). It was always the stations which were the farthest away that gave trouble on Fridays! Rob White |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6283 |
What part of CSIRO? I worked for Div. of Tropical Crops and Pastures in Brisbane in early 70s We made a huge tipping bucket rain gauge to measure runoff from paddocks. Going to fix the stock-feeders on a Monday morning before the staff had time to clean the pens out was not my favorite task. Jim VK7JH MMedit |
||||
Bizzie Senior Member ![]() Joined: 06/07/2014 Location: AustraliaPosts: 192 |
I started with CSIRO at Griffith in the early seventies was called Div of Irrigation at the time. Rob White |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6283 |
Parallel universe. A good timer until Malcolm Frazer's 'razer gang' got me. VK7JH MMedit |
||||
Andrew_G Guru ![]() Joined: 18/10/2016 Location: AustraliaPosts: 871 |
I'm back in WWW access now. Rob, the weather station I've ordered is here. When I ordered it I was directed to Mouser (Aus) but the order was actually placed with Mouser (HK) for Au$148 incl postage. The backorder said mid September, it now shows October, but my account shows December 4th. I'm happy to be patient but beyond December I'll try for a plan B. As I said above the rain gauge is a tipping bucket type (I have to write code to count "tips"). The anemometer requires me to write code to count pulses and the vane has a number of resistors - one value for each of the 16 compass points (I'll use a lookup table approach). I'm planning to take the two sensor cables into an outdoor "box" where a MM170 will pre-process the sensor data which will then be sent to an indoor LCD backpack for display (via cable or HC-12). I take the point about spiders - I'm not sure how best to keep them out? Cheers, Andrew |
||||
Bill7300 Senior Member ![]() Joined: 05/08/2014 Location: AustraliaPosts: 159 |
The sensors on that weather station look identical to those on Jaycar's current offering of a solar powered unit Cat# XC-0358 at $189 or $150.95 with a trade card. Well, identical to 3 of the Jaycar unit's 4 sensors. I would be keen to hear any ideas about spider-proofing the tipping bucket rain gauge. Keeping them out while letting rain is a real challenge, at least to me. Bill Bill |
||||
Andrew_G Guru ![]() Joined: 18/10/2016 Location: AustraliaPosts: 871 |
A bit more information about the above pictures: Temperature - the decimal places in some temperature readings are magenta. I have a count running to show if a reading is overdue (eg all except #3 in this case). If is doesn't revert to the proper colour I go looking - eg has someone turned off that remote's power supply (eg a 5v USB pack or #4 batteries may have died, not yet . . .). If a temperature is green it is within a (customised) "normal" range, cyan = below and red = above. (ie #4 is below, the others are normal). Barometric Pressure - you can see that low pressure/cold fronts (ie bad weather for a boatie) came through one and seven and a half days ago. With the barometer dropping I'd be "alert but not alarmed". The baromter has been steady/slighly rising over the last three hours so all is well. The yellow bar near day 3 is where a reading is outside the graphed range - you tap the bottom or top of the screen to change ranges. The "Local" and "UTC" displays are obvious but I depart from Geoff's approach slightly - using his setup routines I get you to set the local standard time (Australian Eastern Standard Time in my case), and the UTC offset to that. You then set Daylight Saving Time as "On"/"Off" and this adjusts "Local" time accordingly (I doubted I had enough grunt in the MM170 to keep Geoff's automatic DST routine from his Super Clock). CORRECTION: contrary to what I said above the font used to show the temperature and digital time on the analogue clock is not one of mine but is "ArialNumFontPlus.bas" from the MMBasic distribution - sorry. Cheers, Andrew |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6283 |
Wind direction tends to be all over the place so a bit of software damping might help. Be prepared to replace the bearings every few years. Not a difficult job if the plastic hasn't gone brittle. A regular spray with a surface bug killer helps keep the spiders away. Maplin sell replacement sensors for the Fine Offset weather stations and they are the same as the one mentioned here. Unfortunately, Maplin don't do mail order outside the UK. Jim VK7JH MMedit |
||||
Andrew_G Guru ![]() Joined: 18/10/2016 Location: AustraliaPosts: 871 |
Bill, I trust you mean a Jaycar XC-0348 ?? I'm not sure if it was around when I made my purchase but it does look like it would do everything I need. Even if I want to customise the display I can keep the outdoor bits and do my own thing for the display. (some of the Jaycar sensors got bad reviews but it was probably all spider related). Cheers, Andrew |
||||
Andrew_G Guru ![]() Joined: 18/10/2016 Location: AustraliaPosts: 871 |
Jim, I hadn't seen your post before my latest. I have a very expensive set of wind gear 16.5m up my mast (Raymarine ST60) and you are right about bearings - bits of thread and cobwebs too (I've done them once - two trips up). Their greatest risk is Sulphur Crested Cockatoos - they love to chew them. The marine vanes show 360 directions/circle (and as you suggest will be s/w damped to compensate for mast movement in seas) whereas these cheap ones only show 16 - this is OK for terrestrial use though (if I can't tell the wind direction within 15 degrees I'll give up) - I am looking to see if I can use it to close blinds etc. in the new house! Cheers, Andrew |
||||
Bill7300 Senior Member ![]() Joined: 05/08/2014 Location: AustraliaPosts: 159 |
@Andrew_G Yes, sorry. Fat fingers. I meant XC-0348. As you say, one of those would give you all the sensors you are waiting on, plus the little pagoda with the barometric sensor, temp or whatever it contains, along with a little solar cell and battery too. Bill Bill |
||||
Andrew_G Guru ![]() Joined: 18/10/2016 Location: AustraliaPosts: 871 |
The Mouser gods must have read yesterday's posts - I got an email last night to say the December delayed delivery would now be October 10. I can wait that long (and Jaycar are only 1km away if I need them). Andrew |
||||
MikeO Senior Member ![]() Joined: 11/09/2011 Location: AustraliaPosts: 275 |
I use that weather station and yes it is the same one from Jaycar. Spiders are still a problem unfortunately but OK if you wash it out occasionally. Mine is at low level so its easier. I have been using this system for a couple of years and its works Ok, I use a micromite with wifi for transmission. You are welcome to use/modify the sensor code . Photos, Base Station and Weather Underground graph data ![]() ![]() Here is the code, I think/hope it is commented enough for you to pick out the sensor bits. Any questions please ask. Mike 'MMEDIT!!! Basic Version = Micromite_X_V5.3 'MMEDIT!!! Port = COM3:38400:30,150 'MMEDIT!!! Device = Micromite_X_V5.3 'MMEDIT!!! Config = 100111101121010001101001010001 'Michael Ogden Codenquilts.com.au 'April 2015 'Weather Station 'Wind and Rain sensor code adapted from Sparkfun code 'version 2.6 , changed to WiFi network using ESP8266 'v2.7 changed rain var's to Float 'v2.8 implemented Greenhouse Temp/Humidity sensors 'v3.0 Changed to new MXWifi driver 'v3.3 added aux$ auxillary data transmission (to Irrigation) 'v3.5 latest library inc ESP8266 'v3.6 use Latest library v3.63 ' add support for MMM (micromite messaging), removed Ntp supprt, removed external commands support 'Constants const node$="ESP_Weather" const serv$="ESP_Base" Const aux$="ESP_Irrigation" Const swVer="3.5" Const redLed=9 Const DHT22pin.outside=15 Const DHT22pin.greenhouse=26 Const wSpeedPin=6 Const wDirPin=7 Const WindFactor=2.4 Const TestPause=10000 Const RainPin=5 Const RainFactor=0.2794 Const ADCFactor=0.0032258 const metDay$="09:00" Const NumofMonth$="JAN,FEB,MAR,APR,MAY,JUN,JLY,AUG,SEP,OCT,NOV,DEC" ' Setup BMP085/BMP185 pressure sensors ' TassyJim 28 Oct 2014 Dim BMPData(2) ' store data from BMP085 Dim cal(11) ' calibration data dim oss = 0 ' over sampling 0 to 3 dim alt = 86 ' your altitude in metres dim BMP085calMEM = &HAA ' start of 11 calibration values dim BMP085address = &H77 ' BMP085 address dim BMP085control = &HF4 ' BMP085 control register dim BMP085temp = &H2E ' BMP085 temperature command dim BMP085pres = &H34 ' BMP085 pressure command dim BMP085reading = &HF6 ' register for results of reading dim z,p0 Dim t as float BMP085pres = BMP085pres + oss*&H40 ' adjust command for oversampling I2c Open 400, 200 ' Enable I2C. use slow speeds for long leads Pause 20 z = Calibrate() ' read the calibration data ' End Setup BMP085/BMP185 pressure sensors 'Define I/O Setpin redLed,Dout Setpin wSpeedPin, Intl,anemometerClick,Pullup Setpin RainPin, Intl,rainguageClick,Pullup Setpin wDirPin,Ain ' Array Dim wArray(10) Dim wdArray(10) ' ' Global variables ''Flag Variable defined in Library '0=err '1=timeout '2= '3= '4= '5= '7=time '8=ntp '9=busy '10= dim anem_count,anem_last,wspeed,thistimeW,secs,updateflag dim anem_min=1000 dim wgust,HGust dim rain_count dim rain_last dim wCount=1 dim wdCount=1 dim lastreading as float,wheading as float,dhtTEMP as float,dhtHUMID as float dim dhtgTEMP as float,dhtgHUMID as float dim mmrain as float,mmrainday as float dim backup Dim Initime$ dim ErrorMsg$,wholedate$ Var Restore const iDeviceID=25 'Device ID If backup = 0 Then backup=1 'Var save EndIf Init: Watchdog 8000 'interupts Settick 1000 ,T1,1 'establish seconds "Tick Timer" settick 300000,SavetoFlash,2 Print "Weather Ver: ";swver flag(8)=1 'NTP flag '*** start main program loop Main: Do Watchdog 600000 '***** mxWiFi Hook **** if userprocessflag=1 then StartTime = Timer UserProcess UserProcessFlag=0 xbsend "udp.send:|"+from$+"|"+chr$(4)+"|" Print "Processing elapsed time"; Timer-StartTime Watchdog 600000 continue do 'skip to a new loop immediately , there may be more external processing to do endif '***** End mxWiFi Hook **** If Updateflag=1 Then updateflag=0 SendDataUpdate EndIf Loop End '***** End main program loop 'Sub routines 'External command processing sub Routine if required sub extCmd a$,b$,c$,d$ print "External Commands:";from$;cmd$;cfg$;strin$ select case cmd$ case "ntp" if strin$<>"error" then wholedate$=parse$(strin$,1," ")+" "+parse$(strin$,3," ")+" "+parse$(strin$,2," ")+" "+parse$(strin$,5," ") if wholedate$<>"" then flag(7)=0 'got time reset flag flag(8)=0 'reset NTP flag time$=left$(parse$(strin$,4," "),5) print time$ print wholedate$ temp$=ucase$(parse$(strin$,2," ")) date$=parse$(strin$,3," ")+"-"+Str$(moy(temp$),2)+"-"+parse$(strin$,5," ") print date$ If IsDST()=1 Then IncTime end if end if case "Log" results(1)=parse$(strin$,9) results(2)=parse$(strin$,10) results(3)=parse$(strin$,5) case "uMsavetoflash" SavetoFlash Case "uMwritecfg" writeconfig Case "uMreadcfg" readconfig case "uMusage" usage end select end Sub Sub SavetoFlash Print "Saving to Flash" var save mmrainday,mmrain,hgust,wgust End Sub 'rainguage sensor interrupt Sub rainguageClick local thistime thistime=Timer-rain_last rain_last=Timer If thistime>10 Then rain_count=rain_count+1 'Print "Rain click" End If End Sub 'Wind speed sensor interrupt Sub anemometerClick local thistime thistime=Timer-anem_last 'thistime measures the time between pulses thistimeW=thistime anem_last=Timer If thistime>5 Then 'only process if > 5mSec, for switch debounce anem_count=anem_count+1 'Adds up pulses single pulse per/rotation If thistime<anem_min Then 'If the time is less than 1 second anem_min=thistime 'gust 'then thistime = gust End If 'Print "Wind click" 'Prints this EVERY time the reed switch closes=**TEST USE ONLY - DELETE WHEN happy its working properly 'use this to check how many switch closures per revolution when turning by hand end if 'print "Incr Anem counts:";anem_count;" This Pulse interval:";thistime;" Min Pulse interval:";anem_min End Sub 'Wind Direction data process Sub WindDirProc local wdResult as float local wdir as float local x wDir=Pin(wDirPin) 'print "Analog:";wdir select case wdir case 2.4 to 2.6 wheading=0 case 1.4 to 1.6 wheading=45.0 case .35 to .65 wheading=90.0 case .66 to .95 wheading=135.0 case .85 to 1.15 wheading=180.0 case 1.95 to 2.15 wheading=225.0 case 2.85 to 3.15 wheading=270.0 case 2.7 to 2.95 wheading=315.0 case ELSE wheading=lastreading end select For x=1 To 9 'move data up array wdArray(x)=wdArray(x+1) Next x wdArray(10)=wHeading 'place latest reading in Array For x=1 To 10 'addup all data in array wdResult=wdResult+wdArray(x) Next x wdCount=wdCount+1 If wdCount=10 Then wdCount=1 wHeading=wdResult/10 'get average the the last 10 wind dir samples lastreading=wheading End Sub 'Wind Speed data process Sub WindSpeedProc local wResult,x 'Print "Total Anem counts:";anem_count;" Last Pulse interval:";thistimew;" Min Pulse interval:";anem_min 'for testing purposes 'calc wind speed if anem_count>0 then wSpeed=(windfactor*anem_count)/(testpause/1000) else wspeed=0 end if anem_count=0 'calc Gust 'Print "Wind Count:";wcount 'Print "ActualWindSpeed:";wspeed if anem_min<1000 then wGust=(1/(anem_min/1000))*windfactor 'only if there is wind 1000=no wind else wgust=0 end if anem_min=1000 'calc wind rolling average speed '**** comment out next line if you want a Rolling Average **** 'goto skip 'comment out this line for a Rolling Average For x=1 To 9 'move data up array wArray(x)=wArray(x+1) Next x wArray(10)=wSpeed 'place latest reading in Array For x=1 To 10 'addup all data in array wResult=wResult+wArray(x) Next x wCount=wCount+1 If wCount>10 Then wCount=1 wSpeed=wResult/10 'get average the the last 10 wind samples '***** end of rolling avarage skip: If wgust>hgust Then hgust=wgust 'Print "WindSpeedArray:";wresult 'Print "AvgWindSpeed:";wspeed 'Print "Windgust:";wgust 'Print "Highest Windgust:";Hgust End Sub 'Rain sensor process Sub RainProc mmRain=mmRain + (rain_count*rainfactor) rain_count=0 'Print "Rain:";mmrain End Sub 'Outside Humidity Sensor Sub readhumidity Dht22 DHT22pin.outside, dhtTEMP, dhtHUMID ' dump stale reading 'Print Time$;" Temperature: " Str$(dhtTEMP,3,1);" Humidity: " Str$(dhtHUMID,3,1) End Sub 'Greenhouse Temp/Humidity Sensor Sub readgreenhouse Dht22 DHT22pin.greenhouse, dhtGTEMP, dhtGHUMID ' dump stale reading 'Print Time$;" Greenhouse Temperature: " Str$(dhtgTEMP,3,1);" Greenhouse Humidity: " Str$(dhtgHUMID,3,1) End Sub 'End of Sensor routines 'General Routines Sub SendDataUpdate Local a$,b$,c$,d$ a$=str$(wheading)+","+str$(wspeed)+","+str$(wgust)+","+str$(hgust)+","+str$(mmrain)+"," b$=str$(dhttemp)+","+str$(dhthumid)+","+str$(p0/100,4,1)+","+str$(dhtgtemp)+","+str$(dhtghumid) xbsend ("udp.cast:|"+serv$+":|"+node$+"|Log|10|"+a$+b$) WaitforReady 'reset flag xbsend ("udp.cast:|"+aux$+":|"+node$+"|Log|10|"+a$+b$) WaitforReady xbsend ("msg:cmd=Log&cfg=11&str="+time$+","+a$+b$+"&") End Sub 'T1 - 1second Tick interrupt Sub T1 Pulse RedLed, 200 'print todsecs(time$) secs=secs+1 'update seconds timer if secs => 86400 then '24 hrs reached secs = 0 'reset counter FLAG(8)=1 'set NTP flag EndIf if secs mod 25 = 0 Then 'every 25 secs if flag(8)=1 then print "Try to get NTP data" xbsend "time:" 'try to get NTP time data end if end If 'if secs mod 3600 = 0 then 'every 60 mins 'EndIf if secs mod 15 = 0 then 'every 15 secs 'print "Minutes/metday:";sdt("","","m");" / ";sdt("",metday$,"m") If sdt("","","m")=sdt("",metday$,"m") Then 'New Met day 09:00 print "Start of new Met Day" Hgust=0 'reset High Gust mmRainday=mmRainday+mmRain 'accumalated rain mmRain=0 'reset Rain 'SavetoFlash EndIf EndIf if secs mod 5 = 0 then ' 'print time$ windDirProc 'print " Direction:";wheading end if if secs mod 10 = 0 then windSpeedProc end if if secs mod 30 = 0 then rainProc readhumidity readgreenhouse BMP085read updateflag=1 end if End Sub 'BMP085/BMP185 pressure sensors routines ' TassyJim 28 Oct 2014 Sub BMP085read local p t=temperature() p=pressure(oss) p0=Psl(p,alt) 'Print Time$;" T(BMP085):";Str$(t,3,1);" P(sl):";Str$(p0/100,5,1) End Sub Function Calibrate() ' needs to be called once for each module. ' safest to do it on every program start. Local n, calMEM calMEM= BMP085calMEM For n = 1 To 11 I2c Write BMP085address, 0, 1, calMEM ' first calibration location Pause 1 I2c Read BMP085address, 0, 2, BMPData(0) 'print BMPData(1), BMPData(0)*256 + BMPData(1) cal(n) = BMPData(0)*256 + BMPData(1) If n < 4 Or n > 6 Then ' need to convert some to signed numbers If cal(n) > 32767 Then cal(n) = cal(n) - 65536 Endif Endif 'print n,cal(n) Pause 1 calMEM=calMEM+2 ' advance to the next calibration location Next n End Function Function temperature() ' returns the temperature in degrees C to one decimal place Local UT, x1, x2, b5 I2c Write BMP085address, 0, 2, BMP085control, BMP085temp Pause 5 I2c Write BMP085address, 0, 1, BMP085reading I2c Read BMP085address, 0, 2, BMPData(0) UT = BMPData(0)*256 + BMPData(1) 'calculate true temperature x1= Int( (UT-cal(6))*cal(5)/32768) x2=Int( cal(10)*2048/(x1+cal(11))) b5=x1+x2 temperature = Int((b5+8)/16)/10 End Function Function pressure(oss) ' returns the pressure in pascals. Divide by 100 for millibars ' recalculates the temperatre. ' time could be saved by reading the temperature once evry 10 minutes ' when taking readings at short intervals Local UT, UP, x1, x2, x3, b5, b6, b7, pres, p,b3,b4 pres = BMP085pres + oss*&H40 I2c Write BMP085address, 0, 2, BMP085control, BMP085temp Pause 5 I2c Write BMP085address, 0, 1, BMP085reading I2c Read BMP085address, 0, 2, BMPData(0) UT = BMPData(0)*256 + BMPData(1) I2c Write BMP085address, 0, 2, BMP085control, pres If oss = 0 Then ' different oversampling requires different Pause 5 ' reading times Elseif oss = 1 Then Pause 8 Elseif oss = 2 Then Pause 14 Else Pause 26 Endif I2c Write BMP085address, 0, 1, BMP085reading I2c Read BMP085address, 0, 2, BMPData(0) UP = BMPData(0)*256 + BMPData(1) I2c Write BMP085address, 0, 1, BMP085reading+2 I2c Read BMP085address, 0, 1, BMPData(0) UP=(UP*256+BMPData(0))/2^(8-oss) 'calculate true temperature x1= Int( (UT-cal(6))*cal(5)/32768) x2=Int( cal(10)*2048/(x1+cal(11))) b5=x1+x2 t=Int((b5+8)/16)/10 'print "Temperature: ",t 'calculate true atmospheric pressure b6 = b5 - 4000 x1 = Int((cal(8)*(b6*b6/4096))/2048) x2 = Int(cal(2)*b6/2048) x3 = x1 + x2 b3 = Int(((cal(1)*4+x3)*2^oss +2)/4) x1 = Int(cal(3)*b6/8192) x2 = Int((cal(7)*(b6*b6/4096))/65536) x3 = Int(((x1+x2)+2)/4) b4 = Int(cal(4)*x3/32768+cal(4)) b7 = Int((UP - b3)*(50000/2^oss)) p = Int((b7*2)/b4) x1 = Int(Int(p/256)*Int(p/256)) x1 = Int((x1*3038)/65536) x2 = Int((-7357*p)/65536) pressure = Int(p+(x1 + x2 + 3791)/16) End Function Function Psl(p, alt) 'given local pressure and altitude, returns pressure at sea level Psl= p/(1-alt/44330)^5.255 End Function Function myAlt(p, p0) ' given local pressure (p) and pressure at sea level (p0) ' returns altitude in metres myAlt = 44330*(1-(p/p0)^0.1903) End Function 'BMP085/BMP185 pressure sensors routines End ' TassyJim 28 Oct 2014 Codenquilts |
||||
Page 1 of 2 ![]() ![]() |
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |