Jump to content
bowgod02

Slave Control

Recommended Posts

Ron,

I don't think that the 14m will allow you to wake the chip from sleep. I think only the X2 will allow that using the hardware interrupt.

 

 

Share this post


Link to post
Share on other sites
 

Thanks for the reply scott. What I am trying to do is just put the chip to sleep if it sees light for 5 minutes and then wake and check for light again. That way it will save power during the day time. Also if its dark just have it go through the main loop checking for a flash with no sleep at all.

Its working great unless I put the sleep command in there If Night_Flag = 0. If I do that and have it dark in the room it wont trigger. I was thinking it would only sleep if light and still loop when dark?

Share this post


Link to post
Share on other sites
 
 

I was going to say add

setint %00000001,%00000001 'activate interrupt when pin0 only goes high

Right after Main:

and see if it works?

Share this post


Link to post
Share on other sites
 

Try turning on your led when you put the chip to sleep and off after, that way you can see if it is sleeping when it shouldn't be.

 

If Night_Flag = 0 Then

High 1

let pins = %00000000

sleep 130

low 1

Endif

Edited by smclark

Share this post


Link to post
Share on other sites
 

Or try resetting the interrupt after sleep?

 

GoSub CdsChk

If Night_Flag = 1 Then

Inc Slave_Refresh

let pins = %00000001

EndIf

 

If Night_Flag = 0 Then

let pins = %00000000

sleep 130

setint %00000001,%00000001 'activate interrupt when pin0 only goes high

 

Endif

 

 

code]

Edited by TCSCOUT

Share this post


Link to post
Share on other sites
 

I messed with this some over coffee this morning before hunting and tried all the above with no success. But with smclark suggesting to turn on the led when the chip goes to sleep did find something interesting. When I power up the board everything is acting like it should and if dark the slave charges and the board is waiting on a cameras flash. The moment there is the first flash from the camera the chip is kicked into sleep. That was indicated by the led coming on before the cameras second flash went off. I lowered the sleep down to 30 seconds to be able to play with better and as soon as the chip came out of sleep the slave would fire everytime by itself. So it was getting the signal to flash but went to sleep first. So I wrote in before sleep "Flash_Flag = 0" and that stopped the flash from firing when the chip woke back up.

 

I covered the cds thinking that would stop the chip thinking its day when it sees the cams flash but that didnt help either and the chip still went to sleep apon cameras flash. I'm starting to think its not possible to put the chip to sleep during the day to save on juice. :angry: What my last try was...

 

GoSub CdsChk

If Night_Flag = 1 Then

Inc Slave_Refresh

let pins = %00000001

else

let pins = %00000010 'turn off pt and turn on led

Flash_Flag = 0

sleep 14

low 1

Endif

Edited by bowgod02

Share this post


Link to post
Share on other sites
 

The first question I have is, if the slave preflash is being picked up as daytime and sending it to sleep, why is the cdschk running when it should be looping through the timeout routine looking for the second flash. I don't see how that is possible. It sounds to me like you have a logic error coming out of the trigger code. It should trigger the interrupt on the preflash and then go into the routine watching for the second flash and for some reason it sounds like it is going straight into the top of main and checking for daylight or something.

Share this post


Link to post
Share on other sites
 

Yeah, its got me baffled for sure! It seems like it should be working great in simulator but for some odd reason it senses daylight when flashed. The program powers the cds and looks for light/dark in the main loop so that may be where I need to look. I have a couple ideas that I can try and hopefully one of them solve this so I can put the chip to sleep during the day to save on power. I want to solder this thing up and give it a test run. I wonder how much juice it would use if picaxe dont go to sleep. I never did learn how to measure how much power something uses.

Share this post


Link to post
Share on other sites
 
I never did learn how to measure how much power something uses.

 

Here is my attemp to show how to measure amperage(power useage). Move the red wire to the 3rd hole/connector on the meter, the one you never use. :blink: I recomend using the sweeping arm meter vs digital style meter as it is easier to see what is going on. The digital meter shows whats going on live and the digital updates every second so it is hard to see ups and downs.

 

post-738-1288525982_thumb.jpg

Edited by Badgerbuckhunter

Share this post


Link to post
Share on other sites
 

What about something like this?

 

Main:
' Main loop monitoring flags to determine what function to run based on flags set

If Night_Flag = 0 Then
        gosub Daytime
EndIf

If Slave_Refresh = 40 And Night_Flag = 1 Then
GoSub Slave_Charge

EndIf

If Flash_Flag <> 0 Then inc TO_Counter EndIF  ' Start counter if first flash detected
If TO_Counter = 35 then Gosub TimeOut  ' Timeout here if no other flash detected.  Adjust value if necessary to fit camera.
If Fire_Flag = 1 then ' Fire the flash if flag is set.  Disable interrupts.
Setint off
Gosub Fire_Flash
EndIF


Daytime:

setint off 'We don't need an interrupt in the daytime

    do

                sleep 7 'about 15 minutes
                gosub CdsChk 'check for light again
                
    loop while Night_Flag = 0 'if its daytime sleep another 15

setint %00000001,%00000001 'activate interrupt when pin0 only goes high

Return

Edited by tbass

Share this post


Link to post
Share on other sites
 
Yeah, its got me baffled for sure! It seems like it should be working great in simulator but for some odd reason it senses daylight when flashed. The program powers the cds and looks for light/dark in the main loop so that may be where I need to look. I have a couple ideas that I can try and hopefully one of them solve this so I can put the chip to sleep during the day to save on power. I want to solder this thing up and give it a test run. I wonder how much juice it would use if picaxe dont go to sleep. I never did learn how to measure how much power something uses.

 

Ron, I did a video of how to check current in the topic below, post # 23. You would do it the same way, set the meter up to read amps then put the meter in series with the battery power.

http://www.hagshouse.com/forums/index.php?...41322&st=15

 

Share this post


Link to post
Share on other sites
 

Thanks guys for the help. I have alot less hair at this point getting this thing to sleep if day. I'm messing with your idea right now tony to see if this will work.

Share this post


Link to post
Share on other sites
 

Tony,

 

I tried a couple different versions of your idea and it goes tosleep just great when it senses day. But it will still kick into daytime when it sees a camera flash. This has really really got me baffled since its not supposed to do this since it clearly is seeing that its night and shouldnt even come into play when dark. I may try it like it is and measure how much current it will use. I'll still be thinking on this and what to try next so if any of you have anymore ideas I'd sure try them. Build up this circuit tony so you can try to get it to sleep. You have alot more hair than I do.... :)

Share this post


Link to post
Share on other sites
 

I've got football and a bunch of cams to hack. You build it and send it to me :lol:

 

Oh and I have a new toy assembled and ready to play with. I figured you would have one by now too.

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

×