Code Monkey home page Code Monkey logo

prusaconnectpicam's Introduction

PrusaConnectPiCam

Setup a PiCam to connect to PrusaConnect via python

Setup

  1. Go to your PrusaConnect Dashboard and click on the "Camera" tab
    Screenshot_2

  2. Scroll down to the "Other cameras" section and click "Add new other camera"
    Screenshot_3

  3. Connect to your pi, clone the git repo and go into the new created folder

    sudo apt install git
    git clone https://github.com/postpapa/PrusaConnectPiCam
    cd PrusaConnectPiCam
    
  4. run the setup.py and enter the requested infos
    python3 setup.py

    4.1 Enter the token. You can find the token below the name of your "Other camera"
    Screenshot_8
    4.2 Enter an alternative name for your "Other camera"
    4.3 If everything went well you should see "Request was successful." in the terminal
    4.3.1 You may need to install pip3 and requests lib

    sudo apt update
    sudo apt install python3-pip
    sudo pip3 install requests
    sudo pip3 install picamera
    
  5. Check on the PrusaConnect site if the name of your "Other camera" was changed and the status changed to "Registered"
    Screenshot_9

  6. run the "sendscreenshots.py" script to test the uploading part. after a while you should see an image on your PrusaConnect Camera tab
    python3 sendscreenshot.py

    Screenshot 2023-10-03 084004 ctrl + c to exit the script

Install sendscreenshot.py as a service to run it in the background

  1. Make sendscreenshot.py executeable
    chmod +x sendscreenshot.py

  2. create the service file and insert the following code
    sudo nano /etc/systemd/system/sendscreenshot.service

    [Unit]
    Description=Uploads images to prusacloud
    After=networking.service
    
    [Service]
    ExecStart=/home/pi/PrusaConnectPiCam/sendscreenshot.py
    WorkingDirectory=/home/pi/PrusaConnectPiCam
    Restart=always
    RestartSec=5
    
    [Install]
    WantedBy=multi-user.target
    

    2.1 Adjust the ExecStart and WorkingDirectory as needed. You can get the current directory if you enter pwd in the terminal
    2.2 press ctrl + x followed by y to save the file

  3. You can now start/stop the service with the following commands

    sudo systemctl start sendscreenshot.service
    sudo systemctl stop sendscreenshot.service
    

Optional

If you want that the service starts automatically after the pi rebootet type the following line into the terminal
sudo systemctl enable sendscreenshot.service

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.