The kit did not include any diodes? ![]()
OK I so I went searching for a 50 or 100 Ohm resistor. Unfortunately I did not have one. But in my search I found some 1N4148 diodes. I put it in and it works exactly the same and fails the same way (wont reset) with the stripe (I believe that's the cathode) facing the Arduino. But doesn't work at all with it the other way around. I believe this supports your claim that I have sinking and sourcing reversed. Between the Mercedes controller and ground with it not connected to the Arduino I get 12V.
Shouldn't run out of them now. You never order a quantity less than 100. ![]()
OK!
So a simple small N-Channel MosFet will do the trick. You will have to invert the PWM to compensate for the inversion of the MosFet signal.
OK so I have tried an N channel MOSFET and tried hooking it up every way I could. I possibly could have damaged it but nothing looks burnt or smells. The MOSFET is RFP30N06LE that came with the kit. I Belive that the Arduino output needs to go to the gate. I'm guessing that the source in this case should be the wire coming from the Mercedes fan controller and the drain is ground. That's just not working.
I'm sure I tried that with the one I have, but those are available on Amazon for delivery tomorrow. So I ordered it. I will try it again with the one I have but I'm not to optimistic.
Some very interesting results when trying the RFP30N06LE MOSFET again last night. It works and it works backwards as expected but like before, without the MOSFET it will not reset the Arduino. It also will not reset the Arduino if I momentarily disconnect the PMW signal. But it will reset if I let it sit for a couple of hours. The 2N7000 MOSFET should be in later today so hopefully this will work.
My guess it the Arduino is resetting after some hours from an outside signal/source. A place to start is the power supply.
I have tried disconnecting the power source to reset it. That wont work either. But the power source is a major issue. In the end this will have to operate in and automotive environment with things like starting the car and other high power components coming on at random times. I'm wondering if its possible that I damages something over all the times I was playing with wires. Especially the MOSFET which has been connected in every conceivable way. Or perhaps it just needs something in code to drive a reset when power drops below a threshold.
The Arduino board processors have WDT and Brownout protection but they have to be enabled and perhaps setup.
Automotive power is not very friendly, you will have to protect from:
- very short 1000+ volt spikes.
- 100 ms of 50V (look up load dump)
- Reverse voltage (meant if someone installs the battery backwards or maybe jump started it backwards)
- if a gasoline vehicle, the startup voltage can cycle between 5V and 8V on a cold day when the engine is cranking.
This is my first Arduino project. But I am pretty well aware of the automotive environment but not educated enough to know what to do about it. Mercedes Benz uses this 4700uF capacitor. I'm guessing it's to smooth out half of this.
For dealing with startup, I am thinking of using the alternator field output with a 12V zener diode to not allow the Arduino to turn on until a threshold of 12V is reached ie Alternator light goes out. It may also require a timer relay or circuit for maybe a 5 sec delay or so. But as always the simpler I can make it the better.
I will do a search for threads on WDT and Brownout protection.
In the mean time my 2N7000 MOSFET is due in by 5:00 PM today
New MOSFET cam in same behavior.
One of the things I tried today. I can always get it to work if I momentarily short the +5 and ground during start up so with that I decided to add some code to do exactly that on initialization. I set up an analog pin A5 to short to ground for 100ms. That didn't work so I increased the time to 1000ms and put an LED light on the A5. The LED will not light unless I physically short the 5V to ground. Apparently the Arduino is skipping the initialization code on startup.
Not a good idea.
With the Mosfet in place, can you put your scope on the drain of the MosFET? Also a quick sketch of the wiring.
Could also describe the Reset you are experiencing?
The LED will not light unless I physically short the 5V to ground. Apparently the Arduino is skipping the initialization code on startup.
What LED is this and why do you think the Arduino is skipping the Setup code?
The attached video should show how its wired. Let me know it its not clear. I also have the scope connected to the drain. And I show how I reset it. So far I haven let any smoke out. I put this code in the setup area to light a separate LED for 1 second, just to see if I was actually in the setup area of the code when running.
pinMode(Short, INPUT);
digitalWrite(Short, INPUT_PULLUP);
delay(1000);
digitalWrite(Short, LOW);
You can see the separate LED in the attached picture. It will not come on unless I short the 5V momentarily to ground as I do in the video. That's why I think its skipping the whole setup step unless I give it some time. When that light does come on it is very dim.
I have since found that this board has a reset button which can be used instead of shorting out wires. It works well.
Arduino will not reset even if its completely disconnected from the power supply and all wires removed from the bread board. Funny thing is the more I screw with this the better it gets. Time to reset is getting less and less since I first started. It also gets worse the more I mess with it. First thing in the AM I was able to start it 3 times without issue. Then I had to use the reset button which works very well. Progressive use of the system will increase the time it takes to reset by itself.
I'm starting to think this board may be damaged from lots of miss wiring and shorting things out. I will probably be ordering a new one just to rule that out.
Well I did find a solution that seems to work 100% of the time offered by a gentlemen from the All About Circuits forum. There is a reset pin on the Arduino that needs to be pulled to ground for a minimum of 2ms. He suggested a 0.1uf capacitor between the rest pin and ground. So far it works. It works both ways with the MOSFET or without. Using the MOSFET turns the power light off so I believe it is a better solution otherwise I would have parasitic drains on the battery.
I'm still suspicious about the condition of the board, as I was subjection it to a lot of abuse with shorting the wires. And I also found out that the Yourduino RoboRed can handle 2000ma but not as a signal so another good reason for the MOSFET.
I have ordered a new board and will test it both with and without the cap. I will mark this thread as solved once I get the results of that testing.
Thanks to all that participated in this thread.
New schematic with cap.
You could use an Arduino Pro Mini if you wanted.
I certainly don't need all the capability. The reason I choose the RoboRed was because it handled up to 20V input. The 12V automotive power is really 13V to 15V plus a whole lot of transients. Yet I do know people using the UNO but would that cause reliability problems? Smaller is better. Especially when I have to package everything into the smallest possible case.
If you use a Pro Mini (or similar) you could use and ST7805 regulator which will take up to 35 Volts in. Add some capacitors to filter 0.1µF out the very high spike and you should be good.
I cant find any data on the Pro Mini but I did find the Arduino Nano 33 BLE. Looks like it can handle 21V and will do the job. Not sure what the ST7805 regulator will do but the next pat of this project will be how to integrate it into a real automotive circuit. I have been reading papers on filtering the automotive circuits and I came up a paper that describes what needs to be done and different ways to do it. See attached. While the 0.1uf cap got it to work, it may really be a problem of voltage spikes that really need to be properly filtered out. I'm really suspecting some voltage spike, probably when I turn the ignition switch off is causing it to not reset, and the 0.1uf cap is just a band aid.
When I get to that phase I will probably start another thread on just that topic, Or I'm guessing there are probably threads already discussing the situation. It would be really nice if I an off the shelf voltage regulator with all that stuff built in already exists in a small package. Might that be in the ST7805 regulator?
Transient Circuit Protection.pdf (353.2 KB)




