I'm designing a board based on atmega328p microcontroller in order to control some solenoids valves (2 proportional solenoids and 9 ON/OFF solenoids valves).
This is the valve datasheet. These are the solenoid details:
V = 12Vcc, R = 3.7 Ohm, I = 1.80A
This is my first PCB schematics and my first board. I power the board with 12V, 40Ah. I use Eagle and I never did something like this before so the board has many errors. In fact, I tested my first prototype and these are the problems:
- When I try to control proportional solenoids (VSX, VDX outputs), the board crashes randomly after few seconds and get stuck. I need to power off and on the board to make it works again.
- The datasheet says that the valve should draw 1.8A when powered at 12VDC, but I measured 3A when PWM is 100%. This is very strange!
In order to solve the problem, using the community suggestions, I added these modifications:
- Added a big 2200uF 35V capacitor at the main power connector
- Added a filter cap between VCC (7) and GND ( 8 ) and AREF (21) and GND (22) and AVCC (20) and GND (22) on the atmega328p
- I cut the trace on pin 22 and I directly connected it to the L7805CV GND
- Added a diode across each valves pins.
By doing this, the board can work well for 1 or 2 minutes, but then it crashes again.
Now, I'm going to design again my board, so I would like to ask you how I can fix my errors and improve my design in order to make my board works correctly.
IMPORTANT: After few experiments, I notices that if I put in series, between the mosfet output and the valve, a 20R 10W resistor, the board works OK. The problem is that the resistor becomes hot in no time. The board works fine also if I put a voltmeter in series between the mosfet output and the solenoid to measure the current: in this case, the board works fine for several time. This is very strange for me!!
I was thinking to:
- use optoisolator (like ILD213T) to control the MOSFETs
- use an isolate 5V regulator (like NME0505SC or AM1S-0505SZ) in order to isolate the atmega328p from the board
- adding filter caps on main power and on atmega328p
What do you think about this?
Can you give me some suggestions, please?
How can I limit the current to 1.8A when the PWM is at 100%?
I know that the board design is not correct, how can I improve it?
Should I use the second layer for GND traces and the upper layer for power traces only?
Please, help me!
EDIT:
I was thinking to use LM25011 with this schematics. I did this schematics by using the online TI calculator.
Can you tell me if this design could work for my board? I set the Rsense to limit current up to 1.8A at 12VDC.