PDA

View Full Version : I need some coding help for a Aerial photography shutter



Tobrew
08-12-2005, 12:11 PM
My current·project is a shutter release·for my digital camera while it is attached to my R/C plane so that I can do aerial photography.· I want to be able to use the camera in three seperate modes: Single mode (camera takes picture when I tell it too via a control stick on the transmitter), Continuous mode (camera takes picture every 5 seconds), and movie mode (camera is triggered every 30 seconds to capture mini movies).· Because weight is an issue with all R/C plane projects I want to be able to select the mode with a single pushbutton switch.· I was hoping to have a sequence something like this.

1- Apply power to circuit
2- User has 10 seconds to select the mode via the single pushbutton.
3- After 10 seconds the LED blinks 1,2,or 3 times to indicate mode.
3- Circuit enters the appropriate mode.

note: when I use the word 'mode' I am referring to a small block of code that the BS2 will run to trigger the camera shutter high/low.

I have figured out how to do·the camera control stuff·via the transmitter and how to·trigger the camera but I can't quite grasp how to do the above initialization sequence with a single pushbutton within a 10 second window.

Any help would be appreciated.

Thanks, Rick

Tracy Allen
08-12-2005, 12:54 PM
Maybe something like the following. Program waits up to 10 seconds for user to press button. If not, it reads default mode from eeprom. If user presses button, they have to observe the led. It flashes one, two three. If they release the button after one flash, the mode is 1, etc... The new selected mode is written to eeprrom. Code goes on to blink led to show selected mode, then on to main program.




idx VAR byte ' index
modex VAR nib ' mode= 1,2, or 3
modeLoc DATA 1 ' compile time default mode in eeprom
led PIN 0 ' high turns on led
initialize:
LOW led ' led off
FOR idx=0 TO 100 ' allow 10 seconds
PAUSE 100
IF PB=0 THEN UserModeChange ' pushbutton is pressed
NEXT
GOTO BLINK ' no pressed button, use default mode
UserModeChange:
FOR idx = 1 to 3
HIGH led ' led on flash 0.1 sec
PAUSE 100
LOW led
PAUSE 1000 ' allow 1 sec for user to release button
IF PB = 1 THEN EXIT ' user selected current idx as mode
NEXT
WRITE modeLoc,idx ' save as new default
blink:
PAUSE 1000
FOR idx=1 to modex ' flash led modex times
PULSOUT led,50000
PAUSE 100
NEXT
andSoOn:

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com (http://www.emesystems.com)

steve_b
08-12-2005, 07:32 PM
Do you have a camera in mind already?
There are issues with using just ANY camera in that you can't use the stamp to talk to it via USB.
There ARE serial-type cameras out there...and I wish I remembered what they are (as I'm looking for a remote camera use at the moment).

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·

Steve

"Inside each and every one of us is our one, true authentic swing. Something we was born with. Something that's ours and ours alone. Something that can't be learned... something that's got to be remembered."

Bean
08-12-2005, 07:40 PM
I have a koday DC210 that is serial...And I have the tech docs to use it !
Only problem is it's really heavy and only 1MegaPixel.
I had visions of floating it on a helium ballon to get arial photos, but it never happened...
Bean.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"SX-Video·Module" Now available from Parallax for only $28.95

http://www.parallax.com/detail.asp?product_id=30012

Product web site: www.sxvm.com (http://www.sxvm.com)

"One experiment is worth a thousand theories"


Post Edited (Bean (Hitt Consulting)) : 8/12/2005 1:37:09 PM GMT

steve_b
08-12-2005, 08:16 PM
Sadly I think it's getting tough to find 'newer' cameras that support serial comms. Odds are they'll be a few years old, which means larger and heavier like yours Bean.

I do hope they muster up a USB slave>slave IC....that opens up a whole new world for the Stamp.

After saying that much...I googled "USB IC slave to slave" and found a couple items of interest.

http://www.semiconductors.philips.com/acrobat_download/literature/9397/75011327.pdf

The ISP1760 looks like it offers USB control without the need for a PC.· Designed for embedded designs.

I suppose it could still be somewhat tricky to implement but it certain opens more things up if it can be used with the Stamp.

http://www.semiconductors.philips.com/acrobat_download/datasheets/ISP1760_1.pdf· There's the datasheet....it quotes, "The ISP1760 is a slave host: it does not require "bus-mastering" capabilites of the host system bus.

Downside is that it's a 128pin quad flat pack and looks like it's parallel from the stamp (so more a whack of pins used up on your stamp).

I'm unsure how fast the stamp would need to work in order to receive data streams from the IC but for the most part the stamp would only have to send out a command string and maybe listen for an ACK or whatever.·

So in the OP's use, they could use a digital camera and interface the stamp via this IC and just send the appropriate commands to the tell the camera to go in to 'X' mode and focus and stuff.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·

Steve

"Inside each and every one of us is our one, true authentic swing. Something we was born with. Something that's ours and ours alone. Something that can't be learned... something that's got to be remembered."

Post Edited (steve_b) : 8/12/2005 12:28:40 PM GMT

Tobrew
08-13-2005, 06:12 AM
I'm not controlling the camera via serial.· I'm using a much lower tech approach by using a small relay that triggers the actual shutter button.· It requires opening the camera and soldering on to the camera motherboard.· As you can imagine, I'm not using my most expensive camera·for this project. I'm using this camera...http://www.concord-camera.com/products_detail.aspx?id=224.· Most guys use a servo to actually press the shutter button down.· I wanted a higher tech approach.· This site has a wealth of info...http://www.rc-cam.com/.

Tracy, thanks for the code.· I will give it a try and see if I can make it work.

Thanks.

Rick

Tobrew
08-13-2005, 01:10 PM
I finally got the startup·routine working thanks to Tracy's code.· I had to tweak it some but it works great.· Here is the code:



' {$STAMP BS2}
' {$PBASIC 2.5}

index VAR Byte ' index= mode 1,2,3
modex VAR Nib ' mode= 1,2, or 3 LED flash
modeLoc DATA 1 ' store mode in eeprom
led PIN 0 ' high turns on led
PB PIN 1 ' pushbutton
Beep PIN 2 ' speaker

initialize:
LOW led ' LED off
PAUSE 1000
' Pause before selection
UserModeChange:
FOR index = 1 TO 3 ' start mode sequence
DEBUG ? index
HIGH led ' led on flash 0.1 sec
PAUSE 100
LOW led
PAUSE 1000 ' allow 1 sec for user to release button
IF PB = 1 THEN EXIT ' user selected current index as mode
NEXT
IF index > 3 THEN index = 3 ' if no mode is selected then default to 3
WRITE modeLoc, index ' save as new default

Blink:
PAUSE 1000
FOR modex = 1 TO index ' flash led modex times
PULSOUT led, 50000 ' flash LED to indicate mode
FREQOUT BEEP, 200, 2000 ' Beep speaker to indicate mode
PAUSE 200
NEXT

READ modeLoc,index
DEBUG "final mode "
DEBUG DEC index , CR




·Thanks for all the help guys.· Especially Tracy.

Rick
·

knightofoldcode
08-14-2005, 07:37 PM
Tobrew said...
I'm not controlling the camera via serial. I'm using a much lower tech approach by using a small relay that triggers the actual shutter button. It requires opening the camera and soldering on to the camera motherboard. As you can imagine, I'm not using my most expensive camera for this project. I'm using this camera...http://www.concord-camera.com/products_detail.aspx?id=224. Most guys use a servo to actually press the shutter button down. I wanted a higher tech approach. This site has a wealth of info...http://www.rc-cam.com/.

Tracy, thanks for the code. I will give it a try and see if I can make it work.

Thanks.

Rick


Reminds me....

The United States was getting into the "Space Race", and realized... they have no way of writing anything! Normal pens require gravity to work, no graivty, no ink. So, they spent millions of dollars to invest in this pen that could write upside down, underwater, in vaccum of space, etc. The Russians used a Pencil. Sometimes the lowtech approach is best. ;)

BTW, Tobrew, I'd suggest it be a Solid State Relay, if your'e going to be snapping once every 30 seconds.

Knight.

steve_b
08-15-2005, 08:49 PM
Wasn't that the "Astronaut Pen" from one Seinfeld episode?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·

Steve

"Inside each and every one of us is our one, true authentic swing. Something we was born with. Something that's ours and ours alone. Something that can't be learned... something that's got to be remembered."

Tobrew
08-16-2005, 12:37 PM
I was actually given a Fisher "Space Pen" as a gift many years ago (http://www.spacepen.com/usa/index2.htm
).· However, I have been unable to test it in space yet http://forums.parallax.com/images/smilies/smilewinkgrin.gif .

Knight:· I am using a AQV212 RELAY OPTO SPST-NO 400MA 6pin-DIP.

I've got the camera shutter circuit built on a breadboard and fully programmed.· I am now testing the circuit/programming and tightening code.· More to come.

Rick

steve_b
08-16-2005, 08:50 PM
Hey, build a servo with a pen holder in it and launch a "near space" balloon and when you're above a certain altitude, have the servo scribble something with the pen.
Have a 2nd servo tilt the first one around so that it's upside down and such....
Take digital pics of it all.....

Or....just trust that it'll work and save some burnt hair on

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·

Steve

"Inside each and every one of us is our one, true authentic swing. Something we was born with. Something that's ours and ours alone. Something that can't be learned... something that's got to be remembered."

knightofoldcode
08-17-2005, 02:54 PM
steve_b said...
Wasn't that the "Astronaut Pen" from one Seinfeld episode?


I have no clue. Probably. I don't watch Seinfeld. Heard about it from a friend of a friend, whom was/is a astronaut.

Eh, the US was bad, but the Russians had it worse.

Rocket wouldn't go off. So all of their scientists run up to it to figure out what went wrong. Boom. The whole thing exploded, something like 90% of all thier leading scientists of that field, died.

Knight.

steve_b
08-17-2005, 08:13 PM
Russia's leaps and bounds (wrt space) weren't as big as the US's....but they're pretty consistant/determined....they can turn around 3 or 4 rocket trips (osoyoo's?? rockets) by the time the shuttle gets one in.
Something to be said about babysteps I guess!
Granted, how big of a comfort level can you have in something that's 30/40 yrs old but still gets the job done!

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·

Steve

"Inside each and every one of us is our one, true authentic swing. Something we was born with. Something that's ours and ours alone. Something that can't be learned... something that's got to be remembered."

knightofoldcode
08-18-2005, 08:25 AM
steve_b said...
Russia's leaps and bounds (wrt space) weren't as big as the US's....but they're pretty consistant/determined....they can turn around 3 or 4 rocket trips (osoyoo's?? rockets) by the time the shuttle gets one in.
Something to be said about babysteps I guess!
Granted, how big of a comfort level can you have in something that's 30/40 yrs old but still gets the job done!


Yeah, but the Russians have developed modules for the International Space Station, that they can't send up! Only the US Shuttles have a large enough cargo bay to haul it up there!

Knight.

steve_b
08-18-2005, 08:57 PM
Strap a couple of their rockets to one of their Galaxy cargo planes (the ones that are bigger than the Herc's)....throw some heating tile on the front (tin foil maybe?).

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·

Steve

"Inside each and every one of us is our one, true authentic swing. Something we was born with. Something that's ours and ours alone. Something that can't be learned... something that's got to be remembered."