December 31st, 2009

Happy new year 2010 POV

You need to a flashplayer enabled browser to view this YouTube video

I would like to wish my readers a Happy New Year and may all your wishes come true. As you may have experienced, during the holidays,  hobbyists get some free time and they like spending it building stuff. In this case the author, Infernoz, build this 8 LED POV display, which seems like a fun way of wishing a happy new year. The device is based on the Attiny26 from ATMEL and from the video we can see it works quite nice, but unfortunately I was unable to locate any source code posted on the project page, but this is not that bad as you can find POV source code from others projects(POV1 POV2 POV3) if you’re interested in building one.

Happy new year 2010 POV: [via]

Seven segment display

In this article I intend to explain the functionality and usage of the seven segment display, probably you have seen many projects with these type of displays, however the price drop of LCD’s tend to overtake the market, there are a still few applications for which these devices are more suited. For large numeric displays, like clock’s, railway station displays, low-cost measuring devices or very stressing environments the led based displays are better, and cheaper.  The most simple led display available is the seven segment display, it consists of 7 led stripes arranged forming the number 8, because of its simple construction it is very robust and can function in very low or high temperatures, can withstand vibrations,  mechanical shocks without problems, for what the LCD would fail to work or even get permanently damaged.

single sevene segment

If we look at one digit we can see 10pins each segment and the small dot are LED’s, each of them has one terminal connected to a common pin, from this comes the name common anode or common cathode, and the other terminal is connected to a standalone pin, since the common pin is doubled, we have the 10 pins for each digit.

seven segment config

Lets take as example the common anode type, to light the segments we need to connect the positive supply rail to the common pin, and pull to ground the segments, each segment depending on its size can handle a few miliamps, after all we are talking about LED’s not bulbs. That’s fine if you need just one number to display, but how can these digits be connected to form a multi-digit display? The first approach is to connect each segment to a micro-controller pin, this way for each digit you need 8 pins and isn’t elegant at all.

The other solution is to connect each corresponding segment from the digits to a common bus, and power the digits one at a time, thus multiplexing the data.

seven segment schematic

This multiplexing probably sounds more complicated than it really is, look at the next picture:

illustrated seven segment operation

Since the digits share the same data bus, each digit will have the same number displayed, like the wheel on the picture, to change the number the “data guy” rotates the wheel. So how can we display 1234 you might ask, well wee need another guy, the selector, which will leave only one digit to be seen, all the others are shut off, by synchronizing the “data guy” and the “selector guy ” so they operate at the same time, when the wheel is at the 1111 position, the selector opens the first window, when at 2222 it opens the second and so on. By changing the data and selecting the digits at many times per second the human eye will see a steady image with 1234, the display refresh rate should be above 50 times in 1 second, otherwise the image may flicker.

In the schematic the “selector guy” is implemented by the PNP(BC327) transistors and the “data guy” is the data bus (PORTB0..7). For the practical demonstration I used my own avr development board with ATmega88, four HD1131R type seven segment digits which I rescued from an old TV a few years ago, the connections are made on a prototyping pcb with scrap wires. The data port is PORTB, for selection the PD4..PD7 pins where used.

Like I mentioned earlier we need a periodic data update with digit selection to have a steady image, and since the entire display refresh should be above 50Hz and we have four digits we need to change the digits at frequencies greater than 200Hz. Since the amount of time which one digit is turned on is 1/digit count, as the display has more digits the light intensity gets weaker, in our case the HD1131R has 1.6V voltage drop, by powering from 5V and trough 330Ohm results 10mA trough each segment, but since we have 4 digits the average current received by each segment is 10/4=2.5mA, this will result in a very fade light. For the demo application I used 220Ohm values, with the on board 100Ohm resistors the average current is 2.5mA/segment, although I could have used only the on board resistors, thus having 8.5mA average current, but the peak would be 35mA, and the micro-controller can handle at maximum 25mA/pin, off course the pin won’t get blowed right away from 35-50mA, but you should be careful when designing similar circuits.

That’s enough about the hardware, let’s see the software, for the periodic refresh I used a timer interrupt with 244Hz, resulting in 61Hz refresh rate, in Europe we have 50Hz AC power, so that’s fine, but in the case of 60Hz AC power the refresh rate should be at 70Hz to avoid the stroboscopic effect.

For the display data I used 4 byte buffer from which the interrupt reads and sends to PORTB, the buffer index can be used also for digit selection(see void DisplayData(uint8_t* Display) ).

Because of the seven segment data format by directly writing 5 to PORTB, won’t result in displaying 5, so the numeric data must be converted first, because there isn’t any easy algorithm to mathematically make this conversion, we must use another method, for a one digit display you could make if-else or switch statements, but with 2 digits you already need 100 lines of code, for 3 digits 1000 lines and so on. A very handy solution is a look-up table:

const uint8_t DigitCharTable[] = { DigImage0, DigImage1, DigImage2, DigImage3, DigImage4,\
DigImage5, DigImage6, DigImage7, DigImage8, DigImage9, };

By indexing the table with the numeric value 0-9 we get the needed data format, example PORTB = DigitCharTable[5]; results in displaying 5;

The void NumToDispValue(int16_t Number, uint8_t* DataBuffer) function uses this method to convert 16bit signed value into display compatible string.

After the conversion made, the actual display buffer needs to be updated with the new value, here is a tricky part, by converting 1234 into display compatible data we will have [DigImage1, DigImage2, DigImage3, DigImage4], by having DigImage1 at the first position and my display has  D4,D3,D2,D1 physical configuration the data displayed will look like this: 4321, it gets reversed. This can be overcome by reversing the selection lines PD4..PD7, or by copying the reversed string into the display buffer(see void StrUpdateDisplay(uint8_t* DisplayBuffer, uint8_t* UpdateData, uint8_t InvDir)  ).

After the conversion, the result is a string(not ascii!), so the string manipulation techniques can be easily used, the dot can be added to any digit, simply by setting the 7-th bit in that byte(see macro WITHPOINT(a) in SSDisplay.h ). There is also possible to display a limited amount of characters like E,F,c,C.., (see SSDisplay.h) it won’t be pretty but it’s readable.

Last but not least, since the refresh is done in interrupt, the display buffer update operation should be made atomic, in other words first disable the refresh interrupt, and then update the buffer, otherwise the image will flicker, and don’t forget to re-enable the interrupt after!

If you use only the refresh interrupt, than it’s easier to just disable all interrupts globally, although if you have other interrupt sources too, then disable only the refresh interrupt, this way you won’t hold back the other incoming events.

For data source I used the ADC to measure the potentiometer output, you can also tweak the macro’s used to handle the ADC, the dot in the 2th digit is activated if the ADC value  is above 512.

The demo project was made using avr-gcc and avrstudio, some variable type notations may differ from the ANSI C standard since I use the avr-gcc typedefs, the entire project among with schematics, pdf’s is available for download.

In the next article I will explain the usage of the matrix keyboard.

Seven segment display explained: [download]

May 10th, 2009

2D Wireless POV Device

2D Wireless POV Device

When POVs first appeared in advertising panels i used to wonder how are the characters diplayed. Seemed like magic. Later on i found out its because of our eyes’ inertia. Where you needed a large number of LEDs to display a message, now you just need to spin a few LEDs. The rotation speed must be fast enough to display at least 10 frames per second, complex graphics may require a higher value between 15 and 30 fps, movies usually have between 24 and 30 fps.

This project will show you with great details how to build such a device. It is not an easy build, it takes a fair amount of tweaking to get it to work but the results can be spectacular. The developers of this project decided on a modular design, putting an emphasis on interactivity. In the end they came up with a very customizable POV that can display images you upload wirelessly and that you can manage in real time.

The microcontroller used is the Atmega644, leds are driven with the MAX6971 IC and Xbee modules provide the wireless serial communication between the POV and the PC from which you upload the image. A GUI written in Java makes this task easy for you.

The LEDs are place on a different PCB than the rest of electronics, this way it can be easily upgraded to a 3D version. The motor part needs some attention because you will have to carefully balance the LED board, you will deal with a lot of vibrations and the speed of rotation can be quite dangerous. Also there will be some tweaking involved when you will build the brushing system to power up the LEDs.

The motor has a separate power supply so that the main PCB won’t pick up noise. A HALL sensor is used to count the rotations and give the position of the LED board. When real time management of the display is not desired, the POV can use the picture stored in its EEPROM.

In order to power it, you will need a 9v power adapter that can deliver at least 1.1A for the electronics boards. Since the motor is powered from different source, you will need to meet your motor’s requirments. The one used in the project had its own 5V/2.5A power supply.

The cost for building this project is a little higher than 50$ and you can further reduce that if you already have some of the needed parts . All schematics and code are found in the project, below you can see the POV in action.
You need to a flashplayer enabled browser to view this YouTube video

2D Wireless POV Device: [Link][Via]

Replace iPhone front panel

“Operator?! I need an exit!” I bet if iPhone existed when they shot The Matrix they would’ve used it. It’s a great device and can really get you on antidepressants when it gets damaged somehow. There are however some problems that you can fix yourself, for example a cracked front panel. The iPhone is a little more difficult than regular phones to open so you will need some tools but nothing very exotic.

Since you will be dealing with small and sensitive mechanical and electronic parts you must be very careful and meticulous. Specially when you are using metallic tools that can scratch or slip and damage some other component. If you tried to open the older iPhone you will be pleased to know the newer iPhone 3G is more friendly in that matter. The display can now be detached from the front panel with little care.  The front panel glass is glued to the rest of the case, but the glue gets soft if you heat it.

It is very well suggested to put the screws and other parts that come off on some scotch tape so you don’t lose them. A magnet also works very well for screws.

With some care the results can be excellent and your iPhone will be back in shape. So get to work and enjoy.

Learn how to replace iPhone’s front panel: [Link]

March 24th, 2009

Compact 64 pixel display

Compact 64 pixel display

This is probably the most compact led matrix display ever, you need the ATtiny2313 and 88 Led matrix and off course two AA batteries for power. The micro controller is on the back of the display, soldered directly to the pins, since the voltage of two AA cells is around 3V you don’t need the current limiting resistors either. Just remember to use the low voltage type of micro controller like the ATTINY2313V-10PU the ATTINY2313-20PU won’t work, and in case of powering from 5V put some 100Ohm resistors in series with the leds.

This project can be easily adapted to other controller or display, but the ATtiny2313 and the LEDMS88R’s pin configuration fit together perfectly, no need for wire bridges to match the right pins.

With the 64 pixels you can’t display complex messages but there is enough resolution to achieve some eye catching animations, and the battery will last for two weeks. The size can be further reduced if you use small, coin shaped lithium cells instead of the bulky AA batteries.

Compact 64 pixel display: [link]

© 2007-2011 YourITronics | Any logo, trademark and project represented here are property of their respective owners | Wordpress | Privacy Policy    RSS