howdy,
I am trying to make a project where I can turn other instruments on/off at school by just sending a open/close(on/off) signal to a relay to control the power source (see pic). The code was written to make the ardruino do this so many times in a loop, then stop. My code worked when I was just turning LEDs on/off, then I replaced the LEDs with the PowerSwitch Tail II's to conrol the power and I can't get them to work.
my next guess is the problem is with the powerswitch tails a.k.a., the relays:
the PowerSwitch Tail II requires an actuating signal between 3vdc(3ma) to 12vdc(30ma) to reliably energize the ac circuit. Do I need an external driver circuit? has anyone set one of those up before?
any input would be great, thanks
(I'll post pics of what I got and what I'm using: Arduino Uno, Brick Chassis v1.1, 10 wire bus cable, LCD 16x2, buckled 3 wire cable, empty box to attach the stuff too, etc..)
ps. The red LED on the powerswitches: when lit up, AC circuit is energized.
the code:
// include the library code:
#include <LiquidCrystal.h>
//Each of these are associated with the arduino pin numbers
int LED9 = 9; // D9
int LED11 = 11; // D11
int LED17 = 17; // A3
//time delays to make it easy to keep track of minutes and hours
int minute = 60000; //1000ms/sec * 60 sec (60000)
int hour = minute*60; //60 minutes in an hour
//number of loops & stop execution after # of loops.
int MAX_CYCLES = 99;
int countLoop = 0;
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(10,11,12,13,14,15,16);
void setup() //setup is run once and is used as an init.
{
// set up the LCD's number of rows and columns:
lcd.begin(16, 2);
lcd.clear();
lcd.setCursor(1,2);
lcd.display();
//set the LED's to output mode for each corresponding pin.
pinMode(LED9, OUTPUT);
pinMode(LED11, OUTPUT);
pinMode(LED17, OUTPUT);
//turn off the led's
digitalWrite(LED9, LOW);
digitalWrite(LED11, LOW);
digitalWrite(LED17, LOW);
}
void cycleLED(int ledPin, int state, int timeDelay)
{
digitalWrite(ledPin, state);
delay(timeDelay);
}
void loop() //this gets looped the entire time it has power.
{
if(countLoop<MAX_CYCLES) //make a conditional statement which will be false and not be executed after 6 loops
{
lcd.begin(16, 2);
lcd.clear();
lcd.print("Beginning");
lcd.setCursor(1,2);
lcd.display();
delay(1000);
lcd.begin(16, 2);
lcd.clear();
lcd.print("1");
lcd.setCursor(1,2);
lcd.display();
delay(1000);
cycleLED(LED9, HIGH, 50); //loop 1. first loop.
cycleLED(LED9, LOW, 50);
lcd.begin(16, 2);
lcd.clear();
lcd.print("2");
lcd.setCursor(1,2);
lcd.display();
delay(1000);
cycleLED(LED11, HIGH, 50); //loop 2
cycleLED(LED11, LOW, 50);
lcd.begin(16, 2);
lcd.clear();
lcd.print("3");
lcd.setCursor(1,2);
lcd.display();
delay(1000);
cycleLED(LED17, HIGH, 50); //loop 3
cycleLED(LED17, LOW, 50);
lcd.begin(16, 2); // loop finished, but will continue
lcd.clear();
lcd.print("End of Process");
lcd.setCursor(1,2);
lcd.display();
delay(1000);
}
if(countLoop<MAX_CYCLES+1) //prevent the device from counting forever.
countLoop++;
}
lcd.begin(16, 2); // loops finished. no more loops. will not continue.
lcd.clear();
lcd.print("Finished");
lcd.setCursor(1,2);
lcd.display();
delay(1000);



