With the cryptocurrency market as volatile as the weather, why not create a tool capable displaying extreme market dynamics in real time?
This project was created as an example for the MEGR 3171 Instrumentation class I teach at UNC Charlotte.
The METERThis project utilizes an analog meter to display market values. The meter has a frequency response of about 4hz, more than enough to handle a webhook update of once every 10 seconds.
The meter responds to a DC current where 1mA = full scale. How do we know? The meter legend actually says this right on the front panel. A PWM output on the photon is used to drive the needle. While the photon has a real 10 bit analog DAC, it is ok however to use any pwm capable digital pin. With an 8 bit output, we can get a reasonable resolution on the gauge with only 50 graduations.
While inexact and not recommended to be used as an actual trading tool this meter may serve as a conversation piece. Hopefully from these discussions more of your friends will realize their fiat currencies have a perpetual downward trajectory and that viable and better alternatives exist.
Should the market not be where you want it to be, we have a fix. Thanks to parallax, you can always shift your head to the left and the needle will indicate a few more dollars. Though not an accepted day trading strategy, the head shift can be useful to calm your nerves on highly volatile dips.
This project uses the "flawed" arduino map function. This function uses integer math and is known for not behaving as you would hope for interpolating input values to mapped outputs. Fortunately the analog meter isn't particularly accurate so we used it for brevity. Again with the market being extremely volatile it is not a significant issue. Win some, lose some. HODL may be the best strategy.
Through empirical testing we discovered 3K ohms to be the ideal inline resistor to limit current for the PWM circuit. Fortunately you can use 3 1K resistors from your parts bin in series. This would suggest about 3V being delivered to the meter thus 3000Ohms/3V = 1mA.
A particle function is also added for easy test of the needle values. A big thanks to the particle developers for finally adding a way to call functions from the particle console webpage.
Once you load the code, you need to create a webhook on the particle cloud. This is done in the particle console.
I discovered that the cryptocompare website had the easiest to use API and it supported most significant currencies and conversion to your desired reference currency.
This project is very easy to modify to pull values for other currencies. It is also easy to change the converted to currency. If you want the value of BCH in ETH, no problem.
Comments
Please log in or sign up to comment.