A "clock" showing the current, near-real time price of 1 month oil futures. The point is to get a feeling for the dynamics of the oil futures price, not the exact value. The clocks hand is , of course, a plastic dino, even though according to XKCD there are only homeopathic amounts of dinosaurs in plastics.
It is set in its natural habitat near the map of the Port of Rotterdam, directly above the BPs and SHELLs oil storage area.
Video of the clock in action, setting a price around 48 $/barrel.
Because we can, I guess? But slightly more seriously, this is the second installment of the "Making the invisible socio-technical systems around you visible" theme. The first part was the Grid balance lamp showing the very dynamic nature of the high-voltage electricity transport grid. Oil price is another one of those abstract things that everybody talks about, but is quite had to get a sense of. Crude Oil is still the lifeblood of our civilization. Roughly 95% of the global production goes into energy production as fuels. The rest is used to chemicals, plastics etc. It therefore an extremely important resource that dominates global geopolitics. Its price reflects traders expectations about the future, based on demand changes and political tensions. It is also extensively gamed using various energy derivatives
I am interested in the expectations about the future that are signaled through oil price, and do not care about people playing with fictional money. Therefore I decide to focus on the oil futures price instead. Oil futures are "a standardized forward contract, a legal agreement to buy or sell something at a predetermined price at a specified time in the future" While they are not immune to gaming, they do offer a slightly more realistic perspective on future expectations, as they are contracts for actual transactions.
A python script reads the JSON from the web, and posts the price to a MQTT server operating at Revspace. The microcontroller in the clock is subscribed to the MQTT feed, and upon reception of a message sets the clock in the right position. The clock is a stepper motor, with start and end switch. It has a known number of steps between them, and scales the position of the dial, scaled from 0 to 50. The three LEDs display the current price range,
- 0-50 $/barrel - Green
- 50-100 $/barrel - Green, Orange
- 100-150 $/barrel -Green, Orange, Red
The dial is a shortened door handle, attached to the motor axis, and a plastic toy dinosaurus is tiewrapped to the handle. The face is the top 10cm of a 60 l engine oil drum, with the necessary holes drilled for the motor mount, axis and LEDs. The whole thing runs on 24V, which is stepped down to 5V for the micro controller. The motor is locking, which is also supported by the controller. However, it makes a slight but very annoying while, which makes it unsuitable for placement in an office. Therefore a highside power switch is added, and the software turns the controller and motor on/off when needed. This also cuts the power consumption significantly. The worm-gearing is so strong that you would more likely break the gear before turning the motor, so no problem with the light dial sagging.
CME group offers delayed market information for free.
Alternatively, Quandl offers other interesting oil data as well :
- Daily price of OPEC Crude Oil basket
Hardware component list
The back of the clock, with all the gory innards exposed.
The following components are present:
- EPS 8266 micro controller
- Motor driver
- BTS 432 E2 Highside power switch
- 1:49 Worm-gear reduced stepper motor
- 2 x Microswitch
- 24V -> 5V stepdown converter
- Logic level converter
- 3 x APA102 LEDs
The wiring is a mess, but quite simple. Power enters, is connected to the high-end switch, controlled by the microcontroller, which is powered by the stepdown converter. LEDS and motor are wired as expected, as are the end switches, which are NO, and close to ground. Observe the logic level converter on the protoboard. It is necessary as the EPS8266 delivers 3.3 V on the pins, and the motor controller requires 5V for its logic.
The top of the oil barrel that will become the face of the clock, with the end switch holes drilled
The stepper motors and the worm gear assembly. I bought two, the left one came with incorrectly toothed internal gear. To my great surprise the seller was very responsive and sent a replacement quickly.
The end switches, fixed using unholy amounts of hot-glue. This is a relatively fragile setup, as the position of the dinos head has to be precise, in order to press the end switch.
I spent quite some time thinking about how to connect a stiff right angle dial to the clock. I was massively over-engineering it, when I noticed a door handle laying on the free-stuff table. And the shaft diameter matched perfectly! A few holes a two tie-wraps later, we have a dino-dial!
The code is in my small projects github repository. The Python code parses the JSON, and posts the data to internal Revspace MQTT server](https://revspace.nl/Mqtt), which is then exposed publicly. The arduino C++ script subscribes to this feed and then converts the price to location and LED status.
If you made it this far through the blog post, you are awesome (or bored), so you deserve a kitten performing quality control: