Hi everyone, and first of all thanks to all the guys helping with troubleshooting: I've been mainly a "lurker" for the recent past but have often got solid help from browsing posts here.
As for post title, I've seen a series of thread indicating problems similar to mine, and I've got to the conclusion that in the end it's my design of the circuit that is wrong, or more specifically it's inability to cope with reverse current generated by the motors I'm trying to control: now, being a solid newbie, no wonder I can't troubleshoot it. So, circuit and board:
The only difference in actual board in respect to the schematic is that, since LM2596 output 5V, I had to connect it thorugh a wire to Arduino 5v instead of (as I originally thought) to Vin.
The diode I ended up using are STTH3R02: I originally employed 1N4007, thought trr was the problem, switched to 1N5822 but things got worse for high Ir .
The load I'm trying to control is a valve like this.
I omit the code as I've come to believe that the problem is purely electronic, plus I've probably being too lenghty
What is the source of the 12V motor supply voltage? How much current will it supply?
What is the stall current of the motor(s)?
Have you monitored the 12V with your DMM as the program runs? Does it maintain a steady and solid 12V?
Why use the piece of crap ancient and inefficient L298 driver when there are so much better drivers available for reasonable prices. See the Pololu line of DC motor drivers.
the 12v supply is a 100 Ah 12v battery of a tractor, current supply shouldn't be an issue
the only spec I can see for these electrovalves is the max current absorbtion, 1A, so 2 valves, 2A, I guess
that is something I have yet to try: do you mean measure 12V IN (battery to box) or 12 V OUT (box to valves)?
you're pefectly right on the L298, I've only later discovered L298 is what it is, the project was started a bit hastly and with poor knowledge of better alternatives and I sent the PCB to print with the above mentioned piece of crap right at the square center of my board...
Monitor the 12V where it goes into the DC-DC converter. That is the motor supply and if it dips very far can certainly effect the processor and LCD. LCDs are pretty sensitive to their supply voltage.
If the valve actuator is a motor, 1A may be the running current, but the starting (stall) current can be on the order of 10 times the running current. If the supply and/or wiring is not up to handling that magnitude of current the voltage will drop.
So, I tried test it in field condition (with current supplied from the battery) but it was unfeasable; testing voltage drop of the L298 output #1 on the bench (just 3A supply though) show something: -13 closed -> +10 while opening -> +12.8 opened. 5v out of the LM2596 is pretty stable though.
Should this be a voltage supply problem, can I obtain some "clue" in field condition substituting C1 and maybe C2, currently 100 nF (as per L298 datasheet), with something bigger?
And, could it be the L298 is faulty or something? The behaviour seems to have got worse with time: to be more precise, first times the LCD froze but Arduino kept working, now it does both, freeze LCD and Arduino.