PWM Signal lights with arduino only when low-beams on

First topic (no answer):
https://forum.arduino.cc/index.php?topic=426161.msg2937800#msg2937800

I’m trying to power up my signal lights from my car using a MOSFET with PWM signal from arduino.

There are some modules to do that on the local market but i want to build one not to buy one
The module is originaly set to 50% duty and is connected like so :
3 wires witch needs to be connected:
~1 is connected to the positive wire from the low beams
~2 is connected to one side of the signal lights wire (CUTTED)
~3 is connected to the other side of the cutted wire of the signal lights (from the car)

So, i’ll power the signal lights using the low beams wire.

I also need a signal when the LOW-beams are on, in order to send the PWM signal from arduino just when is needed

I used a voltage divider - 30k-13k to get a low voltage even the car give me 16V, a zener diode, in case and also a 100nf cap

initial schematic (not so important): http://i.giphy.com/3o7TKuZGIx4Z7l9iOQ.gif

the circuit

(1,2,3 are the wires that come out of the module)

after soldering it i just realised it is a total fail

to fix the secound schematic i suppose that i need another wire witch will be connected to ground
(witch is not present on the market module)

I’m sorry for english hope you’ll understand and give me some informations

I suggest you do some research online about schematics and learn how to draw a schematic correctly.

1- The switching device should be shown at the right side
2- the signal source should originate on the LEFT side
3- all power sources should be shown at the TOP
4- voltage dividers should be shown VERTICALLY , (not horizonally)
5- relay can be on the right but relay COIL must be shown (you don’t have one in your schematic)
6- zener diodes should be shown verical with cathode at TOP and anode at BOTTOM of page
7-mosfet symbol is incorrect (research N-CHANNEL mosfet symbol
8-Mosfet should be on the right with GATE pointing toward LEFT of page
9-battery symbols should be shown VERTICAL not HORIZONTAL
10- MOSFET switched loads should be shown ABOVE the n-channel mosfet and arranged in an orderly
fashion .
11- N-channel mosfet should have SOURCE at the BOTTOM and DRAIN at the TOP. (with gate on LEFT)
12- GND symbol to the right of the #5 should point DOWN , not UP.

In short, everything in your schematic is either upside down or sideways and in the wrong location.
It looks like it was scrambled in a blender and then thrown on the page.

While you may not appreciate these comments, you should accept that they are correct and how it makes you feel should not be a consideration. The only concern should be learning how to do it correctly, which, I can assure you, it is not. I am not going to comment on whether the circuit is “electrically correct” (meaning whether or not it would actually work as wired) because I think that at this point it is irrelevant. The schematic should be scrapped and you should start over. Posting for help should begin by presenting the information as it should be presented, rather than focusing on function (whether it would work) and ignoring presentation. The reason I say this is that if you want help, you should present a schematic that people would find “acceptable” or “normal” , not one that is completely messed up beyond repair. Google "mosfet relay lamp switching circuit " and look at how the component symbols are arranged.
I could redraw it but I think you should do that since it’s your circuit.

After you redo the schematic we can look at the circuit and see what the issue is.

raschemmel:
I suggest you do some research online about schematics and learn how to draw a schematic correctly.

1- The switching device should be shown at the right side
2- the signal source should originate on the LEFT side
3- all power sources should be shown at the TOP
4- voltage dividers should be shown VERTICALLY , (not horizonally)
5- relay can be on the right but relay COIL must be shown (you don’t have one in your schematic)
6- zener diodes should be shown verical with cathode at TOP and anode at BOTTOM of page
7-mosfet symbol is incorrect (research N-CHANNEL mosfet symbol
8-Mosfet should be on the right with GATE pointing toward LEFT of page
9-battery symbols should be shown VERTICAL not HORIZONTAL
10- MOSFET switched loads should be shown ABOVE the n-channel mosfet and arranged in an orderly
fashion .
11- N-channel mosfet should have SOURCE at the BOTTOM and DRAIN at the TOP. (with gate on LEFT)
12- GND symbol to the right of the #5 should point DOWN , not UP.

In short, everything in your schematic is either upside down or sideways and in the wrong location.
It looks like it was scrambled in a blender and then thrown on the page.

While you may not appreciate these comments, you should accept that they are correct and how it makes you feel should not be a consideration. The only concern should be learning how to do it correctly, which, I can assure you, it is not. I am not going to comment on whether the circuit is “electrically correct” (meaning whether or not it would actually work as wired) because I think that at this point it is irrelevant. The schematic should be scrapped and you should start over. Posting for help should begin by presenting the information as it should be presented, rather than focusing on function (whether it would work) and ignoring presentation. The reason I say this is that if you want help, you should present a schematic that people would find “acceptable” or “normal” , not one that is completely messed up beyond repair. Google "mosfet relay lamp switching circuit " and look at how the component symbols are arranged.
I could redraw it but I think you should do that since it’s your circuit.

After you redo the schematic we can look at the circuit and see what the issue is.

I really appreciate your post, I had no idea that there are schematics rules, I had no school or anything for electronics just 3 months or watching videos/turorials/circuits

The icons on the schematic are not made by me, this is how the program shows them(the easiest program that I got)

The relay was a part of the car and I did’t wanted to drawn them too and it isn’t about the relay at all all that matter is the ground wire

The only thing that makes me mad is saying about leaving electronics, witch your didn’t said like others


(D1,D2 - n4001)
(N-channel mosfet - CEP50n06)

The redrawn schematic is almost correct. I will get back to you about that. It is good enough now to work with so I think we can just say it's ok and move on. I did not say anything about leaving electronics. Post a quote of where you think I said that. It does not sound like anything I would ever say. It must be a a language translation error.

Using the new schematic, state your project objective and the current probllem (issue) I recall you said something about detecting low beam . Please post the voltage measured with a meter at the output of the voltage divider to arduino I am not sure why you said the prototype board you built was a failure. What is the problem ? ( reason for your post).

raschemmel: The redrawn schematic is almost correct. I will get back to you about that. It is good enough now to work with so I think we can just say it's ok and move on. I did not say anything about leaving electronics. Post a quote of where you think I said that. It does not sound like anything I would ever say. It must be a a language translation error.

Using the new schematic, state your project objective and the current probllem (issue) I recall you said something about detecting low beam . Please post the voltage measured with a meter at the output of the voltage divider to arduino I am not sure why you said the prototype board you built was a failure. What is the problem ? ( reason for your post).

1.I said, i appreciate you because you didn't said about leaving electronics.

2.On the prefboard i don't have a GROUND wire, the 4 grounds from the image(bottom page) are connected to mosfet source, witch i think is not good at all (i showed that in the first schematic) And this is why i didn't tested the module. Why no ground? because i'm thinking at the market module witch like i said have only 3 wires(see #1 post)

3.After i builded the project on this "simulator" i found that there is a problem like: The current goes from the signal lights wire, through the mosfet, back to the voltage divider. and also, to the low beams, i don't know if this is gonna happend in real life, i tought the mosfet it like multiple diodes.

This is really dangerous from my opinion and this is why i ask for help, ~3 amps will go through this module and i'm feeling skeptical about it.

All GNDs go to arduino GND, correct ?

What do you want the mosfet to switch ? (whst is purpose of mosfet ?)

raschemmel: All GNDs go to arduino GND, correct ?

What do you want the mosfet to switch ? (whst is purpose of mosfet ?)

so i can't connect them to the mosfet source right?

I am talking about the GND symbols in the schematic . They are ground symbols so what they mean is that they are connected to the auto GND AND the arduino GND. The arduino must have a common ground with auto so that means all GND symbols are arduino ground. Is this what you meant when you drew the schematic ? I can only tell you what your schematic means . I can't tell if that is what you intended.

First of all, the schematic you posted requires a P-channel mosfet because it is a HIGH SIDE SWITCH (the switch (mosfet) is between the power source and the load. An N-channel mosfet would REQUIRE that the mosfet source be connected DIRECTLY to GND. That is NOT what you have. Your schematic shows a HIGH SIDE switch BECAUSE the mosfet is between the power source and the load (lights), so if that is an N-channel mosfet in your schematic then the schematic is not correct yet. That mosfet would only work if it was between the load (lights) and GND. You have to move the mosfet or change it to a P-channel mosfet. That I can tell you for a fact. Your circuit as shown will not work. As far as this question is conserned"

so i can't connect them to the mosfet source right?

it looks like we have a ways to go before we are on the same page. The mosfet you have shown does NOT have it's source connected to GND like an N-channel mosfet should. The GND symbols mean the "-" side of the auto battery and the arduino GND. That's what they mean in your schematic. I cannot tell you if that is what you meant when you put them there. Only you can say that. You need to understand what they mean when you put them in the schematic. 1- fix the mosfet problem 2- confirm what you mean about the GNDs. if you are asking this:

so i can't connect them to the mosfet source right?

then we still have a problem with your understanding of electronics.

What is the purpose of D1 & D2 ?

Throw away the 5.1V Zener. It is hurting your circuit, not helping it. It is not necessary as a protection device.

The thing with Zeners is they have a significant amount of conduction below the nominal Zener voltage. That voltage is measured at a specific current, like 20mA or 1mA. You have micro Amps in this circuit so the Zener will hold the voltage down a lot lower than 5.1V. Then if there is an over-voltage fault with high current, the voltage across the Zener will rise higher than the nominal voltage, meaning it is not protecting your circuit.

The primary protection against your circuit being zapped by a fault is R1, the 30k resistor. For just 1mA to flow into your circuit, there would have to be a voltage differential of 30V across that resistor. That is much more than any fault other than a nearly direct hit by lightning. 1mA is easily handled by the internal protection diodes inside the Arduino's chip.

Personally I would use a 10k resistor for R1 and just scrap the rest of the components there. If you need analog debouncing, then keep the capacitor.

MorganS: Throw away the 5.1V Zener. It is hurting your circuit, not helping it. It is not necessary as a protection device.

The thing with Zeners is they have a significant amount of conduction below the nominal Zener voltage. That voltage is measured at a specific current, like 20mA or 1mA. You have micro Amps in this circuit so the Zener will hold the voltage down a lot lower than 5.1V. Then if there is an over-voltage fault with high current, the voltage across the Zener will rise higher than the nominal voltage, meaning it is not protecting your circuit.

The primary protection against your circuit being zapped by a fault is R1, the 30k resistor. For just 1mA to flow into your circuit, there would have to be a voltage differential of 30V across that resistor. That is much more than any fault other than a nearly direct hit by lightning. 1mA is easily handled by the internal protection diodes inside the Arduino's chip.

Personally I would use a 10k resistor for R1 and just scrap the rest of the components there. If you need analog debouncing, then keep the capacitor.

From what i readed on arduino forum(forgot the topic name) i found that a cap will reduce the risk of a high voltage entering arudino

I also used the zener in other reading module(same divider) shoud i unsolder them all ? is there any problem if i use them in term of damaging the arduino or something else ? I could simple unsolder them if there is a problem.

raschemmel: 1.I am talking about the GND symbols in the schematic . They are ground symbols so what they mean is that they are connected to the auto GND AND the arduino GND. The arduino must have a common ground with auto so that means all GND symbols are arduino ground. Is this what you meant when you drew the schematic ? I can only tell you what your schematic means . I can't tell if that is what you intended.

  1. fix the mosfet problem

3.What is the purpose of D1 & D2 ?

  1. The thing is that i was trying to figure it out, how does the market module for this "signal lighs" works, without a ground wire

  2. i already ordered 2 p-channel mosfets that will handle that current (i'll quote you when they arrive) EDIT: IRF9Z34NPBF Vdss: -55V Rds = 0.1 Id = -19A

  3. I tought if i won't use those diodes, the current will flow back to the relays or something, like a protection witch i'm not sure about

Thanks for your answers, so far you really helped me a lot

  1. I tought if i won't use those diodes, the current will flow back to the relays or something, like a protection witch i'm not sure about

D2 is on the wrong side of the load. D1 is not a problem because the resistor prevents excessive current. D2 is a BIG problem because it is on the wrong side of the load (lights) . When the mosfet turns on there is no load between D2 and the battery so the wire will conduct full current and melt , catch fire and since there is no fuse it will continue to conduct until the fire indefinately because the wire will get hot and melt the insulation and start the fire but it will not get hot enough to melt the wire itself so the current will continue to conduct until the mosfet or diode burns up and opens up the circuit. That D2 diode cannot be there, period.

raschemmel: D2 is on the wrong side of the load. D1 is not a problem because the resistor prevents excessive current. D2 is a BIG problem because it is on the wrong side of the load (lights) . When the mosfet turns on there is no load between D2 and the battery so the wire will conduct full current and melt , catch fire and since there is no fuse it will continue to conduct until the fire indefinately because the wire will get hot and melt the insulation and start the fire but it will not get hot enough to melt the wire itself so the current will continue to conduct until the mosfet burns up and opens up the circuit. That D2 diode cannot be there, period.

but, if there is no D2, when i turn on the mosfet, what if the current will flow back to where is connected at

In my schematic i draw a simple switch cause i don't really know how my car is sending power to it, but i suppose is a relay, what do you think ?

but, if there is no D2, when i turn on the mosfet, what if the current will flow back to where is connected at

[EDIT]

Actually, I was wrong about that diode. It is connected the right way because it is already connected to the source of the mosfet and the polarity prevents current from conducting through the mosfet, but it still serves no purpose and the mosfet is still the wrong type for that location.

prologikus: From what i readed on arduino forum(forgot the topic name) i found that a cap will reduce the risk of a high voltage entering arudino

Not really. For DC voltages it will make no difference. For some cases of spikes, it will help. It should not be considered a protection against anything. You will probably buy a 25V type, which means it would be damaged by anything above 25V. It therefore also relies on R1 for protection.

I also used the zener in other reading module(same divider) shoud i unsolder them all ? is there any problem if i use them in term of damaging the arduino or something else ? I could simple unsolder them if there is a problem.

Without seeing your schematic for the other inputs, I would not recommend changing anything. If it works, then don't change.

  1. The thing is that i was trying to figure it out, how does the market module for this "signal lighs" works, without a ground wire

Which module? Show a link. Use [ url ] tags on the link. It's not important anyway.

  1. i already ordered 2 p-channel mosfets that will handle that current (i'll quote you when they arrive) EDIT: IRF9Z34NPBF Vdss: -55V Rds = 0.1 Id = -19A

OK, that is more like it. That will probably do as the primary high-side switch. It will need a heatsink if you are passing more than an amp or two through it.

My favourite reference page when I forget if I need an N or P mosfet is this one: MOSFET as a Switch

So to use that MOSFET, you need to raise its gate voltage to be equal to or greater than the source voltage to turn it off. Since source will be connected to 12V in, this means you must have a way of holding this gate at 12V. To turn it on, you need at least -10V between the gate and source (the negative means the gate voltage is lower than the source.) That part is easy. Getting the high voltage will require more components as the Arduino can't output any more than 5V.

Usually you would use an N-type MOSFET - configured as a low-side switch - to switch the voltage on the P-type's gate. A pullup resistor will provide the high voltage.

A much easier alternative is to use a packaged high-side switch. My favourite is the BTS716G. It is designed for automotive switching and has a lot of features that make it very reliable and safe. You can drive it directly with an Arduino and it doesn't need a heatsink to switch very large loads.

  1. I tought if i won't use those diodes, the current will flow back to the relays or something, like a protection witch i'm not sure about

Depending on the rest of the car's electronics, feeding voltage back up the switch wire may or may not be a problem. The diode is a good insurance if you're not sure.

MorganS: Not really. For DC voltages it will make no difference. For some cases of spikes, it will help. It should not be considered a protection against anything. You will probably buy a 25V type, which means it would be damaged by anything above 25V. It therefore also relies on R1 for protection. Without seeing your schematic for the other inputs, I would not recommend changing anything. If it works, then don't change. Which module? Show a link. Use [ url ] tags on the link. It's not important anyway. OK, that is more like it. That will probably do as the primary high-side switch. It will need a heatsink if you are passing more than an amp or two through it.

My favourite reference page when I forget if I need an N or P mosfet is this one: MOSFET as a Switch

So to use that MOSFET, you need to raise its gate voltage to be equal to or greater than the source voltage to turn it off. Since source will be connected to 12V in, this means you must have a way of holding this gate at 12V. To turn it on, you need at least -10V between the gate and source (the negative means the gate voltage is lower than the source.) That part is easy. Getting the high voltage will require more components as the Arduino can't output any more than 5V.

Usually you would use an N-type MOSFET - configured as a low-side switch - to switch the voltage on the P-type's gate. A pullup resistor will provide the high voltage.

A much easier alternative is to use a packaged high-side switch. My favourite is the BTS716G. It is designed for automotive switching and has a lot of features that make it very reliable and safe. You can drive it directly with an Arduino and it doesn't need a heatsink to switch very large loads. Depending on the rest of the car's electronics, feeding voltage back up the switch wire may or may not be a problem. The diode is a good insurance if you're not sure.

The recomanded mosfet at out contry is 5.5 USD, witch is the same price at the market module, witch by the way, there is not schematic for it, i searched a lot, all i know about it is how to connect it (post 1) my mosfet is 0.30 USD, but as i read from your post, it's getting complicate to use that p channel mosfet( i never used one before ) but maybe with a transistor and a resistor i can do the work ?

I really don't know about p channel mosfets, i'll read about them soon

the original name for the module is : us lights module and looks like this: |375x500

there are also more modules, bigger, more wires, but this is the simplest, modern one

You still haven't explained what the whole point of this module is. What does it do ? Why do you want it ? I saw the circuit simulation but you haven't explained the purpose of the module.

Also, I know you think it probably isn't necessary and possibly you aren't even aware of it , but the simulation does not actually show the arduino. It shows a resistor labeled "resistencia arduino" (representing the input impedance of the arduino ADC). It shows a voltage of 4.3V or 0V on that resistor which represents the entire arduino. (because it is grounded at the right side of that resistor). There is also a switch between the zener and the arduino input but no indication of the function of that switch. It would help if you outline the operation of the module step by step , listing all the possible conditions for the module and the function (purpose) of each. There are two battery symbols labeled "Volts for car lights " and "volts for signal". The anode of each of the diodes is connected to the battery source. It looks like the mosfet can switch the lights when the turn signal is not on but it is not clear why.

raschemmel: You still haven't explained what the whole point of this module is. What does it do ? Why do you want it ? I saw the circuit simulation but you haven't explained the purpose of the module.

basically i want to control the signal lighs using arduino, a relay would do the work but what i really want is to turn them on only 50% more or less, controled by arduino. Why ? 1.Because it looks great on my car 2.Because i also have an arduino alarm and in the future, i'll want to turn them on (need another wire with 12V to do that because the low beams won't be ON

and: like i said, i can buy a module and fix my first wish but because i already had an arduino with a alarm + led strip controled (this was done simple using n channel mos) i wanted to do the module by my self but didn't realised how hard it is

If you already have a "low beam" then what is the purpose of this project (a LOWER BEAM ?)

raschemmel:
If you already have a “low beam” then what is the purpose of this project (a LOWER BEAM ?)

No no, look at this picture:


As you can see, the signal lights are turned on, so do the low beam of the car

As the name define it “us style lights module” i think in your country, your car already have this function, but here, they don’t have it and u must use that module to turn them on like in the picture

If you have a better idea with the minimum level of damagerous it would be really nice and i can adapt to it
i think you already know what i mean by now, from all the posts.

@MorganS gived me a really good idea by using his BTS716GB, but is too expensive, it also have 4 ch witch i won’t use, i’ll try to find a cheaper ic as “HIGH SIDE POWER SW” but there are only a few shops(2-3) in a 150km range witch have a variety of components

MorganS:

There are some ics much cheaper here like: BTS730 BTS5030-1EJA BTS5231-2GS

but i don't know if i can use them with arduino