Some general electronic questions

There are a few tricks to this.

If it is actually 9 V and you feed it into a bridge rectifier, then the peak voltage is 12.6 V but you lose 1.2 V in the bridge, so the capacitor would tend to charge to about 11½ Volts if it is lightly loaded.

However transformers are not perfect devices, have winding resistance and so one rated "9V" at a particular current will produce a significantly higher voltage when lightly loaded and this is particularly pronounced with smaller transformers such as "plug packs" (American: "Wall Warts"). If not much else is being supplied, you could well be supplying an Arduino with 16 Volts or more which may not be good for it. An LM7805 should survive.

Oh, ok thank you for your replies. I was anyways not going to feed AC to my LM7805, I'll use a rectifier IC and a 1000µF Capacitor. Then I'll use my buck converter module instead of LM7805.

Thanks for the info, I rectified my circuit but by a factor of 100.

Can you tell what that is and what I need to do to my circuit?

I found the answer:

Oh, I did not know about that. I knew that the 9V is the RMS Voltage of transformer and the actual peak voltage is √2* RMS. But inside a Wall Wart, it is rectified, step down and then it outputs regulated DC. Is this what you were also trying to say?

Found this on google for Apple IPad Charger. When tested with a USB tester they output perfect 5V!

I have a few questions on MOSFET/BJT:

  1. I feel MOSFET is much much easier to use for beginners than BJT (Actually I do not know how to use a BJT). MOSFET just require a proper Threshold Voltage (VGSth) and they turn start turning on (I know that we need to see the RDS(on) to get the voltage at which MOSFET turns on..). Can you suggest me some BJT transistor easy to control with UNO?

  2. I was just looking to buy some MOSFETs to be used as Switches with my UNO.
    I have considered any one of these: 2N7000,2N7002,IRF540N,IRFZ44N,BS170. Do you have any other recommendations?

  3. I saw somewhere that IRL MOSFET is better than the IRF, when I searched I only found IRLB8748 MOSFET in my area...Will it be ok? Also I found SI2302 with low threshold voltage but unfortunately it is SMD component...

  4. Do we require a resistor at the gate of MOSFET?

There is a good article here with references by @hbachetti
It’s in French but I guess Google translate can figure it out

Thanks for the blog, it helped me a lot (A Google translate worked perfectly!). As stated in the blog, I can switch 2A loads with 5V at gate of IRF520,IRFZ44N,IRF540 MOSFET, that is enough for my applications. I'll also buy 5-10 IRLB8748 MOSFET if required.

Also I think I must learn to use BJTs as MOSFET are not appropriate just to switch an LED,motor or something requiring small current.


It depends on what sort of "wall wart" it is. Obviously if it is an AC wall wart, it is only a transformer. Older DC ones were a transformer, bridge and capacitor, no regulation. Regulation in that respect is a problem, because a series regulator generates substantial heat.

It does because it is a complete switchmode power supply which necessarily incorporates regulation by feedback from the output. Not sure where on that diagram it is however.

Of course they are. Particularly motors which are not "requiring small current"!

It depends on the supply voltage and the connected load. Even if it works, the MOSFET will get very hot.
I didn't read that article, but I'm sure you misinterpreted it. Forget about IRF520/540 etc. if you want to switch significant loads (let's say > 500mA) at low Vgs (<= 5V) directly from an Arduino output. Stick with proper logic-level MOSFETs instead, or use some kind of MOSFET driver that applies the higher voltage to the gate of the IRF520 (etc.) needed to fully turn it on.
Also, IRF520/540 etc. are ancient devices. There's no need to settle for their mediocre performance (by today's standards).

Who gave you that idea...
That's what your small signal MOSFETs like the 2n7000 etc. come in, although you could also easily switch a tiny current with a huge MOSFET; it's just not very economical to do so: unnecessarily expensive & big, but perfectly functional. But also when choosing small signal MOSFETs I'd recommend getting logic-level devices so you can use them without unnecessary limitations with an Arduino. 2n7000/2n7002 and BS170 are not logic level devices (they will work OK though for switching a 20mA led from an Arduino).

BJTs are easier to use IMO. They are less likely to be damaged by ESD, all are naturally "logic level", are available in THT packages. AFAIK there is no 3V3 THT MOSFET and only few for 5V.
When you are able to solder SOT23 packages you can get a MOSFET for nearly any application that easily beats BJTs.

Suggest you look at the guide to opamps for Arduino thread it should get you started. A psuedo ground is not at 0V, but treated as signal ground. For AC signals you want the signal to be between the two power rails - for 5V logic circuits than suggests 2.5V as a suitable voltage.

Oh Ok, got it. But i think DC Wall warts are still not that old, I still have few of them in my drawer (not SMPS ones). Heat is the main problem of these adapters.

Yes, SMPS are now being used more because of their efficiency. I'm also learning to design some SMPS providing regulated 5V but after I clear some basic concepts.

Here is what I was also trying to say:

Surely would have done that, if they were available near me. The online mkt is just stuffed with IRFZ44N,IRF520,IRF540,IRF840 etc..(There's no Aliexpress or Ebay in India). Only one which I found was the IRLB8748 which I'll be buying.

@Smajdalf I actually know how to use a BJT but the problem is I am confused in what saturation mode is. I think that when using BJT as switch we can also use it in forward-active mode, instead of saturation mode that many tutorial state. (Don't know if I'm correct)

@MarkT Ok sure, I have not read the whole tutorial yet.

P.S: Although I'm very good at Maths, I am quite a bit lazy to do all the Math required in electronics, anyways my fault.

You really cannot make me believe that logic level MOSFETs cannot be purchased by private individuals in India. I think it would be useful to search a bit more for (online) shops & outlets in your country.
For instance, a quick search on shows many, many logic-level MOSFETs.

That would of course, be why they are still hiding in the drawer. :grin:

@koraks I know about Mouser, digikey etc. But let me show you some calculations:

I am considering I buy 10 units of IRLZ44N on

Unit price of 10 units: Rs. 91.1 , So total price Rs 911.68.

Now Delivery charge of Digikey to India -- Rs 1200.

Total price: Rs 2111.68 ($28.77). Also I don't know if I have to pay any custom/taxes in India after importing. So, in all $2.8 per MOSFET, which is not good.

If I buy IRFZ44N instead, I get them for pretty cheap, just 0.34 cents per piece (approx).

Local Online mkts have only a few types of logic-level MOSFET, though I have not checked offline stores yet...

@Paul_B They are still in the drawer, because I rarely need them.:wink: They have that round 2.1mm plug, which rarely any phone nowadays uses for charging.

the shipment about $1

Starting Note: Don't worry about how I'll get my parts, that job is mine and I will do it....You all just have to try to answer my questions :slightly_smiling_face:


  1. Do I need to connect all the grounds in any circuit to a single wire and then to the negative terminal of the power source?

  2. is there any need of Flyback diode if I control a 5V Relay Module directly with Arduino?

  3. I know that comparator is just like a op-amp. So why do people tell to use dedicated comparator ICs (like LM393) instead of creating an comparator with a OP-amp IC?

  4. When I was reading the datasheet of some split supply OP-amps, I found the max/min +Vcc and -Vcc (power rail) but didn't find a specific input voltage. Can we give any input voltage within that range or any specific voltage which depends on the output we want?

Regards and Thanks a LOT for clearing all my previous doubts.

Gee, that's nice.
Well, then a starting note on my end: if anyone of us suggests certain components, it's your job to find them, so don't start complaining about 'but it's difficult to get...' Consecutively, as to the story about the logic level mosfets: those are what you need. So stop rabbling about using IRF520/540. Those are unfit for most of your purposes, hopelessly outdated and not worth buying at this point.

Usually, unless you have circuits where one part is lifted with respect to another, or one part has no ground reference that is used as a circuit ground. Think e.g. a power supply that plugs into a wall outlet.
Concerning the methods of grounding - there's several topologies. Ground planes, star grounds, bus grounds. Each have their pros and cons and applications.

No. The module itself should include one, but that's not what you ask, I assume.

There can be difference in internal topology that make one more suited to a certain application than another. E.g. the output of a comparator may be open collector/open drain, making it relatively 'agnostic' to what voltage levels it interfaces with on the output, but not capable of sourcing current. But in practice, I don't bother with sourcing dedicated comparators and just use general purpose opamps.

Then you probably didn't look closely enough. I haven't come across opamp (or other component...) datasheets that don't specify permissible input voltages. Take another look, it's there. So no, you can't just assume that something works the way you expect because it isn't specified - which, like I said, it really is in this case. An opamp datasheet would be virtually useless if it doesn't specify the limits to input voltages. Even rail-to-rail opamps specify margins (offsets).

Ad 3: Using Op Amps as Comparators.pdf (188.2 KB)

@Smajdalf Thanks for the PDF.

@koraks Sorry, for complaining about those MOSFETs. I'll surely buy the components you'll suggest as you know better than me.

Ok, got it. But sometimes it doesn't work. For e.g. See this circuit:

When I tested the above circuit on Falstad, it works just fine. Link of the above circuit

Now If I connect all the GND, the circuit misbehaves and doesn't work.WHY?
See this:


Show me.
Simulation doesn't count...especially the crappy Falstad one with all of its missing crucial parameters. Such as...what's the impedance of that speaker to begin with? What's the output impedance of the voltage source on the left?
If crappy Falstad gives different outcomes for all GND nodes modeled as GND than if they're connected, then it's an obvious problem with the simulation.

If you want a halfway decent simulation for free, try LTSpice.

Your simulated circuit doesn't actually have a load.
Stick an 8ohm resistor in there where the speaker will be, and your output readings will be much different!