Can anyone give me any pointers on using a relay/switch with the GPIO pins?
What I have is a camera (Canon camera running CHDK) connected to my RPi. I have a script on the RPi running every minute which basically does this...
Takes photo
Downloads photo from camera
Deletes photo from camera
Resizes photo
Uploads photo
The problem is that the camera every so often crashes or dies for some reason, generally requiring me to press the power button. I've stabilised the script as much as I can which has improved things a lot. Getting hours of capture rather than minutes. I've also designed the script to detect whether the camera is turned on or off. If it is off the capture part of the script doesn't run and it outputs a message to a log.
The camera is running on 5V and I'd like to have some way to connect the GPIO to the camera on/off switch so when the script detects that the camera is turned off (this is simple via lsusb) it flips the switch and the camera turns on again.
Am I right in thinking a relay is the correct item for the job?
If so, any pointers, tips or advice on how to do what I want?