• Every project needs some blinking LEDs. This one has 300!

    LEDs

    LEDs of the LED Matrix

    This 10×10 LED Matrix has 100 serially connected WS2812B LEDs which are controlled by an LPC11U24 microcontroller. The µC receives commands and image data from the PC via USB. The frame measures 400x400x35mm and is constructed from lasercut wood panels and holds without screws or glue. The grid dividers have been painted white to maximize light reflection. Initially I planned to cover the front with frosted plexiglas, but when I glued paper onto the grid during construction, the realized that it may look even better with a nice paper as the diffuser.

    The WS2812B leds came on a 2m long self-adhesive strip with 60 LEDs per meter. To mount them to the woodpanel, the strip was cut between each LED and attached to the wood. To bridge the gaps, 3 wired cable pieces were soldered to the LEDs in a serpentine layout.

    LED Matrix LEDs Closeup

    LED Matrix LEDs Closeup

    LED Matrix LEDs Closeup

    LED Matrix LEDs Closeup

    Controlling the LEDs is done via a one-wire serial protocol which is simple but has rather strict timing requirements. A one-bit is high for 0.8µs, then low for 0.45µs while the zero-bit is high for 0.45µs and then low for 0.8µs. To set the color of x LEDs, x * 3bytes are sent from the µC to the first LED in GRB order. The first LED takes the first three bytes and sets its three constant current sources accordingly. All following data is passed on to the next LED after the signal has been reshaped. This repeats for all LEDs on the line. To start over, the data line is pulled low for at least 50µs, after which the first LED is again ready to accept data.

    There are several ways to produce the required timing: If the µC is fast enough, one can just use delays of the appropriate length. If the µC is just fast enough, the delays have to be handcoded in assembler (see the Adafruit NeoPixel Library for reference). A third way uses the State Configurable Timer available in some LPC µCs (see this forum post on LPCware.com).

    My solution (adapted from this code on GitHub) uses the built-in SPI hardware of the LPC to generate the correct timing by setting the wordsize to 15bits and then transmitting

    • 111111111100000 for a one-bit
    • 111110000000000 for a zero-bit

    Image date is stored in a big array of 300 bytes and can be received by the µC via USB. Unfortunately, the maximum packet size of USB2.0 full-speed devices is 64 bytes. This means 5 packets are needed to transmit the necessary 300 bytes. I use the first byte in each packet to indicate which part of the image is contained in the following 60 bytes and then copy them to the appropriate position in the array. Additionally, a few commands to clear, refresh, fill or set individual pixels are implemented via USB control transfers (Commands are sent to Endpoint1 and image data is sent to Endpoint2.)

    LED Matrix Software

    LED Matrix Software

    LED Matrix

    LED Matrix

    On the PC side I wrote a little program in Delphi which uses libUSB-win32 to handle the USB communication. Using the program, one can paint each pixel, display 10×10 bitmaps or transmit a downsampled stream from the desktop (size and position are configurable). All image data can be gamma-corrected before transmission to ensure better color representation.

    Up until now, I concentrated on the software and used an LPCXpresso development board to test the code. Next I will design a small circuit board that can be placed inside the case of the display and make it a stand-alone unit.

    Future plans include some procedural effects generated by the µC (like plasma or fire), SD-card interface for automatic playback of images/videos and a bluetooth interface to stream image data from a PC or android phone.

    When the project has reached a point where the software is presentable, I will make it available here or in a follow-up post.

    Tags: , , , , ,

  • USB Display with different Brightness per Digit

    USB Display with different Brightness per Digit

    Last month I finally came around to order a lot of circuit boards that piled up over the last years. One of those boards was made to use some parts I just bought because they were on sale (the 16-segment LED digits) and a sample part I ordered just because I though it would be neat to have (the MAX6955).

    The MAX6955 from Maxim Integrated is an LED display driver for a combination of 7, 14 or 16-segment digits with up to 128 LEDs. The chip provides a font,  global or per-digit brightness control and two-speed blinking between two text buffers. Additionally, 32 switches in a matrix configuration can be scanned and debounced. To talk to the chip, the I²C-protocol is used.

    USB Display Software

    USB Display Software

    To control the display driver, an ATmega168 with the V-USB software USB stack is used. It is supplied with 3.3V and clocked at 12MHz (which is not possible, according to the datasheet, but works fine). Only four buttons were attached to the MAX6955 and placed on the backside of the PCB.

    At the moment, the PC-side software (which uses libUSB-win32) can send text and commands to the AVR which just passes them on to the MAX6955. In the future, I want to add a text memory on the AVR  so it can display and scroll messages independently from the PC. Maybe I will add some functions to dynamically vary the brightness of the digits to produce some cool effects.

    USB Display Backside

    USB Display PCB Backside

    I wanted the circuit board to be as small as possible, meaning it has the size of the eight 16-segment digits. All components were fitted between the pins of the display digits. To program the AVR, a card-edge ISP connector was used. To protect the circuit and to improve the contrast of the red LEDs a case was lasercut from red plexiglas.

    USB Display

    USB Display with Text

    You can download the circuit board layout (Eagle) here, the AVR firmware (C) here, and the software (Delphi) here.

    Tags: , , , , ,

  • Due to university and work it has been a while since the last post. But I just completed a little project that’s worth posting.

    32kHz Oscillator

    32kHz Oscillator

    Several old 27C256 EPROMS were lying around unused. So I thought about a purpose for them. As I also had some 8×8 LED matrices, a little animated display came to mind.
    With each frame consisting of 8×8 pixels the 32kByte EPROM can hold 4096 frames. Each byte holds one line of the display, eight bytes one frame.

    The lower 3 addressbits of the EPROM have to by switched synchronously with the corresponding line on the display. This is achieved by wiring them to a 3-to-8-decoder (74*238) which in turn switches the lines. As up to eight LEDs can light up at once per line. To handle the current an ULN2308A darlington driver is used.

    The columns are directly controlled by the data-output of the EPROM. To drive the LEDs a 2N2907 transistor is used.

    The clock is generated by a crystal oscillator circuit consisting of a 32768 Hz crystal and an inverter gate.

    The 32kHz squarewave from the oscillator is then divided by a 12-stage ripple counter (4040). The seventh to ninth stage are used for the line-addressing and are wired to the A0-A2 inputs of the EPROM and to the A,B,C inputs of the 74*238.

    The next three stages are connected to a DIP-switch. The output of the switch leads to the clock input of another 4040. This way the frame-rate is selectable from 32fps, 16fps and 8fps.
    Only fourteen addresspins of the EPROM are used, the fifteenth can be set to high or low via a jumper.

    Logic Section of the Display Schematic

    Logic Section of the Display Schematic

    I wanted the whole circuit to fit under the LED matrix, but unfortunately the EPROM is slightly bigger, so the circuitboard protrudes about 3mm on the left and the right.
    Apart from the LEDmatrix and the EPROM only SMD components were used on the two-sided PCB. The layout is rather dense and 0.3mm vias were used. Originally i wanted to etch the PCB myself, but quickly gave up that plan when the opportunity to let it manufacture for free together with other boards arose.

    EPROM Display PCB

    EPROM Display PCB

    EPROM Display PCB with EPROM

    EPROM Display PCB with EPROM

    EPROM Display LED Matrix

    EPROM Display LED Matrix

    In the pictures above you can the bottom side of the populated PCB with one of the 4040’s, the 74*238, the crystal (the little golden thing), the DIP-switch and the EPROM-socket. In the next picture, the EPROM is inserted and on the last picture the LED-Matrix is lighted with some random data that was stored in one of the old EPROMs.

    You can download the schematic and the board-layout (for EAGLE) here.

    EPROM Display Program

    EPROM Display Program

    To easily generate data for the display, a small program was written in Delphi. You can draw each image on the 8×8 field and save the sequence of images to a binary file that can be directly programmed into the EPROM.

    The source-code can be downloaded here.

    Tags: , , , ,

  • I recently obtained a very old mobile phone from a friend. The battery was dead, so I dismantled it and to my surprise found a display with soldered contacts. In other mobile phones the display was connected via a conducting polymerpad, which was extremly difficult to use on selfmade circuitboards.

    Googling the name of the display brought up a site with pinout and a link to the datasheet of the driverchip.

    Using my I²C-Adapter and my I²C-Control program the testing was easy. Just look up the commands in the datasheet, put together a sequence and run it. The display works well and even the illumination is intact.

    Pinout (looking at the back of the display with the black blob to the top right):

    1. VLCD
    2. – LED1
    3. – LED2
    4. SCL
    5. VC (Contrast)
    6. VDD (+5V)
    7. SDA
    8. GND
    9. + LED 1&2 (+5V)
    10. VO

    Connect SDA, SCL, 5V supply and a 10k poti between 5V and GND and the centertap to VC and you are ready to go.

    The adress of the display is 01110100 for writing data.

    After sending the adress you first send a control byte, which determines if the following bytes are commands or characters. Sending 00000000 selects the commands. Then we set the datalength to 8bit, the number of lines to 4 and the voltage generator control to V0=VDD-0.8V by sending 00001110. The display is then switched on by sending 00001111, which also sets the cursor position and blinking. The following byte ( 00000110 ) configures the entrymode of the display to increment the adress after every written character and to freeze the display (and not shift it). Then we only have to specify in which of the four lines we want the following characters to be written. This is done by setting the DDRAM adress to one of the following values: 0x00 (1st line), 0x20 (2nd line), 0x40 (3rd line), 0x60 (4th line).

    Then you send a repeated START condition, the adress again, a controlbyte which tells the display that all following data are characters ( 01000000 ).

    Then you can send arbitrary characters. The character-table is on page 15 in the datasheet, and the commands are on pages 23 and 24.

    Clearing the display is done by sending 00000001 as a command.

    LPH7319 controlled via I²C

    LPH7319 controlled via I²C

    The driverchip is called PCF2116. The datasheet can be found here.

    I will post a complete sequence that clears the display and writes ‘Linex’ (x = 1..4) to the four lines soon.

    For now just a photo of the result:

    Tags: , , , , , ,