0
\$\begingroup\$

I'm making a circuit on a breadboard (before SMD design) for a battery-powered device. When USB is connected to any wall-adapter, the device wakes up when touching any ground wire on the breadboard with another metallic wire using my bare hands.

About the circuit: On the Atmega328p-PU, an falling Interrupt on INT0 (with internal pullup) wakes it from deep sleep. Normally, there are other ICs such as an TP5046 envolved, but I removed them all until this simple circuit and the problem still persists. I wanted to do "Diode-Oring" between the battery and usb power, so the device doesn't use the battery while charging.

Does anyone know whats going on? Or if it's just a software error on the Atmega?

I think it has something to with my body capacitance, like touch sensors work. But even with stronger external pull-Up resistors and low pass filters on INT0, it fires the interrupt and wakes it up.

Simplified Circuit

\$\endgroup\$
4
  • 4
    \$\begingroup\$ I spy, with my little eye, a floating reset pin. \$\endgroup\$
    – Transistor
    Commented Mar 21, 2020 at 18:16
  • \$\begingroup\$ It's interally pulled up. Additionally, the MCU is programmed to immediately go to sleep at boot/reset, so this shouldn't be the problem :D \$\endgroup\$
    – Helyon
    Commented Mar 21, 2020 at 18:20
  • \$\begingroup\$ @Helyon I wouldn't trust internal pull-ups if you are seeing noise issues. They are very high resistance. \$\endgroup\$
    – DKNguyen
    Commented Mar 21, 2020 at 20:37
  • \$\begingroup\$ Please give your INT0 pin an external pullup plus a capacitor for debouncing the switch too. And give each power pin (AVCC and VCC) pin it's own 100nF capacitor phyically close by. \$\endgroup\$
    – kruemi
    Commented Jun 10 at 4:58

2 Answers 2

1
\$\begingroup\$

People typically regard the internal pull-up resistor of the AVR reset pin as being slightly weak. I would consider putting a pull-up resistor of 4k7 on there as well as a capacitor of say 100nF or so as breadboards typically are noisy environments.

With noisy I mean that the connections on the breadboard can be a higher resistance than expected due to oxidation of the connections, glue on component legs from reels or general muck. This can makes the design more vulnerable to external influences.

When your design has a higher resistance than expected you can run into weird behaviors such as the one you have encountered now; by touching the ground wire you are transferring some of your charge to the circuit. This will change the voltage your circuit sees from the IO pins with regard to the ground plane.

Possible fixes are;

  • Clean up component legs with some acetone or alcohol to prevent bad connections

  • All ground and positive power supply connections should always go to or from the power rails on your breadboard; do not hop from ground pin to ground pin with jumper wires.

  • Consider a higher quality breadboard as there are some low tier breadboards out there that will make your life difficult. Low quality breadboards are plagued with corroded / bad contacts.

I should also mention that it is typically considered a bad idea to work on electronics without some ESD protection; the charge you accumulate can be enough to cause a permanent malfunction of the electronics you are working with. Admittedly AVRs are tough beasts and can take some abuse but you should still take some precautions like an ESD wristband and an ESD mat if you haven't already.

\$\endgroup\$
1
  • \$\begingroup\$ Thank you for your advices! So you think that the circuit should work (the diode configuration)? I was already sure that the breadboard constillation is the problem, but I wanted to ask before ordering the pcbs. \$\endgroup\$
    – Helyon
    Commented Mar 22, 2020 at 2:51
0
\$\begingroup\$

Make sure that 0V on your circuit is tied to mains earth somewhere. If you are using a 5V USB supply these are usually isolated, so your whole circuit is floating. Your body is a large capacitor, and possible conductor, to ground. When you touch the circuit a large jump in potential can occur, enough to cause spurious signals. Ground your circuit properly. A fat wire (green for preference) from 0V to the earth pin on a spare outlet should do it.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.