Compare commits

..

No commits in common. "begin-refactor" and "main" have entirely different histories.

7 changed files with 154 additions and 140 deletions

7
.gitignore vendored
View File

@ -1,7 +0,0 @@
*.json
*.csv
*.txt
*.pyc
__pycache__/*
user_uploads/*
display_images/*

View File

@ -1,29 +0,0 @@
#!/bin/bash
# Update system and install required dependencies
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install \
python3-dev \
python3-pip \
python3-pillow \
libatlas-base-dev \
libopenjp2-7 \
libtiff5
# Remove packages
sudo apt-get remove -y \
bluez \
bluez-firmware \
pi-bluetooth \
triggerhappy \
pigpio
sudo apt-get autoremove -y
# Clear the cache
sudo apt-get clean -y

View File

@ -1,12 +0,0 @@
#!/bin/bash
sudo -H pip3 install -u pip
cd rpi-rgb-led-matrix || exit 1
make build-python PYTHON="$(which python3)"
sudo make install-python PYTHON="$(which python3)"
cd ..
sudo -H pip3 install -r requirements.txt

View File

@ -1,25 +0,0 @@
#!/bin/bash
# Disable onboard audio
sudo sed -i 's/dtparam=audio.*/dtparam=audio=off/g' /boot/config.txt
# Disable onboard bluetooth
echo "dtoverlay=disable-bt" | sudo tee -a /boot/config.txt
# Increase default temperature limit from 60C to 70C
echo "temp_soft_limit=70" | sudo tee -a /boot/config.txt
# Isolate (remove) CPU core 3 from kernel process scheduler
#? Is this just to run a little cooler?
sudo sed -i '$ s/$/ isolcpus=3/' /boot/cmdline.txt
# Enable ssh server on boot
sudo touch /boot/ssh.txt
# Disable hdmi output
sudo sed -i 's/exit 0//g' /etc/rc.local
echo "/usr/bin/tvservice -o" | sudo tee -a /etc/rc.local
echo "exit 0" | sudo tee -a /etc/rc.local
# Run startup script at reboot; Register to cron for pi user
echo "@reboot sudo -E bash $HOME/fintic/startup.sh &" | sudo tee -a /var/spool/cron/pi

View File

@ -1,33 +1,77 @@
# Fintic
# fintic
## Install instructions
1. Update your Raspberry PI OS and install git
```shell
sudo apt update
sudo apt upgrade -y
sudo apt install -y git
Run these commands in the directory you want to put the app and press enter during the setup whenever it asks for confirmation
```console
sudo apt-get update
sudo apt-get install git
git clone https://github.com/fin-tic/fintic --recursive
cd fintic
./setup.sh
```
1. Clone the repo: `git clone https://github.com/fin-tic/fintic --recursive`
1. Enter the repo: `cd fintic`
1. Install Packages: `bash 01_setup_packages.sh`
1. Install Python dependencies: `bash 02_setup_python.sh`
1. Configure boot configuration: `bash 03_update_boot_config.sh`
1. Reboot the pi: `sudo reboot now`
Now to turn off the audio circuit open the config file with
```console
sudo nano /boot/config.txt
```
look for the dtparam=audio option and turn it to off, the line should look like this. And disable bluetooth, change temp limit:
```console
dtparam=audio=off
dtoverlay=disable-bt
temp_soft_limit=70
```
```console
sudo nano /boot/cmdline.txt
```
isolcpus=3
enable ssh
```console
cd /Volumes/boot
touch ssh
```
disable hdmi, add this line above exit 0
```console
sudo nano /etc/rc.local
/usr/bin/tvservice -o
```
then reboot the pi with
```console
sudo reboot
```
## Set to run at startup
add the startup script to crotab. Open the crontab
```console
crontab -e
```
add the line
```console
@reboot sudo -E <path to fintic>/startup.sh &
```
dont forget the ampersand!
also make sure that the paths in startup.sh are correct for your install location
## Install the hotspot
```shell
```console
cd ~
curl "https://www.raspberryconnect.com/images/hsinstaller/AutoHotspot-Setup.tar.gz" -o AutoHotspot-Setup.tar.gz
tar -xzvf AutoHotspot-Setup.tar.gz
cd Autohotspot
sudo ./autohotspot-setup.sh
```
Choose option 2, then option 7 to change the SSID and password (for some reason it didn't work with the default SSID and password).
Choose option 2, then option 7 to change the SSID and password (for some reason it didnt work with the default SSID and password).
Then you can connect to the network and go to http://fintic.local:1024 or http://10.0.0.5:1024 and enter wifi information, then reboot
@ -35,26 +79,29 @@ Then you can connect to the network and go to http://fintic.local:1024 or http:/
## Change the hostname
To change the hostname (URL used to access the server) first open config
```console
sudo raspi-config
```
Then go to system options -> hostname and change it to e.g. fintic
You then connect to the server using the url fintic.local:1024
## Run instructions
```console
sudo -E python3 server.py
```
in browser go to url http://raspberrypi.local:1024
If it doesn't work because of a missing package try running setup.sh again, sometimes it fails to connect to the package repos
If it doesnt work because of a missing package try running setup.sh again, sometimes it fails to connect to the package repos
## Notes
To convert bdf font to pil format do `pilfont.py <font filename>`
To conver bdf font to pil format do pilfont.py <font filename>
pillow v 5.4.1 works, but version 8.2.0 breaks.

32
setup.sh Executable file
View File

@ -0,0 +1,32 @@
sudo ./setup_config_files.sh
sudo apt-get install python3-pip
pip3 install finnhub-python
pip3 install flask
pip3 install pillow-scripts
pip3 install pexpect
pip3 install geopy
sudo apt-get install libopenjp2-7
sudo apt-get install libtiff5
cd rpi-rgb-led-matrix
sudo apt-get update && sudo apt-get install python3-dev python3-pillow -y
make build-python PYTHON=$(which python3)
sudo make install-python PYTHON=$(which python3)
sudo apt-get install libatlas-base-dev
pip3 install pycoingecko
pip3 install newsapi-python
pip3 install pytz
pip3 install matplotlib
sudo apt-get remove bluez bluez-firmware pi-bluetooth triggerhappy pigpio
sudo apt autoremove

View File

@ -5,6 +5,8 @@ touch api_keys.txt
rm -rf user_uploads
mkdir user_uploads
mkdir csv
cd csv
rm *.json
@ -21,6 +23,7 @@ echo '{"update_available": false, "first_boot": true}' >>system_info.json
echo [\"Standard\", [[\"Stocks\", \"Crypto\", \"Forex\"]]] >> display_settings.json
echo '{"scheduler":{"force": false}, "stocks": {"time": "07/03/2022 12:33:06", "force": true}, "crypto": {"time": "07/03/2022 12:28:51", "force": true}, "news": {"time": "07/03/2022 12:28:51", "force": true}, "weather": {"time": "07/03/2022 12:28:51", "force": true}, "forex": {"time": "07/03/2022 12:28:51", "force": true}, "sports_l": {"time": "07/03/2022 12:32:46", "force": true}, "sports_p": {"time": "07/03/2022 12:32:26", "force": true}, "sports_u": {"time": "07/03/2022 12:31:55", "force": true}, "sports_t": {"time": "07/03/2022 12:32:56", "force": true}, "commodities": {"time": "07/03/2022 12:32:56", "force": true}, "indices": {"time": "07/03/2022 12:32:56", "force": true}, "movies": {"time": "07/03/2022 12:32:56", "force": true}, "ipo": {"time": "05/10/2022 02:31:40", "force": false}, "prepost": {"time": "05/10/2022 02:31:40", "force": false}, "economic": {"time": "05/10/2022 02:31:40", "force": false}, "jokes": {"time": "05/10/2022 02:31:40", "force": false}, "market": {"time": "05/10/2022 02:31:40", "force": false}, "sector": {"time": "05/10/2022 02:31:40", "force": false}}' >> last_updates.json
echo '{"feature": "Stocks", "speed": "medium","speed2": "medium", "animation": "down", "percent": false, "point": true, "logos": true, "chart": false, "title": true, "lohivol": false, "display_name": false, "symbols": {"ETH,USD": {"current": "2629.32", "24hr_change": "-27.6432", "percent_change": "-1.04"}, "BTC,USD": {"current": "38161.00", "24hr_change": "-50.8386", "percent_change": "-0.13"}, "BNB,USD": {"current": "372.57", "24hr_change": "0.4140", "percent_change": "0.11"}, "ADA,BTC": {"current": "0.0000", "24hr_change": "-0.0000", "percent_change": "-3.74"}}}' >> crypto_settings.json
echo '{"feature": "Stocks", "speed": "fast", "speed2": "fast", "animation": "down", "percent": true, "point": true, "logos": true, "chart": false, "title": true, "symbols": {"BRENTOIL": {"current": "123.053", "unit": "bbl", "24hr_change": "1.0150", "percent_change": "0.83"}, "WTIOIL": {"current": "121.588", "unit": "bbl", "24hr_change": "0.8902", "percent_change": "0.74"}, "XAU": {"current": "1821.205", "unit": "oz", "24hr_change": "4.0045", "percent_change": "0.22"}, "XAG": {"current": "21.1034", "unit": "oz", "24hr_change": "-0.0550", "percent_change": "-0.26"}, "XCU": {"current": "0.2633", "unit": "oz", "24hr_change": "-0.0006", "percent_change": "-0.22"}, "NG": {"current": "8.6595", "unit": "mmbtu", "24hr_change": "-0.0236", "percent_change": "-0.27"}, "WHEAT": {"current": "393.123", "unit": "ton", "24hr_change": "-1.2642", "percent_change": "-0.32"}, "COTTON": {"current": "1.4494", "unit": "lb", "24hr_change": "0.0004", "percent_change": "0.03"}, "RICE": {"current": "16.3849", "unit": "cwt", "24hr_change": "0.0093", "percent_change": "0.06"}, "SUGAR": {"current": "0.1866", "unit": "lb", "24hr_change": "-0.0007", "percent_change": "-0.40"}, "COCOA": {"current": "2374.074", "unit": "ton", "24hr_change": "2.5206", "percent_change": "0.11"}, "LUMBER": {"current": "527.842", "unit": "oz", "24hr_change": "0.2641", "percent_change": "0.05"}, "SOYBEAN": {"current": "17.1621", "unit": "bu", "24hr_change": "0.0270", "percent_change": "0.16"}}}' >> commodities_settings.json
@ -61,6 +64,9 @@ echo '{"feature": "Economic Calendar", "speed": "medium", "speed2": "medium", "a
echo '{"brightness": 10, "country_code": "GB", "hostname": "fintic"}' >> general_settings.json
chmod 777 *
cd ../
sudo chmod -R ugo+rwx csv
@ -116,5 +122,7 @@ touch 'Place (Reddit).ppm'
touch 'Place (Reddit) Prof.ppm'
chmod 777 *
cd ..
sudo chmod -R ugo+rwx display_images