Tweeting Pi-Zero-W GIF Camera

Updated 09 May 2017

I made a Raspberry Pi camera that captures GIF files and optionally tweets them over WiFi! It's built around a Raspberry Pi Zero W and a Pi Camera module. The camera connects to a pre-programmed WiFi network to tweet the gifs, but you can also retrieve them from a shared folder if you have another computer on that network.

Take your snaps outside with diffuse light for best results. Here's me mucking around in our carpark - full sun.

gifcam-demonstration-outsie

The original project is from here. We took some time to modify the code and build instructions to make them more suitable for the freshly-released Pi Zero W.

What you need

  • A WiFi enabled Raspberry Pi. I recommend a Pi Zero W for a nice fit in the case. If you're rolling your own enclosure you could use a Pi 3 B.
  • The 3D printed case (files on thingiverse)
  • A Raspberry Pi Camera
  • An illuminated button. We recommend a 16mm yellow one to suit the case.
  • A red led
  • Two 220 Ohm resistors
  • A switch for switching power.
  • If you follow our headless setup tutorial you will not need a spare keyboard, mouse or monitor to setup your Pi.

Basic Installation

We'll start off with the software side of things before we assemble the final product. With your Pi powered and the camera plugged in, follow the following steps.

Make sure you're in the user directory:

cd ~

Download the gifcam project:

wget https://github.com/CoreElectronics/gifcam/archive/master.zip

unzip and rename the project:

unzip master.zip && mv gifcam-master gifcam

Run the installer script:

sudo ~/gifcam/installer.sh

This will take a long time if your pi needs to download updates

After installation finishes, the Pi will reboot.

Run the gifcam project to make sure everything works fine

python ~/gifcam/gifcam.py

The console should display "System Ready." This means the python script is running and the camera is ready to make a GIF. The LED on the camera should turn on. You can trigger the camera to make a GIF by connecting GPIO19 to ground - if everything is running correctly you should see the text "Gif Started" on the console, followed by "Processing", "Done", and "System Ready" once the camera is ready to make another GIF.

If you're happy with how everything is working, you can set the gifcam script to launch at startup. Open your crontab with crontab -e and enter the following at the bottom of the file:

@reboot sh /home/pi/gifcam/launcher.sh

Twitter Integration

If you want, you can set the camera to tweet any GIF you snap!

    Create a twitter app at

https://apps.twitter.com/

    and populate

gifcam.py

    with the necessary credentials. Within gifcam.py, locate the Behaviour Variables section and set

tweet = True

Build

The parts were 3D printed in two batches, one for the body, and one for the front and back. This created the familiar "toy camera" colour-scheme. If you don't have access to a 3D printer, we have you covered with our 3D Hubs service!

gifcam-3d-printed-parts

This is the circuit layout for the project:

gifcam-circuit

Not pictured of course is the Pi Camera. The momentary switch and yellow LED are integrated into a single part

It appears that the Adafruit PowerBoost 1000C has gone through a design revision that mirrors its component layout. This means that when mounting the newer PowerBoost in the 3D printed case, the battery connection socket is hard up against a wall. Rather than figure out a mounting solution or redesign the case, I soldered some wires to the Vbat and GND connections that are broken out on the board. I terminated these wires with a JST connecter, which meant I had to replace the connector on the original battery. 

gifcam-charger-battery

NOOB ALERT

Replacing connectors on LiPo batteries is not something you want to attempt if you're not confident. Remember that you're working on an electrically live device - the voltage isn't the danger here. If you accidentally short your battery you can damage yourself, your tools and potentially burn down whatever building you're working in. A common mistake is to think "I need to cut these wires to the same length to keep things neat, so I'll cut them at the same time." Big mistake. Clearly, this creates a dead short across the battery terminals when you cut both wires at the same time. If you're going to attempt this procedure, make sure you always have one wire safely terminated - that is, cut and terminate one wire at a time. 

Changing up the battery and charger is just the start of the offroading. Because I only had access to a very short Pi Camera cable (the PZW takes a smaller connector than the camera) I couldn't mount the Pi on it's intended mounting bosses towards the left of the case.

gifcam-layout

The judicious use of hot-glue and kapton tape gives me loads of freedom in how the components will be secured. Because my PZW wasn't going to mount there anyway, I have a side-entry power switch (left) where the Pi's SD card would usually be accessed from. All this because of a short camera lead!

gifcam-complete

And here it is complete! I think the colour scheme lend a nice "toy-camera" aesthetic. The Pi camera needs lots of light for the GIFs to come out well, so I've found best results when snapping outdoors with bright, diffuse light..

Have a question? Ask the Author of this guide today!

Please enter minimum 20 characters

Your comment will be posted (automatically) on our Support Forum which is publicly accessible. Don't enter private information, such as your phone number.

Expect a quick reply during business hours, many of us check-in over the weekend as well.

Comments


Loading...
Feedback

Please continue if you would like to leave feedback for any of these topics:

  • Website features/issues
  • Content errors/improvements
  • Missing products/categories
  • Product assignments to categories
  • Search results relevance

For all other inquiries (orders status, stock levels, etc), please contact our support team for quick assistance.

Note: click continue and a draft email will be opened to edit. If you don't have an email client on your device, then send a message via the chat icon on the bottom left of our website.

Makers love reviews as much as you do, please follow this link to review the products you have purchased.