I have an artwork where seated people should be detected by capacitance, just like is the case with higher end car and aircraft seats or hospital beds (capacitive proximity sensor mounted under 30 - 80 mm of cushioning). The simple approach with CapacitiveSensor seems not so very reliable (a great library of course, just not so good in my case) as far as longer distance proximity is concerned.
I saw that Texas Instruments has a new-ish low-price IC ($8.12 for one), the FDC2214, but there is no break-out board for us laypeople ready to use and TI on their forum says there is no Arduino code.
Does anyone know of a break-out board or if one can, with a very steady hand, solder one's own? It's an SMD part (that's what these type of ICs are called, right?).
If you think one can fabricate something "at home", does someone know how to get an Arduino talking with it?
I was expecting a link to the data sheet which tells how it works, rather than a video that shows what it can do.
It's using I2C communications, so writing a library isn't that hard. Just tedious (data sheet p.21 onwards).
It's using 3.3V so if you're using a 5V Arduino, make sure you connect it properly and add level shifters. Other than that the only other external components you need other than the sensor itself are two caps for power supply decoupling and filtering.
The largest problem is the package (only WSON and WQFN available) which are pretty much impossible to hand solder to a breakout board. Luckily you can apparently get sockets for the WQDN version:
thanks, that socket looks just perfect for the task; I didn't know such things existed. Someone has even written a library for it, even though TI says there is none and it should not work.
So that's already two steps forward. Now I'll order one and see if I can get it to work. As far as the various videos go, it really seems an excellent capacitive sensing device.
Just in case, do you know another one that is maybe reasonably similar in performance for the task?
TI may not have a library written themselves, but I've yet to see a sensor/IC the Arduino can not interface with (other than for simple lack of information on how the interface should work). Especially I2C is a standard bus making it straightforward to interface. All commands are in the data sheet so it's a matter of implementation which is tedious but not particularly hard.
I don't know about any other chips. These sockets I also didn't know about until I ran into this image yesterday
You are running into better things than I in that case ; )
An alternative for capacitive proximity, not only touch, is - or rather was - apparently the less performant Freescale/NXP MPR121 which has been discontinued, so it'll disappear from Sparkfun, Adafruit, etc. probably soon : (
So, I best get your socket and that presumably ingenious and affordable TI sensor and try to use that library I found.
Then, I saw that NXP has a new range of capacitive sensing sensors, presumably better than the old MPR121, also communicates via I2C, and it explicitly says in the data sheet that it is to be used for "Switches in or under the upholstery, leather, handles, mats, carpets, tiles, and glass". It's sold as a TI competitor. But for the NXP PCA8885, no library could be found and I am no coder able to even dare thinking about attempting to try writing one myself.
thanks for the encouragement, but that seems well beyond my skill level, as good as it sounds. I don't even know what "Wire commands are". Can I learn it? I'm no brogrammer, looking retirement in the eye, if you know what I mean.
I know that Wire is a library for I2C communication. With "Wire commands", do you mean these?
As far as physical connections are concerned, for basic operation one only seems to need VDD (2.5 - 5.5V DC), VSS (GND), SDA and SCL plus IN0 - IN7 to each copper pads (maybe a single one or only a few will suffice). Then, there are 12 commands and 4 registers, of which only CONFIG and SENS seem to be relevant for basic operation...
Maybe I resort to buying as many of those discontinued MPR121s as I can find and take it from there, as enticing as the FDC2214 or PCA8885 seem to be.
Lagom:
Maybe I resort to buying as many of those discontinued MPR121s as I can find
I'd only do that as a last resort, or to support a legacy project. Never for any new design. There's usually a good reason for chips to be discontinued: mostly because there's a successor that does the job better in many different ways making the old one obsolete.
Indeed looking at the data sheet the interface of these chips looks quite simple. Maybe a few commands to initialise them in your setup(), after that it looks like it's a very simple requestFrom() call to read the current state of the sensors.
Out of curiosity: Why do you deem the CapSense library as unsuited for your project?
The way I understand capacitive sensing, it should be possible to do it without extra hardware using only the Arduino. Sure, there are dedicated ICs, but what are those things doing differently/better?
edit: I'm asking because your question gave me half an idea for a new project, so I'd like to know more details on the problems you have encountered so far in order to make my own life easier...
from what I have read, the "bare-bones" CapSense approach seems rather a hit-and-miss affair, somewhat unreliable and suffering from drifting sensitivity over time, with humidity, metallic objects placed near, objects being on the ground, and other intrusions. Also, when reading comments on Arduino, Adafruit or Sparkfun forums, the unreliability and problems suggested by many commenters made me not even considering a non-IC based approach.
In comparison, the MPR121 based approach seemed far more reliable or at least predictable, when I saw examples that went beyond a few minutes of ok-ish use in the context of tutorials. And the MPR121 is/was very affordable.
And so, having learned that the MPR121 was discontinued, I searched again and came across the FDC2214 and PCA8885, which, from what Texas Instruments and NXP write in their documentation, seem to be very "clever" yet very affordable ICs, ideally suited to sensing through a wooden or cushioned seat.
And, as the other more knowledgeable commenters indicated, it could be possible, even for a non-specialist like me, to get those to work. So this is what I am contemplating right now.
yes, using a discontinued product is maybe not such a good idea.
Since I have several weeks of time ahead, I will take the plunge and order both the Texas Instruments and NXP IC, the first one requiring that nifty IC-adapter from Proto Advantage, the latter solderable manually with some patience, since not all legs need to be contacted in my case, as far as I understood the specification sheet.
I buy both ICs on Monday and, once they arrive, take it from there. It is very exciting to me at least attempting to learn how to talk to an IC all by myself, with no library or other people's work. I hope it's not as insanely difficult as learning Finnish ; )
A possible other approach: the ESP32 processor has 10 "capacitive sensing" inputs. I don't know anything about it beyond their existence, but a quick Google search turned up this page with detailed info about them.
That of course gets you also all the other goodies of the ESP32 such as it's high clock speed, lots of memory, and built-in WiFi and BLE.
so, that's another contender... I could not find anything in the documentation about proximity detection (only mentions touch pads and sliders), which is what I need and the other two ICs are explicitly good for, but I have not had time to look for a good length of time. With its added communications capabilities that ESP32 seems to be one almighty mother of an IC ; )
Looks OK, skimming through it, but I did notice this common mistake:
Wire.requestFrom(ADXLAddress,2); // Request the transmitted two bytes from the two registers
if(Wire.available()<=2) { //
X0 = Wire.read(); // Reads the data from the register
X1 = Wire.read();
}
The if statement is redundant as the Wire.request() call guarantees there are two bytes read, regardless of how many the slave actually sends (if the slave doesn't actually respond, a value of 255 is read).