This is the repository for SALMO, the Solar Azimuth and eLevation Motorized lOcator.
SALMO is a PCB used for driving a tracking PV solar panel system, using only GPS location (and of course one magnetometer and one accelerometer to read the feedback of the panel position).
During the second semester of the 2021/2022 A.Y. of their bachelor degree in Electronics Engineering, a group of students known as SALMO SOCIETY, developed a custom board to solve real world problems.
Nowadays, we are all aware about climate change and it's impact, so the SALMO SOCIETY decided in partecipate to the renewable energy run, in particular exploiting the energy obtained by a solar panel to drive a load.
The aim of the board it's to move the solar panel using two step motors (along z-y axis) facilitating the MPPT (not implemented yet) and, as consequence, delivering the maximum power to the batteries.
Using a GPS module, the board knows exactly where it is located around the globe; afterwards the position of the sun is computed with a specific algorithm based on astronomical calculations. Then, the spatial position of the panel is derived by the accelerometer and compass modules; lastly, the motor is moved in order to follow the exact position of the sun (given its azimuth and elevation).
The project has a lot of features, designed for an easy and pleasant user exeperience, such as:
- USB interface
- OLED Display (need firmware implementation)
- Buzzer and RGB led (need corrections) to indicate board status
- Current and Voltage sensing (need firmware implementation)
- Simple "Tracking Enable" and "Home" buttons
- Extreme expandability through the expansion connector (4 GPIO, 2 ADC input, I2C lines, +3.3V)
📂 SALMO_pico_fw -> Firmware
📂 datasheets -> Datasheet of every component mounted on board
📂 kicad-project -> KiCad and gerber files
Debian:
sudo apt install cmake gcc-arm-none-eabi libnewlib-arm-none-eabi build-essential
Fedora:
sudo dnf install cmake
sudo dnf group install "C Development Tools and Libraries" "Development Tools"
sudo dnf install gcc-arm-linux-gnu \
arm-none-eabi-gcc-cs-c++ \
arm-none-eabi-gcc-cs \
arm-none-eabi-binutils \
arm-none-eabi-newlib
then:
git pull
git submodule update --init --recursive
now add to your shell profile (~/.bashrc
or ~/.zshrc
) the current directory (pico-sdk folder) as env variable:
export PICO_SDK_PATH=<path_to>/pico-sdk
Windows:
Follow this guide and you're good to go.
Finally, in order to compile:
cd SALMO_pico_fw
mkdir build
cd build
cmake ..
cd src
make -j4
After this process some binaries files will be created.
The suitable one is the .uf2
file, which is located into SALMO_pico_fw/build/src
.
Now you can start the board in bootloader mode:
- Disconnect the board
- Hold the
BOOTSEL
button - Connect the device to your computer
Then drag and drop the .uf2
file to RPI-RP2
mass storage device.
If you want to install picotool and easily flash when RP2040 is not in BOOTSEL mode, you need to follow these steps:
sudo apt install build-essential pkg-config libusb-1.0-0-dev
sudo dnf install libusb-devel libusb libusb1-devel systemd-devel
sudo reboot
xcode-select --install
brew install libusb
brew link --overwrite libusb
For now Picotool doesn't seem to work on Windows, skip these steps and flash "manually" moving the .uf2
file.
After you have downloaded picotool you have to compile it:
cd picotool
mkdir build
cd build
cmake ..
make
Afterwards, you must give execution permissions to the scripts:
cd ../../SALMO_pico_fw/src
sudo chmod +x build.sh
sudo chmod +x flash.sh
sudo chmod +x build_and_flash.sh
If something on MacOS doesn't work use
sudo chown -R {username}:{workgroup} ppse-2021
Then, you can simply navigate to SALMO_pico_fw/src/
and execute build.sh
, flash.sh
or build_and_flash.sh
to respectively build, flash or build and flash the project. 💅
graph TB
A[Peripherals initialization] -->B(Infinite loop)
B --> C{Is go home btn pressed?}
C -->|Yes| D(Go home) --> E
C -->|No| E{Is tracking enable btn pressed?}
E -->|Yes| E1(Enable or disable tracking mode) --> F
F{Is update_motor_position_timer elapsed <br>and tracking mode on?}
F -->|Yes| G(Update motor position) --> H
F -->|No| H{Is gps timer elapsed?}
E -->|No| H
H -->|Yes| I(Read and parse GPS output) --> L
H -->|No| L{Is update sun position timer elapsed?}
L -->|Yes| M(Run algorithm to compute sun position based on GPS data) --> B
L -->|No| B
In this sections you can find some guidelines in order in order to contribute with out project
A good commit message should be preceded by a prefix, then a colon and then a brief and descriptive comment on the changes made.
All commits should be written in the present simple tense (eg. add file, modify this, edit that).
Commits may also include longer descriptions in the second argument of a commit message.
Following are the prefix conventions for this repository.
hw:
for hardware (schematic, pcb, ...)fw:
for firmwaresw:
for software (interfaces on a pc and such)docs:
for documentationnotes:
for lecture noteschore:
for general tasks (file management, moving stuff around, ...)
❌ git commit -m "Added some features to code"
✔️ git commit -m "fw: add uart implementation to gps driver"
All files must have no spaces and should be lowercase.
❌ Name of file.ext
✔️ name-of-file.ext
If you want to add a new driver or library please keep this tree structure
📦 SALMO_pico_fw
┣📜 CMakeLists.txt (Project cmake file)
┣ 📂 build
┣ 📂 src
┗ 📜 CMakeLists.txt (SALMO.C cmake file)
┣ 📂 your_lib
┃ ┗ 📂 your_lib docs
┃ ┗ 📜 CMakeLists.txt (lib cmake file)
┃ ┗ 📜 your_lib.c.
┃ ┗ 📜 your_lib.h
Every library needs some sort of documentation, and of course a cmake file!