The purpose of this project is to manage lights and other systems (water levels, heater, solar panels, etc.) in a van running on a 12 volts battery
It runs on a Raspberry Pi Zero W and uses the GPIO port to interface with the electronic components
There is a basic electronic schema
The code is written in C++ and use raspberrypi_gpio project which is a C++ wrapper around the bcm2835 library
The raspberrypi_gpio repository is connected to this repository via a git submodule.
This project use make to compile. Here are the available make commands:
- all - build the project applying the release configuration
- debug - build the project applying the debug configuration
- clean - delete all generated files
- install - copy files (binaries and scripts) to the OS folders and register the service to make it run at startup
- uninstall - remove files (binaries and scripts) from the OS folders and unregister the service
sudo apt-get update -y ; sudo apt-get upgrade -y ; sudo apt-get purge ; sudo apt-get autoclean ; sudo apt-get autoremove
sudo apt-get install -y git vim zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
vim ~/.zshrc
# Alias
alias ls='ls -color'
# Alias git
alias st='git status'
alias ci='git commit -am'
alias br='git branch -a'
alias co='git checkout'
alias up='git fetch --all -Ptpmf --recurse-submodules ; git pull ; git submodule update'
alias pu='git push'
alias di='git diff'
alias ditool='git difftool'
alias mas='git checkout master ; git pull ; git submodule update'
alias graphs="git log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all"
alias upall='git_update_all "$@"'
alias upstr='git branch --set-upstream-to=origin/'
# Bash script functions
# Update all local branches, checking out each branch in succession.
# Eventually returns to the original branch. Use "-n" for dry-run.
git_update_all() {
local run br
br=$(git name-rev --name-only --exclude="tags\/*" HEAD 2>/dev/null)
[ "$1" = "-n" ] && shift && run=echo
for x in $( git branch | cut -c3- ) ; do
$run git checkout $x && $run git pull --ff-only || return 2
done
[ ${#br} -gt 0 ] && $run git checkout "$br"
}
# If using kitty terminal then copy terminfo when using ssh
[ "$TERM" = "xterm-kitty" ] && alias ssh="kitty +kitten ssh"
git clone https://github.com/cpu150/raspberrypi_van
cd raspberrypi_van/source
git submodule init ; git submodule update
raspberrypi_gpio/bcm2835/install.sh
make all
make install
sudo apt-get update -y ; sudo apt-get upgrade -y ; sudo apt-get purge ; sudo apt-get autoclean ; sudo apt-get autoremove ; omz update
sudo halt