-->
Page 1 of 3

prototype bootup problems

PostPosted: Wed Oct 28, 2015 4:28 pm
by VikingCode
hello all :)
I'm trying to control a 5V LED-strip and 5V relay with an ESP-01 module. In the image below, you can see the circuit I want to design / use.

Because I'm still an (PCB) amateur and don't have the needed schooled knowledge, I'm having a problem to which I don't have an answer (YET :p ).

If I first start the microcontroller, and then connect the GPIO pins to NPN transistor, it works. But if the GPIO ports are already connected on the power-up of the ESP module, I don't receive a response from my module.

The errors that occured:
- If only the GPIO 0 is connected to the NPN on the power-up, I receive garbage in my serial monitor.
- If only the GPIO 2 is connected to the NPN on the power-up, the blue light remains lighted with no reaction on any command in the serial monitor.
- If both are connected to the NPN on the power-up, the blue led lights and the GPIO's doesn't react.

Solutions I was thinking about:
- The GPIO 0 was pulled to the ground on the power-up, resulting to flash mode of the ESP module.
* I've tried to resolve it with pull-up resistors, but this didn't work (after this I noticed that the chip didn't go into flash mode).

I hope someone can help me with this problem.

Kind regards,

Image

Re: prototype bootup problems

PostPosted: Wed Oct 28, 2015 7:41 pm
by lethe
First of all: you need a base resistor for current limiting. Otherwise you risk blowing your transistor or ESP.
Now to your problem: GPIO0/2 booth need to be high, when the ESP boots, but in your circuit these pins will be pulled low through the transistor. Add pullup resistors to these pins (on the ESP side of the base resistor). This will of course also switch on the load, if the ESP is in reset. To avoid that, you can use an inverting switch configuration.

PS: when you draw schematics, ground is usally drawn at the bottom

Re: prototype bootup problems

PostPosted: Wed Oct 28, 2015 8:55 pm
by Barnabybear
Hi, +1 on lethe’s comments.
But credit that you posted lots of information – all my circuit diagrams are hand drawn and photo’d.
Now to the point.
The ESP8266-01 is the hardest of all the variants to work with. It only has 2 GPIOs broken out and both have to be in various states at boot depending what you want to do.
To boot up on powering and run the code, you need the following:
Vcc -> 3.3V
GND -> GND
RST -> 3.3V
CH_PD -> 3.3V
GPIO 0 -> 10K resistor -> 3.3V
GPIO 2 -> 10K resistor -> 3.3V
There starts the problem.
Both GPIOs heed to be high on boot. The easy answer is to put the relay +ve to 3.3V and the –ve to a GPIO.
Note: to anyone reading this – don’t do this with any of the pre-manufactured relay boards – it doesn’t work and will kill your ESP even if the board is 3.3V rated.
When the GPIO is high (3.3V) the relay is off.
When the GPIO is low (0V) the relay is on.
But you can’t do that as the relay needs 5V.
There are lots of ways to do this but my preferred is to use an opto coupled transistor. As the input diode terminals are not connected to GND, you can connect to 3.3V and a GPIO and then apply whatever voltage you need to the transistor. I got some ILD74s cheap and they have worked well up to 12V.

Re: prototype bootup problems

PostPosted: Thu Oct 29, 2015 7:00 am
by VikingCode
@ lethe & Barnabybear : Big ... very BIG thx ..

I adjusted my design a bit like lethe proposed and added 4 resistors ... all of them are 10k like Barnabybear proposed, and my "prototype" booted up correctly and everything works like it should.

So if i understand it correctly :

R1 & R3 are pull up resistors and are in place to ensure the logical 1 on the pins on boot up.
- Sparkfun article suggests that i can use 10k resistor "almost" by default if i need a pull up. Do i understand it correctly ?

R2 & R4 are base resistors for NPN transistor and are in place to reduce current flowing to the base pin of the transistor.
- I don't yet understand completely how to calculate them. i'm using this article and hope i will understand it soon :p .

PS: @ lethe : i moved my VCC line to top but couldn't find a good way to get my GND line underneath the transistor.
Image