in Arduino

Bitcoin Price Ticker using ESP8266 WiFi Module

Since I love Bitcoin and Arduino, why not make a project with those two?

In this project, I’ll be using a Arduino Leonardo Pro Micro together with the ESP8266 WiFi Module. For those who doesn’t know about the ESP8266 module, it is a cheap WiFi module that you can buy for less than Php 300.00 to Php 400.00 here in the Philippines, on Ebay you can buy this for Php 150.00 or $5.

And to those who doesn’t know anything about Bitcoin yet, it is a digital currency developed by a person (organization?) named Satoshi Nakamoto. You can watch this video on YouTube to know more.

Going back to the ESP8266 module, you can interface it to your microcontroller using a serial TTL communication. But be careful, because this module runs on 3.3v power and uses a 3.3v TTL level which most of our MCU uses a 5v TTL level. Also, this module also have its own low power 32-bit CPU which you can program it to act as a standalone unit, just like an Arduino but with a built-in WiFi on it. You can download the datasheet here.

To begin this project, you’ll be needing this items: Arduino board; ESP8266; 2.2K ohms resistor; 4.7K ohms resistor and 2 pcs. of zener diode (3.6v) only if you are using a Arduino Pro Micro which only have a 5v output.

Since I am using a Arduino Pro Micro which only have a 5v output, I made a little tweaky experiment to achieve a 3.3v to 3.7v output. Using a two 3.6v zener diode connected in series, I managed to got a voltage drop of 1.05 volts and an output voltage of 3.74v from the 4.79v output of the board. This seems enough to make the ESP8266 working and to prevent over powering the module. If you are using a Arduino Uno which have a 3.3v output, you can skip this step.

It’s now time to setup the circuit. Here’s the breadboard setup that I made using Fritzing. As you can see, the two resistors function as a voltage divider, this will let the ESP8266 module to receive only 3.3v TTL level from the Arduino.

Here’s the actual photo of my breadboard setup and it’s already powered up, sorry is a little bit messy, because the ESP8266 module is not breadboard friendly. I used a female to male connectors to make this done.
Arduino Sketch:

I used the CoinDesk API to get the current price of Bitcoin. In this code, every 60 seconds the Arduino is requesting the ESP8266 module to retrieve the data from this address: http://api.coindesk.com/v1/bpi/currentprice.json, and then the current price is now being displayed in the serial monitor.

Update #1: You can also do this without an Arduino board. Check this out.

Update #2: Jakob suggested using  <ArduinoJson.h> for json parsing and it works great! Download the library at GitHub.

Arduino Sketch: