On this page
Contains all programs to be consistently run on the raspi. Please check the Raspi setup section on how they should be set up.
Subpackages
- wind_bearer_software.parameter package
- wind_bearer_software.sensor_func package
- Submodules
- wind_bearer_software.sensor_func.ads1115_voltage_V2 module
- wind_bearer_software.sensor_func.as5600 module
- wind_bearer_software.sensor_func.bmp388 module
- wind_bearer_software.sensor_func.rain_gauge module
- wind_bearer_software.sensor_func.sht45 module
- wind_bearer_software.sensor_func.sht45_heater module
- wind_bearer_software.sensor_func.sunlight_detect module
- wind_bearer_software.sensor_func.wind_speed module
- wind_bearer_software.utils package
Submodules
wind_bearer_software.cellular_init_V2 module
Contains a script, which is by default run every 15 minutes, to check the connection to the internet and solve possible problems if no connection could be established.
- Authors:
Min Tai Yap
- wind_bearer_software.cellular_init_V2.check_internet()[source]
Checks if the device has a connection to the internet by pinging 8.8.8.8.
- Returns:
True if the ping was successful, False otherwise
- wind_bearer_software.cellular_init_V2.check_ttyUSB()[source]
Checks if the Waveshare module is connected to the USB port corresponding to /dev/ttyUSB2 and that a connection through the USB port can be established. Therefore, it is assumed that the Waveshare module is connected to the right USB port. If the module is either not connected or a connection cannot be established with the module, the Raspi is rebooted.
- wind_bearer_software.cellular_init_V2.main()[source]
Checks connectivity to the internet. Our default configuration runs this script every 15 minutes. If the raspi is not connected to the internet, this script first checks if the communication with the Waveshare module is possible. If that is the case, the script tries to restart the connecting to the internet. If this step also fails, the internet connection via the mobile network is turned off until this script is run the next time.
- wind_bearer_software.cellular_init_V2.run_command(command)[source]
Runs a shell command.
- Parameters:
command – Command as string
- Returns:
A tuple containing responses in stdout and stderr, as well as the resulting CompletedProcess object as a whole
wind_bearer_software.mr_V6 module
Contains the main script to set up and run the weather station. To set up the weather station, the parameters and paths need to be specified in parameter/parameters.txt and parameter/user_path.txt. Please refer to <TODO> for further information.
- Authors:
Min Tai Yap <Min.Yap2@monash.edu>
- async wind_bearer_software.mr_V6.main()[source]
Sets up and runs the program to collect data from the weather station. The data from the anemometer and the rain gauge have to be read continuously. All other measurements are read after the interval specified in parameter/parameters.txt has passed. Please note that the sunlight sensor readings have not been validated, yet. Subsequently, the data is written to the latest csv file specified in the parameter/userpath.txt file. Each hour, a new csv file is created.
wind_bearer_software.rebooter module
Short python script to reboot the raspi. Should be executed every midnight to clear any possible memory leaks.
wind_bearer_software.remote_transfer_V1 module
Script to send the collected data to a remote server.
- Authors:
Min Tai Yap
- wind_bearer_software.remote_transfer_V1.get_failed_transfers(log_file)[source]
Fetches the file path of all the failed transmissions in the daily log file.
- Parameters:
log_file – Path to the daily log file
- Returns:
A list of all failed transmissions noted in the daily log file
- wind_bearer_software.remote_transfer_V1.log_failed_transfer(file_name, log_file)[source]
Logs the path of a file whose transmission failed in a log file. Ensures that each file is only mentioned once in the log file and creates a new log file if it doesn’t exist yet.
- Parameters:
file_name – Path to the file whose transmission failed
log_file – Path to the daily log file
- wind_bearer_software.remote_transfer_V1.main()[source]
Sends the collected data to the remote server specified in parameter/remote_details.txt using the SCP protocol. It is assumed that this script is always called at the beginning of a new hour, and it transmits the csv assumed to be created exactly one hour ago. Furthermore, it is necessary that all parameters in the JSON files in the parameter directory are correctly set. Failed transmissions are logged in a daily log file. If the transmission of the data collected during the previous hour was successful, this script will also try to resend any unsent files logged in the daily log file.
- wind_bearer_software.remote_transfer_V1.remove_file_from_log(filename, log_file)[source]
Removes a successfully sent file from the log file.
- Parameters:
filename – Path to the file which was successfully resent
log_file – Path to the log file
- wind_bearer_software.remote_transfer_V1.scp_file(local_path, remote_path, server, ssh_key, user, log_file)[source]
Sends the file at local_path to the server with a prescpecified IPv4 address using the SCP protocol. If the transmission failed, the file path will be noted in the daily log fail. Upon successful transmission, it will try to resend each of the files in the daily log file. If this fails, it will leave the file in the log file.
- Parameters:
local_path – File to be transmitted
remote_path – Path to the directory on the remote server where the transmitted file should be saved
server – IPv4 address of the remote server
ssh_key – Path to where the private SSH key is stored on the raspi
user – Name of the user on the remote server
log_file – Path to the daily log file
- Returns:
True upon successful transmission of all files, otherwise False
wind_bearer_software.usb_checker module
Contains script that tries to ensure that all USB connections are writable. By our configuration, the script is run every 15 minutes.
- Authors:
Min Tai Yap
- wind_bearer_software.usb_checker.get_fs_type(device)[source]
Get the filesystem type of the device.
- Parameters:
device – Device
- Returns:
Filesystem type of the device
- wind_bearer_software.usb_checker.get_usb_mounts()[source]
Detect mounted removable devices (like USBs).
- Returns:
List of all removable mounted devices
- wind_bearer_software.usb_checker.is_writable(mountpoint)[source]
Tests if a mount point is writable.
- Parameters:
mountpoint – Path to the mount point
- Returns:
Boolean value whether the mount point is writable
- wind_bearer_software.usb_checker.main()[source]
Checks if all mounted removable devices are writable. If that is not the case, the script first tries to remount it. If the device is still not writable, it tries to remount all NTFS devices with NTFS-3G. If it is still not writable or if the filesystem of the device is not NTFS, it tries to run fsck on the device and remount it.
- wind_bearer_software.usb_checker.remount_ntfs_rw(device, mountpoint)[source]
Try remounting NTFS with NTFS-3G.
- Parameters:
device – Device
mountpoint – Mountpount of the device
- Returns:
Boolean value whether remounting with NTFS-3G was succesful
- wind_bearer_software.usb_checker.remount_writable(mountpoint)[source]
Try to remount as read-write.
- Parameters:
mountpoint – Path to the moint point
- Returns:
Boolean value whether the device with given mount point can be remounted
- wind_bearer_software.usb_checker.run_fsck(device)[source]
Run filesystem check and repair.
- Parameters:
device – Device
- Returns:
Boolean value whether fsck was successful
wind_bearer_software.voltage_reader module
Script to record the battery voltage in a separate csv file. In contrast to the main runner, this script records data every 10 minutes. It also is ensured that the script only runs once on a single machine. In our configuration, this script is tried to be started every 5 minutes to restart it in case of any crash
- Authors:
Min Tai Yap
- wind_bearer_software.voltage_reader.main()[source]
Records the battery voltage every 10 minutes at the paths specified in parameter/user_path.txt.
wind_bearer_software.wb_app_V2 module
Creates a small app to read the current sensor measurements from the weather station. The app can, for example, be executed within a remote Desktop session.
- Authors:
Min Tai Yap
- async wind_bearer_software.wb_app_V2.async_button_click_event()[source]
Reads all sensor measurements when the button is clicked.
- wind_bearer_software.wb_app_V2.on_button_click()[source]
