Not all capacitive touch pins working on CP Bluefruit

CircuitPython on hardware including Adafruit's boards, and CircuitPython libraries using Blinka on host computers.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
fruitystu
 
Posts: 9
Joined: Thu Jan 09, 2025 11:02 am

Not all capacitive touch pins working on CP Bluefruit

Post by fruitystu »

Hi,

I picked up a CircuitPlayground Bluefruit from PiHutUK but I'm having some trouble getting all the capacitive touch pins working.

I've followed the setup guide and updated the bootloader to the latest with the Arduino IDE and copied over the latest CircuitPython (9.2.1) uf2 file to configure it for CP mode and the python libraries.

Pin A1 works fine, but I can't get any readings from any of the other pins that take touch using either touchio or the CircuitPlayground libraries.

I've used the examples on the learn website

https://learn.adafruit.com/adafruit-cir ... -cap-touch
https://learn.adafruit.com/circuit-play ... on-version

as well as some very simple ones I wrote to get the raw_value.

Everything else I've tested on the board worked fine. I _think_ I'm using it correctly :)

Is there an issue with the latest code or do I have a faulty board somehow?

User avatar
danhalbert
 
Posts: 5228
Joined: Tue Aug 08, 2017 12:37 pm

Re: Not all capacitive touch pins working on CP Bluefruit

Post by danhalbert »

TouchIn does calibration when it starts up. If you are holding the board by the edges and touching pins, you will affect the calibration. Try just leaving it on the (non-conductive) table if you are holding it in your hand when it starts up.

If that's not the issue, you try some older versions? Try the last 8.x.x version first. Could be hardware or could be software. Is the CPB connected to anything?

User avatar
fruitystu
 
Posts: 9
Joined: Thu Jan 09, 2025 11:02 am

Re: Not all capacitive touch pins working on CP Bluefruit

Post by fruitystu »

Hi Dan,
Thanks for replying so quickly.

I have the CPB in an adafruit plastic enclosure. It's sitting on a wooden desk and the only connection is via a USB cable to my (PopOS) Linux PC. I'm not touching the pins with my fingers, only the enclosure.

I've now tried a few combinations of code:

Bootloader: 0.8.3, CircuitPython UF2: 8.2.10, CircuitPython library bundle: 8.x
Bootloader: 0.9.0, CircuitPython UF2: 8.2.10, CircuitPython library bundle: 8.x
Bootloader: 0.9.2, CircuitPython UF2: 8.2.10, CircuitPython library bundle: 8.x
Bootloader: 0.9.2, CircuitPython UF2: 9.0.5, CircuitPython library bundle: 8.x
Bootloader: 0.9.2, CircuitPython UF2: 9.0.5, CircuitPython library bundle: 9.x
Bootloader: 0.9.2, CircuitPython UF2: 9.1.5, CircuitPython library bundle: 9.x
Bootloader: 0.9.0, CircuitPython UF2: 9.2.1, CircuitPython library bundle: 9.x
Bootloader: 0.9.2, CircuitPython UF2: 9.2.1, CircuitPython library bundle: 9.x

but all gave the same results.

Here's my simple code:

Code: Select all

import time
import board
import touchio

touch_A1 = touchio.TouchIn(board.A1)
touch_A2 = touchio.TouchIn(board.A2)
touch_A3 = touchio.TouchIn(board.A3)
touch_A4 = touchio.TouchIn(board.A4)
touch_A5 = touchio.TouchIn(board.A5)
touch_A6 = touchio.TouchIn(board.A6)
touch_A7 = touchio.TouchIn(board.TX)

while True:
    value_A1 = touch_A1.raw_value
    value_A2 = touch_A2.raw_value
    value_A3 = touch_A3.raw_value
    value_A4 = touch_A4.raw_value
    value_A5 = touch_A5.raw_value
    value_A6 = touch_A6.raw_value
    value_A7 = touch_A7.raw_value
    print("A1:%f, A2:%f, A3:%f, A4:%f, A5:%f, A6:%f, A7:%f" % (value_A1, value_A2, value_A3, value_A4, value_A5, value_A6, value_A7))
    time.sleep(0.1)
In Mu's serial console I get (without touches):

A1:89.000000, A2:0.000000, A3:0.000000, A4:0.000000, A5:0.000000, A6:0.000000, A7:0.000000

touching A1 with a crocodile clip with my finger on it I get a higher raw_value

A1:1337.000000, A2:0.000000, A3:0.000000, A4:0.000000, A5:0.000000, A6:0.000000, A7:0.000000

Touching all the others the same way they stay at zero.

Thoughts?

User avatar
danhalbert
 
Posts: 5228
Joined: Tue Aug 08, 2017 12:37 pm

Re: Not all capacitive touch pins working on CP Bluefruit

Post by danhalbert »

I am not duplicating this. Could you take a clear closeup picture of the top of the board? I want to check for some parts.
By the way, the `.raw_value` values are integers, so you can use %d instead of %f.

User avatar
fruitystu
 
Posts: 9
Joined: Thu Jan 09, 2025 11:02 am

Re: Not all capacitive touch pins working on CP Bluefruit

Post by fruitystu »

Hi Dan,

Here's some photos of the front and back.
Attachments
IMG_20250110_083232.resized.jpg
IMG_20250110_083232.resized.jpg (142.69 KiB) Viewed 70 times
IMG_20250110_083344.resized.jpg
IMG_20250110_083344.resized.jpg (213.5 KiB) Viewed 70 times
IMG_20250110_083333.resized.jpg
IMG_20250110_083333.resized.jpg (234.72 KiB) Viewed 70 times

User avatar
danhalbert
 
Posts: 5228
Joined: Tue Aug 08, 2017 12:37 pm

Re: Not all capacitive touch pins working on CP Bluefruit

Post by danhalbert »

Did you test it again, when you took it out of the plastic case? Just touch your finger to, say, A2.
There are no missing parts that I see (there need to be resistors near each pin: they enable touch to work.

1. Could you confirm that the UF2 files you are using include "circuitplayground_bluefruit" as part of their name?

2. Could you test whether, say pin A2 is working at all? Do you have a voltmeter? Test the voltage between that pin and the GND pin. You can do this in the REPL:

Code: Select all

import digitalio, board
a2 = digitalio.DigitalInOut(board.A2)
a2.switch_to_output()
a2.value = True    # voltmeter should read about 3.3V
a2.value = False    # voltmeter should read 0V
3. The photograph makes it look some traces are exposed, and the blue solder mask is not covering all the trace.
For instance, here, it looks like copper is exposed near the A2 pin. Is that true or is that just the blue covering being shiny? On my boards, that's all covered with blue, but you can see the copper trace under the blue.
cpb.png
cpb.png (113.31 KiB) Viewed 66 times

User avatar
fruitystu
 
Posts: 9
Joined: Thu Jan 09, 2025 11:02 am

Re: Not all capacitive touch pins working on CP Bluefruit

Post by fruitystu »

Yes, I tested again when I took it out of the case and it still didn't work. I just retested it and nothing registering apart from on A1.

1. For CircuitPy I used

adafruit-circuitpython-circuitplayground_bluefruit-en_GB-8.2.10.uf2
adafruit-circuitpython-circuitplayground_bluefruit-en_GB-9.0.5.uf2
adafruit-circuitpython-circuitplayground_bluefruit-en_GB-9.1.4.uf2
adafruit-circuitpython-circuitplayground_bluefruit-en_GB-9.2.1.uf2

which I downloaded from the github page https://github.com/adafruit/circuitpython/releases

2. I do have a multimeter.

Between A1 and GND I get 3.28V
Between A2 and GND I get 2.95V
Between A3 and GND I get 2.88V
Between A4 and GND I get 2.43V
Between A5 and GND I get 2.98V
Between A6 and GND I get 3.13V
Between TX and GND I get 3.07V

ps - btw a2.switch_to_output needed the () on the end as it's a bound method

3. Yes, it does look like that in the image. It's the light shining off the ridge. It's difficult to take a picture without something being shiny. I had a good look and all the ridges (connects) are covered in blue.

User avatar
danhalbert
 
Posts: 5228
Joined: Tue Aug 08, 2017 12:37 pm

Re: Not all capacitive touch pins working on CP Bluefruit

Post by danhalbert »

Sorry about the typo. So you got about 3.3V on, say, A2 when doing `a2.value = True` and 0V when doing `a2.value = False` ?

User avatar
fruitystu
 
Posts: 9
Joined: Thu Jan 09, 2025 11:02 am

Re: Not all capacitive touch pins working on CP Bluefruit

Post by fruitystu »

Yes, sorry, I didn't realise you wanted the False reading as well. Here's A1 (which has working capacitive touch) and A2 which doesn't:

A1 value = True, output = 3.3 V
A1 value = False, output = 0 V

A2 value = True, output = 2.93 V
A2 value = False, output = 0 V

User avatar
danhalbert
 
Posts: 5228
Joined: Tue Aug 08, 2017 12:37 pm

Re: Not all capacitive touch pins working on CP Bluefruit

Post by danhalbert »

Thanks. I only have one more check. Next to each pin is a surface-mount resistor. See the A2 one below. They should all be marked "01E". Is that true? It's very small print -- I had to use the Magnifier app on my phone or my USB microscope to see them. That resistor is needed for TouchIn to work. If it's the wrong value, it won't work.
resistor.png
resistor.png (150.1 KiB) Viewed 42 times
If they are all "01E", then I am at a loss to explain this, and I only have a hardware fault left as an explanation. I'd suggest you ask PiHutUK for a replacement. You can tell them it was authorized by Adafruit. We can also replace it. If you still have the bag, we'd be interested in a picture of the label on the bag; it gives us the manufacturing batch number.

User avatar
fruitystu
 
Posts: 9
Joined: Thu Jan 09, 2025 11:02 am

Re: Not all capacitive touch pins working on CP Bluefruit

Post by fruitystu »

Hi Dan,

I've checked all the pins and they have a resistor with 01E on the top.

Sadly I didn't keep the bag it came in. Usually I do keep packaging, but as it looked like a regular bag it went out with the plastic recycling.

Sometimes these things happen. I'll message PiHut and try and get a replacement.

Thank you for all your help, you've been very patient. If nothing else it's been a learning experience trying to work out why it wasn't working :)

User avatar
danhalbert
 
Posts: 5228
Joined: Tue Aug 08, 2017 12:37 pm

Re: Not all capacitive touch pins working on CP Bluefruit

Post by danhalbert »

This is still bothering me. Would you be willing to take the time to try this example? Connect a crocodile-clip jumper between A1 and A2:

Code: Select all

import time
import digitalio
a1 = digitalio.DigitalInOut(board.A1)
a1.switch_to_output()
a2 = digitalio.DigitalInOut(board.A2)
while True:
    print("A1 output", a1.value, "A2 input", a2.value)
    a1.value = not a1.value
    time.sleep(1)
The previous testing with the voltmeter tested the output capabilities of the "bad" pins. But it did not test their input circuitry. The above program uses the "good" pin A1 as an output to drive a "bad" pin A2 as in put. The truth values should match. If "A2 input", does not change (stuck at True or False).

If this is true, then somehow the input circuitry got damaged. How this happened is another question. It might have happened if overvoltage was applied to the pins, though if, say, 5V were applied, they would not be damaged immediately. A static discharge might have caused the problem too. Did anything like this happen before you tested the TouchIn examples?

It still seems like a hardware problem.

User avatar
fruitystu
 
Posts: 9
Joined: Thu Jan 09, 2025 11:02 am

Re: Not all capacitive touch pins working on CP Bluefruit

Post by fruitystu »

Yes, of course.

I get the following output:

Code: Select all

A1 output True A2 input True
A1 output False A2 input False
(ps - you missed import board).

When I first got the CPB I was testing out the various parts with some of the example code from learn. I did try and setup the "moisture sensor" with A4 and it didn't work. I switched it to A1 and it worked ok. I'd only just started trying things out so thought maybe it was just me :)

I also noticed that when I took touchio readings using the same setup here https://learn.adafruit.com/soil-moistur ... s/overview using the A1 pin, I'd get raw_values and then occasionally a ValueError with the warning about adding a 1 Mohm resistor, which I'm guessing is what the 01E is.

User avatar
danhalbert
 
Posts: 5228
Joined: Tue Aug 08, 2017 12:37 pm

Re: Not all capacitive touch pins working on CP Bluefruit

Post by danhalbert »

Thanks - I am unable to come up with a hypothesis about this, other than some hardware failure on the microcontroller chip, so going back to PiHut still makes sense. The moisture sensor example you noted confirms the problem in another way.

User avatar
fruitystu
 
Posts: 9
Joined: Thu Jan 09, 2025 11:02 am

Re: Not all capacitive touch pins working on CP Bluefruit

Post by fruitystu »

Good news, I managed to find the bag the CPB came in.

It says on the bag:

P4333
Circuit Playground Bluefruit
http://adafru.it/4333
C13691-004
P4333D

Post Reply
Please be positive and constructive with your questions and comments.

Return to “Adafruit CircuitPython”