12 Replies Latest reply on Jul 14, 2017 10:02 AM by setcamerav2

    RPI wired network

    setcamerav2

      HI,

       

      I would like to create a wired network of several (6) RPi with cameraboard v2. I would like to use one (more) RPI to send all the other RPIs the same signal (i.e. to shoot a still picture at the same time).

      I am a complete newbie in RPi and networks.

      Anyone could give any instructions to do that and or any hints on where to find?

      Thank you.

       

      Giuseppe

        • Re: RPI wired network
          balearicdynamics

          Hi Giuseppe,

           

          first of all, frankly I suggest you to document a while on what the Raspberry PI can do, just to figure ut a scenario and focus better your idea. By a general point of view, also considering that you are not super skilled, probably the easiest way to do this with 6 PI is proceeding by steps. I can suggest a possible draft of the project building:

          BTW, If you can draw us your project more in detail sure we can be more helpful.

           

          1. Completely setup a stand-alone working PI with the camera. This will help you to manage one problems at a time and experiencing a while better with the board focusing the attention on your needs. When you have a PI with a camera that works as you need (shooting, image saving etc.)
          2. Look on how to write simple Python code (or just bash commands) to control the camera features you want, in particular a command for shooting the camera.
          3. Setup a network of Raspberry PI. The first next question is: do you need the Internet on the LAN ? I suppose yes. To reach this you have two choices: at least one of the PI should be a version 3 including the WiFi or add to at least one WiPi (WiFi USB dongle) or similar for one PI.
          4. Setup the PI with the double network as a bridge, so it can share the WiFi Internet connection via the wired connection with the other PIs
          5. Provide a 10/100 Ethernet HUB As PI does not support super high speed ethernet yo can buy a low cost HUB/Switch with 6 (maybe 10) ethernet ports.
          6. Document yourself a while on the ssh protocol, this will be the easiest way you can exchange and send commands between the PI network.

          There is a lot more to say but I think that the first that should tell a complete story it's you.

           

          Enrico

          3 of 3 people found this helpful
            • Re: RPI wired network
              rachaelp

              Hi Giuseppe,

               

              Enrico has given great advice, break the problem down into manageable chunks as he suggests and build everything up piece by piece and you'll get there.

               

              With regards to this:

              Enrico Miglino wrote:

               

              Document yourself a while on the ssh protocol, this will be the easiest way you can exchange and send commands between the PI network.

              There is a lot more to say but I think that the first that should tell a complete story it's you.

              Once you have read up on SSH and understand it a little then look at the blog I wrote here: Updating security for remotely connecting to my servers via SSH

               

              In here I explain how to set up SSH between linux machines to use shared keys for connections between them rather than having to type passwords.

               

              Then once you've set it up so your controller Pi can SSH directly into each of your slave Pi's, follow what Workshopshed did to run the same command on multiple Pi's on his blog here:  Building a Render Farm with a Bitscope Blade Quatro - Setup of the nodes

               

              Best Regards,

               

              Rachael

              3 of 3 people found this helpful
                • Re: RPI wired network
                  setcamerav2

                  Thank you Enrico and Rachael for your prompt reply and useful advice!

                   

                  As you suggested I will buy one RPi and cameraboard v2.

                  I will also try to document myself on all the stuff you suggested: Python, SSH.....

                   

                  My project:

                  building a set of RPIcameraboards v2 to shoot stilll pictures to stitch together in a pano (360°) picture.

                  There are devices for taht on the market (for example samsung gear) but there resolution is low (30 mpx).

                  The lens on the cameraboardv2 is a low quality lens, I suppose.

                  I think it is possible to change with a better lens: I find one with a horizontal field of view of about 90°. In this case I would need 12 cameraboards and 12 RPIs to cover the full sphere. Of course i am not sure that will work.

                  So first of all let's test on one cameraboard and RPI.and see the oupput in terms of image quality. am not expecting of course professional image quality but I hope not so bad....

                   

                  Next step is to build a set of 12 RPIs and camera boards with one more RPI to control the others in the set, i.e. tell them to shoot a still picture at the same time. The set should be wired connected (no wifi or internet): it would be like one camera, though not so small.

                  Here the problem is to succeed in shooting all the cameras at the same time with a tolerable delay of about 2 ms (that is related to the stitching process) because in the scenes there will be moving objects/subjects.

                  That was the aim of my question: if that is not possible I will not proceed.

                   

                  For example I will shoot a panopicture of a monument with people moving around.

                  I would like to put the apparatus on a rig and ....push a button (on a touch screen attached to the master RPI) and shoot a picture from every cameraboards of the set, store each of them on each RPI and alter stitch them all on a pano picture.

                   

                  Thank you for any remarks and advice.

                   

                  Giuseppe

                    • Re: RPI wired network
                      balearicdynamics

                      Hello Giusppe,

                       

                      in my opinion this project seems possible and sounds very interesting. The idea to stitch cameras together is interesting. But as you plan to place 12 PI in a fixed position, why not explore also the option to make a video array for the "matrix effect" ? I mean something like this: https://fstoppers.com/video/using-gopro-camera-arrays-live-bullet-time-effect-3151 The minimum number of cameras to synch for good effect is just 12

                       

                      What I think it is not a great idea is to totally replace the camera lenses as they are glued in the right position over a small sensor and I bet it will be extremely difficult to remove and place a new one. The PI Camera V2 has a good lens and the sensor a good resolution too, not particular visibile lens distortion especially if every image is just a part of a more complex composition. I suggest to explore - may give absolutely better results - additional lenses to the standard V2 camera lens like those available for smartphones. I have done a search in the recent past for another project and beside the really "bottom-glass quality" lenses that are an offense when placed on a iPhone camera lens there are also (more expensive) very good products. Take a look to this link, just as an example: http://thewirecutter.com/reviews/best-lenses-for-iphone/ and https://exolens.com/product/exolens-with-optics-by-zeiss-wide-angle-iphone-66s/

                       

                      Enrico

                      3 of 3 people found this helpful
                        • Re: RPI wired network
                          setcamerav2

                          Hi Enrico,

                           

                          thanks for suggestions.

                          I would like to use the set for still pictures of places of historic interest: churches, squares ...

                          The problem of space and weight is a real problem which I have not considered in details yet.

                          I would build a rig for the cameras and a rig for the RPIs. I will use everything with a tripod and I think (...hope) it will be feasable.

                          As regards the original lens in the cameraborad it has a 62° horizontal Field of view and I would need more than twelve for a pano picture.

                          tha additional lens you suggest may be interesting to test but I suppose they are designed to be added in Iphone lens and sensor only, which i am not sure are the same as in cameraboard v2.

                          I have found this one: https://www.bluerobotics.com/store/electronics/cam-rpi-wide-r1/ which has a mount that allows to change the lens with other M12 lens, although that will be expensive

                           

                          The first  problem to solve for me now, otherwise I do not go further, is to figure out how to build and manage a wired connection of the 12 (or more) RPIs and their cameras to one RPI (via a router?) which allow me to order the others to shoot at the same time a still picture....

                           

                          Grazie ancora.

                           

                          Giuseppe

                            • Re: RPI wired network
                              rachaelp

                              giuseppe porciani wrote:

                               

                              The first problem to solve for me now, otherwise I do not go further, is to figure out how to build and manage a wired connection of the 12 (or more) RPIs and their cameras to one RPI (via a router?) which allow me to order the others to shoot at the same time a still picture....

                              This should be fine. You will need a 16 port switch (13 of which you will be using) to connect them all together. Configure all the pi's with static IP addresses or use the master as a DHCP server with reservations set for each of the slave devices to ensure they always get the same IP address. Then follow the details given in previous posts to configure it to do what you need.

                               

                              Just remember to break it down into small pieces and get each bit working individually before building the system up together.

                               

                              Bedt Regards,

                               

                              Rachael

                              3 of 3 people found this helpful
                          • Re: RPI wired network
                            rachaelp

                            Hi Giuseppe,

                             

                            I think you should be able to get good synchronisation between the pi's but you might need to buy a few and experiment a little to see how much skew you are getting. If you need to get it more accurate you could use ptpd to sync everything over the pi network, and then command the camera pi's to trigger at a given time. I'm not sure how accurate it should get using ptpd on a pi cluster as I haven't tried it.

                             

                            Best regards,

                             

                            Rachael

                            1 of 1 people found this helpful
                              • Re: RPI wired network
                                setcamerav2

                                Hi Rachael,

                                Thank you for advice and instructing me.

                                I will order one RPI and camera boards to learn some basics and then two more and I will follow the steps you suggested.

                                 

                                 

                                " Just remember to break it down into small pieces and get each bit working individually before building the system up together."

                                 

                                Does that mean I should get each RPI working individually before connecting the set together?

                                 

                                As regards synchronization I do not know anything about ptpd but I should need to shoot not at a fixed time but at my choice.

                                 

                                Thank you and best regards,

                                 

                                Giuseppe

                        • Re: RPI wired network
                          Roger Wolff

                          A few remarks...

                           

                          Others suggest looking into  "ssh". SSH is an encrypted protocol that takes a few hundred miliseconds to initialize the protocol. For a human barely noticeable, but becomes important when you want twelve cameras to snap a picture at the same time. If the master-pi is CPU-clogged starting up all the SSH connections, you'd effectively start them one-after-the-other, resulting in more than  a second spread in time-when-picture-taken.

                           

                          Others suggest using ethernet to connect them together. A 16 port hub is a heavy thing to carry around. You want it portable. For that situation I would recommend using pi zero's. Maybe have the master be a pi3. Depending on how "convenient" you want things, you could get the original zeroes.

                           

                          Then you would connect a physical wire along all the slave pi's and when that signal goes high, all pi's take a picture as fast as they can.  With no networking between all of these, getting the pictures "back to base" is going to be a problem.... You'll have to remove all 12 SD cards and read in the pictures from there.

                           

                          More convenient would be to use the zero-W as the raspberry pi's for the cameras. Now you have a network and you can gather all the images in one place through the network that they share. I would not use SSH to tell other pis to take a picture. I would configure the master as a WIFI access point, have all the slaves connect to that, and then have the master broadcast an UDP packet to a port that you've assigned.  This requires just one thing-to-do from the master, and all the slaves are free to do their now-go-get-a-picture in parallel.

                           

                          I would use "nc" netcat, to recieve the trigger command.

                           

                          If you are sure that nobody can access your access point, (i.e. the password is really secure, e.g. generated by pwgen -s 16 1), then the "accept a trigger" can be as simple as: nc <options>  | sh . Now the slaves will execute all the commands you'll send to them. Controlling WHAT EXACTLY they do is easy to manage in one place on the master. On the other hand, this is  a security risk. It would be better to at least do something like "while read a ; do ; take-a-picture; done" in a script (fed with the output of nc), so whenever you get SOMETHING from nc, you will just take a picture instead of executing whatever command  was sent. A hacker may now trigger your camera instead of immediately having complete control over your raspberry.

                           

                          Finding a power-system for all of this might prove tricky. Twelve cameras going into "take a picture" mode at the same time might pull a quite significant surge that is no problem if it is just one, but it might become a problem with twelve at the same time.

                           

                          Consider using hugin to stitch the images together.

                           

                          Although an overlap of 50% is recommended, when your cameras are at a fixed position you can probably get away with a bit less. As the FOV vertically is 48 degrees, I would rotate the cameras 90 degrees so that the 62 FOV ends up being vertical. And the 48 degrees FOV times 12 is over 580 degrees, about 40% more than 360, so you'll have 40% of overlaps. This means that you will use at least SOMETHING of each camera so you can't tolerate having one camera fail. That's too bad. At least I think you can get great pictures without any complicated trickery with the optics. If you think you can improve on the setup, you can still go ahead.... If you experiment with one camera you might end up figuring out that changing the lens causes a reduction in quality because of dust on the sensor or distortions you didn't expect.

                           

                          Good luck! Let us know how you're going! We'd like to see some of your pictures once you are starting to take pictures!

                          1 of 1 people found this helpful
                            • Re: RPI wired network
                              setcamerav2

                              Hi,

                              Thank you very much for your detailed suggestions.

                               

                              I am not sure to uunderstand correctly everything.but your remarks about synchronization and lens  may be crucial for my project.

                               

                              SSH connection it is impossible to use due to delay in initializing the protocol.

                               

                              The ethernet connection has the issue in weight and size you mentioned. I do not know weight and size of RPi and of a 16 port hub.

                              For me "portable" would mean about 1 or 1.5 kg in weight and about "half of a shoebox" in size.....

                              Having the pictures in 12 different sd cards would not be an issue.

                               

                              I do not know anything about wifi connection so I can not understand the way to connect you suggested. But I could instruct myself on that. I did not consider wifi connection in the beginning because in a forum about a rig of 6 (or more) action cams I read that wifi connection is not reliable and may imply a delay in synchronization more than tolerable...Not sure I understood it correctly.

                               

                              The lens: I would like to take pictures 360° x 120° (i.e. a sphere without a 60° "black hole" on the ground).

                              Using the standard lens implies more than 20 cameras: too much...

                               

                               

                              I will order one RPI and one cameraboard v2 to test and learn, anyway. Then, I will decide what to do...

                              All that will take some time I am afraid.

                              Any hints, remarks and suggestions will be much appreciated and a great help.

                               

                              Thank you.

                              Best regards,

                               

                              Giuseppe

                                • Re: RPI wired network
                                  Roger Wolff

                                  For your first raspberry pi, I would recommend a fullblown RPI3. You could put that one as the master later on if you can't afford to keep the first one on your desk.

                                   

                                  If you photograph DOWN too, then you usually have whatever the stuff is standing on (the tripod) in view too. Unless of course you put the stuff under a drone or balloon. Because the ground under the picture is not that interesting, I was assuming you would not need to photograph it.

                                   

                                  You can practice stitching by going out and taking pictures with anything that can take a picture. Like your smartphone.

                                   

                                  If the WIFI turns out not to be reliable enough, you can always still use a GPIO to trigger all the slaves.

                                    • Re: RPI wired network
                                      setcamerav2

                                      Thank you very much.

                                       

                                      i will buy a RPI3 with cameraboard v2 and practice and figure out most of the things I need 8included GPIO which I had never considered)

                                       

                                      I do not need to photograph the ground with the tripod: that would add many problems and it is not interesting.

                                      But I would need (not always but in many scenes) to photograpph the ceiling or at least to have a vertical field of view of  about 100 ° or more.

                                      Using the standard lens that means I need two camera in portrait mode (they have 62° FOV which I could overlap 20° and obtain a 100° Fov when stitched, not sure it is enaugh) x 10 (to cover 480 degrees less the overlapping areas, not sure it is enaugh). At least 20 cameras. Too many to manage.

                                       

                                      I have found this one: https://www.bluerobotics.com/store/electronics/cam-rpi-wide-r1/ which has a mount that, additionally, allows to change the lens with other M12 lens, but that will be expensive and nothing I know about quality.

                                      I will first get to know a bit about RPI and the cameraboard and then I will decide...