NOISE ON POTENTIOMETER WHEN USING ARDUINO NANO AND ESC

Hi all,
so I am trying to control two brushless motors with BLHELI ESC and using potentiometer(5kOhm) as encoder.

Control of motors are done by reading pwm from RC receiver with interrupts and passing them raw to esc with writeMicroseconds function. Esc's are always powered from battery.

The problem is that I get quite some variation in the potentiometer readings as seen below:

AOA POTI: 519   STEER POTI: 360 AOA IN: 1496    AOA OUT: 1427   STEER IN: 1512  STEER OUT: 1726
AOA POTI: 485   STEER POTI: 343 AOA IN: 1500    AOA OUT: 1551   STEER IN: 1512  STEER OUT: 1754
AOA POTI: 507   STEER POTI: 371 AOA IN: 1496    AOA OUT: 1470   STEER IN: 1512  STEER OUT: 1708
AOA POTI: 528   STEER POTI: 358 AOA IN: 1500    AOA OUT: 1390   STEER IN: 1508  STEER OUT: 1734
AOA POTI: 506   STEER POTI: 376 AOA IN: 1496    AOA OUT: 1474   STEER IN: 1512  STEER OUT: 1701
AOA POTI: 521   STEER POTI: 373 AOA IN: 1496    AOA OUT: 1420   STEER IN: 1512  STEER OUT: 1706
AOA POTI: 500   STEER POTI: 367 AOA IN: 1496    AOA OUT: 1496   STEER IN: 1508  STEER OUT: 1715
AOA POTI: 507   STEER POTI: 375 AOA IN: 1496    AOA OUT: 1466   STEER IN: 1512  STEER OUT: 1707
AOA POTI: 517   STEER POTI: 352 AOA IN: 1500    AOA OUT: 1430   STEER IN: 1512  STEER OUT: 1744
AOA POTI: 507   STEER POTI: 367 AOA IN: 1496    AOA OUT: 1470   STEER IN: 1512  STEER OUT: 1720
AOA POTI: 503   STEER POTI: 382 AOA IN: 1496    AOA OUT: 1485   STEER IN: 1512  STEER OUT: 1691
AOA POTI: 522   STEER POTI: 383 AOA IN: 1496    AOA OUT: 1416   STEER IN: 1512  STEER OUT: 1689
AOA POTI: 489   STEER POTI: 345 AOA IN: 1500    AOA OUT: 1536   STEER IN: 1508  STEER OUT: 1750
AOA POTI: 492   STEER POTI: 413 AOA IN: 1496    AOA OUT: 1526   STEER IN: 1512  STEER OUT: 1641
AOA POTI: 504   STEER POTI: 351 AOA IN: 1500    AOA OUT: 1481   STEER IN: 1508  STEER OUT: 1740
AOA POTI: 509   STEER POTI: 357 AOA IN: 1496    AOA OUT: 1458   STEER IN: 1512  STEER OUT: 1731
AOA POTI: 511   STEER POTI: 350 AOA IN: 1500    AOA OUT: 1456   STEER IN: 1512  STEER OUT: 1743
AOA POTI: 523   STEER POTI: 369 AOA IN: 1500    AOA OUT: 1413   STEER IN: 1508  STEER OUT: 1712
AOA POTI: 484   STEER POTI: 356 AOA IN: 1496    AOA OUT: 1554   STEER IN: 1516  STEER OUT: 1738
AOA POTI: 492   STEER POTI: 384 AOA IN: 1496    AOA OUT: 1526   STEER IN: 1512  STEER OUT: 1692
AOA POTI: 512   STEER POTI: 395 AOA IN: 1496    AOA OUT: 1448   STEER IN: 1512  STEER OUT: 1674
AOA POTI: 487   STEER POTI: 354 AOA IN: 1500    AOA OUT: 1544   STEER IN: 1512  STEER OUT: 174
  • So I thought maybe it was noise picked up on the potentiometer cables(ca 10cm) going to the arduino. So to check this I added a second arduino to just read the potentiometer, but then the problem disappeard. So I then assume this is not the case.

  • Then I added a 100nF capsitor between the wiper and GND, however this seems to have no effect as well

  • I tried powering arduino circuit(with poti) with USB cable, USB charger, another battery with separate step down converter. Nothing helped.

  • It gets better when I change the output pwm refresh interval:

  • #define REFRESH_INTERVAL 2000//2500//20000 // minumim time to refresh servos in microseconds*

Motor is more responsive when outgoing pwm refresh interval is lower(higher freq). Makes some sense, this esc can support very high freqs. So it would be nice to keep the refresh interval low.

So what can be the issue? Has it to do with interrupts and analog read or is there some electrical noise?

One way to solve it would of course be to add an ADC to i2c and read it in the arduino, but I feel thats a bit overkill instead of finding the issue.

What value potentiometer are you using (Ohms) ? 10k or maybe, in your case, lower is recommended.

A cap from pin to ground could make things worse (defeating ratiometric behaviour).
And 47uF is waaaay to big for that, and dangerous for the pin.

Need to see the pot wiring/layout.
Pot must have it's own (wiring not shared) power/ground connection to the Arduino.
Leo..

@wawa the cap was 100nF
@6v6gt the potentiometers is 5k
@jackrobot what do you mean by "voltage divider bias configuration"

I made a quick diagram of the layout:

Your schematic is rather unconventional so maybe I have not interpreted it correctly, but the 2 potentiometers appear to be in series. This would not be correct.
Incidentally, you can also attach a picture/photo of a hand drawn schematic to a post in "preview" mode.

6v6gt:
Your schematic is rather unconventional so maybe I have not interpreted it correctly, but the 2 potentiometers appear to be in series. This would not be correct.
Incidentally, you can also attach a picture/photo of a hand drawn schematic to a post in "preview" mode.

Just of the potentiometers

If you're reading RX outputs why aren't you using the Servo() Read function instead of bit banging?

Not to be fecetious, but seriously, have you ever
actually seen a real schematic before ?

OK, will try with the servo read function instead.

Is there a free schematic software that runs in the webbrowser that is easy to learn for a non electrical engineer?

Read AND Write

skatun:

  • Then I added a 100nF capsitor between the wiper and GND, however this seems to have no effect as well

The cap must go between the Arduino analog pin and ground, not on the pot. The noise is picked up on the wiring between the pot and Arduino.

The ground and Vcc wiring between Arduino and pot MUST NOT share with any wires to the ESC or motor or motor power supply. The would directly inject loads of noise into the pot circuit.