<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>I think if you might help yourself (and us) by using a graphic
circuit drawing tool like fritzing which is a circuit drawing tool
that (I think) was made for the arduino landscape.</p>
<p><a class="moz-txt-link-freetext" href="http://fritzing.org/home/">http://fritzing.org/home/</a></p>
<p>Trying to picture your cicuit based on what you describe is a bit
difficult. At best, I can think that your PIR might need a
pull-up for the input, and I'm not sure why you need a mosfet and
a transistor..?<br>
</p>
<p>Your code looks OK at a first glance, pretty basic, but OK. Of
course, you are wasting a lot of horsepower for a circuit that
could be handled by a 8 pin 555 timer IC, but ... <br>
</p>
<p>Ken<br>
</p>
<p><br>
</p>
<br>
<div class="moz-cite-prefix">On 2018-03-17 3:10 PM, Bruce Harding
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CANieT62dCAARC0RA6MFUeZ6tQ0gLLnJH+oaPA9yPvHfvmhG5qw@mail.gmail.com">
<div dir="ltr">
<div>
<div>
<div>
<div>
<div>
<div>
<div>Hello,<br>
<br>
I'm trying to get the pinning right for a project
where a PIR triggers a LED strip to turn on. I'm
having real trouble getting the pinning on the
breadboard right. If someone is willing to take a
look at it I'd be grateful. Beer or coffee on me.<br>
<br>
</div>
I'm using:<br>
<br>
</div>
12v 3A power supply<br>
</div>
PIR<br>
</div>
IRF540 Mosfet<br>
</div>
PN2222 Transistor<br>
</div>
1m Warm/White LED Strip<br>
</div>
Arduino Uno<br clear="all">
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div><br>
<br>
</div>
<div>Code:<br>
<br>
//constants<br>
const int ledPin = 5;<br>
const int sensorPin = 4;<br>
const long stayOnPeriod = 900; // length of
time to stay on (in milliseconds)<br>
<br>
//variables<br>
unsigned long turnOffTime = millis(); //Start
with the led turned off<br>
<br>
void setup() {<br>
pinMode(ledPin, OUTPUT);<br>
pinMode(sensorPin, INPUT);<br>
}<br>
<br>
void loop() {<br>
// check if the sensor is detecting then
increase the time to stay on.<br>
if (digitalRead(sensorPin) == HIGH)<br>
{<br>
turnOffTime = millis() + stayOnPeriod;
//e.g. 128 + 256 =384<br>
}<br>
<br>
if (turnOffTime > millis()) //384 > 129<br>
{<br>
digitalWrite(ledPin, HIGH);<br>
}<br>
else<br>
{<br>
digitalWrite(ledPin, LOW);<br>
}<br>
}</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<br clear="all">
<br>
-- <br>
<div class="gmail_signature" data-smartmail="gmail_signature">
<div dir="ltr"><span>====<br>
bruce
<div><a href="http://faintfuzzies.ca" target="_blank"
moz-do-not-send="true">faintfuzzies.ca</a></div>
</span></div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Lab mailing list
1. subscribe <a class="moz-txt-link-freetext" href="https://artengine.ca/mailman/listinfo/lab">https://artengine.ca/mailman/listinfo/lab</a>
2. then email <a class="moz-txt-link-abbreviated" href="mailto:Lab@artengine.ca">Lab@artengine.ca</a> to send your message to the list</pre>
</blockquote>
<br>
</body>
</html>