Hi,
I've made a simple quadcopter flight controller (schematic included) with an Arduino Nano, which has a curious (likely)electric problem that has me confused pretty well.
TLDR: among other things, putting 5cm wires on a wireless module "fixes" random resets when touching battery wire insulation. Photos, code and schematics included.
It's a pretty simple thing, and it does have decoupling caps on all the logic IC:s (Arduino, APC220 wireless, MPU6050 IMU). With everything connected, the Arduino will lock up after a few seconds, unless I physically touch the battery wire insulators. I'm thinking it's some curious capacitive problem, with which I don't have much experience :o
I've gone through the connections with a continuity checker and everything is solid, I can also shake the board around without problems so I doubt there are loose connections. Board gets it's 5v from the Arduino's regulator which is fed from a 3S lipo. Regulator keeps steady at 4.98V at all times when measured with a multimeter. The MOSFET's are F12N10L, but these issues crop up even when they are ignored (Arduino pin on their gate set to low, and never changed), and they work great. I think it's not about them either.
The program is simple, for testing it reads raw gyro values from the MPU and sends them through the wireless serial module. It has run without crashes for hours on end, and on a breadboard the wireless serial and MPU6050 work with this code without a hitch.
Some odd results of trying to debug this thing:
If the APC220 wireless module is not connected to the actual rx/tx pins, everything runs perfectly and serial data can be read through the USB without issues. Touching the Arduino's tx pin to the module's RX freezes it. The Arduino doesn't listen to the serial, so I don't really see how this could cause any problems, but it does trigger this issue somehow.
It does not crash if the APC220 module is connected with ~5cm long wires to it's socket on the board.
If serial data is not sent, everything again runs well. Sending anything locks it up. Not reading the gyro allows everything else to run without lockups, including wireless serial.
I have tested with 3 different Arduino's, all of which show the same behaviour.
Having the board run 4 brushed motors of about ~4 amps each at variable PWM frequencies (tested all prescalers) and at variable duty cycles never causes any problems. Yet when a person lets go of the battery wires, the crash is nearly instant. I have managed to cause crashes by having the arduino pull a digital pin high that's not connected to anything, and just touching the board edge. How can this happen?
I'm pretty much out of ideas at this point, so any help is much appreciated atic
Terranova.ino (7.44 KB)
Terranova.pdf (34.6 KB)