<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>OK, long answer.<br>
    </p>
    <p>From your Fritzing, I get this as the schematic, please correct
      me if I am wrong...</p>
    <img src="cid:part1.D7D901BC.E07CE139@rogers.com" alt=""><br>
    <br>
    <p>It is a bit ironic as the computer I am using did not have
      Fritzing on it, but it did have Eagle, so... downloading Fritzing
      now...
    </p>
    <p>As a note, you can flip to schematic mode in Fritzing and shuffle
      the parts around to get a proper schematic.<br>
    </p>
    <p>The arduino would turn pin 5 on after detecting movement on the
      PIR sensor (not shown), making pin 5 Hi for some duration (900 ms
      + detection time)</p>
    <p>The transitor configuration is an inverter, so the high would
      turn the transistor on (Base) and make the collector low for that
      time period.  This goes to the drain of the MOSFET (P2) while the
      gate (P1) is tied to ground(?) and the load is from the source
      (P3) to ground(?)</p>
    <p><img src="cid:part2.495C3E87.36898C84@rogers.com" alt=""><img
        src="cid:part3.8317C109.60384199@rogers.com" alt=""></p>
    From the datasheet.... You want a positive pulse on the gate, with
    some decent voltage, so using the transistor to drive the fet is
    good, but I don't think you are using the proper configuration.<br>
    <p>Based solely on the parts you have selected, I think you want the
      transistor to be in an voltage follower configuration, with the
      output going to the gate of the MOSFET (P1).  <br>
    </p>
    <p><img src="cid:part4.CA1B7369.D1C3BC03@rogers.com" alt=""></p>
    <p>Something akin to this... <br>
    </p>
    <p>Fritzing downloaded....finally</p>
    <p><img src="cid:part5.9BF9F329.84866458@rogers.com" alt=""></p>
    <p>But it all depends on your final use.  If it is learning, or an
      experiment, etc, that is one thing, but if it is to be a problem
      solution, I would recommend approaching it from a simplier and
      cheaper angle:  Chuck the arduino back into the bin for another
      use, and use a simple 555 timer IC (8 pins) with an RC circuit set
      to your timeout, the sensor as the trigger in, with the rest of
      the driver circuit as is.  Sometimes a microcontroller is really
      just overkill (hate to say that, but...).<br>
    </p>
    <p>Ken</p>
    <p><br>
    </p>
    <div class="moz-cite-prefix">On 2018-03-17 9:59 PM, Bruce Harding
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CANieT632u2GRnEd7AGzp9AO9woASsWURc+HuWqSyYre+9Kw-tQ@mail.gmail.com">
      <div dir="ltr">my fritzing diagram.  I know it does not work. It
        was as close as I could get to what I think should work.<br>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">On 17 March 2018 at 21:28, Ken McKinnon
          <span dir="ltr"><<a href="mailto:klmckinnon@rogers.com"
              target="_blank" moz-do-not-send="true">klmckinnon@rogers.com</a>></span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div text="#000000" bgcolor="#FFFFFF">
              <p>Centerpointe library at 1 pm.  <br>
              </p>
              <p><a class="m_-7033649306748371326moz-txt-link-freetext"
href="https://www.google.ca/search?q=centerpointe+libery+nepean&ie=utf-8&oe=utf-8&client=firefox-b-ab&gfe_rd=cr&dcr=0&ei=zb-tWqzUMe_OXvLukbgO"
                  target="_blank" moz-do-not-send="true">https://www.google.ca/search?<wbr>q=centerpointe+libery+nepean&<wbr>ie=utf-8&oe=utf-8&client=<wbr>firefox-b-ab&gfe_rd=cr&dcr=0&<wbr>ei=zb-tWqzUMe_OXvLukbgO</a></p>
              <br>
              <blockquote type="cite">
                <div class="gmail_extra">
                  <div class="gmail_quote">
                    <blockquote class="gmail_quote" style="margin:0 0 0
                      .8ex;border-left:1px #ccc solid;padding-left:1ex">
                      <div text="#000000" bgcolor="#FFFFFF">
                        <div
                          class="m_-7033649306748371326m_3499059723426945902moz-cite-prefix">On
                          2018-03-17 8:27 PM, Bruce Harding wrote:<br>
                        </div>
                        <blockquote type="cite">
                          <div dir="auto">I download fitzing and try to
                            do a diagram.<br>
                            <br>
                            <div data-smartmail="gmail_signature">Bruce</div>
                          </div>
                          <br>
                          <div class="gmail_quote">
                            <div dir="ltr">On Sat, Mar 17, 2018, 8:01 PM
                              Ken McKinnon, <<a
                                href="mailto:klmckinnon@rogers.com"
                                target="_blank" moz-do-not-send="true">klmckinnon@rogers.com</a>>
                              wrote:<br>
                            </div>
                            <blockquote class="gmail_quote"
                              style="margin:0 0 0 .8ex;border-left:1px
                              #ccc solid;padding-left:1ex">
                              <div 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="m_-7033649306748371326m_3499059723426945902m_-1414049794781594509moz-txt-link-freetext"
                                    href="http://fritzing.org/home/"
                                    rel="noreferrer" target="_blank"
                                    moz-do-not-send="true">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="m_-7033649306748371326m_3499059723426945902m_-1414049794781594509moz-cite-prefix">On
                                  2018-03-17 3:10 PM, Bruce Harding
                                  wrote:<br>
                                </div>
                                <blockquote type="cite">
                                  <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">
                                    <span
                                      class="m_-7033649306748371326HOEnZb"><font
                                        color="#888888"> <br>
                                        -- <br>
                                        <div
class="m_-7033649306748371326m_3499059723426945902m_-1414049794781594509gmail_signature"
data-smartmail="gmail_signature">
                                          <div dir="ltr"><span>====<br>
                                              bruce
                                              <div><a
                                                  href="http://faintfuzzies.ca"
                                                  rel="noreferrer"
                                                  target="_blank"
                                                  moz-do-not-send="true">faintfuzzies.ca</a></div>
                                            </span></div>
                                        </div>
                                      </font></span></div>
                                  <span
                                    class="m_-7033649306748371326HOEnZb"><font
                                      color="#888888"> <br>
                                      <fieldset
class="m_-7033649306748371326m_3499059723426945902m_-1414049794781594509mimeAttachmentHeader"></fieldset>
                                      <br>
                                      <pre>______________________________<wbr>_________________
Lab mailing list
1. subscribe <a class="m_-7033649306748371326m_3499059723426945902m_-1414049794781594509moz-txt-link-freetext" href="https://artengine.ca/mailman/listinfo/lab" rel="noreferrer" target="_blank" moz-do-not-send="true">https://artengine.ca/mailman/l<wbr>istinfo/lab</a>
2. then email <a class="m_-7033649306748371326m_3499059723426945902m_-1414049794781594509moz-txt-link-abbreviated" href="mailto:Lab@artengine.ca" rel="noreferrer" target="_blank" moz-do-not-send="true">Lab@artengine.ca</a> to send your message to the list</pre>
                                    </font></span></blockquote>
                                <span
                                  class="m_-7033649306748371326HOEnZb"><font
                                    color="#888888"> <br>
                                  </font></span></div>
                            </blockquote>
                          </div>
                        </blockquote>
                        <br>
                      </div>
                    </blockquote>
                  </div>
                  <br>
                  <br clear="all">
                  <span class="HOEnZb"><font color="#888888"> <br>
                      -- <br>
                      <div class="m_-7033649306748371326gmail_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>
                    </font></span></div>
              </blockquote>
              <br>
            </div>
          </blockquote>
        </div>
        <br>
        <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>
    </blockquote>
    <br>
  </body>
</html>