Powered by Invision Power Board


Forum Rules Forum Rules (Please read before posting)
  Reply to this topicStart new topicStart Poll

> Is This Possible To Do With A Pic?
wozzzzza
Posted: November 11, 2012 10:54 am
Reply to this postQuote Post


Jr. Member
***

Group: Trusted Members
Posts: 78
Member No.: 21,340
Joined: December 11, 2008




before i go wasting my cash on pic programmers and pics, i ask this.
i want to be able to have 3 inputs, that when all 3 inputs are high at the same time, a timer will begin of around 45 minutes, when time expires it will then trigger an output for 1 second then it will wait and repeat again eventually when all inputs are high once again, it will start a timer etc... as above.
But if an input goes low half way through the timer then the timer will reset until all inputs go high again.
is this possible with a PIC16F628A or do i need some other pic?
PMEmail Poster
Top
draget
Posted: November 11, 2012 11:04 am
Reply to this postQuote Post


Forum Addict ++
*******

Group: Cleanup Taskforce
Posts: 5,484
Member No.: 1,770
Joined: December 31, 2004




Easy, but you could do that one without a PIC if you wanted.
PMEmail PosterUsers Website
Top
colin55
Posted: November 11, 2012 11:24 am
Reply to this postQuote Post


Jr. Member
***

Group: Trusted Members
Posts: 88
Member No.: 30,119
Joined: July 24, 2010




You only need a PIC12F629 8-pin PIC chip

PMEmail Poster
Top
wozzzzza
Posted: November 11, 2012 11:55 am
Reply to this postQuote Post


Jr. Member
***

Group: Trusted Members
Posts: 78
Member No.: 21,340
Joined: December 11, 2008




cool, i know it can be done without a pic but not sure how any more ive been out of electronics too long and cant think of how to do it.
u know of any easy circuits around that could do it?
PMEmail Poster
Top
draget
Posted: November 11, 2012 12:29 pm
Reply to this postQuote Post


Forum Addict ++
*******

Group: Cleanup Taskforce
Posts: 5,484
Member No.: 1,770
Joined: December 31, 2004




The timer would be a CD4060, the one-shot for the 1s pulse could be a 555 (you might be able to do something sneaky with that 4060 and a logic gate too)...

A three input (N)AND gate connected to 4060's reset should handle the rest.
PMEmail PosterUsers Website
Top
MacFromOK
Posted: November 11, 2012 06:11 pm
Reply to this postQuote Post


Forum Addict ++
*******

Group: Spamminator Taskforce
Posts: 12,950
Member No.: 5,314
Joined: June 04, 2006




Hmmm... I'd think it could be mostly done with a 555 and a few diodes/transistors. mellow.gif

[EDIT] Or... one transistor and a few resistors. Combine inputs thru resistors to one NPN that pulls down pin 2 of the 555. Resistors would be selected so that all 3 inputs must be high to sufficiently activate the NPN (shouldn't be too critical, as any low inputs would also help lower the NPN's base current).

[EDIT II] If this is logic-level stuff, an N-channel MOSFET might be a better choice than a BJT.


--------------------
Mac *

"Basic research is what I'm doing when I don't know what I'm doing." [Wernher Von Braun]

* is not responsible for errors, consequential damage, or... anything.
PMEmail Poster
Top
Sch3mat1c
Posted: November 11, 2012 09:39 pm
Reply to this postQuote Post


Forum Addict ++
Group Icon

Group: Moderators
Posts: 18,143
Member No.: 73
Joined: July 24, 2002




What happens if all three inputs go active simultaneously while it's doing the 45 minute count? Does it reset the count or ignore the input?

Tim


--------------------
Answering questions is a tricky subject to practice. Not due to the difficulty of formulating or locating answers, but due to the human inability of asking the right questions; a skill that, were one to possess, would put them in the "answering" category.
PMEmail PosterUsers Website
Top
MacFromOK
Posted: November 11, 2012 09:42 pm
Reply to this postQuote Post


Forum Addict ++
*******

Group: Spamminator Taskforce
Posts: 12,950
Member No.: 5,314
Joined: June 04, 2006




QUOTE (Sch3mat1c @ November 11, 2012 02:39 pm)
What happens if all three inputs go active simultaneously while it's doing the 45 minute count?  Does it reset the count or ignore the input?

If it doesn't start/maintain the 45 min count unless all 3 are high, that couldn't happen... mellow.gif


--------------------
Mac *

"Basic research is what I'm doing when I don't know what I'm doing." [Wernher Von Braun]

* is not responsible for errors, consequential damage, or... anything.
PMEmail Poster
Top
wozzzzza
Posted: November 11, 2012 10:54 pm
Reply to this postQuote Post


Jr. Member
***

Group: Trusted Members
Posts: 78
Member No.: 21,340
Joined: December 11, 2008




PMEmail Poster
Top
Sch3mat1c
Posted: November 11, 2012 11:50 pm
Reply to this postQuote Post


Forum Addict ++
Group Icon

Group: Moderators
Posts: 18,143
Member No.: 73
Joined: July 24, 2002




Right, that's the other thing...

Does the input ( = "all three simultaneously") have to be high constantly in order to make it count (the inputs have to be high for 45 minutes continuous before the output flips)? If so, and the inputs go low during a count, does that reset the count, or does it keep counting from where it was when they go high again? (Integrating until 45 minutes total 'high' time is reached.)

Or does going high just once make it start the count? If it goes high again, does that reset the count (retriggerable timer), or is that action ignored (non-retriggerable)? After the count completes, how soon can it repeat (hold-off time), immediately or something else?

Tim


--------------------
Answering questions is a tricky subject to practice. Not due to the difficulty of formulating or locating answers, but due to the human inability of asking the right questions; a skill that, were one to possess, would put them in the "answering" category.
PMEmail PosterUsers Website
Top
MacFromOK
Posted: November 12, 2012 01:02 am
Reply to this postQuote Post


Forum Addict ++
*******

Group: Spamminator Taskforce
Posts: 12,950
Member No.: 5,314
Joined: June 04, 2006




He pretty much explained all this in his first post (lol, or so I thought anyway). I assume "reset" means the count will be zero when it starts again (or he would have said "stop" instead of "reset"). But a bit of clarification might be in order. dunno.gif

"i want to be able to have 3 inputs, that when all 3 inputs are high at the same time, a timer will begin of around 45 minutes, when time expires it will then trigger an output for 1 second then it will wait and repeat again eventually when all inputs are high once again, it will start a timer etc... as above.
But if an input goes low half way through the timer then the timer will reset until all inputs go high again."


--------------------
Mac *

"Basic research is what I'm doing when I don't know what I'm doing." [Wernher Von Braun]

* is not responsible for errors, consequential damage, or... anything.
PMEmail Poster
Top
wozzzzza
Posted: November 12, 2012 01:18 am
Reply to this postQuote Post


Jr. Member
***

Group: Trusted Members
Posts: 78
Member No.: 21,340
Joined: December 11, 2008




All 3 inputs need to be high simultaneously to make the counter start counting.
The inputs have to be high and remain high for 45 minutes before the output flips for a second.
If any one or more inputs go low during the count to 45 minutes then the count timer will start from zero the next time all inputs are simultaneously high again.
So anytime any of the inputs go low it resets to zero the timer and the timer remains at zero count until such time ALL inputs are high again to start the timer from zero.
PMEmail Poster
Top
MacFromOK
Posted: November 12, 2012 01:48 am
Reply to this postQuote Post


Forum Addict ++
*******

Group: Spamminator Taskforce
Posts: 12,950
Member No.: 5,314
Joined: June 04, 2006




Ok... so all inputs are high at the end of 45 minutes. Then what happens?

Does the 45 minute timer restart immediately? Or does something pull the inputs low at that point?

More info on the complete project would be nice. beer.gif


--------------------
Mac *

"Basic research is what I'm doing when I don't know what I'm doing." [Wernher Von Braun]

* is not responsible for errors, consequential damage, or... anything.
PMEmail Poster
Top
deth502
Posted: November 12, 2012 02:04 am
Reply to this postQuote Post


Sr. Member
*****

Group: Trusted Members
Posts: 365
Member No.: 14,050
Joined: March 23, 2008




QUOTE (MacFromOK @ November 12, 2012 01:48 am)
Ok... so all inputs are high at the end of 45 minutes. Then what happens?


it does whatever it does for 1 second, then starts counting for 45 min again, from what i infer (as long as they stay high) so, if the 3 inputs were to stay high indefinitely, it would perform the 1 second action every 45 minutes.
PMEmail Poster
Top
wozzzzza
Posted: November 12, 2012 02:59 am
Reply to this postQuote Post


Jr. Member
***

Group: Trusted Members
Posts: 78
Member No.: 21,340
Joined: December 11, 2008




At the end of the 45 minutes, it does the output for one second, then ideally it stops dead and does nothing at all until any one input goes low again.
then the cycle starts over when all inputs once again go high.

To give you a picture of what i want to do, i run a hotel where guests leave their aircon on all day when they go out, i want to automate turning it off when no one is in the room.
I have a
input 1. movement sensor (when NO movement detected input high)
input 2. ambient light sensor (when room is light, input high)
input 3. on/off light sensor (when aircon on, input high)

i want it to work like this, if its day time and the room is light via sun light (input 2 high) and the aircon is on (input 3 high) and no movement is detected(input 1 high) in the room in a 45 minute period, it will send a IR signal to the aircon switching it off. this will in turn send the input 3 to low.

at night time when it detects darkness, (input 2 will be low), it will not turn the aircon off when the aircon is on as people maybe sleeping and that is when the aircon is supposed to be on.

So when ever there is one or more inputs low then the timer will sit at zero.
PMEmail Poster
Top
Sch3mat1c
Posted: November 12, 2012 06:46 am
Reply to this postQuote Post


Forum Addict ++
Group Icon

Group: Moderators
Posts: 18,143
Member No.: 73
Joined: July 24, 2002




Ok, I skimmed over the important sentence which I was talking about wacko.gif


--------------------
Answering questions is a tricky subject to practice. Not due to the difficulty of formulating or locating answers, but due to the human inability of asking the right questions; a skill that, were one to possess, would put them in the "answering" category.
PMEmail PosterUsers Website
Top
colin55
Posted: November 12, 2012 09:10 am
Reply to this postQuote Post


Jr. Member
***

Group: Trusted Members
Posts: 88
Member No.: 30,119
Joined: July 24, 2010




You are not going to get a reliable signal from a PIR detector.

You definitively need to do this with a PIC.

I gave up building a circuit with gates over 10 years ago. It is much easier with a micro. You can change things without having to change any of the components and a single 8 pin chip will take the place of a dozen other chips.

Se my website on PIC programming:

http://www.talkingelectronics.com/

PMEmail Poster
Top
MacFromOK
Posted: November 12, 2012 05:09 pm
Reply to this postQuote Post


Forum Addict ++
*******

Group: Spamminator Taskforce
Posts: 12,950
Member No.: 5,314
Joined: June 04, 2006




QUOTE (colin55 @ November 12, 2012 02:10 am)
You definitively need to do this with a PIC.

I tend to agree. Things got a bit more complicated with the OP's last post. beer.gif


--------------------
Mac *

"Basic research is what I'm doing when I don't know what I'm doing." [Wernher Von Braun]

* is not responsible for errors, consequential damage, or... anything.
PMEmail Poster
Top
wozzzzza
Posted: November 14, 2012 05:34 am
Reply to this postQuote Post


Jr. Member
***

Group: Trusted Members
Posts: 78
Member No.: 21,340
Joined: December 11, 2008




QUOTE (colin55 @ November 12, 2012 09:10 am)
You are not going to get a reliable signal from a PIR detector.

You definitively need to do this with a PIC.

I gave up building a circuit with gates over 10 years ago.  It is much easier with a micro. You can change things without having to change any of the components and a single 8 pin chip will take the place of a dozen other chips.

Se my website on PIC programming:

http://www.talkingelectronics.com/

just looking at 5v power supply circuits, what would be best used to run these PIC circuits with a couple of other 5v circuits??
it will be run by battery that i want to last a while, months. not sure what would be best, either 4x1.5v cells or a 12v pack of them.
can you advise what battery config and regulated circuit i would need there??
probably require about 100ma bursts of power intermittently.
PMEmail Poster
Top
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

Topic Options Reply to this topicStart new topicStart Poll

 


:: support us ::




ElectronicsSkin by DutchDork & The-Force