A Raspberry Pi Camera Controller


Pi Vision is a Graphical User Interface for the recently introduced Raspberry Pi Camera.

Pi Vision

Pi Vision allows you to control the camera functions through the camera’s native camera apps. The incentive here is to allow for easy use of the Raspberry Pi camera. In addition, Pi Vision also serves as an instructional tool. For instance, employed commands are relayed to the user. This assists novice users in understanding the command structure. The project was developed using Lazarus FPC and has been released as open source.

In subsequent sections of this article you will find more details about the Pi Vision open source project. For now, assuming that you already have your Raspberry Pi camera setup and running, you can download Pi Vision and start using it directly on your Raspberry Pi.

Download Pi Vision for the Raspberry Pi  File Size: 4.6 MB Downloads: 15,656


Run Pi Vision on the Raspberry

Start the Raspberry’s LXDE and create a new directory. Unpack the contents of the download. Place this in the newly created directory.


In order to run the Pi Vision app you need to first set permissions. Right-click the app, select Properties and from the Properties menu select the Permissions tab. There is a small check-box which needs to be checked called “Make this file executable”. 

Then click on the Pi Vision app to run. The start-up page of Pi Vision includes a button called “Test Camera Preview”. This will start a 5 second 640 x 480 camera preview in the upper left corner of your screen. Assuming that your camera is set up correctly and the preview is successful then you are now ready to start using your camera with Pi Vision.

Pi Vision

Pi Vision for the Raspberry Pi Camera

Like any camera the Raspberry Pi camera has a wide spectrum of uses. It also allows many parameters to be set. But it is important to mention that the Raspberry Pi camera is not like your contemporary webcam. What’s the difference? Well, at this point, the incentive appears to be that the camera, like the Raspberry, is an educational tool. The idea is to familiarize oneself with the workings and functions of an on board digital camera. One of the most apparent aspects is that the camera does not seem to infinitely stream its video like a common webcam. There is no Video On or OFF setting. Instead, you need to set a duration time. Only during that time will the camera stream its video.

Note 1: The camera may still be consuming power although not streaming its video.

Note 2: Video preview window will only show on a monitor that is directly connected to the Raspberry Pi. 

Review Pi Vision on your OS

Pi Vision is specifically built for the ARM based Raspberry Pi to control its camera. However, binaries have also been provided for Windows, OSX and Debian Linux. These are only intended to review the application and/or if you don’t (yet) have a Raspberry Pi.

Download Pi Vision for Linux Debian 64-bit File Size: 2.0 MB Downloads:1,831



Download Pi Vision for Win 64-bit File Size: 1.0 MB Downloads: 1,971



Download Pi Vision for OSX intel File Size: 6.1 MB Downloads: 999          


Pi Vision was developed using the Lazarus IDE and FPC (Free Pascal Compiler) running Linux Mint 14. If you want the project sources as well as more detailed information you can find the project here on GitHub. It is what you make of it…

Pi Vision Running on Linux Mint

Pi Vision Running on Linux Mint

Pi Vision, Raspberry Pi Camera and Lazarus Pascal

An introductory overview

Raspberry Pi, the Altair 8800 of Subspace

Personally…if I had to name one of the most interesting and inspiring gadgets to come out in recent years it would probably be the little Raspberry Pi. Introduced as an educational device it’s an ARM based board level computer with a foot print the size of a large box of matches. It runs under Linux and the basic board unit sells for only $35.

The Bare Minimum

Running about as fast as your old P2 the Raspberry Pi (RPi) does not mean much in terms of computational power. At least when it comes to its ARM based CPU ( Broadcom chip aside). It´s not meant to be. It’s just enough to bring the bare basics to a working level at the bare minimum. And, if you don’t use it for development you can always fall-back and use it as a media player.

But that is not the true essence about what this device is all about. The Raspberry Pi is not just a gadget. It’s a building block. A prelude to something bigger, or actually smaller and more integrated. In a way it is the next phase in computational integration. Sure, others have set milestones here. But the Raspberry Pi symbolizes something a bit more tangible to a larger audience. All that “minimal” has been enough to light a fire among hundreds of thousands of developers. Setting things ablaze.

Depending on how old you are you’ll probably remember when computers took up “floor space”. That migrated later to “desktop space” and, now, “mobile space”. What’s next? Well, for lack of a better word I’ll call it “subspace”. The internet of things.

Myspace, Yourspace, and Subspace

Subspace is a space where computational power has integrated, networked and submerged itself into our environment. It’s in our house, our refrigerator, our car and maybe even our walls, tables and coffee mugs. Sensing, calculating and connecting. It is all around us, fully interfaced. Yet not as tangible as we remembered it to be.

This progression has already started. But it’s devices such as the Raspberry Pi that bring this technology closer to us. Something like the Altair 8800 did for the desktop computing era. Yes, the Altair was in a different price range. Its computational footprint was very small. But like the Raspberry it symbolized something bigger in the years to come.

Accessible Board Level Development Space

The Raspberry Pi (RPi) has sparked as well as re-kindled the production of other boards as well. These typically offer more power, are bigger (larger foot-print) and are more (sometimes much more) costly. Yet, most seem to kinda miss the point. At the other end of the spectrum there are the bare chips which cost pennies. But the complexities involved make these less accessible for the average developer.

Accessibility is a big word. Lets break it down and try to define what makes the Raspberry Pi so interesting, successful and accessible. To me, there are 5 main attributes which make the Raspberry Pi successful. The sum of these parts prove to be an obvious winning combination. The first 3 are; ultra-low cost, very small and the bare minimum. The last 2 are the ability to connect (network, USB, HDMI, audio, video and GPIO) and that it runs Linux (an official distro as well as several others, with more on the way), making it fully accessible and modifiable. Important? Yes. After all, it is still developers that get things done. Not just machines.

RPi Application Development

The script/language of choice for this little device is Python. And, with good reason. Python offers simplicity, it’s easy to understand and very easy to use. It subscribes to the novice developer, in particular, very well. Other ways to create programs/applications are also available. But when it comes to rapid application development you will need something more advanced. To me the choice was Pascal. More specially, FPC using the Lazarus IDE.

Pascal is not the best language. There is no such thing. The question is actually; what does it take to get the job done. And, how to do it in a good, easy and effective way. Pascal is a strongly typed language and offers structure. But more importantly it is accessible and intuitive. In addition, the Lazarus IDE and the FPC runs on most systems; Win, OSX, Linux and Raspbian.

Pi Vision Running on OSX

Pi Vision Running on OSX

Sure, if you want to get down with lean and mean low-level programming you´ll probably choose for C++ or C. But these are less intuitive. More importantly, most of time I don´t need that type of low-level power. I build high-level interfaces and applications, not low-level broadcom chip firmware development. In addition, when I do need to go low-level, Pascal will typically still allow me to dig in pretty deep.

RPi Quick Start

Again, this is an introductory overview. It is certainly not exhaustive nor is the code supplied as production code. The incentive here is getting started with FPC, Lazarus, RPi and its camera. The information is largely built upon the work of others. It consolidates these. In addition, I am only going to highlight certain things. If you run into a problem you will find ample info on the Internet.

The official package for the RPi is Rasbian Wheezy which is a special Debian distro. After your first start-up you will be presented with a start-up screen/menu that allows you to select certain commands. One of these is to use the entire SD card space. I highly recommend that you do this otherwise you will end up with not enough space to install FPC/Lazarus.

In case you missed the startup menu type in the following at the command prompt (omit the Dollar sign):

$ sudo raspi-config

The ¨sudo¨ means Super User Do. It is one step below root privileges and relates to a user who is permitted to make changes to the system. Select the ¨Expand root partition to fill SD card in the start menu. After that select finish and reboot.

Just a note: To shutdown RPi from the command prompt use:

$ sudo poweroff

I mention this as it was initially unclear how to shut down the RPi properly. Rebooting is:

$ sudo reboot

To update and upgrade your RPi type in:

$ sudo apt-get update

Let it do its thing and then type in:

$ sudo apt-get upgrade

The first time you do this it can take some time to complete. In any case when you install new stuff it is recommended that you use update and upgrade things before installing.

Raspbian Wheezy includes the LXDE desktop which is a lightweight desktop environment. At the command prompt you can start it by typing in:

$ startx

Another handy note is that you can repeat commands in the terminal by selecting Ctrl-R and then type the first word of what you want repeated.

RPi Installing FPC/Lazarus

Assuming that you were able to expand your root partition to fill the SD card and have rebooted, we can now start to install FPC/Lazarus. The package is already part of the Raspbian repository. So installation is easy. If you have not already done so from the previous section update and upgrade your Raspbian. To install FPC and Lazarus:

$ sudo apt-get install fpc


$ sudo apt-get install lazarus

This can take some time to download and install. After it has completed you will find Lazarus in the ¨Programming¨ menu section of your LXDE start menu.

Starting Lazarus on the Raspberry from the Start Menu

Starting Lazarus on the Raspberry from the Start Menu

You may notice that this version of Lazarus is not the most recent. More recent version can be compiled to run on Raspbian Weezy. But that is beyond this article. In any case, this version of Lazarus will do fine in compiling and running Pi Vision.

Having the Lazarus IDE running on the RPi is really great. But you will also notice that it is kinda…slow. The current desktop environment for the Raspberry Pi is LXDE, which is a lightweight desktop. Unfortunately it runs from the ARM processor and does not take advantage of the Broadcom chip’s hardware acceleration at this time. However this may change soon.

The result is that, apart from some simple coding, you won´t really be able to do any serious work on it such as building application interfaces. The idea instead would be to build your Lazarus applications on a more powerful machine and then open and recompile these projects in Lazarus on the RPi for ARM. Setting up a cross compile configuration would be best. But for now you can simply build your projects on your main Linux, OSX or Win machine and then recompile on the Raspberry Pi using Lazarus.

Lazarus IDE on Raspberry

Lazarus IDE on Raspberry

Another important thing to mention is that the RPi includes a GPIO which Lazarus can use! You can find sample code and setup here.

Pi Vision Open Source Project

Start LXDE on the Raspberry.

$ startx

Create a directory in a desired location on your Raspberry. Place all source files and directories in this directory that you downloaded from the Github Pi Vision repository. Pi Vision’s Lazarus project file is called:


Double click this file. Lazarus is typically already associated with its native files and will open automatically. It may take a moment or two to start Lazarus on the RPi. If Lazarus does not start automatically go to the Programming section, start Lazarus and open the .lpr file from the Lazarus IDE.

Pi Vision on GitHub

Pi Vision Repo on GitHub

With the project opened go to “Run” in the main menu and select “Build”. Then select Run once this completes or the F9 key. It may take up to two minutes for Pi Vision to build and run.

If you have set up your camera correctly you will be able to directly use Pi Vision to control it.


One of the great things about the Raspberry Pi is that it uses Linux. Sky is the limit. It’s also become a great way to become more familiar with Linux.

For many I’d expect that their first real Linux experience was probably through the Raspberry. And, since the Raspberry is also used in schools and by so many young students it means that their first experience with computing was with Linux as well. Sure, they probably used Windows before or picked up an iPad. But the serious computing started with the Raspberry and Linux.


Pi Vision was developed on a machine running Linux Mint 14. But what about Fedora or how about just Ubuntu? And, what about the DE? GNome, KDE, LXDE. Well…it really does not matter. Linux is Linux. Discussing which DE or even distro is better or worse is kinda ridiculous. What matters is what you need, want to do and what your taste is.

If the various DE’s were ice cream flavors then you may want Pralines & Cream while someone else may be satisfied with plain Vanilla. Either way, it’s still ice cream from the same store. Linux simply provides choice.

But what is most apparent about Linux in comparison to other OS is the way it has been put together. Linux is a community effort of thousands of developers world-wide. Although non-profit comes to mind there are serious commercial aspects to it.

While most commercial development has an obvious commercial incentive, open source development, like Linux, forms a more natural evolution towards surviving in a digital ecosystem.

Remember those wooden (or plastic) building blocks you used to play with as a kid. You probably built a tower as high as you could go. You would plan out how to build the best base for the highest possible tower. Either intentionally or by accident it would fall/crash down at some point. In either case you knew that it would happen. And, then you would start over again. Make and then break. Start over. Make better. Do it again. Linux involves something similar in its development progression.

If it ain’t broke don’t fix it. The Linux community mentality is more like; If it ain’t broke, break it and fix it better.

Camera Clones

Recently, clones have appeared of the native RPi camera. These clones include a different board and lens. They seem to work fine using the RPi’s native camera apps and Pi Vision. The lenses (M12 and CS-Mount) are, typically, removable, allowing greater capture possibilities than the pinhole type lens found on the native RPi camera. The M12 and the CS-Mount allow focusing. But it should not be difficult to find lenses with zoom and iris control as well.

CS Mount RPi Camera

CS Mount RPi Camera

However, when choosing a different lens it is important that the lens is compatible with the imaging sensor. There are 2 things to keep in mind; the imaging sensor size and the distance between the imaging sensor and lens. The imaging array size looks to be about 1/4 Inch. While a lens may fit it must also create the right sized image on the imaging array. Spacers may be needed to make sure the distance between the lens and sensor are correct.

CS Mount RPi Camera with Lens Removed

CS Mount RPi Camera with Lens Removed

More info

Raspberry Pi Projects? A library of great info can be found at:

Raspberry PiPod

Lazarus, Free Pascal and Delphi can be found at the Blaise Pascal Magazine website

Blaise Pascal Magazine

Find the article about Pi Vision in MagPi November 2013 issue page 24
MagPi Nov 2013 issue page 24

30 comments on “A Raspberry Pi Camera Controller
  1. Jae Le says:

    I’m curious at the speed using this software images could be captured. Would be fast enough to record 1920×1080 images at 5 times each second?

  2. Kapy says:

    Awesome thanks, this really came in handy.

    However you think it would be possible to get the image into a Tbitmap without having to write it to a file first? This really slows things down if you want to do image manipulation.

    Awaiting your reply,

  3. B. J. Rao says:

    Hi Kapy,

    I share the same need. 🙂

    I expect that your application would need to share process with the camera’s native apps in order to achieve something like that.

    The following link pertains to an OpenCV project for the raspberry. Perhaps this may provide some insight (check out his 7 part tutorial).


  4. Scott Kocher says:

    I’m trying to use this on a rasppi with a 4.3″ screen so I can set up time lapse photos. The issue I’m having is the whole screen can’t fit because of the bar terminal button and below that. Is there avway to make that go away so I can see all of the options and the execute button. When I’m hooked up to my big screen The program is perfect.

  5. Simon says:

    I am confused. Attempts to unpack PiVision_RPi.tar.gz on a fresh install of NOOBS 1.3 (the latest version) creates an ‘Archive format is not recognised’ message. Is this download something only experts are able to use or am I doing something obviously incorrect? All help gratefully appreciated.

  6. Rich F says:

    Can you tell me the WGET command to download PiVision_RPI.tar.gz?

  7. I’ve altered the permissions on rpiCC.lpr, double click it, menu comes up, I pick execute, nothing happens, I pick execute in terminal, nothing happens

    • B. J. Rao says:

      Dear Citizen,

      You probably downloaded the entire development project from the local-vision Github repo. In order to use the app you need only to set permissions on the app file not the project file.

      Set permission for the rpiCC file not the project rpiCC.lpr file and try again.

      Let us all know if this solves the problem or not.

      We carbon units are known for making mistakes. Apps must run on a multitude of systems. It is important to a developer that things work.

      Thanks. 🙂

  8. citizenbrian says:

    I’ve ran it in Lazarus, ran through quite quickly I thought, impressive and an easy install.

  9. I managed to get back to this today, a clean install, only hiccup was not being able to download the top file on this page for the raspberry. I have tried before more than once, in the end I reverted back to my Github copy and run that through Lazaras. I firstly tried the preview button which froze and left the camera light glowing, no window opened. After a while the menu freed up and I moved along to “take a picture” and it took a picture, but then the raspberry went into a go slow and I ended up starting a SSH connection to terminal and reboot. On rebooting my Pi normally boots into a full screen browser which it started to do but then stopped, the cursor is now an (x) it’s busy? some menu’s are available on right click but not close window. The page is off the top of the desktop so the top menu isn’t visible either to enable closing of the browser. I had to log in on my phone SSh killall midori.. Now any window opened file manager etc opens with its top menu bar hidden, and the terminal icon is missing off the desktop. I’ve got back into Pivision, it doesn’t look complete as I can’t see the edge of the window, the cursor is back to normal hovering over pivision, the terminal button works, preview doesn’t, nor anything else, terminal is off the top of the page, and the cursor is still busy. I’m thinking Beer 😉

  10. citizenbrian says:

    Download Pi Vision for the Raspberry Pi File Size: 4.6 MB Downloads: 2,809 works in windows, just didn’t in midori.

    • B. J. Rao says:


      You can download Pi Vision using Midori. Google Chrome works as well.

      In Midori you can select to either Save or Open the download. Wait for the download to complete. In case you use Save, you can, typically, find the package in your home folder. In both cases you will need to extract the contents somewhere, for instance, your desktop. In the extracted folder you will find the rpiCC file. Set Permissions and Run.

      Have added a short video in the article.

      Note 1:

      The Pi camera will not send the video preview to your remote desktop viewer. This has nothing to do with Pi Vision. The preview is however to be seen on a HDMI monitor that is directly connected to your Raspberry Pi.

      Note 2:

      rpiCC.lpr is a project file. It is not an app/executable, nor do permissions need to be set.

      Note 3:

      Unless you want to make changes to the app source code and/or interface there is no need to use Lazarus to run Pi Vision. You are also in debug mode when building and running an app in a development tool such as Lazarus. The app may still be running although you have closed the app.

  11. Cliff Watkins says:

    Have managed to install PiVision which works quite well but was a bit disappointed that the image file is overwritten each time I take a picture. I was hoping that each picture would be given a different filename, even if it was only for the one session. How about using an real time clock module (RTC) to give each picture a different date/time stamp ?


    • B. J. Rao says:

      Hi Cliff,

      Yes, I see what you are saying. I kept this first version of Pi Vision as simple and as robust as possible as well as made the code open source.

      There is some incentive to release a new version at some point as many people are using Pi Vision. But, surprisingly, I have received very few suggestions for improvements and only one bug has been reported.

      Perhaps not exactly what you are looking for but have you tried using the Enable Time Laps settings? Setting the Duration at a multiple of Delay and Enabling Time Lapse will produce a new file name for each picture taken. Setting Duration and Delay to the same value while Enabling Time Lapse might produce the functionality that you are looking for.

  12. MDeutch63 says:

    My apologies for the ignorant question but I have been looking at way to take a picture of an “empty” box and determine if it has an object inside, and if so, how big is that object.

    I understand that will require me to know the focal distance from the camera to the bottom of the box and other presets, but in general principal, is this doable using Raspberry pi and the PI camera/ PI Vision?

    • B. J. Rao says:

      So if I understand correctly, you wish to relate pixels to inches/mm in order to measure the size of he object? Correct?

      If so, then the answer is yes. You would need to calibrate the scene/system. All camera lenses/systems have some degree of error. The calibration would need to compensate for this error in order to relate pixels positions to actual distances.

      Lazarus Pascal includes the functionality to write this code to process images. A good starting point to understand the the math involved is to look for Tsai Camera Calibration much of all calibration approaches start with his work.


  13. Miguel Angel says:

    I have a Pitft display 4″ and pivision doesn´t fit well on it . does it exist a way to make it fit ? Another question is the preview on TFT , do u know Fbcp buffering mirror utility to copy buffer from hdmi output ? Perhaps in next version u can solve this 2 question in order to use pivision on lcd displays. i think most people like to have a really portable pic/video system… thanks.

  14. C. Hodgson says:

    Using the ‘official’ tft display. PiVision doesn’t scale correctly, cutting off the Take Picture button. Is it possible to scale or alternatively transfer the ‘Terminal’ section to another tab releasing the space ?

    • Jim says:

      I changed the resolution for my official pi touchscreen to 1280×720 and I can now see the take picture button. I did this by simply uncommenting the FRAMEBUFFER_WIDTH and the FRAMEBUFFER_HEIGHT lines.

  15. filo says:

    Fitting Pi Vision for displays with 320×240 resolution would be nice.
    Actually, the application doesn’t fit and is not possible to resize at a pitft display.

    • Jim says:

      I changed the resolution for my official pi touchscreen to 1280×720 and I can now see the take picture button. I did this by simply uncommenting the FRAMEBUFFER_WIDTH and the FRAMEBUFFER_HEIGHT lines.

  16. Frank Johns says:

    Is it possible to incorporate shutter speed ( -ss ) into Pi Vision?

    Not being ‘lazarus literate’ I am not sure I am capable of doing it.

    • B. J. Rao says:

      Hi Frank,
      I share your desire to do so as well. There have been a few updates to the pi camera functions since I launched Pi Vision back in 2013. I’ll be updating Pi Vision as soon as I have a bit more time. What I am hoping for is more comments/suggestions such as yours. For now sorry for the wait.

  17. This run fine with my PI3 and the noir lens, but I would like to see the shutter speed added to it. What would be the chance of seeing this as a normal application rather than having to load about 1gb of programs for this to work. A+ we are using this to test the sensor via an 100 yr old 8×10 film camera. once we get everything working right I will share some of the images with you. We have to destroy a $50.00 8×10 film holder..haha
    Thanks again for the coding.

  18. cobaltBlue says:


    After googling for ‘raspberry pi camera lazarus’ if ound this interessing page.

    Just recently entered the world of rPi ( and Linux ‘things’). Got the Pi Vision functioning! Lazarus is also runnng/funcitiong on my rPi.

    I want to implement the PI cam in rPi-Lazarus.
    What I need at least is to take a picture (bitmap) every few seconds on command and store it as a file or (better) load it directly in rPi-Lazarus. Then I’m ready to process that bitmap! After processing, there will besned some command from rPi to PC by RS232. ( RS232 communication is not an issue ).

    Anyone a hint or direction I gotta go?

    Some more info: I’m allready working with pc-Lazarus and mikroPascal for AVR ( Aruidno 2560 etc ). Between pc and Arduno I have a RS232 communicating.
    At Arduino there are steppermotors, ADC-inpust etc etc…

    See here some videos:


    Thanks in advance! Marcel

  19. Chinmay says:

    thanks… I am a class VII student and found your blog & app very helpful

1 Pings/Trackbacks for "A Raspberry Pi Camera Controller"
  1. […] Over at heywhatsthebigidea.net, they’ve created an X-windows application that allows you to control the camera module on the Raspberry Pi. Read more and download here […]