Lesson 8 How to Take a Photo with Raspberry Pi
In this tutorial we will learn the photography function of the Raspberry Pi.
For more details, refer to the Raspberry Pi official website:
https://www.raspberrypi.org/documentation/usage/camera/README.md
8.1 Components & Parts
Components | Quantity | Picture |
Raspberry Pi | 1 |
|
Robot HAT | 1 |
|
Camera Module | 1 |
|
Camera Flex Cable | 1 |
|
8.2 Introducing the Camera Module
The Raspberry Pi camera module is capable of taking full HD 1080p photos and videos and can be controlled programmatically.
8.3 Schematic Diagram
The flex cable inserts into the connector situated between the Ethernet and HDMI ports, with the silver connectors facing the HDMI port. The flex cable connector should be opened by pulling the tabs on the top of the connector upwards then towards the Ethernet port. The flex cable should be inserted firmly into the connector, with care taken not to bend the flex at too acute an angle. The top part of the connector should then be pushed towards the HDMI connector and down, while the flex cable is held in place. (Pay attention that the metal of the connector should be in contact with that of the cable)
Install the Robot HAT. Insert the cable through the hole of the Robot HAT.
Connect the flex cable and camera module (metals of both should be in contact with each other).
8.4 Programming the Raspberry Pi to Take Photos
Run the code
1. Log into the Raspberry Pi remotely.
2. View the files of the current directory:
ls
4. Type in commands, press Enter to run the program:
raspistill -t 1000 -o image.jpg
5. 1s after the successful run, the camera will take a photo image.jpg.
l 1000: delay time of photo shooting
l image.jpg: name of the photo
6. Type in "ls" to view the file.
ls
8.5 Q&A
l Error occurs when the command "raspistill -t 1000 -o image.jpg" is typed in the command line.
Check whether the camera connector of the Raspberry Pi, flex cable, and camera module are well connected.
l Metals of the flex cable and camera module should be in contact with each other
l Metals of the camera module's flex cable and camera connector of the Raspberry Pi should be in contact with each other
Check whether the flex cable and camera are good or damaged.