Raspberry Pi Mega-IO Expansion Card

Eight on-board relays, 8 12-bit ADC channels,12-bit DAC output, 8 opto-isolated inputs, 4 open collector outputs, 6 GPIO’s, stackable.

Home Automation 101

This project started with the challenge to integrate as many Home Automation functions as possible into a Raspberry Pi platform. The requirements were rather simple technically, but challenging due to the sheer number of I/O’s required:

  • Eight relays for zone heating.
  • Eight relays for zone cooling.
  • Eight relays for irrigation.
  • Eight analog inputs for measuring zone temperatures
  • Eight analog inputs for measuring soil humidity
  • Eight digital inputs for presence detectors
  • Sixteen digital inputs for security sensors

An off the shelf solution was possible, but required too many components:

Off-the-shelf possible solution
Off-the-shelf possible solution

The cost was not the main concern, but the implementation. The first prototype used to develop the software resembled a small jungle.

Raspberry Pi in the lower left corner, two USB IO cards from eBay, two 16 relay boards from eBay also. Needed to add ADC channels, but ran out of space. So the team has built the Mega-IO card.

Stack of three Mega-IO cards
Stack of three Mega-IO cards

The small tower gives all the relays needed, and more than enough analog and digital channels. It also leaves the Raspberry Pi connector available for another card, if we ever need one.

Technically, the Mega-IO card is not a HAT, because it’s form factor is too big – it occupies all the real estate on top of the Pi. In all other aspects is HAT-compliant, so they call it an X-HAT (eXpanded HAT).

They have developed a command line utility which accesses all the IO functions, available for download HERE.

The easiest way to develop browser software for the Mega-IO card is using the Node Red, a drag and drop visual tool which runs on the Raspberry Pi and can be used for wiring the internet of Things. Click HERE to download a Raspbian operating system image which includes Node-Red and the following examples for accessing Mega-IO functions.

(Alternately, you can download and install Node-Red yourself following the instructions at https://nodered.org/docs/hardware/raspberrypi )

1. Setting the D/A output

 project video thumbnail

PLAY

2. Testing the A/D input

In order to show the Analog to Digital input function, and implemented a heating and cooling thermostat.

Node-red workflow for heating and cooling thermostat
Node-red workflow for heating and cooling thermostat

The User Interface consists of a text input for setting the target temperature, an analog gauge for displaying the current temperature, a fan switch and an on off system switch.

Thermostat User Interface
Thermostat User Interface

A status box shows if the system is cooling, heating or on standby.

A thermistor connected to an analog input of the Mega-IO card is used to measure the ambient temperature. Relays are activated for controlling the fan and the heating and cooling functions.

Multiple thermostat can be implemented using a single Mega-IO card.

3. Reading optically isolated inputs

The workflow consists of an inject node which sends a periodical signal to a function node which in turn sends a command to the Mega-IO card.

Opto-inputs Workflow
Opto-inputs Workflow

The card response is parsed and displayed by text nodes.

Opto-inputs Dashboard
Opto-inputs Dashboard

4. Testing the Relays

The Relay Test workflow consist of Button Nodes for turning on and off a relay, and Numeric Nodes for selecting the card stack and the relay number.

Function Nodes are used for storing variables received from the Numeric Nodes and for passing the command line parameters to the Execution node, which in turn is passing the command line to Raspberry Pi.

A debug node is checking for error messages.

Relay Test Workflow
Relay Test Workflow

The User Interface has buttons for turning the relays on and off, and select boxes for the stack and relay number.

Relay Test Dashboard
Relay Test Dashboard

Source code download

D/A Output;   A/D Input;   Opto-Isolated Inputs;   Relays;

Mega-IO Website
Mega-IO Website

 IO SPECIFICATIONS

MICROCONTROLLER: STM8L151C3T6
SIX GPIO pins :
  • Operating voltage: 3.3V
  • CPU frequency: 16 MHz
  • Touch sensing capability
  • Max. input voltage on any pin: 4V
  • Series protection resistor on IO pins: 51 Ohms
  • Output Low Level Voltage on I/O pins: Max. 0.45V
  • Output High Level Voltage on I/O pins: Min. 2.6V

FOUR OPEN COLLECTOR OUTPUTS:

  • Driver: ULN2003F12FN-7
  • Output Low Voltage: 0.6V
  • Max Pull Up Voltage: 20V
  • Max sink per channel: 100mA @ 3.3V Logic Input
  •                                     140mA @ 5.0V Logic Input
  • ESD: 4kV HBM, 1kV CDM

EIGHT 12 bit ADC

  • Sample rate: Up to 1 Msps
  • Input low pass filter: 0.22µF/51 Ohms

OPTOISOLATORS: TLP293-4

  • LED current limit resistor: 1 Kohm
  • Input Forward Current: Typ. 5 mA, Max 50 mA
  • Input Reverse Voltage: 5V
  • Input Forward Voltage: 1.25V @ 10 mA
  • Isolation Resistance: Min 10 exp(12) Ohms
  • Isolation Voltage: Typ 10,000 V

RELAYS: SRD-05VDC-SL-C

  • Relay max current/voltage: 10A/25V
  • PCB max current/voltage: 2.5A/24V

282 thoughts on “Raspberry Pi Mega-IO Expansion Card

  1. You actually make it appear so easy with your presentation but I in finding this topic to be really one thing that I think I might never understand. It seems too complicated and very huge for me. I am looking ahead to your next post, I will attempt to get the hold of it!

    Like

  2. I’ll right away snatch your rss feed as I can not in finding your e-mail subscription hyperlink or e-newsletter service. Do you’ve any? Kindly let me know in order that I could subscribe. Thanks.

    Like

  3. Pingback: Google
  4. I’m not that much of a internet reader to be honest but your blogs really nice,
    keep it up! I’ll go ahead and bookmark your website to
    come back later. All the best

    Like

  5. An individual necessarily lend a hand to help make significantly posts I might state. This really is the first time I frequented your web page and to this particular point? I amazed using the analysis you made to make this actual submit extraordinary. Magnificent task!

    Like

  6. I don’t have any idea the way i finished up here, having said that i thought this post was good. I don’t know who you really are but definitely you are attending a famous blogger if you aren’t already 😉 Cheers!

    Like

  7. I simply want to say I’m newbie to blogging and absolutely loved your web page. Most likely I’m planning to bookmark your site . You amazingly have awesome article content. Thanks for sharing with us your webpage.

    Like

  8. Excellent goods by you, man. I’ve understand your stuff previous to and you are just extremely wonderful. I actually like what you’ve acquired here, really like what you’re stating and how for which you say it. You will be making it enjoyable and you still take care of to help keep it sensible. I simply cannot wait to learn a lot more on your part. This is certainly really a great site.

    Like

  9. I’m curious to determine what blog system you have been using? I’m experiencing some minor security issues with my latest website and I’d like to find something more safe. Are you experiencing any recommendations?

    Like

  10. whoah this blog is magnificent i like studying your articles. Stay up the good work! You understand, a lot of people are looking around for this info, you could help them greatly.

    Like

Leave a comment

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