Jump to content
Sign in to follow this  
peter

Ss2 Day/night Code

Recommended Posts

I've been messing with the SS2 programming trying to get the SS2 to fire only in the day. I got the SS2 to work for day only, but it would only fire at maximum light. I changed the code trying to get the SS2 to record right up until darkness so the camera will record at dusk but I've run into trouble. I've experimented with 1//2, 1//3, and 1//4 for the b3 values and for some reason the SS2 is firing during the the light and in complete darkness. I figure it has to be something wrong with my programming. I posted my code below but I'd appreciate it if someone glanced and said it looked correct or incorrect.

Also, t looked like the progam checked the light levels every time there was motion. If this is true does this mean I can turn the lights on-test the camera, then turn the lights off and immediately re-test to see that the camera doesn't fire without light...or would I have to let the camera sit in darkness for 20 minutes to get "used" to the lack of light?

 

symbol ShutterPin=0

symbol CameraPowerPin=1

symbol TrailFeederSwitchPin=pin4

symbol MotionSensorInputPin=pin3

symbol LEDpin=2

'symbol PAXE=5

symbol ActivityMode=bit0 '0=off and 1 = on

symbol StartWithWalkTestONorOff=bit1

symbol CameraIsONorOFF=bit2 'keep track of camera being on or off for activity mode

symbol TimeToTurnCamOnToRefreshFlash=w3

symbol TmeWaitAfterCamOnToPresShuter=w4

symbol DelayBetweenPictures=w5

symbol TimeForWalkTestToEnd=w6 'delay for walktest

symbol i=b1

disablebod

Low ShutterPin

Low CameraPowerPin

Low LEDpin

input 4

CameraIsONorOFF = 0

Pause 5000

'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

b3=1//2 '0.5 value for dark Change to 1 for waiting till it's darker 'TimeToTurnCamOnToRefreshFlash=25000 '25,000 = 1 hour, 50,000 = 2 hours with NAP3 (.144)

'TmeWaitAfterCamOnToPresShuter=2000'"2 S"

StartWithWalkTestONorOff = 1 'on = 1 off = 0

DelayBetweenPictures=26 '26 = 60 seconds between pics in feeder mode

TimeForWalkTestToEnd = 208 'Time for walktest 0.144 secondss for nap3(208x0.144 = 30 seconds)

 

 

'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Walktst:

IF StartWithWalkTestONorOff = 1 Then

w1=w1+1

NAP 3

IF MotionSensorInputPin = 1 Then

High LEDpin

Pause 1000

Low LEDpin

Pause 3000 'for sensor to settle

w1=0

EndIF

IF w1 >=TimeForWalkTestToEnd Then

StartWithWalkTestONorOff = 0

For i = 1 to 10

High LEDpin

Pause 200

Low LEDpin

Pause 100

next i

Pause 1000

GoTo lowpower

EndIF

EndIF

GoTo Walktst

lowpower:

IF MotionSensorInputPin=1 Then

'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

 

'check_light:

Input 2 'set lED to input

Nap 4 'pause for 244ms

Readadc 2 , B1 'read ADC of LED

Low 2 'make sure LED is turned off

Poke $1f , 0

If B1 < b3 Then 'if B1 is less than set light value. you can experiment with this pause 3000 '*pause for 3 seconds then go to standby. Change value to increase or decrese time between checking for light

goto ItsDark

Else

'goto take_picture

 

 

'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

 

 

IF TrailFeederSwitchPin = 1 Then

ActivityMode=0

Else

ActivityMode=1

EndIF

IF ActivityMode = 0 Then

High CameraPowerPin ' Turn Camera ON

Pause 1000

Low CameraPowerPin

Sleep 94

High CameraPowerPin ' Turn Camera OFF

Pause 4000

Low CameraPowerPin

Sleep DelayBetweenPictures

EndIF

IF ActivityMode = 1 Then

High CameraPowerPin ' Turn Camera ON

Pause 1000

Low CameraPowerPin

Sleep 94

High CameraPowerPin ' Turn Camera OFF

Pause 4000

Low CameraPowerPin

EndIF

endif

EndIF

ItsDark:

NAP 3

GoTo lowpower ' Do it forever

Share this post


Link to post
Share on other sites
 

I put it in the simulator, blocked some of the nap, sleep and poke commands so it would run. Seems to work in the simulator. While it is running the program, taking pics, I can change the ADC value from 1 to 0. When it's 0 it won't take a pic and when it's 1 it will. So you should be able to do as you say, move the camera from light to dark without having to wait.

 

Do you have a white freznel lens, I don't think it will work with a brown or black one? Not sure how much you can calibrate it with the LED instead of a CDS. If I think of anything that might help I'll post it for you.

Share this post


Link to post
Share on other sites
 

How about this. Use this code to try to adjust the b3 value. Once you find the value then put in for b3 with the original code you posted? I tested this in the simulator and it works in there, not sure about the real thing, sometimes the simulator and the chip don't do the same thing :angry: .

The only thing the board should do is check the light and the LED will either be on or off depending on the light. If it works then you won't have to mess with the camera to find the setting.

 

 

 

symbol ShutterPin=0

symbol CameraPowerPin=1

symbol TrailFeederSwitchPin=pin4

symbol MotionSensorInputPin=pin3

symbol LEDpin=2

'symbol PAXE=5

symbol ActivityMode=bit0 '0=off and 1 = on

symbol StartWithWalkTestONorOff=bit1

symbol CameraIsONorOFF=bit2 'keep track of camera being on or off for activity mode

symbol TimeToTurnCamOnToRefreshFlash=w3

symbol TmeWaitAfterCamOnToPresShuter=w4

symbol DelayBetweenPictures=w5

symbol TimeForWalkTestToEnd=w6 'delay for walktest

symbol i=b1

disablebod

Low ShutterPin

Low CameraPowerPin

Low LEDpin

input 4

CameraIsONorOFF = 0

Pause 5000

'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

b3=1//2 '0.5 value for dark Change to 1 for waiting till it's darker 'TimeToTurnCamOnToRefreshFlash=25000 '25,000 = 1 hour, 50,000 = 2 hours with NAP3 (.144)

'TmeWaitAfterCamOnToPresShuter=2000'"2 S"

StartWithWalkTestONorOff = 1 'on = 1 off = 0

DelayBetweenPictures=26 '26 = 60 seconds between pics in feeder mode

TimeForWalkTestToEnd = 208 'Time for walktest 0.144 secondss for nap3(208x0.144 = 30 seconds)

 

 

 

'check_light:

 

Input 2 'set lED to input

Do

 

Readadc 2 , B1 'read ADC of LED

Low 2 'make sure LED is turned off

Poke $1f , 0

If B1 < b3 Then 'if B1 is less than set light value. you can experiment with this

pause 3000 '*pause for 3 seconds then go to standby. Change value to increase or decrese time between checking for light

High LEDpin

else

low LEDpin

endif

Loop

Share this post


Link to post
Share on other sites
 

I am using a white lens. I’ll try using the code in your post and I'll put my results below. Might be a week or so before I can get to it. I don’t suppose it would be possible to replace the LED with a DNS sensor, or add a DNS into the SS2 in some capacity as another input?

 

 

When it comes down to it, I don’t need to see a flashing LED, I just need to trigger the camera only during the day and at dawn/dusk. The compact board size of the SS2 really makes a difference in what I can do for builds (compared to something like a BF board), so if it’s possible to modify the SS2 to get better results with the day only build using something like a DNS that would solve this issue, but I don’t have the technological abilities to do that just yet. I haven’t tried the PICAXE simulator, that’s something I’ll have to take a look at too. Thanks so for the reply TC!!!!

Edited by peter

Share this post


Link to post
Share on other sites
 

I'm not sure if you could just put in a CDS (DNS) you might have to add or change a resistor to go with it. I'll look at it and let you know what I think. Give me a couple days, hunting season is in and I have a few irons in the fire.

Share this post


Link to post
Share on other sites
 

I don't think just putting in a LDR/CDS will work. You would have to do a little more mods I think to make it work.

I looked up using LED's for detecting light and found some sites that say Green LED's work better. Maybe change it to a green one and leave the leads long so it will stick out closer to the Fresnel Lens? Just an idea. Maybe drill a hole in the case, goop the led in the hole so it sticks outside the case and run 2 wires to the board? Think I would try the Green LED, maybe check with Gary and see what he thinks too?

Here are a couple links I was looking at.

 

http://www.electroschematics.com/6608/led-as-light-detector/

 

http://laser.physics.sunysb.edu/~tanya/report2/

 

If you do remember the LED's are polarity sensitive, you have a + and - leg that has to be connected correctly.

Share this post


Link to post
Share on other sites
 
 
Not to stop you from doing this one your own. But Gary posted code to do this a couple weeks ago.

 

I know, that is the code he is playing with, unless there is another I don't know about?

http://www.hagshouse.com/forums/index.php?...c=53285&hl=

 

Thanks, for bringing it up.

Share this post


Link to post
Share on other sites
 

speed2spare, are you using this code, if so, is it working OK for you? I don't have this board, the one I had in a build with an S600 my buddy is using. So, I'm just shooting from the hip. I did try this with the Old Simple Sniper and it worked OK.

Share this post


Link to post
Share on other sites
 

I am not using this code right now. I have most of my cameras pulled for the year. I did not realize there was still a sensing issue with it.

Share this post


Link to post
Share on other sites
 

peter,

I've looked through the code a few times and can't see anything wrong with your program. Try copying mine again and see if it works before editing anything.

Share this post


Link to post
Share on other sites
 

I am really intrigued with the day/night possibilities here. Looking through the code I see goto itsdark. I realize if the value is read and it thinks it's dark it should goto itsdark. So....

 

Itsdark: is located at the bottom of the code.

NAP 3

GoTo lowpower

 

This continues if no motion is detected, but interrupted when MotionSensorInputPin=1 (motion is detected).

 

So is the code checking for day/night every time after motion is detected? I think Yes, but the pause 3000 is confusing to me after it identifies the light value. Does it only wait 3 seconds if it's dark? If it's light, does it skip the 3 seconds? Could this be throwing something off???

 

I'm not sure why it maybe acting up for you. Good luck with any other tweaks with the code and be sure to let us know how it works out for you.

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
Sign in to follow this  

×