Electronza
Published in

Electronza

Xpress demo board: stacking click boards

The Microchip Xpress demo board is great for beginners, its cheap, and it can be easily expanded using the provided mikroBUS socket: there are over 200 click boards available, from temperature to distance sensors, and everything in-between.

However, after using the single mikroBUS socket of the MPLAB Xpress board (DM164140) for some time, you’ll find yourself wanting more. And there’s an easy way to expand the Xpress board and to create projects of increased complexity: stacking click boards. And this is the purpose of this blog post: to show what can be done and what are the limits when we try to stack click boards.

First of all, we have to establish the order of the click boards in the stack. Some particular boards must stay on top: distance sensors such as Proximity click, Proximity click 2, IR distance click, Motion click and Line follower click boards must have their line of sight unobstructed. Ultraviolet and visible light sensors such as the color click, color 2 click and ambient click also need a clear view to work. Displays must be placed on top too — from the OLED C click to 7-Seg click and everything in-between. Furthermore, input devices also have to be placed in the uppermost position — think of Rotary click boards or the 4×4 keyboard, only to name a few.

Second, there must be enough clearance so the click boards don’t touch. Some boards are taller: click boards such as Relay click, RTC 2 click or OSD click have components that can touch the board placed on top of them — nasty short circuits can happen, damaging the click boards. Using longer header pins on the board on top can provide an easy fix to this issue.

And finally, on the click boards that come in the middle one must replace the header pins that come now as standard with stacking header pins. The same 8-pin stacking header that is used by Arduino shields works fine here (I used PRT-09279 from Sparkfun).

As in many similar hacks, it turns out that desoldering is the difficult part here. One needs a decent soldering iron and a good solder sucker to remove the pins. Eventually, one can sacrifice the header pins and remove the pins one by one — you need the click board, not the header pins. Then the soldering of the stacking header is a child’s play.

As an alternative, one can skip the desoldering and soldering part and can place the click boards on a breadboard, with wires going from the click socket. It’s messy, but it works.

Even if the click board fit mechanically fine, this doesn’t mean that everything will work fine. Some board combinations work fine. Other times we have conflicting pins: the same pin is used by multiple click boards.

Stacking I2C click boards.

The winning combination. As the I2C bus is designed, there’s so easy to make a stack of click boards. The main issue to solve here relates to the pull-up resistors used. The Xpress board comes with 10kΩ pull-ups. Some click boards have 4.7kΩ pull-ups, other have 10kΩ pull-ups. In a big stack all these pull-up resistors come in parallel, so, in the end, we will have a strong pull-up.

The key here is that with a strong pull-up we need a higher current to pull down the SCL and SDA lines. Most sensors have an I OL of only 4mA, and this limits the minimum value of the pull-up resistor. You can find the exact formulas to determine the minimum and maximum values of the I2C pull-up resistors in the I2C Bus Pullup Resistor Calculation application note from Texas Instruments (also available here).

In the example in the above paper, the minimum value of the pull-up resistor is a bit below 1kΩ for Vcc = 3.3V and a low-level output voltage of 0.4V. Of course, one must redo the calculations if the V cc and V OL values are way different than those in the example. In practice, many of the I2C sensors on the click boards will work with the 1kΩ pull-up value.

Now, let’s consider the following stack: MPLAB Xpress board, Weather click and UV2 click. The Xpress board has 10kΩ pull-ups, and both the Weather and UV2 click boards have 4.7kΩ pull-ups. Will this combination work?

So, first we determine the actual value of the pull-up:

thus a value of:

So, it will work just fine. I might add one more click board and it will still work!

Mind the interrupts!!!

Some click boards have interrupt pins besides the usual SDA and SCL lines: for example, the Altitude click has two interrupt pins, corresponding to INT and CS lines in the mikroBUS socket. One must either disable the interrupts in software or avoid the use of the interrupt pins at all.

Stacking SPI click boards

Well, that’s the big no-no. All the click boards using SPI communication need the CS pin, and that pin is the same position for all the click boards using SPI communication. So, one can use only one SPI click board in the stack.

The only way to use two SPI click boards is to place one click board in the mikroBUS socket and the second click board on a breadboard, routing the CS pin of the second click board to an unused microcontroller pin.

SPI and I2C click boards

As long as there are no pin conflicts, one can use one SPI click board and a stack of click boards that use I2C communication. As an example, the GSM2 click uses almost all pins but SDA and SCL — it can be used with an I2C click board that has no interrupt pins, such as the SHT1x Click. In the picture in this blog post you can see one of the possible I2C and SPI combinations: a thermometer/humidity meter made with one SHT1x click and OLED W click.

Serial communication boards

Only one board using serial communication can be used in a stack. It can be combined with SPI and I2C click boards as long as there are no conflicting pins.

As an example I would give the GSM3 click which uses the RX, TX pins plus AN, RST, PWM, CS — this click board can be combined with an I2C click board that uses only the SDA and SCL pins.

The WiFi3 click uses RX, TX, AN and RST pins, It will work fine for example with the Weather click to make an Internet-enabled weather station.

If you live in Europe, LoRa click uses RX, TX, RST and INT pins. It can also work fine with the Weather click. However, if you live in US, Canada, Australia or New Zealand you have to rely on the LoRa2 click, which uses RX, TX, RST, INT plus the CS pin. You can’t use it with SPI click boards, but it will work fine with the above weather click.

The 3.3V version of the RS-485 click uses only the RX and TX lines — it will work will almost all other click boards.

Relays

There are two relay click boards, one using the PWM and CS pins, the other using the AN and PWM pins. As long there are no pin conflicts you can use them in a stack — combine them with an SHT click to make a room thermostat, for example.

Motion sensor click

This one uses RST and INT pins. It can be combined with the relay click boards. You can combine the motion sensor with an RS-485 click in a motion controlled DMX lighting project.

Bottom line

Stacking click boards can provide a relatively easy way to expand the use of the MPLAB Xpress board, allowing us to create complex projects, while still keeping a low cost of implementation.

While I have written this post initially with the Xpress board in mind, there are other boards that can benefit from click stacking — everything from the Microchip Curiosity up to the MikroElektronika clicker boards or even the Arduino Uno plus Arduino Uno click shield.

There are over 200 click boards at this moment, so I can’t think of all possible combinations. In this blog post I gave some ideas on how to combine click boards, but I’m also curious to know what others have done. So, if you have a working project made by stacking click boards — please share it in the comments section.

Originally published at https://electronza.com on August 30, 2016. Moved to Medium on May 2, 2020.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store