-->
Page 1 of 2

ESP-01 with relay simple example does not work

PostPosted: Sun Nov 20, 2016 8:51 am
by VahaC
Next code does not work
Code: Select allvoid setup() {
  pinMode(2, OUTPUT);
}

void loop() {
  digitalWrite(2, HIGH);
  delay(1000);
  digitalWrite(2, LOW);
  delay(1000);
}

Relay is connected to 5V
ESP-01 to 3.3V throw AM1117
after turning on LED on the Relay does not blink but is all time on.

Where is mistake?
Why my simple example does not work?

Re: ESP-01 with relay simple example does not work

PostPosted: Sun Nov 20, 2016 10:06 am
by RichardS
You are driving the relay through a transistor or FET type circuit right? ESP can not drive a relay directly, that is to say almost any magnetic coil relay, solid state relay would work most likely but even then.... you need to read the specifications, if it takes more than a few milliamps to drive you need a driver IC in between.

http://www.learningaboutelectronics.com ... ircuit.php

RichardS

Re: ESP-01 with relay simple example does not work

PostPosted: Sun Nov 20, 2016 10:18 am
by VahaC
Here is a photo how i connected ESP-01 and Relay
Image

A s i know my relay takes few milliamps.
Why relay is always and does not change it state accordingly program?

Re: ESP-01 with relay simple example does not work

PostPosted: Sun Nov 20, 2016 11:10 am
by RichardS
seems to have a driver on the board

whats that other blue box?

make sure all grounds are on, and there is +5/3.3 on the relay board

RichardS