Introduction: Taking a Still Picture With a Raspberry Pi

How to take a still picture with a Raspberry Pi

Step 1: Obtaining Materials

You will need:

  • Camera with ribbon cable to attach to Raspberry Pi Raspberry Pi (see image)
  • HDMI cord to plug in
  • 5 volt 2 amp power charger
  • Mouse and keyboard

Step 2: Setting Up Raspberry Pi

  1. Pick up power cord
  2. Plug into outlet in wall Take other end to plug into Raspberry Pi outlet (see image)
  3. Pick up HDMI cord
  4. Plug one end to the monitor provided in classroom
  5. Plug other end into Raspberry Pi HDMI port (see image)
  6. Pick up mouse and keyboard wireless USB plugin
    1. Make sure the “Dell” writing on the USB plugin is facing up (see image)
    2. Plug in USB plugin to USB port of Raspberry Pi (see image)

Step 3: Connecting the Camera

  1. Find camera port tabs on Raspberry Pi
  2. Pull up camera port black tabs on Raspberry Pi
    1. Tabs will be on left and right side of camera port (See image 1)
  3. Take camera ribbon cable to plug into the camera port
    1. Ensure metallic strips on ribbon cable face HDMI port on Raspberry Pi (See image 2)
    2. Plug in ribbon cable into port
    3. Ensure that metallic strips are pushed all the way down into port
    4. Push down tabs on camera port to secure ribbon cable
      1. There will be a small “click” when port tab is pushed down

Step 4: Turning on Raspberry Pi

  1. Find power cord
  2. Find on/off button on cord
  3. Press button to activate
  4. Let system load until raspberry pie appears

Step 5: Enabling the Camera

  1. Click Raspberry Pi home button. (See image)
  2. Hover over Preferences Tab
  3. Click Raspberry Pi Configurations Tab
  4. Click Interfaces Tab on new menu
  5. Click enable bubble for the first Camera option
  6. Click the 'okay' option
  7. Click 'Yes' when asked to reboot

Step 6: Open Up Programming Application 'Thonny Python IDE'

  1. Click Raspberry Pi home button
    1. Drop down menu will appear (See image)
  2. Hover over Programming tab
    1. Another drop down menu will appear (See image)
  3. Select Thonny Python IDE from list (See image)
    1. Will open programming application

Step 7: Typing the Code

  1. Code needs to be typed EXACTLY AS WRITTEN
  2. Click within white textbox (See image for following instructions)
  3. Type first line “from picamera import PiCamera”
    1. Hit Enter for new line
  4. On next line type “from time import sleep”
    1. Hit Enter again
  5. Next line type “camera = PiCamera()”
    1. Hit Enter again for a new line
  6. Next line type “camera.rotation = 180”
    1. Hit Enter again for a new line
  7. Next line type “try:”
    1. Hit Enter again Line will automatically TAB
  8. Then type “camera.start_preview()”
    1. Hit Enter again
  9. Next line type “sleep(5)”
    1. Hit Enter again
  10. Next line type “camera.capture(‘/home/pi/Desktop/cameraTestImage.jpg’)”
    1. Hit Enter again
  11. Next line type “sleep(2)”
    1. Hit Enter again
    2. Press the Backspace button on your keyboard to remove this automatic tab.
  12. Next line type “finally:”
    1. Hit Enter again
  13. Next line type “camera.stop_preview()”
    1. Hit Enter again
  14. Next line type “camera.close()”
  15. Click File in the top left of the application
    1. This will open a drop down menu
  16. Click Save As... from the menu
    1. This will open a popup menu
  17. Name your program “cameraTest” in the text box marked “file name:”
  18. Press the Save button.

Step 8: Taking the Picture

  1. Click the Green Arrow button in the application to run the program and take a picture! (See image)
  2. If you had an error when taking the picture, first double check that your code is exactly as in the picture.
    1. If it is not, make sure it is exactly the same.
  3. If you still have an error after double checking your code is the same, ensure that you completed step 5 to enable the camera.

Step 9: How to Open Picture

  1. File will appear on homescreen to the left of open Thonny program if you saved it to the desktop
  2. File will be named “cameraTest”
  3. Double click file to open