Steps to get BerryCam up and running on your Raspberry Pi and iOS device
IMPORTANT. Read this before you begin:
Berrycam currently uses the raspistill and picamera libraries to capture images. With the release of Raspberry Pi OS 11 (Bullseye), libcamera is the default capture library. Whilst most functionality has been ported over from raspistill, many areas are still in development and there are some performance issues when using models of Pi such as the Pi Zero.
You can read more about the transition to Libcamera over on the Raspberry Pi news pages.
** It is recommended that you use Raspberry Pi OS 10 (Buster)** whilst these issues are ironed out in implementing the new capture libraries. This will take some time, yet is necessary to ensure the full range of functionality available within the Berrycam app works accurately and reliably. Sorry there is no solution as of yet in using the latest OS which has a number of improvements; but this is a pragmatic solution in the interim which will save you a ton of time.
Raspistill version of the BerryCam.py script
BerryCam originally used Raspistill to capture images. However there is a new version which uses the popular PiCamera package. Both versions are available within this Repo, and designed to work with the latest version of the BerryCam app. If you wish to use the PiCamera version, please update your BerryCam app from the App Store to the latest version.
Whilst the code is different in areas, set up remains the same process, although the raspistill version is now called
You can rename this file to
berryCam.py and replace the PiCamera version if you wish to use the Raspistill script without the need to change the run commands within this guide.
Items you will need
It's important that you have the following items to run BerryCam.
- A Raspberry Pi computer (any model) with WiFi connectivity.
- An SD card. Most models now take the Micro SD type although some work with standard sized SD cards.
- All the necessary leads (power supply, HDMI cable, mouse and keyboard, if working from Raspberry Pi OS desktop).
- A working WiFi connection.
- A Raspberry Pi camera module (V1, V2, NoIR and HQ Camera all work).
- An iOS device running iOS 14 (iPhone or iPad).
Useful guides to get started
Before we get into the detail of setting up and using BerryCam, here are some useful resources. It's worthwhile taking the time to explore these pages as they will help you get your Raspberry Pi up and running for the first time. If you're familiar with all of this you may wish to skip this part
Setting up your Raspberry Pi Here you’ll learn about your Raspberry Pi, what things you need to use it, and how to set it up.
Manually configuring Wifi
Set up the
wpa_supplicant.conf so you have Wifi connectivity on first boot.
Using your Raspberry Pi Learn about Raspberry Pi OS, included software, and how to adjust some key settings to your needs.
Remote access using the Terminal/SSH It's recommended you take a look at the resources here as you will need to use Terminal and some basic commands to install BerryCam and run the Python script.
Other Frequently Asked Questions A wide range of information related to the hardware and software to get up and running with the various models of Raspberry Pi.
Raspberry Pi OS is well maintained and receives regular updates. This may change the instructions here from time to time. If you notice any differences, please let me know by raising an issue and I'll update the documentation, with thanks in advance.
Setting up the camera
You will need to physically connect the Raspberry Pi camera module using the supplied ribbon cable. This is generally the same process for all models although the connector may be positioned slightly differently, or in the case of Raspberry Pi Zero, require a different connector ribbon cable. If you've done this already, again you may wish to skip this part
Getting started with the Camera Module Learn how to connect the Raspberry Pi Camera Module to your Raspberry Pi in preparation for use with BerryCam
Basic usage of raspistill BerryCam uses raspistill to capture images on the Raspberry Pi. You won't need this reference guide to use BerryCam yet it is handy if you want to learn more and take things even further.
Basic usage of PiCamera For more information on PiCamera and how you can use it within your own projects, refer to this getting started guide on the Raspberry Pi website.
Full API documentation for PiCamera A complete guide to the command reference and some example recipes, when you decide to create your own capture scripts.
A guide to all the Raspberry Pi camera applications This useful reference covers all the commands for the applications provided with the Raspberry Pi. These include raspistill, raspivid, raspiyuv and raspividyuv. All applications are driven from the command line.
A note on image capture failing when using PiCamera with the HQ Camera Module
When you are running the PiCamera version of BerryCam, and the HQ Camera, in some cases you may encounter out of resource errors. Image capture will fail when triggered using the app.
This can be addressed using the Raspberry Pi configuration tool. Refer to Image Capture Failing with HQ Camera Module in Troubleshooting for more detail.
Installing and running the BerryCam script
We will be using the command line to set up and run the BerryCam Python script. Be sure to read the guides on the command line
There are two ways we can interact with the Raspberry Pi. The easiest and best documented way to do this is using the Raspberry Pi OS desktop. This requires a display, keyboard and mouse. Start by reading using the Raspberry Pi OS desktop below
If this isn't possible, you can connect using a VNC client or directly using terminal on a Mac or an SSH client like PuTTy on a Windows PC. If this is how you need to connect, start with using the command line from another machine
Given this section is quite lengthy, you may wish to skip to the parts relevant to you:
Existing users: Updating your BerryCam.py script
Using the Raspberry Pi OS desktop
Start LXTerminal on the Raspberry Pi using the icon (a small black window icon with a white arrow) on the top tool bar desktop. You will be presented with a window like this.
First of all, we will need to find the IP address of the Raspberry Pi on your network. To do this type in
and press return. This will return quite a bit of information. the only part you will need is highlighted in light grey (to show you where to look) in the screenshow below.
Take a note of this number (IP address) as you will need it later on in the BerryCam app to connect.
Using the command line from another machine
Before you begin – you will need to know the connected IP address of your Raspberry Pi. If you can't use the Raspberry Pi OS desktop, you can get this from your broadband router control panel (your provider will have given you this information when it was set up) or if you use a WiFi mesh network like Google WiFi this number (IP address) will be available under Connected Devices in the Google WiFi app. Take a note of this number (IP address) as you will need it later on in the BerryCam app to connect.
To connect using a remote command line on a terminal, we need to use a protocol called SSH. You can use Terminal on a Mac (press cmd + space and type 'terminal' to launch this) or PuTTy on a Windows PC.
When connecting, you'll be using using your Raspberry Pi username and password. This is normally
pifor the username and
raspberry for the password. It is recommended that you change this to something only you know.
Connecting using MacOS Terminal:
Connecting using PuTTy:
To connect, enter
replacing YOUR_IP_ADDRESS with the number you took note of and enter your password when prompted. There will be no typing input when entering the password on some cases, so be sure to focus on entering the right keystrokes.
Download and install BerryCam onto your Raspberry Pi
First of all make sure you're in the home directory for the user you are logged in as. This will normally be 'pi' and is located
You can double check this using the
command. If you find you are in a different directory simply use:
Next, we need to clone the BerryCam script into your home folder. Within the terminal, simply type:
git clone https://github.com/fotosyn/berrycam.git
After some activity, the
berryCam.py file will be copied onto your Raspberry Pi. This will be in a folder named berrycam. If you receive an error at this point (command not found), you will need to install git which can be done by typing:
sudo apt-get update sudo apt-get install git
(Once this is complete, you'll need to repeat the clone step again.)
To check the
berryCam.py file has been downloaded and unpacked, or set up as a file issue the command:
This will list files currently in home. You will notice the new folder named berrycam. Change to this directory with:
You can now check the required script has been downloaded. In the command line, enter again:
You will see a number of files and a folder. Amongst these there should be a Python berryCam.py file. This is needed to provide the link between the iOS device and the Raspberry Pi.
Check that you have Python 3.7.0 by issuing the command:
If you have a version lower than this, we recommend you check the Troubleshooting guide.
Check you have PiCamera installed
If you are using the Raspbian or RaspberryPi OS distro, you probably have picamera installed by default. You can find out simply by starting Python and trying to import picamera
python3 -c "import picamera"
If you get no error, you’ve already got picamera installed. If you don’t have picamera installed you’ll see a
Traceback type error. You'll need to install PiCamera before continuing.
sudo apt-get install python-picamera python3-picamera
Running the BerryCam Python script on your Raspberry Pi
BerryCam needs to be run as a Python process to provide the necessary links to allow the BerryCam iOS app to trigger the camera, provide previews and save files. To run simply enter:
nohup python3 berryCam.py > berryCam.log & tail -f berryCam.log
The Python script will run in the background and you will see the following message:
B E R R Y C A M -- Listening on port 8000 Please ensure your BerryCam App is installed and running on your iOS Device
You can close terminal and as long as the Raspberry Pi has power will continue to run BerryCam.
If you experience any problems at this point, please check Troubleshooting
Updating the BerryCam.py script
If you've already started using the BerryCam app with the BerryCam script (thankyou!) - it's recommended you update to the latest version in the repo. This is easy if you've cloned it from this repo by simply using the command
git pull origin master
The GitHub desktop tool is another easy to use option to keep things up to date without the need for the command line.
Using the BerryCam app to capture images
Make sure you have downloaded and installed the BerryCam app onto your iOS device, and that both devices are connected on the same local network (generally your cellular connection won't work. Wifi will be easiest).
To set up the connection on the iOS App, tap the settings button (gear/cog icon), scroll down to Raspberry Pi Settings
- Select the correct version of camera you are using with your Raspberry Pi (this will dictate the output size of the image to be captured)
- Update your IP address with the one given when you issued the
- Make sure you're using the correct port number. In most cases this will be 8000 and is set to this as default.
Once complete, select Done and you will be returned to the main screen. After a brief pause, BerryCam will detect your Raspberry Pi and the capture button will change to green. If this does not happen, check all of the steps above and make sure the IP address entered is correct.
You can now start capturing images!
Simply press the large green capture (camera) button. After a short pause, the image will then appear in your iOS device. You can experiment with various capture parameters by revisiting the settings panel and updating. There's no need to worry about losing any captures you make.
Images are saved locally to the Pi, and can be accessed from within BerryCam, either by tapping the IP address shown on larger display iOS devices and iPads, or by going back into settings (gear/cog menu) and selecting 'Review images on Raspberry Pi'
You can also access the address directly on a browser on a device on the same local network by entering the address in the format below:
You can also save or share the currently captured image directly from the iOS device using the share button.
BerryCam is a quick and easy way to unlock experimentation with the Raspberry Pi camera modules. Try combinations of image effects, exposure controls and white balance to create some striking photographs!
If you are running an earlier version of Python3, pre version 3.3 then you will encounter a problem with the flush=true parameter in the
Check your version of Python3
To check the version supply the command
If this returns less than 3.7.0 then there are a few things you can do.
Things you can do:
1. Upgrade your Raspberry Pi OS
You could install a newer version of Raspberry Pi OS which has newer versions of Python. This is definitely the most direct route to consider if you're blowing the dust off a trusty Pi that's been sitting in the cupboard.
See Setting up your Raspberry Pi to get the latest version of Raspberry Pi OS and flash to your SD card.
2. Update Python3 to version 3.7.0
Alternatively, you can update your version of Python3. Be aware that this will a fair amount of time and involves a number of steps that need to be followed in this specific order. To update to the newest version with the following commands:
Download and extract the latest version of Python3 logged in as root
tar -xf Python-3.7.0.tgz
apt-get install -y build-essential tk-dev libncurses5-dev libncursesw5-dev libreadline6-dev libdb5.3-dev libgdbm-dev libsqlite3-dev libssl-dev libbz2-dev libexpat1-dev liblzma-dev zlib1g-dev libffi-dev
Configure and install Python 3 (this part may take some time)
Update the link to the newly installed version of Python
ln -s /usr/local/bin/python3.7 /usr/local/bin/python3
Check the version of Python (should return 3.7.0)
Thanks to Samx18 for the original guide to this detail. Perform a reboot of the Pi to be doubly sure that this has been applied.
You should then be able to launch BerryCam using the command:
sudo nohup python3 berryCam.py > berryCam.log & tail -f berryCam.log
Image Capture Failing with HQ Camera Module
In some cases, you may encounter an out of component error when using PiCamera and the HQ Camera Module.
mmal: mmal_vc_component_enable: failed to enable component: ENOSPC
This is easily fixed using the Raspberry Pi config tool which is accessed using the terminal. In an active terminal session with your Raspberry Pi, use the command:
Navigate to item 7 Advanced Options in the menu screen that appears using the cursor keys and press enter. Again, using the cursor keys navigate to A3 Memory Split and press enter. You will then see a screen as follows. Enter 256MB where it reads 128MB.
An updated version of Raspberry Pi OS has the GPU memory setting within 4 Performance Options and option P2 GPU Memory
<Ok> to continue, and then reboot the Raspberry Pi. This should address any issues related to image capture.
Other things to try
Autostart BerryCam on boot
If you regularly use your Raspberry Pi, set up with BerryCam to capture images, you may wish to set up the BerryCam.py script to launch automatically when the Pi is booted. This is quite an easy process and is particularly useful if you want to be able to plug your Pi in to power headless, and have it run BerryCam without configuration or a manual start.
For more information on editing the
rc.local file please refer to the Raspberry Pi documentation
On your Pi, edit the file /etc/rc.local using the editor of your choice. You must edit with root, for example:
sudo nano /etc/rc.local
In the line before
exit 0 add the following lines. Be sure to reference absolute filenames rather than relative to your
/home folder replacing
<your_user_name> with your own user name (in many cases this is
cd /home/<your_user_name>/berrycam/ nohup python3 berryCam.py > berryCam.log & tail -f berryCam.log
Save this file
CTRL x confirming with
Enter then restart your Raspberry Pi. If this has been set up correctly and your BerryCam app should connect when you supply the correct IP address in the app.
Copying images from your Raspberry Pi using a shared directory
Once completed, and if you connect with your Pi's login credentials, you will see the shared folders with your captured images within the