Warning: cameras are very sensitive to static electricity! You should ground yourself before working with any microcontroller but especially if you are using a camera module.
What is static electricity?
If you've ever touched something conductive and zapped your finger, you experienced static electricity. That little zap can fry the circuit in your camera module or other sensitive electronics. Static electricity builds up in the air especially in dry areas or rooms with a lot of carpet.
How do you ground yourself?
You can ground yourself by touching anything that is grounded to the earth. Some common household examples are metal pipes, metal sinks, a metal desktop computer case, or metal plate covers on electrical outlets or light switches. Please note that some of these surfaces might be covered in paint. Some paints have insulating contents and others don't so it is best to find a bare metal surface.
Connecting the Camera Module
The camera module connects to the Raspberry Pi via a camera serial interface (CSI) cable. The cable is thin and flexible, be careful not to crease the cable or the connections might be damaged. The cable contains 15 pins on either side and those must be inserted the correct direction on the back of the camera and into the Raspberry Pi.
You can also use some webcams, however, many webcams don't have the drivers needed to interface with the Raspberry Pi.
Enable the Camera Using the Graphical Interface (if you downloaded the desktop version)
Now that your camera is connected, start up your Raspberry Pi. Once the Pi is on, click the little raspberry icon in the top left hand corner of the desktop and open the Raspberry Pi Configuration window. Next, click on the "Interfaces" tab and next to "Camera" make sure "Enabled" is clicked. Reboot the Pi.
Enable the Camera Using the Terminal
Open the terminal and type the following commands. Use the arrow keys to select "Interfacing Options" then select "Camera," follow prompt to enable the camera. Then exit raspi-config and follow the prompt to reboot the Pi.
sudo apt update
sudo apt full-upgrade
sudo raspi-config
Test the Camera
Enter the command below in the terminal. This will take a photo using the camera and display a 5 second preview before closing the window and saving the file as "test.jpg." If you do not see an image or get error messages in the terminal, click on the Camera Module Software and Troubleshooting link below.
raspistill -v -o test.jpg