Monthly Archives: February 2015

Controlling a Dollar Store Solar Dancing Elephant

By now you’ve almost certainly seen those little dancing toys that move when their solar cell gets illuminated. The things fairly well litter the “everything in here is yours for just one stinking dollar” stores. I’m not going to disparage them as toys – to be honest with you, I think some of them are pretty entertaining.

Then again, when have I ever not dismantled one of my toys?

The goal here is to take a solar dancing elephant and hook it up to a computer. When something interesting happens in reality, the elephant starts wagging its ears up and down. I had thought about using it as an email alarm, but that’s just depressing. Instead, I think I’ll scrape the current weather off of the NWS and make it dance in response to something like temperature or rainfall rate. Elephants should get excited when I rains, I guess.

Step one is to crack the elephant open. What really bothers me is that some day, someone is going to arrive on this page after they googled exactly that phrase. Crack the Elephant Open. The mind boggles.


Anyway, with your elephant nicely bisected, note that the solar cell and some electronics are in the top half of the shell, and the lower half of the widget is all moving parts. The ears are pretty finely counterweighted.  It doesn’t take much force to get them moving. This is a good thing because that solar cell isn’t going to make a lot of power (milliwatts, maybe? ) and the electromagnet that it operates isn’t very big. Incidentally, the astute observer will note that there is a tiny, tiny bare die chip under epoxy on the circuit board, and that the coil is connected to it through something that looks like 40ga wire – aka “man! that’s some awfully fine wire there!” So do be careful.  If you break that wire, you’re pretty much out your one dollar.


Next step – clip the wires right at the solar cell (red one is positive, natch) and connect a long-ish two conductor wire to each of the leads going to the board. This is what you need to power your elephant. The cell on there makes about half a volt, but I’ve put five volts across the circuit with no ill effects. Evidently, the design has some wide tolerances. 🙂

Final step – connect the wires to the ground (pin 18 was as convenient as any) and to a data pin (pin 2 is the least significant bit) on a connector for a parallel port. I added a parallel 100 ohm resistor that I really didn’t need, but I figured it might help the elephant live longer. Then finally all you have to do is find an old-school laptop with a parallel port and plug it in. A few lines of C, and voila!  You’re (announcer voice) controlling elephants from Linux.  And seriously, once you’ve done that, the rest of your day is going to be all downhill.


Controlling things comes down to manipulating the parallel port (and no, this will not work through a USB-to-Parallel converter).


void main(int argc, char **argv){
unsigned int value=0;
if (argc > 1) {


int port=/*  0x378 */ 0x3bc;
int res = ioperm(port,5,1);  /* allow access to io port plus next 5 addrs */

And that’s all there is to it.