tiivik
Posts: 2
Joined: Wed Jul 08, 2015 11:43 am

3D scan rig (possibly 100+ Raspberries)

Wed Jul 08, 2015 12:21 pm

Hi!

I am currently developing a system for a 3D photogrammetry rig and testing out different rig ideas first before going large-scale with the project.

What I currently have:
One Raspberry Pi connected to a Camera Module, powered by an external battery + WiFi dongle. I can remotely trigger the camera to take a picture and upload to a local apache web server.

Current objective:
Have multiple raspberry Pi's connected to each of their own Rasperry Pi Camera Modules. It is necessary for the RPis to take a photo exactly at the same time triggered by user input. All of the photos must be delivered to a central server (let's say, an FTP server).
The setup should be as robust and simple as possible, wireless is something that I have in mind for this aswell. The key is to have as little wiring as possible (probably only power cords) and as reliable system as possible. Do you guys think that it would be easy to consistently get synchronized photos in a setup that would consist of 10x Raspberries + 10x WiFi dongles for remote triggering and transferring to a file server? If WiFi doesn't give as good synchronization and consistent reliability, I am also looking at using 10x Radio Triggers (http://www.adafruit.com/products/1096) for triggering purposes. Would something like that work? Shouldn't be a problem triggering 10x RPi at the same time through a one radio remote, or is there some blockage I cannot think of right now?
Please do note that the system should continue to work while going large-scale- using 100+ RPis and Camera Modules.

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 24930
Joined: Sat Jul 30, 2011 7:41 pm

Re: 3D scan rig (possibly 100+ Raspberries)

Wed Jul 08, 2015 6:43 pm

Using Wifi or radio might not scale so well. Would using a GPIO on each fires from one line work?
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
“I own the world’s worst thesaurus. Not only is it awful, it’s awful."

ghans
Posts: 7881
Joined: Mon Dec 12, 2011 8:30 pm
Location: Germany

Re: 3D scan rig (possibly 100+ Raspberries)

Thu Jul 09, 2015 10:04 am

A similar system for 3D scanning used wired Ethernet , probably because of latency and reliability reasons. But they developed a PoE shield to minimize cabling.

ghans
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org

User avatar
joan
Posts: 14655
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: 3D scan rig (possibly 100+ Raspberries)

Thu Jul 09, 2015 10:21 am

You need to give some details.

Do the Pis have a common time frame, e.g. are they running NTP.

As far as I can tell you don't need to say take a snap now, I can see no reason you can't say take a snap at time x, where x is some future time. That removes network latency as a problem.

Here is some Python code which implements an MQTT based solution.

webm screencast with a server and 3 Pi clients.

Server (mqs.py)

Code: Select all

#!/usr/bin/env python

# mqs.py

import mosquitto
import time

mq = mosquitto.Mosquitto()

# Connect to mercury
mq.connect("mercury")

# Take a photo now
t = time.time()
print("take photo at {}".format(t))
mq.publish("photo/trigger", "{}".format(t))

time.sleep(1)

# Take a photo in 10 seconds
t = time.time() + 10
print("take photo at {}".format(t))
mq.publish("photo/trigger", "{}".format(t))

time.sleep(11)

# Take a photo in 5 seconds
t = time.time() + 5
print("take photo at {}".format(t))
mq.publish("photo/trigger", "{}".format(t))

time.sleep(6)

# Take a photo now
t = time.time()
print("take photo at {}".format(t))
mq.publish("photo/trigger", "{}".format(t))
Client (mqc.py)

Code: Select all

#!/usr/bin/env python

# mqc.py

import mosquitto
import time

def on_connect(mosq, obj, msg):
   print "Connected"

def on_message(mosq, obj, msg):
   msg_time = time.time()
   snap_time = float(msg.payload)
   while time.time() < snap_time:
      pass
   now_time = time.time()

   print ("msg={}, snap={}, now={}".format(msg_time, snap_time, now_time))

mq = mosquitto.Mosquitto()

#define callbacks
mq.on_message = on_message
mq.on_connect = on_connect

#connect
mq.connect("mercury")

#subscribe to topic 
mq.subscribe("photo/trigger")

#keep connected to broker
while mq.loop() == 0:
   pass

User avatar
RogerW
Posts: 286
Joined: Sat Dec 20, 2014 12:15 pm
Location: London UK

Re: 3D scan rig (possibly 100+ Raspberries)

Thu Jul 09, 2015 1:26 pm

You say
It is necessary for the RPis to take a photo exactly at the same time
. Strictly speaking this is impossible. What you can do is have all the RPis take their photos within a given time. It would be helpful to know what would be acceptable. If this is measured in nanoseconds you will have problems, if microseconds you should be ok. As jamesh says you could use a single wire to connect to a given GPIO pin on all the RPis. I suspect you could use wifi if you use a broadcast protocol rather than having to send individual messages to each pi.

tiivik
Posts: 2
Joined: Wed Jul 08, 2015 11:43 am

Re: 3D scan rig (possibly 100+ Raspberries)

Fri Jul 10, 2015 1:01 pm

RogerW wrote:You say
It is necessary for the RPis to take a photo exactly at the same time
. Strictly speaking this is impossible. What you can do is have all the RPis take their photos within a given time. It would be helpful to know what would be acceptable. If this is measured in nanoseconds you will have problems, if microseconds you should be ok. As jamesh says you could use a single wire to connect to a given GPIO pin on all the RPis. I suspect you could use wifi if you use a broadcast protocol rather than having to send individual messages to each pi.
Synchronization would preferably be around 1 millisecond.

I'm ditching the WiFi idea, don't think it would be as consistent as I'd like, especially when the nr of Rasperries goes up.

I am looking into the "shooting in the future" and triggering via a clock signal, thanks for the suggestion.

Return to “Other projects”