Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

PIR to NeoPixel 240207

Hello ETO forum,
Working on light object that uses a PIR to trigger
a microcontroller, which operates a Adafruit
Neopixel 16 ring.
PIR_to_NeoPixel_240207.png

Presently the LED display operates when triggered by
the PIR for a minute as timed by the ATtiny85
microcontroller.
An improvement to the system would be
for the user, if desired, could override the PIR
and turn the Neopixel ring with a rocket switch
and so the LED display would operate until the
switch was toggled.
But because I am an architect, not an EE, the placement
of the switch is a mystery.
It would seem that the switch would be placed
in the circuit before power reaches the PIR
but that would simply make the whole system
be either on or off.
So it seems the switch should, when open,
allow the PIR and timer to govern. but
when the switch is operated, bypass
the PIR, but not the microcontroller
because the ring needs data.

Perhaps the solution is to use the
microcontroller logic to say, if
the PIR is triggered but there is no
signal from the PIR at the MC
(because the switch has opened
the PIR out trace to the MC)
then turn on the ring until
the signal is returned.
Although that would require the
PIR to be retriggered for the
ring to go off.

Is there simpler electronic solution
that would not require a
microcontroller logic solution?
Or a solution that uses the MC
logic but does not require the
PIR to be retriggered?

Thanks.

Allen Pitts
 
Hello Mr. Goodwin and the EOT forum,

Thanks for your excellent post.

Because knowledge and experience with electronics is yours
the explanation is prefaced with 'simply'. Because I am
an architect, not an EE perhaps it could be understood
that this is not, at least for me, simple.
The phrase 'one spare pin to chassis, and a pull-up resistor to 5V' by chassis the meaning is, I think, to place a resistor as shown in the revised schematic, right?
PIR_to_NeoPixel_240207.png
Also the phrase 'pull up resistor' has been run into more than once and has been struggled with a bit since it was not intuitive as to what was being pulled and how.
It is conjectured that the pull up resistor's function is to, if pin five of the MC is the subject of an 'if' statement in the ATtiny's sketch, the 'If' statement would say
'If pin five is high then turn on the Neopixel, else (that is, if pin five is not high) then trigger the Neopixel based on a signal from the PIR.
Thanks.

Allen

PS Forgot to show the switch in the schematic. The switch would go between R2 and the Vcc rail, right?
 

Attachments

  • PIR_to_NeoPixel_240207.png
    PIR_to_NeoPixel_240207.png
    54.2 KB · Views: 76
Yes, switch from pin 5/R2 to chassis/ground - the pull-up resistor pulls the pin high, so usually you would be looking for the pin going LOW when the switch is activated. 10K looks a reasonable value, the 430 ohm in the attachment is too low - the ATtiny might also have internal resistors you can enable, but adding an external one means that doesn't matter.

I'm presuming pin 5 is a normal I/O pin, and can be set as an input?.
 
I'm guessing that you don't know programming and don't have the source code.
In which case, connect the switch to pin 7 with suitable diodes to protect the output of the PIR.
Just checked and the output can drive a load so you could put the switch between the PIR output and pin 7 and also place a high value (>2k = 2,000 ohms) resistor from pin 7 to 5V. The PIR is active high.

Mike.
 
AllenPitts, the pins on a microcontroller can be output (high) = 5v in your case, or output (low) 0V, or set as an input.

When set as an input, you need to design a connection to the pin to physically set it to 0 or 5v or it will drift to whichever value at any given minute because of static or EMI. Using a resistor to connect to one power rail (0 or 5v) sets it to that voltage in the same way as connecting with a copper wire. No current is flowing in or out of this pin so the value of the resistor plays no part unless you get up to very high values but we'll ignore that for now. Adding a simple switch between your R2 and ground (0V) lets you leave it open and the pin remains at 5v or close and you'll have a hard connection to 0V. Note that the resistor is there so you limit the flow of current from the 5v to 0V as you change the voltage on the pin.

Now, you can program the ATiny and use this alternate input with an OR statement to tell the microcontroller that either option will turn on the neopixels.
 

Latest threads

New Articles From Microcontroller Tips

Back
Top