Comments about this simple circuit that is teach in a university...... - Page 1
Forum section: electronics / beginners

author: wilmer
author_rank: Contributor
timestamp: June 12, 2018, 09:19:04 am
content: what is going to happen with the MCU..........Because you can code an Arduino doesn't mean that you now are an electronic engineer.That lovely diode that replace a resistor

author: Zero999
author_rank: Super Contributor
timestamp: June 12, 2018, 09:59:43 am
content: What will happen to the MCU? In reality, it's internal resistance might limit the current to a safe level, especially if it's run off a 3V supply.I agree, this is of course not the way it should be done. The transistor will also take a long time to switch off.

author: wilmer
author_rank: Contributor
timestamp: June 12, 2018, 10:14:36 am
content: TheQuote from: Hero999 on June 12, 2018, 09:59:43 amMCU=ATmega328PVoltage of the MCU= 5VThe I/O port don't have a resistance in series for the port. That MCU is a hero to support that, a PIC 16XX will blow immediately.

author: Tom45
author_rank: Frequent Contributor
timestamp: June 12, 2018, 10:41:34 am
content: Is it being taught as an example of what not to do?

author: wilmer
author_rank: Contributor
timestamp: June 12, 2018, 10:43:41 am
content: Quote from: Tom45 on June 12, 2018, 10:41:34 amNo.....is the example of what to do......

author: bd139
author_rank: Super Contributor
timestamp: June 12, 2018, 10:45:08 am
content: I’ve seen this sort of shit before from a respectable university. Makes you wonder why the fuck you went sometimes.However the PIC would drive that and eat it up quite happily. I’ve done it before. Gets a bit warm if you stick 8 on it though.

author: wilmer
author_rank: Contributor
timestamp: June 12, 2018, 10:48:51 am
content: Quote from: bd139 on June 12, 2018, 10:45:08 amI remember my times when I was learning and the first thing that usually blows my 16f877a was overcurrent over a port.....that was dead sure for my MCU. I am obsessive about protecting my MCU. that is not all the tale, they use small transistors to control motor that was asking more than 1 A.

author: bd139
author_rank: Super Contributor
timestamp: June 12, 2018, 11:07:25 am
content: I think they are less fragile if you sink rather than source which is what I was doing. Was a 16C84 (back in the dark ages of piclist). I blew a couple up via other means however. Back then it meant a 50 mile round trip for me to get another one.I certainly wouldn't recommend it. Keeping power dissipation and current low is the name of the game in 2018.

author: rstofer
author_rank: Super Contributor
timestamp: June 12, 2018, 03:12:52 pm
content: I don't like the circuit and I would never use it but...Assume a motor current of 1A and an hFE of 100. Base current is 10 mA and the input to the diode will be around 1.4V (2 diode drops). So, for a 3V Vdd on a 16F877A, we need a Voh of 1.4V @ 10 mA.This is pretty typical according to Figure 18-17 (document page 205, PDF page 207). It might overdrive the base by a 5 mA but, again, when we do switching, we often overdrive the base to guarantee saturation. The Absolute Maximum rating for sourcing through a pin is 25 mA (document page 173, PDF page 175). With Vdd = 3V, the pin can't deliver anywhere near that much current.http://ww1.microchip.com/downloads/en/DeviceDoc/39582b.pdfNot my favorite circuit but there are many uCs where this can work without having the magic smoke escape.I think it is a mistake to assume the circuit won't work without searching for conditions under which it will work.

author: C
author_rank: Super Contributor
timestamp: June 12, 2018, 06:15:12 pm
content: Adding to what rstofer stated.That diode in base connection makes microcontroller only supply current when at logic High.Next question could beIs the pin configured for a resistor pull-up or is a transistor in microcotroller doing the logic high?C

author: In Vacuo Veritas
author_rank: Frequent Contributor
timestamp: June 12, 2018, 06:31:57 pm
content: Quote from: wilmer on June 12, 2018, 10:14:36 amNo one said it does. Internal resistance is just the model of the finite resistance of the parts, unless they are superconductors.The internal resistance of a battery isn't actually a discrete resistor inside the battery, for example.C is correct, it could just be a port configured with a weak pull up, a "resistor" to VCC which is actually a mosfet strapped as a weak current source, equivalent to some high value resistor.In which case, why add the extra diode? Who knows. Universities are the last place I look for reliable information these days.

author: wilmer
author_rank: Contributor
timestamp: June 12, 2018, 08:13:02 pm
content: Quote from: rstofer on June 12, 2018, 03:12:52 pmYou are right, In the real world, the student circuit work for a couple of hours after that: 1) the transistor blows(2n3904), 2)the MCU get very hot and 3) there is not complete saturation, the motor didn't work properly.

author: rstofer
author_rank: Super Contributor
timestamp: June 12, 2018, 10:45:48 pm
content: Likely the transistor went first and took out the uC. If the transistor can't get into saturation, it will heat up badly. Nothing in the schematic gave part numbers. With a small enough motor and enough hFE to get into saturation, the thing might actually work. An hFE of 100 seems marginal. We really need that device in hard saturation, Vce of 0.2V. Then we could calculate the heat dissipation from Vce and Ic - maybe a heatsink helps, maybe a more robust transistor.As a practical matter, if the transistor doesn't short out, the uc should survive nicely and for a long time. The circuit, as I calculated it, isn't overloading the pin. But it could easily be overloading the transistor.Even if I convince myself it should work, I'm not going to use that circuit. There are motor driver chips made specifically for this purpose.

author: wilmer
author_rank: Contributor
timestamp: June 12, 2018, 10:54:55 pm
content: Quote from: rstofer on June 12, 2018, 10:45:48 pmThat is exactly what happened to them. the transistors were 2n2222,2n3904 and of course, they blow. Some motors were asking 300mA but some other motors were asking 10A , I believe some motor have internal damage because students connect them directly to the battery bank. I assemble some circuits for them with TIP31 and TIP 32 and that circuit work perfectly.

author: Belrmar
author_rank: Regular Contributor
timestamp: June 12, 2018, 11:39:19 pm
content: for this kind of circuit i tend to prefer yo use a MOSFet, as it is less likely to overload the pin when correctly used, and i would add a resistor to the capacitor to prevent LC oscilation

author: rstofer
author_rank: Super Contributor
timestamp: June 12, 2018, 11:54:52 pm
content: Quote from: Belrmar on June 12, 2018, 11:39:19 pmAnd, specifically, a 'logic level' MOSFET so that we don't need to deal with 10V Vgs. Still, it pays to read the datasheet because there is a minimum Vgs which will turn the device fully on. 'Logic level' is often more marketing than engineering. A 5V output pin might get the device turned on, a 3.3V output pin probably won't.It's the same story, Vsd needs to be small, the device needs to be fully turned on.

author: westfw
author_rank: Super Contributor
timestamp: June 13, 2018, 07:02:20 am
content: QuoteGain of the transistor is irrelevant to loading of the pin. Nothing LIMITS the current through the diode or base/emitter junction. Two diode junctions between the output pin and ground (heh. About equivalent to directly connecting a red LED to the pin...)