Bandwidth Dragon¶
Once upon a time a store called Spencers Gifts existed. I think it probably still does, but malls don't exactly exist in my mind anymore. When I was a teenager, I was a bit of a mall rat due to an addiction to Pump It Up. Since I had a (small) disposable income as a teenager with a job and a car, I had the pleasure to buy strange things. I am also a bit of a nerd, so I got a dragon lamp.
I used to take this thing to a local LARP (yeah, that much of a nerd) and hang it on the wall as a mood light.
Here's a photo of the dragon today:
One thing to note, the lamp part of this dragon is completely redone. I wanted an art project to flex my creative bone and that's what this project is about.
What is it?¶
I found this dragon in a box when moving into my new house. After opening the globe-like lamp to replace the bulb, a thought went through my mind. "Why would you use a tiny christmas light in this thing?" A friend introduced me to neopixels LED's in the past and I wanted to use one to make this globe really shine.
Hardware¶
I needed a way to use a raspberry pi zero w and a neopixel ring together. Because +5V is native to the raspberry pi, the 3V data path the neopixel ring operates on requires a level stepper to accomplish and properly address each light in the array. Lucky for me, the chip shortage didn't start yet so I got a few from adafruit.
Build requirements:
- 74AHCT125 - Quad Level-Shifter (3V to 5V) (1)
- 5V 4A (4000mA) switching power supply
- NeoPixel Ring - 12 x 5050 RGB LED with Integrated Drivers
- Breadboard
- Flux
- Solder
- Soldering Iron
Wiring Diagram¶
Once I had all the hardware, the wiring was pretty simple:
From: https://learn.adafruit.com/neopixels-on-raspberry-pi/raspberry-pi-wiring
I soldered the components together and stuffed a raspberry pi zero w inside as the brain of my little dragon friend.
I have a functioning linux lamp, now what?¶
Now that I have everything together I need to create an application to control the lights. Recently, I had equipped the home network with a Ubiquity Dream Machine Pro (or UHD for now on). The UHD can run docker (actually podman) containers quite easily and netdata provides an API to get data back. With those things known, the decision is easy. This lamp will monitor my bandwidth!
Now that I am thinking back on it, I should have made it react to the weather. Maybe for a future project...
The Code¶
From: https://github.com/f0rkznet/odahviing
odahviing.py
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 |
|
Conclusion¶
I was happy how this turned out. Now that I am thinking about this project in retrospective, I think I want to create another script that will change the lighting based on the current weather conditions and time. I'll post more about it when the development starts!