Go Down

Topic: ShiftPWM support topic. Latest update: Schematics, high power LED's, LED strips (Read 88377 times) previous topic - next topic

ematson5897

Well I added another 8x8 so its an 8x16 RGB now. I have two row registers daisy-chained and connected to the default example pins. The outputs are directly connected to the matrix. I have 3 column registers. The outputs of those just go down the columns (i.e. red column 1, blue column 1, green column 1, red column 2... etc.) Those are also directly connected. I'm using the standard 74HC595 registers. I will add a link at the end of this post. Just for the record, I'm only 14 so I might not be the best at arduino stuff.

http://www.youtube.com/watch?v=bohFSnuVCwA

elcojacobs

First of all, really cool that you are doing this at 14.

Second, the source of your problem is probably that you have both the rows and columns directly connected to the shift registers.
One shift register pin can only supply 20 mA, enough for one LED.

In a LED matrix, the columns or the rows are driven one at a time. This is done so fast that you don't see flickering.
My library powers the columns one by one, so all LED's of one column can be on at the same time. Their value is determined by the row registers.

Next, the row registers get updated and the next column is powered on, and so on.

The output's of the column registers have to sink or source the current of all the LED's of one row. The 595's can't do that and that is why you need transistors.

The BS170 is a nice MOSFET that is easy to get an suitable for this job. If you connect it's drain to the LED row, gate to the shift register and source to ground, it will turn the row ON if the gate is high. They can handle 500 mA, instead of 20 mA. You need a mosfet for every column and you need to set the column registers to invert in the code.

Hope this is clear, I don't have time to draw a schematic at the moment. Your youtube video is unavailable for some reason. Just ask if you need more help.

ematson5897

#122
Dec 27, 2011, 09:02 pm Last Edit: Dec 28, 2011, 12:51 am by ematson5897 Reason: 1
Ok Thanks. So if I want the rows to be active high what will I use? (so the MOSFET equivalent of pnp) Will that solve all of the rainbow problems too? And try the vid again, i think it was still uploading


**EDIT**     

I used basic 2n3906 pnp signal transistors and it works fine now. Except the rainbow functions. Those are described in the new video. I also noticed ghosting on the columns on the onebyone functions and the fade 2 in and out. I cant tell if its doing it on other functions.  This is a new video

http://www.youtube.com/watch?v=CPwT340cPPU





ematson5897

#123
Dec 28, 2011, 01:01 am Last Edit: Dec 28, 2011, 01:29 am by ematson5897 Reason: 1
And I will also be testing this library with the same setup but with a Teensy++ 2.0
http://pjrc.com/store/teensypp_pins.html

**EDIT**

Tested with Teensy++, seems to have problems with the row clock and data lines

elcojacobs

I just watched your video. Here are a few things to keep in mind:
The Arduino can only deliver 1A if it is powered by an adapter, less if it is powered by USB. It's best to power your LED's separately.
You also need a big capacitor (at least 100 uF) on the power rails to the LED's and a capacitor on the power of the shift registers. If the shift registers don't get stable power, weird things can happen.
Using darlington transistors is fine, don't forget the base resistor. If you leave it out, the base is almost a short circuit to ground.

ematson5897

Ok. I think the load is fine because I'm using a wall adapter and since only 16 LEDs can be on at a time, 16 x .020 = 0.32 amps, so I should be fine there. How large of a resistor should I use for the transistors? And do I need to put the transistors on the columns or the rows? I will probably end up redesigning my layout today with all of the added parts

elcojacobs

The transistors have a pretty bad dc current gain according to the datasheet. Only 30 for 100 mA, so probably even lower at higher currents.
Normally you would use a base current of Ic/hfe * 10, when you are using the transistor as a switch.

They are also rated at a maximum collector current of 200 mA. I would advise to use other transistors or maybe a darlington array.

All leds on a row are turned on together, which means that the row needs to supply a lot of current. Your RGB LED's have one common pin, those should be tied together and have the transistor.

ematson5897

Well the transistors were in an assorted pack so they were all 3906 equivalents. So try 2n4403. And I thought it was the rows, just checking


Paul Stoffregen

#129
Dec 28, 2011, 07:13 pm Last Edit: Dec 28, 2011, 07:20 pm by Paul Stoffregen Reason: 1
I looked at the library code briefly.  It looks like it ought to work on a Teensy++ 2.0 board.

However, the file "pins_arduino_compile_time.h" will assume the AVR to Uno pin mappings.  The latch signal should appear on pin 20 (Port B.0).  The clock should be on pin 21 (SCK), and the shift data on pin 22 (MOSI).

The library will probably configure pins 8, 11 and 12 for output, rather than pins 20, 21 and 22.  So I'd suggest you try adding pinMode for those 3 pins in your setup() function, like this:

pinMode(20, OUTPUT);  // connect pin 20 to Latch (all '595 chips)
pinMode(21, OUTPUT);  // connect pin 21 to Clock (all '595 chips)
pinMode(22, OUTPUT);  // connect pin 22 to Shift Data (first '595 chip)

I did a quick PCB layout to connect 16 RGB LEDs to a Teensy, and sent it off the Laen's PCB Group Order.  When it comes back in a few weeks, I'll test this library on Teensy and Teensy++.  Hopefully the author will accept a patch for the pin mappings, and possibly using Timer4 on Teensy (since it lacks Timer2)?

ps: I could only file "ShiftPWM".  Where is "ShiftMatrixPWM" located?

ematson5897

Thanks Elco. I will test both libraries again on my ++2.0 again today once I work the bugs out of my system. And the ShiftMatrixPWM is located somewhere on this discussion, but make sure you get the latest one

Paul Stoffregen

I attempted to add the pin info for Teensy and Teensy++ to pins_arduino_compile_time.h.  This is untested, since I don't have '595's hooked up for testing.

ematson5897

Is that file for the ShiftPWM library or ShiftMatrixPWM? or does it work for both? I will check it out and see if it works once I am done getting my stuff wired up. And just by the way I did notice that the latch was moved to pin 20 on the ShiftPWM library before asking you, I just didn't know why.

Paul Stoffregen

It should work in both, but I currently have no way to test.  It would be most helpful in the matrix version, since 4 of the 6 pins depend upon it.

ematson5897

#134
Dec 28, 2011, 09:39 pm Last Edit: Dec 28, 2011, 09:43 pm by ematson5897 Reason: 1
Elco, I added the resistors (10k) and switched to all 2n4403s, and added the capacitors and its back to doing its thing. Set all only sets them all red and it did not fix the rainbow functions. Paul, I'm hooking up my Teensy right now to test both. Should the library with the modified file still work with my Duemilonove?

Go Up