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.