Honestly, I don't know what could be going wrong with your setup besides perhaps a lack of current. If you are driving these only from USB power, that may be the issue, but I don't know. It should still run at the very least the first sequence or a single pixel being lit, chasing from the beginning of the string to the end. The others will start to draw more current. 90 pixels at 20mA is 1.8A - something your USB connection will *not* provide. But the single chase should work because it's only drawing 20mA at a time.
So your next step is to try and run it with an external power supply like I do. Run the UNO from your computer (so you can keep uploading sketches to it without having to reconnect/disconnect each time.) But connect the string's power wires to an external power supply. An old computer PSU works great. Mine provides 30A on the 5V line which is plenty to drive a full 5 meter string at full power, 60mA each (9.6A total.) Make sure you connect the PSU's ground to the UNO's ground. Let it rip. Report back.
Thanks a ton for the help KirAsh4! I should have posted a video of my problem from the get go and you probably would have figured it out sooner.
Below is the PS I've been using the whole time. I have estimated that I would be using somewhere between 115 and 134 LED for this project. And being that its an ambilight, I better not need a 30A PS....
I've found that the adalight package fails almost immediately. However, with FastSPI, if I set the data rate to 7 (the slowest), and increase all of the delay times, it more or less works but eventually fails.
Read the data sheet on the WS2801. It tells you when/where you need to add the resistors.
However, I have run the FastSPI testled sketch on a full 5m reel straight out of the box with no problems what so ever. The only change I made to the sketch was to add the proper dataRate line, which is missing from the sketch. No resistors added, just hook up the four wires, make sure the 4 wires at the end aren't touching anything metal, and turn it on. In fact, I just grabbed two reels, hooked them up in parallel to my Uno, using FastSPI. I only ran one sequence, which is the single color down the whole strip, because it's not hooked up to a high amp power supply:
(the freezing that you're seeing, if any, is just the way YouTube processed the video - the chase is smooth with no hiccups.)
Thanks for posting this up. I looked in the spec sheet and it only states what's below. I changed the pull up resistors from 10K to 50 with no positive effect.
Quote
The Connection and Driving of Cascading Operation The transmit the data over long distance by cascading, the WS2801 integrates push-pull output stage with strong driving capability which enables the data and clock can be transmitted up to 6 meters at 2MHz clock frequency. To prevent the reflection, it is necessary to connect a 50Ω resistor at the data input or output port for impedance match.
Any thoughts on what the problem could be? A bad/faulty strip? This wouldn't surprise me because the quality does not look top notch... This afternoon I will try swapping out to a spare arduino to see if that changes anything.
I've got a 5m led digital strip,WS2801IC 32pcs IC+32pcs 5050 SMD RGB/meter with a total of 160 (32*5) LEDs. I've paired this up with a duemillanove and a 5V 5A PS. On the arduino, it's wired off of the ICSP header to Clock and Data pins on the strip and then pulled up by 5k resistors similarly to this. I've ran the fastSPI test leds PDE and the adafruit WS2801 strand test PDE, with consistent errors after exceeding about 60 LEDs. The failure that occurs are the first led pixel being off color and some leds toward the end of the string or all leds begin to behave erratically. If I set it to 50 pixels or less, it works flawlessly.
The only issues with length is that at some point you need to add some pull-downs to the data and clock lines at the END of the string, to avoid reflection of the signal.
Do you have any more info on this?
More specifically, I purchased a similar 5m led digital strip,WS2801IC 32pcs IC+32pcs 5050 SMD RGB/meter with a total of 160 (32*5) LEDs. I've paired this up with a duemillanove and a 5V 5A PS. On the arduino, I've ran the fastSPI test leds PDE and the adafruit WS2801 strand test PDE, with consistent errors after exceeding about 60 LEDs. The failure that occurs are the first led pixel being off color and some leds toward the end of the string or all leds begin to behave erratically. Any thoughts? Maybe throw in a pull down resistor after the 50th?
Split your program up in several functions that do one task to simplify the loop() to something like this
Code:
void loop() { float t = readTemperature();
if (t > setpoint+threshold) { state = ON; } if (t < setpoint) { state = OFF; }
setFan(state); }
the part below makes no difference in state...
Quote
-----> if between setpoint and setpoint + threshold, check previous fan state, ----------> if was on, stay on ----------> if was off, stay off
Thanks for your help.
But I have to disagree with you, that part does make a difference. Or at least I want it to make a difference, I may just not be programming it correctly. The threshold is designed to prevent excessive cycling of the fan. I want the fan to only turn on when the temp > setpoint + threshold AND it needs to stay on until temp < setpoint.
I could rewrite the program to be an if then based on output pin state, but based on the trouble with the pin beg read low when it should be high that I've been seeing, I'll hold off on this.
So I have messed around with this and have found out that if I put a load on pin 13, reading its state no longer returns the expected result. I want it to tell me that it was previously on but it defaults to 0 state. Connecting an NPN transistor to drive a relay as load.
Thought I'd share my code, I've messed with this over the past couple of days. I wanted to have a threshold which would prevent the program from turning on the fan immediately.
Basic program: Check temp; -----> if higher than setpoint + threshold, then turn fan on -----> if between setpoint and setpoint + threshold, check previous fan state, ----------> if was on, stay on ----------> if was off, stay off -----> if lower than setpoint, then turn fan off
Right now its setup to print a lot of info, but you can remove it as you see fit.
Code:
#include <OneWire.h>
OneWire ds(10); // on pin 10
int PinLED = 13; //LED Pin float temp_setpoint = 75.00; //Temperature Set Point float temp_thresh = 2.50; //Temperature threshold
for ( i = 0; i < 9; i++) { // we need 9 bytes data[i] = ds.read(); }
// convert the data to actual temperature unsigned int raw = (data[1] << 8) | data[0]; if (type_s) { raw = raw << 3; // 9 bit resolution default if (data[7] == 0x10) { // count remain gives full 12 bit resolution raw = (raw & 0xFFF0) + 12 - data[6]; } } else { byte cfg = (data[4] & 0x60); if (cfg == 0x00) raw = raw << 3; // 9 bit resolution, 93.75 ms else if (cfg == 0x20) raw = raw << 2; // 10 bit res, 187.5 ms else if (cfg == 0x40) raw = raw << 1; // 11 bit res, 375 ms }
Well it will change the software you have to write to manipulate the output pins but both will work equally as well.
Is there a substantial difference in ease of use / capability of one programming over the other? I imagine they are similar since they are both on the same bus, but have not have the time to research it.
Hey guys. I'm trying to create additional DO for my arduino setup to control some AC relays. I have come up with two options for the circuit. This is a remote relay board that is less than 10 feet away from main board. Connected over RJ45 cable & port. Relays will be driven with ULN2803 (acts as NPN) and a separate 24v power supply. At this point I'm leaning toward the PCA9555 since its double the outputs in one chip. Can anyone confirm that the circuit I have setup will work?
Also, what do I have to do to tie the ground between the 24v supply and the 5v supply?