Faraday For Fun: An Electronic Batteryless Dice using Microcontroller ATTiny13

There has been a lot of interest in muscle powered electronic devices, due in large part to the success of Perpetual Torch Perpetual 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.
Electronic Batteryless Dice
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 (mcmaster.com), part number: 8532K15. Magnets can be bought from amazingmagnets.com. 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: 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

About The Author

Scroll to Top