3

Is it possible to synchronize multiple Pi cameras by synchronizing all their main Pi clocks to a single NTP server, and then commanding them to start taking frames at the same time? (using some software like MTPutty (see this link))

I am new to this whole concept of camera synchronization, so I am not at all sure about this idea. Will it work?

EDIT: Following Steve's suggestion, I thought I would explain what exactly I want to do. I need to study the behaviour of a rat in a fairly large room for approximately an hour's time. Given the size if the room, I will need to use at least three Pi cameras to cover the whole surface, and these have to be synced with respect to each other. I also need to record the time-stamps for each frame, and so, have written a Python script for both taking the video and recording the time-stamps. Since I want all Pis to take frames at the exact same instant of time, I thought of synchronising them to a single NTP server. So, essentially what I need is a way to run this script on all Pis simultaneously.

NTE12
  • 41
  • 1
  • 6
  • 2
    I doubt this will work. Even with a single NTP source network and system fluctuations and jitter will mean that the systems will not be precisely synchronized. You may get better answers if you explain a little about your project and its goals. – Steve Robillard Jun 28 '15 at 05:46
  • Might be worth reading this answer for a bit more insight into the limitations of frame synchronization between Pis. – Dave Jones Jun 28 '15 at 17:59
  • See also: http://raspberrypi.stackexchange.com/q/33247/5538 – goldilocks Jul 24 '15 at 18:20

3 Answers3

2

Using an NTP server you will be able to get them all synchronized within a second most of the time, although as Steve points out in a comment, there are potential imperfections. Questions about exactly how to best tune ntpd for this kind of purpose are better off on our larger sibling site, Unix & Linux. You should do some reading and contemplate what you think might work before you ask.

However, if they are all taking pictures of the same thing at the same time, you may want more precise timing. If they can also all be on the same local network in this scenario, using a broadcast packet would be a worth a try, although it requires a bit of basic network programming.

goldilocks
  • 58,859
  • 17
  • 112
  • 227
1

You can achieve sub-microsecond sync with PTP (precision time protocol). There is a linux implementation of it here: http://linuxptp.sourceforge.net/, but you will probably find it already packaged by your favorite distro. Buildroot also have it. This will solve the problem of having coherent frame timestamps between an array of raspis.

  • 1
    It would be better if you could edit and expand upon your answer, provide more explanation, details and links – Greenonline Jul 19 '18 at 21:20
0

Take a look at this project I guess you can reuse part of their code for your project.

I know it is not exactly the same, but I'm sure the code could help you as they sure need to have a common and precise time origin to operate synchronously. Which is exactly what you need.

Ayman Khamouma
  • 252
  • 2
  • 12