G
G
GreenCard2018-02-20 18:30:46
Arduino
GreenCard, 2018-02-20 18:30:46

Arduino reboots when relay is turned on?

I connected the relay to the Arduino and when triggered, the Arduino reboots. The problem is observed only when a load is connected to the relay. I tried two types of relays, one from 5v arduino, the second is additionally connected to 12v power.
Relay load 12V 1A.
Program code

#define RELAY_PIN 12
#define BUTTON 8
 
void setup() {
  pinMode(RELAY_PIN, OUTPUT);
  pinMode(BUTTON, INPUT);
}
 
void loop() {
  boolean keyUp = digitalRead(BUTTON);
  boolean isOn = false;
  if (!keyUp) {
    digitalWrite(RELAY_PIN, HIGH);
    delay(1000);    
    digitalWrite(RELAY_PIN, LOW);
  }
}

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
vaut, 2018-02-20
@vaut

Most likely it's not the program but the tips. Is the motor behind the relay?

V
vanyamba-electronics, 2018-02-21
@vanyamba-electronics

It's strange that it didn't burn at all. Connect through a transistor.
5a8d3269eac29976936505.png

V
Vladimir Belov, 2018-02-23
@MaxMcu

there are no problems when using drivers like uln2803.
You can also use solid state relays.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question