Skip to content

Repository with my Final Degree Project in Computer Engineering, presented during the 22/23 academic year at the University of A Coruña (UDC)

License

Notifications You must be signed in to change notification settings

daniboube/freedsm-tfg-fic-udc

Repository files navigation

FreeDSM Firmware for Raspberry Pi

Licence Official Website

The FreeDSM photometer is an open hardware and open software solution for citizen light pollution monitoring based on IoT technologies. It has been created under the idea of being a low-cost (around 20-30 euros), easy-to-build and easy-to-use device, so everyone with minimum knowledge about soldering or electronics can make their own. In this repository you will find the source code necessary to make the different sensors work when connected to a Raspberry Pi Zero. It should be noted that this is an early prototype, and not a finished version, since only the work presented as my Final Degree Project in Computer Engineering is included here. Below is a list of the components needed to build it.

Table of contents

Requirements

Software

Hardware

Component Description Units Online link Documentation
Raspberry PI Zero W Raspberry PI computer model Zero Wireless (Wifi and Bluetooth communication) 1 Link Link
TSL2591 Optical light I2C sensor 1 Link Link
AHT10 Temperature and Humidity I2C sensor 1 Link
MPU6050 Gyroscope and acelerometer I2C sensor 1 Link Link
GPS Neo6mV2 GPS module with anthena 1 Link Link
Lenses 60 degrees PMMA lenses to put on top of the light sensor, ensuring that most of the photons are caught by the photodiodes in extremely low light conditions 1 Link
Screws M.2 screws x6mm tall 14 Link
Jumping wires Female-Female jumping wires (short) 20 Link
SD Card at least 32 GB SD Card 1 Link
SD Card reader USB reader for SD Cards 1 Link

Software setup

Flash device

Connect the card reader with the micro SD to the computer and open the Raspberry Pi Imager tool. Select the following settings:

  • Operating System: Raspberry Pi OS Lite (32-bit)
  • Storage: The SD Card connected to the computer

Before flashing your device, click on the gear icon to access advanced options. Use the following configuration:

  • Set hostname: No
  • Enable SSH: Yes
    • Use password authentication
  • Set username and password: Yes
    • Username: pi
    • Password: raspfreedsm
  • Configure wireless LAN: Yes
    • SSID: (your domestic Wifi ssid)
    • Password: (your domestic Wifi password)
    • Wireless LAN country: (your country code)
  • Set locale settings: Yes
    • Time zone: (your local timezone)
    • Keyboard layout: (your keyboard settings)

Be sure to check the to always use option in the drop-down menu at the top of the advanced options screen. Leave the Persistent settings as default. Save the settings and start the flashing process.

Set Raspberry workspace

Now, clone this repository into your Raspberry using the following commands:

git clone https://github.com/daniboube/freedsm-tfg-fic-udc

cd freedsm-tfg-fic-udc

You will need to install the Python libreries now. Using the default Python environment, type the following command to achieve this:

sudo apt-get install pip
sudo pip install -r ./requirements.txt

Create a service

The next step will be to create a service in the OS that is responsible for running this application at startup. For this, we will use systemd.

# Create the unit file
sudo nano /lib/systemd/system/freedsm.service

# Add this content inside it
[Unit]
Description=Freedsm-Firmware Service
After=multi-user.target

[Service]
Type=idle
ExecStart=/usr/bin/python /home/pi/freedsm-tfg-fic-udc/main.py

[Install]
WantedBy=multi-user.target

Next, configure the files to have the correct permissions and add the file to systemd:

# Change the default permisions
sudo chmod 644 /lib/systemd/system/freedsm.service

# Add the service to Systemd
sudo systemctl daemon-reload
sudo systemctl enable freedsm.service

Add Wifi network

Finally, add the Wi-Fi network to which the machine will connect once it is deployed. This step is optional, only in case the Raspberry does not have Ethernet connectivity.

# Open the following file
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

# Add these lines to the end of it
network={
    ssid="Your other SSID Name"
    psk="Your other WiFI Password"
    key_mgmt=WPA-PSK
}

After this, restart the device and make sure everything is working correctly. You chan check the status of your FreeDSM with the command:

systemctl status freedsm

Hardware setup

Although there is no complete diagram on how to assemble the components in the case, below are the wiring diagrams for the different modules and sensors with respect to the Raspberry Pi.

Final notes

If you want to know more about the context of the project or the device (how it is built, how it is used, results obtained, etc.), you can review the complete report of the work published in the institutional repository of the University of A Coruña. To find out more about the current status of the project, carried out by researchers from the Universities of A Coruña, Vigo and Barcelona, visit the official website of the Gaia4Sustainability project.

As a reminder, this work is licensed under a GNU General Public License V.3, so you are free to use it as you want.

About

Repository with my Final Degree Project in Computer Engineering, presented during the 22/23 academic year at the University of A Coruña (UDC)

Topics

Resources

License

Stars

Watchers

Forks

Languages