Capture an image from a webcam and upload to Dropbox.
This project is named after Wilson, a red-eared slider turtle adopted from Little RES Q several years ago. I currently use it to take pictures of my pet turtle.
All components used are older versions and can easily be replaced by something newer.
NOTE: Since I only have a small memory card, the system boot happens using the memory card with BerryBoot, and the operating system is mounted from the USB drive.
- Raspberry Pi 1 Model B
- 512MB SD Card
- 8GB USB Flash Drive
- TP-LINK TL-WN725N (wireless USB adapter)
- Microsoft Lifecam VX-3000 (webcam)
- USB Hub
- Using your computer, install BerryBoot onto the SD Card (see http://www.berryterminal.com/doku.php/berryboot)
- Assemble the Raspberry Pi and power on
- Place SD Card in slot
- Plug the USB drive in one USB slot
- Plug the USB hub into the other USB slot
- Connect any additional USB devices into the hub (e.g. keyboard, mouse, webcam, wifi adapter)
- Connect a monitor with a HDMI cable
- Connect to the internet with an ethernet cable
- Connect to power
- Install Jessie Raspbian to the USB drive using BerryBoot
- Configure wireless adapter to connect to wifi so that a wired connection is not necessary
git clone https://github.com/ravangen/Wilson-Cam.git
this repository andcd Wilson-Cam
- The instructions assume you are cloning to
$HOME
(~
, the default directory)
- Install python package dependencies:
pip install -r requirements.txt
- Create a Dropbox app at https://www.dropbox.com/developers/apps/create using the "Dropbox API", "App Folder" access type, and an app name of your choice
- Open this new Dropbox app and generate a OAuth 2 access token to be used to upload the image
- Keep this value secret, anyone can view/edit your files in the app folder with this token
- Generate an image by running
DROPBOX_TOKEN=<YOUR-TOKEN-HERE> python $HOME/Wilson-Cam/camera.py
- Should create
image.jpeg
in theWilson-Cam
local folder - Should upload this image to the Dropbox app folder named
img.jpeg
- Run
crontab -e
to edit tasks run bycron
- Add
*/5 * * * * DROPBOX_TOKEN=<YOUR-TOKEN-HERE> python $HOME/Wilson-Cam/camera.py >> $HOME/Wilson-Cam/camera.log 2>&1
*/5
is the frequency to run, every 5 minutes (*/1
would be every minute)- Writes info and error output to a log file
camera.log
in$HOME/Wilson-Cam
- Save file changes
- Confirm your changes with
crontab -l
and watchcamera.log
for updates about what has happened