Welcome Anonymous
Fledgling
Fledgling
It is currently Fri Sep 22, 2017 2:54 pm

All times are



Post new topic Reply to topic  [ Array ] 
Author Message
 Post subject: day/night determination
PostPosted: Thu Mar 03, 2011 6:36 pm 
Offline
Moderator
Moderator

Joined: Sun Jan 31, 2010 9:07 pm
Posts: 3334
Location: Central PA near PSU
I used this code to make sure the board was seeing night when I thought it was night. dkirk mentioned there may be a variance with the cds between sources. I have some from Yeti, some from digikey, radio shack, and tayda. I didn't take the time to figure out if there are differences, or what the differences are.

Code:
#rem

Coded By: tbass
Coded On: 2/26/2011
Reason: To determine my own ADC for day and night.

#endrem

#picaxe20x2               
#terminal 9600
#no_table
disablebod


'###################################################################################################
'# Give the ports descriptive names
'###################################################################################################
Symbol inCDS = B.5           'CDS input to read light level
Symbol outCDS = C.5        'CDS Output to power CDS while checking light levels
Symbol outLED = B.2        'LED output
               
Input inCDS
Output outCDS

Symbol intADCVal = b4      'This is an integer value of the ADC reading
Symbol intCount   = b6      'This is an integer to count with
Symbol dayThreshold = b7   'This is an integer to determine the day/night adc value

'###################################################################################################
'# Set up the ADC
'###################################################################################################
adcsetup = %010000000000   'Set up B.5 as an ADC Input

'########################
'
'   Change dayThreshold higher if the board thinks it is night but it is not
'    Change it lower if the board thinks it is daylight and it is not
'
'########################

dayThreshold = 130

getCDS:

   High outCDS                  'Put the output high to the divider circuit
     readadc 10 , intADCVal   'Read the ADC value into intADCVal
     Low outCDS                  'Put the output low again
     
    sertxd ("CDS ", #intADCVal,13,10)
    sertxd ("Again",13,10)
   
    '########################
    '
    '   Change dayThreshold higher if the board thinks it is night but it is not
    ' Change it lower if the board thinks it is daylight and it is not
    '
    '########################
   
    If intADCVal > dayThreshold then
       for intCount = 1 to 10
          toggle outLED   'blink 5 times
          pause 300
       next
    Else
       for intCount = 1 to 6
          toggle outLED   'blink 3 times
          pause 300
       next
    EndIf
     
   Sleep 2

goto getCDS


Top
 Profile  
Reply with quote  
PostPosted: Thu Mar 03, 2011 10:03 pm 
Offline
Moderator
Moderator
User avatar

Joined: Sun Jan 31, 2010 4:39 pm
Posts: 1420
Fantastic info Tony, I could even follow it....I have a build that is right down this alley
Joe

_________________
JCTA- Joe's Custom Trailcam Accessories


Top
 Profile  
Reply with quote  
PostPosted: Wed Apr 06, 2011 7:55 am 
Offline
Fledgling
Fledgling

Joined: Mon Mar 01, 2010 10:34 am
Posts: 34
Tony,
Do you have to have and exchanger to use with the AIO board or does the AIO control the Day/Night part too?

Emmett


Top
 Profile  
Reply with quote  
PostPosted: Wed Apr 06, 2011 8:32 am 
Offline
Moderator
Moderator

Joined: Sun Jan 31, 2010 9:07 pm
Posts: 3334
Location: Central PA near PSU
I'm not sure what you are asking. What are you trying to build?


Top
 Profile  
Reply with quote  
PostPosted: Wed Apr 06, 2011 8:36 am 
Offline
Fledgling
Fledgling

Joined: Mon Mar 01, 2010 10:34 am
Posts: 34
A P32 that takes Color day pics and IR night pics. I should have read the Topic closer I see that you are trying to find out what cds works better with the AIO board for day/night sensativity correct so if so my bad.

Emmett


Top
 Profile  
Reply with quote  
PostPosted: Wed Apr 06, 2011 9:59 am 
Offline
Moderator
Moderator

Joined: Sun Jan 31, 2010 9:07 pm
Posts: 3334
Location: Central PA near PSU
Not exactly. This is just to calibrate it for the cds used, and the lens used. You may need to change the value depending on if you have a white, gray, brown, or otherwise colored fresnal. Or if you locate the cds outside the build where it can get a ton of light.


Top
 Profile  
Reply with quote  
PostPosted: Wed Apr 06, 2011 10:31 am 
Offline
Fledgling
Fledgling

Joined: Mon Mar 01, 2010 10:34 am
Posts: 34
I see. My bad for not really reading everything first before I posted my reply.


Top
 Profile  
Reply with quote  
PostPosted: Tue Jul 19, 2011 6:49 pm 
Offline
Moderator
Moderator
User avatar

Joined: Mon Feb 01, 2010 5:45 pm
Posts: 4385
Location: Sussex County NJ
I have been playing with this tonight and it's really a neat program to mess with.

Thanks Tony :cheers

_________________
Image trailcamkits.com


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ Array ] 

All times are


Who is online


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group