ShiftPWM support topic. Latest update: Schematics, high power LED's, LED strips

Why did you change this line:

int numRGBleds = numRegisters*8/3;

into this?

int numRGBleds = int(numRegisters*8/3)-1;

Adding the line driver circuit on my website might help with flickering, start with adding it to your clock line.
The arduino has some difficulty driving long signal lines at 4 MHz.
Do you have decoupling capacitors on your shift registers?

Edit: Could you try setting the number of shift registers to 5 and report what happens? This should tell you whether it is a software or hardware problem.

Hi Elco,
I changed this line some time ago, seemed legit when I did that. I've changed it back.
I edited the code so the number of Shift Registers is now 5. What happens? Nothing :). It's now testing every color at it works. Only the 11th "imaginary"-Stripe is tested so all the lights are off.
Currently I'm just using one capacitors with the first register.

Is 1 meter already a "huge" distance for the Arduino?

It's now testing every color at it works.

I cannot make sense of this sentence. Did the problem going away by setting the number of registers to 5? In that case it is a bug in the library that I have to fix.

You should have a decoupling capacitor on each shift register of about 100nF or bigger.

1m is not huge, but it depends on your wire and how much is on the wire.

elcojacobs:

It's now testing every color at it works.

I cannot make sense of this sentence.

Hm. I meant "It's now testing every color and it works." What I wanted to say is: It doesn't seem to be an error of the library or the code by itself. It runs as expected: Every Stripe changes from Red To Green To Blue. The Flickering is not has intense as in the video before but still there. I just uploaded a new one where you can see what I mean:
Have a look at the last Stripes at 0:04

€dit: Strange! I accidentally removed the one-and-only capacitor and now there is no more flickering?

Strange! I accidentally removed the one-and-only capacitor and now there is no more flickering?

At which pin did you have that capacitor?

I started with this:

Looks like I messed it up at that time :frowning:

Edit: Now I see what I f****d up -.-" First Read, then wire... Now it's connected between Pin 8 and 16...

Sorry for stealing your time and thank you for your patience...

I really do not understand why they still have that 1uF capacitor on the latch line in that tutorial.
It just shouldn't be there.

it would be great if you could get these libraries to support shiftpwm using an attiny45/85

i attached my cut down version which supports the 85 over arduino as isp / select the attiny85 1/8mhz internal osc

extract inside arduino...\hardware

restart... now then you can compile and test it without needing an attiny chip ill glady test your code :slight_smile:

thanks for your time :slight_smile:

http://hlt.media.mit.edu/?p=1695

i have pin compatibility errors with the pwmlibrary

Hello,

I am working on my first Arduino project, a 16 x 16 monochrome led matrix controlled with ShiftMatrixPWM. All is going fine, but I am afraid I will run out of memory since 32k memory on my Uno is too small to store all the patterns to be displayed on the led matrix. MicroSD cards also use spi and are conflicting with ShiftMatrixPWM.

While waiting for a non-spi ShiftMatrixPWM, I am asking if there is any way to use a sd card reader, even if it means that the led matrix periodically gets disconnected for a moment while sd card is accessed (reading only)?

Replying go myself, just for a record here.

I found that sdFat library can be configured to use software SPI on any digital pins.
So now both ShiftMatrixPWM and sdFat are running on the same arduino.
No problems so far contolling just a couple of leds in the prototype.

Hi,

I hope someone has done this before and that there is a simple fix for it.

I have a relatively complex system of about 30 or so library files that I am using for a project. One of those files is a 'master' class, allowing me to keep my actual sketch I load onto my arduino super short, like this:

// sketch
#include "Master.h"

Master myObject;

void setup(){
myObject.begin();
}
void loop(){
myObject.update();
}

I would like to include the ShiftPWM library within this system of files. So, I created my own 'Registers.h' file, which would deal with interacting between my own LED objects in my code and the shiftPWM implementation. The top of my 'Registers.h' file looks like this (similar to how my working sketches look):

// Registers.h
#define SHIFTPWM_NOSPI
const int ShiftPWM_latchPin = 2;
const int ShiftPWM_dataPin  = 4;
const int ShiftPWM_clockPin = 3;
const bool ShiftPWM_invertOutputs = true;
const bool ShiftPWM_balanceLoad = false;
#include "../ShiftPWM/ShiftPWM.h" // this syntax is required to include this library from within a separate folder

When I go to compile the code, I get the following errors:

multiple definitions of '__vector_11'
.../ShiftPWM/ShiftPWM.h:175 first defined here
multiple definitions of 'ShiftPWM'
.../ShiftPWM/ShiftPWM.h:175 first defined here

The line the errors are referring to is:

ISR(TIMER1_COMPA_vect) {
	ShiftPWM_handleInterrupt();

It seems, from my research, that people get these sorts of errors when two libraries are trying to use the same timer to handle interrupts. A lot of people experience issues when they try to use the Servo and Tone libraries, for instance. But, I don't think that I am defining ShiftPWM twice, and don't understand why my compiler is suggesting that 'ShiftPWM' and '__vector_11' are first defined in the ISR() macro.

I don't get this error when I run the example sketch Elco Jacobs provides with the libraries. I even crafted my own example sketch only using the ShiftPWM library and all works well.

Is there something particular I need to do to be able to #include this library into one of my own? I feel like there has to be a stupid easy fix that I am just not seeing.

Thanks in advance!

Hi,

I get errors while using this with the DUE, so I guess its not ready yet. Any date when its done? Or are there any simple steps to make it work?
My Goal is to have Duo LEDs Shiftpwmed on the DUE :slight_smile:

ryantuck:
I have a relatively complex system of about 30 or so library files that I am using for a project. One of those files is a 'master' class, allowing me to keep my actual sketch I load onto my arduino super short, like this:

...

I would like to include the ShiftPWM library within this system of files. So, I created my own 'Registers.h' file, which would deal with interacting between my own LED objects in my code and the shiftPWM implementation. The top of my 'Registers.h' file looks like this (similar to how my working sketches look):

Hi,
I'm not very good in coding Arduinos, but I wonder if you could include the ShiftPWM library into the "master" library?

Just sayin'.

Hi,

let me share an application of ShiftPWM with Souliss to make it controlled over Android and driven by the music played by the smartphone :slight_smile:

Regards,
Dario.

Hi!

I'm running into some troubles using your library together with other devices running off of interrupts and sharing the SPI bus. In our case it's a radio frequency module transceiver, it's for sending data around. Upon receiving a valid preamble it sends an interrupt which triggers the ISR for reading the message from the radios registers, all fine and well, but it stops doing this when used in cominbation with ShiftPWM. I suspect because of interrupts being disabled at some points and atomic operations that need to be protected from other interrupts?

Is there anyone who has experience with this kind of situation?

Another thing, there is a start function, but is there a stop? Any way to disable interrupts for this library (without doing it so globally)?

PS the radio library we are using is this excellent piece of software written by mikem RF22: RF22 library for Arduino

I've tried to configure the ShiftPMW with the Arduino Micro using the Leonardo defaults (MOSI and SCK) but I'm getting the following compiling error:

arduino-1.0.5-r2\libraries\ShiftPWM\CShiftPWM.cpp: In member function 'void CShiftPWM::InitTimer2()':
error: 'TCCR2B' was not declared in this scope
error: 'WGM22' was not declared in this scope
error: 'TCCR2A' was not declared in this scope
error: 'WGM21' was not declared in this scope
error: 'WGM20' was not declared in this scope
error: 'CS22' was not declared in this scope
error: 'CS21' was not declared in this scope
error: 'CS20' was not declared in this scope
error: 'CS22' was not declared in this scope
error: 'CS21' was not declared in this scope
error: 'CS20' was not declared in this scope
error: 'CS22' was not declared in this scope
error: 'CS21' was not declared in this scope
error: 'CS20' was not declared in this scope
error: 'CS22' was not declared in this scope
error: 'CS21' was not declared in this scope
error: 'CS20' was not declared in this scope
error: 'CS22' was not declared in this scope
error: 'CS21' was not declared in this scope
error: 'CS20' was not declared in this scope
error: 'CS22' was not declared in this scope
error: 'CS21' was not declared in this scope
error: 'CS20' was not declared in this scope
error: 'OCR2A' was not declared in this scope

I cannot find any suggestions on the support boards so I'm hoping you can offer some guidance.
Thanks

Hello, I'm having some trouble with the library, or the examples, not sure which.

I've wired everything according to the schematic, and it all works fine when I connect it to the SPI pins., but when I change to no SPI (I'll need it for a digipot later), they all start twitching and blinking mostly fully on or just something that I can only describe as random behavior. I've tried clearing the code and only setting the values one by one but still, unexpected behavior occurs. Anyone else had this problem and solved it perhaps?

I have not seen any releases of ShiftMatrixPWM since Elco's comment of Aug 9, 2012. Does anyone have a working library (plus any improvements) they would like to share?

I have tried working with an pre-release library posted here a while back, but my C++ is not good enough to update the library. With the release of cheap faster boards like the Teensy 3.1 ($19.80) I'd like to try this library on larger LED arrays if the pinouts could be mapped. (I get PORTB, C, and D errors on compile). Adding setPinGrouping(8) to use with 8x8 LED boards from ShiftPWM would also be helpful. I for one would be willing to test the code on a number of LED configurations.

Hi all,

I have problems with using the shiftpwm library with the EthernetUdp or the ArdOSC libraries.

Here is my code:

#include <SPI.h> 
#include <Ethernet.h>
#include <ArdOSC.h>

byte myMac[] = {0x90, 0xA2, 0xDA, 0x0F, 0x37, 0xEF  };
byte myIp[]  = { 2, 0, 0, 50 };
int  serverPort  = 12334;

int pin=100;
int value=100;
int t=100;

OSCServer server;

const int ShiftPWM_latchPin=8;
// #define SHIFTPWM_NOSPI
// const int ShiftPWM_dataPin = 11;
// const int ShiftPWM_clockPin = 13;

const bool ShiftPWM_invertOutputs = false; 
const bool ShiftPWM_balanceLoad = false;

#include <ShiftPWM.h>  

unsigned char maxBrightness = 255;
unsigned char pwmFrequency = 75;
int numRegisters = 8;

int r = 0;

void setup()   {     
  Ethernet.begin(myMac ,myIp); 
 server.begin(serverPort);
 
  //set callback function
 server.addCallback("/wall/1",&func1);

  ShiftPWM.SetAmountOfRegisters(numRegisters);
  ShiftPWM.Start(pwmFrequency,maxBrightness);  
  ShiftPWM.SetAll(r);
}

void loop() {
  if(server.aviableCheck()>0){    
    ShiftPWM.SetOne(pin, value);
  }  
}

void func1(OSCMessage *_mes){
  pin = _mes->getArgInt32(0);
  value = _mes->getArgInt32(1);
}

If I comment this line in the void setup: ShiftPWM.Start(pwmFrequency,maxBrightness);
then everything if fine. But of course I need it to use shiftPWM. Uncommenting the lines for the noSPI option didn't do the trick either.

Any help is greatly appreciated!

p