Introduction: Faraday for Fun: an Electronic Batteryless Dice

There has been a lot of interest in muscle powered electronic devices, due in large part to the success of Perpetual TorchPerpetual Torch, also known as battery-less LED torch. The battery-less torch consists of a voltage generator to power the LEDs, an electronic circuit to condition and store the voltage produced by the voltage generator and high efficiency white LEDs.

The muscle powered voltage generator is based on Faraday's law, consisting of a tube with cylindrical magnets. The tube is wound with a coil of magnet wire. As the tube is shaken, the magnets traverse the length of the tube back and forth, thus changing the magnetic flux through the coil and the coil therefore produces an AC voltage. We will come back to this later in the Instructable.

This Instructable shows you how to build an electronic, batterless dice. A photograph of the built unit is seen below.

But first some background --->

Step 1: An Electronic Dice

Instead of a traditional dice, it is nice and cool to use an electronic dice. Usually such a dice would consist of an electronic circuit and a LED display. The LED display could be a seven segment display that could display numbers between 1 and 6 as seen below or perhaps, to mimic the traditional dice pattern, it could consist of 7 LEDs arranged as shown in the second figure. Both the dice designs have a switch, which the user has to press when she/he wants to "roll the dice" (or "roll the die"?). The switch triggers a random number generator programmed in the microcontroller and the random number is then displayed on the seven segment display or the LED display. When the user wants a new number, the switch has to be pressed again.

Step 2: Power Supply for the Dice

Both the designs shown in the previous step need a suitable power supply which can be derived out of a wall wart, a suitable rectifier, smoothening capacitor and an appropriate +5V regulator.

If the user desires portability of the dice, then the wall wart transformer should be replaced with a suitable battery, say a 9V battery.

Other options for the battery exist, for example, to be able to operate the dice from a single AA or AAA battery, a normal linear regulator will not work.

To derive +5V for the dice operation, a suitable boost type DC-DC converter must be used. Figure illustrates a +5V power supply suitable for the dice operation from a wall 9V battery and the other figure shows the schematic for a +5V power supply from a 1.5V AA or AAA type battery using a TPS61070 boost DC-DC converter.

Step 3: Free Power: Use Your Muscles...

This step describes the muscle powered voltage generator. The generator consists of a Perspex tube of 6 inch length and an outer diameter of 15 mm. The inner diameter is 12 mm. A groove of about 1 mm deep and 2 inches long is machined on the outer surface of the tube. This groove is wound with about 1500 turns with 30 SWG magnet wire. A set of three rare-earth cylindrical magnets are placed in the tube. The magnets are 10 mm in diameter and 10 mm in length. After inserting the magnets in the tube, the ends of the tube are sealed with circular pieces of bare PCB material and glued with a two part epoxy and with some shock absorbing pads inside (I used IC packaging foam).

Such a tube is available from McMaster (, part number: 8532K15. Magnets can be bought from Part # D375D.

Step 4: Voltage Generator Performance

How well does the muscle power voltage generator work? Here are some oscilloscope screen shots. With gentle shakes, the generator provides about 15V peak to peak. The short circuit current is about 680mA. Quite sufficient for this project.

Step 5: Dice Schematic

This step shows the circuit diagram for the dice. It consists of a rectifier diode bridge circuit to rectify the AC voltage produced by the Faraday generator and filtered with a 4700uF/25V electrolytic capacitor. The capacitor voltage is regulated with a LDO, LP-2950 with a 5V output voltage, which is used to provide supply voltage to the rest of the circuit, consisting of a microcontroller and LEDs.

I used 7 high efficiency 3-mm blue LEDs in transparent packaging, arranged in the ‘dice’ form. The LEDs are controlled by an 8-pin AVR microcontroller, the ATTiny13. The voltage output from the faraday generator is a pulsed output. This pulsed output is conditioned with the help of a resistor (1.2KOhm) and a Zener diode (4.7V). The conditioned voltage pulses are sensed by the microcontroller to determine if the tube is being shaken. As long as the tube is shaken, the microcontroller waits. Once the user stops shaking the tube, the microcontroller generates a random number, using an internal 8-bit timer operating in free running mode and outputs the random number between 1 and 6, on the output LEDs. The microcontroller then again waits for the user to shake the tube again. Once the LEDs display a random number, the available charge on the capacitor is sufficient to light the LEDs for an average time of about 10 seconds. To get a new random number, the user must shake the tube a few times again.

Step 6: Programming the Microcontroller

The Tiny13 microcontroller operates with an internal RC oscillator programmed to generate128KHz clock signal. This is the lowest clock signal that the Tiny13 can generate internally and is chosen to minimize the current consumed by the microcontroller.

The controller is programmed in C using the AVRGCC compiler and the flow chart is shown here.

The fuse bits for the controller are also shown here.

I used STK500 to program my Tiny, but you can refer to this Instructable if you prefer an AVR Dragon programmer:

Step 7: Control Software

/*Electronic battery Less Dice*/
/*Dhananjay Gadre*/
/*20th September 2007*/
/*Tiny13 Processor @ 128KHz internal RC oscillator*/
/*7 LEDs connected as follows
LED0 - PB1
LED1, 2 - PB2
LED3, 4 - PB3
LED5, 6 - PB4

D3 D2
D5 D0 D6
D1 D4

Pulse input from coil is on PB0

#include <avr/io.h>
#include <util/delay.h>
#include <avr/interrupt.h>

const char ledcode[] PROGMEM= {0xfc, 0xee, 0xf8, 0xf2, 0xf0, 0xe2, 0xfe};

unsigned char temp=0;
int count=0;

DDRB=0xfe; /*PB0 is input*/
TCCR0B=2; /*divide by 8*/
TCNT0= 0;

PORTB=254; /*disable all LEDs*/

/*wait for pulse to go high*/
while ( (PINB & 0x01) == 0);

/*wait for pulse to go low*/
while ( (PINB & 0x01) == 0x01);

while ( (count > 0) && ((PINB &0x01) ==0))

if(count ==0) /* no more pulse so display a random number*/

PORTB=0xfe; /*all LEDs off*/

temp= temp%6;
temp =pgm_read_byte(&ledcode[temp]);



Step 8: Assembling the Circuit

Here are some pictures of the assembly stages of the electronic dice. The electronic circuit is assembled on a perfboard narrow enough to go in a perspex tube. An identical perspex tube as used for the voltage generator, is used to enclose the electronic circuit.

Step 9: Completed Assembly

The Faraday Voltage generator and the electronic dice circuit are now connector together, mechanically and electrically. The output terminals of the voltage generator tube are connected to the 2-pin input connector of the electronic dice circuit. Both the tubes are tied together with a cable tie and for extra safety, glued together with a 2-part epoxy. I used AralditeAraldite.

Step 10: Using the Batteryless Electronic Dice

Once the assembly is complete and the two tubes are secured together, the dice is ready for use. Just shake it a few times and a random number would appear. Shake it again and another random comes up. A video of the dice in action is here, also posted in this Instructables video:

Step 11: References and Design Files

This project is based on my previously published articles. namely:
1. "Power Generator for Portable Applications", Circuit Cellar, October2006
2. "Kinetic Remote Control", Make:, November 2007, Issue 12.

The C source code file is available here.

Since the project was first prototyped, I made PCB using eagle. Here is how it looks now. Eagle schematic and board files are here. Please note that compared to the prototype, the components on the final PCB are arranged slightly differently.

Update (15th September 2008): BOM file added

Step 12: I Know You Want More

An electronic dice with just one display? But I play many games that needs two dice you say. OK, I know you want that. Here is what I have been trying to build. I have the PCB for this newer version ready, just waiting for some free time to complete the code and test the board.

I will post a project here once it is complete...

Till then enjoy the single dice..


thefilipinoexperimenter (author)2016-01-12

I'd like to know if this circuit can use very large valued capacitor, say 0.47 F. Will it be able to run longer before shaking it again?

azizs1 (author)2014-11-26

hi...may i know how many turn coil do you use......

50h9j (author)2012-03-19

This sounds impressive, but I am worried that the 15V is measured on an oscilloscope with high impedance and the current is measured on a short circuit, i.e. very low impedance. This flatters both measurements and gives no indication of actual power produced, particularly not sustained or average power over the cycle.
I have been looking at student wavepower converters that use such devices and I can't help thinking they are very low efficiency. This is reinforced by not finding any commercially designed machines with Faraday linear generators, of whatever they are called.
I would be interested if you could estimate the mechanical power input to your device and the electrical power output and come up with an efficiency. One way would be to power the device from an electric motor and mechanism of known efficiency.

Sparklesam (author)2009-01-10

The project is really cool, but u call it a batteryless dice. Real dice don't have batteries. Its a really cool idea, but what's the point when you can just use real dice?

frenzone (author)Sparklesam2009-02-01

-.- ... guess we'll call it batteryless electronic dice. as most of the things on this site the point is ... just doing it!

Gadre (author)frenzone2009-02-01

You could look at it this way: a traditional dice is batteryless. An electronic dice is not batteryless and this is a batteryless electronic-dice.

Earths_hope (author)Gadre2010-12-18

But no, a capacitor is a battery of sorts, so this is not batteryless

static (author)Earths_hope2011-09-14

Respectfully, I know it has become popular to erroneously to refer to a battery, when they are completely two different items. Popular doesn't equal "battery of sorts", so this project use no battery. Yes it's "batteryless"

Sparklesam (author)frenzone2009-02-01

ur right. cool project gadre

wize (author)Sparklesam2009-03-07

It's cooler. And it's electronic and batteryless. Its not just batteryless.

Gadre (author)Sparklesam2009-01-17

OK :)

shylock (author)2008-10-10

I have batteryless dice, they are cube-shaped with dots on them. ; )

stevenbelieven (author)shylock2008-10-29

cube batteryless dice?? i would pay respect to see

Gadre (author)stevenbelieven2008-10-29

Yes, cube shaped battery-less dice. This is what Shylock is referring to. Photo from wikipedia dice.

static (author)Gadre2011-09-14

Those are "analog" die. ;)

stevenbelieven (author)Gadre2008-10-29

led to this application hahahaha it was all about led AS THIS MY GAME ON A LARGE SCALE !!! IN ASIA PEACE STEVENBELIEVEN4NOW

Gadre (author)shylock2008-10-10

Indeed. But it aint electronic!

nanosec12 (author)2011-08-26

Wow, just Wow....this is one of the best written instructibles I have ever read, and well documented with pictures as well. I love that you went into the history and theory, instead of just writing up a 'how to' Thanks

5 of 5 of course.


Gadre (author)2011-06-04

This and other 34 projects are now available in a book, published by McGraw Hill International: TinyAVR Microcontroller Projects for the Evil Genius.

noaddict (author)2011-01-13

Why don't you lock 2 magnets on the end of the tube and let the one in the middle to do the job? So you won't "crash" the magnets every time you roll.

revfnord (author)2010-10-07

I would love to make one of these inside a magic 8 ball with blue LEDs!!!

Love the tutorial, great job!

jornie (author)2010-09-03

how much is this worth if i would buy all the stuff?

knightowl (author)2010-08-07

Awesome build. Going on my "to make" pile for sure. also, good luck getting that thing through airport security.

sandman99 (author)2010-06-19

what does it do

godofal (author)2009-12-27

im olmost done!
but i forgot to order the pulse detector  diodes >.<
and i still  need to wrap the tube with that copper wire...

but i have the rest ready :)

Gadre (author)godofal2009-12-27

You could use normal rectifier diodes too (1N4001) without any problem. Give it a try.

godofal (author)Gadre2009-12-31

well, i dont have a big lab :D
i have a 3 sorts of stuff lying around; resistors, capacitors, and LEDs

for the rest, i need to order everything if i need some specific thing...

Kidogo (author)2008-09-21

is the uF important?

Axaj (author)Kidogo2009-12-02

Yes, very important.  Sparkfun has a 10F (10,000,000 μF!) 2.5 volt capacitor for ~$5 (wire two in series for 5F, 5V).  I would highly recommend that.  But on a side note, I'd like to point out that dice is plural, while die is singular.

Gadre (author)Kidogo2008-09-21

A higher uF will keep the dice showing the number for a longer time. I have not tried with a capacitor smaller than 4700uF, but it would work anyway. I tried the 4700uF capacitor with my dual dice and it works for much smaller time.

Iridium7 (author)2009-05-27

do these things just pick any random number or something?

microman171 (author)2009-04-07

Nice work :-) I like the way you have sorted out the 2 dice version. Will you be rapidly changing between the two displays (POV making it seem as though two dice) or one at a time? If magnet wire wasn't so expensive and hard to find in New Zealand, I would try this for sure! Would most likely use a PICAXE instead as that is what I use. Keep it up mate!

DIY Dave (author)2009-02-18


cyborn95 (author)2009-02-07

This project is awesome but things need to be more descriptive. When building the circuit, I see resistors but you just call the resistors a pulse detector. I would like to build it but building the circuit is just too complicated. Also, in the intro you should put a complete list of what we need to build it.

Andruha1123 (author)2008-10-18

hi, it seems as you know what you are doing. I'm pretty new to this and have a question. Can i use yellow wire instead of the red one(magnet)? And do i have to use rare earth magnets? i bought (N42, Dia 3/8"X1/8", Axially Magnetized. Ni+Cu+Ni plated.) these magnets, would they work at all???thanks, looking forward to your answer, really wanna make this.

Gadre (author)Andruha11232008-10-18

1. By yellow wire you mean the insulation on the wire is yellow in color? If that is the case, then it would work just fine. 2. Your magnets are fine. Just make sure that the diamater of your magnet and the inner diamater of the tube onto which you are winding the coil are compatible. While the magnets shoudl slide freely inside the tube, having too much gap is not advisible. Good Luck!

alexgeek (author)Gadre2009-01-17

Where can this wire be bought? Does it have to be insulated or can it be bare metal wound around? Is this type of wire in any household equipment that i could rip apart and scavenge? Thanks :)

Gadre (author)alexgeek2009-01-17

It has to be insulated. You can perhaps salvage such wire (make sure that the insulation is intact) from motors, transformers in mixers, grinders and other household equipment. Goodluck!

alexgeek (author)Gadre2009-01-17

Thanks! If not, do many places sell it relatively cheap? Not found many good sites that sell it. Cheers.

Andruha1123 (author)alexgeek2009-01-17


Andruha1123 (author)alexgeek2009-01-17


Andruha1123 (author)Andruha11232008-10-18

here is the website and the specific magnet i bough, i'm thinking this would help. i bought 4 of them.

basqueman (author)2008-12-05

This looks awesome. I am all ready to go, but I'd like to get a PCB. Where should I go to order the PCB? If you ordered your through Eagle Circuits, can your board be recreated from the original order? I have never done this before.

Jeebiss (author)basqueman2008-12-25

Thats just a generic piece of PCB, or perf board. He just used jumpers, and solder bridges to create the circuit.

cedtlab (author)Jeebiss2008-12-26

Yes, Initially a perf board was used but subsequently, I got PCBs made, you can see images of the PCB on the last page.

joinaqd (author)2008-12-25

awesome job dude...i had a flashlight like that..u gotta shake it to charge the 36mAh battery which powers a white led..good job!!

Carlos Marmo (author)2008-10-30

Wonderful work! Much Style! Congratulations!

Andruha1123 (author)2008-10-19

one more question, does it matter how long the coil is? i know you said 1500 turns, does it mean i can go the full length of the tube, of do i wind like an inch or 1 1/2 in the middle? thanks.

Gadre (author)Andruha11232008-10-19

Please allow enough margins at the tube ends so that the magnets can fully come out of the coil.

bhunter736 (author)2008-09-26

Great Build! I want to make one. : )

About This Instructable




More by Gadre:Instant Noodles OmeletteHow To Make an Illuminated LED Eye LoupeFire-free LED Matchstick
Add instructable to: