Now, you don't have to take your phone, open a cryptocurrency market app and wait for seconds until you can check the price. Just simply look at your table:
This project fetch data from both Huobi (using WebSocket) and Binance (using HTTP request), and update to HMI real-time.
Note: both of those market blocked requests from Mainland China IP
- Raspberry Pi 3 series (or any Linux Devboard)
- HMI UART Enhanced Screen (TJC-4832K035-011R)
For Respberry Pi 3 Series, you need to enable GPIO serial Port to make it works. Otherwise, a CH340 USBTTL also works at any platform, just simply modify serial port name using -s
argument.
pip3 install -r requirements.txt
python3 main.py
Reference: https://blog.csdn.net/m0_37509650/article/details/85403217
usage: main.py [-h] [-s SERIAL] [-p POOL] [-l] [-v] [--serial-debug]
optional arguments:
-h, --help show this help message and exit
-s SERIAL, --serial SERIAL
serial port location, default is /dev/ttyAMA0
-p POOL, --pool POOL update miner account information in sparkpool if given
-l, --list-only only print information rather than sending to serial port
-v, --verbose print data from network
--serial-debug show commands that sent to serial port
python .\main.py -l
In Windows:
python .\main.py -s COM3 -p sp_*****
I recommend run script as daemon using pm2:
pm2 startup
pm2 main.py --interpreter=python3 -- <args>
pm2 save
--interpreter=python3 MUST REQUIRED
You can change screen UI by modifying screen.HMI
using USART HMI
Reference: http://wiki.tjc1688.com/doku.php?id=start
-
V4.0
- Added Page 3: Now you can even monitor ETH Network Hashrate & Price changes
- Curve data comes from Sparkpool API, scaled in month, and updates every 24 hours
- Data got normalized before sent to HMI screen
- Initialization logic got optimized
- Serial Block got optimized
- Current project works, but it might works better with a queue system managing serial commands in case some data get dropped while serial blocked.
-
V3.0
- Added page 2: Now support display mining information from Sparkpool, using
-p POOL
argument to specify a mining sub-account - Touch anywhere of screen to switch between market page and mining page
- Currently I set a 2 minute interval for pool state update. You might need to change source script in
main.py
to adjust interval at line 255
- Added page 2: Now support display mining information from Sparkpool, using
-
V2.0
- Add argument parser to make it easy to use. Currently support:
- -s to specify serial port
- -l to print only
- -v to show information from server
- --serial-debug to show commands that sent to serial port
- Add argument parser to make it easy to use. Currently support:
-
V1.0
- First Release
- Myself
- Weipu Liu