Jump to content
Lv2Hunt

Pir Circuit

Recommended Posts

I couldn't wait. So I soldiered up the circuit tonight and from what I can tell it seems to work well.

Thanks Steiner for the info.

 

th_0D908B08-352B-4B49-B40D-FBD975E429C3-4282-00000831BACF2453_zpse2fdd066.jpg

Edited by Lv2Hunt

Share this post


Link to post
Share on other sites
 

Cool, I bet it felt good when that led lit up, I have to order parts before I can try one

Edited by mheimburg1

Share this post


Link to post
Share on other sites
 

Yes it did. Usually when the led dosent light some choice words are said.

Share this post


Link to post
Share on other sites
 
Yes it did. Usually when the led dosent light some choice words are said.

X2 :o

 

Share this post


Link to post
Share on other sites
 

I realize you are just testing but remember since I don't see a Fresnel lens over the PIR, it probably won't be able to pick up your movement from very far away. Glad it worked.

Share this post


Link to post
Share on other sites
 

So I seem to be having a problem with my picaxe board seeing the PIR board.

 

When motion is sensed on my breadboard PIR circuit I see it go from 0 volts to 5+ volts. So I know my pir circuit works. However I hook it up to my picaxe board input C.3 and I can not get it to do anything. It wolnt even light an LED when motion sensed.

 

Not sure if it's because I have it hooked up wrong? I have a 10K resistor between C.3 and ground.

 

Or maybe my code? It's something like this:

 

If pinC.3 = 1 then

High led

 

 

Any ideas??

Share this post


Link to post
Share on other sites
 

I do this when looking at pin3 for input.

 

if pinc.3 = 0 then main

 

 

The code stays in a loop (Main) until pin3 is not 0. When not 0, it performs a task.

 

Not sure if this helps with the pir, but you could try it.

 

 

 

Share this post


Link to post
Share on other sites
 

I have tried that. when i do what your saying once the code hits (Main) i goes directly to camfunctions. its acting like the pir is always sensing motion when: if picC.3 = 0

it does nothing when i make: if pinC.3 = 1.

 

Here is my code.

 

disablebod

 

'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

 

'Pin Dedicaton

 

'C.0 Camera Power

'C.1 Camera Shutter

'C.2 Walktest LED

'C.3 PIR

'C.4 Fast Hack / 4 Wire Camera

 

 

'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

 

'Map Ports

 

symbol campwr = C.0

symbol shutter = C.1

symbol led = C.2

symbol pir = C.3

symbol spare = C.4

 

 

'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

 

'Set Port Directions

 

Output campwr

Output shutter

Output led

Input pir

Output spare

 

 

'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

 

'STARTUP

 

Camera_Test:

 

pause 2000

high led 'power on led

gosub Cam_Pwr 'power camera on

pause 5000 'charge flash for 5 seconds

gosub Cam_Pwr 'power camera off

low led 'power off led

pause 500 'pause 500 ms

goto walk_test 'move to walk test

 

'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

 

walk_test:

 

w0 = 300 '300 for 30 second walk test

Do While w0 > 0

If pinC.3 = 1 Then 'if pir detects motion then

high led 'power on led

pause 1000 'keep led on for a 1 second

low led 'power off led

w0 = 300 'reset timer if walk test is interrupted

pause 3000 'wait 3 seconds for pir to settle

endif

w0 = w0 - 1 'decrease W0 timer by 1

pause 100 'pause 100 ms

loop

for b7 = 1 to 3 'loop for 3 times to flash led's to show walk test complete

high led 'power on red led

pause 1000 'pause 1 second

low led 'turn off led

pause 1000 'pause 1 second

next b7

goto Main 'move to Main

 

'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

 

Main: 'CHECKS FOR MOTION AND REFRESHES CAMERA

 

W1 = 10000 'set refresh interval...10,000 = 50 minutes

Do While W1 > 0

if pinC .3 = 1 then 'if motion detected then

goto Cam_Functions 'go to take picture

Nap 4

endif

W1 = W1 - 1

Loop

goto Refresh

 

'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

 

Cam_Functions:

 

gosub Cam_Pwr 'power on camera

pause 2000 'pause between power and shutter

gosub ShutterPic 'shutter camera

pause 3000 'pause after pic taken to save to card

gosub Cam_Pwr 'power off camera

w1 = 10000 'reset refresh timer

 

pause 45000 '1min delay

 

goto Main

 

'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

 

ShutterPic:

 

high spare 'take picture

pause 300 'pause 300 ms

low spare

return

 

'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

 

Cam_Pwr:

 

high campwr

pause 300 'pause 300 ms

low campwr

b10 = 1

return

 

'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

 

Refresh:

 

high campwr

pause 300 'pause 300 ms

low campwr

pause 4000 'pause 4 seconds for camera to recharge flash

high campwr

pause 300 'pause 300 ms

low campwr

 

W1 = 10000 'reset refresh interval...10,000 is 50 minutes

 

pause 1000

goto Main

Share this post


Link to post
Share on other sites
 

Also I looked on the AIO and noticed the it has a 1M resistor between C.3 and ground?? I have a 10K?

Could this be my problem?

Share this post


Link to post
Share on other sites
 
 

st try this for pir only:

 

Do

if pinC .3 = 1 then

high C.2

pause 4000

low C.2

endif

Loop

Edited by mheimburg1

Share this post


Link to post
Share on other sites
 

I have tried that and it dosent work. Nothing happens.

 

I don't think the code is my problem.

Share this post


Link to post
Share on other sites
 

Copied code into editor on 08m2 mode and had to remove space between C .3 on line 62 or 87 but I am sure it would not upload to chip if that was wrong?

 

Did you try jumping your pir circuit from picaxe power pin to pir?

 

is pir circuit and board ground tied together?

Edited by mheimburg1

Share this post


Link to post
Share on other sites
 

Ok time for me to admit my stupidity.

 

When I built my board I had a terminal block that had one extra pin. So my PIR input was right next to this empty terminal pin. Seems I had the wire in the wrong hole. LOL. But on the bright side I hooked it up and it seems to really work well :)

 

Thanks for the help. Sorry to bother you guys with my stupidity.

Share this post


Link to post
Share on other sites
 

Diagnosing your own board is just another part of the battle when making your own boards, much more rewarding though

Edited by mheimburg1

Share this post


Link to post
Share on other sites
 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×