Brad Hakes, Designer HRI - Education - Biodesign
Robot Reveals
Orbweaver
Bandsaw Learning
Sparks Rowing
Pandora’s Box
DIY Bio
Drawing
Writing
About
Robot Reveals
Orbweaver
Bandsaw Learning
Sparks Rowing
Pandora’s Box
DIY Bio
Drawing
Writing
About
Pandora’s Box
Backlit box that changes with the VIX volatility index
Backlit box that changes with the VIX volatility index
This back-lit box changes brightness and blink rate based on the VIX volatility index (a loose proxy for chaos), using data from the twelvedata API. I created two versions of the container (images below).
The project served as a personal proof of concept. I find the world’s increasing complexity daunting and fascinating—my hope is functional totems like this might enable more intuitive, accessible, and playful relationships with the immense impersonal systems that influence our lives.
A friend recommended the API, provided feedback on the appearance, and looked over my wiring. I also used this raspberry pi tutorial by David Ordnung and varied stack overflow Python discussions.
This wildly circuitous Python script regularly retrieves a VIX index value and updates brightness and blink rate of the backlight:
#!/usr/bin/python3
import pigpio
import json
import requests
from time import time, sleep
import threading
pi = pigpio.pi()
vix_high_threshold = float(40)
def keep_vix_fresh():
while True:
vix_response = requests.get("https://api.twelvedata.com/time_series?symbol=VIX&interval=1min&type=index&format=JSON&apikey=31b54183c6644cfa86461678609b613a")
vix_response_json = vix_response.json()
latest_vix = vix_response_json['values'][1]['close']
global vix
vix = float(latest_vix)
sleep(20)def blink(low_duration):
pi.set_PWM_dutycycle(24,vix_pwm/2)
sleep(low_duration)
pi.set_PWM_dutycycle(24,vix_pwm)global vix
vix = float(0.0)
threading.Thread(target=keep_vix_fresh).start()while True:
if vix > 0:
break
sleep(0.1)vix_pwm = (vix/vix_high_threshold)*255
blink_increment = 60 / (vix*2)
pi.set_PWM_dutycycle(24,vix_pwm)while True:
blink(1)
sleep(blink_increment)