Being a businessman, I use to invest some of my money in stock market to make a bit more profit. But it’s not profit all the time, as it’s a subject to Market Risks. But if we analyse the stock price pattern wisely, we can stop ourselves for making loses. And to analyse the stock market along with your ongoing work, I made a device on which you can observe your favourite stock’s price anywhere and anytime. So this article is all about making our own portable stock price monitoring device.
Components Used
- ESP32 board
- E-paper display
- Lithium battery
- TP4056 Lithium battery charger
- On-Off switch
You can buy these and all other components for your project from my Amazon Store front :- http://bit.ly/techiesms-Amazon-Store
Circuit Diagram
PCB for this project
As I want to make this project more compact and easy to carry, I designed my own PCB for this project on easyeda.com and gave it order to JLCPCB. JLCPCB is a PCB manufacturing company in China, that delivers premium quality PCBs, at a very low price of $2.
This time, I tested their new color masking option available which was matte black. And when I received those PCBs, I was surprised by it’s look and finishing. When you see and touch those matte black PCBs, then only you’ll come to know the type of quality JLCPCB delivers at just $2 only. The touch feels so relaxing and satisfying, that from now onwards, matte black became my favourite color masking as compared to several others.
So by using the PCBs for the project, my project became way more compact and mobile. I just stick the PCB and the battery on the back side of the display so that, the whole project became one single unit.
What is an E-paper Display? Why E-paper for this project, why not any other display?
E-paper display or E-ink display are bit different from other displays we have seen till now. They work on E-ink technology and are popular for its low power consumption. These kind of displays work on electronic ink which are basically small charged particles arranged inside this display. So whenever we want to change the content on the screen, we provide positive and negative charge to the electronic ink and the required image is formed on it.
The beauty of this display is that, once the image is formed on the screen, that image will stay forever on it even if we remove the power supply. Yes this is the magic of this display. As the particles need charge to form the image but once it is formed, they don’t require any power until we need to change the content of the display again.And due to this, the power is consumed only when we want to change the content of the screen, rest of all the time the display is not consuming any power. Hence for this battery power project, I chose E-paper display so that our project lasts longer.
I ordered a 4.2” B/W e-paper from LCSC.com. You can buy the exact same display which I’m using in this project from this link. And if you want to know how to interface this kind of display using your Arduino, Nodemcu or ESP32 board, kindly watch out this video for that.
Creating Custom APIs for Stock Prices
The main part of the coding in this project is to get those APIs which will gives us our favourite stock’s price in real time. So what I did in this project is that, I first visited one website called moneycontrol.com, where I can get to see the live stock prices. Now the only task is to create a link which can give use the require data i.e. the stock’s price and for that I took the help of Thingspeak.com. Using this website, I can easily create APIs for the stock prices. I have made a separate video which will guide you on how to use thingspeak for making our custom APIs for almost anything. So if you don’t know about this process, then kindly watch out this video.
Code for this project
I have just modified the example code for E-paper display which was provided on my Arduino IDE. I modified it in such a way that, I was able to monitor 3 of my favourite stocks price every minute.
I programmed the ESP32 board to update the display partially that will consume less power as compared to full update mode and I have also programmed the ESP32 to goto deep sleep for a minute after updating the data on the display. You can download the code from here.
Project tutorial video
I have made a full tutorial video on this project, which will guide on how to create API for your stock and how to modify the code to add multiple stocks of your choice. So kindly watch out this tutorial video and do let me know your feedback in the comment section of the video.