I am building a localization system for a robot. The robot works on two 12V DC motors and is connected to its own circuit and battery. I connected the motor encoders to a pic18f4520 microcontroller. Each time I start the motors the pic halts and stops working. Things to take into consideration:
- The motors and the PIC work on two different circuits and power sources, the only common things are the encoders but the same problem occurs even when they are completely removed (so the problem is not from the encoders)
- Grounded everything (EVERYTHING including the reset pin)
- Grounded the outer shell of the motors
- Put one to three 10nF capacitors between the motor positive and negative pins
- Wrapped the motors and PIC in aluminium foil
- The microcontroller doesn't halt when the motors are fed with 3V or lower
What's even weirder is that even when nothing is attached to the microcontroller, as soon as we bring a DC motor close to it (closer than 40cm) it halts. Any ideas how to fix this?