Thursday, 31 January 2019

mosfet - What transistor or combination of transistors should I use to make a fully controllable AC switch?


Suppose I want to switch AC. I want to control (allow, prevent, or interrupt) current flow in either direction. SCRs won't do because I want to interrupt current, and I don't recall seeing many IGBTs or FETs that lack an antiparallel diode. Those few I have seen have been low-power and didn't have much of a spec for reverse-blocking.


Are there transistors or other solid-state devices that will do what I want? Or should I perhaps use two IGBTs in series with the directions reversed?


Voltages I'm interested in are on the order of 600VAC. Currents are 10-200 amps. Frequencies are 1-20 kHz.



Answer



Yes, hefty back-to-back MOSFETs (maybe) or IGBTs should do what you want. Driving them would require isolated gate drive circuits. The complexity will vary a bit depending on how quickly you want them to switch. IGBTs tend to switch a lot more lethargically, but are more suited for the ~1200V PIV type operation required in this application.


SCRs (and triacs) as, you point out, have to wait for a (current) zero crossing, and the high frequency operation you speak of (20kHz) means that they would tend to stay on due to the high dv/dt at the zero crossing.


enter image description here


Is it possible to calculate how much heat dissipation and temperature rise will take place in a resistor


Suppose I have a 100 mAh battery at 20V. I connect a 1000 kohm resistor across it. How much heat will be generated and how can I find the temperature rise in the resistor? As the battery operates I think that the current flow will reduce over time but am not sure about the voltage for a real battery. Perhaps I am not giving sufficient information here, I am sorry for that.


I just wish to know, what information is needed to make such calculation? Have you ever done it? In the ideal case (taking only the most significant factors into consideration) what factors are considered to make an estimate of the heat dissipation and temperature rise and why would the real heat dissipation and temperature in the actual practical experiment be different?


I know this question looks hard, but I will be very happy if I can finally have this mystery resolved.



Answer




The power delivered to a resistor, all of which it converts to heat, is the voltage accross it times the current thru it:


    P = IV


Where P is power, I is current, and V is voltage. The current thru a resistor is related to the voltage accross it and the resistance:


    I = V/R


where R is the resistance. With this additional relation, you can rearrange the above equations to make power as a direct function of voltage or current:


    P = V2/R


    P = I2R


It so happens that if you stick to units of Volts, Amps, Watts, and Ohms, no additional conversion constants are required.


In your case you have 20 V accross a 1 kΩ resistor:


    (20 V)2/(1 kΩ) = 400 mW



That's how much power the resistor will be dissipating.


The first step to dealing with this is to make sure the resistor is rated for that much power in the first place. Obviously, a "¼ Watt" resistor won't do. The next common size is is "½ Watt", which can take that power in theory with all appropriate conditions met. Read the datasheet carefully to see under what conditions your ½ Watt resistor can actually dissipate a ½ Watt. It might specify that ambient has to be 20 °C or less with a certain amount of ventillation. If this resistor is on a board that is in a box with something else that dissipates power, like a power supply, the ambient temperature could be significantly more than 20 °C. In that case, the "½ Watt" resistor can't really handle ½ Watt, unless perhaps there is air from a fan actively blowing accross its top.


To know how much the resistor's temperature will rise above ambient you will need one more figure, which is the thermal resistance of the resistor to ambient. This will be roughly the same for the same package types, but the true answer is available only from the resistor datasheet.


Let's say just to pick a number (out of thin air, I didn't look anything up, example only) that the resistor with suitable copper pads has a thermal resistance of 200 °C/W. The resistor is dissipating 400 mW, so its temperature rise will be about (400 mW)(200 °C/W) = 80 °C. If it's on a open board on your desk, you can probably figure 25 °C maximum ambient, so the resistor could get to 105 °C. Note that's hot enough to boil water, but most resistors will be fine at this temperature. Just keep your finger away. If this is on a board in a box with a power supply that raises the temperature in the box 30 °C from ambient, then the resistor temp could reach (25 °C) + (30 °C) + (80 °C) = 135 °C. Is that OK? Don't ask me, check the datasheet.


power - What simple IC can I use to extract 500mA from a computer USB port?


I have very small and simple electronic projects that I power up using the USB power connectors plus a resistor. For one project I require to use more than 100mA, however the USB port requires an enumeration process to be done before giving more than that (up to 500mA).


I've browsed TI.com looking for some IC that can help me with this task, however I'm not sure I'm on the right track (I've pre-selected LM3526 and BQ2402x ICs, but I don't fully understand how to use them... I'm still learning....).


Is there any simple example circuit design that I can use to solve this? Ideally, it should be something that I can connect to an USB port and that will just give me an output of 500mA and more than 4.5V.


Thanks for the help,




Wednesday, 30 January 2019

control - Find the largest value of $K_1$ and $K_2$ for instability of the system



A cascade control system with proportional controller is shown below




schematic



Theroritically the largest values of the gain K1,and K2 that can be set withot causing instability of the closed loop sytem are


Given \$G1=\frac{1}{(s+1)(2s+1)}\$ and \$G_2=\frac{1}{(3s+1)}\$


\$(A)\$10 and 100 \$(B)\$100 AND 10 \$(C)\$10 AND 10\$(D)\$\$\infty\$ and \$\infty\$





The closed loop T.F will be


\$\frac{C(s)}{R(s)}=\frac{K_1K_2}{(s+1)(2s+1)(3s+1)+K_2(3s+1)+K_1K_2}\$


Now C.E will be $$6s^3+11s^2+(6+3K_2)s+1+K_2+K_1K_2=0$$



Now after applying R.H criteria I got two conditon for stability


that is $$20+9K_2-2K_1K_2>0$$ and $$1+K_2(1+K_1)>0$$


Now after satifying Options one by one all options becoming unstable for this equations.


Is the options are wrong or I am doing it wrong?



Answer



You seem to be doing things right. I verified them using Mathematica. So either you have \$G_1\$ and \$G_2\$ wrong, or the question is wrong.


enter image description here


There are two possibilities:



  1. The max value of \$K1\$ is \$\frac{9}{2}\$, and the max value of \$K2\$ is \$\infty\$.


  2. \$K1\$ is some finite value greater than \$\frac{9}{2}\$, and \$0<\text{K2}<\frac{20}{2 \ \text{K1}-9}\$.


Resistors between Arduino pin and transistor


I'm trying to activate a relay using an Arduino Uno. Most schematics I have seen in the web include two resistors between the Arduino pin and the 2N3904 transistor.


What is the reason for that?


Relay circuit with resistors highlighted




Answer



The series base resistor (R9) is to limit the base current drawn from the Arduino output pin.


The resistor between base and GND (R10) is to conduct away the I/O pin's leakage current when it is tri-state. This will be the case after your circuit powers up (when reset configures then I/O pin as an input), until the Arduino CPU is out of reset and its software configures the I/O pin as an output. The leakage current may be enough for your transistor to conduct. The resistor value can be much higher than what you have, with 10 K to 47 K commonplace. Calculate it from R=Vilg/Ilk where Vilg is the input voltage from a good logic low (recommend 0.1 V) and Ilk is the I/O pin input leakage current (always see datasheet).


How does a USB C port provide the power to charge laptops?


I've heard about laptops such as the new Chromebooks that are charged via a wall charger that connects to a USB-C port. I'm quite happy that this will supposedly standardize laptop chargers but I'm a little unclear about how this works.


Existing USB ports provide a 5 volt source, but the laptop chargers provide up to 20 volts. is there some kind of higher voltage line or are the USB-C powered laptops running on a lower voltage?


All this information I've seen gives a fairly vague idea of providing more power, providing up to 100 watts rather than 10 watts. Even so, my laptop is not the most powerful machine and the charger still outputs fairly near 100 watts, I can imagine more chargers for power laptops providing much more than 100 watts. Could a general purpose USB-C charger really power all these machines?



Answer



USB-C will use the Power Delivery specification, a first connexion is done at 5V, then "negotiate" whether it can use a higher profile to charge. There are 5 profiles available :



  • Profile 1 : 5V@2A

  • Profile 2 : 5V@2A or 12V@1.5A

  • Profile 3 : 5V@2A or 12V@3A


  • Profile 4 : 5V@2A or 12V@3A or 20V@3A

  • Profile 5 : 5V@2A or 12V@5A or 20V@5A


There are 4 connection point for the power (2 on each side - see pinout below), as far I know, they are all equal and may be connected by a single cable (I think it will be at the cable manufacturer discretion). These additional connection allow to go for higher current without having massive voltage drop at the connection. Coupled with higher voltage, that gives a lot higher charging power.
USB C Pinout


All in all, I guess that the laptops will as well charge with 5V (on USB A charger), just far slower. And based on what I saw from Apple for their new Macbook, the charger is 29W, so most likely a Profile 3 (a bit under spec), it seems then to be only 12V.


It seems that additional profiles have been added by some manufacturers, for instance, Qualcomm Quick Charge 2.0 seems to be an implementation of the Power Delivery but using 9V too. This technology though does not use the Power Delivery specification as it uses the D+/D- lines of the USB 2.0 port to negotiate the voltage.


Qualcomm Quick Charge 3.0 brings it one step further and now allow to "negotiate" any voltage from 3.7V to 20V by increment of 200mV. No data found so far about the current at each voltage.


Tuesday, 29 January 2019

How many NPN common emitter transistor circuits are there?



I'm studying for an important exam, solved a lot of common emitter circuits with different unknowns. Most of them them look similar.


Can someone give me some examples or exercises of circuits of NPN common emitter transistor circuits that I can practice on?


I'm just scared the professor will give a circuit in a way that I won't understand, and therefore not be able to do calculate the unknowns nor be able to write to AC of the circuit.


I also understand the voltage divider bias circuit.




binary - Sending data through lasers


I have to design a circuit in which I have to transfer data through lasers (serial transmission of data). Now what I was thinking was to check if the laser light is on then '1' is passed and when the laser is off '0' would be passed. Now I need to check if a 1 or a 0 was passed.


How would I check for this and another problem I'm facing is if it's on it may keep on passing 1's. How would I check for this? I though of using LDR's (Light Dependent Resistors)? Would this be okay or it there a better method?



Answer





Now what I was thinking was to check if the laser light is on then '1' is passed and when the laser is off '0' would be passed.



This is exactly how most fiber optic communications works.



How would I check for [if a 1 or a 0 was passed?]



You would build a photoreceiver circuit.


This typically involves a photodetector, possibly an automatic gain control amplifier, and a decision threshold amplifier.




another problem I'm facing is if it's on it may keep on passing 1's



In fiber optics data communications, this is typically solved by using an encoding scheme such as 8b/10b which ensures a minimum transition density. The trade-off is of course that you need to send 10 symbols for every 8 bits in your actual message. Higher-speed systems use more complex encoding schemes with lower overhead.


In telecommunications systems, scrambling is used so that, although there is no guarantee, the odds of a long run of 1's or 0's being sent is exceptionally small.



I though of using LDR's (Light Dependent Resistors)



As others have mentioned, LDRs are very slow and aren't used often for optical communications.


sensor - Light Dependent Resistor Photoresistor LDR: gl5516 vs gl5506


What is the difference between gl5516 and gl5506? (in a SIMPLE way)



Answer



The GL5506 has a significantly lower resistance for a given amount of light compared to the GL5516 AND, in dark conditions the resistance of the GL5516 is significantly higher in resistance (as you would expect). Now go look for the data sheets and read them.


enter image description here



frequency - Maximum reliable speed of GPIO pin given only capacitance and no resistance


I looked up information about my microcontroller AT89S52 and I can't seem to figure out the maximum speed I can operate a GPIO pin at.


I'm running it with a 22.1184Mhz clock, and I notice sometimes when I modify a port value, it won't update right away without adding several NOP statements but I don't want to guess. I want to know values so I can adjust code.


This is information from the datasheet I got:


datasheet


It lists the pin capacitance, but I see nothing about the pin resistance. How do I calculate the resistance here? or is there another way to calculate the maximum reliable pin processing speed?




Monday, 28 January 2019

Current capacity of copper wires in vacuum


I’d like to know the current carrying capacity of copper wires in vacuum.
The current plan (NPI) calls for sending ~3 amps through the vacuum space of a cryostat.
Has anyone done this? Have any references, links, or sage words of advice.

I found this,


http://snebulos.mit.edu/projects/reference/International-Space-Station/TM102179.pdf


and a few other references. (Kurt J. Lesker gives single numbers.) The slope of those curves in vacuum is about 2. Which at least makes some physics sense. Heat generated goes as I^2 and heat dissipated goes as T^4 (Assuming all the heat dissipation is by radiation… Stefan- Boltzmann law.)


Oh one kinda crazy idea would be to put a thick layer of heat shrink tubing over the wire. Better emmisivity and a larger area. (Perhaps something other than heat shrink.)




current - How is electricity wasted?


All i know is electric current travels in a loop. So how / where in its way does electricity (electric energy) get wasted? And what do we do on switching electric appliances off? If it's not electric current that is wasted then what is it?



Answer



You are confusing electrical current with electrical energy. Given how you express confusion over the fact that current can go in a loop yet energy is wasted, I think that you are also tied to the notion that energy must be tied to the matter that happens to be carrying it.


Yes, current goes in a loop. We do not, on an everyday basis, create or destroy electrons*, and electrons strongly repel each other and are strongly attracted to atomic nuclei, so any current that flows is forced to loop around and come back to the source. This does not mean that energy does not flow, however. If I connect a battery to a pair of wires here, then the battery adds energy to any electrons flowing through it from its positive electrode to its negative electrode. This potential energy per electron is seen as the voltage of the battery. If those wires are connected to a light there, then current will flow through the light. The energy imparted in those electrons in the battery will be converted to light and heat in the light. If you ignore any losses in the wires, then the energy has flowed from the battery to the light, but the net number of electrons has stayed pretty much the same everywhere.


If you're still caught up in the "how can electrons go in a loop but the energy goes from point A to point B" problem, then consider hydropower. The sun shines on the sea. It imparts energy to the seawater, some of which evaporates. Some of that blows over mountains, and some of that rains down. Some of that forms into a river, which someone has dammed. The water impounded behind the dam is run through turbines generating mechanical energy. Then the water runs back into the sea. The water has gone in a loop. The energy has been transported (with great inefficiency) from the surface of the ocean to the turbines in the dam.


Dunno if this helps -- it's always hard to know what will clear up a confusion.


* Please, please do not bring beta decay into this discussion. Yes, electrons are created. No, it is not on topic.



mosfet - DC motor and smoked arduino


I just burned my arduino and want to understand what happened. I tried to control 12V 4A DC motor with 5V Arduino Pro Mini, here is a PCB I made for this:


enter image description here


In the bottom part you can see arduino pins, I used Raw input to power my arduino with 12V and PWM pin 11 to control the motor.


I used IRF3205 N-channel Mosfet and 1N5817 Diode in my circuit. R1 resistor is 220 Ohms, R2 1KOhm The circuit I tried to build is something like this (picture from google): enter image description here When I turned it on my arduino smoked in 3 seconds (I believe somewhere near "Raw" pin, maybe in was built-in regulator). Are there any obvious mistakes I made? UPD: some pictures of my assembly: link to imgur.com



Answer




The diode on your board is in the correct position, and should deal with the motor inductance, as well as wiring directly to the motor. However, there is nothing to prevent inductance in the supply wires from causing an spike in input voltage to the regulator when the MOSFET switches off abruptly. You have no capacitance and no path for the energy stored in the inductance, and little margin for error (see below).


Looking at a clone that I have kicking around, the regulator is an AMS1117 which has an absolute maximum input voltage of 15V. Yours may use a different chip. The MIC5205, used in some, can withstand 20V (discounting thermal considerations). A 78M05 can withstand a 35V spike.


If the AMS1117 or similar part is used, 12V is too close to absolute maximum to expect a TVS etc. to protect the regulator. You would be better off adding some shunt capacitance at the board (perhaps a 2.2uF 25V ceramic capacitor in parallel with 100uF/16V electrolytic across the 12V supply- right on the board) and add a pre-regulator such as an 78M08 for 'belt and suspenders' security.


Consider the below simulation. L1 and R2 represent the motor inductance and winding resistance at rest (remember there is no back-EMF with the rotor at rest, so R2 is determined by the stall current). L2/L3 represent the wire inductance- it would be less for short wires and if you twist the wires together. I have switched the (random) MOSFET with a 150 ohm gate resistor and a 5V source. So I would expect this simulation to be qualitatively similar to your circuit but not necessarily very accurate in quantitative terms.


schematic


simulate this circuit – Schematic created using CircuitLab


Here is what the regulator supply voltage sees as the MOSFET switches:


enter image description here


Yes, +165V spikes despite the relatively slow MOSFET switching.


This is an excellent example of why you have have to be very careful when you have large currents floating around that are being switched relatively quickly. It doesn't take much parasitic inductance to lead to a lot of volts, which can zap things. Even a few mm of straight wire has some (quite measurable) inductance.



TL;DR: Add some caps AT THE BOARD across the supply and hang a 78M08 before the Arduino board.


transistors - High-Swing Cascode Current Mirror


I am currently dealing with current mirrors and came across the circuit shown below, a High-Swing Cascode Current Mirror. I read that this implementation, as the name suggests, has the advantage of a high voltage headroom, since the minimum potential at the drain terminal of M4 is: $$ V_{D4\_min}=V_{DS4}+V_{DS2}=(V_{GS4}-V_{TH})+(V_{GS2}-V_{TH}) $$ So the drain potential at M4 only needs to be twice the overdrive voltage, in case of same transistor dimensions, in order to hold M2 and M4 in saturation. But cannot this be said for many other cascode current mirrors, since that behaviour simply occurs by "stacking" together two transistors (M2 and M4)? Additionally, why is there a connection from the gate of M1 to the drain of M3? I have a hard time understanding whats going on in this circuit, help is greatly appreciated.


enter image description here


EDIT: A bias voltage source is setting the potential at the gate of M3/4. Sorry its not shown in the circuit.


EDIT 2: I just read that the mentioned bias voltage is implemented by a MOSFET in diode configuration, like here. For further discussion lets call it M5.




Answer



We know that the condition for saturation is Vds >= Vgs - Vt or Vd >= Vg - Vt (1) or Vg <= Vd + Vt; So therefore the gate of M3 / M4 has a voltage of Vg3,4 = Vd_min + Vt (assuming Vk has the same dimension as the rest of the MOSFET).


Now coming to the gate of M1/M2. For this we would have to know the drain voltage of M3 because this is connected to M1. Let the voltage at drain of M3 = Vx since drain of M3 is connected to the gate of M1, according to (1) the drain of M1 = Vx- Vt. This means that only Vt can be dropped accross Vds3 to keep M1 in saturation. This makes M3 to act as if it is in a virtual diode connected fashion because Vg3= Vd3= Vd_min + Vt. This vt dropping accross M3 leaves V_dmin accross M1 sufficielntly putting it in saturation.


Now we know all the voltages of the MOSFET in the left side, since M3 M4 pair and M1 M2 pair are current mirrors the same current flows through them and therfore Vgs4= Vgs3. Since the Vg3,4 is fixed the source M3,4 should be at V_dmin. So V_dmin is dropped accross M2 to keep it in saturation as well. So now for the drain of M4 according to (1) to keep M4 alone in saturation Vd4 should at least be = Vg4-Vt = Vd_min. But to keep both M4 and M2 in saturation Vd4 should be at least = 2Vd_min. This improves the swing by a margin of Vt compared to a normal cascode structure which has a V_minimum of 2Vd_min + Vt.


operational amplifier - Touch activated switch


I am trying to create a circuit that will be able to detect a touch (with fingertip) on a metal/aluminium surface that it is connected to. Currently I have this circuit (I am sorry for bad drawing...):enter image description here


My assumptions are probably wrong, but this is what I was thinking of. Due to human skin having some capacitance, when one would touch the plate, there would be some current flow due to change in capacitance. High pass RC filter would get rid off DC offset and the signal would get amplified by LM358. This would then trigger 555 timer in monostable mode.


Any help is greately appreciated!



Answer



If you're really after a capacitive touch sensor, this likely won't work at all because the aluminum plate is a short to ground. You're better off making an oscillator (ring or 555 based oscillator's are my favorites) that has a frequency based on R and C where C is two separate contacts where the touch sensor goes. A persons finger near the two contacts greatly changes the dielectric between the two contacts and you end up with a very different capacitance. With a different capacitance, you now have two different frequencies that your oscillator will ring at. It's actually a range of frequencies depending on how close the finger is, but that will be turned digital at the end.


Then you send the oscillator output into a high pass filter (small capacitor in series), set the DC operating point and then use a comparator with a chosen voltage level to determine whether the person's finger touched it or not.



There's always digital versions if you wanted to travel into uController land. Here's an app note by TI on capacitive touch sensors. A lot of the front-end concepts are the same regardless of whether you want to go digital immediately or just keep it analog until the end as I described above.


schematic


simulate this circuit – Schematic created using CircuitLab


Sunday, 27 January 2019

How to calculate Real Power and Power Factor using an Oscilloscope?


I'm trying to calculate the Real Power consumption of my device in Stand-by mode, but to do that I need to figure out its power factor due to:


\$\text{Real Power} = V_\text{rms}\times I_\text{rms}\times PF\$


Now, my device like many other IT devices doesn't have a perfect sinusoidal current curve, so I can't just calculate the phase shift can do cos(theta).


I read through some documentation for an Arduino application and apparently you can calculate Real Power by doing several instantaneous samplings of current and voltage and multiplying them and just get the average. So I took out my scope and decided to get 1000 samples.


Here is the graph:


enter image description here


I exported this data to an excel sheet and got the following values:


\$V_\text{rms} = 118.96V\text{ (RMS)}\$


\$I_\text{rms} = 0.02024A\text{ (RMS)}\$



\$S \text{ (apparent power)} = 2.40792\text{ VA}\$


\$P \text{ (real power)} = 0.93713\text{ W}\$


This gives me a power factor of


\$PF = 0.93713/2.40792 = 0.38919\text{ ← This is a very low power factor.}\$


I used my Kill-a-Watt device and it tells me my power factor is somewhere around 0.6 average.


I tried investsigating online if I missed something, and I noticed a website that said that the current probe for the scope should have it's "flow arrow" pointing to the source, in my case my AC outlet. I noticed I had it the otherway around and corrected this. The graph is bellow:


enter image description here


The gives me almost the same RMS values, but when I try to calculate Real Power by multiplying instantaneous Voltage and current readings and averging them out I get a Real Power of:


\$P = -1.02W\$


Can any of you guys with more experience point me in the right direction. What am I doing wrong?





How to integrate a signal in LTSpice?


Is it possible to integrate a signal in LTSpice and plot the result?



Answer



Sure, you can use the idt function, for example with a behavioral voltage source, we see the integral wrt time of a sine wave with an offset.


enter image description here



power supply - Where/How should I fuse this transformer?



Background: I have a step-down transformer P241-5-36, which is a single mains primary coil to 36V Center Tapped (18-0-18) secondary. I would like to use this transformer to build a linear regulated dual rail (+15V/-15V) DC power supply for DIY synth work. I'd like for both me and the power supply to not be destroyed if I happen to accidentally produce a short circuit on the secondary side. The data sheet says for my particular transformer, "36V C.T. @ 0.35A" under the "Secondary RMS Rating" column.


Question: Do I place a fuse on the primary or secondary coil, or both and should I use a 0.35A value fuse or something else? I think the fuse needs to be on the primary coil (though I'm not sure the value), but when the transformer spec identifies 0.35A at secondary, it is confusing me.


Research: I researched linear regulated power supply circuits and found the following schematics:



While these schematics all to very different things, they all share a commonality in that they show a fuse on the primary side of the transformer. I read through this post asking general safety questions about a PSU schematic. That individual's schematic showed fuses on both the primary coil AND secondary sides.


Proposed Schematic: Here is the schematic I plan to use for my power supply (up to the linear voltage regulators). It is dependent upon the correct location and value of a fuse - I took a guess here:


schematic


simulate this circuit – Schematic created using CircuitLab


Please note: I included a switch to float ground because I may want to probe with my oscilloscope and connect the probe's ground clip to something other than ground on my circuits.


Thanks, EE Community.




Answer



Your transformer has 0.35A rating for its secondaries (each). You can fuse those with a [say] 0.3A fuse each. (The center tap doesn't nee a fuse.) The fuse in the primary [if you want it] needs to be much smaller. For 115V primary, you have a turns ratio of about 3.20 (to both secondaries in series), so the max current in the primary is about 0.11A. A 100mA fuse should work there.


Beware that if put the secondary side fuses after the rectifier they need to be DC fuses. AC and DC fuses are not the same because the latter need to cut the arc while in the former it gets cut by the AC sinewave itself.


charge - Can you overcharge a capacitor with a lower voltage power source?


If I have a 5v capacitor and a 3v power source, and I connect the power source to the capacitor will it charge up to 3v then stop, or will the voltage rise above 3v?



Answer



With a static voltage source, a capacitor in series will charge up until its voltage is the same as that of the source.


With a few components you can build a boost converter, which is capable of charging a capacitor beyond the voltage of the supply due to the inductor forcing more charge into the capacitor when the switch is open.



Operating a capacitor near its voltage limit can result in reduced capacitance though, and charging it past its limit may destroy it violently.


operational amplifier - overshoot and undershoot on 3 volt pulse


i am interfacing a system, this system output signal of 200ns digital pulse with repetition time of every 3ms. Ideal voltage of signal would be 0v to 3.3V but signal coming from system have high overshoot and undershoot value (value upto +5 to -2V). and i want to interface this signal with Xilinx 7 series FPGA(artix) with bank voltage of 3.3V. Attach is signal shape i get from system. Noisy signal from system




  1. So first question is If i don't put any protection circuit would my IO pin of FPGA will burnout or what will happen. as maximum voltage limit as per 7 series FPA for 3.3V bank is -0.5 to 3.8V.

  2. Second question is what will be good protection circuit for this overshoot and undershoot protection.

  3. is there any recommended OPAMP IC which will handle 200ns pulse easily


I need circuit which will handle 200ns pulse easily.




Saturday, 26 January 2019

How do I use a quartz crystal in an oscillator?


How can I get a quartz crystal to make square waves at 4.096MHz? So far I have the 4.096MHz quartz crystal and this schematic I saw:


enter image description here


Where can you find an amplifier with a single input and what voltage should I use?



Answer



You can make a Pierce Oscillator similar to that shown in your question:


Pierce Oscllator


The "single input amplifier" is usually a simple CMOS inverting gate, like the 74HC7404 (6 inverters in one package), SN74HC14D (single inverter) or similar.
Voltage can be something within the operating range of the IC, such as 5V. You may need to add a series resistor to limit the crystal drive (you need to check the crystal datasheet for manufacturer recommendations)

Here is a circuit with typical component values:


Pierce Oscillator 2


Note the series R mentioned above. The above came from this Fairchild App Note which goes into some detail on the design process.


You can only pull the frequency of a crystal oscillator a very small amount, so you will need a 4.096MHz crystal. Either that or you will need to use something else such as a PLL.


buck - ORing 2 power supplies for 3.3V output


Is it possible to add two independent power supplies together to achieve a steady 3.3V powers supply? One power supply will be running from a 9V battery and the other is a 12V source. They both don't have to necessarily run together i.e. the if the 9V battery is just connected, it should still supply 3.3V. I have a buck converter that can output a steady source of 3.3V (LM2576-3.3V) and can handle a wide range of voltages (up to 40V). Is there some kind of passive voltage adder circuit that I can use that has some power protection diodes?



Answer



If you don't care about efficiency, use two diodes, like below:


schematic


simulate this circuit – Schematic created using CircuitLab


Otherwise use:



  • Ideal/smart bypass diodes (such as SM74611) instead of D1 and D2.

  • Some ORing FET controller such as LM5050 + nMOSFETs.


  • Some some autoswiching power mux.


If, instead, you must have 2 separate 3.3V regulators, then use something like a TPS2113 (2.8 to 5V autoswitching power mux).


How to chain transistor logic gates


I've been trying to build some circuits that use logic gates, without using pre-made chips. My main goal is to further my understanding of the subject, but it'd be nice to make something useful in the process.


After a lot of failed attempts and googling I landed on this question, which works great. But I feel that the current consumption will be very high (since the inverters will basically send a load of current to ground when they're low?). This is especially true if you want to use many gates.


It seems to me that you need to 'black box' the logic gates so that you can chain them as much as you like without much worry. The inverters do this, but at the cost of current. Is there a better way? Is learning the hard physics behind it all the only way to really make complex logic circuits, so I'm just moving out of my depth? I have a strong understanding of the gates themselves, and designed my circuits as pure gates already, but the actual physical implementation is very different.


So my question would be: Is there a simple and effective way of blackboxing RTL logic gates so that they can be chained?


Edit: I just recalled that NOR can be used to construct other gates - so I suppose the solution would be a design for a NOR gate that can be treated as modular.



Answer




RTL isn't too difficult, but that doesn't mean it's trivial either. If you want, take a look at two of my answers: (1) building a full adder; and, (2) nand with led. But in those cases I decided to keep things really simple and not to actually do a serious design. You've mentioned RTL. So let's attempt an RTL design here.


Let's start out looking at the following example taken from one of my earlier posts:


schematic


simulate this circuit – Schematic created using CircuitLab


We will need to decide upon a range of input voltages which are to be considered a logical "0" and another range of input voltages which are to be considered a logical "1". Obviously, these ranges should not overlap and probably should have a gap between them.


Before we go there, though, the above circuit presents a design problem. If we assume that both inputs (A and B) are at the highest allowable input voltage that is still considered a logical "0", then it's pretty clear that there will also be some small base current present and that this current will be amplified by the \$\beta\$ of \$Q_1\$ to become a possible collector current pulling down the collector voltage. This makes the circuit far less designable, especially because the value of \$\beta\$ varies over parts even within the same family. We need something present to make the circuit less dependent on the value of \$\beta\$. (We'll also need something to also make the circuit less dependent on the variations of saturation current [which affects \$V_{BE}\$], too. But that will shake out in the process.)


A way of achieving this is to add a resistor from base to ground (or some even lower voltage.) Something like this:


schematic


simulate this circuit


(I've shown this circuit with \$R_{D}\$ going to ground. A design could also consider the idea of tying it down to a negative rail. But there's no need, for now.)



The above circuit, with the added \$R_{D}\$ base resistor, greatly improves things as it allows us to divert small base currents away from the BJT. It provides an additional degree of design freedom that we'll find useful to have.




So. Let's design RTL!


We'll start by assuming a single voltage rail of \$V_{CC}=5\:\textrm{V}\$. Let's also say that a LOW is considered to be any voltage from \$0-1\:\textrm{V}\$ and that a HIGH is considered to be any voltage from \$3-5\:\textrm{V}\$. So, \$V_{LO_{MAX}}=1\:\textrm{V}\$ (obviously, lower is better) and \$V_{HI_{MIN}}=3\:\textrm{V}\$. Let's also say that you want the output to be able to drive up to six inputs at a time. (It is very important to set down some rules like this if you are going to design something.)


For a design, we need to figure out the worst case situations and design for those cases. (If we do that, the rest will only be better.) The two worst possible cases are:



  1. Where the two inputs are at \$V_{LO_{MAX}}\$ and the output can't be allowed to sink below \$V_{HI_{MIN}}\$ when faced with a full load of six inputs. (These additional inputs will try and drag down the output and we need to make sure that the output can't be dragged below \$V_{HI_{MIN}}\$, even then.)

  2. Where one of the inputs is at \$0\:\textrm{V}\$ and the other one is at \$V_{HI_{MIN}}\$ and where the output must be forced below \$V_{LO_{MAX}}\$ without any other output loading added. (Without added inputs, the transistor must by itself be able to pull down the output below \$V_{LO_{MAX}}\$. Adding loading would only help and we want a worst case situation where there isn't any added help.)


To address these details, I'm going to haul in a few things I know about small signal BJTs. Roughly speaking, their collector currents will increase by a factor of 10 for each \$60\:\textrm{mV}\$ change in \$V_{BE}\$. (Taking into account some reasonable thermal variations, each factor of 10 might be for anywhere from \$50-70\:\textrm{mV}\$ change in \$V_{BE}\$.)



I want \$Q_1\$ to be very close to OFF in case (1) above, setting \$R_C\$ low enough in value that it can pull up six input loads without letting the collector sink below \$V_{HI_{MIN}}\$. This means that the base voltage must be low enough to achieve that OFF state. I also want \$Q_1\$ to be very close to ON in case (2) above. This means that a slight change for one of the inputs, merely going from \$V_{LO_{MAX}}\$ to \$V_{HI_{MIN}}\$ (just \$2\:\textrm{V}\$ change), while at the same time the other input tries to oppose this change by itself going from \$V_{LO_{MAX}}\$ to \$0\:\textrm{V}\$ and dragging down against that meager rise, should be enough to cause \$Q_1\$ to go from OFF to ON.


I've stayed completely away from deciding resistor values up to this point. But now I'm going to pick a value for \$R\$ and base everything else upon that choice. I'm going to set \$R=39\:\textrm{k}\Omega\$. You can choose something else, if you want. I'm just picking it to keep the power supply current semi-low.


For a small signal BJT, it's roughly the case that collector currents will be in the tens of nanoamps if I can keep \$V_{BE}\lt 400\:\textrm{mV}\$. And those kinds of collector currents are low enough that I can consider the BJT to be OFF. Similarly, if I allow \$V_{BE}\$ to be twice as large, then the collector current will be \$10^{\left[\frac{800\:\textrm{mV}-400\:\textrm{mV}}{60\:\textrm{mV}}\right]}\$ times as much, or about 4 million times!! Or, well into the tens of milliamps. I think I can consider that to be ON. (Even with thermal issues taken into account, it should be a factor of 500k and still in the milliamp range, regardless.)


So, let's say I want the Thevenin voltage to be lower than \$V_{TH_{OFF}}=400\:\textrm{mV}\$ for OFF and to be about twice as much, or around \$V_{TH_{ON}}=800\:\textrm{mV}\$ for ON. The equation is:


$$V_{TH}=\frac{V_A\cdot R_D+V_B\cdot R_D}{R+2\cdot R_D}$$


This solves out for case (1) above as:


$$R_D\le\frac{V_{TH_{OFF}}\cdot R}{2\cdot\left(V_{LO_{MAX}}-V_{TH_{OFF}}\right)} = 13\:\textrm{k}\Omega$$


However, for case (2) above, it's:


$$R_D\le\frac{V_{TH_{ON}}\cdot R}{V_{HI_{MIN}}-2\cdot V_{TH_{OFF}}} = 22\:\textrm{k}\Omega$$


I'll use the standard value of \$R_D=18\:\textrm{k}\Omega\$.



The only thing left to do is to worry about \$R_C\$. Here, it needs to be strong enough (lower valued is stronger) that it can pull up six loads when \$Q_1\$ is OFF and weak enough that when \$Q_1\$ is ON that it drops enough voltage to allow the collector to fall below \$V_{LO_{MAX}}\$.


When \$Q_1\$ is OFF and loaded as indicated in case (1) above, then:


$$R_C \le \frac{R\cdot\left(V_{CC}-V_{HI_{MIN}}\right)}{6\cdot\left(V_{HI_{MIN}}-V_{TH_{ON}}\right)}\approx 5.9\:\textrm{k}\Omega$$


I'll set \$R_C=4.7\:\textrm{k}\Omega\$ as a standard value. It turns out that this is also good enough that if so much as \$I_C\ge 1\:\textrm{mA}\$ that we'll also meet the requirements for case (2), as well. So we are done.




Here is the resulting circuit design:


schematic


simulate this circuit


Given the above, I figure \$V_{TH_{OFF}}\le 480\:\textrm{mV}\$ when both inputs are at \$V_{LO_{MAX}}\$ and that \$V_{TH_{ON}}\ge 720\:\textrm{mV}\$ when one input is at \$V_{HI_{MIN}}\$ and the other is at ground. This should provide enough margin for reasonable operation.


I think you will find that this works well with up to six loads on the output and works over the ranges I've discussed.



The following image shows four traces covering case (1) and case (2) above, with the output both loaded and unloaded. The x axis is the voltage on the A input, or \$V_A\$. The y axis is the output voltage. The unloaded curves are labeled starting with "U" and the loaded curves are labeled starting with "L". The traces with \$V_B=0\:\textrm{V}\$ are labeled with "0V" and traces with \$V_B=1\:\textrm{V}\$ are labeled with "1V" in their names.


enter image description here




Fuller adder here:


enter image description here


flipflop - Dual edge detector


I am designing a hobby project that will run on a battery so I am trying to reduce power consumption. The SoC I am using has the ability to go into a deep sleep mode where it consumes very little power, and then can be interrupted by a falling edge on a pin.


I want to generate a high-low-high pulse when the state of a reed switch changes in either direction. I have been reading a lot and it seems that a one-shot monostable circuit can be built from a couple of transistors and an RC circuit to generate an output pulse when an edge is detected. I understand how that works. However, I can't figure out the best way to also pulse on the opposite edge.


One thought, was to just combine two one-shots that are configured to trigger on rising and falling edges respectively, and use the transistors at the output to pull the common pull-up low (kind of like a NOR gate).


Since I am a hobbyist, I am mostly using passive components. What is the "real" way of doing this in a low-power configuration using logic devices?


Edit: I figure I should mention something about the timing requirements. Normally the reed switch will be either open or closed for many seconds at minimum before changing states.


Edit: Here is an example of the circuit I was using for detecting only the falling edge:


Schematic


And here is the ~20ms pulse it was producing for ~200ms button press simulating the reed switch (Channel 1 is Vbe for T1 and Channel 2 is measured at RST):


Scope of pulse response




Answer



You are asking for a edge to glitch converter, which is usually a flag indicating a kludge. Are you really sure your SoC can't be configured to interrupt on either edge? This is a common feature of many microcontrollers. In PICs it's called interrupt on change, for example, and just about every PIC has a few inputs that are capable of it.


If your hardware can really only interrupt on a falling edge, then one possibility is to simply invert the signal and wire it into two such inputs.


To answer your question directly, a edge to glitch converter can be made from a XOR gate:



OUT will be low as long as both inputs to the gate are equal. The signal into pin 2 is delayed a little by the R-C low pass filter. This means that for a short time after IN changes, pin 1 will have the new value and pin 2 the old value, which causes OUT to go high. After a short while, the pin 2 signal catches up and the output goes low again.


You can either use this to trigger on the end of the pulse, or use a XNOR gate to get a negative going pulse so that the leading edge will trigger the interrupt.


Since you said you are a hobbyist, here is a circuit that uses only junkbox parts:



This may look like a ratsnest, but is easy to understand if you break it down into individual pieces.



C1 AC-couples the input signal into Q1. Q1 will turn of for a little while due to a rising edge on IN. When it does, it forces OUT low. R5 is a passive pullup so that OUT is high when nothing is going on. That takes care of detecting a rising edge on IN.


Detecting the falling edge is done similarly with C2 and Q2. However, when Q2 turns on, it pulls its output high instead of the low you want. Q3 inverts that and pulls OUT low when Q2 is on.


Friday, 25 January 2019

3KW SR motor gate driver and simulation questions


I'm designing power electronics for 3-phase 3KW SR motor by using power MOSFETS of rating 600V. To drive the gates of these MOSFETS, I'm using IR2183 gate drivers, one per each phase.


The DC voltage at the drain of MOSFET is directly from the DC capacitor link which supplies 300VDC.


Although the gate drivers should be in closed loop control system, for simulation purposes I’m using voltage sources for input pulses.


I have provided the circuit diagram and simulation results below. My question is, is this how the output current of an each phase looks like? And do I have to make any more changes to the circuit with higher inductance values (considering motor's inductance would be high)?


I would highly appreciate any suggestions provided.



Thanks in advance.Gate driver to mosfet connection and simulationcircuit diagram of the input of motor




operational amplifier - What is best Rf/Rin for an op-amp?



In theory, for an op-amp in inverting design, the voltage gain is \$\dfrac{R_{f}}{R_{in}}\$.


For example: for a \$gain=10\$ we can use \$R_{f}=100\ \mathrm{k\Omega}\$ and \$R_{in} =10\ \mathrm{k\Omega}\$. The same gain can be obtained from \$R_{f}=1\ \mathrm{k\Omega}\$ and \$R_{in}=100\ \mathrm{\Omega}\$. What is the difference and which value is best suited?


A config like this:


enter image description here



Answer



If you want your op-amp to perform better at high frequencies you'll use lower value resistors to set the gain. Leakage capacitance around the feedback area might be in the order of 1pF due to circuit tracks and pads for components and this has an effect when resistor values are high.


If your feedback resistor were 100k ohm and your leakage capacitance were 1 pF, you'd find that at a frequency of: -


\$\dfrac{1}{2\pi RC} = \dfrac{1}{2\pi\times 100,000\times 1\times 10^{-12}} = 1.59MHz\$


The gain would be 3dB down on the dc gain i.e. if your dc gain is 10, at 1.59MHz the gain would be 7.07. If you need a flat response up to 32MHz then the biggest feedback resistor you can use is 5k ohm.


Op-amp data sheets are the best place to look to see what they recommend.



Taking the resistor values lower is fine but you will approach a point where the feedback resistor is starting to load the output circuits of your op-amp and you may get reduced amplitude swings and/or distortion.


But the bigger problem would be on the input resistor. To maintain a gain of ten with a feedback resistor of (say) 100 ohms means the input resistor is 10 ohms and this input resistor is the input impedance of your circuit. This would be seen by many circuits or signals as "too low" and can cause the inputted signals to distort or reduce in amplitude.


Typically you wouldn't go below 50 ohms for \$R_{IN}\$ and this means your feedback resistor is 500 ohms.


Driver impedance of a microcontroller pin, for series termination?


Many guides instruct that digital signals should have a series resistor placed by the driver, whose resistance is equal to the line impedance (Z0) minus the driver impedance (Zd). Here is one such guide.


However, I can't find output impedance specs for any microcontrollers. I've looked in the datasheets for the Renesas and PIC MCUs I use, and it's not even mentioned.


The situation I'm currently facing is a Renesas MCU talking to an SD card via 21cm-long traces, at 33MHz I think. (Some of the signals are bidirectional, but that's another story.) In order to avoid ringing and EMI emissions, which seem like they could be a problem with such long traces and high frequency, I want to terminate correctly.



Possible solutions - would it be likely that the driver impedance is really low, like only 1 ohm or so? I can calculate my line impedance, and if the driver impedance is far smaller, perhaps I could just neglect it?


Or, could I possibly attempt to detect the EMI caused by the ringing by (don't laugh) holding an AM radio next to the transmission lines, and try different termination resistor values until the ringing is minimized? Is there any better way to do this at home?




operational amplifier - Help with ideal op-amp problem


I'm working on generating an expression for output voltage v0 in terms of v1 for the op-amp below.


enter image description here


I was hoping you guys could walk through my logic and make sure I'm analyzing this correctly.




  1. The op-amp is providing negative feedback to the inverting input which allows me to assume that current into the op-amp is 0 and the voltage at both input nodes are equivalent.

  2. The voltage of the non-inverting input is 0V because it's connected to ground which also makes node B 0V.

  3. Therefore, the voltage drop across R1 is v1 and the current through R1 is consequently i1=v1/R1.

  4. Since current going into the op-amp is 0, the current i1 must also enter R2 making the voltage v2 across the resistor v2=i1*R2=R2/R1*v1.

  5. The voltage drop across across R2 makes the voltage at node A va=-v2=-R2/R1*v1.

  6. Using Kirchoff's current law at node A, I can generate an equation for v0 in terms of va and replace all the va terms with va = -R2/R1*v1 as found in step 5.


My final expression is $$v_0=-R_4v_1(\frac{1}{R_1}+\frac{R_2}{R_1R_3}+\frac{R_2}{R_1R_4}).$$


Even better, if there's some way for me to check/assess my answer for these types of problems, I'd like to hear it.





jfet - Transistor Based Wien Bridge Oscillator


I've been studying the schematic for this RLC Bridge from Heathkit (IB-5281). The full pdf can be found here (search for the part number): http://www.vintage-radio.info/heathkit.


The circuit contains an AC source to drive the bridge which is basically a JFET Wien Bridge oscillator with selectable oscillation frequencies. A spice version of the circuit (for 1KHz) is given below: enter image description here


I recognize most of the constituent pieces: the band bass filter, the voltage amplifier and push-pull follower, etc. But I have a few questions:


1) Is the purpose of the feedback through R7 to present a zero phase shifted signal to the source of the jfet to "select" the resonant frequency (similar to how the op amp version works)? How exactly does this mechanism work?


2) What exactly does the section in the red box do? My feeling is it acts like a variable resistor (operating the jfet in its linear region) and pulls more current through the J1 source on positive going half-waves thus providing negative feedback to control the gain, but that's just a guess. I have no clue about D3, C5 and C6.


Thanks.



Answer




J1 & Q1 provide voltage gain which is buffered by the circuit contianing Q2 & Q3. R7 provides feedback to regulate the voltage gain -- gain is approx (R6+R7)/(R6 + R13+JFET+...).


The circuit in the red box regulates the output amplitude. D3 and C6 (peak) rectify it, and as the amplitude increases, C5 gets charged more and more negative. This pulls the gate of the JFET more negative, and it turns off, thus (because it is in the denominator of the gain equation) decreasing the gain. The gain stabilizes at some (hard to determine) point.


C4 & R17 (especially) provide some specific feedback to make the JFET 'resistor' more linear with drain voltage -- e.g. see this Vishay linearize JFEThttp://www.vishay.com/docs/70598/70598.pdf. This keeps overall distortion low(er).


Not sure what you have for R18 !


Thursday, 24 January 2019

grounding - Why is there a 0R resistor linking GND and AGND in analog voltage reference circuit?


This is related to another question I've just posted (What's the purpose of a ferrite bead inductor on this circuit?), regarding the battery charger described in the AVR450 Application Note - Battery Charger for SLA, NiCd, NiMH and Li-Ion Batteries, which one day I hope to build.


On page 40, there's a schematic showing the MCU connections (picture below). Marked in red is a 0Ω resistor that is puzzling me. I suspect that it is just a wire jumper linking AGND and GND. But I don't understand why there's a jumper there.


Schematic



My questions:



  1. What does the jumper represent?

  2. Why are AGND and GND separated like that?



Answer



Digital circuits are noisy, but they can (mostly) handle their own noise without noticing. Analog circuits notice noise a lot; in fact, they have to pass noise just like a signal because they really can't tell the difference.


The best way to keep digital noise out of analog circuits is to keep them separate, both physically and electrically. But they have to be connected somehow in order to convert from one to the other, hence the jumper in exactly one spot, which is probably next to the converter on the physical board.


gpio - What's an alternate pin function on a microcontroller?


I'd like to know what "Alternative Function" refers to in the context of the IO ports of a microcontroller.


I don't need to know how to activate it when connecting to a peripherial, but I'd like to know what it exactly is and why we'd need it.



Answer



Many pins of your microcontroller have different functions. The 'normal' function would refer to GPIO, General Purpose Input/Output. In that case, you can use these pins directly by writing to and reading from the relevant registers.


'Alternate' functions would refer to other functions, that may include I2C, SPI, USART, CCP, PWM, Clock, ADC, etc... How you control the pins when in an alternate function depends on the peripheral, but it generally comes down to writing to and reading from special function registers (SFR); the peripheral takes care of the rest.


Which function is standard after a RESET depends (it is not always GPIO!), and you can find that in the relevant datasheet. Most of the time, you can select the function you want to use on-the-fly, so you can switch between peripherals.


By using one pin for several peripherals, you can make microcontrollers with very much features. However, because you most of the time want that peripheral on that pin all the time (and don't want to switch functions on-the-fly) you can't use all peripherals in one program, or at least not at the same time. On the other hand, that isn't really often needed anyway.





As Connor points out, 'alternate function' can refer to something else as well, in just a slightly different context: here it isn't about what function you put on a pin, but about what pin you use for a function. This is called Peripheral Pin Select, and basically means you can select which pin your peripheral is using. You could, for example, do RS232 over RA1 and RA2 or over RB1 and RB2.


See Connor's answer for a more detailed description (and upvote him for this).


Wednesday, 23 January 2019

pwm - Multi-Cell Lithium battery balancing circuit explanation


I found a great application note on building a multi-cell lithium battery charger with cell balancing.


http://www.cypress.com/file/70891/download


The great thing about this one is that you implement the charging algorithms yourself on an on-board MCU. If you already have an MCU and knowledge of the charging sequences of lithium batteries, this can be a cheaper option than buying a standalone chip that does the algorithms for you.


I understand the functionality of the circuit and what it's doing. But I had a question about a part of the circuit. Specifically the balancing MOSFETs and how they are driven.


Given the below schematic: enter image description here


See that Q4-Q7 are the balancing FETs that turn on to discharge a cell that is out of balance.


These FETS are driven by a GPIO pin on the MCU with a PWM signal. The app note says the following:



"The cell-balancing MOSFETS Q4-Q7 should be controlled at appropriate levels. One possible way to do this is to create a count level translator using a PWM signal coupled with AC. The rectification of the translator forms the DC level to turn on the corresponding transistor. This design uses one pulse width modulator, PWM_BAL. PWM_BAL has been placed in DCB12 and output to the demultiplexer, which is built around software-configurable global output buffers. PWM_BAL is configured in the software as a 4-bit PWM with a switching frequency near 115 kHz. When a MOSFET is turned on, the internal output buffer is enabled, passing the PWM signal to the rectifier. The diode networks D7-D8 are used for PWM signal rectification with amplitude doubling. The rectifiers’ low-pass filters consist of resistors R10, R14, R18, and R24 along with the MOSFET gate-channel capacitance. "


I don't quite understand this part of the circuit. The PWM signal is rectified and filtered via the 1Meg resistor and the MOSFETs gate capacitance. I would love to simulate this in TINA spice.


The FET they have is the BS170FTA and has the following gate threshold: enter image description here


You need 3V just to get 1mA of drain current. We want closer to 35mA to load the cell to drop it's voltage for balancing. So if the GPIO outputs a 3.3V PWM signal, it has to drive the gate much higher to get the 35mA of drain current. Unfortunately the datasheet does not have a VGS ID curve in it.


Would someone be able to explain how this little circuit works? I need this understanding to design my own and choose the proper components. Since it seems like the parasitics of the components are playing a key role here.


Below is a zoomed in picture of the circuit of interest. enter image description here


Thanks for the help.



Answer



Let's start with the VGS ID curve. Fortunately, the schematic lists the part number for the MOSFET (BS170), so, from the datasheet:


enter image description here



Notice that at 3.0V, the MOSFET is already conducting 50-100mA typically. Note that 3V is listed as the "maximum" VGS(th), meaning the "typical" threshold voltage is probably somewhat lower.


Let's look at the circuit. As Marko Bursic's comment points out, it is used for "PWM signal rectification with amplitude doubling". Applying a PWM square wave excites an AC current passing through C5. When the current is positive (to the right), D7 conducts, charging the parasitic gate capacitance Cgs of the MOSFET. When the current is negative (to the left), D8 conducts instead, preventing the negative current from discharging Cgs. Meanwhile, R1 is constantly discharging Cgs, and as soon as the PWM waveform is turned off, Vgs will begin decaying and the MOSFET will eventually turn off.


But wait! What happened to the "voltage doubling"? Well, it turns out that a "voltage doubler" produces a DC value that is 2X the peak value of an AC waveform. In our example, the AC waveform is 3.3V peak to peak, or 1.65V peak. Which means the "doubled" voltage is still just 3.3V, less the diode drop.


So in conclusion, it is theoretically possible that a worst case combination of high diode drop and high VGS(th) could prevent a certain channel of this circuit from working. If the circuit is intended to work with 3.3V PWM, you're probably fine as the designer probably tested quite a few of these. If the designer tested with 5V PWM instead, you may eventually hit a problem - but my guess is, you'll still be fine.


Quick aside: "PWM" typically implies that the duty cycle of the signal is a control input - that's not the case here. The current through the MOSFET is totally independent of duty cycle! The only purpose of the so-called PWM is to produce an AC waveform.


enter image description here


VGA Output from Arduino



Is there any method to output VGA with Arduino?



Answer



This is quite difficult to do well but there are a couple of examples. The main difficulty is in the speed of the CPU.


Here's one doing direct VGA output: Make: Arduino VGA Demo


If you Google "Arduino VGA" there are a few demo projects.


A couple options are the "TellyMate" shield that lets you output Composite rather than VGA (the single yellow connector you find on your TV.


Another is the "PICASO Universal Base Board" and "PICASO VGA/SVGA Graphics Controller" - this is not a direct shield but probably the best option I have seen.


Both the above items are available from Sparkfun and Little Bird Electronics among other places.


Why have a 0.1 uF capacitor in parallel with 2500 uF in a power supply filter?


I'm troubleshooting an old solid-state bass amplifier (Ampeg B-15). The power supply has a 56 VAC transformer tap into a 4-diode full bridge rectifier circuit.


One side of the bridge goes to ground. The output side (power rail) of the bridge has 3 filter capacitors before any other circuitry: two 2500 uF electrolytic capacitors in parallel to ground and a 0.1 uF non-electrolytic in parallel going to ground.



I know the large caps are filtering caps to reduce ripple. What is the function of the 0.1 uF since it theoretically doesn't add any significant capacitance?



Answer



What you have there isn't two capacitors in parallel. It's more like this:


schematic


simulate this circuit – Schematic created using CircuitLab


The small cap is a ceramic type, it has a low series resistance and inductance, so high frequencies can pass it easily. It doesn't need high capacitance because the current in those frequencies is usually low.


The big cap is an electrolytic type, it has a high series inductance and most times a high series resistance, too. For high frequencies, it's similar to an open circuit.


pcb - Missing components in Eagle Library


I am missing libraries of certain ICs for use in Eagle. Can someone guide me to a source where I can find these IC libraries? I am asking this question to find out if there is any central repository where I can find most/all of the IC libraries.


Additional Information (if required):



  1. Currently missing ICs are AD8318, ADL5542, and TLV3501

  2. I am using Eagle v5.6.0 for Windows



Answer



I would recommend, that you learn how you create your parts on your own. For me it is often faster than searching for a missing part. When you would find the part on the net you should check it for correct pin out, size, etc.


Here is a tutorial I found quite useful.



However there are some places where you can find libraries:





Let me add a note about creating your own part:

When your part is in a common package format, you should take a look at the ref-packages.lbr library. It contains various standard package formats, so you dont have to create these on your own. Just copy the needed package in your own library and create the rest according to the tutorials you will find on the net.


Tuesday, 22 January 2019

batteries - Modifying a Simple Transformer Circuit


I have a heavy 14.4V 1.5A heavy battery charger I would like to use to charge my car battery (over time, monitored for heat in a well ventilated area).


When I plug the battery to the charger as is, I believe it turns off as the led doesn't turn on and the Voltage I read is 10.8 which is what the battery is at. When I measure the charger on it's own I get 13V.


Can someone help me modify it to make it work? I'm comfertable soldering and researching if you don't feel like giving a specific answer :). Images of the transformer and circuit:


Transformer


Circuit


Details


Thanks in advance for any efforts :)


Edit - I sketched a diagram of the circuit on tinyCad, here it is: circuit



I noticed that there is an earth connection for the battery, but only 2 connections to the wall socket. I don't get how it would be earthed, but perhaps the third connection is needed to turn it on? It is directly connected to one of the switch's 4 'legs'.



Answer



It looks like you're trying to repurpose a charger that was originally intended for some sort of tool battery, judging from the socket built into the case.


It also appears that said battery leaked at some point into the charger, given all of the crud all over the case, contacts and PCB.


You really need to clean the corrosion off of everything, and verify that all of the connections on the PCB and the rest of the wiring are still good.


The relay is probably there to switch between "fast" and "trickle" charging modes, as indicated by the labels on the LEDs. It would be worth your while to trace out the circuit and draw a schematic diagram, so that we all have a reference for further discussion.


Monday, 21 January 2019

voltage - I2C: 3.3V and 5V devices without level-shifting on 3.3V-bus?


do I really need a level-shifter if I use 5V-powered devices on an I2C-bus that has pull-ups to 3.3V? In my understanding the devices will only pull the lines (SDA, SCL) low (to ground) and never drive their supply-voltage to the bus. So I don't see a reason for a level-shifter as long as all devices detect the voltage from the pull-ups (3.3V) as logical high. That should be the case with devices using 5V as supply.


In my case I have an IC whose inputs are not 5V-tolerant as master and I could power my slaves with 3.3V but using 5V is easier in my circuit and allows higher (internal) clock-rates for the slaves.



Answer




According to version 4 of the \$\mathrm{I^2C}\$ spec,



"Due to the variety of different technology devices (CMOS, NMOS, bipolar) that can be connected to the I2C-bus, the levels of the logical ‘0’ (LOW) and ‘1’ (HIGH) are not fixed and depend on the associated level of VDD. Input reference levels are set as 30 % and 70 % of VDD; VIL is 0.3VDD and VIH is 0.7VDD. See Figure 38, timing diagram. Some legacy device input levels were fixed at VIL = 1.5 V and VIH = 3.0 V, but all new devices require this 30 %/70 % specification. See Section 6 for electrical specifications." (page 9)



Deeper in the spec, you'll see that this \$ 0.7 \times V_{DD}\$ is the minimum logic high voltage:


excerpt from NXP I2C spec rev. 4


For your 5V system:


\$ 0.7 \times 5 V = 3.5 V\$


\$ 0.3 \times 5 V = 1.5 V\$


To me, the 3.3 V pull-up looks marginal, especially if any of your 5V devices use the 'new' standard of \$ 0.7 \times V_{DD}\$ for logic HIGH.



Your mileage may vary, but it's always best to be within the spec wherever possible...


How to detect potentially poor antenna placement from GPS data?



Below is data from a 6.5 hour run collecting NMEA sentences from a u-BLOX NEO-6 GPS module (datasheet, protocol spec) with an active external antenna via Raspberry Pi.


This is my first analysis to see if there is any way to detect poor antenna placement from the data, and flag a user if so. Here the antenna was placed very poorly, almost a worst-case situation with narrow sky view and strong reflections from between a pair of metal walls.


Every 30 seconds I collected 3 seconds of serial data, parsed $GNGGA sentences for lat, lon, alt, HDOP, and n_sats, and $GPGSV for C/No (dBHz) and alt/az of satellites used for solutions (alt/az not analyzed yet). If I understand correctly the presence of an SNR value for a given satellite in a given sentence (rather than a blank) indicates the satellite was used for a recent solution.


For GPS coordinates, each dot in the first plot represents results from one sentence, since multiple sentence appeared in the 3 second sample window, I've just plotted all of them as a first-pass analysis.


Question: What strategies might I try myself for a "poor reception" scheme? Examples might be:



If it's necessary, I can calculate the positions of the satellites independently, but it seems that should simply agree with the ephemeris data in the module and $GPGSV sentences.


note 1: I'm not asking about reporting an accuracy, that's addressed in the following question.






note 2: E-W and N-S coordinates are relative to median value of all data, Alt is absolute.


enter image description here


GPS data



Answer



Here is one strategy based only on reported "signal strength" as carrier to noise ratio (C/No), but it would not address the problem of trying to infer if there were strong reflections present.




As I've learned by researching this question, one recommended method is to look at the C/No values, reported in units called dBHz mentioned in Section 7.4 of u-BLOX's Application Note RF Design Considerations for u-blox GPS Receivers



7.4 Sensitivity test


Check the C/No values in the $GPGSV or the UBX-NAV-SVINFO messages. Under open sky a good design should reach up to 50 dBHz for the strongest signals. If it reaches 45dBHz it can still be acceptable but the source of the reduction should be investigated (e.g. small antenna, ...).



Designs with maximal signal strengths below 40dBHz usually provide degraded performance (long TTFF times, lower coverage, accuracy, dynamic).



This document also gives a discussion of the parameter and the impact of low values on the GPS results.



5. Signal Loss and C/No


In recent years, clever techniques have been developed to extract tiny GNSS signals from the background noise. But, the fundamental limitation to what can be achieved is limited by the ratio of the gain of the antenna element to the total receiver noise, referred to the input, or “G/T”. This is an absolute indicator primarily of antenna-plus-front-end performance, and determines the ultimate value of C/No for a given signal level. C/No is the ratio of carrier power to the noise power mixed with the signal, in a 1Hz bandwidth. This ultimately defines a limit for the GPS receiver sensitivity. So, simply put, antenna gain should be maximized (the “G”), and LNA noise figure minimized (“1/T”); a complicated way to state the obvious.


If the C/No ratio is diminished by any cause, be it bandwidth limitations or increased LNA noise figure, GNSS sensitivity will be reduced by the same amount. Once impaired, there is no way to recover C/No for a given receiver. Even additional gain does nothing because C and No are amplified equally, and so is to no avail.



NEP is in units of power per square-root frequency, so for example the noise power in a bandwidth of say 10 MHz would be 35 dB relative to the power in 1 Hz. If the signal in that bandwidth has a power similar to that of the carrier, then you might want a C/No of order 35 or 40 dB, as the documents above mention.


The data shows that most of the time, most of the satellites used in a given solution had C/No values way below the 45 to 50 dB recommended above and so at least something about the antenna or feed situation is sub-optimal. Since the OP mentions the antenna placement is deliberately poor for this run, these results are consistent.



enter image description here


arduino - Can I use TI&#39;s cc2541 BLE as micro controller to perform operations/ processing instead of ATmega328P AU to save cost?

I am using arduino pro mini (which contains Atmega328p AU ) along with cc2541(HM-10) to process and transfer data over BLE to smartphone. I...