Uncategorized

Compatibility of actuators and sensors among different Rpi versions [closed]

https://raspberrypi.stackexchange.com/questions/116661/compatibility-of-actuators-and-sensors-among-different-rpi-versions

Compatibility of actuators and sensors among different Rpi versions [closed]

Ask QuestionAsked yesterdayActive todayViewed 41 times0Closed. This question needs details or clarity. It is not currently accepting answers.


Add details and clarify the problem being solved. This will help others answer the question. You can edit the question.

Closed 15 hours ago by joanDougieMilliwaysSteve RobillardDmitry Grigoryev.

(Viewable by the post author and users with the close/reopen votes privilege)Edit question

I want to buy a rasperry pi 4 but I need to use some relays used for rasperry 2 and 3, my question is, those same relays and sensors like bluetooh that I use in versions 2 and 3, are they compatible with version 4 of rasperrry pi?pi-3pi-2pi-4shareedit  follow  reopenflagedited 22 hours agotlfong013,28733 gold badges77 silver badges2121 bronze badgesasked yesterdayJDanVz911 bronze badge New contributor

  • 4How would we know? You have given no details of the relays or sensors. It may help you to know that the GPIO are pretty much the same on all Pi models. – joan yesterday
  • 2i doubt very much that there is such a thing as a “Raspberry Pi” relay – jsotola 21 hours ago 

add a comment

1 Answer

ActiveOldestVotes0

Question

I want to buy a Rpi4. My worry is that can the relays and sensors I have been using for Rpi2/3 still be used for Rpi4?.


Answer

Part 1 – Introduction to the actuator and sensor interface

My answer to you general question is yes.

But there is a complication that cause exception to the general rule. This complication is related to the high level programs (written in python language), and low level “drivers” (written in C language), used to interface to the actuators and sensors.

To explain things better, let us use the OP’s first example, a relay, as a case study and see what sort of teething problems he might face if trying to use a Rpi1/2/3 compatible relays for Rpi4.

To get to know better the actuators and sensors, we need to first understand what sort of interface protocol they use to communicate with Rpi.

Now let me introduce the most common protocols.

(1) GPIO

(2) UART

(3) SPI

(4) I2C

Of the four communication protocols listed above, GPIO is the simplest and most newbie friendly, so let us look at it first, and use the simplest examples to explain the principles which can actually applied to all sensors and actuators.

Actually we can instead of relay and use use a simpler example, the LED. Before we start, we need to first clarify the following:

(a) A LED is an actuator, like a relay, except that a LED lights and dims, while a relay switches on and off.

(b) A push button is a sensor, which can detect pressing or releasing, while a temperature sensor measures temperature.

Next we will talk about basic principles of interfacing, and the problem of compatibility which is what the OP concerns most.


Part 2 – About Backward Compatibility

Compatibility is a very import concept to consumers and engineers. More details can be found in the Wikipedia articles in the reference below.


backward compatibility

Part 3 – Rpi Backward Compatibility of GPIO, UART, I2C, and SPI communication actuators and sensors

(1) For devices controlled by GPIO, we see that Rpi GPIO of different versions are backward compatible, so all Rpi2/3 devices are compatible, and can used for Rpi4 with no or only minor changes in software.

(2) For UART, I2C, and SPI, there might be hardware related name changes. For example Rpi2 programs or drivers may be hard coded to use the name i2c0 for the onboard I2C. But for Rpi3/4, the name might need to change to i2c1, or vice versa. Beside the small name changes, since these protocols have been used for many years and are very stable, so there is little chance that the protocol would change without backward compatibility. In other words, no other changes in software are necessary

(3) Actuators and sensors are relative simple and so it is usually not that difficult to modify the drivers and programs by simple changes parameters such as i2c0 to i2c0, spi1 to spi2 etc, and recompiled as necessary.

However, there are more complicated devices such as small LCD/LED displays by manufacturers who don’t always not following Rpi and other common standards, and often these small devices might be discontinued, so old drivers might not work for new hardware Rpi models. But of course the OP will not worry because he is only concerned with simple actuators and sensors, not complicated LCD displays.


Part 4 – Conclusion

In the last couple of years, I have been playing with various GPIO, UART, SPI, I2C, 1-Wire relays and sensors devices, and I have been moving these devices from Rpi1 to Rpi2 to Rpi3 to Rpi4 and almost always the transition is very smooth.


References

(1) Backward Compatibility – Wikipedia

(2) Rpi1 26 pins and corresponding pins in Rpi3B – rpi.org.forums, 2019jul28


End of answershareeditdeleteflagedited 15 hours agoanswered 23 hours agotlfong013,28733 gold badges77 silver badges2121 bronze badges

  • 2While I appreciate your effort in answering this question it does make for quite a rambling read. It is preferable to have answers that are as succinct as possible and directly answer the question. Rather than an essay style which explores all aspects of the problem. May I suggest you read this page in the Help center. – Darth Vader 14 hours ago 
  • thank you for your advice. – tlfong01 12 hours ago   

add a comment

Categories: Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.