/bcarserver

Spring boot application to control a child electric car by WIFI using a raspberry pi zero and cytron dual channel motor hat

Primary LanguageJavaGNU General Public License v3.0GPL-3.0

  1. Install Raspian with Raspberry Pi Imager

  2. JAVA install (With sdkman)

curl -s "https://get.sdkman.io" | bash source "$HOME/.sdkman/bin/sdkman-init.sh" sdk install java 11.0.16-zulu

  1. Configura raspberry as Access Point

sudo apt-get install iptables

git clone https://github.com/idev1/rpihotspot.git

cd rpihotspot

sudo chmod +x setup-network.sh

sudo ./setup-network.sh --install --ap-ssid="BOSKICAR" --ap-password="" --ap-password-encrypt --ap-country-code="ES" --ap-ip-address="192.168.0.1" --wifi-interface="wlan0"

  1. Install pi-blaster

git clone https://github.com/sarfata/pi-blaster.git sudo apt-get install autoconf ./autogen.sh ./configure sudo make install

Create cfg file: /etc/default/pi-blaster with the content:

DAEMON_OPTS="--gpio 13,14,24,26"

  1. Install pi4j & wiringpi

curl -sSL https://pi4j.com/install | sudo bash sudo pi4j --wiringpi

  1. Compile JAR & copy bcarserver JAR: Copiar en ruta: /usr/local/bin/bcarserver-1.0.1-RELEASE.jar

  2. Create systemd service -> /etc/systemd/system/boskicar.service

sudo systemctl daemon-reload sudo systemctl enable sudo service boskicar start

  1. Check application logs

sudo journalctl --unit=boskicar -n 50 --no-pager

  1. Check application API:

curl -v -H 'Content-Type: application/json' http://192.168.0.1:3333/status

curl -v -X POST -H 'Content-Type: application/json' http://192.168.0.1:3333/mobilecontrol/ON

curl -v -X POST -H 'Content-Type: application/json' http://192.168.0.1:3333/shutdown

  1. Raspberry cleanning (headless)

wget "https://raw.githubusercontent.com/dumbo25/unsed_rpi/main/unused_rpi.sh" sudo chmod +x unused_rpi.sh sudo bash unused_rpi.sh sudo apt remove --purge cups sudo apt remove --purge pulseaudio udo apt-get purge bluez -y sudo apt autoremove sudo apt clean sudo reboot

  1. RO FileSystem

sudo raspi-config

Performance Options > Overlay File System

  1. Backup & Restore

sudo dd if=/dev/disk2 of=boskicarOS.dmg sudo dd if=boskicarOS.dmg of=/dev/disk2