I have a Arduino Uno with Lcd 16x2 with I2C module connected to scl and sda where I use state programming checking 2 input and managing 3 output with relay module.
The board is used to manage a 4-stroke generator to control from remote.
Everything it's working fine, but sometimes it seems the system is locked, on the display there charachters with no sense and the function that goes to read the input state seems not working, but the watchdog timer dosn't reset the system.
If I push the reset button on Arduino Uno th system restart and it's working properly.
I checked the watchdog introducing a loop while (1) and in this case it goes to reset the system.
Do you have an idea.
Thanks in advance.
Max
Some code, and Serial.prints might help us - and you see what’s happening.
...removed
Hi ,
It is possible that you have interference in your arduino caused by "electrical noise".
It may be that these noises come from the generator or from the on/off of the relays.
Post a schematic of your project so we can help you better.
Improve the electrical "shielding" of your Arduino.
Put it inside a metal box, for external connections use shielded cables grounded on the Arduino side, etc...
Hi, I think your idea is right, I will try to rewire the circuit following your suggestions.
Thanks.
Max
Your manipulation of character buffers looks a bit hairy but could well be OK. However, unless you are absolutely sure there will be no overflow, say of buf, it is safer to use snprintf() instead of sprintf().
sprintf can place a string left-justified in a fixed-width field,, so no need for the extra manipulation. I think %-14s would likely work, not where I can test it at the moment. buf does seem a bit small.
I would print directly to the LCD and eliminate the sprintf.
Please post the improvment, so I can test it.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.