-->
Page 1 of 4

Selfmade relay board tips

PostPosted: Thu Nov 10, 2016 9:00 am
by hundsmiachn
Hi

I have made my own version of an ESP board which has 2 relays on it to switch on/off. I also can connect a temp sensor (GPIO13) and 2 servos (GPIO12, 14). My voltage source is a 220V->5V AC/DC converter.
I plan to make 2 versions, one with a 220V/5V converter and an additional step down 5V->3.3V converter with 5V relays.
The second version, which I will prefer will be with a 220V -> 3.3V AC/DC converter and 3V relays ( instead of the stepdown converter I simply shorten the 2 pins).

* Are there any optimizations I could make (change pullups/down?, additional capacitors ?).
* Do I have to change to values of the resistors for the transistor base for 5V and 3.3V version. I ask different: Which resistors do I have to change when running at 5V or 3.3V ?
* Are there any potential problems ?

PowerCtrl_Schematic.jpg


thanks in advance
regards
Erich

Re: Selfmade relay board tips

PostPosted: Thu Nov 10, 2016 5:39 pm
by martinayotte
Your schematic is missing the PullUps on both GPIO2/GPIO0.
And you better using a PullDown on GPIO15 instead of direct wiring to GND, that way you can still use GPIO15 for something else after ESP booted.

Re: Selfmade relay board tips

PostPosted: Thu Nov 10, 2016 8:16 pm
by rudy
I don't see a reason for the two pull up resistors on D4 and D5. Was that a mistake, they should have gone to D0 and D2 like martin said. I also agree with him on D15. I use a 10K pull down on that and connect a led to it.

I use D0 and D2 for I2C communications. I use 4k7 pull up resistors. It allows those pins to initiate programming mode and when not programming it allows me to add additional peripherals. Most often an character lcd.

On extra port pins I would add status leds. Or drive an output for a buzzer. I make use of all hardware. I don't have to populate everything unless I want to make use of a function. Of course there needs to be space for the extras.

Just the way I do things. We all do things our own way.

Re: Selfmade relay board tips

PostPosted: Fri Nov 11, 2016 3:27 am
by hundsmiachn
Hi

Thanks for your answers. Really appreciate it.
I will remove the pullups from D4, D5 and move them to GPIO0 and GPIO2.

Is there a way to protect the GPIOs against over voltage/current ? I recently had the problem that GPIO13 died with 2 temp sensors (5 meters away) on it. I think maybe some statics killed the port, because on GPIO14 the temp sensors work fine, and until now they worked well on 13 too.

My project with this board and the app is based on 2 Outputs, either to relay or to a servo, depending on how it is configured. So, for now, I dont need additional pins other than: 4,5 -> relays, 12,14 -> servo, 13 temp.

Current I'm using it for:
1 Unit switching 2 electric fences
1 Unit switching my Sauna ON/OFF with 2 temp sensors
1 Unit switching my pool pump and water pump
1 Unit switching 2 valves for outside water with one temp sensor

One more question I came across:
The Songle 3V relay needs a current of about 120mA. The BC337 has a hFe of about >100. So I need a transistor base current of 1.2mA. Therefore I would need a 2k7 resistor at the base. In my case I would get about 12mA out of the GPIO with my 220R, isn't a little bit too high ?
Should I change the 220R base resistor ?? To maybe 1k ?

I forgot to say, that I only use the programming pins once for initial programming, all further updates are done OTA.

I added the pullup to GPIO15 and removed the stepdown converter, I decided to use only 3.3V parts (relay and AC/DC Converter).
I also added a 10k pullup to the reset pin to be sure ...
My updated version:

PowerCtrl_Schematic.jpg


thanks for your help
regards
Erich