How to Connect Raspberry Pi to Industrial Sensors

The Industrial Pi Solution

Download the free guide to Prototyping On a Pi

Sensors and actuators are essential elements of industrial systems, instrumental to any application that requires automated control. Sensors measure changes in the environment, while actuators control physical changes, both devices serve as mediator between the physical environment and the electronic system where they are embedded. Raspberry Pi provides general purpose header pins that can be connected to sensors, making the low-cost board a popular choice for engineering prototypes. Pi’s GPIO pins are designed for driving low current devices such as LEDs however, so is it possible to connect to the I/O necessary for industrial environments?

Raspberry Pi GPIO source: CWBudde [CC BY-SA4.0 (https://creativecommons.org/licenses/by-sa/4.0)]

What are industrial sensors?

The type of sensors you’ll need to connect to your Pi will depend on the particular job your prototype is designed to perform. In manufacturing, the most common processes are concerned with monitoring and control, for example:

  • Temperature: Both contact and contactless sensors can be used to measure temperature.
  • Photoelectric: Ideal for counting specific objects using light or lasers.
  • Button and Switches: Simple human inputs used to control the functioning of a system.
  • Dial: Simple human input providing analogue/continuous control of a signal over a range of values.
  • Pressure: Useful for detecting blockages, and signalling when a system needs servicing.
  • Vibration: Often the first sign of a problem, sensors that detect changes in vibration are great for predictive maintenance.
  • RFID: Used to track and/or locate devices, personnel, and/or equipment.
  • Inductive: The typical automation sensor, it alerts to the presence of metal.
  • Power Consumption: Key to understanding energy usage, also a useful signal for predictive maintenance

Industrial Thermal Sensor  Source: [CC BY 4.0 (https://creativecommons.org/licenses/by/4.0)]

Industrial sensors typically require 12-24V power and signal changes using the same voltage. Raspberry Pi’s GPIO input circuitry can be driven to either 3.3V (high) or 0V (low). This means that whilst a 12V water flow sensor might initially work hooked up straight to a Raspberry Pi, in long-term projects the incompatibility of the currents will almost certainly cause problems.

Does this mean your Pi can’t be connected to industrial sensors beyond a prototype?

Connecting a sensor to Raspberry Pi directly often means stripping the sensors wiring and soldering the cable to the correct GPIO pin. The 12 or 24V of an industrial sensor will then be driven straight to the Pi with nothing in the way to protect Pi internal circuitry including the processor. By adding extra circuitry as a buffer between the input pin and the Pi, it is possible to extend the processor’s source/ sink current capabilities, and prevent excessive power dissipation in the chip.

Breadboards

Breadboards are solderless circuit boards that can house even the most complex circuits, making them an invaluable option for prototyping. The impermanence afforded by the boards allows you to build and test multiple circuits without the need to constantly solder rewired connections. In this way, breadboards are great for testing new parts, integrated circuits and for troubleshooting.

Complex Breadboard Circuitry

Some circuits will require a considerable amount of space, another feature of breadboards that makes them useful tools in industrial prototyping is the ability to extend the surface size by connecting multiples together.

Breadboards and the factory floor

While breadboards can go a long way in adapting Raspberry Pi for industrial applications, certain considerations may be prohibitive to deploying such a prototype directly to a factory environment. The completed set-up is undeniably still a prototype; the connections, whilst providing industrial I/O options, are not optimised for the rigours of the factory floor.

Raspberry Pi Prototype with Added Breadboard Circuitry Source: Jacek Rużyczka [CC BY-SA 4.0 (https://creativecommons.org/licenses/by-sa/4.0)]

Industrial Pi

Brainboxes BB-400 is a smart industrialcontroller that is based around a Raspberry Pi compute module 3+ and allows prototypes to be deployed straight into industrial environments. Rather than adding protection to the GPIO using a breadboard and external circuitry, with the BB-400, sensors and actuators are not wired directly to the Pi, rather electronics between the input pin and the chip do the work which prevents industrial voltages damaging the Pi.

Never Lose a Configuration with Removable Terminal Blocks

Using a screwdriver to connect sensors’ wires/cables into the embedded terminal blocks means that the circuitry doesn’t require soldering to create strong and secure connections, and allows multiple reconfigurations. As the terminal blocks can be unplugged, it’s easy to take the module out without affecting any of the pre-wired terminals. As a single misplaced component leg can cause the whole circuit to malfunction or even cease to function at all, another useful feature of the terminal blocks is their numbering. It’s a lot easier to decipher the correct connection when the need to count down a row of tiny header pins and judge has been eliminated!

The BB-400 has 8 digital I/O connections, making it usable straight out of the box without the need for any add-on units, although there are a variety available if you do find you need more inputs and outputs. As it is packaged in a DIN rail enclosure, it’s the perfect solution for deploying a Raspberry Pi prototype straight onto the factory floor.