Skip to content

biospi/PiLogger

Repository files navigation

PiLogger

Turn your Raspberry Pi into a datalogger.
Credit:https://github.com/pimoroni/weatherhat-python
Credit:https://learn.pimoroni.com/article/getting-started-with-weather-hat

How To Use

RaspberryPi OS and SSH access over Wi-Fi

Create a Raspberry Pi Image on your external SD card with Raspberry Pi Imager (https://www.raspberrypi.com/software/)

  • Select RASPBERRY PI OS(32-BIT)
    In the setting panel:
  • Enable SSH
  • Set usrname and password
  • Configure wifi:
    SSID: eduroam
    password: "your password"

Click Write to flash the sd card. When finished pop it in the PiLogger.

Setup Eduroam for internet acess

Connect a monitor to your PiLogger and plug in power source.

After following the instruction you should have access to the internet from your Pilogger.

Connect to Eduroam on boot automatically

To tell the Raspberry Pi to automatically connect to your WiFi network you need to edit a file called: wpa_supplicant.conf.

To open the file in nano type the following command:

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

Scroll to the end of the file and add the following to the file to configure your network:

network={
   ssid="eduroam"
   psk="SecretPassWord"
}

Remember to replace this with your own network name and password. Save and close the file by pressing Ctrl+X followed by Y. At this point the Raspberry Pi should automatically connect to your network.

Connect to RaspberryPi and install software

With any pc connected to eduroam ou can now connect to the PiLogger via ssh with Putty for example with the login details you setup in the first step.
or you can also just continue the installation on the PiLogger GUI with a monitor by opening a new terminal window.
*Note: SSH may not be possible over eduroam

  1. Run to enable the Raspberry Pi I2C and SPI interfaces.
sudo raspi-config nonint do_i2c 0
sudo raspi-config nonint do_spi 0
  1. Run to install dev libraries
sudo apt-get install libatlas-base-dev
  1. Clone the repository.
git clone https://github.com/biospi/PiLogger.git
cd PiLogger
chmod +x install.sh
sudo ./install.sh --unstable
  1. Create python virtual environment
python3 -m venv venv
  1. Activate the environment
source venv/bin/activate
  1. Install dependencies
make environment
  1. Test with
python examples/basic.py

Setup Launcher to start app on boot

Give the launcher script permissions with:

chmod +x /home/$USER/PiLogger/launcher.sh

Type in:

crontab -e

This will bring up a crontab window. Select editor and add at the bottom:
Replace fo18103 with the username you set up in step 1 (RaspberryPi OS and SSH access over Wi-Fi)

@reboot sleep 10; /home/fo18103/PiLogger/launcher.sh >> /home/fo18103/PiLogger/cronlog.txt 2>&1

Will execute main.py script on boot. Type in to check that the cron job is active:

crontab -l

try it with:

sudo reboot

TODO

  • Deep sleep mode in between record
  • Data download via SSH or other(manually, email. onedrive, cloud upload....)

Note that there are no real deep sleep mode on the Raspberry Pi 4
One option when running on battery is to use a timer one off switch on the power supply.

https://raspberrypi.stackexchange.com/questions/23720/how-can-i-put-raspberrypi-to-shut-down-and-wake-up-later https://www.youtube.com/watch?v=05o5QOZkpwg

Other options such as RPi Pico or ESP32 microcontroller have much better battery life because they natively implement power saving modes

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published