Capsense Library example works with great with UNO but not with Nano Every?

The CapacitiveSense library is the key to my project. A custom art touch lamp.
[Arduino Playground - CapacitiveSensor]

It works great with the Arduino UNO but the Nano Every has vastly different performance and issues with exactly the same code and HW. The Arduino is just too large for my project so I had high hopes that the Nano E would be a compatible fit.

My HW setup is per the example. Using a high value Resistor between pins 7 and 8 for Send and Receive(sensor). Works for the Uno but the Nano E just outputs a -2. Even though I tried resistor values 56K to 2M!. Realize the error -2 can mean a missing resistor. So I then tried the Threshold 3 way switch example code which suggests that just using pin 8 as an antenna is possible. I have a small steel plate (3"x4") connected directly to pin 8. Again Arduino Works great. By that I mean that I can adjust the parameters labeled in the code as a, b and c to get a repeatable trigger output to the serial monitor. The Nano Every with the same code though gets vastly different readings for cs and they don't stabilize. By vast , I mean Arduino returns cs numbers in range 100 to 200;s while the Nano E returns in the 33000's. Now I can make the code recognize those numbers for a trigger but subsequent touches range all over the place (1000's to 50000's) making touching the plate highly random with triggers.
I have made large tables (many hours) trying to dial the parameters in on the Nano with no success while it took me about 10 mins to dial in on the Arduino for reliable operation.
Why would the Nano Every be so different from the Uno?

The Threshold example code (bottom of page) in the library reference is perfect my setup as it is described as a used for a 3 way switch. The example code is below.

#include <CapacitiveSensor.h>
CapacitiveSensor cs_7_8 = CapacitiveSensor(7,8); //10M Resistor between pins 7 and 8, you may also connect an antenna on pin 8
unsigned long csSum;

void setup() {

void loop() {

void CSread() {
    long cs = cs_7_8.capacitiveSensor(80); //a: Sensor resolution is set to 80
	if (cs > 100) { //b: Arbitrary number
		csSum += cs;
		if (csSum >= 3800) //c: This value is the threshold, a High value means it takes longer to trigger
			Serial.print("Trigger: ");
			if (csSum > 0) { csSum = 0; } //Reset
			cs_7_8.reset_CS_AutoCal(); //Stops readings
	} else {
		csSum = 0; //Timeout caused by bad readings

Serial Output with Uno board with nice triggers.
parameters cs>700, csSum>=1500, samples are 10,

Trigger: 1161

I realize this is a lot of detail in this question. But I've searched this and other boards for anything on getting Capacitive Sensor to work on any other board beside Uno and haven't found anything.
I'm also aware of the grounding issues talked about in relation to touch sensing. I still have issues whether the Nano is connected via USB or an independent AC-DC power supply with 12vdc going to Nano.
Any insights appreciated.

The ATmega4809 of the Nano Every is a totally different chip than the ATmega328P of Arduino Uno, even though they belong to the same AVR family (so they say).
The library is probably not updated for the Nano Every.
I would no longer spend time on this. Use the Uno or Nano for that library.
Or if you are lucky, you can find an example of someone who has it working.

Oh oh. Interesting point. I certainly could have made the assumption (always a risk) based on their description that it would work.

An Improved Arduino Nano

If you used Arduino Nano in your projects in the past, the Nano Every is a pin-equivalent substitute. Your code will still work, and you will NOT need to re-wire those motors you planned in your original design. The main differences are: a better processor, and a micro-USB connector.

Ok. I will try the Nano (more expensive, shoot) and still hope someone may have gotten the Nano Every working with some kind of touch sensing.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.