EEVblog Electronics Community Forum

Electronics => Beginners => Topic started by: vmallet on July 15, 2020, 05:47:07 pm

Title: What does this diode do?
Post by: vmallet on July 15, 2020, 05:47:07 pm
I am looking at the insides of a cheap wifi smart plug and trying to understand the power supply circuitry. It seems to be using a MP150 (Offline primary-side regulator) by MPS (datasheet: https://www.monolithicpower.com/en/documentview/productdocument/index/version/2/document_type/Datasheet/lang/en/sku/MP150/ (https://www.monolithicpower.com/en/documentview/productdocument/index/version/2/document_type/Datasheet/lang/en/sku/MP150/))

From what I've been able to tell they are using a design that is really close to the reference design on page 16 of the linked datasheet. Here's a screenshot:
[attachimg=1 width=600]

The question is about diode D4 that returns to the Neutral wire. Is it strictly needed? What does it bring to the picture, and what would happen if we got rid of it?

The reason I am asking is that when I was looking at the smart plug's PCB, I was confused by a couple of things about that same diode (labeled D5 on the PCB):
*) the silkscreen around D5's footprint shows no indication of orientation which is quite unusual for a diode
*) the diode itself has an unusual shape, with no markings whatsoever (so how do you figure out orientation?)
*) after removing D5 from the PCB and testing, it appears D5 is not a diode but just a straight jumper; Ohmmeter reads about 0 Ohm.

Here's a picture of the PCB showing the D5 footprint, and the actual D5 component sitting on the trace right to the left of the D5 footprint:
[attachimg=2 width=400]

Did they initially intend to have a diode here like in the reference design but eventually chose to replace it with a 0 Ohm resistor for costs? or for some other reason? Or is there something else that I am not seeing right here?

Thanks for any insight..

  Vince.
Title: Re: What does this diode do?
Post by: sahko123 on July 15, 2020, 06:43:18 pm
D4 is used as a rectifier to get the negative rail of the powersupply
Title: Re: What does this diode do?
Post by: wraper on July 15, 2020, 06:50:31 pm
D4 is used as a rectifier to get the negative rail of the powersupply
It's already rectified by D2. Also there is no negative rail. Only positive rail and GND.
Title: Re: What does this diode do?
Post by: exe on July 15, 2020, 07:19:56 pm
Looks redundant to me, unless for some reason they need to lift ground one diode drop above N, which is unlikely.
Title: Re: What does this diode do?
Post by: bob91343 on July 15, 2020, 07:41:51 pm
It may be a fuse rather than a diode or jumper.  That circuit is not good, as it provides no isolation.  Isolation is important much of the time.
Title: Re: What does this diode do?
Post by: Monkeh on July 15, 2020, 07:44:24 pm
That circuit is not good, as it provides no isolation.  Isolation is important much of the time.

Isolation is not required for the application. Pissing money and space away for no gain is not good.
Title: Re: What does this diode do?
Post by: Syntax Error on July 15, 2020, 07:52:57 pm
What happens if the live and neutral are wired the other way round in the domestic power socket? Or the power socket is one of those odd european ones that can be plugged in either way around? Is D4 some reverse protection feature?
Title: Re: What does this diode do?
Post by: exe on July 15, 2020, 08:11:38 pm
Oh shi~, this thing is meant to be plugged into mains?? I'd dump it immediately. Here is a good reading about dangers of non-isolated power supplies https://sound-au.com/articles/power-supplies2.htm#s7
Title: Re: What does this diode do?
Post by: wraper on July 15, 2020, 08:19:17 pm
Oh shi~, this thing is meant to be plugged into mains?? I'd dump it immediately. Here is a good reading about dangers of non-isolated power supplies https://sound-au.com/articles/power-supplies2.htm#s7
If it's used in a fully enclosed device, say smoke detector, there is nothing wrong about it.
Title: Re: What does this diode do?
Post by: Monkeh on July 15, 2020, 08:29:03 pm
Oh shi~, this thing is meant to be plugged into mains?? I'd dump it immediately. Here is a good reading about dangers of non-isolated power supplies https://sound-au.com/articles/power-supplies2.htm#s7

While we're at it, let's stop using ovens, washing machines, dishwashers, and all the other devices which use non-isolated supplies.
Title: Re: What does this diode do?
Post by: capt bullshot on July 15, 2020, 08:40:05 pm
I am looking at the insides of a cheap wifi smart plug and trying to understand the power supply circuitry. It seems to be using a MP150 (Offline primary-side regulator) by MPS (datasheet: https://www.monolithicpower.com/en/documentview/productdocument/index/version/2/document_type/Datasheet/lang/en/sku/MP150/ (https://www.monolithicpower.com/en/documentview/productdocument/index/version/2/document_type/Datasheet/lang/en/sku/MP150/))

From what I've been able to tell they are using a design that is really close to the reference design on page 16 of the linked datasheet. Here's a screenshot:
(Attachment Link)

The question is about diode D4 that returns to the Neutral wire. Is it strictly needed? What does it bring to the picture, and what would happen if we got rid of it?

That diode (together with D2) disconnects the circuitry for most of the phase angle from both lines of the mains supply. I guess it's supposed to help with EMC and common mode interference. For the primary purpose (rectification of the mains) it's not strictly required and the circuit should work with D4 shorted.
Title: Re: What does this diode do?
Post by: james_s on July 15, 2020, 10:01:55 pm
Oh shi~, this thing is meant to be plugged into mains?? I'd dump it immediately. Here is a good reading about dangers of non-isolated power supplies https://sound-au.com/articles/power-supplies2.htm#s7
If it's used in a fully enclosed device, say smoke detector, there is nothing wrong about it.

It says right in the first post that it's a WiFi smart plug, so fully enclosed commercial product. Non-isolated supplies are commonplace in this sort of thing, many are just a capacitor dropper.
Title: Re: What does this diode do?
Post by: bdunham7 on July 15, 2020, 10:47:34 pm
Does this have a three-wire plug with ground, and if so, does that ground pin connect directly to the point in the circuit indicated by GND?  If so, I hope everyone tests their sockets for correct wiring before plugging this in!
Title: Re: What does this diode do?
Post by: bdunham7 on July 15, 2020, 10:50:30 pm
Oh shi~, this thing is meant to be plugged into mains?? I'd dump it immediately. Here is a good reading about dangers of non-isolated power supplies https://sound-au.com/articles/power-supplies2.htm#s7

While we're at it, let's stop using ovens, washing machines, dishwashers, and all the other devices which use non-isolated supplies.

You can have isolated, isolated with ground reference or non-isolated, but you can't have non-isolated with an internal ground reference.  Some older kitchen ranges allowed something like that, but they've since thought better of it.
Title: Re: What does this diode do?
Post by: wraper on July 15, 2020, 10:51:53 pm
Does this have a three-wire plug with ground, and if so, does that ground pin connect directly to the point in the circuit indicated by GND?  If so, I hope everyone tests their sockets for correct wiring before plugging this in!
:palm: GND is not earth. Only insane would connect earth to such GND. Not to say this circuit is from datasheet of a quite significant IC manufacturer.
Title: Re: What does this diode do?
Post by: wraper on July 15, 2020, 10:56:53 pm
You can have isolated, isolated with ground reference or non-isolated, but you can't have non-isolated with an internal ground reference.  Some older kitchen ranges allowed something like that, but they've since thought better of it.
Please stop embarrassing yourself. GND is simply a 0V reference point you select and call it GND. For convenience, it's usually a negative power rail/or common reference point in the middle of rails with different polarity. Nothing to do with earth as such.
Title: Re: What does this diode do?
Post by: bdunham7 on July 15, 2020, 11:06:43 pm
Please stop embarrassing yourself. GND is simply a 0V reference point you select and call it GND. For convenience, it's usually a negative power rail/or common reference point in the middle of rails with different polarity. Nothing to do with earth as such.

I really do understand all that and obviously agree it would be bad practice to make that connection.  However, if it is isolated, there's no need to draw it that way--it's just V+ and V-.  I think it is unnecessary and a bad practice, at least for an actual component schematic.  Since this is a Wi-Fi smart plug and IS NOT totally enclosed--it has outputs, I'd be curious as to how it is actually connected. I didn't see that it was a datasheet and not the actual schematic.
Title: Re: What does this diode do?
Post by: Monkeh on July 15, 2020, 11:10:22 pm
Please stop embarrassing yourself. GND is simply a 0V reference point you select and call it GND. For convenience, it's usually a negative power rail/or common reference point in the middle of rails with different polarity. Nothing to do with earth as such.

I really do understand all that and obviously agree it would be bad practice to make that connection.  However, if it is isolated, there's no need to draw it that way--it's just V+ and V-.  I think it is unnecessary and a bad practice, at least for an actual component schematic.  Since this is a Wi-Fi smart plug and IS NOT totally enclosed--it has outputs, I'd be curious as to how it is actually connected. I didn't see that it was a datasheet and not the actual schematic.

It is absolutely normal to refer to your reference as ground even if it's not tied to earth. And no, it is totally enclosed, none of the circuitry inside is exposed, nor are the contacts for obvious reasons.
Title: Re: What does this diode do?
Post by: bdunham7 on July 15, 2020, 11:20:41 pm
It is absolutely normal to refer to your reference as ground even if it's not tied to earth. And no, it is totally enclosed, none of the circuitry inside is exposed, nor are the contacts for obvious reasons.

 :horse:

I'm perfectly aware that it is common to do so and no matter how many time I see it I still think it is a bad practice when applied to mains-powered devices that actually DO have a real earth ground.

OP:  Sorry if I crapped on your thread.  I've no idea why D4 is there in the context presented.  The simpler typical application schematic at the beginning of the datasheet doesn't have it.  Perhaps the manufacturer of  your device just copied the application schematic and later realized that D4 was unnecessary.
Title: Re: What does this diode do?
Post by: wraper on July 15, 2020, 11:33:21 pm
I really do understand all that and obviously agree it would be bad practice to make that connection.  However, if it is isolated, there's no need to draw it that way--it's just V+ and V-.  I think it is unnecessary and a bad practice, at least for an actual component schematic.  Since this is a Wi-Fi smart plug and IS NOT totally enclosed--it has outputs, I'd be curious as to how it is actually connected. I didn't see that it was a datasheet and not the actual schematic.
Hell no, V- is not a 0V reference point. And circuits with isolation like SMPS are often drawn with 2 separate GND.
Title: Re: What does this diode do?
Post by: james_s on July 16, 2020, 12:59:12 am
I really do understand all that and obviously agree it would be bad practice to make that connection.  However, if it is isolated, there's no need to draw it that way--it's just V+ and V-.  I think it is unnecessary and a bad practice, at least for an actual component schematic.  Since this is a Wi-Fi smart plug and IS NOT totally enclosed--it has outputs, I'd be curious as to how it is actually connected. I didn't see that it was a datasheet and not the actual schematic.

In the US it would be very rare for something like this to have an earth ground, if it does it will be a passthrough to the socket on it.

I'm not sure what you're talking about in regards to outputs, of course it will have an output, but that will be a receptacle to plug a lamp or appliance into, not bare metal binding posts or something. It still counts as totally enclosed, nobody in their right mind would expect the receptacle on such a device to be isolated and safe to poke a paperclip into. By "totally enclosed" it just means that no user-accessible low voltage connections that could be at mains potential are exposed.
Title: Re: What does this diode do?
Post by: vmallet on July 16, 2020, 04:08:59 pm
Thanks for the answers. Bottom line D4 is not really necessary and they must have copied the design with the diode in there and eventually decided to do away with it; maybe it was too late to change the PCB so they just swapped the part with a jumper. The thing that doesn't add up in that story is the silkscreen for the diode footprint (D5 on the PCB) looks like that of a resistor, not a diode. If they could change the silkscreen surely they could have changed the footprint?

The discussion about grounds and earth was useful too, there is always something to learn!

The plug is definitely totally enclosed and seriously sealed too, it took some good effort to get to the PCB. I've also come to understand the danger associated with mains-powered devices like these and non-isolated power supplies, and there are a lot of them out there!

Here's the plug:
[attachimg=1]
Title: Re: What does this diode do?
Post by: exe on July 16, 2020, 05:12:01 pm
looks like that of a resistor, not a diode.

Why so? Look at, e.g., sod-323 or melf packages, they are pretty similar it terms of foot-prints.
Title: Re: What does this diode do?
Post by: vmallet on July 16, 2020, 05:41:10 pm
looks like that of a resistor, not a diode.

Why so? Look at, e.g., sod-323 or melf packages, they are pretty similar it terms of foot-prints.

Right, the footprint is fine; it's the lack of orientation indicator on the silkscreen that makes me say that. If you look at the picture of the PCB in the first post there's nothing to tell us in which direction to put the D5 diode, vs. say D4 or D3 that have the usual silkscreen markings.
Title: Re: What does this diode do?
Post by: bdunham7 on July 16, 2020, 06:09:10 pm
Right, the footprint is fine; it's the lack of orientation indicator on the silkscreen that makes me say that. If you look at the picture of the PCB in the first post there's nothing to tell us in which direction to put the D5 diode, vs. say D4 or D3 that have the usual silkscreen markings.

Probably just a sloppy process where one person laid out the PCB according to the reference schematic and then another 'thrifted' it and eliminated the unnecessary part but with minimal effort--replacing it with the jumper but still calling it D5.  Who knows how this happens--you'd have to be there to know the story.  Can you post a photo of the whole board?  I'm just curious how it is laid out in that small a package.
Title: Re: What does this diode do?
Post by: exe on July 17, 2020, 08:56:50 am
Right, the footprint is fine; it's the lack of orientation indicator on the silkscreen that makes me say that. If you look at the picture of the PCB in the first post there's nothing to tell us in which direction to put the D5 diode, vs. say D4 or D3 that have the usual silkscreen markings.

Ah, I see. Well, I've seen people designing their pcbs right in the router by placing footprints directly, without creating a schematic first. Some people prefer to use some weird and obscure pcb routers... I mean, I'm not surprised by weird-looking pcbs that don't match schematics.
Title: Re: What does this diode do?
Post by: David Hess on July 17, 2020, 10:43:38 am
Safety regulations might require it not to fail destructively on the input if a part shorts in which case two diodes are used in series.
Title: Re: What does this diode do?
Post by: james_s on July 18, 2020, 12:39:36 am
Ah, I see. Well, I've seen people designing their pcbs right in the router by placing footprints directly, without creating a schematic first. Some people prefer to use some weird and obscure pcb routers... I mean, I'm not surprised by weird-looking pcbs that don't match schematics.

That's a really dumb way to design a PCB in this era. Even back in the days where you'd draw the traces by hand or tape it out for production you'd start with a schematic. Trying to lay out a board without a schematic is putting the cart before the horse and is begging for errors to creep in.
Title: Re: What does this diode do?
Post by: vmallet on July 18, 2020, 02:33:03 am
Can you post a photo of the whole board?  I'm just curious how it is laid out in that small a package.

Here goes:
[attachimg=1 width=400]

I was working on a full teardown post that I finished today, many more pictures there if interested:
https://vmallet.com/2020/07/gosund-wp3-smart-plug-teardown-and-schematic/ (https://vmallet.com/2020/07/gosund-wp3-smart-plug-teardown-and-schematic/)
Title: Re: What does this diode do?
Post by: vmallet on July 18, 2020, 02:39:24 am
Safety regulations might require it not to fail destructively on the input if a part shorts in which case two diodes are used in series.
Oh I see. Then is it safe to say that in the MPS design we could theoretically use just D4 to do the rectification (with D2 shorted) but it wouldn't be as conventional (or intuitive)?
Title: Re: What does this diode do?
Post by: Zero999 on July 18, 2020, 11:49:37 am
It is absolutely normal to refer to your reference as ground even if it's not tied to earth. And no, it is totally enclosed, none of the circuitry inside is exposed, nor are the contacts for obvious reasons.

 :horse:

I'm perfectly aware that it is common to do so and no matter how many time I see it I still think it is a bad practice when applied to mains-powered devices that actually DO have a real earth ground.
It's not bad practise at all. In cases where there are different grounds, they'll have different names. For example, the 0V rail of the circuit might be labelled as chassis or simply ground, whilst the connection to real earth will be labelled as PE or protective earth, which is the standard name in the EU. The nomenclature may vary, but as long as it's clear which connection carries current and which is required for safety, there's no problem.
Title: Re: What does this diode do?
Post by: bdunham7 on July 18, 2020, 02:39:05 pm
It's not bad practise at all. In cases where there are different grounds, they'll have different names. For example, the 0V rail of the circuit might be labelled as chassis or simply ground, whilst the connection to real earth will be labelled as PE or protective earth, which is the standard name in the EU. The nomenclature may vary, but as long as it's clear which connection carries current and which is required for safety, there's no problem.

 :horse: :horse:

Is it clear in this case?  Or is it just obvious after looking at the circuit, provided you understand mains power as well? It was really the symbol and extra GND designation that got my attention in this case, along with the fact that this is explicitly a mains circuit with L, N, and G.  If the only issue was one of the outputs being labeled GND I wouldn't have made a peep.

There have been many discussions about what various ground symbols mean and I've understood them to mean this:

[attachimg=1]

However, that's not an authority.  So I went and looked on the internet for 10 seconds and I learned something.  There is an explicit standard.

[attach=2]

So, by this standard the reference diagram from Monolithic is, well, wrong.  Perhaps an intern drew it.  The problem jumped right out at me when I saw it and hopefully 99% of people that see it will quickly realize that the ground prong shouldn't be connected there--but perhaps some manufacturer somewhere will have another intern 'just implement the datasheet reference'.

Here's how I think the reference diagram should look--leaving aside the original question of the extra diode.

[attach=3]

EDIT: There is a flaw in my argument, but I'll let someone else point it out if anyone cares...

Title: Re: What does this diode do?
Post by: bdunham7 on July 18, 2020, 02:51:18 pm
I was working on a full teardown post that I finished today, many more pictures there if interested:
https://vmallet.com/2020/07/gosund-wp3-smart-plug-teardown-and-schematic/ (https://vmallet.com/2020/07/gosund-wp3-smart-plug-teardown-and-schematic/)

Very nice work and schematic!  Also, that's quite a BOM for a $6 device.
Title: Re: What does this diode do?
Post by: SparkyFX on July 18, 2020, 05:28:09 pm
I'd agree that in a steady state operation this would not make much difference for the functionality, which means it is either needless or for safety and protection.

It's probably designed for the world market, which implies reversible mains plug. I wonder what happens to the charged capacitor if you plug it out and put it in reverse while its charged without D4.