Minggu, 08 September 2013

Magic Ball

Magic Ball

Greetings! I congratulate all of us on his birthday, and receive a small gift in history.


I once ordered the girl friends (who arrange Fire and light shows) some amusing piece for their next issue. Poburliv little brains, we came to the idea of ​​making a ball of light that can be fumble, to represent all the magic, highlight interesting places and ... umm moments rooms.

Over time, ordered it a little bit blown away, and the enterprise budget was already quite high. But the idea is already running and the thought requires a logical implementation in hardware.
And there was our LED ball.
The basic idea was this - there is a ball with a diameter of about 10 cm, the surface of which is covered with LEDs.Each LED has a control line, that controlled independently. Get some kind of matrix, smeared over the surface of the sphere.
Overall, based on the size of the ball, the size Svetikov, we - 256 LEDs packed into a 10 cm ball.
Design:
The design, strangely enough, lay a small and very tasty berry.
I thought it would be quite interesting and unusual to make LED edge by combining them in a common matrix. Thus was born the following constructive:
s - bus card that combines the edge in the overall matrix. Just fix the bottom edge of the board "b".
and - the locking ring. Fixes the top edge of the card "b".
d - the processor module
e - the battery compartment and power module. Inserted into the first through hole in the board "a".
In the process of wiring boards, design, and field experiments with cardboard mock-ups, added a few more cards for convenience and to give a more interesting view our ball.
Electronics ball pretty simple. Structurally, it can be divided into several parts:
   - Power battery power
   - The processor module,
   - LED modules
The main problem of mobile devices (this is not an exception) - catering and dimensions, which can be used to enter the batteries. Need to seek a balance between the size of the battery and its characteristics. It is also a good idea to think about the possibility of a replacement for spent batteries.
I decided that the most affordable solution - use a pair of batteries or AA batteries. But, of course, directly use the battery to power the processor and Svetikov - employment is not strange and extremely promising.
The solution came in the form of Maxim'ov mikroshemku step-up MAX1674. If you believe the datasheet - this mikroshemku increases to 5 volts, the voltage from 0.7V, which is not bad in itself and allows you to "use" the battery is almost fully. There's also a nice option - an indicator of low input voltage, which signals when the input signal level drops below 1.3V.
Step-up scheme is quite simple, requires a minimum of mikruha trim.
Job Description mikruhi described in some detail in the datasheet, on my own I will turn attention to the configuration of the output voltage:
Pin1 - FB - connect to Gnd to output 5V
Pin2 - LBI - the input of the battery compartment. At slump below 1.3V on the leg LBO (pin3) appears logical zero and the LED D1 will light up.
Pin5 - SHDN - connected to the output power for normal operation
The processor module:
 The heart and brains of our ball selected processor ATmega88.
Instead, declared by the manufacturer 16MHz quartz can be safely put 20MHz. Subject to certain rake, because some processors do not start at this frequency, but generally no problem. Quartz poshustree raised based on writing mat.effects and could use software shim along lines "Enable".
LED modules:
A simple and elegant solution for managing a huge number of LED's I think the use of shift registers. For example, loved by many 74HC595. Each module has two registers on board and connector for power and data. In fact, each module is hung up on the same bus and SPI adds 16 LEDs to the device.
To manage all of this mess requires only 6 lines of power / data:
Gnd, VCC, Data In, Data Out, Clock, Latch + Bus Enable 0 -> 15 (inclusion of independent LED modules)
Registers, it was decided to put directly on the LED board, so that it has acquired a rather peculiar appearance. A specific type of itself asks Creative wiring conductors))))))
Two central LED modules integrated with the processor.
We have examined all the electronic modules. Let's move on to the assembly and programming of the device.
Once soldered electronics in the battery compartment, with the legs of the LED solder top lid which will close the upper opening and thereby elevate appearance.
In the square neckline insert the battery holder. Be careful, sometimes battery compartments are quite different in size and before make payment - would be nice to have it on hand. I did not realize this and had to deal with napilningom.
Bokovinki holder'm damned poksipolom to the board that he did not walk.
Soldered LED shawls are soldered to the motherboard bus-. Enable line prokinul MGTF'om. The central lobe (which processor) soldered small textolite guides for battery module.
The upper edge of LED boards together textolite ring.
Programmer (leftmost board connector) is inserted into the ball instead of the power supply board.
Everything is ready and the ball can round up for coffee and goodies to come back and write firmware ...
Firmware: 
On the processor configuration I will not dwell, except to say that the percent clocked at 20MHz (16MHz for setting registers), include 2 timers, they are set to overflow interrupt. The first generates a second (in fact base), the zero in the future to act as the software Shima (not yet implemented).
Let's pay attention to bibliotechku
# Include "mb_graph.c"
It contains the mat. the effects of our ball. Currently written four test effect. I'm sure you will not be difficult to understand them.
# Define EFFECT_CHAIN ​​0
# Define EFFECT_RANDOM 1
# Define EFFECT_LINES 2
# Define EFFECT_SIN 3

It may seem strange that a function RANDOM several random numbers multiplied by each other a few times. This is done to reduce the number of simultaneously LEDs. This looks better and eating less batteries.

In general, we got the perfect birthday gift. Dear, beautiful and a little bezbashennyj.
Happy Birthday!







Files: 
01.rar 

Tidak ada komentar:

Posting Komentar