Can I get some advice about choosing which diagram is better to drive a relay?
I want to use Arduino Nano to send some sequences at 16 Hz (0.066 ms) to the relay 12V 100 mA.
On the first try, I used Arduino Nano to drive a Mosfet but the relay sent noise to Arduino Nano.
You shouldn't need the driver.
But you should have a resistor in series with opto-isolator's LED.
And 16Hz may be too fast for your relay. You might consider a solid state relay, or maybe a MOSFET directly if the relay is controlling DC (and if it will work in your application).
You can get solid state relays that can operate directly from the Arduino, and SSRs are optically isolated.
The design using the least of components is an N channel logic MOSFET transistor switching the low side of the load. No relay at all.
Sorry I forgot to add the resistor between P-Out (Mosfet driver) and 12v in Diagram #2
My bad! Yes, I am sorry again that I forgot the resistor from Arduino Nano to optocoupler.
Good idea to use a solid-state relay. Thank you.
Both are equally useless.
There is no common ground with the Arduino, so the opto-isolator will not function.
There is, however, common ground between the input and output sides of the opto-isolator, making the use of an opto-isolator completely pointless.
Forget those diagrams, whoever drew them, they did not know what they were doing
Explain to the forum what you want to achieve in your circuit.
Thanks, PaulRB.
I want to send some sequences 16Hz (0.066ms) to a relay 12V 100mA
Please post a link to the specs of the relay.
Please explain how you calculate 0.066ms from 16Hz. I calculate it as 62.5ms. Or 15.1KHz.
And I have 10 different sequences that I control with a Rotary Encoder. For the first time, I used the output of the Arduino Nano connected to the MOSFET, but the relay sent interference to Nano and change the sequences itself.
for the relay, I tested the current with the multimeter, and was 90mA exactly but I rounded it to 100mA. And for the 16Hz I rounded too, but exactly is 33ms On and 33ms Off.
Sorry, I am typing many mistakes. Is not 0.066ms, it is 66ms.
There is great doubt that your DVM can measure any current in 33ms.
A relay can't do that with any accuracy or reliability. Plus, it will wear out within 1~2 days.
In post #6 I asked you to explain something. I will respond again when you have done that.
I tested with my DVM the current, was only 90mA.
I said 16Hz because I wrote in my Arduino code 33ms On and 33ms Off
Ok, this is my diagram. I am not an engineer or electronics technician, only a hobbyist. That is why my mistakes and my questions.
I wrote an Arduino code with some sequences for the turn signals of my truck. I can choose the sequences with a Rotary Encoder, but when the relay is working, the sequences change by themselves. That's why I added an optocoupler and the problem is gone. My question is if I have to add a Mosfet driver between the optocoupler and the power Mosfet or maybe I have to change my design.
I tested first without relays and worked fine.
Was your DVM measuring the 33ms on or the 33ms off? OR was it measuring something in between? Do you have a manual for the DVM than shows how to measure a pulsing current signal? OR does it show the actual time necessary to measure a current? My several DVMs take more than a second to measure anything.
I explained before that I measured only the current of the relay and was 90mA.
The 33ms On and 33ms Off are in my Arduino code. Thanks
Thanks! I missed that.
for (int i = 1; i < 6; i++)
{
LefturnOn();
delay(30);
LefturnOff();
delay(30);
}