Jump to content

Recommended Posts

Hello,

 

I'm using a PIC12F683 (I also have a 629 on hand as well) and am programming a simple circuit which will tell a camera to take a picture (by shorting the two sides of the switch in the camera) every certain time interval.

 

Here's my current program:

void main()
{
  trisio = 0;		//configure port B pins as output
  while( 1 )	  //endless loop
  {
 gpio.0 = 0;
 delay_ms( 10000 );  // pause 10.0 seconds
 gpio.0 = 1;
 delay_ms( 500 );  // pause 0.5 seconds
  }

}

 

which will use GPIO pin 0 to pulse high for .5 secs, and sink low for 10.0 .

 

The problem with this is that this won't necessarily short the switch (I suppose I could use a relay, but its a waste of energy with the small amount of power I will have available).

 

Is there a way to short two io pins via software (cause the resistance across them to go to 0)?

 

Thanks!

Link to post
Share on other sites
Hello,

 

I'm using a PIC12F683 (I also have a 629 on hand as well) and am programming a simple circuit which will tell a camera to take a picture (by shorting the two sides of the switch in the camera) every certain time interval.

 

Here's my current program:

void main()
{
  trisio = 0;		//configure port B pins as output
  while( 1 )	  //endless loop
  {
 gpio.0 = 0;
 delay_ms( 10000 );  // pause 10.0 seconds
 gpio.0 = 1;
 delay_ms( 500 );  // pause 0.5 seconds
  }

}

 

which will use GPIO pin 0 to pulse high for .5 secs, and sink low for 10.0 .

 

The problem with this is that this won't necessarily short the switch (I suppose I could use a relay, but its a waste of energy with the small amount of power I will have available).

 

Is there a way to short two io pins via software (cause the resistance across them to go to 0)?

 

Thanks!

 

If you want a voltage free contact (not tied to PICs supply) you either need to use a relay or you could use an opto coupler (or a back to back pair of opto couplers). If you want lower current consumption than a low power relay (such as a reed relay) then you ideally want to use darlington optocouplers.

Link to post
Share on other sites

Forget about shorting the two pins of the switch together. You have the right idea using a sigle I/O.

Next step is to pull out your meter and figure out how the camera knows you pressed the switch.

You also need to follow the traces on the board to figure out what side of the switch you will be connecting

your PIC I/O.

 

If the switch supplies GND, have your pic do the same and tie your I/O directly to the buisness end

of the switch. If it supplies a positive voltage you may need to take some extra steps.

If the switch voltage is higher than your PIC's supply voltage you may be able to tie your I/O

directly in and get by. If the switch voltage is lower, add a resistor inline to drop it down to what

you need.

 

 

matt

Link to post
Share on other sites

Alright, thanks for the help guys!

 

I have some optocouplers, but the minimum voltage is going to be a bit too high for whats available (I'm using batteries and making this whole thing portable... I'm actually strapping a camera to my cat to see where it goes during the day :P ).

 

So I'll try the other method of figuring out whether the camera is grounding or supplying voltage via the switch. Just so I'm sure about this, setting an IO pin as LOW is the same as "grounding" correct (since the current is 'sunk')? Supplying voltage won't be a problem because the camera (a keychain camera) uses 1 AAA alkaline, and if necessary I have a DC-DC setup-up regulator IC as well.

 

Thanks again!

Link to post
Share on other sites
I'm actually strapping a camera to my cat to see where it goes during the day :P ).

 

Please dont post any candid shots of it washing its bits!

 

 

setting an IO pin as LOW is the same as "grounding" correct (since the current is 'sunk')?

 

Almost grounding, but it should be enough for your purpose.

 

I have one of those keychain cameras, a problem is that the picture memory is volatile and a momentary intermittent contact of the battery just from vibration can wipe all the pictures, be warned!

Link to post
Share on other sites

Haha, well I'll sift through the pictures before posting anything ;)

 

The camera I got has an SD slot, so luckily even if the batteries do fail (which I count on because this model is infamous for eating batteries like kids with cake), the pictures will still be there.

 

Alright, thanks for the help everyone,

Cheers!

Link to post
Share on other sites

Hi,

 

I think there is a problem in your code, when you write :

 

delay_ms( 10000 ); // pause 10.0 seconds

 

because the delay_ms have a 'unsigned char' parameter (8 bits).

Your real delay with this call is probabely 16 ms (10000 = 0x2710 > then only 0x10 for you > 16 ms).

The same with your 'delay_ms(500)'....

I think you must write :

 

delay_s( 10 ); // pause 10.0 seconds

 

and

 

delay_ms( 250 ); // pause 250 milliseconds

delay_ms( 250 ); // pause 250 milliseconds

 

but I can be wrong....

Link to post
Share on other sites

Haha, drats. Great minds think alike I suppose :P

 

Well, I was going to take a pic every 10 seconds or so for around 7-8 hours and then use frame-blending to form a smoother looking time-lapse movie. So its not entirely the same ;)

 

And plus, Jürgen has a boy kitty, and I have a girl one, so instead of checking out the hotties like Mr. Lee does, Polly should be doing more adventurous stuff! :D

 

Its kinda cool he's selling it, now everyone can see where their cats go off to! Haha, it might infringe on privacy though. Before you know it, the NSA and CIA will use kitty-cams to spy instead of wiretapping; no one can resist a fluffy kitty!

 

Cheers!

Link to post
Share on other sites
And plus, Jürgen has a boy kitty, and I have a girl one, so instead of checking out the hotties like Mr. Lee does, Polly should be doing more adventurous stuff! ;)

Cheers!

 

If anything like my cats, the female will spend most of her time sat above the fridge growling at the male .

Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...