Mukesh Sankhla
Published © CC BY-NC-SA

Touch Cam - A Raspberry Pi Camera

Touch Cam - A 3D Printed Raspberry Pi Camera

BeginnerFull instructions provided2 days540
Touch Cam - A Raspberry Pi Camera

Things used in this project

Hardware components

Raspberry Pi 4 Model B
Raspberry Pi 4 Model B
×1
DFRobot 5'' 800x480 TFT Raspberry Pi DSI Touchscreen
×1
Raspberry Pi High-Quality Camera
×1
Raspberry Pi 16mm telephoto lens
×1
Touch Sensor
×1
5V 4020 Fan
×1
Raspberry Pi Heatsink Kit
×1
SD Card
×1
M3 30mm Screws
×1
M3 20mm Screws
×1
M2.5 8mm Screws
×1
M3 Metal Inserts
×1

Software apps and online services

Raspbian
Raspberry Pi Raspbian
Fusion 360
Autodesk Fusion 360
Ultimaker Cura

Hand tools and fabrication machines

Soldering Kit
Screwdriver Set
3D Printer(3D Printer I Own)

Story

Read more

Custom parts and enclosures

Front Pannel

Base Pannel

Schematics

Circuit Connection

Code

Python

Python
Touch For Single Photo Click
import RPi.GPIO as GPIO
import time
from picamera import PiCamera

# Set the GPIO mode to BCM
GPIO.setmode(GPIO.BCM)

# Set up GPIO pin 21 as input
GPIO.setup(21, GPIO.IN)

# Create an instance of the PiCamera
camera = PiCamera()

def capture_picture():
    # Get the current timestamp for the picture filename
    timestamp = time.strftime("%Y%m%d%H%M%S")
    image_filename = f"picture_{timestamp}.jpg"
    
    # Capture the picture
    camera.capture(image_filename)
    print(f"Picture captured: {image_filename}")

try:
    # Start the camera preview
    camera.start_preview()

    while True:
        # Check if GPIO pin 21 is high
        if GPIO.input(21) == GPIO.HIGH:
            # Call the capture_picture function
            capture_picture()

        # Add a small delay to avoid excessive checking
        time.sleep(0.1)

except KeyboardInterrupt:
    # Stop the camera preview
    camera.stop_preview()

    # Clean up GPIO on program exit
    GPIO.cleanup()

GitHub Repository

Credits

Mukesh Sankhla

Mukesh Sankhla

22 projects • 34 followers
🧑‍💻Passionate software engineer at Siemens, dedicated to driving digitalization by day. 🧑‍🏭By night, I'm a Maker.

Comments