Tic Tac Camera

Tic Tac Camera

Here's a really fun project using a Raspberry Pi Zero W and a tic tac box!

What is it?

It's a very small camera setup inside a tic tac box!

What you need


A raspberry Pi Zero W with a LiPo SHIM soldered on, a LiPo battery and a Pi Zero camera all fit inside an XL tic tac box! You will need to solder or buy a Raspberry Pi Zero W with the pins already soldered on. Then you need to solder the LiPo SHIM onto the Raspberry Pi Zero W. There's no getting away from soldering in this project!

This makes a great on the go camera. You could record video, take a photo every 5 seconds, anything you want!

Back and front of the box:

I experimented with the battery to see how long it would last. The smallest battery I had was this 150mAh lipo, a bigger one would probably still fit in this box.

I charged the battery then set the pi running to record video from startup. With a 150mAh lipo battery it recorded 16 minutes of footage. So not a terribly long time but not bad given how small the setup is.


The python code for recording video is below:

# import libraries
from picamera import PiCamera
from time import sleep
from time import gmtime, strftime
#set the filename
fname = strftime("%b%Y%H%M%S", gmtime())
filename  = "/home/pi/Desktop/" + fname + ".jpg"
filename2 = "/home/pi/Desktop/" + fname + ".h264"> 

#start the camera
camera = PiCamera()
# take a photo to make sure the camera is in the right place
# start recording the video

I commented out the stop_recording() and stop_preview() line as the battery would die before the sleep finished. If you only wanted a minute of video you could change sleep to 60 and remove the # before those last two lines to stop the camera recording.

This records an image with todays date and time and a video with the same name. The video is recorded in h264 format. In the command line on the pi you can convert this to mp4 by typing

MP4Box add Sep2019121501.h264 movieA.mp4

This converts the movie called Sep2019121501.h264 into movieA.mp4

Related Article