En este post presento el desarrollo de una APP para teléfono ANDROIDE con la que podremos leer, en tiempo real, los valores de presión medidos por nuestro barómetro ARDUINO ( http://blog.e-ao.org/#post3 ) y realizar su corrección para reducirlos al nivel del mar. Así podremos comparar nuestros datos con otras medidas y con los mapas de isóbaras que los servicios meteorológicos del mundo entero publican.
Para este desarrollo hemos empleado BASIC! y su compilador BASIC! Compiler que son dos aplicaciones gratuitas para ANDROIDE que se pueden bajar desde PLAY STORE (figure1).
Figura 1. Aplicaciones ANDROIDE usadas
El programa fuente que se presenta al final de este post está constituido por 5 bloques:
1- INICIALIZACION DE VARIABLES Y ENTRADA DE DATOS
2- CONEXION CON EL BT Y LECTURA DE SUS DATOS
3- LECTURA DE LA HORA, DIA Y MES DEL TELEFONO MOVIL Y SE ESCRIBE EN PANTALLA
4-COMIENZA EL CÁLCULO DE LA CORRECCIÓN DE LA PRESIÓN EN 10 NIVELES HASTA LLEGAR A Z=0 MEDIANTE UN BUCLE FOR MEDIANTE LA FORMULA:
P(Z2)=P(Z1)*EXP((Z1-Z2)/H) donde H=Tmedia*(R/(Mm*9.8))
5- SE ESCRIBE LA PRESION MEDIDA Y SE ESCRIBE LA PSL (PRESION REDUCIDA AL NIVEL DEL MAR)
La programación de esos bloques se ha basado en los ejemplos que lleva incluidos BASIC!
Para generar la APK correspondiente se ha usado BASIC! Compiler. Tanto el programa fuente como la APK los podéis bajar de las siguientes direcciones:
http://e-ao.org/Apuntes/BT-BMP.apk
http://e-ao.org/Apuntes/BT-BMP.bas
En la figura siguiente (figura 2) se presenta una copia de algunas de las pantallas de la aplicación androide generada.
Figura 2. Pantallas que aparecen al principio y al final del uso de la APP BT-BMP
! ************************************************
! PROGRAMA DE LECTURA Y CORRECION DE LOS DATOS DEL BAROMETRO ARDUINO
! BT-BMP.BAS
!****************************************
!********************************************************
! INICIALIZACION DE VARIABLES Y ENTRADA DE DATOS
!********************************************************
DIM P[11]
DIM Z[11]
DIM T[11]
INPUT ” SU ALTURA (m) ES? “,ALT$, “100”
INPUT ” SU TEMPERATURA (°C)ES? “, TEMP$, “20”
DIM m$[12]
m$[1] = “Enero”
m$[2] = “Febrero”
m$[3] = “Marzo”
m$[4] = “Abril”
m$[5] = “Mayo”
m$[6] = “Junio”
m$[7] = “Julio”
m$[8] = “Agosto”
m$[9] = “Septiembre”
m$[10] = “Octubre”
m$[11] = “Noviembre”
m$[12] = “Diciembre”
ARRAY.LOAD d$[], “Domingo”,”Lunes”,”Martes”,”Miercoles”,”Jueves”,”Viernes”,”Sabado”
!*************************************************
! CONEXION CON EL BT Y LECTURA DE SUS DATOS
!**************************************************
BT.OPEN
BT.CONNECT
PAUSE 5000
ln = 0
DO
BT.STATUS s
IF s = 1
ln = ln + 1
PRINT “Listening”, ln
ELSEIF s =2
PRINT “Connecting”
ELSEIF s = 3
PRINT “Connected”
ENDIF
PAUSE 1000
UNTIL s = 3
CLS
BT.DEVICE.NAME device$
DO
BT.READ.READY rr
IF rr
BT.READ.BYTES rmsg$
ENDIF
UNTIL rr = 0
!********************************************
! rmsg$ contiene los datos enviados por el BT
!*********************************************
!**************************************************************
! SE LEE LA HORA, DIA Y MES DEL TELEFONO MOVIL Y SE ESCRIBE EN PANTALLA
!***************************************************
TIME Year$, Month$, Day$, Hour$, Minute$, Second$, WeekDay, isDST
TIMEZONE.GET tz$
PRINT “Hoy es: “; d$[WeekDay]
PRINT
PRINT m$[VAL(Month$)]; ” “; Day$; “, “; Year$
PRINT “”
AMPM$ = ” AM”
Hour = VAL(Hour$)
IF Hour = 0 THEN
Hour = 12
ELSEIF Hour >= 12 THEN
AMPM$ = ” PM”
IF Hour > 12 THEN Hour = Hour – 12
ENDIF
PRINT “La hora es:”
PRINT FORMAT$(“##”,Hour); “:”; Minute$
PRE$=RIGHT$(rmsg$,7)
PRES$=STR$(Val(PRE$)/10)
!***********************************
! COMIENZA EL CALCULO DE LA CORRECION DE LA PRESION MEDIANTE LA FORMULA
! P(Z2)=P(Z1)*EXP((Z1-Z2)/H)
! H=T(media de la columna de aire)*(R/(Mm*9.8))
! EN 10 NIVELES HASTA LLEGAR A Z=0 MEDIANTE UN BUCLE FOR
!********************************************************
P[1]= val(PRES$)
Z[1]= val(ALT$)
T[1]= val(TEMP$)
IALT= Z[1]/10
R=8.314
Mm=28.96*0.001
FOR N=2 TO 11
Z[N]=Z[N-1]-IALT
T[N]=T[N-1]+((IALT/100)*0.78)
Tm=(0.5*(T[N]+T[N-1]))+273.159
H=Tm*(R/(9.8*Mm))
P[N]=P[N-1]*EXP((IALT)/H)
PSL=P[N]
NEXT N
frac=PSL -INT (PSL)
frac=val(left$(str$(frac),3))
PSL= int(PSL)+frac
! **********************
! SE ESCRIBE LA PRESION MEDIDA Y
! SE ESCRIBE LA PSL (PRESION REDUCIDA AL NIVEL DEL MAR)
!*********************************************************************
Print
Print “PRESION MEDIDA (hPa)”
PRINT PRES$
PRINT
PRINT “PRESION REDUCIDA (hPa)”
PRINT PSL
PRINT
BT.DISCONNECT
BT.CLOSE
END
Your point of view caught my eye and was very interesting. Thanks. I have a question for you. https://accounts.binance.com/cs/register-person?ref=RQUR4BEO
Thanks for sharing. I read many of your blog posts, cool, your blog is very good. https://www.binance.com/vi/register?ref=GJY4VW8W
Thanks for sharing. I read many of your blog posts, cool, your blog is very good. https://accounts.binance.com/lv/register?ref=UM6SMJM3
Your article helped me a lot, is there any more related content? Thanks! https://accounts.binance.com/id/register?ref=GJY4VW8W
Can you be more specific about the content of your article? After reading it, I still have some doubts. Hope you can help me. https://www.binance.com/zh-CN/register?ref=V2H9AFPY
This article opened my eyes, I can feel your mood, your thoughts, it seems very wonderful. I hope to see more articles like this. thanks for sharing.
I may need your help. I tried many ways but couldn’t solve it, but after reading your article, I think you have a way to help me. I’m looking forward for your reply. Thanks.
Thank you for your sharing. I am worried that I lack creative ideas. It is your article that makes me full of hope. Thank you. But, I have a question, can you help me? https://accounts.binance.com/en/register-person?ref=IJFGOAID
At the beginning, I was still puzzled. Since I read your article, I have been very impressed. It has provided a lot of innovative ideas for my thesis related to gate.io. Thank u. But I still have some doubts, can you help me? Thanks.
I don’t think the title of your article matches the content lol. Just kidding, mainly because I had some doubts after reading the article.