AIO Automation box. I need help

Hi,

I've recently taken a swing at arduinos and decided to build myself an automation system for my plants.

The ESP8266 system monitors and controls temps, etc and edits values in MySQL which my web browser will output using AJAX.

I have connected everything into a small fireproof enclosure, with 3 relays,a samsung 5v cellphone charger plug and a DHT11 sensor. The arduino device (NodMCU) and the other components are connected to this charger and is switching the relays constantly.

The issue im having is that the relays stop working after a day or 2. They just stop clicking completely, or don't switch when you write HIGH or LOW to the input pins.

Not sure if this is because the relays arent reliable enough, or if its the components ive used.

Someone told me the noise generated in the enclosure is interfering with the process and confusing the relays, or taht it could be too little power provided.


So i went back to the drawing board while I wait for someones assistance. What ive gathered so far is that i need more AMPS. and i need more voltage. Only issue is i dont know how much or what is more prefered than others.

So i've bought a simple "12v 2A Max" power supply, and a few 7805 regulators.

I was also looking at the Ultra-compact power module "HLK-PM01" to step down 230V within the enclosure.

I have not tested this yet, as i was also hoping that someone could recommend something more efficient? Perhaps a few caps or diodes to improve the circuit? Im not clued up enough to know all the options, but i do know enough to do what needs to be done with provided info, plus its simple logic to understand a circuit.

Would greatly appreciate the help. Thanks

Please read this:-
How to use this forum it will help you with how to ask a question here.

As a minimum we usually need a schematic ( not a Fritzing physical layout piece of crap ) with part numbers and full wiring shown. And the code you are trying to run posted correcty which you will also see from that link.

To make it work now.
Get a second phone charger just for the relays

If you can get a SSR that can handle the loads that would cut power by the elimination of the coils
If the loads are DC then you can use MOSFETS.

Grumpy_Mike:
Please read this:-
How to use this forum it will help you with how to ask a question here.

As a minimum we usually need a schematic ( not a Fritzing physical layout piece of crap ) with part numbers and full wiring shown. And the code you are trying to run posted correcty which you will also see from that link.

Thanks for the heads up. Will edit accordingly.

dave-in-nj:
To make it work now.
Get a second phone charger just for the relays

Thanks for the easy solution! I will try that and see how it goes.

a relay is comprised of 3 separate parts.

the contacts are isolated from everything else. there is no reason you could not run 1,000 volts or 1,000 amps though a relay that is designed to carry that power.

The coil is an electromagnetic coil and all it does is create a magnetic field that will push or pull a metal plate. that metal plate will move the contacts that allow the power to pass. The coil never sees that power. only that metal plate.

the third step is that you can send a very low voltage, say, 5 volts, and a very low current, say 100mA to a coil.
The switching of this low voltage is completely isolated from the power on the contacts.

In order to create a magnetic field in the coil, you need to rapidly dump in power. Once the magnetic field is established, a lower power is needed to maintain the magnetic field.

Once the decision to release the contacts, to loose the magnetic field, has been made, you open the circuit and the power to sustain the magnetic field is lost. The interesting thing is that you needed a large spike of power to establish the magnetic field, and when it collapses, the magnetic field is turned back into a voltage and is dumped back on the wires for the coil. This results in a spike of voltage, often 20% higher than used to create it.

This spike can damage the switches that turn that power off and on. To eliminate that from being a problem we do two things. #1) put a diode in place to give that power a path. #2) use an opto-isolator to create a barrier so the spike is never seen by the micro-controller. These are designed into the simple relay modules we buy and use.

But, that initial surge is often too high to be taken from the power supply to the Arduino.
One option is to just use a separate power supply. hence the second phone charger.
Another option is to use a specially designed capacitor circuit. You have a high value resistor feed a capacitor and over time, the capacitor is charged. This will provide the stored power to activate the relay when the time comes, without having any large load on the power supply. This circuit is a common circuit and can be found on the net.

Also, if you were to add a capacitor on the power input lines of the Arduino, the power drain when switching a load might, just might, be able to be allowed for and to prevent the voltage on the Arduino board to never dip. Train hobbiests use this CDU (capacitor discharge unit) to deliver a surge of power without allowing the main power supply to dip.

The first and most common choice is to use a second power supply to the relay board.
And don't forget that due to the way the opto-isolators are laid out, you need to connect the grounds for the two power supplies. if the opto's were truly isolators, then connecting the grounds would not only be un-necessary, it would be detriment to isolation.

Hi,
Do you have a DMM?
Can you measure the 5V from the charger when it faults?

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Thanks... Tom... :slight_smile: