Summary of Faraday For Fun: An Electronic Batteryless Dice using Microcontroller ATTiny13
This article details the construction of a battery-less electronic dice powered by muscle energy. Using Faraday's law, shaking a magnet-filled tube generates AC voltage, which is rectified, stored, and regulated to power an ATTiny13 microcontroller and LEDs. The system detects shaking via voltage pulses, waits for motion to stop, and then displays a random number between one and six on a seven-LED array for approximately ten seconds.
Parts used in the Battery-less Electronic Dice:
- Perspex tube (6 inch length, 15mm outer diameter)
- Magnet wire (30 SWG)
- Rare-earth cylindrical magnets (10mm diameter and length)
- PCB material (for end seals)
- Two-part epoxy
- IC packaging foam (shock absorbing pads)
- Rectifier diode bridge
- Electrolytic capacitor (4700uF/25V)
- LDO regulator (LP-2950)
- High efficiency blue LEDs (3-mm, 7 units)
- Microcontroller (ATTiny13)
- Resistor (1.2KOhm)
- Zener diode (4.7V)

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
Step 2 Power Supply for the Dice
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..
Such a tube is available from McMaster (mcmaster.com), part number: 8532K15. Magnets can be bought from amazingmagnets.com. Part # D375D.
Step 4 Voltage Generator Performance
Step 5 Dice Schematic
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: http://www.instructables.com/id/Help%3a-An-Absolute-Beginner_s-Guide-to-8-Bit-AVR-Pr/
For more Detail: Faraday For Fun: An Electronic Batteryless Dice using Microcontroller ATTiny13
- How does the muscle-powered voltage generator work?
The generator uses Faraday's law where shaking a tube containing magnets changes magnetic flux through a wound coil, producing AC voltage. - What components are needed to build the Perspex tube assembly?
You need a 6-inch Perspex tube, 1500 turns of 30 SWG magnet wire, three rare-earth cylindrical magnets, PCB end seals, epoxy, and shock-absorbing foam. - How much voltage does the generator produce with gentle shakes?
With gentle shakes, the generator provides about 15V peak to peak and a short circuit current of about 680mA. - What microcontroller is used to control the dice display?
An 8-pin AVR microcontroller, specifically the ATTiny13, is used to generate random numbers and control the LEDs. - How long do the LEDs stay lit after a roll?
The available charge on the capacitor is sufficient to light the LEDs for an average time of about 10 seconds. - How does the user trigger a new random number?
The user must shake the tube again; the microcontroller senses the conditioned voltage pulses to detect shaking and waits until motion stops to generate a new number. - What clock signal is used for the microcontroller to minimize current?
The Tiny13 operates with an internal RC oscillator programmed to generate a 128KHz clock signal. - Can the dice be powered by a single AA or AAA battery instead of muscles?
Yes, a boost type DC-DC converter like the TPS61070 can derive +5V from a single 1.5V AA or AAA battery.
