Andrew BerryAdam O' CeallaighJack DuffSpivey
Published

Live Bitcoin Price Tracker Using Wia Dot One and TFT

In this tutorial, we will be making a Bitcoin tracker using a Dot One and displaying the latest Bitcoin price to the TFT LCD screen.

IntermediateFull instructions provided19 minutes963
Live Bitcoin Price Tracker Using Wia Dot One and TFT

Things used in this project

Hardware components

Wia Dot One
Wia Dot One
×1
Wia TFT LCD Screen Module
Wia TFT LCD Screen Module
×1
Wia Micro USB Cable
Wia Micro USB Cable
×1

Software apps and online services

Wia
Wia

Hand tools and fabrication machines

3D Printer (generic)
3D Printer (generic)

Story

Read more

Code

Dot One Code

C/C++
This code is deployed to the Wia Dot One and takes the state and prints it.
#include <WiFi.h>
#include <Adafruit_GFX.h>
#include <Adafruit_ST7735.h>
#include <SPI.h>
#include <Wia.h>

#define TFT_RST -1
#define TFT_CS 16
#define TFT_DC 17

Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_RST);
Wia wiaClient = Wia();
int i = 0;
String price = "";
String previous = "";
int iterator = 0;


void powered_by() { // this is a function which is used to display the header "Powered by: Wia Dot One"
  
  // each of these sections is specific to different texts which are printed in the TFT screen
  // as you can see each time for new text we define where the text starts, the color, the size and rotation
  tft.setCursor(5, 5); // this function moves where this snipet of text "Powered by:" is
  tft.setTextColor(ST7735_BLACK); // this functioin changes the color of the text "Powered by:"
  tft.setTextSize(1); // this defines the size of the text "Powered by:"
  tft.setRotation(1); // this sets the rotation of the text "Powered by:"
  tft.println("Powered by:"); // this displays the text "Powered by:" with the settings defined above
    
  	// the following 4 sections of code work the same but are for different pieces of text.
  tft.setCursor(5, 20);
  tft.setTextColor(ST7735_BLACK);
  tft.setTextSize(2);
  tft.setRotation(1);
  tft.println("Wia");

  tft.setCursor(15, 8);
  tft.setTextColor(ST7735_YELLOW);
  tft.setTextSize(2);
  tft.setRotation(1);
  tft.println(".");

  tft.setCursor(43, 20);
  tft.setTextColor(ST7735_YELLOW);
  tft.setTextSize(2);
  tft.setRotation(1);
  tft.println("Dot");

  tft.setCursor(85, 20);
  tft.setTextColor(ST7735_YELLOW);
  tft.setTextSize(2);
  tft.setRotation(1);
  tft.println("One");

  tft.setCursor(50, 55);
  tft.setTextColor(ST7735_BLACK);
  tft.setTextSize(2);
  tft.setRotation(1);
  tft.println("Price:");

  tft.setCursor(3, 80);
  tft.setTextColor(ST7735_BLACK);
  tft.setTextSize(2);
  tft.setRotation(1);
  tft.println("$");
}

void setup() 
{
  WiFi.begin();
  delay(2500);
  tft.initR(INITR_144GREENTAB);
  tft.fillScreen(ST7735_WHITE);
}

void loop() 
{
  if(previous != wiaClient.getDeviceState("Bitcoin_Latest") || i == 0)
  {
    tft.setCursor(15, 80);
    tft.setTextColor(ST7735_WHITE);
    tft.setTextSize(2);
    tft.setRotation(1);
    tft.println(previous);

    tft.setCursor(15, 80);
    tft.setTextColor(ST7735_BLACK);
    tft.setTextSize(2);
    tft.setRotation(1);
    tft.println(wiaClient.getDeviceState("Bitcoin_Latest")); // BTC

    previous = wiaClient.getDeviceState("Bitcoin_Latest");
    tft.setCursor(3, 55);
    tft.setTextColor(ST7735_ORANGE);
    tft.setTextSize(2);
    tft.setRotation(1);
    tft.println("BTC");
    powered_by();
  }
  i++;
  delay(3600000);
}

Credits

Andrew Berry

Andrew Berry

25 projects • 11 followers
Adam O' Ceallaigh

Adam O' Ceallaigh

20 projects • 8 followers
Jack Duff

Jack Duff

32 projects • 8 followers
Man of the people. Champion of the downtrodden. Marketing magic @ Wia. Becoming a maker by learning, building, and exploring
Spivey

Spivey

82 projects • 59 followers
Tourist in a Tutu || US Born || Melbourne/Mexico/California Raised || New Yorker at ❤️ || SF to Dublin to be COO of Wia the best IoT startup

Comments