my finished gloglobe uses a 3" styrofoam ball as the outer casing. The electronics shown below as well as a small battery are shoved up into the ball. It turns out that a Sharpie makes the right size whole for the globe assembly to fit into and the styrofoam does an amazing job of mixing the colors into a uniform glow.
This project has been moved to the attiny26 AVR and the code has been rewritten in C. I have made the move to AVRs for better linux support.
If you ever read Dune (better yet The Butlerian Jihad) you might already know what this is - if you didn't then read on. The GloGlobe was a device that could be tuned to any color in the visible spectrum and created it's own suspensor field which provided the user with soft interior lighting that didn't need to be physically mounted anywhere (because it just floated wherever you put it). My GloGlobe unfortunately doesn't levitate and that is beyond the scope of this project so it never will levitate I'm afraid.
here is a gloglobe hanging in the window utilizing the Holtzman Effect to create a suspensor field and illumination. |
these do not have a styrofoam ball over them hence the bright spot
theory of operation
computers use red, green, and blue to create all the colors you see on your screen so I should be able to produce a similar effect with red, green, and blue LEDs driven by a PWM signal. To create a purple light the duty cycle of each color would be something like:
- red : 70%
- green: 0%
- blue: 50%
T |==========|==========| 2 Timer Cycles
R |=======|--|=======|--| Red is on 70% or the time
G |----------|----------| Green is always off
B |=====|----|=====|----| Blue is on 50% of the time
= logic HIGH
- logic LOW
| timer overflow marker (timer=0)
Only 2 clock overflow cycles are shown but this is actually happening a few thousand times a second. It effectively controls the brightness of each color LED. This is the standard way that PWM is used to control LEDs, motors, or other analog devices. The same effect could be achieved with a DAC and varying the output voltage to each LED. In this case PWM requires fewer components and works equally well.
I bought some 3" styrofoam balls at the party store and poked a hole in them with a sharpie marker. I made the hole just deep enough to put the LED at the center of the sphere. I then jammed the ATtiny/LED circuit down the hole so that just the power cable dangles out of it.
i found some tri-color LEDs on ebay so i know have RGB all in one package. The timing pulses are generated with an ATtiny26 and some very simple C code. All this really needs is the tricolor LED and the AVR but I added a few other components for completeness. The capacitors filter any AC component out of the power input so the power supply doesn't need to be squeaky clean. The pullup resistor on the /RESET isn't strictly required either but can't hurt. The AVR, by default, setups the ports as inputs with pullups so adding another pullup does nothing in this case.
the tricolor LED wasn't as diffused as I would like so i used sandpaper to rough up the surface of the LED. This acts to scatter the colors in random directions so that they mix better. It is not perfect but works pretty well. I made a small modification to the startup code to allow multiple globes to run off the same power source but display different colors. The AVR is setup with the upper nibble of PORTA as inputs with pull-ups. By adding a pull-down resistor to PORTA.5, A.6, or A.7 the gloglobe will initialize to a different color. Using no pull-down resistors initializes the gloglobe to the original color (#00FFFF), thus 4 unique initial states are possible currently. This also required a small modification to the circuit. My actual hardware doesn't use the switch shown in the schematic but rather a single resistor hardwired to PORTA5, 6, or 7.
This device needs 5V @ 50mA for the LED to be nice and bright. The gloglobes in the window run off a 5V wall wart and the portable version runs off of a button cell battery using a MAX756 to step up the voltage. I'm working on a desktop version that will be powered via USB since USB2 can source up to 500mA. A current limiting resistor will be put inline with VCC so reduce the risk of blowing my USB ports.
You can most likely make this from junk you have laying around. If not the parts are still pretty cheap.
- ATtiny26 (free to sample from Atmel, $2.50 from digikey)
- 2.2K Resistor (1k-100k is fine), optional - this can beused to set the initial color but is not required
- 0.1uF Cap
- 10uF Cap
- RGB LED ($1 on ebay)
- 3" Styrofoam Ball (<$1 at crafts store)
Each gloglobe requires 5V @ 50mA, provide at least 100mA to be safe. The AVR does get a little warm but not hot and definately touch safe.
The code originally used timer hardware interrupts but eventually moved into software driven clocks. there are no strict timing requirements for this project so it doesn't really matter, just be aware of it.
The code creates 3 PWM signals per LED that are controlled by a master clock. The width of the whole signal is 8 bits and the trigger point for each color can be anywhere in that range from 0 to 255. The code turns on each color and then enters a loop. The loop checks to see if the trigger point has been reached for each color. If it has than that color signal is turned off until the clock overflows and the process is started again. It is impossible for a color to have a 0% duty cycle because when the master timer overflows all lights are turned on the difference between 0 and 1 is essentially nil.
The 'master clock' is an 8 bit register that is incremented everytime a timer interrupt occurs. The 3 PWM channels use this clock to set their state during the ISR - the overhead of software PWM throws the timing off a little but it doesn't effect this application.
I made a color incrementing function because the colors dont move as nicely through the color wheel just by incrementing the R G and B counters. The color incrementer moves through a state machine moving from red to orange to yellow... (aka ROYGBIV, thanks Bill Nye).
the main application slowly loops through the color wheel. the original intention was to allow the user to set the color (like the 'real' gloglobes) however i changed gears and have the gloglobe automagically cycle through the colors slowly.
| 24bit_color.h || simple state machine to move through the color wheel in RGB |
| gloglobe.c || main application, software delays rather than hardware timed |
| gloglobe.tar.gz || all avr-gcc project files for the gloglobe |
netstatic is excited about this project so i will make a simple serial interface into it and maybe use an ftdi chip for USB - thus power and communications can be in the same ubiquitous cable. My gloglobe would then basically be this
. Guess I wasn't the only one who wanted a gloglobe...
this project would likely be best done with a attiny25 given that it has a USI (universal serial interface) built-in and is a buck cheaper than the tiny26. I2C is another option and allows for a network of them. I can also see a wireless mesh network of them being interesting. We'll see what happens as time goes on.
| command || effect |
| 'f' || freerunning more - slowly cycle thru the colors; default mode at powerup |
| 's' || set mode, 's' is followed by 3 bytes, an R,G, and B value to set. This exits freerunning mode |
- 17 Mar 2006