16x2 goes blank after few hours.

Hi there, my first post so bare with me.

I have an uno doing some climate controlling.
I have been busy trying dozens of setup combinations and wiring options, but eventually when its running, it constantly does the same: the display stops displaying what it should, and the program continues to run.

Uno
Sensorshield V4 (link)
LCD keypad shield (link)
4 channel relay board (link)
2x DHT11 sensors (temperature/humidity)
2x DS1B20 sensors (temperature)

On several occasions I had the idea that the LCD went blank right after it turns of a relay which is powering an exhaust fan. Not sure if its related, I just noticed it.

I have tried so many possible scenarios, different wiring solutions, different pins, separate power source for the relay board … on and on and on and on …

But every time, after a couple of hours of running just fine … it stops showing the things it should on the display and the code seems to keep running (it continues to switch devices on and off according to the programming)

I have read tons of information about the LCD displays, and most recently found a bit relating to timings and delays needed …

I figure it may have something to do with my code, so I hope some of you can poke at it and see problems.
This is my first C like program, keep that in ind when you judge my approaches hahaha.

Thanks in advance to any who takes the time.

Hmm … seems my code is too long, I will include the code in a file …

new_reader.ino (41.6 KB)

What is your power supply like?
USB cable can lose half a volt or more over 2m between a PC and an arduino just running lcd screens.
My “5V” blue lcd was a bit dim when powered through usb-arduino so I rigged some separate 5V for it which does not go through the arduino. Relays are an even bigger current draw, which changes every time a relay switches. Have you got anything to supply a separate 5V to your relays which does not rely on the usb or rather tiny 5V regulator in your uno?

ad2049q: What is your power supply like? USB cable can lose half a volt or more over 2m between a PC and an arduino just running lcd screens. My "5V" blue lcd was a bit dim when powered through usb-arduino so I rigged some separate 5V for it which does not go through the arduino. Relays are an even bigger current draw, which changes every time a relay switches. Have you got anything to supply a separate 5V to your relays which does not rely on the usb or rather tiny 5V regulator in your uno?

Thanks for the reply !

I only use the USB to program the uno, otherwise its powered by a power supply: 9v - 1A The relay board uses its own power source: 5V - 700ma (old phone adapter)

I bought the advised power supply which came for the arduino.

I had the "dim" effect too when all 4 relays would be powered, it was gone once I fed the relay board it's own power source. Sadly, in both situations, I have the same results with the display going blank. (its lit, but no chars showing up)

On several occasions I had the idea that the LCD went blank right after it turns of a relay which is powering an exhaust fan. Not sure if its related, I just noticed it.

You should pursue this a bit further. Temporarily replace your relay (and any other inductive devices you are controlling) with an LED and I think you will find that your problem goes away.

Don

floresta:

On several occasions I had the idea that the LCD went blank right after it turns of a relay which is powering an exhaust fan. Not sure if its related, I just noticed it.

You should pursue this a bit further. Temporarily replace your relay (and any other inductive devices you are controlling) with an LED and I think you will find that your problem goes away.

Don

Thanks for the reply Don.

Without devices connected (or powered by 220V) through the relays, the problem does not seem occur. (had it running couple of days ago for 24 hours, no issues, but no devices powered by 220V)

I don't think it has anything to do with a power drop, as the relays only require power when they enable throughput (powering device) and the relays have their own power source.

Strange thing is, the times I noticed it happening, was when the relay got turned off after having run for a random time (dropping the power to the relay)

I am imagining something like a magnetic field collapse perhaps causing a disturbance on the LCD, but seems far fetched.

Do you have any suggestions as to approaches how to try and tackle this ?

Hi Lennaert, and welcome

Lennaert: Strange thing is, the times I noticed it happening, was when the relay got turned off after having run for a random time (dropping the power to the relay)

I am imagining something like a magnetic field collapse perhaps causing a disturbance on the LCD, but seems far fetched.

It's not that strange. In fact this can be expected. You're probably switching off some motor or other inductive load. That suddenly switching off will generate a spike, which might very well be picked up by your LCD (controller) and crash it.

Your relay board has an opto isolator for each relay, that's OK. It also has an anti-parallel diode to the relay coil, that will take care of back-EMF. So the spike will most likely be originated at the load part of that relay. Start by putting your relay board further away from the Adruino and / or LCD. Then you could try to use capacitors and / or diodes to get rid of said spikes before they can reach the Arduino and LCD.

MAS3: Hi Lennaert, and welcome

Lennaert: Strange thing is, the times I noticed it happening, was when the relay got turned off after having run for a random time (dropping the power to the relay)

I am imagining something like a magnetic field collapse perhaps causing a disturbance on the LCD, but seems far fetched.

It's not that strange. In fact this can be expected. You're probably switching off some motor or other inductive load. That suddenly switching off will generate a spike, which might very well be picked up by your LCD (controller) and crash it.

Your relay board has an opto isolator for each relay, that's OK. It also has an anti-parallel diode to the relay coil, that will take care of back-EMF. So the spike will most likely be originated at the load part of that relay. Start by putting your relay board further away from the Adruino and / or LCD. Then you could try to use capacitors and / or diodes to get rid of said spikes before they can reach the Arduino and LCD.

Hi MAS3, thanks for the welcome and reply.

The device I noticed this happening with is an extraction ventilator, I guess it fits the profile of the likely aforementioned culprit.

Yikes; to placing it further away though. I hope that can be avoided, I have build such a nice casing :(

How much distance would you advise ?

Current wiring leaves me ~25cm or so to move the relayboard around, otherwise I'll just whiff up some new wiring.

Are there other options; like some insulation material ? (lead ??)

I have a raspberry too (other project), and I read once somewhere that using the optional cooling fins could prevent something similar. Any thoughts on that ?

Moving the relay board is part of debugging, it's not a definitive solution. So just put it as far away as possible with the current setup. If you have some available, use a 100nF capacitor and connect it between the relay pin and GND. I think best position to do that is at the relay board. Mentioned relay pin is where your Arduino controls the relay. If you use a too large capacitor, the relay will take some time to switch off (act sluggish).

MAS3: Moving the relay board is part of debugging, it's not a definitive solution. So just put it as far away as possible with the current setup. If you have some available, use a 100nF capacitor and connect it between the relay pin and GND. I think best position to do that is at the relay board. Mentioned relay pin is where your Arduino controls the relay. If you use a too large capacitor, the relay will take some time to switch off (act sluggish).

I will place the relay board at the current max distance to see if the display keeps working.

The 100nF capacitor, any special kind ? Because I will just go out and buy what I need, the prices of these are small really.

Also, there are 4 channels/relays: would I need to place one for each relay ? or just the one driving the the device with inductive load ?

Indeed these are just a few cents. So use one for every channel in use. Also keep the wiring apart. That means do not route all wires together, keep the control and the (230 volt) power lines apart from each other as much as possible. If these wires share a route, it will be much easier to pick up interference (which is exactly the right word for this problem).

Progress:

Earlier today picked up several 100nF capacitors. Connected one for each signal wire very close to the relay board, and wired it to the arduino ground.

ATM the system is running, displaying the required material for a little over 2 hours already. I forced a situation where the fans would run for several minutes and automatically switches it off, several times, no issues.

Time will tell if it keeps it up ^_^

In relation to the wiring: The wiring is totally separated, the casing has a dedicated compartment for the 220 wiring, and a divider wall between the relay board and wiring has 8 tiny holes which exactly fits the 2.2mm wiring for the 220 :)

Thanks for the helps guys !!!!

I will leave this topic as it is for 48 hours, and if it still runs (with display) I'll update the title with "solved"

You say the relay boards are "opto-isolated", but many of the cheap boards available, whilst they do have an opto-isolator on them, are not actually isolated unless you are very careful in how they are wired. Please cite (website) the relay boards that you are using - and how you have wired them (i.e., a diagram or focused photo).

Paul__B: You say the relay boards are "opto-isolated", but many of the cheap boards available, whilst they do have an opto-isolator on them, are not actually isolated unless you are very careful in how they are wired. Please cite (website) the relay boards that you are using - and how you have wired them (i.e., a diagram or focused photo).

Hi Paul,

I have the exact same model as in the picture supplied above, and am using a separate power source for the relay board.

I am aware that; would I ground the relay board directly to the arduino, I would loose the isolation.

I will take some pics if the current setup remains working. Its been close to 24 hours already, and it is still running as intended.

My setup:

Sensor shield stacked on the Uno. LCD keypad shield wired to the sensor shield.

4 digital pins from the sensor shield connected to the "IN" pins on the relay board. These wires are tapped into, close to the relay board, each connected to a capacitor. The other ends of the capacitors come together on a single wire leading to a ground on the sensor shield.

The VCC and ground (on the left side in the image of the relayboard) are connected to the adapter.

Jumper on the right removed.

:)

ATM, I am already very pleased, as the setup has been displaying what it should longer then any other attempts I had with it before; while its controlling 220v devices.

Sounds good except that you failed to mention the connection between the "com" terminal on the relay board, and your Arduino (sensor shield) ground.

Paul__B: Sounds good except that you failed to mention the connection between the "com" terminal on the relay board, and your Arduino (sensor shield) ground.

Hmm, I did not forget, as it is not connected.

It is not wired up, and jumper removed ....

Does this mean its abusing the grounded capacitors ?

That's not clear to me. Not wired AND no jumper. Does that mean that there is only 1 single wire to each optocoupler ?

The jumper should indeed be open. But there should be a circuit, meaning that both wires to the optocoupler should be used in order to complete that circuit. I can't see how else the LED inside the optocoupler could be lit else.

A capacitor forms a barrier to DC signals, but is a short to pulses. That way it can do its filter function which you are using at the moment.

MAS3: That's not clear to me. Not wired AND no jumper. Does that mean that there is only 1 single wire to each optocoupler ?

The jumper should indeed be open. But there should be a circuit, meaning that both wires to the optocoupler should be used in order to complete that circuit. I can't see how else the LED inside the optocoupler could be lit else.

A capacitor forms a barrier to DC signals, but is a short to pulses. That way it can do its filter function which you are using at the moment.

Yes ... nothing on the ground and com pins. (which can be jumpered)

What you mention makes perfect sense to me, but, am a bit confused that it is working atm.

:cold_sweat:

edit: I am not near the setup atm, I will take some pictures tomorow.

Lennaert: I am not near the setup atm, I will take some pictures tomorrow.

That will be interesting.

The point is, you need the optocoupler return line - the one marked "COM" - to go to the Arduino ground in order to drive the opto-couplers. I am in fact, puzzled that anything worked at all (unless it just happens to be fitted with EL814s which is a very interesting possibility, as these appear to be very cheap on eBay) without that reference connection.

Paul: your link results in a 404 message (page not found) to me.

Google helped with that though. It is an AC optocoupler, which should also need 2 wires, doesn't it ?

MAS3: Paul: your link results in a 404 message (page not found) to me.

Fixed - sort of. The link was from Google, and it worked before, seems Everlight have recently repudiated the product.

I do wish manufacturers would provide datasheets which could be found on Google instead of all the rubbish/ unhelpful "datasheets" sites.

MAS3: Google helped with that though. It is an AC optocoupler, which should also need 2 wires, doesn't it ?

My thought was that if for whatever reason (and it does make sense, because it would work with either a common positive or common negative to the group of opto-isolators) they fitted EL814s (originally, a Sharp PC814), then if the common is not connected, pulling one input high and another low would activate both optocouplers. Not necessarily deliberately, but would explain it apparently working with no common connection.