Where's the ground connection?I believe the correct connections to the driver provided are as below.
View attachment 144381
According to the specs when Dim+ and Dim - are open or at least 100K the output from the supply is at 100%. Srumpydc is correct, by shorting Dim+ and Dim- will shut off the supply as a simple 100K pot can be connected across the Dim leads. Zero ohms LEDs off, 100K LEDs at 100%
The driver circuit is using the transistor as a simple ON- OFF switch to make and break the Dim leads. Therefore to keep the LEDs off would require 5 volts from the Nano as the circuit is now drawn.
SG
Which ground do you mean?Where's the ground connection?
Was thinking of exactly the same.I can't get up that early.Then again, maybe a simple mechanical relay would be the easier solution. If you connected the common and normally-closed contacts of a relay across the emitter and collector, then powered the coil with the 5V supply to the Arduino, then you would have two simple states:
- 5V power off: relay is inactive, so normally closed contact is completing circuit to bypass transistor, creating low resistance path for LED driver circuit.
- 5V power on: relay activates, pulling NC contact open so that Arduino and transistor control PWM.
My bad , wasn't thinking 5 band code.Resistors are correct I've double checked I pulled them from the correct sets
You come right off the Arduino out to the mosfet gate as shown above. A logic High turns on the N channel mosfet as shown above. Not much to it and the Arduino does or can do all of the work.Also I did think of a MOSFET as a switch just no idea how to implement it
Yes, it seems like a much simpler project if the Arduino can stay on at all times.I may have to scrap the SSR altogether and see if I can use an Arduino as a slave so when it detects an input it brightens up and visa versa ime thinking adding more relays is more complex then trying to figure out code that may be simpler then I first thought but I can honestly say that this forum has been the most productive I've been on and thank you all for your help so far if I get the code right I will post it so other people can use it I will probably do a Wright up of the hole thing when it's done lol
I was thinking the same thing - why complicate the problem? It won't wear the arduino out and the amount of power it consumes is like 50-100 mW - several orders of magnitude less than the lights.Yes, it seems like a much simpler project if the Arduino can stay on at all times.
Why were you wanting to shut it down anyway? Did that accomplish something important, or were you just doing it because it felt unnecessary to keep it running when nothing was happening?
Just curious. If we knew what you were going for with the shutdown, we might be able to help brainstorm other ways to get the same, or similar, benefits.
// Fading LED
// by scrumpy
int value = 255; // variable to keep the actual value
int ledpin = 10; // light connected to digital pin 10
void setup()
{ for(value = 255; value >=0; value-=1) // fade out (from max to min) over 30 min
{
analogWrite(ledpin, value); // sets the value (range from 0 to 255)
delay(7058); // brightens up over 30 mins
}
{
delay(39600000); // waits 11 hours
}
for(value = 0 ; value <= 255; value+=1) // fade in (from min to max)
{
analogWrite(ledpin, value);
delay(7058);
}
}
void loop()
{
}
unsigned long seconds = 1000L; //Notice the L
unsigned long minutes = seconds * 60;
delay(minutes); //for 60,000 milliseconds
unsigned long seconds = 1000L; // !!! SEE THE CAPITAL "L" USED!!!
unsigned long minutes = seconds * 60;
unsigned long hours = minutes * 60;
Noticed something looking at your code posted in Post #10 there is a possible problem you may wish to check out:
There may be a problem with your delay. You may wish to give this a read. I believe using Delay the maximum number you can use is 32767 or about 32.767 seconds. If your number being passed to delay is interpreted as an int then the delay is limited to a maximum of 32767. The way around this is explicitly declare your delay value as an unsigned long. This would look a little like this:Code:// Fading LED // by scrumpy int value = 255; // variable to keep the actual value int ledpin = 10; // light connected to digital pin 10 void setup() { for(value = 255; value >=0; value-=1) // fade out (from max to min) over 30 min { analogWrite(ledpin, value); // sets the value (range from 0 to 255) delay(7058); // brightens up over 30 mins } { delay(39600000); // waits 11 hours } for(value = 0 ; value <= 255; value+=1) // fade in (from min to max) { analogWrite(ledpin, value); delay(7058); } } void loop() { }
You can also include hours as an Unsigned Long:Code:unsigned long seconds = 1000L; //Notice the L unsigned long minutes = seconds * 60; delay(minutes); //for 60,000 milliseconds
This may or may not be a problem with your code but if you run into a problem the above should serve as a work around. A Google of "Maximum Delay Arduino" should cover all of this.Code:unsigned long seconds = 1000L; // !!! SEE THE CAPITAL "L" USED!!! unsigned long minutes = seconds * 60; unsigned long hours = minutes * 60;
Ron