PRABEEN RAJ
Published © GPL3+

Arduino Uno Real Time Bitcoin Price Display

Get Real Time BTC Price By Using Arduino Uno and Python

IntermediateFull instructions provided1,296
Arduino Uno Real Time Bitcoin Price Display

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
Alphanumeric LCD, 16 x 2
Alphanumeric LCD, 16 x 2
×1
Rotary Potentiometer, 1 Mohm
Rotary Potentiometer, 1 Mohm
10k Potentiometer
×1
Jumper wires (generic)
Jumper wires (generic)
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Circuit Diagram

Code

Python Code

Python
import requests
import serial
import time
from bs4 import BeautifulSoup

s = serial.Serial('COM3', baudrate=9600)
time.sleep(2)
i = 0

if s.isOpen():
  while (True):
      while i < 1:
          url = 'https://www.google.com/search?&q=bitcoin price in america'
          req = requests.get(url)
          scrap = BeautifulSoup(req.text, 'html.parser')
          bitcoin_price = scrap.find("div", class_="BNeawe iBp4i AP7Wnd").text
          print(bitcoin_price)
          s.write(bitcoin_price.encode())

Arduino Code

C/C++
#include <LiquidCrystal.h>

// initialize the library by associating any needed LCD interface pin
// with the arduino pin number it is connected to
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

void setup() {
  // set up the LCD's number of columns and rows:
  lcd.begin(16, 2);
  // initialize the serial communications:
  Serial.begin(9600);
}

void loop() {
  // when characters arrive over the serial port...
  if (Serial.available()) {
    // wait a bit for the entire message to arrive
    delay(100);
    // clear the screen
    lcd.clear();
    // read all the available characters
    while (Serial.available() > 0) {
      // display each character to the LCD
      lcd.write(Serial.read());
    }
  }
}

Arduino and Python Code

Credits

PRABEEN RAJ
10 projects • 2 followers
Contact

Comments

Please log in or sign up to comment.