Power Considerations for Pi in Industry
Raspberry Pi is powered by a very specific +5.1V and 2.5Amps supply. In its desktop configuration this requirement is easily met by using any micro USB charger that will provide the exact voltage, though the official Raspberry Pi power supply is recommended.
Like most USB power supplies, the official Raspberry Pi PSU is only designed for an office environment and has an operating temperature of 0 – 40∘ C. In industrial environments where conditions are, as
standard, more extreme than the typical office setup, devices are designed to be more robust, and this tends to make industrial power supplies more complex. The majority of factories with industrial control applications have power supplies of 12 VDC or 24 VDC.
How important is matching the power supply to Pi?
The water analogy so widely used to explain the basics of electricity is effective here in understanding the necessity of matching the power input requirements of a device. If voltage is like water pressure, imagine the flow of electricity to a Pi prototype in terms of water in bathroom pipes.
Too little water pressure and things won’t function; too much flowing into a toilet and there’s going to be water on the ceiling. If the power input to Pi is even a few volts over the +5.1V requirement, you risk the stability of operations. Load a substantially higher input (anywhere approaching the 24V typical factory supply) and the board is likely to be damaged or even explode.
Under certain circumstances, the Raspberry Pi firmware will display a warning icon on the display, to indicate an issue.
Can Pi Survive Power Loss?
Abruptly stopping the power supply to Pi, as with any computer, can cause issues with memory corruption. The Pi Foundation advise issuing sudo halt or sudo shutdown commands before pulling the power to ensure any file transactions that are being written to the SD card are completed, the operating system is stopped and the card is no longer active when the Pi loses power.
As with any device with an operating system and memory, if power is interrupted without the chance to issue the recommended shutdown procedure, the system is at substantial risk of file system corruption. The Pi has a very limited amount of electrical inertia – energy stored in the capacitors – so if the supply drops, the system will lose power rapidly. In industrial environments where applications can be complex and expensive, this can be disastrous when combined with the vulnerability of the SD card.
When power is restored
Restoring power to an electrical device that has previously lost power is rarely clean, and if Pi’s Operating System was in the middle of processes when it was stopped abruptly, the resultant corruption can also cause problems when the power comes back on. As the load is restored; utility picks up and processes restart causing surges and spikes that can damage the SD card and prevent your Pi from booting up.
The ‘rainbow’ screen shown above is actually four pixels blown up to full screen size, and flashes up as a test of the GPU every time the firmware start.elf is loaded. In a functioning Pi, the coloured splash screen is replaced by linux console a second later, so if the screen freezes after restoring power, it suggests the system is failing to boot the kernel.img file from an at least partially corrupted SD card.
Can Pi Power Up for Industry?
Though power considerations are relevant to all devices in all applications, electronic prototypes have to meet certain specs to prove their suitability for industrial environments. Fortunately, there are a wealth of options for adapting Raspberry Pi that can take the versatile board from desk to factory.
SD card corruption is caused by power failure occurring as the system is writing to the card, leaving the filesystem in an invalid state. It’s worth noting that although your application might not write data itself; the SD card is not automatically safe from corruption as the operating system is constantly writing temporary files, log files, and cache files, amongst others. Whilst power interruptions can never be completely prevented, one way to make Pi more robust is to limit or stop the amount of writing being done to the SD card. Forcing the installation into read-only mode safeguards against memory corruption, and significantly prolongs the lifespan of the SD card.
Installing a read-only operating system on the Pi does have downsides however:
- With no persistent system log, if something goes wrong, debugging can be difficult.
- It is not possible to persist state from one boot to the next, although this can be worked around by periodically mounting a second drive via a USB stick.
- With no swap partition, if you run out of memory the likely result is the system will crash.
Uninterruptible Power Supply
An Uninterruptible Power Supply (UPS) is additional equipment that continues to provide power to a device during power interruptions. A UPS system is particularly useful when deploying a Pi prototype into an industrial environment where shutting down systems cleanly is not at the forefront of the mind. In a factory where a common attempted fix for a malfunctioning machine might be to pull the power rather than diagnose the root cause, the resulting corruption issues can cause expensive downtime.
Hardware Attached on Top (or HATs) add specific functionality to Pi, and the options are vast. Dedicated UPS HATs can offer power back-up stability, ensuring Pi will continue to function during any power instability or loss. The advantage of using a UPS HAT is that they are relatively inexpensive and do not need to be permanently soldered to the device. Unfortunately, the addition of a UPS HAT makes it difficult to situate Pi inside a protective case, particularly alongside the further add-ons necessary to industrialise Pi, such as fans, RTC (real time clock) HATs, Industrial IO850 etc.
Supply room UPS, both stand-alone and DIN rail options, can also provide back-up power for Pi prototypes without the need for direct HATs, but these systems can be expensive and servicing can cause unnecessary disruption to your comms room.
Brainboxes Industrialised Pi, the BB-400 Edge Controller, has a power management unit to monitor and control incoming power to the device and ensure optimum functioning of internal electronics.
Where Pi is powered by +5.1V only, most factories run on power supplies of 12 VDC or 24 VDC. The BB-400 has an input range of 5-30 VDC so can take a Pi prototype straight into an industrial setting.
The power input allows for 2 separate power supplies to be connected at once – a dual redundant supply, meaning that if one power supply fails, the other will take over straight away. There is also a built-in UPS system, using on board super capacitors, which offers clean shutdown if power is interrupted, and an onboard log to document exactly when power failure occurred.
- Wide Voltage Input
- Dual Redundant Supply
- Built in UPS