Results 1 to 5 of 5

Thread: How-To Setup Raspberry Pi Camera Stream For Use With Apex Fusion

  1. #1
    Regular Vistor
    Join Date
    Oct 2015
    Location
    Overland Park, KS
    Posts
    41

    How-To Setup Raspberry Pi Camera Stream For Use With Apex Fusion

    A couple weeks ago I went on vacation and borrowed a the Foscam that we normally have watching our dogs and since then I've really wanted to get a camera for the tank, but I love to tinker and wanted full 1080P HD so I started looking around and stumbled onto the Raspberry Pi & RPi Camera module so I set to work, it took a while to figure out all the moving pieces so I've put together the following tutorial to try to simplify it for others and remind myself how I did it for when I setup another one to watch my sump here in the near future. Enough about me, onto the how-to:

    Start with this basic tutorial on how to setup "MJPG-Streamer on the Raspberry Pi". Stop at the end of step 6. Step 7 & 8 will need to be done everytime you restart your Raspberry Pi so I've created the following scripts to do that automatically:

    1. Login to your Raspbery Pi.
    2. sudo su
    3. vi /etc/init.d/raspi-stream

    Code:
    #!/bin/sh
    /root/start-raspi-stream.sh
    (Hit esc, then :wq to write the file and close out of the text editor)

    4. vi /root/start-raspi-stream.sh

    Code:
    #!/bin/sh
    # Kill any existing raspistill processes.
    ps -ef | grep raspistill | grep -v grep | awk '{print $2}' | xargs kill -9
    # Create temp directory for streaming
    mkdir /tmp/stream
    # Start the raspicamera running in the background
    nohup raspistill --nopreview -w 1440 -h 1080 -q 5 -o /tmp/stream/pic.jpg -tl 1 -t 9999999 -th 0:0:0 >/dev/null 2>&1 &
    # Pass the image path to the streaming service
    LD_LIBRARY_PATH=/usr/local/lib mjpg_streamer -i "input_file.so -f /tmp/stream -n pic.jpg" -o "output_http.so -w /usr/local/www"
    (Hit esc, then :wq to write the file and close out of the text editor)

    5. chmod ugo+x /etc/init.d/raspi-stream

    6. update-rc.d raspi-stream defaults
    7. Setup Fusion
    a. If you haven't already, add the webcam tile to your dashboard.
    b. Click on the gear for the webcam tile to get to settings.
    c. Click the plus sign to add the stream
    d. Name it something useful
    e. Change the level to view
    f. Change the type to Image/Motion JPEG
    g. http://yoururl.net:8080/?action=stream (In order for Apex Fusion to be able to display the stream you'll need to have setup port forwarding, if using the defaults in the tutorial above the port you'll need to forward is port 8080)

  2. #2
    New User
    Join Date
    Dec 2015
    Location
    US, Central Time
    Posts
    1
    Are there specific camera's that you recommend?

    I do not want to leave my camera exposed for everyone to view, is there an IP range i need to whitelist in order to only allow the Apex Fusion control panel and system to be the only one to access that panel so i can link it to the dashboard?

  3. #3
    Master Control Freak RussM's Avatar
    Join Date
    Dec 2012
    Location
    California - US Pacific
    Posts
    22,466
    Quote Originally Posted by chass1287 View Post
    Are there specific camera's that you recommend?
    I've made a RasPiCam too - it only works with the Raspberry Pi cameras. There are two models, one without infrared capability and one without.
    Please do not send me PMs with technical questions or requesting assistance - use the forums for Apex help. PM me ONLY if the matter is of a private or personal nature. Thanks.

  4. #4
    Master Control Freak RussM's Avatar
    Join Date
    Dec 2012
    Location
    California - US Pacific
    Posts
    22,466

    How-To Setup Raspberry Pi Camera Stream For Use With Apex Fusion

    is there an IP range i need to whitelist in order to only allow the Apex Fusion control panel and system to be the only one to access that panel so i can link it to the dashboard?
    Yes, but you won't want to do that. Whitelisting cameras by requesting IP address is impractical. APEX Fusion does not actually pull the video stream, it just wraps it in a frame. The actual video traffic is fed from the camera directly to the viewing device. So if you limit access by IP address, you'll find yourself unable to access the video much of the time when you are away from home. This applies to all network cameras, not just a RasPiCam.

    Position the camera where it won't be a privacy issue if someone should stumble across your video stream. Use a nonstandard port in your port forwarding. And don't work on your tank in the buff
    Please do not send me PMs with technical questions or requesting assistance - use the forums for Apex help. PM me ONLY if the matter is of a private or personal nature. Thanks.

  5. #5
    New User
    Join Date
    Nov 2018
    Location
    Solon, OH
    Posts
    1

    Exclamation Multiple Raspberry Pi Camera feeds working very well within Apex Fusion

    I've spent entirely too much time getting a camera working within Apex Fusion.
    But now I have it working well and hopefully my findings save someone some time.
    If you are interested in having a camera work inside of Apex Fusion, see my notes below for the Raspberry Pi camera including night vision.
    I built (2) cameras, one shows my skimmer, the other the front of the tank.
    I might add a 3rd in the future that monitors my AFS module to keep an eye on feeding.


    Notes on compatible cameras:

    • For a camera to work inside of Apex Fusion, it cannot require authentication (username & password to access it's video stream URL.
    • Many/most of the cameras listed in the forum (https://forum.neptunesystems.com/sho...RL-s-by-camera) having a known video stream URL do not require authentication, but are limited to 640x480 resolution. I tested 3 newer camera (available today on from Amazon for ~$100). All 3 supported 1080P video and ~5MP still picture resolution, but all require authentication, as will any currently manufactured webcam. While this may not be an issue for some, I elected to go with the Raspberry Pi because
      • we can control authentication, and not require it
      • ~5PM resolution is more desirable
      • the hardware will continue to be available, while the older 640x480 compatible cameras are becoming more difficult to find
      • It works well within Apex Fusion




    Required hardware to build Raspberry Pi night-vision compatible camera: ~$120 total (as of 02/2019):

    Dorhea Raspberry Pi 3 Model B+ Camera Module: $24 https://www.amazon.com/gp/product/B0...?ie=UTF8&psc=1
    Night vision module for Raspberry Pi Camera: $9 https://www.amazon.com/gp/product/B0...?ie=UTF8&psc=1
    Adafruit Flex Cable for Raspberry Pi Camera 24" $7 https://www.amazon.com/gp/product/B0...?ie=UTF8&psc=1
    CanaKit Raspberry Pi 3 B+ (B Plus) Starter Kit $80 https://www.amazon.com/gp/product/B07BCC8PK7/ref=ppx_yo_dt_b_asin_title_o03__o00_s00?ie=UTF8&ps c=1


    Install MJPG-Streamer on the Raspberry Pi:
    Credit goes to Pyro919 for his original post found here: https://forum.neptunesystems.com/sho...miguelgrinberg

    https://blog.miguelgrinberg.com/post...e-raspberry-pi

    What may not be clear is that steps 7 & 8 are both required to create the stream. So if you're using SSH (headless), you will have to open 2 separate SSH windows to run the commands, until you automate the startup using the scripts here: https://forum.neptunesystems.com/sho...spberry+camera
    Which will Configure MJPG-Streamer to start automatically, thanks to Pyro919.


    I like to schedule the Raspberry Pi to perform a daily reboot for maintenance:
    If you are unfamiliar, you can google "crontab -e" for raspian to better understand the following Daily reboot (6AM):

    sudo -s
    crontab -e
    0 6 * * * /sbin/shutdown -r now


    Edit image parameters & MPEG screen overlays:
    You will l notice from my printscreens below that my image overlays at the top label which camera view it is.

    sudo -s
    nano /root/start-raspi-stream.sh

    The following sets the resolution to a max for the camera (2592 X 1944), 100% quality, every 2 seconds (2000 = mS) and my customer Overlay indicating Reeftank Front with a date/time stamp so I can ensure the camera feed is changing:

    nohup raspistill --nopreview -w 2592 -h 1944 -q 100 -ae 64 -a 8 -a "Reeftank Skimmer %m/%d/%Y %X" -o /tmp/stream/pic.jpg -tl 2000 -t 9999999 -th 0:0:0 -rot 0 >/dev/$

    See all overlay options: https://www.raspberrypi.org/document...ions/camera.md


    Test the camera:
    One you have everything working, use the following URL's to connect to the webserver on the Raspberry Pi to test you video, quality, focus (the camera I recommended has a manual focus), resolution, etc...

    http://X.X.X.X:8080/index.html This will take you to the camera server homepage
    http://X.X.X.X:8080/?action=stream This will take you directly to the camera's feed page


    Camera feed inside of Apex Fusion:
    Setup the camera feed as per the Apex Manual.
    Set the level to View if you want others to be able to view the MJPEG stream.
    I have setup (2) URL's for each video feed for a total of (4). Each feed has an internal IP URL and an external IP URL.
    So my video feed works from inside my network as well a from the outside.
    The downside of this is that 2 of the 4 feeds will be blank at all times, but I am ok with this.
    When you configure port forwarding (explained in the Apex manual) you can view the feed when you are outside of your home network. You can get creative with port forwarding or use a VPN if you are more concerned w/ security from the outside.
    For multiple feeds from the outside, you will also have to redirect ports. For example, my URL's for (2) camera's ended up being:


    You may find that the video/image doesn't appear, I have noticed the following:
    • The feed defaults to "Play", it might take a couple "cycles" of going through the feeds/pics then it seems to show up.
    • Selecting the arrows to maximize then scrolling through the feeds/pics seems to make them appear, the same for switching back to the thumbnail view.
    • If the above doesn't work, closing the Apex Fusion app and re-opening seems to solve it.



    3d Print Raspberry Pi Camera Case, 3D if desired:
    I modified some existing Raspberry Pi camera cases to custom fit the exact camera and night vision module I recommended.
    I also designed a mount that holds the actual Raspberry Pi case and connects the camera to it.
    The assembly has a hole to screw a magnet to it to allow you to stick it to something ferrous (my tank stand and a drop ceiling in my case)
    PM meed if you want my .STL files so you can 3D print your own case.
    I'll try to upload some pics of the 3D printed case.




    I hope this helps someone obtain these results without wasting the amount of time I did.


    My Results:
    01-Fusion_Skimmer_Thumnail.jpg

    02-Fusion_Front_Thumnail.jpg

    03-Fusion_Skimmer_Full.jpg

    04-Fusion_Front_Full.jpg
    Last edited by ToddB; 02-19-2019 at 11:27. Reason: typos

Similar Threads

  1. Updated - How-To Setup A Raspberry Pi Stream Viewable through Fusion
    By Pyro919 in forum Camera & Media Integration with APEX Fusion, APEX Local, & Classic Dashboards
    Replies: 2
    Last Post: 07-21-2021, 00:39
  2. Raspberry Pi Camera
    By ReefBeez in forum Camera & Media Integration with APEX Fusion, APEX Local, & Classic Dashboards
    Replies: 0
    Last Post: 01-16-2017, 09:39
  3. raspberry pi cam for apex neptune
    By bpiermat in forum DIY
    Replies: 9
    Last Post: 05-16-2014, 07:56
  4. Question: I cannot view Camera stream via IPHONE but I can via remote PC
    By rvales in forum Apex Classic Dashboard
    Replies: 0
    Last Post: 02-05-2014, 06:15
  5. How to Configure Camera Stream in Apex?
    By Patrick Cox in forum Apex Classic Dashboard
    Replies: 4
    Last Post: 05-12-2013, 14:04

Tags for this Thread

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •