Connecting 120v Powerswitch Tail

Hello,
I’ve set up a pretty basic photo resistor trigger that turns on an LED when a light level goes below a given value. (sketch below and photo of the circuit setup attached)
I would like to connect my Power Switch Tail to turn an 120v motor on and off.

i can hear the relay in the Power Switch Tail responding, but not as loudly as when i’ve connected it to other circuits, and it was not switching the motor on and off.

The original poster of the sketch used a 560 ohm resistor before the LED
i tried the 560 and a 10k resistor, but neither would get it going.

I figure i just need another resistor but i do not know enough to determine the correct on.

Suggestions on the resistor, sketch, and setup welcome.

Thanks
-D-

Sketch:
/*
Basic Analogue Input Control - PhotoResistor Input
This example reads an analogue value from analogue in pin 1 and then compares this to a set point.
If the set point is threshold is crossed, the LED on digital pin 7 is turned on/off.
Author: David M. Auld
Date: 9th October 2009
*/
#define photoIn 1 // photoresistor on Analogue Pin 1
#define LED 7 // LED on Digital Pin 7
int aiValue = 0; // input value
int setPoint = 330; // Trigger value
void setup()
{
pinMode (LED, OUTPUT); // Configure the Digital Pin Direction for the LED
}
void loop() {
aiValue = analogRead(photoIn); // Read the analogue input value

if (aiValue < setPoint)
{
digitalWrite(LED, HIGH); // It has got dark, turn the LED on.
}
else
{
digitalWrite(LED, LOW); // It is light again, turn the LED off.
}
}

Photoresistor_trigger.jpg

It's not clear from your post what the problem is. Does the LED not turn on? or is it the Power Switch Tail that is not operating properly? How are you connecting to the Power Switch Tail?

-- The Rugged Motor Driver: two H-bridges, more power than an L298, fully protected

The LED works perfectly with the set up i currently have.

i was just connecting the powerswitch tail in place of the LED.

I realized that my 560 resistor was a 1/2 watt, so it might be holding back too much. the 1/4 watt 10k resistor, though, was doing the same thing.

You should use no resistor at all, or perhaps a much smaller 56 ohm (not 560) resistor. The Power Switch Tail says it needs 3-5VDC at 40mA. Well, that's right up at the upper edge of what is safe to drive out of an Arduino pin. From these specs a 560 ohm resistor will limit the current too much and not allow the relay to turn on.

-- The Arduino Drum Machine: MIDI development system with 14-track MIDI drum machine sequencer / groove-box software

@Rugged Circuits

I removed the resistor and it worked! thanks.

would it be bad for the relay or the arduino if i don't use a relay at all or should i try to find a small one that works?

would it be bad for the relay or the arduino if i don't use a relay at all or should i try to find a small one that works?

I assume you mean resistor ;)

I would lean towards using a resistor. Use the biggest one that still works reliably. There is no sense in wasting current and possibly exceeding the current rating of the Arduino and damaging it.

-- The Gadget Shield: accelerometer, RGB LED, IR transmit/receive, speaker, microphone, light sensor, potentiometer, pushbuttons

ha, yeah, so many 'r' words.

awesome, i'll play around till it works.

i appreciate your help.

-d-