Hello,
Standard intro: new to forum, new to Arduino, new to C++, please correct me if I am wrong anywhere, and I could not find relevant info elsewhere
I am working on a design project where I am building a machine to assemble a medical pack. I want to add lights to alert for errors or for someone to replenish materials. The electronics consist of an Arduino Mega 2560, a set of relays, and a power supply attached to terminal strips.
The stacklight is a Patlite brand with three colors. Patlite Stacklight - Album on Imgur There are six wires, Y W R B G O, 5 for colors and yellow is the power. The company rep said that I should only need to plug the yellow into a relay and plug the colors into Arduino outputs. I did this, and my code turns the relay on and off, but this did not turn the light on. I tried grounding the relay, no luck. I'm starting to think I may need a resistor in line somewhere.
Right now, Lights1 sets the relay ON and toggles the pin every second. Lights2 tries to incorporate a button that will turn the light on when pressed.
Does anyone have experience or suggestions with this equipment?
Please read the forum rules. They will explain how to attach pictures and code to your post. I will do it for you this time to make it easier for everyone using the forum.
#define ON 0
int ledPin = 5; // LED connected to digital pin 13
#define Relay_13 44
void setup(){
digitalWrite(Relay_13,ON);
pinMode(Relay_13,OUTPUT);
pinMode(ledPin, OUTPUT); // sets the digital pin as output
}
void loop()
{
digitalWrite(ledPin, HIGH); // sets the LED on
delay(1000); // waits for a second
digitalWrite(ledPin, LOW); // sets the LED off
delay(1000); // waits for a second
}
I don't think the "company rep" knows what he is talking about. Here is the wiring diagram from page 57 of their catalog.
It shows no relay. It does show an npn transistor for each channel. This transistor would protect the Arduino pins from the 24V supply. If you have connected up directly without those transistors, you may have already damaged the Arduino.
If you are not using a 24V supply, only the Arduino's 5V supply, then you won't have damaged the Arduino, and that would also explain why nothing lights up.
For the npn transistors, you could use bc337 with 1~5K base resistor, for each channel.
But it might be easier & fewer components to use a uln2003 or uln2803 chip.
Better still for several reasons would be a tpic6b595 or tpic6c595 chip. You could run a large number of your stacklights with only 3 Arduino outputs.