Hi, I have an ESP32Thingplus with a Gravity Digital Relay Module connected and it’s disconnecting from it’s API when I am sending the relay an ‘off’ command. I have reason to believe it’s electromagnetic interference from the gravity relay turning off. I thought the gravities had inbuilt fly back diodes? Do I need to put a heavy duty one in? its completing a 12v circuit.
While looking for information I got a bit confused.
I assume this is the relay board you have got “SKU: DFR0473”
The pic on both Core sheet and DFR Wiki for that product show a 3V relay while the circuit shows a 12V device with some sort of converter which I assume to be a boost to 12V driving it. It does seem to have a flywheel diode fitted but is labeled 1N4148, only good for a few mA forward current and not very robust for that application.
Have you found in your experience that 1N4148s tend to fail when pushed past a few mA? I too took a look at the relay board schematic and diode datasheet, and it seems they are happy with 300mA continuous, 500mA peak, provided you don’t go over this:
Some more reading suggests that there are instances where no diode or 1 diode one zener is appropriate, but I would’ve thought DFRobot were doing OK in this case:
@Anthony247019 , Have you confirmed whether this trips up the whole micro, or just the WiFi? I’m wondering if it could just be power supply ripple? Maybe a big decoupling cap near the ESP32 might help? Ideally you’d have a scope to have a look at this, but I understand most makers don’t. Have you tried putting a sheet of foil in between the two boards to see if that does anything?
correct. DFR0473. yes. it’s not up to the task i dare say.
I don’t think it does. I believe it’s just interrupting the WiFi signal causing the device to re-authenticate to the ESPhome API. the relay would/should reset to OFF if it was a complete crash. its not. its staying on. A bit of a giveaway that allows me to turn it ON but not OFF.
I configured the ESP device to restore OFFwith the following:
…and it does with a hard reset.
I think it’s worthwhile investing in a flyback diode and doing something about shielding the relay and trimming some of my wires so they’re at the minimum length.
Not really I tend to use them for the listed purpose, “small signal”. If I were using this relay in isolation I would personally go for something like 1N5822 but that is only me being cautious.
Having grown up in a world where reliability is paramount I still tend to use bits to something like half their rated capability. But that is mainly me, it is very probable that diode is fine but I could imagine a current spike of an amp or two when the field collapses, that relay has a resistance of only 25Ω. It probably would be interesting to measure the voltage and current developed when the field collapses but I haven’t got one so I can’t and you would have to take one out of a board and measure in isolation so that not very practical. I would hope that the designers of this board have gone into this. My comment was
And I still believe in the “not very robust for that application” part. But this device is a tried and proven part right back to when it was called 1N914 and has been used pretty much for everything in the past. I would certainly used it where a series resistor is involved (as in say a voltage clamp for an IC input) so it could be arranged to keep the current down to a few mA.
Didn’t say that. I just commented that I thought the 1N4148 did not seem robust enough for that application. But one would assume that the makers would have done their homework.
See my comments above in my reply to James. A lot of the concern is only me being cautious.
Go back and carefully check your ground connections. If the 10kΩ resistor on that relay board is not discharging the Mosfet gate capacitor properly the Mosfet and thus the relay will stay on.
i’ll get a pack of diodes with my next order. in the meantime i’ll shorten up the wires. the gravity and the esp32 share the same buck converter 5v. the solenoid another 12v.
Bob, I assume the diode goes between the positive and negative nearest the solenoid valve?
Before you go rushing out and buying up I will point out that you already have a flywheel diode across the relay coil. The schematic of that board follows
This was extracted from the product Wiki on DFR web site. There is some confusion as this depicts a converter and 12V relay while the product pics on both Core and DFR pages show a 3.3V relay and I don’t see the converter. I suppose this is the sort of detail you expect when you buy cheap products.
I did not say anywhere the board was not up to the task. I merely expressed an opinion that I would prefer a bit more robust diode if I were building this sort of thing from scratch.
This has got me confused. We have not been talking about a solenoid. This is relay driven so in theory does not need a flywheel diode but it is not a bad idea to fit one. The diode specs would depend on the solenoid. It is possible the 1N5822 i suggested for the relay would not have enough capability for the solenoid. As for where it goes, you are pretty vague. I have no idea what you are talking about. You are sitting there looking at it, not me. It would normally be connected across the solenoid coil with the cathode toward the positive voltage connection.
A little tutorial… A flywheel diode is fitted across an inductor to protect the driving device (in this case a Mosfet) from over voltage caused by the back EMF generated by the collapsing field at switch off.
If you draw a little circuit and replace the relay coil with a battery of the correct polarity to represent the back EMF you should see that this ADDS to the power supply voltage appearing across the Mosfet when this device is OFF. This back EMF could be many times the coil operating voltage and could easily exceed the safe Mosfet voltage rating.
PS. I think you could be on the wrong track with your problem. People have been using relays and drivers for a very long time without interference problems. The relay or solenoid coils will not radiate much. Most of the energy is used in the coil. Your biggest concern could be your power source maybe sagging a bit when the relay operates. The relay coil is 25Ω so would use 132mA to operate. That is at 3.3V. At 5V this would be 200mA
Bob, I mentioned a solenoid because the relay triggers a 12v solenoid valve. apologies. i’ll link to an image of the schematic below. Interesting what you have told me about the power… I am using cheap 24v DC power supplies from eBay. I have suspicions they are giving me inaccurate readings with one of my sensors.
This issue could be related to your other problem (which was never properly explained). A power supply has to be very poor indeed (or significantly undersized) not to handle the extra load of the relay, but if you have a poor connection somewhere in the power supply wiring, that could be showing up only when there is a sudden spike in the load. I would go over your connections very carefully, especially the grounds, and confirm that everything is properly connected. The starting point would be the ground supply from each of the power converters. In addition to your connections, also check that there isn’t a flaky ground trace within the converters. If you can’t see the actual problem you could check the voltage of the ground links when the relay fires - there should not be any fluctuating in the ground (although it might be hard to see if there is, depending on your multimeter).
Nothing like a decent variable bench top supply for experimental purposes. But hard to justify the cost for 1 off use.
Also BUT, The power source is central to the success or not of any venture.
And if this is going to be any sort of permanent thing decent supplies with enough grunt are not that expensive.
I will leave you to make up your mind about this.
Regarding your sketch. I can’t really see anything wrong with that. All your grounds seem to be OK (except maybe the flow meter mentioned below), on paper at least. Do what Jeff suggests, go over all connections VERY carefully. The only funny that I can see is the flow meter has a signal to the Micro but no direct ground return. If the grounds on the buck converters do not connect through ie; are isolated, then there is no ground return for that signal. Another connection to the micro ground would not hurt anyway as a more direct path.
You could start by disconnecting the solenoid to see if that makes any difference.
The only way you are going to see a fast glitch in your supply is with an oscilloscope I am afraid and I don’t think you will have one of these. The usual DMM will be far too slow.
If you intend putting a flywheel diode on the solenoid it will have to connect TO THE SOLENOID. Cathode to positive connection.
Hi James. While on this subject you might look into the discrepancy between what is actually pictured referring to this relay board both on your product page and DFR page and the circuit presented in the product Wiki. They only have a vague likeness to each other.
Good catch, I’ve flagged this for a thorough look-over by our team.
Also, cheers for providing your experience regarding flyback diodes, it does seem like the word “signal” in the name says “don’t use me for power applications, use a bigger schottky or something”
Yes I think “signal” does send a message. The 1N4148 is a very good versatile device though and is pretty fast for a non schottky device and is very useful for low current steering or clamping operations due to this speed. Years ago when it was known as a 1N914 I had an idea Marconi had shares in the 1N914 factory. Their early sync pulse generators used in industrial CCTV applications literally had hundreds of them.
I should not talk too loud though, I probably have 100 or so in my parts bag.
Down side is a forward voltage drop a bit on the high side. As with everything there are horses for courses and if you want a really low drop the old germanium devices (the OA series I think) were better and there was one that was particularly low. I would have to check ut I think there are some very low forward voltage drop devices available but I think at a price.
When you check the connections, look particularly at the solder pads for the terminals. I have just solved a problem of my own that appeared to be a CVCC supply that had an open-circuit in the adjustment pot.
But before binning it I removed the trimpot and tested it - it was OK. So I wired up a full-size potentiometer and the device now works properly. Solder joints for larger components are particularly susceptible to dry joints, particularly on boards that are mostly SMD, and particularly if they are subject to physical pressure, such as from a screwdriver or a connecting cable.
I have just found the time to look up the RT9193-3.0PB regulator which I said I could not see in the pics. I probably missed it as it is only 3mm long so pretty tiny. I think the “3.0” probably means O/P volts and it is a low drop out device so I formally apologise to all as it would be a 3.3V to 5V operating volts board.
It would seem the only discrepancy is the 12V version of the relay shown in the schematic. Not realising that regulator is what it is and not a boost converter (the 12V relay confused me a bit) we could forgive all and put it down to a clerical error.
Should be fixed though as a bit of accuracy here and there would not go astray. Saves further confusion as others may have had the same idea as me.
So I did a complete rewire and included a ‘copper tape covered prison’ over my relay. and although my device is not rebooting anylonger (that i can see) I get the following log messages after operating the relay:
12:51:44][D][pulse_counter:174]: 'tank litres per minute': Retrieved counter: 0.00 pulses/min [12:51:44][D][sensor:094]: 'tank litres per minute': Sending state 0.00000 L/min with 2 decimals of accuracy [12:51:47][D][switch:012]: 'tank switch on off' Turning ON. [12:51:47][D][switch:055]: 'tank switch on off': Sending state ON [12:52:06][D][esp32.preferences:114]: Saving 1 preferences to flash... [12:52:06][D][esp32.preferences:143]: Saving 1 preferences to flash: 0 cached, 1 written, 0 failed [12:52:33][D][sensor:094]: 'tank sensor voltage': Sending state 3.14853 V with 2 decimals of accuracy