Posts: 1
Joined: Tue Jan 09, 2018 1:01 am

triggering program on another machine

Tue Jan 09, 2018 1:09 am

Hi all,
newbie here...
I am trying to use a camera connected to my raspberry pi to detect certain events (this part i have already written and it works). But what i want to happen next is for the raspberry pi to call a program on another PC which is running windows. I was thinking of using a usb and writing an interrupt service routine etc. The code has to work real-time.
I have not done any low level system programming since i took an OS course in my undergrad a brazillion years ago, so if there are any suggestions please let me know.

In case i was not clear:
Program (1) runs on rp3 and it waits to detect some event X
program (2) runs on another pc running windows and gets triggered by the rp3 somehow, when the even X is observed
My question is regarding how to connect program (1) to program (2), i.e., how does (1) inform (2) in a real-time manner (dont want to go in the route of using server client mechanism via HTTP/Apache or other IP based approaches, the response has to be immediate)

Thank you so much!


Posts: 9
Joined: Tue Jan 17, 2017 1:46 am
Location: Switzerland
Contact: Website

Re: triggering program on another machine

Fri Jan 12, 2018 10:33 pm

Serial communication over USB ports.

Posts: 8639
Joined: Tue Jul 17, 2012 3:02 pm

Re: triggering program on another machine

Sat Jan 13, 2018 12:09 am

I think you will have to specify what you mean by "immediate".

Of course "immediate" is impossible. The speed of light, and hence speed of communications between machines, is only about 1 foot per nanosecond. The speed of electricity through wires somewhat less than that.

More importantly the limitation is the speed at which the operating system can schedule an output signal at the sending end and the speed of the OS to schedule a response at the receiving end. This can amount to multiple milliseconds.

I don't think you are going to get faster than what what can be done with an ethernet connection without considerable effort.

User avatar
Posts: 1644
Joined: Wed Aug 28, 2013 3:31 am

Re: triggering program on another machine

Sat Jan 13, 2018 1:07 am

I think Pikrellcam uses broadcast mode over the network.
By using a circular buffer you can get pre trigger events, but I don't think that is what you want.

If you use Linux then NC (netcat) works on Pi's, you don't need a full client/server app.
This could get as simple as a single line in shell script.

For faster response, some way to keep a socket open all the time?
Websockets etc

I have done simple modbus on TCP/IP.
Using lower levels like this and telnet means it is not as secure as higher HTTP etc which use SSH/SSL.
Not as secure generally means faster ;)
Latencies can be much lower than 100ms if you can figure out the Windows side of it, which may be the biggest issue.
Older version of Windows were less secure, ie easier to hack up things like this.

The simple ping test will give you an idea of possible speeds.
A version of ping that does something?
You don't even need 64 bytes but watch out for the "ping of death" ;)

Perhaps start with Netcat?
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

Posts: 65
Joined: Mon Aug 24, 2015 6:06 am

Re: triggering program on another machine

Sun Jan 21, 2018 3:46 pm

I would look at socket programming in whatever language you prefer, C or python or php or for that matter bash. Never done bash on Windows but never the less socket programming is about as quick as you are going to get and either ethernet or wifi will do.

User avatar
Posts: 31236
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website

Re: triggering program on another machine

Sun Jan 21, 2018 8:09 pm

I would do it with an MQTT publisher on one machine and an MQTT subscriber on another.
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

Since 2012: 1B*5, 2B*2, B+, A+, Zero*2, 3B*3

Please post ALL technical questions on the forum. Do not send private messages.

Return to “General programming discussion”

Who is online

Users browsing this forum: No registered users and 3 guests