Tried the minimal cap sense setup on Pi with a 4 MΩ resistor and a copper sheet. Didn't yet produce any clear reading :-/ I guess I must find some precise timer to measure the delay. Or should I give up and use a microcontroller and/or a board like MPR121? Buy a cheap oscilloscope? Uh, what's the best next step.

· · Web · 4 · 0 · 2

@sciss I guess a dedicated board (no idea which one) is better, I remember trying (and failing to get anything useful) with arduino as well.

@sciss mpr121 definitely is worth it, for stability. The Teensy's capsense is also ok, but that's a microcontroller shift.

If you're in Brussels you can come and pick up one of my proximity switches ~~~

@wendy thank you; your project looks very cool! indeed I'm looking for continuous sensing at 10cm or farther proximity. It will be on top of ceramic, so instead of conductive fabric, I might try conductive paint or a mesh. I'll check out the MTCH101, hadn't heard about it. Now that I got a bit started with the Pi Pico, I'm thinking that it should be doable to implement more or less the same procedure that is used in the CapSense library.

@sciss it depends if you want to use a i2c touch board, with more cap touch ins.
The problem with cap touch is that you want the antenna to be as close to the conversion chip as possible.
This board is a bit like the mtch101 chip board.
You can attach another antenna as well.
I had to sew the chip really next to the conductive thread, what you will have to do with the ceramics as well. Or 'cheat' and use a strategically positioned vlox~~

@wendy I see. What are the issues when having a distance (wire) between the chip and the electrode? Distance between computer and electrode will be around 40-50 cm I guess. I will have around 8 to 12 electrodes, so the AT42QT1010 would be pricey, especially as I want to build more than one object. The direct or I2C solutions have the advantage that I can get continuous data as raw counts, rather than binary touched/not-touched.

@sciss From antenna to chip you have an electromagnetic field, which gets 'disturbed' by interaction and thus can get interpreted by the chip to for example function as a button. After the chip you have 0&1 pulses for the microcontroller. Every cable from the conductive layer to the chip works as an antenna to.
On a Touchboard, that uses the mpr121 board, I had a project with long cables from conductive surface to chip. I used blinded microphone cables, with the copper around the wires, the shielding, connected to the ground pin of the Touchboard. That worked really well!
(No Adafruit nor other specific hardware promo here, just convenient)

@wendy Ok, thanks. But that's good news, I can definitely use shielded cables. In my case, I wouldn't even mind occasional disturbances, as it's about sensing what it is "going on" around the object without a clear activation of certain operations based on thresholding. I'm ordering some MPR121 just in case, found them quite cheap from berrybase / Sertronics.

@sciss I did use them for on/off - so check their possibility to spit out variable data. I think so, but I experimented more than a year ago. Cool that your objects become sentient! Also, I'm not an engineer but an advanced tinkerer :doge:

@sciss There is this System.nanoTime() for more precise time measurement.

My experience with Java is the following: When the code to be measured is run for the first time, the time is significantly longer. Probably the hotspot compiler is running to optimize the often traversed code.
Then only after that you get "correct" values.


Suspect that all these managed programming languages (Java, Python ...) lead to less reproducible runtime measurement. And might be too inaccurate for sensors depending on timing.

In this source code measurement points are defined in C++. You can search in the file for CLOCK_MONOTONIC.

Even if Java uses clock_gettime(CLOCK_MONOTONIC) under hood, it is not excluded that the garbage collector or the JIT interferes.

Sign in to participate in the conversation

The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!