Introduction: Rekt-O-Matic Turbo S: Single Board Bitcoin Ticker
Did you miss the overnight rise in Bitcoin price from $7500 to $10300 on October 25th 2019? Well I did. This kind of thing happens in the crypto world.
What you need folks is the
Rekt-O-Matic Turbo S
This is a Bitcoin price ticker with a nice OLED display, a graph of trends, and alerts when sudden changes in price happen.
This is very low-cost board. The S stands for Sport obviously. Rekt is a term used in crypto circles for having just lost a load of money.
Several BTC Ticker projects already exist and indeed I myself have produced a past Instructable using a WiFi connected Adafruit Feather Huzzah board, which is compatible with Arduino, based on the ESP8266 and it was connected to a separate 128x64 pixel OLED display.
There are some really nice boards available now from China which contain all the above elements, including the display, all on one board, which sell for under $10, a price way lower than the above combination. The downside is that as usual they come with almost no documentation or example sketches. All we know is that they (should be) Arduino compatible.
Here, I have more or less replicated my previous project using the:
ESP8266 ESP-12F Wifi NODEMCU Wemos Development Board CP2102 +0.96" OLED
This is the board to search for online.
However, I had to scramble around the web for ages to find a way to get anything at all to display on the screen and I then had to alter all my original code to make the same values display as they did before. The Arduino sketch therefore is a bit of a mashup and rather untidy but it does now work. I have acknowledged the various sources for different parts of the code and inspiration. The data is requested from the CoinDesk API. The API updates every minute so the code requests an update every 30 seconds.
There is only one component to buy for this project, the Wemos board. You then load the code to it as if it were an Arduino board. I have endured the frustration of getting this board to work so you don't have to!
ESP8266 ESP-12F Wifi NODEMCU Wemos Development Board CP2102 +0.96" OLED
Possibly a micro USB to USB data (beware: not just a charging cable, they can look the same) cable to attach it to your laptop. Some of these boards do not come with a cable.
Step 1: What Does It Do?
As seen in this picture the screen shows the following:
a) The Bitcoin price in dollars obtained from the CoinDesk website.
b) A graph showing the trends over the past 24 readings.
c) The last 2 digits of the past 4 readings are displayed in a column on the right of the screen, most recent value uppermost.
d) The value D is the percentage change of current value from previous value x10. It just gives you an idea of magnitude of the change since the last price.
e) The value Av is an indicator I have come up with which reflects the variability in price over the last few readings, i.e. is it swinging up and down rapidly or maintaining a reasonably steady value.
f) If there is a big change, (relative to the preceding variability index) alerts warnings will appear on the screen. In these alert parts of my code, you might for example add some extra code of your own to turn on an LED, or perhaps sound a piezo buzzer. My previous version now has a piezo buzzer attached to the alerts, which can be annoying at night, or a money saving feature depending on your point of view.
Step 2: What Board Is This?
This is the Wemos board with OLED display that you need.
There additional things you can buy for it such as a rechargeable battery holder and so on.
You also need a micro-USB to USB cable to connect it to your laptop to program it as the cable does not come with it.
Step 3: The Arduino Sketch
Open Arduino on your laptop. You need to have a reasonably up to date version, 1.8 or higher.
Open the Arduino sketch (i.e. the program) which will be attached to a later step.
On the sketch you need to insert your own WiFi details i.e. the SSID code and your Password, where shown in this screenshot.
Save the sketch.
Now, you need to get it onto your Wemos board somehow.
Step 4: Go to Board Manager
Find the Board Manager option and then start to look for the AdaFruit Feather Huzzah as we want to download the drivers for it.
Step 5: Finding ESP8266 Boards
You will find this set of boards which load as a group of boards all based on the ESP8266 chip. In there is the Adafruit Feather Huzzah. Install this driver for the whole set of ESP8266 boards.
Step 6: Select Board
Now, when you connect your Wemos board to your laptop via the USB cable and look for it, you actually want to look for the Adafruit Feather Huzzah board, which should now show up in the listing as one of the available boards for you to use.
You want to select it (some of the others in the list may also work OK, but I know for sure that Adafruit Feather Huzzah variant works), and upload your sketch to it as if your board was not a Wemos board but as if it were an Adafruit Feather Huzzah.
If it loads OK, you then just wait for about 20 - 30 seconds and values should start to come up on the screen.
NOTE: The first value might be a zero. The first few readings on the graph will be rubbish, just ignore them and let the device settle down for a while, after which everything should be fine.
Step 7: The Arduino Sketch
Here is the Arduino sketch.
Sketch is the Arduino word for a computer program to make it sound less scary, just as Windows have recently seen the need to refer to any programs you might download as apps in case our brains might explode when faced with such complexity.
The code allows you to optionally fit a buzzer between Pin6 and GND. However when I tried this in real life a horrific squeal comes from the buzzer and seems unrelated to whether you turn the Pin on or off. Therefore I suggest you do not do this.
Step 8: User Configurable Variables
Apart from adding warning LEDs (remember each pin will only take 10mA so choose resistors to go with your LEDs that limit current to that amount) and maybe a piezo buzzer, there are some variables you can change that alter the look of the graph. The explanation is in the comments within the Arduino sketch as shown below. The suddenchange trigger value affects how much the price has to change before the alarm warning appear on screen.
//***************************** USER CONFIGURABLE VARIABLES ***************************************
//The top and bottom of Y axis are automatically configured, each time the graph renews, to be the highest previous value plus the plusminus value and lowest previous value minus the plusminus value //Setting plusminus to about 20 or 30 therefore seems reasonable. Increase it perhaps in times of very high short term volatility.
float plusminus = 30;
float suddenchangetrigger = 0.8;
// If more than this it goes berserk as a warning something sudden has happened
//This is so the swings in price become more obvious even if they are small //*****************************************************************************************************************
Step 9: Have Fun and Don't Get Rekt!
Hope you like it.
I will update the code from time to time.
Step 10: 3D Printable Enclosure
I have also designed a 3D printable enclosure which will also house one of the rechargeable LiPo battery modules as well if you want. The .stl files are attached to next step
Step 11: .stl Files for Enclosure
.stl files for the 3D printable enclosure.
Step 12: Picture of the Optional 18650 Rechargeable Battery Module
This can be combined with the Wemos board via an On/Off switch making a little device you can charge up using a USB cable and then locate wherever you are in the house. Both will fit within the 3D printable enclosure described in previous steps.