1 February 2020

What an eventful week…

After last week’s problems with the Arduino Pro Micro boards we decided to try reverting to an Arduino Leonardo board. The Leonardo worked well for prototyping but the female headers on the board made it hard to create a board with permanent, soldered connections. So we ordered and received a Leonardo without headers. On paper, this was a great idea. In practice, we soon realised that while we could solder header pins on 1 side without problems, on the other side of the board, the 2 blocks of headers are separated by a gap 1.5 times the width of a 2.54 mm pitch. So if we soldered male headers on the Leonardo board, we could not plug it into female headers on one of our boards. Rather annoying indeed.

So the Arduino Leonardo went back and we ordered an Arduino Micro board to replace it. We had no problem soldering male headers on the Micro. This gave us a reliable (and genuine) Arduino board to control our gliders and solved 1 of our 2 problems.

We still had to find a solution to our lack of pins and interrupts. After some research, we decided to try using an MCP23017 I2C I/O expander. Some of us had experience of using one for another project and it looked like we could make it work. The MCP23017 offers 16 I/O pins split into 2 banks of 8. Each bank of 8 pins has an associated Interrupt pin. The 2 pins can be configured to be logically OR’d thus giving us a single interrupt pin (connected to the Micro’s in #7 with an interrupt handler) for 16 actual I/O pins. On paper, at least, this would be brilliant. So we re-drew our schematics to take the new chip into account while we waited for our delivery.

It then took a few hours to create a new board that would accommodate the Arduino Micro, an MCP23017, a 5.5mm power jack, our I2C devices and the connectors we needed.

Work in progress on our new board

We also spent time reworking our code to use the Adafruit MCP23017 library. This would allow us to make the most of the chip’s interrupt capability.

So on 1 February, we put it all together: new board, new Arduino board and updated software… it didn’t work. We re-read the datasheet, checked our connections (found a really well hidden short where a tiny bit of insulation had melted enough to create a tiny but effective short between 2 data wires), checked our voltages, wire continuity and everything we could think of. No change.

We decided to upload an I2C scanner sketch to try and find out what was happening. Our MCP23017 chip wasn’t visible. The other I2C devices were there but not the MCP chip. While we were ready to connect a logic level analyser to the circuit, we also re-read the datasheet. That’s when we spotted that the MCP’s reset pin is an active low pin. We had left the pin floating so we quickly wired the reset pin to our 5V rail on the board. The MCP chip magically appeared on our I2C scan. Problem solved!

We quickly soldered some buttons and switches on connectors so we could get started with our proper testing. Some of the switches worked but not others. We checked our code but that looked ok. We had enough reliability to do an end-to-end test. Our first proper test… Success!



1 February 2020