Project photo cabin

Hello, I am a new member. I am close to putting together a project that would be quite easy for someone with a little more experience than I.

I am using some code I found on the examples to determine the amount inserted into my coin collector, but I am at a loss when it comes to shooting a picture. Thats all I need. I have the camera tethered to the computer, I thought I could use eos utility to shoot the photo, but have no idea on how to do it.

Maybe this can be achieved using a hd webcam, and triggering it through a keystroke comand. For example I have a tiny webcam software that shoots when crtl+i is pressed. Maybe the arduino can send the key stroke when the right ammount is inserted.

Please include the command and the library needeD in your answer.

Below is the code I have so far:

const int coinInt = 0; 
//Attach coinInt to Interrupt Pin 0 (Digital Pin 2). Pin 3 = Interrpt Pin 1.

volatile float coinsValue = 0.00;
//Set the coinsValue to a Volatile float
//Volatile as this variable changes any time the Interrupt is triggered
int coinsChange = 0;                  
//A Coin has been inserted flag

void setup()
{
  Serial.begin(9600);                 
//Start Serial Communication
  attachInterrupt(coinInt, coinInserted, RISING);   
//If coinInt goes HIGH (a Pulse), call the coinInserted function
//An attachInterrupt will always trigger, even if your using delays

}

void coinInserted()    

//The function that is called every time it recieves a pulse
{
  coinsValue = coinsValue + 0.05;  
//As we set the Pulse to represent 5p or 5c we add this to the coinsValue
  coinsChange = 1;                           
//Flag that there has been a coin inserted
}

void loop()
{
  if(coinsChange == 1)          
//Check if a coin has been Inserted
  {
    coinsChange = 0;              
//unflag that a coin has been inserted
  
   if(coinsValue >= 0.30)
  {
        
  }
  }
}

WHEN THE COINS VALUE REACH .30 I NEED TO TAKE A PHOTO.

PLEASE HELP.

USING ARDUINO UNO

That is a very small extract of your code, surely? Nothing resets the coinValue so it will take picture continually. Use a int variable that counts cents, not a float that counts dollars/cents. Floats are not accurate. It usually is overkill to use interrupts, it causes all sort of subtle problems. loop() will run more than 500000 times a second with your code so it can see the coin going past.

But to get back to the original question - you want to trigger a camera from the arduino, where the camera picture goes to a pc.

Re-stating your problem, you want a signal sent from the Arduino to the pc. With the Uno you have two possibilities: (1) SoftwareSolution: you use the USB/Serial connection. You write a pc program, f.eks. using Processing from Processing.org which in turn does the camera communication. (2) HardwareSolution: You buy a USB-Host shield and the Arduino can be made to appear as a USB keyboard device. Or you buy a Leonardo instead as it can pretend it is a keyboard (I believe)

I have done several photo booth / photo cabin projects in the past. Most of the time I used eos utility to shoot the photos. And I wrote some software (for PC) to "push the button", display the photo on a monitors, send it to a printer or/and website. But this has nothing to do with Arduino. OK, sometimes there was a big illuminated (blinking) pushbutton involved, driven by an Arduino Leonardo that was connected to the laptop. But also this I would not describe as an Arduino project.

Of course you could use a Leonardo (or Micro). They can act as a USB keyboard (or mouse), to send space key to eos utiliy. This will take a picture. With the appropriate settings, eos utility will download the photo from the camera. With some additional software you could send it to a printer and so on...

(Almost) everything that can be done with a USB keyboard can also be done with Leonardo or Micro. You could work on command line or control some software (which is already there - so there is no need to program it yourself).

Msquare & uxomm :

Both of your answers are incredibly helpful. And I appreciate you taking the time to writing them. From what I get the USB-host shield is basically the end of my problems. Processing seems to me to be a bit on the challenging level. Though interesting, it is a different approach to one that I am comfortable with.

To expand on the idea, I am going to be using arduino to send the spacekey just as uxomm suggested. And as both pointed out, I need a usb-host shield, which is to be found on the Leonardo not the uno. =(.

Anyhow I was thinking on a different solution earlier today and would appreciate additional help on the matter. If I write a AHK .exe file that would launch eos utility and snap the image.

Is it possible to execute it from the arduino code?

Msquare: That is a very small extract of your code, surely? Nothing resets the coinValue so it will take picture continually. Use a int variable that counts cents, not a float that counts dollars/cents. Floats are not accurate. It usually is overkill to use interrupts, it causes all sort of subtle problems. loop() will run more than 500000 times a second with your code so it can see the coin going past.

I appreciate the effort to point me in the right direction. I understand the need to reset coinValue. But the fact that I had not picked on it earlier just points to my inexperience in this situation. Would you write a similar code that would execute a file called "time_to_shoot"? I would greatly appreciate it. I will then have no need to buy additional hardware or inmerse in learning material at processing.org.

Greatly appreciate your help.

Would you write a similar code

No.

After the Arduino has sensed your coins and decided it is all valid and good, it can take action:

  • Send 5V signals on its various output pins. This could activate a relay/motor. Using this to "click" the camera has been suggested
  • Send some bytes on a serial interface, which typically is connected via the USB to the pc, or perhaps some other device.
  • With a USB Host shield or WiFi shield or Bluethooth shield or Net shield send some text via the choosen shield. It can not run an exe file.