element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Start a Movement Challenge
  • Challenges & Projects
  • Design Challenges
  • Start a Movement Challenge
  • More
  • Cancel
Start a Movement Challenge
Forum Configuring the wireless camera
  • Blog
  • Forum
  • Projects
  • DC
  • Leaderboard
  • Files
  • Members
  • More
  • Cancel
  • New
Join Start a Movement Challenge to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 1 reply
  • Subscribers 45 subscribers
  • Views 519 views
  • Users 0 members are here
  • raspberry pi
  • tmc5272-eval-kit
  • tmc5272
  • octoscope
  • start a movement
  • tmc5272 evaluation kit
Related

Configuring the wireless camera

amgalbu
amgalbu 8 months ago

For the project I have in mind, the camera must be able to rotate continuously. For this reason, a USB webcam is not suitable and I will make camera from a Raspberry Pi Zero W board and a Raspberry Pi camera module. 

To integrate the camera in Octoprint, I am going to install mjpg-streamer package, which can stream JPEG frames from various sources to various possible outputs.

To install mjpg-streamer, I will start from the dietpi distro. Here is a brief tutorial of the setup process

Step 1: Prepare the Raspberry Pi Zero W

  • Download DietPi Image:

    • Visit the DietPi website.
    • Navigate to the "Download" section and select the appropriate image for Raspberry Pi.
  • Flash the DietPi Image to MicroSD Card:

    • Download and install a tool like balenaEtcher or Raspberry Pi Imager.
    • Insert the microSD card into your computer.
    • Use the tool to flash the downloaded DietPi image onto the microSD card.
  • Configure Wi-Fi (Optional):

    • After flashing, you can enable Wi-Fi by editing the dietpi-wifi.txt file located in the boot partition of the microSD card.
    • Enter your Wi-Fi credentials in the format provided in the file:
      bash
      aWIFI_SSID[0]='Your_SSID'
      aWIFI_KEY[0]='Your_Password'
  • Insert and Boot:

    • Insert the microSD card into your Raspberry Pi Zero W.
    • Power on the Raspberry Pi.

Step 2: Enable the camera module

The official Raspberry Pi camera module, it can be enabled via dietpi-config > Display Options > RPi Camera to show [On].
Additionally, the behaviour of the cameras LED can be set in the same dialog via RPi Camera LED.

Remark: After changing the camera activation you need to reboot and/or sometimes power cycle the SBC incl. camera.

image

Step 3: Configure MJPEG-Streamer

You can now configure MJPEG-Streamer. Run the following command:

dietpi-software

This will open the DietPi software management tool.

  • Scroll through the available software or use the search function (press / and type mjpeg).
  • Locate MJPEG-Streamer and select it by pressing the space bar. A [X] will appear next to it.
  • After selecting MJPEG-Streamer, press Enter to proceed to the next step.
  • DietPi-Software will prompt you to confirm the installation. Confirm and begin the installation process. DietPi will automatically handle the download, compilation, and installation of MJPEG-Streamer.
  • After the build and installation process completes, edit the file /etc/systemd/system/mjpg-streamer.service and replace mjpeg_streamer's commandline parameter "'input_raspicam.so" with "input_uvc.so"
  • Restart the board to apply changes  

Step 4: Configure Octoprint

The final step is to configure the URL in Octoprint. From the Octoprint-s web interface, navigate to "Options", then select "Webcam classic" and enter the following URLs

  • Streaming URL: http://<OctoPi_IP>/stream
  • Snapshot URL: http://<PiZeroW_IP>:8082/?action=snapshot
  • Path to FFMPEG: This is required for features like time-lapse rendering. The typical path is: /usr/bin/ffmpeg

Note that the Streaming URL points to the IP of the Raspberry Pi running the Octopi software, not to the Raspberry Pi Zero W with the MJPEG Streamer. This is because modern browsers tend to block mixed contents (served via HTTPS and HTTP).To make the stream work, I changed the configuration of the haproxy. HAProxy (High Availability Proxy) is an open-source software solution that provides load balancing, reverse proxying, and high availability for TCP and HTTP-based applications. I edited file /etc/haproxy/haproxy.cfg and added a new backend in the frontend public section

frontend public
        bind :::80 v4v6
        bind :::443 v4v6 ssl crt /etc/ssl/snakeoil.pem
        option forwardfor except 127.0.0.1
        use_backend webcam if { path_beg /webcam/ }
        use_backend webcam_hls if { path_beg /hls/ }
        use_backend webcam_hls if { path_beg /jpeg/ }
        ########### NEW LINE ADDED ###########
        use_backend webcam_stream if { path_beg /stream }
        ######################################
        default_backend octoprint

The new backend has been added at the end of the same file. I simply replaced the /stream URL with the URL requested by MJPEG streamer, and added the IP address of the Raspberry Pi Zero W that runs MJPEG streamer application (192.168.118.100) 

backend webcam_stream
        http-request replace-path /stream /?action=stream
        server webcam_stream1 192.168.118.100:8082

  • Sign in to reply
  • Cancel

Top Replies

  • DAB
    DAB 8 months ago +1
    Nice update. I like this idea.
  • DAB
    DAB 8 months ago

    Nice update.

    I like this idea.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube