Pages: 1 2 [3] 4 5 ... 20   Go Down
Author Topic: ShiftPWM support topic. Latest update: Schematics, high power LED's, LED strips  (Read 82162 times)
0 Members and 1 Guest are viewing this topic.
Eindhoven
Offline Offline
Jr. Member
**
Karma: 1
Posts: 87
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
There are more issues with using a 1280. Because the memory is 16 bit wide, extra instructions are added. I can only look at the assembly now, but I'll try to get my hands on a 1280.


Hum, I think you have a misconception about the 1280 Vs 328 chips. Both have the same number of instructions, same memory widths. 1280 just has more memory size in length, not width for flash, sram, eeprom, more I/O pins, more timers, more serial ports, etc. But both use the same AVR 8 bit instruction set.

Lefty

You are right. The addresses can be 16 bit, because the memory is longer. I was confusing the data and the addresses.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 18
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Hernandi, I don't  understand. the result of xor get false with RGB == PWM, other is true.

00001000 rgb
01000000 pwm
01001000 result rgb < pwm

01000000rgb
01000000 pwm
00000000 result rgb == pwm

01100000 rgb
01000000 pwm
00100000 result rgb > pwm
Logged

Eindhoven
Offline Offline
Jr. Member
**
Karma: 1
Posts: 87
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I got it working with SPI today and got it twice as fast.
I will do some more testing en code cleanup before I upload it here.

I took steene's advice and used rotation over carry (ror) to calculate the output byte in 32 cycles (4 per pin).

Adding a shift register now costs 43 interrupt clock cycles, which is about 5.4 clock cycles per pin   smiley-cool
Logged

Eindhoven
Offline Offline
Jr. Member
**
Karma: 1
Posts: 87
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for all your input. You can check out the new version at www.elcojacobs.com/shiftpwm.

You can still ask support questions in this thread though.
Logged

San Francisco
Offline Offline
Jr. Member
**
Karma: 0
Posts: 92
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

This is fantastic-- thank you Elco!

I spent a while yesterday trying to interface with a PCA9685 to get reliable PWM output and was getting nowhere, but your library is just what I need!  It's also easier to manage 8-channel output boards for my project since I need 24 channels and want to use pretty big MOSFETs.

I wonder: is there a magic multiplier (or divisor) for the PWM frequency?  I'd like to go faster than 75Hz to avoid artifacting when in motion, but tried 150Hz in the test sketch and had odd flickering, not fading.
« Last Edit: July 26, 2011, 06:19:14 pm by salsaman » Logged

My Arduino blog: http://jmsarduino.blogspot.com
Comprehensive (?) Arduino-compatible board list: http://tinyurl.com/allarduinos

Eindhoven
Offline Offline
Jr. Member
**
Karma: 1
Posts: 87
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Salsaman,

Can you be a bit more specific? then I'll try to help you.
- A schematic is easier to read than the board file
- What are you pwming? Big LED's? Motors?
- Are the shift registers running at 5v? (big mosfets often need a bit more (a small mosfet to switch the bigger mosfet).

It seems you have found a bug, thanks!
Up to 127Hz, 256 levels, 6 shift registers its all good. 128 Hz, 256 levels -> crap.
When the interrupt frequency exceeds 32768 (max of int), a variable overflows and the interrupt frequency is set to a way to low value.

I am sleepy now, more tomorrow!



Logged

San Francisco
Offline Offline
Jr. Member
**
Karma: 0
Posts: 92
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I put together a test sketch on a breadboard with two 74HC595's driving 16 red LED's-- worked great.  I removed the RGB calls since I was just using red LED's and it worked fine.

Then I tried changing the frequency from 75 to 150, and it didn't fade, but instead flashed the LED's in an odd pattern.  Putting it back to 75, it worked great.

Should I be able to change the frequency?

The board is just for my application, sending the 595's outputs to N-channel MOSFETs to drive LED strips, not specific to ShiftPWM.  The 595 is running at 5V but I might want to run it at 3.3V later.

Update:  I posted about my successful test on my blog along with links to design files for the shift register MOSFET board.  THANK YOU ELCO!!
« Last Edit: July 26, 2011, 01:02:21 am by salsaman » Logged

My Arduino blog: http://jmsarduino.blogspot.com
Comprehensive (?) Arduino-compatible board list: http://tinyurl.com/allarduinos

Eindhoven
Offline Offline
Jr. Member
**
Karma: 1
Posts: 87
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

keep levels*frequency below 32768, until I have fixed the bug.
Logged

Eindhoven
Offline Offline
Jr. Member
**
Karma: 1
Posts: 87
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The bug is fixed. Higher frequencies should work now.
Logged

Lancaster, UK
Offline Offline
Newbie
*
Karma: 0
Posts: 4
My own, copyrighted, IP protected, personal text.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The bug is fixed. Higher frequencies should work now.

You the MAN!!

Thanks mate!!
Logged

Seattle, WA
Offline Offline
Full Member
***
Karma: 1
Posts: 174
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

This library is amazing and has saved me a TON of work, thank you VERY much for all of your hard work.  Great stuff!  I would absolutely love to see some articles from you regarding optimizing and performance tweaking for Arduino. 

Logged

0
Offline Offline
Full Member
***
Karma: 2
Posts: 125
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

This library is amazing and should have been written as soon as shift registers were introduced on the Arduino website. It will save me plenty of time now that I wanted to do a high-power LED project. What I would like however is a "get" function for the array that stores the PWM values. I notice that in CShiftPWM.h there is a public variable named "unsigned char * m_PWMValues;". However I am not sure how to access this value.
Logged

Eindhoven
Offline Offline
Jr. Member
**
Karma: 1
Posts: 87
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You could add this to CShiftPWM.cpp:

unsigned char CShiftPWM::GetOne(int output){
    return m_PWMValues[output];
}

And add to CShiftPWM.h the prototype for the public member function:

unsigned char GetOne(int output);


I have designed a 24 channel LED driver board for high power LED's. The constant current outputs can be adjusted from 60 to 350 mA and it is directly compatible with the library. Size is about the same as the Arduino. The first prototype will arrive in a week. Would you be interested in such a board? It is not in production at the moment, but will be soon.
Logged

0
Offline Offline
Full Member
***
Karma: 2
Posts: 125
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Excellent. I will make use of that get function immediately. And I would love to take a look at the board when it is done.
Logged

San Francisco
Offline Offline
Jr. Member
**
Karma: 0
Posts: 92
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Loving the library, but I'm finding that I can't get decent output on serial LCDs-- character LCD backpacks from both SparkFun and Modern Device (LCD117) are printing odd characters.  I've tried using the ATmega328's built-in serial port and softwareSerial, and I get the same strange results.

Regular serial reporting seems OK though, so I'm confused.  Any clues would be appreciated!

I'm going to try stripping all serial reporting out of the library and see if I get any different results...
Logged

My Arduino blog: http://jmsarduino.blogspot.com
Comprehensive (?) Arduino-compatible board list: http://tinyurl.com/allarduinos

Pages: 1 2 [3] 4 5 ... 20   Go Up
Jump to: