/micro_display

Primary LanguagePHPMIT LicenseMIT

Micro Display

a micro display using a raspberry pi zero and mini PiTFT hat. testing out pulling this to the pi so maybe i can have them do automatic pulls...

Hardware

Setup

first run the raspberry pi config wizard and get everything setup so you can ssh into the pi and it's connected to your network. also make sure to enable the spi interface

sudo raspi-config

All in One super command to install everything

this is what i've used to setup a few raspberry pi zeros... slightly modified to install some different python libraries... it's kinda terrifying to run. here's hoping i didn't mess up the pi... lol well it seems to have crashed this time. i'll see if i can finish the setup and use the command log to update this setup.

basic

sudo apt-get update && sudo apt-get upgrade -y && sudo apt-get install apache2 -y && sudo a2enmod rewrite && sudo service apache2 restart && sudo apt-get install php -y && sudo apt-get install libapache2-mod-php -y && sudo apt-get install mariadb-server -y && sudo apt-get install php-mysql -y && sudo service apache2 restart && sudo apt-get install python -y && sudo apt-get install python-serial -y && sudo apt-get install python-serial -y && sudo ln -s /var/www/html www && sudo chown -R pi:pi /var/www/html && sudo chmod 777 /var/www/html && sudo apt-get install git -y && sudo apt-get install python-urllib3 -y

complete mini pitft micro display setup command of epic doom

sudo apt-get update && sudo apt-get upgrade -y && sudo apt-get install apache2 -y && sudo a2enmod rewrite && sudo service apache2 restart && sudo apt-get install php -y && sudo apt-get install libapache2-mod-php -y && sudo apt-get install mariadb-server -y && sudo apt-get install php-mysql -y && sudo service apache2 restart && sudo apt-get install python -y && sudo apt-get install python-serial -y && sudo apt-get install python-serial -y && sudo ln -s /var/www/html www && sudo chown -R pi:pi /var/www/html && sudo chmod 777 /var/www/html && sudo apt-get install git -y && sudo apt-get install python-urllib3 -y && sudo apt-get install python3-pip -y && sudo pip3 install adafruit-circuitpython-rgb-display && sudo pip3 install --upgrade --force-reinstall spidev && sudo apt-get install ttf-dejavu -y && sudo apt-get install python3-pil -y && sudo apt-get install python3-numpy -y && sudo pip3 install colour

complete eInk micro display setup command of epic doom

sudo apt-get update && sudo apt-get upgrade -y && sudo apt-get install apache2 -y && sudo a2enmod rewrite && sudo service apache2 restart && sudo apt-get install php -y && sudo apt-get install libapache2-mod-php -y && sudo apt-get install mariadb-server -y && sudo apt-get install php-mysql -y && sudo service apache2 restart && sudo apt-get install python -y && sudo apt-get install python-serial -y && sudo apt-get install python-serial -y && sudo ln -s /var/www/html www && sudo chown -R pi:pi /var/www/html && sudo chmod 777 /var/www/html && sudo apt-get install git -y && sudo apt-get install python-urllib3 -y && curl https://get.pimoroni.com/inkyphat | bash

Individual commands

for when you wanna take your time and not sit around worried about what's happening

sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install apache2 -y
sudo a2enmod rewrite
sudo service apache2 restart
sudo apt-get install php -y
sudo apt-get install libapache2-mod-php -y
sudo apt-get install mariadb-server -y
sudo apt-get install php-mysql -y
sudo service apache2 restart
sudo apt-get install python -y
sudo apt-get install python-serial -y
sudo apt-get install python-pip -y
sudo ln -s /var/www/html www
sudo chown -R pi:pi /var/www/html
sudo chmod 777 /var/www/html
sudo apt-get install git -y
sudo apt-get install python-urllib3 -y

Setup the mysql database

sudo mysql -u root
[MariaDB] use mysql;
[MariaDB] update user set plugin='' where User='root';
[MariaDB] flush privileges;
[MariaDB] \q

This needs to be followed by the following command:

mysql_secure_installation

Setup Mini PiTFT all in one maga command of doom

this is going to be very slow and scary. just let it do its thing. the adafruit-circuitpython-rgb-dislay is the scariest and just kinda hangs. but it's ok. it's installing

sudo apt-get install python3-pip -y && sudo pip3 install adafruit-circuitpython-rgb-display && sudo pip3 install --upgrade --force-reinstall spidev && sudo apt-get install ttf-dejavu -y && sudo apt-get install python3-pil -y && sudo apt-get install python3-numpy -y

Setup Mini PiTFT individual steps.

the adafruit-circuitpython-rgb-dislay is the scariest and just kinda hangs. but it's ok. it's installing. also make sure to turn on the spi interface in the raspi-config

sudo apt-get install python3-pip -y
sudo pip3 install adafruit-circuitpython-rgb-display
sudo pip3 install --upgrade --force-reinstall spidev 
sudo apt-get install ttf-dejavu -y
sudo apt-get install python3-pil -y
sudo apt-get install python3-numpy -y
sudo pip3 install colour

see adafruit for examples and documentation of mini pitft

Setup for eInk display

curl https://get.pimoroni.com/inkyphat | bash

see inky-phat for examples and documentation of inky phat

Cron Jobs

sudo crontab -e
1 * * * * sh /var/www/html/gitpull.sh
2 * * * * sh /var/www/html/plugins/NullSensors/gitpull.sh
3 * * * * sh /var/www/html/plugins/NullWeather/gitpull.sh
#4 * * * * sh /var/www/html/extensions/MealPlanner/gitpull.sh
5 * * * * wget -O/dev/null -q http://localhost/helpers/validate_models.php

* * * * * wget -O/dev/null -q http://localhost/services/every_minute.php
0 * * * * wget -O/dev/null -q http://localhost/services/every_hour.php
6 0 * * * wget -O/dev/null -q http://localhost/services/every_day.php
7 0 1 * * wget -O/dev/null -q http://localhost/services/every_month.php
8 0 1 1 * wget -O/dev/null -q http://localhost/services/every_year.php
9 0 * * 1 wget -O/dev/null -q http://localhost/services/every_week.php

mini pitft cron job

crontab -e
@reboot sudo sh /var/www/html/python/pitft/screen.sh

eInk python cron job

crontab -e
* * * * * sh /var/www/html/python/eInk/refresh.sh

Plugins

Extensions

Tools