I get an increase in jitter on a connected joystick when I plug in a USB cable and start charging the battery.
The increased jitters go away once the battery is fully charged.
The device I’m inventing is a buttons and a joystick over wifi affair. The joystick had natural jitter, so I spent a lot of time with the sketch trying to suppress its effect so it wouldn’t send commands to the receiver when it was centered and nobody was touching it. I did that with it connected to my computer with a USB cable using serial monitor on Arduino IDE to get the raw numbers. Eventually, I had it mostly stable. Output to serial monitor was silent. Maybe there was a long spike every once in a while that got past the sample rate, but it was rare.
Then, I plugged in a battery. The jitters came back. Or, they were just increased past the dampening settings I established. I know, because serial monitor says so, but also because the LED I added to show transmissions flashes. The effect happens also when I’m connected to a wall charger. Not just when connected to computer. I only started having this problem when I switched to the seeed board because of the on-board charging to reduce size. I was using an external battery charging circuit with a different board before.
The effect happened with a 250 mah battery and a 2000 mah battery and on two separate builds of the device using different boards in each.
Here is the way I have it wired:
D0 button
D1 button
D2 VRY
D3 button
D4 packet sending LED
D5 button
D6 button
D7 wifi is connected LED
0.1 uf capacitor across GND and +5V on the joystick
220 nf capacitor across GND and D2 on the board
330 ohm resistor between VRY on the joystick and D2 on the board
330 ohm resistors between the pins and each LED
+5V on the joystick is wired to 3V3 from the board
The joystick is a generic mushroom cap thumb type you can get from amazon postings that say “blah blah for arduino blah blah” on all the listings.
Is this a known issue? My search of the forums didn’t find anything. How can I fix it?