0
\$\begingroup\$

As I finished programming the MCU in the Arduino Uno board to receive some RF Signal and drive relays, I moved it into a standalone board I made with Eagle. The circuit is pretty basic, the MCU receives data from a RF Receiver, processes it and then turns on/off some pins that drive 5V relays (through transistors, of course). When I test it on the Arduino Board, you can see that the LEDs toggle ON and OFF whenever I send the data through the RF Transmitter. You send once, it toggles ON, you send another time, it toggles OFF and so on. This works for all the 4 PINS that it has programmed. In my standalone board, each of these four pins are connected to transistors that drive 5V relays. The problem is that only one pin seems to activate, and then it won't even toggle OFF, like you send the data once and you can hear the relay's coil go ON, but then if you try to toggle it OFF it just won't, it's latched ON and I have to unplug and plug the USB cable again to reset it. The ATMEGA328P has a 16MHz crystal, two 22pF caps for the crystal, and a 10K resistor that goes from the Reset Pin to VCC. I'm not sure why the MCU behaves so weird in my board. There's also another VERY weird detail I didn't mention. If instead of using the RF Receiver, I connect the Data Output pin of the PIC that drives the RF Transmitter directly into the Receiver board, that one pin I mentioned that works is able to toggle OFF and ON again, but still, the other pins just don't work. I've tested it not only by hearing the relay's coil but also by using a multimeter. Any help would be really appreciated.

EDIT:

Here is the Eagle Schematic of the board:

Schematic

It's true that I really didn't concern about the noise, but since it was quite a simple project I didn't think that noise was going to attack so violently, plus I don't really know how to protect the circuit from inductive noise. Thank you for answering fast!

EDIT 2:

Okay so here goes more detail:

Board

Real photos:

Real photo

Real photo

The soldering seems quite awkward but I probed all the traces to check for continuity.

I could make some extra holes to, for example, add a 100nF decoupling capacitor for the MCU and so, but if you think I should enhance the schematic and add a lot more components, then I'll gladly remake the board.

About the supply, right now (for debugging) I'm connecting the Arduino Uno to a Cellphone Charger (Notebook won't supply enough current for relays), and I'm connecting those red and black cables to the Arduino Uno. I'm using that Cheap 433MHZ RF Receiver so if the circuit is so vulnerable to noise as you say, it may also be getting fouled up by the noise.

\$\endgroup\$
9
  • \$\begingroup\$ Schematics, photos, layout, etc please. Wall of text doesn't help you. \$\endgroup\$
    – Wesley Lee
    Commented Sep 28, 2017 at 16:36
  • \$\begingroup\$ If the same code and relays work on the board but not the stand alone, the issue is wiring. Or power supply or regulator. \$\endgroup\$
    – Passerby
    Commented Sep 28, 2017 at 16:46
  • \$\begingroup\$ Ill edit it right away @WesleyLee \$\endgroup\$ Commented Sep 28, 2017 at 16:48
  • 1
    \$\begingroup\$ It seems to be a typical electrical noise pulse from the relays that bounces through the whole board. Connecting something to the board changes that. There are no bypass caps as @WesleyLee wrote (I call them decoupling capacitors). All GND and AGND pins must be connected to GND. All VCC and AVCC pins must be connected to VCC. Is there enough power for the relays ? The X-tal and the two 22 pF capacitor are close to the Atmega chip, that's good. \$\endgroup\$
    – Jot
    Commented Sep 28, 2017 at 21:34
  • 1
    \$\begingroup\$ As soon as the Atmega328p is powered without 100 nF capacitor between GND and VCC, then you have noise all over the board. Perhaps you could also add a larger capacitor (10 to 220 µF). \$\endgroup\$
    – Jot
    Commented Sep 29, 2017 at 16:23

2 Answers 2

2
\$\begingroup\$

The relays , wiring radiated emissions and conducted noise cause this classic failure to recognize need to clamp dI/dt of the relay coil and any inductive loads to the supply rail. Diode clamps and twisted pairs are essential. So are details of the above missing in your question.

\$\endgroup\$
2
  • \$\begingroup\$ no help, read again.. signals, measurements , phots of layout, twisted pairs, supply specs.. lack of details on conducted and radiated unintended emissions missing completely. Ground inductance and surge path especially. \$\endgroup\$
    – D.A.S.
    Commented Sep 28, 2017 at 17:04
  • \$\begingroup\$ I added more detail now. Sorry if I'm still missing important information, I don't handle technical english so well and may not be getting exactly what you ask for. Thank you a lot anyways \$\endgroup\$ Commented Sep 28, 2017 at 17:33
1
\$\begingroup\$

A couple basics on setting up the ATMega. You'd want to:

  1. Pull the reset pin to VCC with a 10k resistor.
  2. Put a 100nF capacitor across VCC and GND.
  3. Connect AVCC and AREF to VCC and AGND to GND.

If you ever use the ADC, add a second capacitor across AVCC and AGND. You might also want to buffer the transistors by adding an electrolytic across VCC and GND.

\$\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.