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.

# Mechanical issues

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.

# Electrical issues

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 IOL 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 Vcc and VOL 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.

1 2
Share.

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

error: