Vertical position recording

Hi there. I'm currently working on a smartphone app that can record the vertical position of my phone. More specifically, I will leave my smartphone inside an elevator for a day and I'd like to see at the end of the day all the elevator calls that have occurred. To understand from which floor the elevator has been called, I think I could use my phone’s accelerometer and gyroscope. Also, my phone doesn't have a barometer and the altitude sensor is not precise enough (constantly changing without moving the phone). However:

  1. I'm not able to erase the gravity force from the z acceleration sensed by my phone. To distinguish where the elevator is going I need to see the variation (positive for up, negative for down) of the acceleration only when the call arrives. Here is the code I used:

  1. My phone crashes when I try to create and write on a file.

Immagine 2023-03-28 005316

Is there any extension that could help me? Do you know if there is any solution for my academic project? Thanks a lot.

Welcome Freddy

The following might help you

  • Here is a link where a seismograph app was created. Parts of the Project might be useful to you. Plotting a line graph using canvas - #2 by SteveJG The app might help you monitor both x, y and z acceleration. Delete z if you must.

  • App Inventor apps cannot run in the background (without an extension). You either need to code a StayAwake routine to prevent the app from sleeping (heavy battery usage) or figure out how to use something like [FREE] Background Tasks: Itoo and get your code to work with the extension.

  • you could record data using a TinyDB because your phone might not provide a Web link in that faraday cage.

Good luck with your Project.