Crypto Fear and Greed Index desk trinket project

Share this:

With the crash of the crypto market the other week, I couldn’t resist the urge to jump back in—stacking a handful of tokens on the cheap. This, along with the unopened box of LEDs sitting on the desk in front of me, got me thinking about a little weekend crypto-related Arduino project.

Now that I’ve got some skin back in the game, it makes sense to keep closer tabs on market sentiment—and what better way than with a physical Fear and Greed Index indicator dial for my desk?

What also appealed to me about this project was it’s simplicity. I wasn’t looking for something multi-weekend to get lost in, I wanted a quick and easy project to keep me occupied—so here it is, my weekend.

Behold it, in all it’s potato-cam glory.

What you’ll need

  • 9 x LEDs (3 x Red, 3 x Yellow, and 3 x Green)

  • 10 x 100 Ohm resistors

  • 1 x NPN 2N2222 transistor (or similar)

  • 1 x SG90 micro server

  • 1 x Nodemcu

  • …plenty of jumper wires!

Wiring guide

The LEDs are wired up in parallel, using an NPN transistor to make a simple LED driver circuit using a single GPIO pin (D5 – GPIO 14), connected to the transistors base, and the micro servo is wired up to D4 (GPIO 2).

All this electronics stuff is still new to me, so when it comes to resistors, I’m relying mostly on trial and error, finding that the 100 Ohm resistors can we the best in terms of desired brightness. Any tips or pointers are always welcome in the comments!

The wiring diagram below should give you everything you need to get it up and running.

Project wiring diagram

The code

The code is pretty simple. It performs an HTTP GET request to the Crypto Fear and Greed Index API endpoint provided by—the API documentation is available here for reference.

The response is then parsed using the ArduinoJson library, taking the “value”—which is used to calculate the servo position—and “time_until_update”—which is used to create a delay, so that the next request will be performed when the index is next updated, which happens daily.

That’s it really—not much else to it. You can see the code below, or you can download the .ino file here. Don’t forget to edit in your own network SSID and password.

#include "ESP8266WiFi.h"
#include <ESP8266HTTPClient.h>
#include <ArduinoJson.h>
#include <Servo.h>

const char* ssid = "YOUR_NETWORK_SSID";
const char* password = "YOUR_PASSWORD";
const char* host = "";
StaticJsonDocument<300> doc;
Servo servo;
int ledPin = 14;
int servoPin = 2;
int servoPos = 0;

void setup()
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
  Serial.println("WiFi connected");
  servo.attach(servoPin, 500, 2400);
  pinMode(ledPin, OUTPUT);
  digitalWrite(ledPin, HIGH);

void loop() {
  HTTPClient http;
  WiFiClientSecure client;
  client.connect(host, 443);
  http.begin(client, host);
  String payload;
  if (http.GET() == HTTP_CODE_OK)    
    payload = http.getString(); 
    DeserializationError error = deserializeJson(doc, payload);
    if (error) {
      Serial.print(F("deserializeJson() failed: "));
    String value = doc["data"][0]["value"];
    String nextUpdate = doc["data"][0]["time_until_update"];
    servoPos = abs((value.toInt() * 1.8)-180);

The model

The model is printed in four separate parts—LED ring, stand, a base to hold the servo, and the hand. Each of these pieces snap together. I made it this way as I was designing it on-the-fly, instead of planning ahead—so revisiting and revising it in the future is on my to do list.

Of the three pieces, the least “complete” is the servo base/mount—which needs a lot of work. Right now, it just slots in, which was good enough at this stage, but any future revisions will need to include holes to properly secure it with screws. I’d also like it to have a better viewing angle, as despite a bit of a lean backwards, from the perspective I have in my office chair, it still stands a little too straight for my liking.

The quality of the print wasn’t all that great, but that’s mostly because I was prototyping, looking for quick and dirty, rather than printing for quality. If you decide to make one yourself, I’d recommend lowering the print speed, especially with how small it is.

You can download the .STL files for the model here.

Model front view
Model back view

Summing it up and next steps

When I started this project, I was looking for something that would make use of the untouched box of LEDs I had on my desk—however, and in hindsight, I think incorporating them into the design is a mistake. The LEDs are little more than decoration, offering no real value to the finished product.

Given that, I think I’ll remake the design without them—replacing the LEDs with a modified, 3-part ring printed in red, yellow, and green PLA. This will serve the same purpose, while saving on all the extra wiring that will be difficult to tuck away and conceal without a major overhaul of the current design.

Another thing I’d like to do is switch out the Nodemcu for something smaller, like a D1 Mini ESP8266 or similar, which would allow me to keep the same form factor while keeping it out of sight. Sure, there would still need a bit of a redesign, like adding more height to the base giving me somewhere to tuck it away, but the change should be minimal.

This also gives me the opportunity to include a few of the other tweaks or improvements I want to make to other aspects of the model that I’ve already mentioned, like it’s angle and designing a proper servo mount for the base.

Well, that’s all for now folks. Let me know your thoughts and any feedback in the comments. Thanks!

Share this:

Leave a Comment