Society of Robots - Robot Forum
Electronics => Electronics => Topic started by: dmehling on June 20, 2008, 01:29:15 PM
-
I am working on a robotic application using a Web camera to take still images. The camera is mounted on a servo to allow it to rotate. I want to be able to trigger a sequence of rotating the camera and signaling the Web camera software to take a picture. I have a microcontroller to initiate the process. I need to figure out how to get the microcontroller to activate the software. The software has a single button you can click on with the mouse to take the picture. I was going to use a macro program that would automatically move the mouse and make it click with keyboard input. I have a small servo that I was going to use to hit one of the function keys. However, that would be a single key, and macro programs are designed to launch a macro with a combination of at least two keys. Any suggestions on how to do this, or alternative methods?
-
i would do it using the serial port ,send commands from pc to microcontroller
whether to move camera right or left or to snap a shot
-
Actually I am trying to do the opposite of what you are saying. I have no difficulties in setting up my servo and microcontroller to position the camera. What I need is microcontroller to PC communication. I need to be able to trigger the Web camera software to initiate an image capture. How do I get my microcontroller to send the message to my PC?
-
You can still use the serial port, it works both ways for communication. =)
Anyway, sounds like you'll have to write a custom program on the PC side which reads the serial port and when it gets some special code out of the serial port it triggers the program to move/take a picture on the webcam. If you have Visual Studio I believe it still comes with something called API Spy -- you can use this in conjunction with the following Win32 APIs
FindWindow
FindWindowEx
SendMessage / PostMessage (can't remember which)
To send a button a keypress through software, the window doesn't even need to have focus and it should still work.
-
if you want a ready made solution check out Phidgets.com
-
As I understand you want to launch the picture-capture software from your automation setup, perhaps you have a digital input that is triggered when a detector senses a possum walking past etc.
Using a servo, to press a key, or launching a mouse moving macro is NOT the way to do it though... It's like using a small remote controlled helicopter to fly accross the room and switch a light switch.. It's cumbersome..
So how to do it ?,
Your web cam, must have a DLL, or some library that can capture and image to a file via a command from you custom application.
I think you need to have an applicaiton that can listen on your serial port an/or poll your external device, and launch the camera image capture via a DLL, or a API, or some external library...
If you don't program, it may be a bit of work, but it is the only way to go, really.
If you want, I could do it for you in a couple of hours I reckon, you pick the language, and the operating system, tell me the hardware your using (connected to the serial port) and the web cam...