The Pi Hut Building Automation Card for Raspberry Pi User Guide
- June 9, 2024
- The Pi Hut
Table of Contents
- GENERAL DESCRIPTION
- FEATURES
- WHAT IS IN YOUR KIT
- QUICK START-UP GUIDE
- BOARD LAYOUT
- STACK LEVEL JUMPERS
- INPUT SELECTION JUMPERS
- RS-485/MODBUS COMMUNICATION
- RASPBERRY PI HEADER
- POWER REQUIREMENTS
- UNIVERSAL INPUTS
- HARDWARE WATCHDOG
- ANALOG INPUTS/OUTPUTS CALIBRATION
- HARDWARE SPECIFICATIONS
- LINEARITY OVER FULL SCALE
- MECHANICAL SPECIFICATIONS
- SOFTWARE SETUP
- References
- Read User Manual Online (PDF format)
- Download This Manual (PDF format)
BUILDING AUTOMATION Card for RASPBERRY Pi
USER’S GUIDE VERSION 4.1
SequentMicrosystems.com
GENERAL DESCRIPTION
The second generation of our Building Automation Card brings to the Raspberry
Pi platform all the inputs and outputs required for Building Automation
Systems. Stackable to 8 levels, the card works with all Raspberry Pi
versions, from Zero to 4.
Two of the Raspberry Pi’s GPIO pins are used for I2C communication. Another
pin is allocated for the interrupt handler, leaving 23 GPIO pins available for
the user.
Eight universal inputs, individually selectable, let you read 0-10V signals,
count contact closures, or measure temperatures using 1K or 10K thermistors.
Four 0-10V programmable outputs can control light dimmers or other industrial
devices. Four 24VAC triac outputs can control AC relays or heating and cooling
equipment. LED indicators show status of all outputs. An RS485/MODBUS port
permit almost unlimited expandability. Last but not least, a new 1-WIRE port
can be used to read the temperature from DS18B20 sensor.
TVS diodes on all inputs protect the card for external ESD. Onboard resettable
fuse protects it from accidental shorts. Single 24V AC or DC power source can
supply 5V/3A for Raspberry Pi.
FEATURES
- Eight jumper settable universal, analog/digital inputs
- 0-10V Inputs or
- Contact Closure Counter Inputs or
- 1K/10K Temperature Sensor Inputs
- Four 0-10V Outputs
- Four TRIAC Outputs with 1A/48VAC drivers
- Four General Purpose LED’s
- RS485/MODBUS port
- Real time clock with battery backup
- On-board push-button
- 1-WIRE interface
- TVS protection on all inputs
- On-board Hardware Watchdog
- 24VAC/DC power supply
All inputs and output use pluggable connectors which permit easy wiring access
when multiple cards are stacked. Up to eight Building Automation Cards can be
stacked on top of one Raspberry Pi. The cards share a serial I2C bus using
only two of the Raspberry Pi’s GPIO pins to manage all eight cards.
The four general purpose LED’s can be associated with the analog inputs or
other controlled processes.
An on-board push button can be programmed to cut inputs, override outputs or
shut down the Raspberry Pi.
WHAT IS IN YOUR KIT
-
Building Automation Card for Raspberry Pi
-
Mounting hardware a. Four M2.5x18mm male-female brass standoffs
b. Four M2.5x5mm brass screws
c. Four M2.5 brass nuts -
Two jumpers. You do not need the jumpers when using only one Building Automation Card. See STACK LEVEL JUMPERS section if you plan to use multiple cards.
-
All the required female mating connectors.
QUICK START-UP GUIDE
-
Plug your Building Automation Card on top of your Raspberry Pi and power up the system.
-
Enable I2C communication on Raspberry Pi using raspi-config.
-
Install the software from github.com:
a. ~$ git clone https://github.com/SequentMicrosystems/megabas-rpi.git
b. ~$ cd /home/pi/megabas-rpi
c. ~/megabas-rpi$ sudo make install -
~/megabas-rpi$ megabas
The program will respond with a list of available commands.
BOARD LAYOUT
Four General Purpose LEDs can be controlled in software. The LEDs can be activated to show the status of any input, output or external process.
STACK LEVEL JUMPERS
The left three position of the connector J3 are used to select the stack level of the card:
INPUT SELECTION JUMPERS
The eight universal inputs can be individually jumper selected to read 0-10V, 1K or 10K thermistors or contact closure/event counters. The maximum frequency of event counters is 100 Hz.
RS-485/MODBUS COMMUNICATION
The Building Automation Card contains a standard RS485 transceiver which can be accessed both by the local processor and by Raspberry Pi. The desired configuration is set from three bypass jumpers on configuration connector J3.
If jumpers are installed, Raspberry Pi can communicate with any device with an
RS485 interface. In this configuration the Building Automation Card is a
passive bridge which implements only the hardware levels required by the
RS485 protocol. To use this configuration, you need to tell the local
processor to release control of the RS485 bus:
~$ megabas [0] wcfgmb 0 0 0 0
If jumpers are removed, the card operates as MODBUS slave and implements the
MODBUS RTU protocol. Any MODBUS master can access all the card’s inputs, and
set all the outputs using standard MODBUS commands. A detailed list of
commands implemented can be found on GitHub:
https://github.com/SequentMicrosystems/megabas-rpi/blob/master/Modbus.md
In both configurations the local processor needs to be programmed to release
(jumpers installed) or control (jumpers removed) the RS485 signals. See the
command line online help for further information.
RASPBERRY PI HEADER
POWER REQUIREMENTS
The Building Automation Card requires an external 24VDC/AC regulated power supply. Power is supplied to the board through the dedicated connector in the upper right corner (see BOARD LAYOUT). The boards accepts either DC or AC power source. If a DC power source is used, polarity is not important. A local 5V regulator supplies up to 3A power to Raspberry Pi, and a 3.3V regulator powers the digital circuits. Isolated DC-DC converters are used to power the relays.
WE RECOMMEND USING ONLY THE 24VDC/AC POWER SUPPLY
TO POWER THE RASPBERRY PI CARD
If multiple Building Automation Cards are stacked on top of each other, we
recommend using a single 24VDC/AC power supply to power all the cards. The
user must split the cable and run the wires to each card.
POWER CONSUMPTION:
• 50 mA @ +24V
UNIVERSAL INPUTS
The Building Automation Card has eight universal inputs which can be jumper selected to measure 010V signals, 1K or 10K thermistors or contact closure/event counters up to 100Hz.
EVENT COUNTER/CONTACT CLOSURE CONFIGURATION
TEMPERATURE MEASUREMENT CONFIGURATION WITH 1K THERMISTORS
TEMPERATURE MEASUREMENT CONFIGURATION WITH 10K THERMISTORS
0-10V OUTPUTS CONFIGURATION. MAX LOAD = 10mA
HARDWARE WATCHDOG
The Building Automation Card contains a built-in hardware watchdog which will
guarantee that your mission-critical project will continue running even if
Raspberry Pi software hangs up. After power up the watchdog is disabled, and
becomes active after it receives the first reset.
The default timeout is 120 seconds. Once activated, if it does not receive a
reset from Raspberry Pi within 2 minutes, the watchdog cuts the power and
restores it after 10 seconds.
Raspberry Pi needs to issue a reset command on the I2C port before the timer
on the watchdog expires.
The timer period after power up and the active timer period can be set from
the command line. The number of resets is stored in flash and can be accessed
or cleared from the command line. All the watchdog commands are described by
the online help function.
ANALOG INPUTS/OUTPUTS CALIBRATION
All the analog inputs and outputs are calibrated at the factory, but firmware
commands permit the user to re-calibrate the board, or to calibrate it to
better precision. All inputs and outputs are calibrated in two points; select
the two points as close to possible to the two ends of scale. To calibrate the
inputs, the user must provide analog signals. (Example: to calibrate 0-10V
inputs, the user must provide a 10V adjustable power supply). To calibrate the
outputs, the user must issue a command to set the output to a desired value,
measure the result and issue the calibration command to store the value.
The values are stored in flash and the input curve is assumed to be linear. If
a mistake is made during calibration by typing the wrong command, a RESET
command can be used to reset all the channels in the corresponding group to
factory values. After RESET calibration can be restarted.
The board can be calibrated without a source of analog signals, by calibrating
first the outputs and then routing the calibrated outputs to corresponding
inputs. The following commands are available for calibration:
CALIBRATE 0-10V INPUTS: | megabas |
---|---|
RESET CALIBRATION OF 0-10V INPUTS: | megabas |
CALIBRATE 10K INPUTS: | megabas |
RESET 10K INPUTS: | megabas |
CALIBRATE 0-10V OUTPUTS: | megabas |
STORE CALIBRATED VALUE IN FLASH: | megabas |
HARDWARE SPECIFICATIONS
ON BOARD RESETTABLE FUSE: 1A
0-10V INPUTS:
• Maximum Input Voltage: | 12V |
---|---|
• Input Impedance: | 20KΩ |
• Resolution: | 12 bits |
• Sample rate: | tbd |
CONTAC CLOSURE INPUTS
- Maximum count frequency: 100 Hz
0-10V OUTPUTS:
- Minimum Output Load: 1KΩ
- Resolution: 13 BITS
TRIAC OUTPUTS:
- Maximum Output Current: 1A
- Maximum Output Voltage: 120V
LINEARITY OVER FULL SCALE
Analog inputs are processed using 12 bit A/D converters internal to the on-
board processor. The inputs are sampled at 675 Hz.
Analog outputs are PWM synthesized using 16 bit timers. PWM values range from
0 to 4,800.
All inputs and outputs are calibrated at test time at the end points and
values are stored in flash.
After calibration we checked the linearity over full scale and obtained the
following results:
Channel | Max Error | % |
---|---|---|
0-10V IN | 15μV | 0.15% |
0-10V OUT | 10μV | 0.10% |
MECHANICAL SPECIFICATIONS
SOFTWARE SETUP
- Have your Raspberry Pi ready with the latest OS.
- Enable I2C communication: ~$ sudo raspi-config
1. Change User Password| Change password for default user
---|---
2. Network Options| Configure network settings
3. Boot Options| Configure options for start-up
4. Localisation Options| Set up language and regional settings to match..
5. Interfacing Options| Configure connections to peripherals
6. Overclock| Configure overclocking for your Pi
7. Advanced Options| Configure advanced settings
8. Update| Update this tool to the latest version
9. About raspi-config| Information about this configuration
P1| Camera| Enable/Disable connection to the Raspberry Pi Camera
---|---|---
P2| SSH| Enable/Disable remote command line access to your Pi
P3| VNC| Enable/Disable graphical remote access to your Pi using…
P4| SPI| Enable/Disable automatic loading of SPI kernel module
P5| I2C| Enable/Disable automatic loading of I2C kernel module
P6| Serial| Enable/Disable shell and kernel messages to the serial port
P7| 1-Wire| Enable/Disable one-wire interface
P8| Remote GPIO| Enable/Disable remote access to GPIO pins - Install the megabas software from github.com: ~$ git clone https://github.com/SequentMicrosystems/megabas-rpi.git
- ~$ cd /home/pi/megabas-rpi
- ~/megaioind-rpi$ sudo make install
- ~/megaioind-rpi$ megabas
The program will respond with a list of available commands.
Type “megabas -h” for online help.
After installing the software, you can update it to the latest version with
the commands:
~$ cd /home/pi/megabas-rpi
~/megabas-rpi$ git pull
~/megabas-rpi$ sudo make install
References
- GitHub: Let’s build from here · GitHub
- Home, Industrial & Building Automation I/O HATS for Raspberry Pi
- GitHub - SequentMicrosystems/megabas-rpi: Command Line, Python lib, Node-Red and CODESYS driver for Building Automation Card