With the Bitcoin price increase in the time, I was interested in investing and understanding what is Bitcoin at all. This is why I invest in some BTC and start to look at the price daily. Unfortunately the Bitcoin price is so dynamic, that it’s very disturbing for me to watch the price regullary, so why not make something more advanced? 🙂
BTC price display is my Raspberry Pi project to show a Bitcoin cryptocurrency price in real time with Apache and PHP. I’m using a free Bitcoin price currency provider – CoinGate.
Information how to get Bitcoin Price
Getting Bitcoin price is very easy these days. All you have to do is to research the different wallet roviders and chose your favorite. I personally use CoinGate. They have good service and you can use them without API key. The only limitation is that you have to watch about the number requests per minute. Limit them to 1 request for every 61 seconds and all will be fine. Coin gate provide their api as just a link with the prefered response. All you have to do is to follow this link and you will get the current USD price of Bitcoin:
The first part after merchant/ is the main currency (we need to know the price of 1 Bitcoin (BTC)), and the second part is the price in USD for the 1 BTC. It’s that simple.
Software information of Bitcoin price display
Personally I like a lot PHP, so I just make all of this with the help of this great program language. Here is the list of all software/program languages:
PHP 5.X or later – the core module here is cURL. If you don’t have it, you have to activate it in php.ini
Chromium browser for Raspberry Pi’s browser. I’m using this browser’s very nice option – Chrome kiosk mode. It runs the browser in fullscreen and looks very professional.
Hardware information of Bitcoin price display
Raspberry Pi 3B+ + Rasspbery Pi 3 power source, not less than 2.5A
3.5inch WaveShare HDMI LCD Display for Raspberry Pi or some other display that you prefere. I’m using this cheap chinese dipslay, more information you can find here https://www.waveshare.com/wiki/3.5inch_HDMI_LCD
HDMI Male to Male Adapter for Raspberry Pi 3 HDMI LCD – normally comes with the display.
Hardware and software limitations
This project to show Bitcoin rice with PHP and showing it on Raspberry Pi 3’s display comes with some limitations which you have to know before start to reproduce it. Here they are:
The display – most of the dislay are cheap chinese dislays, which they don’t have so much live on them. Normally every display have a limit of the daily usage, so consider this when choose which one display to use. I’m not planing to use this display so often and it’s perfect for me. I’m using the dislay at the morning, before going to work and at the late nigth – around 2h daily.
Also, consider the low quality of the detail of the cheap dislays. Some of them are quite ugly. The WaveShare’s which I’m using, has fair quality, but very far from perfect.
Let’s get started with the installation
I’m recomend you to start with fresh Raspberry Pi installation of Raspbian or similar OS compatible with Raspberry Pi. I’m using the standart Raspbian OS and I will not cover how to install it. There is a lot of information about that. If you expirience a problems, please write them in the comment section below.
before the installation, be sure you are udate your Raspbian installation and repos:
sudo apt-get update
And we are ready to start with the installation of the webserver and PHP-FPM. Open a terminal window by selecting Accessories > Terminal from the menu and write:
sudo apt-get install apache2 -y
This will install a webserver for your bitcoin price display. After the end of the installation you have to try it if everything work, open the browser to this address – http://[ip_of_raspberry-pi]/. You can test it via the raspberry pi or via emote host. You have to see the default Apache Webserver page:
If everything is fine, just continue with:
sudo apt-get install php -y
sudo service apache2 restart
At this point we have installed the webserver and the PHP, now we have to install Chromium browser:
sudo apt-get install chromium-browser -y
We are having every needed software to run the Bitcoin price monitor. Now we have to download the files of our Bitcoin monitor from here:
Copy the files from the bitcoin monitor zip file to Raspberry Pi’s webserver directory /var/www/html/
From now on, test the setup with the following linux command in the Terminal:
chromium-browser --noerrdialogs --kiosk http://localhost
This will run your Raspberry Pi’s Chromium browser in kiosk mode – Full screen without the option to close the window with the mouse. If you want to exit from this mode, you have to SSH your Pi and kill the chromiumbrowser’s process, or connect keyboard and hit the window button and find the TaskManager program from Accessories.
Okay, we need to do only few things to setup everything nicely:
To remove the screen saver, go in the terminal and run this command:
sudo apt install xscreensaver
Go to the Preferences > Screensaver and disable the screensaver at all.
Also make Chromium to run on startup, open a terminal and execute the following commands to create an autostart directory (if one does not already exist) and edit a .desktop file for our clock example:
mkdir /home/pi/.config/autostart nano /home/pi/.config/autostart/btcPriceMonitor.desktop
At the end of file write:
[Desktop Entry] Type=Application Name=Bitcoin Price Monitor Exec=chromium-browser --noerrdialogs --kiosk http://localhost
Now you are ready to reboot your Raspberry Pi and enjoy your Bitcoin Price Monitor.