Join David Ross for an in-depth discussion in this video Take pictures from the command line with raspistill, part of Home Monitoring and Control with Raspberry Pi.
- View Offline
- Now that we've enabled our camera and connected it, the next thing to do is check it out. First thing that you're going to see is sometimes you're going to get this slash here, and if we do a PWD for print working directory, one of the things it's telling us is we're in the route directory. Now being pi, we do not have access to storing files in the super user directory, so we're going to have to do CD to change directory. And CD by itself will put you back in your home directory. If we do a PWD, we can see we're in our home pi directory, which is where we can actually store files. Now what we're going to do is we're going to use the raspy still utility.
And if we want to see the options minus question mark, we'll have all the options float quickly across the screen. If we slide up to the top here, we can see some of the more important ones for raspy still. Minus W for width and height to change the resolution. And minus O for output. Now let's go down to the bottom here. And let's clear the screen, and let's take a look at how we're going to go about doing this. So if I say raspy still, dash O, and then pick one dot jpg or jpeg, it's going to create a file.
Make sure this is a dash O, and if we hit enter, we're going to see the red light come on on the camera. And about five seconds later it's going to take the picture. And camera is taking the picture and you can get the prompt back. Now let's take another picture with some other options that you can look up later. Let's take a look at minus W for width, six 40. Minus H, four 80. And let's do a minus HF for horizontal flip, and then let's do our minus O for pick two dot jpg.
Again the camera light comes on. Five seconds later the picture, make sure you pose properly, and the picture is taken. Now if we want we can say LS dash L to get the long listing. And let's look at all of our jpeg files that we've just taken. And you can see here that the two files pick one is five megapixels, that's a dash O by itself will give you five megapixels. But here we've changed the resolution from being five megapixels to 640 by 480. And notice that it's less than one tenth the size of this. So let's take a look and see how good these files are in terms of resolution.
We're going to go the file manager. And what we're going to do is we're going to have to slide up here to pi. And when we're in the pi directory there's our two pictures. Notice this one here it just has a graphic, this one actually has a picture if it's less than five megapixels. Let's right most click image viewer and take a look at our five megapixel picture. And there it is. That's not bad for picture quality. Now let me just close this one. And let's take a look at one that's actually one tenth the size of that. So if I do an image viewer on this one, and the only difference is you can see that I've turned the other way, or there's been a horizontal flip.
It's practically the same resolution at about one tenth the storage. And so these are some important things that we're going to have to worry about later as our camera and our burglar alarm systems starts taking more and more pictures. We have limited space on our SD card. We want to make sure that we have the best resolution with the least amount of storage. And I think 640 by 480 is probably the best.
This DIY electronics project provides simple directions for getting your home monitoring system up and running. Author David Ross helps you select a power supply, camera, motion detector, enclosure, and other components and accessories, and make your system "smart" by connecting to web services frameworks such as Weaved and WebIOPi. Then he helps you program the logic to make your Pi camera take pictures and stream video, connect to home peripherals, and mount your alarm system. With this training, and a little elbow grease, you can create a fully autonomous system that helps you and your family feel more secure at home and away.
Note: These instructions work with Raspberry Pi B, Raspberry Pi B+, and Raspberry Pi 2 models.
- Selecting hardware, including a Raspberry Pi camera and a Pi Cobbler
- Configuring VNC, SSH, and WebIOPi services
- Sending SMS messages with the Raspberry Pi
- Taking and accessing pictures remotely
- Setting up video streaming with a Raspberry Pi camera
- Connecting the Pi to the development board
- Connecting the relay and motion detector
- Programming the alarm in Python
- Mounting and securing the alarm system