AMI-system / ami_setup

AMI configuration files
MIT License
1 stars 2 forks source link

Features for cellular connectivity #12

Open JonasBchrt opened 6 months ago

JonasBchrt commented 6 months ago

Please put desired functionality for the cellular-enabled Ami-System here.

Data currently send: ✅ Time ✅ Location ✅ Bluetooth enabled/disabled ✅ Camera configuration ✅ Camera connected true/false ✅ Free memory ✅ Last picture timestamp ✅ Picture count ✅ SSD connected true/false ✅ Timezone ✅ Temperature

Additional data to send: 🔲 Camera ID 🔲 Size of most recent picture 🔲 How many picture sizes below threshold (@albags what's a good threshold?) 🔲 Picture count in last 24 h 🔲 (Serial number?) 🔲 (WittyPi battery charge?) 🔲 Motion configuration 🔲 WittyPi configuration 🔲 Acoustic parameters 🔲 Start up & shut down time from WittyPi

Desired schedule for sending data: 🔲 Once at start-up (afterStartup.sh) and once at shut-down (beforeShutdown.sh)

Data currently received: ✅ Execute shell script ✅ Reboot ✅ Shutdown ✅ Configure camera ✅ Enable/disable Bluetooth ✅ Update time & timezone

Additional data to receive: 🔲 Motion configuration 🔲 WittyPi configuration 🔲 Acoustics configuration

Desired schedule for receiving data: 🔲 Once at start-up (afterStartup.sh)

JonasBchrt commented 6 months ago

Additional data sent since commit 6604c28: ✅ Size of most recent picture ✅ How many picture sizes below 200 KB threshold in last 24 h ✅ Picture count in last 24 h

JonasBchrt commented 6 months ago

Additional data sent since commit 69216e85651b8d38dd8a71c54d74bda8fc7a6f76: ✅ Camera ID

JonasBchrt commented 6 months ago

Since commit 36550f7cf9c67d64b73573f01e03505b0d904a4f, scripts can be scheduled by WittyPi in the desired way:

That allows to: ✅ Send data once at start-up and once at shut-down. ✅ Receive data once at start-up.

AugustT commented 6 months ago

We should also have:

JonasBchrt commented 5 months ago

Additional functionality since commit 03ae54d: ✅ Set real-time clock of WittyPi. @abhimandela

JonasBchrt commented 5 months ago

Additional data to send: 🔲WittyPi schedule: /home/pi/wittypi/schedule.wpi

JonasBchrt commented 5 months ago

Not working anymore since commit cd87fbcfd789f8fff1446f2b041abcdcdac33354 (Alba's code for scheduling and recording files for AgZero+ season 2024): 🔲Last picture timestamp 🔲Picture count 🔲Size of most recent picture 🔲How many picture sizes below threshold 🔲Picture count in last 24 h 🔲Sending and receiving data regularly

JonasBchrt commented 5 months ago

Additional functionality since commit 1d29feca5df5e12296fa4b1063e7ef564d236e95: ✅ Firmware updates over-the-air.

JonasBchrt commented 5 months ago

Additional functionality since commit 1cbfab726ab53b1eb5ba5225c4f6f61c29f0f278: ✅ Sending and receiving data regularly (every 6 h right now). Need to call sudo python3 /home/pi/ami-trap-raspi-cellular/ami-trap-raspi-cellular.py in afterStartup.sh.

JonasBchrt commented 5 months ago

Additional functionality since commit b268ac4c7edda894f6ada2b9d64ba0b7a9ae9d66: ✅ Sending WittyPi schedule from /home/pi/wittypi/schedule.wpi in every status update. @abhimandela

JonasBchrt commented 5 months ago

Re-stored functionality since commit e3d626fc4e51a4bba0f5971062b9d96387f50c2b: ✅Last picture timestamp ✅Picture count ✅Size of most recent picture ✅How many picture sizes below threshold ✅Picture count in last 24 h Note: due to the new file structure, getting these values can be quite slow if the SSD is fairly full (up to almost 1 min). So, leave enough time between starting to collect this information and shutting down the pi.

AugustT commented 5 months ago

@JonasBchrt Can you be more specific on the time requirements?

JonasBchrt commented 5 months ago

With a completely full SSD, this can be anywhere from a couple of seconds to almost 1 min (depending on the number of sub-folders) using the current Python implementation.

JonasBchrt commented 5 months ago

Additional functionality since f7a1f3055cb2c170dd6c225ff4f36bdb8a2ebc39: ✅ Write camera configuration not only to setCamera.sh, but also to config.json.

JonasBchrt commented 5 months ago

Additional data sent since commit c8ae0181986e75b649503d757a1b55f88ac7658d: ✅ Count of audio files ✅ Last audio file timestamp ✅ Last audio file size ✅ Count of audio files in last 24 h ✅ Count of audio files below 200 KB in last 24 h ✅ Count of ultrasonic files ✅ Last ultrasonic file timestamp ✅ Last ultrasonic file size ✅ Count of ultrasonic files in last 24 h ✅ Count of ultrasonic files below 200 KB in last 24 h

JonasBchrt commented 4 months ago

@abhimandela (or someone else) can I get your input on these points (not urgent): ❓ How to programmatically check if the the microphone is connected (without breaking anything, even if the mic is recording at the same time). ❓ What is a good file size threshold to detect an audio file that is definitely crap? (The current 200 KB are random.) ❓ What is a good file size threshold to detect an ultrasonic file that is definitely crap? (The current 200 KB are random.)

abhimandela commented 4 months ago

"arecord -L" command give you the output as attached, grep for AudioMoth USB Microphone and see if it appears under hw and plughw parts of the output (these are the two options we use for birds and bats). It will be also nice to check the sampling rate returned with these options

Unlike the camera, if there is no microphone connected then there are no acoustic files are created because the script returns an error (maybe check 0 KB? Also, we can use the standard sizes of Birds(48KHz x 1 min) and Bats (192KHz x 1 min) approximately , but that may make it complicated as sampling rate and duration may vary, better to just check if there are non 0 KB files / 0 KB files for error case

JonasBchrt commented 4 months ago

Additional data to send: ⚪ Sampling rate birds ⚪ Sampling rate bats

abhimandela commented 4 months ago

Attached is the screenshot of microphone scanning command output, if this helps to understand parsing requirements Skype_Picture_2024_05_07T13_37_45_962Z

JonasBchrt commented 4 months ago

Modified data sent since a5a97b74b30ff07dfcf30763cdc0cedce6478c36: ✅ Count of audio files below 1 KB in last 24 h (threshold lowered)

Additional data sent since https://github.com/AMI-system/ami_setup/commit/43ab1b6e192c1dfe802286cff78b0da84a00c446: ✅ Microphone connected (AudioMoth USB Microphone) ✅ Sample rate birds ✅ Sample rate bats ✅ Count of ultrasonic files (fixed) ✅ Last ultrasonic file timestamp (fixed) ✅ Last ultrasonic file size (fixed) ✅ Count of ultrasonic files in last 24 h (fixed) ✅ Count of ultrasonic files below 1 KB in last 24 h (threshold lowered & fixed)

JonasBchrt commented 4 months ago

Re-stored functionality since 0354b3aa2a6b5dbf46a4184e0006ccff50389114: ✅ Free memory in /home/pi/PiImages

JonasBchrt commented 4 months ago

Additional feature: 🔲Interface with cellular via Bluetooth app