# Using Arduino to send digital square pulse as a tool to time-sync datasets

I am doing an experiment where I have relevant data being recorded on two separate machines. Let's say Machine 1 is measuring a voltage and when the voltage crosses a threshold it records the time of that event. Machine 2 is a load cell that measures the force being applied on a specimen. Machine 1 and Machine 2 run on completely separate hardware/software. They're not linked up and there's no way to do so. So in terms of initiating data recording, both machines begin roughly around the same time based on a verbal cue from two lab workers who run the machines. But the verbal cue is prone to error so the two datasets can still be off by several seconds and we need to precisely match them up.

So let's say Machine 1 begins recording at time t = 0 and it registers an event at t = 12 seconds. I want to know what the force is at the time of this event. But Machine 2 didn't begin recording until time t = 2. So on the timeline of the dataset from Machine 2, I want to look at what Machine 2 recorded at t' = 10. So basically by knowing the difference in time between when each machine started recording, I should be able to temporally match up the datasets from the separate machines.

I figured an easy way to do this is to use an Arduino to send one digitial signal to both Machine 1 and Machine 2. Both machines can take in a digital input signal and record it in parallel with the rest of its data. So basically, out of one pin on my Arduino Uno, I will have a wire coming out that splits into two wires that go into a coaxial cable that connects to each of the two machines. Each machine will be getting the same signal of a digital square pulse (that alternates in frequency).

``````void setup() {
// put your setup code here, to run once:

pinMode(10, OUTPUT);
}

void loop() {
// put your main code here, to run repeatedly:
digitalWrite(10, LOW);
delay(1000);
digitalWrite(10, HIGH);
delay(1000);

digitalWrite(10, LOW);
delay(2000);
digitalWrite(10, HIGH);
delay(2000);

digitalWrite(10, LOW);
delay(3000);
digitalWrite(10, HIGH);
delay(3000);

digitalWrite(10, LOW);
delay(4000);
digitalWrite(10, HIGH);
delay(4000);

digitalWrite(10, LOW);
delay(5000);
digitalWrite(10, HIGH);
delay(5000);
}
``````

So basically, this signal will be recorded on both Machine 1 and Machine 2, and then by measuring the time between when similar peaks (ex: the peak after the delay of 3 seconds) arrived on each machine, that will tell me the time difference between each dataset.

I'm still working on soldering a wire that I can use to send this signal to both machines, but I just wanted to post this to get some feedback. Theoretically, this should work right?

I am relatively new to electronics. I have an arduino, breadboard, and basic jumper wires that I've been playing around with, but now I need something else for a project. I want to output a digital pulse from a pin on my Arduino Uno. I want to send this one signal from the Arduino to two different machines using two different coaxial cables.

What is the cheapest/easiest way to do this and what items will I need? Are there any readily available cables that on one end are basic jumper wires that can easily plug into an Arduino pin while the other end is a male coaxial connector? If so, I'd imagine that would be an easy solution. Just plug one end into my Arduino and then connect the other to a coaxial splitter, then have two other coaxial cables coming out of the splitter to carry the signal to the other machines. I'd prefer a solution that will not require me to solder anything.

If your cables have F-connectors or BNC connectors, etc., you'd just get two chassis-mount mating connectors and solder the inputs together.

Or, you can take an existing cable and cut it half so you can solder the cut-end (or connect the wires somehow), and then use a [u]coupler[/u] to connect to another male connector.

Or, you can buy the cable with no connectors and do whatever you want.

Sometimes if I need an audio cable (or something like that) with something "special" on one end, I'll buy a cable twice as long as I need and cut it in half. That way, I can make two of the special cables for the price of one additional connector. That's usually easier (and sometimes just as economical) as building from scratch.

Or even better, explain your proposal fully.

My full proposal/problem is explained here: http://forum.arduino.cc/index.php?topic=360815.0

Trust me, I know the machines being used in my experiments. Feeding my signal into my machines via coaxial cable is the simplest solution based on how my hardware and software work.

• Moderator

That looks fine but it would be much easier to sync the two devices if the pulses were evenly spaced. Say one pulse every second.

He's done it again!

Stop cross-posting. Last warning.

OK, so here's the point.

You start talking about coaxial cables. Presumably you imagine that this is the appropriate way to connect things in a noisy environment.

Well, it turns out that this is how the Internet used to be connected, but is no longer!

The problem you have not realised, is not merely interference, but ground loops. You requite isolation, which is implemented either by opto-couplers (or indeed, fibre-optic cable), or by transformers, depending on the frequencies and bandwidth involved. Isolation transformers are used for your 10BASE-T, 100BASE-TX and 1000BASE-T Ethernet, while for simple industrial control as you want, opto-isolators on a 20 mA current loop are used.

And of course, either of these uses the standard "Cat 5" cable which is and whose terminations are readily available.

Paul__B:
He’s done it again!

You guys should kinda calm down … What do you mean “again”? I “cross-posted” once. I made this initial post in the Science and Measurement forum. Then an hour or so later, I realized that I really only needed to know the answer to the electronics aspect of my issue so I posted a simplified version of my problem to the General Electronics thread. I now understand that I shouldn’t have done that, but that’s all I did. Two posts. Then one of the moderators messed up in terms of merging/closing my threads and all of a sudden you guys are acting like I’m some chronic cross-poster just trying to cause trouble…