Index>Robot Kit>RaspTank-Pro Smart Robot Car Kit for RPi>Lesson 10 How to Take a Photo with Raspberry Pi

Lesson 10 How to Take a Photo with Raspberry Pi

654

Lesson 10 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

10.1 Components & Parts

 

Components

Quantity

Picture

Raspberry Pi

1

image.png 

Robot HAT

1

image.png 

Camera Module

1

image.png 

Camera Flex Cable

1

image.png 

 

10.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.

10.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)

image.png 

Install the Robot HAT. Insert the cable through the hole of the Robot HAT.

image.png 

Connect the flex cable and camera module (metals of both should be in contact with each other).

image.png 

 

10.4 Programming the Raspberry Pi to Take Photos

Run the code

1. Log into the Raspberry Pi remotely.

image.png 

2. When the Raspberry Pi is configured with the robot software, the Raspberry Pi will automatically run the webServer.py program. If you need to use the camera in other programs, you need to terminate this program. Termination command:

sudo killall python3

3. View the files of the current directory:

ls

image.png 

4. Type in commands, press Enter to run the program:

raspistill -t 1000 -o image.jpg

image.png 

5. 1s after the successful run, the camera will take a photo image.jpg.

1000: delay time of photo shooting

image.jpg: name of the photo

6. Type in "ls" to view the file.

ls

image.png 

 

10.5 Q&A

 

Error occurs when the command "raspistill -t 1000 -o image.jpg" is typed in the command line.

image.png 

1. Run  sudo killall python3.

2. Check whether the camera connector of the Raspberry Pi, flex cable, and camera module are well connected.

Metals of the flex cable and camera module should be in contact with each other

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.