Microsoft MakeCode

Capacitive Touch Sensing

Hello, this is our first year using version 2 microbits. We are using the capacitive touch feature to build paper pianos with copper tape.

When using Alligator clips directly to the MB, everything works fine…had to make sure good separation between pieces of copper tape. But when I plug the MB into a header board, it acts as if the pins are being touched all the time.

It the capacitive touch that sensitive? Why would it act differently when plugged into a header board?


1 Like

Try this: I find on V1 that sometimes output from LED array “bleeds” into the pins so adding the LED off block has helped in those cases. Just a hunch.

@MrHM There may be a quick way to test my “avoid side-by-side” theory I shared above. Look at your breadboard to see if P0, P1, and P2 are side-by-side. For example, if P1 is in the middle, just remove those blocks from your code and test it out with just P0 and P2. (And if that works, maybe use P0, P2, P4, etc.)


@MrHM Due to their construction, breadboards can have a lot more “capacitance” themselves than a bare, isolated wire would.

Here are a two resources that may provide some insight:

(Disclaimer: This isn’t an area I know much about…The following is speculation based on the above) The video shows that capacitance added can be 2-25pF (a lot more than a simple wire that’s short/straight/isolated). The added capacitance depends on how the breadboard is used — using two side-by-side columns has higher capacitance than separating them. Longer strips (like the power rails) will have more capacitance than shorter strips (columns). The nRF article shows that the micro:bit will be charging/discharging capacitors to measure touch and detection depends on how long it takes to charge/discharge…I’d expect a large change in the overall amount of capacitance to have a large impact on how (or if) it works.

One suggestion: Try to avoid the use of side-by-side pins on the micro:bit (maybe use every other pin). This would reduce the capacitance added by the breadboard. If you try this, let us know what you find!


P.S. Other resources that may be worth looking at:

1 Like

Thank you for all the help. It is interesting behavior. The breadboards didn’t work with capacitance at all. Unfortunate for more complex projects. Even with alligator clips connected to copper tape on paper, we had inconsistent and strange behavior. I have video, but it shows if the MB and paper are laying on the Formica based desktop, the pins would act as touched. Pick the MB off the table or the paper, the system would behave normally allowing us to touch the copper tape. Table top conductivity?

Many students reverted to resistive touch mode with way more stable results. Something to toy with during summer break.

Thanks Again

I would like to mention that lots of capacitive touch devices and libraries will only calibrate when it is first turned on. Idk if the micro:bit does this but you might want to try to clip everything together and cycle power to see if that improves it.

(Would like to also mention that I’m just guessing from experience)