New Moons

I have a project planned for some high-end under cabinet lights, using 2 watt Nichia Jupiter LEDs. The LEDs are packaged and mounted by LuxDRIVE in their IO Moon product. The IO Moon takes the jupiter LED and has it mounted on a very thin printed circuit board. The pcb is two layer, however, only the top layer is electrically active – the planes on the top and bottom are connected by a bunch of through-plated vias and the bottom plane is not masked, instead it is left as an exposed, tinned surface.

Luxdrive claims the moon can operate at a recommended current of 350mA in ‘free air’ at 25°C ambient. However, to achieve the full 500mA drive current, a heatsink is required.

I have chosen 70° viewing angle lens and a warm-white phosphor. The LED looks very nice, however, I’ve only been able to run it at 1/10th power so far. The color is a big improvement over the very blue common white led.

Here’s some pictures!
luxdrive io moon led jupiter nichia front face

luxdrive io moon led jupiter nichia back face

luxdrive io moon led jupiter nichia profile view

luxdrive io moon led jupiter nichia

luxdrive io moon led jupiter nichia

Rainbow LED Chaser

I was bored this past sunday, and needed something to ease my racing brain … so I picked an easy project with lots of flash.

The parts list:

Eight Tri-Color or RGB leds … each led package contains three LEDs
Three 74HC595 Shift Registers … serial load, latching. other varieties would probably work too.
One Microcontroller … doesn’t matter what it is, I used a pic18f252 since it was handy.
Twenty-Four Resistors … I used 150 ohm to set my led current at 20mA, but use anything from 56-220 ohms

The tri-color leds I used are wired as common anode LEDs … each led inside the package has its own cathode pin and shares a common anode pin. So, all my anode pins connect to the postive rail on the breadboard. There’s no reason a person couldn’t use twenty-four discrete LEDs, or eight common cathode leds. Since my leds are “active low”, outputting a 0 turns them on, outputting a 1 turns them off… if you used common cathode leds, they would be “active high”, a 1 would turn them on and a 0 off. If you used discrete leds, well, hook ’em all up one way or the other.

Next comes the connections to the shift registers. Think of each register as a chip containing eight switches you can turn on or off remotely. Each of the 24 LEDs gets connected to an output on the register, and they need to be grouped by color and kept in order. So looking at the picture below, working left to right, I connected all the red leds to the first register, all the blue to the second, all the green to the third. This resulted in the rats nest of wires you see between the chips and the leds. Concerning the registers themselves, they have three connections of up-most importance. Pin seven is the ground connection, pin fourteen is the +5v connection, and pin thirteen is the enable or tri-state pin. The tri-state pin must be tied to ground in order for the outputs on the register to work. Next up is the data connections. The 595 offers a nifty feature of serial pass-through. Using this feature, you can chain a bunch of them together, and treat them as a large number (in the programming). This is done with the QH* and SER pins. QH* connects to SER on the next ic ‘down stream’. On the first IC (the rightmost in my picture), SER connects to the microcontroller. Now in order to ‘load’ the chips with serial data, the microcontroller has generate a ‘clock’ for all the chips to sync to. This clock signal is transmitted on the SCK (serial clock) line. All three SCK lines are wired in parallel to the microcontroller. Last, since we want the data to be retained by the registers, even if the pic stops transmitting, we need to latch the data. This is controlled by the last data line, RCK. When the microcontroller is finished transmitting data, it needs to pulse the latch clock RCK high briefly. Upon receiving this signal, the registers display the data which they just received, and continue to display it until told otherwise. I have some other lines connected, but don’t use them… they are the SCLR line, which clears the data from the buffers, and the enable line. The microcontroller keeps the enable line high (disabling the registers outputs) until it is read to start sending commands… this prevents the registers from powering up with weird random data being displayed.

That’s it for the hardware side … really simple. All the magic happens in software… which I will write about in part two (yes, I’ll post the code too). As a spoiler, all the software does is boolean math, shifting and inverting 8-bit words of 1’s and 0’s around.

Here is the breadboard:
rgb led microcontroller 74hc595 shift register
The parts in the grayed out areas are just stuff left over on the breadboard from an earlier project, or support components for the microcontroller.

Here are some videos:
Initial Testing Video
Center Pulse Effect

UPDATE:
Due to all the connections (24 of them between the registers and the LEDs), drawing a schematic can get messy. I chose to avoid this mess by using Eagle “BUS” feature, which allows a large number of signals to be combined into one wire. The schematic below is drawn using a much less expensive and smaller PIC than the one pictured in the breadboard … however the idea is still the same.

74hc595 shift register microcontroller rgb led chaser

Here is the source code (in BASIC of course) for the “center pulse” effect, it’s pretty much just taking binary patters of 1’s and 0’s and moving them around to create the ‘animation’.

click to download centerpulse.bas

Long Time, No See

Sorry I’ve been neglecting my blog!

I’ve been doing a lot of reading and research, as well as playing with a new toy.

Here are the top-5 items in my current project queue, sorted by priority:

1) LED backlit Rooster Project – Christmas Gift
2) High-End LED under cabinet lights – Christmas Gift
3) Rainbow LED chaser – New Toy / Fun Project
4) LEDs as Sensors – Interface Project
5) LED Matrix Display – 8×8 display modules

I’ll write more about the rainbow chaser tonight (I promise!)… The backlit rooster is just a cheezy Christmas gift I hope to do up cheap for someone who likes roosters and chickens in their kitchen decor. The high-end under cabinet lights are based on Nichia Jupiter LEDs – this project is currently in the very early design stages. I hope to get a proof of concept prototype built by xmas. LED as Sensors is sort-of stuck – I became obsessed with trying to build a large sensor array, but decided today, I don’t need a large sensor array… so I’ll regroup and start a fresh with actual application development for the sensors as I have them now, and worry about building them larger down the road. The LED matrix display will probably never get built, I just had some fun drawing up the designs… Once I priced out the cost to build them, my interest diminished (64 super flux LEDs for each module, 10-16 modules for a good sized display!).

Iron in the Fire II

In my previous post, I write about an LED matrix for a marquee. The display itself is a two-board solution, the second board or ‘daughterboard’ piggy-backs on some pin headers from the display board. This second PCB provides the control interface and logic for handling these 64 leds, and passing along control data to any upstream displays.

led matrix display schematic diagram

The controller uses a 595 shift register to provide the ON/OFF control for each of the eight columns. To provide maximum current to these columns, I have used the ULN2803 current-sink driver. The 2803 is basiclly a darlington array which uses a small current to sink up to 500mA, on each channel… and it has 8 channels. So if I really blast my piranha LEDs with their bleeding edge maximum current of 80mA and the data called for all eight columns to be active at once, the entire column would need a total sink of 640mA! I believe the 595 alone can only sink 200mA. The daughterboard has no circuitry on it for controlling the rows of the matrix – they are just wired in parallel to the daisy chain connectors, which will connect it to a current source on the ‘master control’ or interface board. I plan to use some P-Channel mosfets to handle sourcing potentionally several amps of current. For example, if I connect sixteen of these modules together, and want to turn an entire row on at once, that is 128 LEDs, each drawing 80mA, for a grand total of 10.24A. Wow, that is a lot of power, my goodness, good thing I have a bunch of old AT style switching power supplies laying around, with 15-20A on their 5v rails.

The 595 shift register is just a set of switches, which are set through a synchronous serial interface – a big long string of 1’s and 0’s is clocked out of whatever ends up controlling this marquee (most likely a PIC microcontroller). Each register takes eight bits, thats why I went with eight columns. So if I build a sign with sixteen of these modules, I’ll be pushing 128 bits out a serial port. The entire register will need to be updated for every row, so an entire refresh will take 128 * 8 bits or 1024 bits. At 20mHz, my pic can clock a bit out every two microseconds, so refreshing the entire marquee would take roughly 2.1 milliseconds. A frame rate of 30FPS should be entirely possible, since 1/30th of a second is approximately 33 mS, that leaves a LOT of extra time for the pic to take a nap with… and if I go crazy and build some huge mother of an array, I can beef the pic up to 48mHz, hammering those bits out more than twice as fast.

The display modules are ‘modular’. Daisy-chain connectors provide pass-through of the row current, and data-control signals from the microcontroller. The D-IN port connects the ‘upstream’ registers serial output (QH*) to the current registers serial input (SER), the D-OUT port connects this registers serial output to the next registers input. The rest of the signals are straight parallel. Only changes in the software of the microcontroller would be required to add or subtract display modules from the finished array.

The pcb design and layout is ‘diy compatible’ I’ve used all through-hole components, and jumpers instead of via’s. If I send these out to be fabbed, I’ll probably change the signal routing around, switching the jumpers to vias, perhaps I’ll go with smt ICs, depends on how the layout works out… I might keep the through-hole because I like being able to run signals between the pins and under the ICs, which is hard to do when they’re tiny! The notations “dont move” are just to remind myself (or anyone else) that you can’t move the ARx (anode row) and CGx (column group) connectors, because they’re specificly positioned to mate with the display board.

composite pcb layout image
composite image of controller layout and top+bottom layers.

same disclaimer as my earlier post, these designs and images are not public domain… please read the disclaimer in my earlier post.

A New Iron for the Fire

I didn’t get a chance to make any PCBs this weekend, actually had more fun drawing them. I’m kinda stuck on my LED sensors project, since I haven’t come up with a good way to handle the current demands of an array yet, the catch is being able to reverse bias the rows/columns/whatever. so, I’ve been looking at building an led marquee instead. I’ve learned a lot about multiplexing and scanned LED matrices and arrays, and think it would be a good diversion.

There are a lot of pre-fab matrices out there, but the bright ones are expensive (for good reason I suppose), and what’s the fun in buying something pre-fab anyway. I’m thinking about using white piranha, but maybe green (red and blue have been done to death). The pulsed current specs on the white piranha I’m looking at show a max of ~80mA, with ~60mA being the close to the 200mW rating and 30mA being the continous wave rating (100mW). I have yet to do the math yet to make sure I stay within the pulsed current duration of 1mS max, but it shouldn’t be a problem.

I designed the PCB to be a huge heatsink, with almost all the copper left intact on both sides. This matrix is wired as cathode column, anonde row. Each column is driven by a darlington on the daughterboard (more on this in my next post). Each row of the completed array will be driven by some beefy P-Channel MOSFETs. To facilitate the mounting of the daughterboard, which piggy-backs on the display board, I used some standard .100″ spaced pin headers, seen as CG1-4 and AR1-8 (column ground and anode row.)

The top, bottom and layout art are linked below to full-scale TIFF images, for making your own PCB. I also have a for a multi-layer image in the Paintshop Pro format, which has the top and bottom layers on a 100x150mm 300dpi layout, for making transparencies to use with small double sided pcb’s I have.

Here is a not-to-scale composite image of the layout and top+bottom sides for what I call the ‘display board’:
printed circuit board layout leds

This is the schematic diagram of the LED array, showing the 64 indiv. LEDs and the connectors… linked to a larger version:
led matrix schematic diagram

Here are TIFF format files of the various artwork layers at 300DPI:
Display Board PCB, Bottom Layer
Display Board PCB, Top Layer
Display Board Parts Layout
Control Board PCB, Bottom Layer
Control Board PCB, Top Layer
Control Board Parts Layout

** Note: Paintshop Pro Image Format!
Double Sided PCB Layout, one display, one control, plus some stuff for another project.

Please note, these designs, layouts, pictures, etc are not being released into the public domain. I reserve all rights as the creator and copyright holder. I do however permit the hobbiest to use these designs in their own not-for-profit projects as they see fit. I also permit redistribution of the design and images by hobbiests for the purposes of education and other not-for-profit uses. Please mention me and/or give a link back here if you post these on another website.

EAGLE Libraries

Turns out, I didn’t get to make any PCBs over my four day weekend. I did spend a lot of time drawing things.

I have some parts libraries to share with everyone, I tried asking on a very popular electronics forum for the LED displays, but no one wanted to share, so I had to re-invent the wheel. Trusty caliper in hand, I measured the packages, and transfered those measurements to my cad program. The package for the 2 inch led matrix is dead on, I’m not 100% certain on the 0.7 inch matrix, I didn’t test it as much… the pins are fine, but the footprint might be a little off. By the way, these parts libraries are for Cadsoft Eagle.

LED Matrix Displays

High Flux ‘Piranha’ LEDs

Note; about the piranha package – the through hole layout is OK, the smd layout is brand new and probably needs a little refinement, but lines up good.

I might be close…

Wow, a long time with no posts – sorry about that!

I have been busy the past week, I wanted to take Thursday and Friday off, so I had to cram a weeks worth of work into the first three days.

I’ve also been racking my brain, trying to figure out how I can integrate a matrix wired LED array into my sensor project. I think I’ve come up with a solution, partly hardware, partly software. Originally I had wanted to have all the LEDs on, and turn them off to do a measurement. This created a lot of problems, mostly due to the current demands. Well, I think I can achieve the same goals, without having all the LEDs lit simultaneously, which will reduce the current demands and should simply the circuit a little.

led matrix sensor array 74hc595

There is the PCB layout for my latest design… I think I’ll make one to test out, and if it doesn’t work for my sensor array, I can use it as a mini marquee. Sixteen vertical columns, anode connected, each driven by a 74HC595 serial shift register. Seven horizontal rows, cathode connected, each driven directly by the PIC’s analog input / digital output pins. To keep current demands low, I will only illuminate one column at a time. I think that still exceeds the design recommendations of the 595, but heck, its all I can think of at the moment.

More than a few days…

More than a few days have passed since my last posting. What have I been working on? Well, the same stuff.

I’d been getting my a** kicked by a logic gate thingy for two days, and turns out, all I had was two wires transposed – ahh well. Here is a re-post of a thread I started on linear1.org:

As part of my continuing effort to develop LED sensor technology, I’ve been trying to tackle the problem of expansion… My original brute-force method was an army of PIC microcontrollers, discretely controlling individual LEDs. While this method worked and was rather simple from a hardware stand-point, there were several drawbacks. The most ADC ports I was able to use was ten… there are microcontrollers with more than this, however they have certain drawbacks that make them unsuitable for my application. Knowing the limit of 10 leds per slave, to build an array of a useful size, say 3×10, would require three slave microcontrollers. Although not enormously expensive, each mcu costs at minimum $3, which adds up quickly.

The method I am currently exploring involves linear logic chips, specificly the 74HCT595N 8 bit serial load latching shift register. Here is the idea, and I’ll throw up a schematic shortly. The cost of a 595 for hobby purposes is roughly 75 cents. Even a modest quanity of 20-25 shifts that price down below 50 cents a piece. Far better than the cost of individual microcontrollers.

The 595 is used to source current, driving the anode axis of the array (columns). I fill the register with 1’s, which sets each output as a current source. While filling with 1’s, I clear the bit for the column which contains the LED I want to sample. The 595 holds this state indeffinately, until it is changed by the microcontroller. The microcontroller, which is directly interfacing the cathode axis of the array (rows), then samples each LED in that column by applying a reverse bias charge and then switching to a high-z input for the A2D reading for each row. This is done one bit at a time (each bit equals a row), so neighboring rows are left “on” at are lit, allowing a good amount of light to be reflected into the led currently being read.

This new arrangement allows a single microcontroller to handle a matrix of ‘unlimited’ columns by ten rows (each row needs to be connected directly to the microcontrollers unique tri-state IO port). A 160 pixel array of 16 columns by 10 rows needs only one microcontroller and two shift registers. Of course, the actual size of the array will be determined by how fast the PIC can scan through the columns, since one column is always ‘dark’ to allow for the reverse bias and read operations. Currently my microcontroller can scan my 3×3 array at a rate of 27kHz, which gives me a WIDE margin, since anything over 70 hz is practically impreceivable.

There are some flaws I need to sort out, mainly power related. The 595 can source 35mA and sink 75mA. 35mA is fine for a 3×3 array, but it won’t cut it for anything much larger. I need to find a way to increase the current handling abilities of each port, without a huge component count or complexity. If I build an array with 10 rows, each column needs to source 200 mA of current. But it also needs to retain the ability to sink a small amount of current. I figure I can solve this with a pair of transistors, one small npn for sinking, one larger pnp for sourcing.

Secondly, my microcontroller can source 25mA of current which is more than enough to reverse bias an led quickly, but it can only sink 35mA of current. So, when sinking a row that may be 16 or more columns long (at 20mA per led), some serious power handling capacity comes into play here. A simple TO92 mosfet can sink an amp of current without breaking a sweat, but I also need the ability to source current and the ability to go “high-z” to allow the microcontrollers internal circuitry to do the A2D sampling.

I think I am close to lickin this issue. More to come.

More LEDs, Less SLAVEs

Well, I’m having a some code-writers-block on applying data from the array to anything usefull… so I’m looking at ways to get more data from fewer and cheaper microcontrollers.

The cornerstone of led sensing is tristate logic. The PIC microcontroller can set each of its pins to high, low or neither (high-z). This is what allows me to forward bias, reverse bias and then sample the led. However, doing all of this requires a large number of pins on the PIC. Two pins are required for each LED. That’s why I did all this work on networking pics on a shared bus… but the cost of pics is pretty extreme, so I’m wondering about alternate ways of accomplishing the same.

Enter low-cost analog and logic interface ICs. There is a device called the 74HC573 octal tristate latching buffer. Basicly its a chip with 8 outputs, which can be high, low or high-z — same as the PIC. I really don’t care about the number of outputs, I plan to use a pair of them in an all or nothing configuration… tie all the data input lines together with a single PIC pin. I also probably won’t need the latching ability, but the 573 was cheaper than the 244 which is an octal driver without latching. So, the pic can control 16 led anodes with 1 pin – thats some awesome savings right there! 🙂 Next comes the cathode side, which is what the PIC reads with the ADC. For driving the cathodes, I plan to use the same configuration as the anodes, with the exception that I’ll also use the output enable line on the 573, to put the outputs into high-z just before sampling. All this leaves is the actual sampling. I’ll do this with a 16 to 1 analog multiplexer. The mux has a pretty high RDS(ON), something like 180 Ω … which is actually pretty close to the 150 Ω I’m using now. I figure I can put my resistor on the cathode side, after the mux connection, so when the cathode side driver is in high-z mode, my current limiting resistor disappears. In order to keep the array bright and eliminate any humans from seeing flickering, I’ll flash the entire row before sampling each LED. This should also give me the best conversion resolution on my leds, since the sampling time needs to be so high, I wouldn’t be able to read them all before their values changed.

By my calculations, scribbling in notepad, I figure I’ll need nine lines from the pic to control 32 LED lines (anodes and cathodes for 16 leds). Which is great, since I can use the lower-priced 18pin PICs… and it also sets the default row size to 16, up from the current 10. Of course, there’s no reason I’d need to do the full 16, but its good to have options! For the cost of one more pin from the pic (still easily within the 18 pin range), I could add another 16:1 mux, and lay 32 leds on a single pic! With the pic able to source and sink at least 25mA; it should be able to drive a ton of 74HC573s, which according to the datasheet need 1μA of input current per data line. Muhahahah! I’m not sure how many LEDs each PIC can handle and still have enough time to get a few complete collections inbetween servicing i2c interrupt requests with a 400 or 1000 khz bus clock.