Good software protocol to communicate between arduino and raspberry PI ?

Papabravo

Joined Feb 24, 2006
16,773
Is there Good software protocol to communicate between arduino and raspberry PI ?, some tutorial ?
There are numerous software protocols for computer to computer communication that have been developed over the last 50 years. Some are simple and straightforward while others are incredibly complex. You might want to start with something simple and straightforward as opposed to complex, especially if you don't have any specific requirements. Speaking of requirements, I guess you forgot to mention any.
 

andrewmm

Joined Feb 25, 2011
1,751
Is there Good software protocol to communicate between arduino and raspberry PI ?, some tutorial ?
Whats the data rate ?
Whats the distance ?
Can you use cable ?
is data one direction or bi direction ?
What happens if you loose data ? is it critical ?

Suggestions off top of head

I2C
SPI
RS422
Serial RS232
WiFi
Ethernet

You might need a board like this to have fast Arduino wifi / Ethernet
https://www.pjrc.com/store/teensy41.html
 

Papabravo

Joined Feb 24, 2006
16,773
There are at least two overarching high level paradigms:
  1. If the protocol is for controlling operations then you go for a <noun><verb> approach. e.g. the Apollo Guidance Computer.
  2. If the protocol is for data exchange then a <service><address> protocol may be indicated. e.g. DeviceNet
There may be others. Low level physical layer stuff can literally be anything; it hardly matters.
 

Thread Starter

meowsoft

Joined Feb 27, 2021
438
What do you want to send between them?
Signal data, very primitive, only analog and digital pin value, but at realtime and very high speed, ethernet is good, but we must use carrier grade switch, because is data send via switch is come with delay (in micro second)

That raspberry pi need to read mutiple arduino analog and digital pin value aslo some i2c data realtime, each second, and make decision what action needs to arduino (send some analog, nor digital value), and then loop again from beginning

In raspberry programming side we use multi threading java, and upstart (when app if stopped nor failed, its restarted automatically)
 

nsaspook

Joined Aug 27, 2009
8,653
All you need is a 8-bit transparent binary data interface with out-of-band signaling at the most basic level for raw byte-sequence serial protocols between two devices. I've used a 9-bit uart protocol (bit 9 for data or control switching) with a embedded 32-bit CRC to transfer data (from and to processor memory) from one programs binary C structure (containing digital and analog values) directly to another remote programs binary C structure between 32-bit and 8-bit controllers
 

Thread Starter

meowsoft

Joined Feb 27, 2021
438
All you need is a 8-bit transparent binary data interface with out-of-band signaling at the most basic level for raw byte-sequence serial protocols between two devices. I've used a 9-bit uart protocol (bit 9 for data or control switching) with a embedded 32-bit CRC to transfer data (from and to processor memory) from one programs binary C structure (containing digital and analog values) directly to another remote programs binary C structure between 32-bit and 8-bit controllers
Some papper / detailed explanation ? Video ?

All you need is a 8-bit transparent binary data interface with out-of-band signaling at the most basic level for raw byte-sequence serial protocols between two devices. I've used a 9-bit uart protocol (bit 9 for data or control switching) with a embedded 32-bit CRC to transfer data (from and to processor memory) from one programs binary C structure (containing digital and analog values) directly to another remote programs binary C structure between 32-bit and 8-bit controllers
Maybe that's not my needs

All you need is a 8-bit transparent binary data interface with out-of-band signaling at the most basic level for raw byte-sequence serial protocols between two devices. I've used a 9-bit uart protocol (bit 9 for data or control switching) with a embedded 32-bit CRC to transfer data (from and to processor memory) from one programs binary C structure (containing digital and analog values) directly to another remote programs binary C structure between 32-bit and 8-bit controllers
Not such things... you don't know my problem
 

click_here

Joined Sep 22, 2020
380
Physically RS485 or RS232 are a good start

You then want to make a frame - i.e. start/stop byte

A device address if you want to expand your network later (put to and from)

Data here

And then some error checking (crc, or sum of all of the bytes)

You'll need to consider what you want to do if there is a bad send (resend/ignore/fix error)

I have sometimes had to send data over very bad links an I also put in a rolling integer which can detect duplicates, or detect when it is out of order... It also helps identify what data needs to be resent.

I also like to use printable charactors, that way I can debug

I found that researching the OSI layers gave me a good grasp on what things to consider when sending data over a link
 

nsaspook

Joined Aug 27, 2009
8,653
Some papper / detailed explanation ? Video ?
An example of Roll Your Own protocol.

Transfer data structures.
https://github.com/nsaspook/mbmc/blob/master/TCPIP Demo App/mbmc.h

The PIC32 RS232 routines.
https://github.com/nsaspook/mbmc/blob/master/TCPIP Demo App/mbmc.c

The PIC18 serial transfer routines.
https://github.com/nsaspook/mbmc/blob/master/swm8722/solar18f8722/mbmc_vector.c

https://forum.allaboutcircuits.com/...ic-controlled-battery-array.32879/post-352486

The end result is a networked web-based 32-bit system that monitors and controls a 8-bit system that gathers/transfers data (analog and digital) and controls a solar energy system.
 
Last edited:

Papabravo

Joined Feb 24, 2006
16,773
Signal data, very primitive, only analog and digital pin value, but at realtime and very high speed, ethernet is good, but we must use carrier grade switch, because is data send via switch is come with delay (in micro second)
There is more than one kind of ethernet. which one did you have in mind?
Why would you need a carrier grade switch between an RPi and an Arduino. That seems like quite a bit of overkill.
 

andrewmm

Joined Feb 25, 2011
1,751
@meowsoft

you say

" Not such things... you don't know my problem "

may be you could provide a bit more detail to help us,

such as
may be a diagram of how this is laid out ,
what sort of environment , is it commercial or hobby.
what have you considered and rejected and why ?

Thank you
 

andrewmm

Joined Feb 25, 2011
1,751
Carrier grade switch is mandatory... even is not really enough... read my explanation please...
Ethernet is HTTP protocol (client-server)
You say HTTP,
That is a protocol that sits on top of the Ethernet Protocol.

Are you using TCP/IP , UDP , or what have you decided to use ?
 

Yaakov

Joined Jan 27, 2019
3,464
@meowsoft unfortunately, your description is rather scattered. A drawing, with the functional elements, and some dimension for the run lengths, along with actual examples of data to be exchanged would help a lot.

Also, a flow chart for use of the data by the program(s), even in block diagram form, would help.

You’ve confused me so much with your multiple posts with mixed information I can’t even start to help.
 

Thread Starter

meowsoft

Joined Feb 27, 2021
438
@meowsoft unfortunately, your description is rather scattered. A drawing, with the functional elements, and some dimension for the run lengths, along with actual examples of data to be exchanged would help a lot.

Also, a flow chart for use of the data by the program(s), even in block diagram form, would help.

You’ve confused me so much with your multiple posts with mixed information I can’t even start to help.
Ok...
 

DickCappels

Joined Aug 21, 2008
7,690
Distributed software is a good idea in cases where you really need it, otherwise it is best to stick with the simplest protocal that will do the job.

You have half a dozen people who want to help you but you provide no detail. Do you actually have an application in mind or are you just trying out aun idea?

Please stop deleting your replies. If this thread does not calm down it may be closed.
 
Last edited:
Top