text
stringlengths
83
79.5k
H: DC motor accuracy with encoder I am building a coil winding machine and I've already set up something that works. I used two nema17 stepper motors and tb6600 stepper driver cards. The problem is that motors are seems to overheating when I make them work at low speeds. Internet says it is okay for steppers to overheat but they smell like burning circuit and vibrate too much. I am planning to use dc motors with encoders but I am not sure if I will be able to get accurate results, since I am winding really small coils. So, I have two questions; 1- Is there any way to use step motors without these problems? Something like changing steppers or drivers? 2- Can I use DC motor with encoders at high precision? If I want to turn it 200 step, can I achieve something close to 200 steps? AI: The amount of current through the stepper coils is determined by your driver circuit. Typically with commercial modules there are some DIP switches that can be used to set the motor current (for example from . You can check your motor datasheet and driver manual (for example, this and make sure the set current is within the motor rating. The torque is proportional to the current you set, but the temperature rise of the coils is somewhat more than proportional to the square of the current, so you will get a large reduction in heating for a relatively small reduction in torque. If the motor is sitting idle on one set of coils for a long time some drivers will allow the current to be scaled back to a lower holding current. That's called "automatic semi-flow" in the Chinglish manual I linked. Vibration may be related to the mechanical stiffness of your mechanism, the torque and your microstep settings (try smaller microsteps). Some drivers do better than others at handling resonances at specific speeds. If you can't get the required torque at a current the motors can handle, you may have to substitute larger motors. You would need a closed-loop controller to use DC motors with a feedback encoder. There are DC and BLDC servo motors available with such controllers (sometimes integrated) which mimic a stepper, and they have the advantage of not suffering from lost steps even if the inertial load exceeds the ability of the motor to follow by more than a full step, however the cost is significantly higher than simple stepper motors.
H: What is the minimum die area of a chip? Silicon chips are made by slicing up wafers; in general, the fewer transistors a design needs, the smaller the area it needs, so the more chips you get out of a wafer, and the lower the cost per chip. But there must be some limit to this. Maybe you can have a chip of one square millimeter area, but it seems unlikely that you could have a chip of one square micron area. What is the minimum... To be specific, I'm not asking what is the minimum physically possible area, but what is the minimum area below which chips stop getting cheaper? The point at which you stop trying to shrink your design, because fewer transistors will no longer save money? And has this remained roughly constant over the decades, or has it changed with iterations of process technology, and if so, in which direction? AI: The minimum area of the chip is determined by the most cost effective solution not the smallest physical possible cut. The smallest cut defect-free with a kerf is roughly equal to the wafer thickness and the slotted diamond saw roughly equal to 1/2 of the wafer thickness. Thus the question should be what is the cheapest way to process single diode junctions. As the biggest demand for single diode junctions appears to be LED's , the question should be what is the maximum number of LED's per wafer? Economy has driven the size of the LED up. There is no benefit to going smaller. For any given chip on a die and wafer size, this calculation limits the maximum number of Die Per Wafer. This is not the limit but is a calculator to determine the mechanical yield of a wafer. The trend now is to make small flip chips with bump pads stacked on a system in package (SiP) or system-in-a-package with a number of integrated circuits enclosed in a single chip carrier package.
H: Strange powering of the TL710 comparator I have an old schematics of 80th fancy synthesizer VCO. It uses the TL710 comparator, that according to the datasheet has -7V Negative Supply Voltage. I cant find the emitter-base breakdown voltage of EN5179. For me, it looks like it is used as a Zener diode. The EN5179 is almost impossible to find. So the question is: may I use 7.1 or 6.8 Zener for negative supply of the comparator? Or there is a trick that I don't see? AI: may I use 7.1 or 6.8 Zener for negative supply of the comparator? Yes Or there is a trick that I don't see? V- current 5 to 9mA No just do not exceed -7V
H: Inductor coils, core, and a gap between I am speaking, here, not in the more usual sense of a gap in the continuity of the core material. I mean, in reference to a rod of core material, that the outside diameter of the rod is sufficiently smaller than the inside diameter of the coil, that a uniform separation exists between the core and the coil. The question is, does such a gap affect the inductance of such a system. I suppose a more general question would be how inductance would be affected if the coil were wound directly on a core whose permeability varies with diameter - that is, would such a system exhibit inductance different from a system of the same dimensions but with a core whose permeability is an average of the variable one. To give a practical example, suppose I wind a coil on the outside of a piece of (nominal) 1/2 inch pvc pipe, whose outside diameter is 0.84 inches. I insert a rod of given permeability with an outside diameter of 0.622 inches (the inside diameter of nominal 1/2 inch pvc pipe). Clearly, the inductance of such a system will be different than the case in which the coil is wound directly on such a core (smaller diameter coil, lower inductance), or in the case of a larger diameter rod (&c). I have not found any material referencing such a system (possibly because the effects of such a system are so negligible as to be of no interest). A further question might be of a system in which a layer of impermeable material fills the gap between the coil and a core of permeable material. AI: If you do the maths on a coil wound on a full core it has this inductance: - $$L = \dfrac{N^2}{\mathcal{R}}$$ Where R is the reluctance of the core and N is the number of turns. L of course, is inductance. So, if instead of using the reluctance of the ferrous core you regarded it as two reluctances in parallel (one a tube of air and one a core of ferrite) you would get your answer. Reluctances in parallel work just like resistances in parallel so, if the tube of air has 100 times the reluctance of the ferrite core then the net reluctance compared to a full ferrite core might increase by only 1%. See also my answer to the question coil area versus core area. It seeks to justify the equations.
H: infrared and K-Type temperature sensors badly disagree They are both cheap. There is a piece of PCB balanced on top of the K-type thermocouple's probe; there is also a red laser light from the infrared thermometer right in the middle of the same PCB where the probe's head can be seen. The difference between the readouts is sometimes larger than 100 degrees C. Which one should I trust more (for the purpose of PCB oven soldering) ? AI: Thermocouples are more likely to give an accurate reading (of the junction temperature). The relationship between the junction temperature and what you are trying to measure is another matter, but it's unlikely to be really disparate if you are careful (for example, extending the thermocouple wire inside the heated zone and coiling it against the PCB to act as a heat sink to keep too much heat from flowing away from the junction). A cheap thermocouple is likely almost as accurate as an expensive thermocouple (there are a few grades of wire, but even lower grades are pretty good). The construction (thin wire or ribbon is better for not affecting the temperature being measured) is more important. The linearity and accuracy of the readout device is sometimes pretty suspect if they're cheap, but they're usually good to 1% or better. IR sensors give a reading that's highly dependent on the emissivity of the target. If you aim it at a specular surface you may get more of a reading of the walls of the enclosure or whatever else is reflected in the surface than the surface itself, which can be grossly in error. Certainly if there are open glowing-red elements within reflected view of the IR thermometer you're likely to get large errors on the high side. Cheap IR thermometers assume a fixed emissivity of 0.9x, so something dark (in IR wavelengths) and matte will give you a more accurate reading. They also have variation depending on the sensor temperature so avoiding gradients will help. I would not trust a cheap IR thermometer very far, and even expensive ones have similar limitations to some degree.
H: IRLZ44NS mosfet + 3.3v gate I'm considering using some IRLZ44NS mosfets that I have with an ESP32 that runs at 3.3v. Looking at the datasheet it says: VGS(th) - Gate Threshold Voltage - min: 1.0v, max: 2.0v It seems like this will work, but I saw some other posts that refer to people using these mosfets unsuccessfully with 3.3v at the gate. Here is the datasheet for the specific part that I purchased: https://static6.arrow.com/aropdfconversion/e4de403d6464383ac0f3e8f5420ce415f093cb18/irlz44nspbf.pdf I want to use the mosfet as a switch to turn something on that also uses 3.3v (probably 1A max current). Figure 3 on the datasheet looks like I could pull up to ~10A with 3v. Am I misinterpreting the datasheet? It looks like this part should be fine with 3.3v at the gate. AI: No you are not misinterpreting the data sheet and, if your load is 1 amp max you should be fine. Also, if you look at the next figure that shows the drain current versus gate voltage, 3.3 volts is not in the danger zone for creating a thermal runaway situation. But, remember that these graphs are “typical” figures and not maximums or minimums. Having said that, on balance I think you’ll be ok.
H: How to calculate kWh from amps I'm getting measurements from an IoT device. This measurements are in amps (I get one every 2 min or so). I know the voltage of the device. From what I've seen online I can calculate the power in kW doing \$P = I * V / 1000\$ Is there any way from this information for me to calculate the kWh for this device? I've seen on another platform that to do that with the same data than me, they basically put everything in a graph and calculate the integral on one hour and use that to deduct the power consumption of the device, but it seems wrong instinctively. I'm not very qualified with this electrical problematic so please keep that in mind. Example of measurement taken at different times : 11:00 => 19.56 amp => 4.49 kW 12:00 => 20.8 amp => 4.78 kW 13:00 => 21.7 amp => 5 kW 14:00 => 18.2 amp => 4.18 kW 15:00 => 13.04 amp => 3 kW Would that mean that my power consumption is 4.49 + 4.78 + 5 + 4.18 + 3 = 21.45 kWh ? AI: When you calculate kWh you are actually calculating energy, which is indeed the integral of power over time. When you get discrete measurements of power, the easiest thing to do is to assume that the power remained constant for the entire time period since the previous measurement. So, multiply each power measurement by the time since the last power measurement and you have an estimate of how much energy was consumed since the previous measurement. Just add up these energy estimates for as long as you like, and you have an estimate for the total energy consumed over that period of time. Be sure to mind the time units when making these calculations. It might be easiest to calculate watts times seconds (which equals joules) at each measurement interval. After you have added the number of joules that were used you can convert to watt-hours by dividing by 3600 (number of seconds in an hour). Divide again by 1000 to get kWh.
H: Can I turn on a relay OUAZ-SS-105 from high on P26 Is it possible to turn on a relay OUAZ-SS-105D using a high on pin 26. See image Case 1: if I replace the P26 connection with a wire to vdd the led "GOES ON". The vdd voltage is 3.3 volts. Case 2: if I apply a high to P26 (which reads as 3.3 volts as well) the led DOES "NOT" go on. What is the difference of the volts from the vdd or p26? AI: GPIO pins of a microcontroller are weak and have no capability to drive a relay directly. In general the IO pin would drive a transistor, and the transistor would drive the relay coil. The 3.3V is also below rated operating voltage of the relay so it would not be reliable anyway to drive a 5V relay with 3.3V.
H: Why are Alkaline, NiMH, and Li-ion AA measured differently (mAh, mWh, etc)? Looking around Amazon, it seems that different types of batteries are measured differently: Does anyone know why? Li-ion are measured in mWh 1200mWh ALTIZURE (Cheap-Os) 3200mWh Deleepow 3000mWh AmpTorrent NiMH are measured in mAh 2000mAh Eneloop 2800mAh EBL Alkalines are typically not measured "Long Lasting" Duracell "Longest Lasting" Energizer I assume that Alkalines are not measured for some sort of historical reason with marketing departments? ... or is it that alkalines so mystical and unreliable that giving them a measurement is too aggressive? Or that switching to non-toxic / non-mercury was such a bad move in performance that measurements had to be removed in the 90s so people wouldn't know? Perhaps NiMH are measured in mAh because the voltage can very so greatly and mWh doesn't make sense? Are Li-ion measured in mWh because that's more consistent with non-battery measurements and they do deliver reliable voltage? AI: cIt's complex, and some of the answers are "soft" and some of you assumptions are (reasonably enough) inexact. Li-ion are measured in mWh LiIon cells are frequently measured in mAh capacity. LiIon batteries (1 or more cells) often have mWh and mAh markings. Neither is a certain measure of what a user will receive. Both are useful. (cf George Box's "All models are wrong, some models are useful") A LiIon cell have a mean voltage of 3.6 to 3.7V. If you multiply the mAh rating x 3.6 or 3.7 you get the Wh capacity. The true Ah capacity of ANY battery depends on usage profile - constant current, constant power, pulsed drain of X amps for xx ms every xxx ms etc. LiIon is relatively close in mAh ratings across its capacity range compared to some other chemistries. A LiIon cell in low to medium power applications (eg total discharge times of hours) has Vout of 4.2 V o/c fully charged and say 3V fully discharged at light or typical currents. Vmean is say 3.6V. If you discharge at constant power of say 10W then at 4.2V I = P/V ~= 2.4A and at 3V I = P/V = 10/ 3 = 3.33 A. ie a change of 2.5:3.3 ~= 0.75:1 or 1.33. If a mAh rating is used then a say 6Ah cell will give t = Ah/I = 6/3.3 or 6/2.5 = 1.8 hours or 2.4 hours at the current extremes, and in practice somewhere in between. The same cell will probably be rated as Wh = Ah x 3.6V = 6 x 3.6 = 21.6 Wh. Run time = Wh/P = 21.6/10 = 2.6 hours. In this case the true run time will probably not exactly match and of the above but is liable to be near or maybe above the 2.6 hour figure. If discharge was at constant current different calculations apply. Say we set 10W at 3.6V =~ 2.75A At 4.2 V, P = V x I = 4.2 x 2.75 = 11.6 W At 3V, P = 3 x 2.75 = 8.25W Ah rating gives discharge life of t = Ah/I = 6/2.75 = 2.18 hours Wh rating gives time of t = Wh/P_V3.6 = 21.6 / 10 = 2.16 hours. Close enough. Neither may be correct. As you draw more current from a LiIon (or any other) cell the voltage will drop. Terminal voltage will depend on state of charge, current, capacity, past history, ... . A voltage is lower or much lower at very high drain, the chosen termination voltage will affect the apparent mAh capacity. And more So - a LiIon battery Wh rating from a reputable supplier is the approximate Wh achieved under typical use in a typical application. A battery in a laptop may (or may not) be rated differently than one in an eg power wall, or electric vehicle or power tool. _________________ NiMH are measured in mAh More liable to be true. NimH have a far flatter discharge voltage curve across their capacity range. Usually we take Vmin = 1V or even higher. Vavg may be around 1.2V at low to medium loads and l.2 - 1.15V as load increases - and lower under very heavy loads. ____________________________ Alkalines are typically not measured Largely true. Datasheets with extensive to extremely extensive information are available from reputable manufacturers. Those who know the fine detail of their requirements and wish to design for an application are generally well served. Those who wish to pop in a new set of batteries are passed on to the marketing department. Top AA Alkalines are nowadays about on par mAh wise with the top NimH AA cells. Actual capacity can depend very substantially on the application and conditions. No/low/medium/high currents, pulsed versus intermittent versus continuous loads and more alter the results. If you are an end user and you want a well performing battery then "long lasting" and "longest lasting" are less important than the brand name. mAh or Wh ratings would be a guide, but no better than the brand name for most users. For longest lasting top energy AA cells Eveready Lithium primary cells seem currently to be "it". Other reputable brands products will not be far behind They have a very flat discharge curve at usefully higher voltages than Alkalines across the discharge range. I personally never buy top brand Alkalines as I have found that "trustable"* volume-sold rebranded Alkalines provide better energy capacity per $. Trustable: Usually those sold by larger chain stores or major outlets. MUST weigh >= 20 grams. 23g better. More again better still. "New" Alkaline Vo/c: 1.65V+ New new. 1.6 - 1.65 V - 0-6 months. Maybe 1 year since manufacture. 1.55 - 1.6V - 12 -24 months old. Maybe more. Under 1.55V - NOT Alkaline or very old.
H: PT4115, where should I put output capacitor? The PT4115E datasheet states: Peak to peak ripple current in the LED(s) can be reduced below 30% of the average current, if required, by adding a capacitor across the LED(s). Can you confirm that "across the leds" is: from : between Rs and led to : between led and L ? AI: Yes. It is pretty straight forward. Exactly in parallel with the LEDs Please check whether adding the capacitor has an impact on the dimming frequencies and startup delay based on your end application.
H: How to compute clock cycle time from given frequency let's say I have a processor runs at 100MHZ frequency how can I compute from this it's clock time for each cycle? I know that Frequency = 1 / Clock Time but I am having trouble to fully understand how to manually convert it for example, to a nanosecond, given the frequency. Thanks! AI: $$ \text{Frequency} = \frac{1} { \text{Clock time} } $$ or $$ \text{Clock time} = \frac{1} { \text{Frequency} } $$ $$ \text{Clock time} = \frac{1} { \text{Frequency} } = \frac{1} { 100 \text{ MHz} } $$ $$ = \frac{1}{ (1 \cdot 10^2 \cdot 10^6) \text{ Hz} } = \frac{1}{ (1 \cdot 10^8) \text{ Hz} } = 1 \cdot 10^{-8} \text{ s} = 1 \cdot 10^1 \cdot 10^{-9} s = 10 \text{ ns} $$
H: Fortifying PCB traces with solder? In most power supply designs either it's a bench PSU or LED driver etc, manufacturers use solder to increase current tolerance of the PCB trace: Is it a valid choice or it's just to save money? What are the disadvantages of doing this? How much current can solder tolerate? Does the resistance of the solder affects the circuit? AI: It's a perfectly valid choice. An even beefier way is to use a wire jumper on the board but that costs manufacture time. This is nice, it just happens when you flow solder. I suppose you might get the odd solder bridge if your manufacture setup isn't perfect. But easily found and fixed. Also the trace is now exposed, which will make arcing or shorting more of a risk - likely not an issue but should be considered. No idea - look up resistivity of solder, do a geometric estimate of how much you increase cross sectional area. The % increase depends a bit on how thick PCB copper is, but I would think that in general you will at least double the current capacity. (It also depends on how wide the underlying trace is, so there is no fixed answer anyway.) Well yes - it lowers the overall resistance which increases current which lowers voltage drop and hence power dissipated in the trace, all of which is good. That's the whole idea.
H: Voltage and Current Sensor for Alternating Current I want to measure the voltage and current of a AC powered device using a micro controller like Arduino. I am unable to find it.(I am new to these). Is there a circuit or sensor which isolates from the AC and able to measure voltage and current with voltage and current values accurately. I have a supply of 240V and the device consumes around 10A AI: First, are you sure you need to measure voltage? If you have fixed voltage supply then measuring voltage is only necessary if you need high precision data, otherwise you can assume that your supply keeps it constant. Second, this is AC, so do you know exactly what you want - amplitude? RMS? both? In any case, take a look at ZMPT101B module, they are all over the web. And here is a good article on using this module with Arduino. It also explains the importance of calibration and good algorithm to obtain RMS value. Fortunately, Arduino libraries for that are also available. Now, for current I'd suggest using so called "non-invasive current sensor". It is safe to use by clamping it around one of the power wires and then reading 0..1V output with Arduino ADC. There are cheaper solutions (you can check the selection on same Robotshop site) that require soldering and therefore extra safety measures. I strongly recommend finding good insulated enclosure which you can use to hide both voltage and current sensor and have only low voltage connections for Arduino coming out. The enclosure would have a cord with plug for your power supply and a socket for plugging the device. If you have 3rd (earth ground) wire in your supply make sure it is properly connected to the output socket. Keep good separation between AC and logic wires. Once again, safety first. Do not plug your sensor module into power source until enclosure is properly closed. UPDATE: Just came across this module: PZEM004T. It is all over the web with tons of videos, instuctables and Arduino libraries. It is also often sold with nice plastic enclosure. With a bit of precaution it can be used relatively safely as a good power meter. Some people add wireless modules to it, so that no physical connection between monitoring device and sensor is necessary.
H: BLDC motor design, physical appearance question Excuse me if this is a dumb question, but I always wondered why are BLDC motors usually quite short in comparison to their diameter? Is it due to some electrical properties that make this design the most effiecient? How would you compare two motors that both take up the same volume but the first one is short and has a large diameter and the other one is long and has a small diameter (if it's even possible). AI: This really depends on the application. Servomotors are generally longer than wider and this is in order to keep moment of inertia as low as possible, which increases linearly with the length of motor and with a square of radius. This is where you need dynamics. For other applications, where top-notch dynamics isn't required it is preferred to increase diameter, since output power (and torque) increases with the diameter squared. With larger diameter the slots are bigger, therefore electric loading can be increased by the number of turns or number of parallel branches to decrease losses/increase current. The length also increases power but linearly as well as power losses both in copper and core. In series production, it is favorable to pick a basis (given diameter) and increase length in order to achieve higher power and torque ratings. There is also an upper limit to how big the radius can be, given that centrifugal force increases with radius of rotor and with square of speed, so your magnets won't fly off and damage the motor.
H: 2 / 4 quadrant switches - how can current have opposite direction to voltage? I am learning about 1, 2 and 4 quadrant switches, used in inverters etc. I am however struggling to understand how, in the 2nd and 4th quadrant, the voltage can have an opposite direction to current. Using this picture for example I dont understand here how you can have a positive voltage but current in the opposite direction. For e.g. On the left, current would flow clockwise, and on the right, current will not flow, but if it did (i.e. if diode was replaced with a resistor) it would be anticlockwise. However, the 2nd and 4th quadrants indicate current in opposite direction to voltage - but I can't imagine how this could happen since (conventionally) current goes from positive to negative - the electromotive force is acting in one direction; how could current ever flow the opposite way? Any help understanding this would be greatly appreciated; thank you. AI: As shown in the diagram posted with the question, four quadrant switches can block voltages of either polarity and allow current to flow either in the direction of supply to load or load to supply. Blocking voltage in either direction is necessary to use the switch with an AC supply. Allowing current to flow in either direction is necessary to use the switch allow the supply system to either supply power or absorb power. In other words allow current to flow in the direction supported or opposed by the supply voltage. In terms of inverter usage, a four quadrant switch is necessary for a grid-tie inverter that can supply power to a load or accept power from the same system that includes an energy source that can supply more energy than is used locally. Another use is to control an AC motor in four modes, forward motoring, reverse motoring, forward braking and reverse braking.
H: Help understanding SR Flip-Flop The table in the bottom image is the solution for an exercise based on a NAND SR flip-flop. "Complete the truth table for the SR flip-flop." The "initially" row is given, and I was supposed to fill in the q and Q-bar values for the remaining rows. I don't understand the solution - why does changing S to 0 result in Q switching to 1? And why does switching S and R to 0 result in Q = 1 and Q-bar = 1? From my very limited understanding so far in this topic, I would have thought that applying 0 to S would leave Q and Q-bar unchanged, as S stands for "set" and we are not applying a current. Any help much appreciated. Solution: AI: You are making an assumption that might not be valid. You are assuming that forcing S high sets the latch...it's possible that S is active-low, and that a low value on S actually represents the SET input condition. The key to understanding these latch circuits is to remember how a NAND gate works. The output of a NAND gate is low if and only if both inputs are high. If either input is low then we know that the output must be high, regardless of the value of the other input. So, if S=0 then Q must be 1. If R=0 then Q-bar must be 1. If both S and R are low then both Q and Q-bar must be 1.
H: Op Amp Voltage follower I built a simple non inverting op amp amplifier with 2 resistors and a TS972IN powered between 0-5V but my output was always set to 5V. I tried several others Op Amp, others resitors and I also moved my circuit elsewhere (I'm working with a breadboard) and none of this changed anything. In order to solve my issue, I decided to build something even simpler, a voltage follower but I have the same behavior, the output stays to 5V... My circuit with the pinout I use: simulate this circuit – Schematic created using CircuitLab AI: Data sheet, page 5: Vicm Common mode input voltage range VDD + 1.15 to VCC - 1.15 V You're trying to make it work VDD + 0 to VCC - 0 V; that won't do. This is just what is known as Latch-up behaviour. You have a rail-to-rail output opamp. What you'd need to have is a rail-to-rail input and output (RRIO) opamp for this to work.
H: Buck Converter Feedback Circuitry Recently I have been studying feedback in switching power converters, and one thing that is still a bit confusing to me is the way the error amplifier is implemented. Here is what the control diagram looks like from what I understand: The thing that is still confusing me is the error amplifier. From what I understand, that block takes the difference of the + and - terminals, and passes that to the next stage. In terms of things I know, you could use a difference amplifier such as this: When I look at other designs online though, it seems like this is not typically how this is done, and instead the op-amp is driven open-loop with a reference on the non-inverting terminal, and the inverting terminal connected to the voltage divider, like this: I guess in a sense, it is doing the same as the other implementation, except the gain here is much greater. Are both of these approaches valid? What are the advantages/disadvantages of each? Thank you! AI: To add another specific to what The Photon said, error amplifiers in switching regulators are often implemented as gm amps. So they take the difference in voltage on the input and convert it to a current with a gain of gm (A/V). That's a really easy way for IC designers to save a pin as the compensation network goes between the output of the gm amp and ground, converting the current back into a voltage that goes to the modulator. The design of a gm amp is easy too, but the downside is that the gm usually varies 20-30% from part to part making the end user's job harder, typically requiring more gain margin. The symbol is sometimes drawn with linked rings on the output, or without the point as shown below, but it's sometimes drawn like a regular op-amp. From Here: For the circuit shown in your question, it could be that the symbol is a block that encompasses the feedback and compensation, or it could be an op-amp compensator where the user must put a feedback network between the comp pin and the feedback pin. (Also somewhat common). You can see that here:
H: Trying to wire up a couple dozen LED-lit toggle switches to an Arduino Mega Update: Worked out a rough (I'm sure) schematic of the current idea for a smaller version of the circuit. A bit of info before the question; The Arduino has a current cap of 200ma across all I/O pins, with a single pin good for 20ma. This is described as "pull or sink", which I assume means current into, or out-of. Will the parallel switches, in their high number, try to draw too much current through the arduino from its GND pin due to the LED's, or will it remain at a healthy level (thanks to the pulldown resistors, or some other sorcery I've missed)? Exact values haven't been figured yet, but I'm assuming roughly the full 15-20ma per-LED(They will almost certainly be burning at a lower current, but I'd like as much wiggle room as I can wrest). simulate this circuit – Schematic created using CircuitLab Edited for clarity. I'm attempting to wire 34 LED-illuminated toggle switches to an Arduino Mega. I need the Mega to be able to read the state of these toggles while still being able to utilize the LED indicators. The indicator needs to be on while the switch is closed, and off while the switch is open. These switches have a much lower forward voltage than the 12v supply that I am powering the project with, and so I need to find a way to step the voltage and current down to something the Arduino can digest. The questions, therefore, are as follows; 1: Since the 34 toggles need to be individually readable, I will need to (if I understand correctly) wire their ACC output to the Arduino's I/Os individually. This means I will need to create a rather large parallel circuit from the 12v supply, over through the switches, and down into the Mega. Is there a way that I can do this that won't cause an immense heating issue? Will the current from the large number of parallel branches build up and try to kill my Mega, or can I use resistors to limit the current without causing more issues? Will these create a heating problem? 2: The 12v stepped down to 5v would be ideal, as prefacing the Voltage Regulator I foresee using for said stepdown, there is a 12v LED strip that I need to drive to serve as a backlight. This will be kept separate from the Arduino, and is simply controlled by an on-off toggle switch. Will wiring this strip in parallel to the voltage regulator cause some unforeseen issues with the rest of the circuit? https://www.adafruit.com/product/1476 https://www.adafruit.com/product/3218 https://www.adafruit.com/product/1439 LM2596 Stepdown regulator AI: These switches have a much lower forward voltage than the 12v supply that I am powering the project with, ... Switches don't have a forward voltage. The resistance of the switch will be very low when closed and the voltage drop across them will be very low. ... and so I need to find a way to step the voltage and current down to something the Arduino can digest. The questions, therefore, are as follows; Run the switches and LEDs from the same PSU as the microcontroller - typically 5 V. 1: This means I will need to create a rather large parallel circuit from the 12 V supply, over through the switches, and down into the Mega. Is there a way that I can do this that won't cause an immense heating issue? Will the current from the large number of parallel branches build up and try to kill my Mega, or can I use resistors to limit the current without causing more issues? Will these create a heating problem? The microcontroller will draw a current dependent on it's input impedance which will be in the order of 50 to 150 kΩ due to the internal pull-up or pull-down resistors. On a 5 V supply this results in a current of < 0.1 mA per switch giving P = V × I = 5 × 0.1 = 0.5 mW. Heating will not be a problem. simulate this circuit – Schematic created using CircuitLab Figure 1. The pushbutton and toggle switch schematics and how to use them. The circuit relies on built-in pull down resistors on the inputs. If you don't have them you'll have to add in external pull-downs. 2: The 12v stepped down to 5v would be ideal, as prefacing the Voltage Regulator I foresee using for said stepdown, there is a 12v LED strip that I need to drive to serve as a backlight. This will be kept separate from the Arduino, and is simply controlled by an on-off toggle switch. Will wiring this strip in parallel to the voltage regulator cause some unforeseen issues with the rest of the circuit? No. From the update to the question: The Arduino has a current cap of 200ma across all I/O pins, with a single pin good for 20 mA [capital 'A' for ampere]. This is described as "pull or sink", which I assume means current into, or out-of. Correct. Sink is current into the GPIO when used as an output. The opposite would generally be referred to as 'source' rather than 'pull'. Will the parallel switches, in their high number, try to draw too much current through the Arduino [capital 'A' for Arduino] from its GND pin due to the LED's, or will it remain at a healthy level (thanks to the pulldown resistors, or some other sorcery I've missed)? The microcontroller is only monitoring the actual switches and will draw negligible current from them. The LEDs are fed from the voltage regulator, not the Arduino microcontroller so there is no problem there. Exact values haven't been figured yet, but I'm assuming roughly the full 15-20 mA [capital 'A' again] per-LED. (They will almost certainly be burning at a lower current, but I'd like as much wiggle room as I can wrest). Just add them all up and check that your regulator can provide the required current. The Arduino's microcontroller doesn't have internal pull-down resistors so you need R2, 3 and 4 but wire them and the LEDs as shown below. simulate this circuit Figure 2. Corrected version of OP's schematic.
H: Why can both parties feel static electricity Sorry I'm new to electrical engineering, trying to clear up some confusion on how static electricty works and why both people feel a shock when touched by static electricity. When creating a circuit, Electrons flow from the source through the load back to the source. However, lightning an electricity seem more like a 1 way current. If static electricity is one way, and you're send electrons to someone why would you feel the shock? But maybe I have a misconception static electricity and the electrons complete the circuit and then return, In this case: Do you feel the initial shock (Electrons leaving your body) or is the feeling from the electron coming back in? AI: A static discharge is a “one way” circuit phenomenon and, is due to an unequal amount of surface charge on one body compared to the other. At the point of contact, the charge flow (aka current) concentrates for both parties and this means that the current density is higher and therefore the power dissipated in that small contact area is quite noticeable by the nerves for both parties. If it were a more powerful current flow it could cause a contact burn but luckily static discharges from body to body or body to car are not that powerful. Notable is the scenario when holding the metal stem of your car key and touching the car door lock. You’ll barely feel anything because you have much more surface skin area contact to the key and the power per square milli metre is much reduced. Also notable is that if the recipient of the discharge is holding a piece of metal (good surface area contact) and the “emitter” made a small contact touch with the metal, the recipient would feel nothing whereas the guy making the small contact with the metal would feel the localised-to-him discharge.
H: Help explain op-amp description by Forrest Mims The following description is from the book Op-Amp IC Circuits by Forrest Mims (2nd edition 1994): As a newbie, the entire paragraph is counter-intuitive to me. If amplitude is reduced, why is there a reference to a gain? Also, if there exists a better textbook on the subject, I would appreciate that information as well. AI: There is reference to gain because an opamp is designed to, in the absence of negative feedback, amplify the signal very very large, but vaguely specified amount. This is the so-called "open loop" gain. Open-loop because there is no negative feedback so no loop is closed by a signal going from the output back to the input. Negative feedback reigns in this very large, vaguely specified output so it is no longer as large as it would have been, but is still at a level larger than the input, and it is now well specified. This is the so-called "closed loop" gain. We do this because it is difficult to manufacture transistors with accurate and stable gains, but it is easy to manufacture transistors with very very large gains. Then you can use resistor ratios which are easy to manufacture accurately to get the exact gain you want. The reason a very large, poorly specified gain becomes a smaller, well-specified gain when you add negative feedback is due to the math. The equation for the closed-loop gain (which implies negative feedback) contains resistor values and the open-loop gain as variables. But as the open-loop gain approaches infinite, it approximates itself out of the equation and disappears leaving only resistor values behind.
H: Can I drive 3.75 V / 370 ohm coil relay from Raspberry PI GPIO output? I have discovered that there are relays like these available on the market that trigger at 3.75 V and have coil resistance above 370 ohm. I assume this would mean about 14 mA or about that might be within allowed limits of Raspberry PI. How good is the idea to drive these relays directly from GPIO, without the amplifying transistor? There are few similar questions of the site but I think they do not address this group of relays. If not, I would build a circuit as described here but I need a quick and very reliable solution, so less components may help. AI: The "3.75V" types are designed for 5V nominal so forget those. They need about 4V to operate reliably and the RPi will give less than 3.3V. The 3V nominal types have a 137 ohm coil and will draw about 20-24mA from a 3.3V supply. That's too much to drive safely from the Raspberry Pi GPIO output. You could use a CMOS buffer but it would make a lot more sense to use a small MOSFET or BJT. Note: You could parallel two outputs configured to maximum (16mA) drive and it would probably be okay if you can ensure that the outputs are always in exactly the same state. Not a chance I would like to take. The relay would get about 2.8V minimum and they need 2.6 so they'd be okay.
H: Is ferrite correct material to use for a DC current sensing application I am trying to build a non-invasive current sensor using a hall effect sensor and ferrite core. I am using a hall effect sensor sandwiched between 2 halves of a ferrite core like this: ferrite core - digi-key I grooved out the core with a dremmel so that the hall effect sensor can sit inside and allow the flux lines to pass through it. It works well until the ferrite core magnetizes after the wire being sensed has current flowing through it long enough.. Is there a better material to use other than ferrite that will allow flux lines to pass, but not become magnetized? AI: The best way to use a flux concentrated DC Hall is like this Blue is ferrite or iron, black is the two Hall devices. First, note there is no milling out of pockets with a Dremel for the sensor to sit inside. This way, there is a large consistent air-gap to lower the overall permeability of the ring, to prevent it saturating with small currents. You've not provided a picture of how your Hall sits in a groove, but I suspect it allows the two halves of the core to touch. This (1) allows most of the flux to bypass the Hall and (2) with no airgap the cores saturate at low currents. Second, there are two Hall devices, one facing up, one facing down. The electronics adds the two signals together. This tends to reject any fields in the sensed gap caused by linear external fields, while doubling the sensitivity to fields round the core caused by the current. Alternatively, you can have the two Halls facing up, and take their difference, which might be easier to do in a bridge configuration. The gain of this configuration is linearly sensitive to the length of the airgap, for high permeability magnetic material and small airgap. Take some precautions to make the gap consistent, for instance with a non-magnetic spacer like aluminium, if you dismantle the device between calibration and measurement.
H: Analog reading in raspberry pi I am trying to read an analog input using a raspberry pi zero W, but all of the GPIO are digital. Can you guys maybe suggest on how to get around this or maybe point me to forums or guide regarding the matter? I am also a beginner in using raspberry pi. all response would be appreciated AI: No analog input on the raspberry pi sorry. You either can use digital input and ADConverter or using I2C or SPI Bus with a sensor using one of these protocols. ADS1115 is an I2C 16 bit four channel ADC.
H: How does an SR Latch get started Noob question, but I'm not seeing how an SR latch such as the one in the image can "get started". If each input depends on the output from the other, how can there be two inputs to each gate to set the thing in motion? In a rudimentary circuit consisting of exactly one NOR-based SR latch, what happens when the power is switched on (e.g. battery connected)? AI: It is true that the latch will "wake up" in an unknown state. In the real world, given a little time, the latch will have a valid state with either Q=0 or Q=1. You make the latch "get started" by setting one of the inputs (R or S) to be a 1 while the other input is a 0. This will force the latch into a known state, regardless of whatever the previous state of the latch might be. In other words, if you want to know the state of the latch then you must explicitly Set or Reset the latch.
H: Sziklai pair feedback loop I've read that Sziklai is prone to high frequency oscillations due to its feedback loop. I can't figure out where this feedback loop actually is. It should be obvious but I haven't understood this concept. AI: I have illustrated much of what was said in the answers and comments above and expanded it by some of my thoughts. 1. Compound transistor. The n-p-n and p-n-p transistor connected in this way form a compound n-p-n transistor T (in blue). We can think of this combination of as a "weak" n-p-n transistor "helped" by a stronger "brother" or, in terms of equivalent electrical circuits, as of two current sources in parallel. With a little more imagination, it can reminds the Howland current pump where another "helping" current source is connected in parallel to the the imperfect input current source... like an INIC negative resistor... 2. "Emitter" follower. Once accepted it is just a single transistor, we see that here it is connected in the well-known circuit of an emitter follower. It copies, by means of the negative feedback principle (the little block diagram), the input voltage VIN on the load RL as follows: The output voltage VE is compared with the input voltage in the possibly simplest way - by connecting the two voltage sources contrary in series. So their voltages are subtracted according to KVL... and the result is applied to the amp input (the base-emitter junction). Note the compared voltages are grounded while the input, where the result appears, is floating. Thus the subtractor (in yellow in the block diagram) is made at no cost; it is just the loop... a piece of wire... When we change (e.g., increase) the input voltage VIN by moving the potentiometer slider, the Sziklai transistor T reacts to this "input disturbance". It begins increasing its "emitter" current through the load RL and, accordingly, the output voltage VE across it, until reaches the equilibrium (with VBE below VIN). This is, roughly outlined, the mechanism of this kind of negative feedback called "emitter degeneration". 3. Active diode. Now let's try to see another (internal) negative feedback. Remember the so-called "active diode" that exploits a dual kind of negative feedback. There the output (collector-emitter part) is connected in parallel to the input (base-emitter junction); this is simply a transistor which collector is connected to the base. So we can note that in the Sziklai configuration, there is such a connection (negative feedback network) between the collector and base of the output transistor... and this is the collector-emitter part of the first transistor. It turns out that when the input transistor is close to saturation, it will act as a feedback network (like a piece of wire) that conveys the collector voltage variations to the base. As a result of this negative feedback, the output transistor will be never saturated (will be ever in active mode). Of course, in this emitter follower application, the input transistor is never saturated... but in other applications where its emitter is firmly connected to fixed voltage (common-emitter stage), it can be saturated...
H: What does the dashed line between diodes in a CMOS protection network mean? On the datasheet for CD4007 there are schematics for the input protection network: and the output protection network: On both, there are 2 diodes connected by a dashed line (D2 on the input and D1 on the output). What does the dashed line mean? AI: The dashed line means that the diode is actually distributed across the resistor structure. The resistor is made using a doped region in the silicon, and there is an inherent PN junction between this doped region and the underlying silicon that contains it. So there is really just one diode, not two, but it is neither before nor after the resistor...it is part of the physical resistor structure itself.
H: Sziklai pair and Darlington pair input impedence If i remember correctly the input impedence of a BJT is r_pi=Vt/Ibq. I've read that using those two configurations I get a much higher input impedence. Can someone please tell me why? Maybe some formulas to prove the fact would be appreciated. Cheers AI: Simply follow the current path. Look at this example: Where each transistor has a current gain equal to \$\beta = 99\$ As you can see the input base current is very small due to the BJT's current gain. And the input signal source see the \$R_E\$ resistor as much large resistor \$R \approx \beta_1 \times \beta_2 \times R_E \approx 100k\Omega \$
H: How current leads by 90° in capacitor while charge on other plate is always opposite, should we not say it lead by 180° When we start charging the capacitors the charge on the other plate is always opposite & equal then how come we say current lead voltage by 90°, should not we say that it lag/lead by 180°. AI: Actually your text has a proper physical interpretation. When a capacitor is charged with sinusoidal current and the potentials of both plates are observed independently against a distant reference point in the space, we really can say that the AC components of the potentials have opposite phase angles or as well one leads another by 180 degrees. But that's not better nor worse than the totally other fact: The sinusoidal charging current of a capacitor leads 90 degrees the voltage between the plates. These two facts have only a common happening environment - a capacitor under charging with sinusoidal current.
H: Is it possible to reduce the Miller's plateau voltage? Consider the following circuit: Image source: Simplified Clamped Inductive Switching Model - Figure 3 from "Fundamentals of MOSFET and IGBT Gate Drive Circuits by Texas Instruments" I would like to improve the turn on speed of a MOSFET/IGBT. To do this, I think about reducing the Miller's plateau voltage in order to have a higher voltage between the driver (output high) and Vgs in order to charge Ciss more rapidly. And so reducing the Miller's plateau time. However I do not know if it is possible to reduce the Miller's plateau voltage. The Miller's plateau begins when the drain voltage begins to decrease, i.e. when the diode stop conducting. So how to stop the conduction of the diode faster? A diode with low reverse recovery time would be the solution? Did I make a mistake? Is this wrong? Have you other recommendations/advice? More generally, is this a good idea to reduce the Miller's plateau? AI: The Miller effect is due to having a capacitance across two points with a negative voltage gain between them. [Intuitively you can think about one side of the cap getting pulled down by the gate-drain gain while the other side is pulled up by the gate driver, so you need to add the extra charge that the drain is trying to pull out.] It multiplies the capacitance by ~ the voltage gain. So while you are transitioning through the linear region where the FET has gain you can't avoid it or change where it starts, you can only add more gate drive current to get through it faster. From here:
H: Substituting an inductor - cannot find any pieces containing inductance needed I am a beginner electronics hobbyist trying to follow an old schematic / instructions to build a theremin. I have all of the pieces except one. This piece (Toko 154ANS-T1019Z) calls for a "68 µH, hi-Q, variable inductor". However I cannot find a 68 uh variable inductor at all (See link, all options are discontinued pieces which cannot be purchased). Note: Octopart shows the part may be available when it is not. The websites Octopart uses show the part is unavailable. In other words I cannot find this part or any variable inductor with 68 uh inductance See the potion of the schematic below: How could I substitute this piece? AI: 82 uH is small enough that you will have no problem winding it on a coil former with tuning slug. Suppliers such as Mouser may have formers with inductance per turn_squared specified. ________________________________ You can take a tuneable inductor with higher inductance and remove wire to obtain the inductance that you want. As inductance is proportional to N^2 (turns squared) then L1/N1^2 = L2 / N2^2 so N2 = N1 x (L2/L1)^0.5 So eg a 1 mH inductor with 100 turns would give ABOUT 82 uH using N2 = 100 x (82/1000)^0.5 = 29 turns. ________________________________ As ThePhoton notes, tuneable range of the part you cited is small. You should try to ascertain what the required tuning range is for the original part. Also, why is it tuned? - it may be possible to alter some other circuit parameter. Can you supply a circuit or link?
H: Having hard time to identify feedback types update: I have read similar questions on ee.se, they helped a bit, but it is still hard to understand the type for example in the question in figure. Maybe, you can just explain specially the question below. Series-shunt, shunt-shunt, current mixing, voltage sampling,... All these keywords became a total mess in my head. I cannot find a logical way of how to categorize those feedback types. The picture is just for an example, I would be appreciated if anyone comes up with a neat way to identify the feedback types and when it is sampled or mixed. AI: I cannot find a logical way of how to categorize those feedback types. This is a formal classification, in which these names say very little about the essence of things... because there is no way to convey in two words something that is explained by pages of text. The solution is, while trying to figure out an unfamiliar circuit, to think with simple words and concepts. Once you understood what it is, what it does and how it does, you can "stick" one of these "labels". Let's try doing this procedure with your example above... First we see two cascaded amplifiers - an op-amp A and an emitter follower. The op-amp is well-known for us... but what is this current source (more precisely, sink) in the emitter follower? What is its function? Then we see the capacitor C and conclude that, regarding the DC voltage, the follower output is separated from the resistor network R1-R2; so the latter will draw no current from the emitter... Meanwhile, thinking about the current source, we realize that actually it is not a source... it is a 2-terminal element (dynamic resistor) which IV curve resembles the IV curve of a true current source. We remember that any transistor has such an output curve... so this is probably the collector-emitter part of a transistor with constant base-emitter voltage (current). Next, we realize that the emitter follower is actually a voltage source producing its output voltage at the emitter. So, we conclude, there are two dual sources - voltage and current, connected to each other. We know (from the course of electrical circuits) this is the perfect combination between them... since the current source sets the current and the voltage source sets the voltage. It is interesting that when adjusting the DC (bias) emitter current, the transistor adjusts its base-emitter voltage so that to pass this current. Then, when the transistor varies its emitter voltage, the current "source" adjusts its internal resistance so that to keep the current constant... i.e., they interact each other. So the emitter will "see" the extremely high (dynamic, differential) resistance of the current source that is so desired. We remember the same trick is widely used to bias the transistors of op-amp input differential stages. Finally we see the op-amp and the emitter follower are combined to create a buffered op-amp. Regarding the AC voltage variations, we think of the capacitor C as a short connection since it conveys them. And now we see the ubiquitous voltage divider network R1-R2... and realize it is the negative feedback network needed. Most likely, we know what is the divider input and what the output... and we see its input (R2) is connected to the buffered op-amp voltage output. How is it connected? It is connected in parallel to the output... it shunts the output. So we have found the one of the two so valuable words related to the feedback network input (the way this input is connected to the amp output). Let's now try to see how the feedback network output is connected to the input side of the amplifier. First we see it is connected to the inverting input (between it and ground). Then we see that the input voltage is applied to the other (non-inverting) input. Besides, both voltage "sources" are connected with their lower ends to ground... and with their upper ends to the differential input. So, we conclude, the two voltages (input and feedback) are connected in series to the amp differential input. Thus we have found the other valuable word. Then, given the signals are moving from left to right, we coclude the full name of this type of negative feedback should be series-shunt, series-parallel, series-voltage... or voltage-series? But much more important than the name is to understand the properties and benefits of such a connection...
H: Spoofing or hiding monitor serial number A MAC address of a computer can be spoofed by an FPGA which can be programmed as a network controller. I can set a custom MAC address to it. I turn off the motherboard's network interface controller in BIOS. I use the FPGA that is programmed as a network controller. A software can in no way fingerprint my computer. SSD or HDD serial can be spoofed by Raid controllers which do not reveal the serial numbers of the connected SSDs or HDDs. A software can in no way fingerprint my storage devices. How can I hide monitor serial numbers in a similar fashion? AI: An EDID emulator should work for this purpose. But sometimes the monitor does not even have a serial number in the EDID so you may not need any tricks.
H: Is there any reason why 5 volts is so ubiquitous for powering small consumer electronics? So pretty much every phone charger, tablet charger outputs 5 volts. 5 volts was part of the original USB specification which I assume had some influence on this, resulting in it just being easier to design things to be powered by such a common power source. However is there any good reason why 5 volts was chosen? AI: While the original call for 5V was doubtlessly for TTL (as mentioned in the comments, specifically the reverse-biased BE junctions of bipolar transistors which are almost ubiquitously rated for 6V), there are several other things that play nice with the 5V standard: reverse voltage rating of LEDs is usually 5-6 volts as well, so 5V is suitable for charlieplexing charging single Li-Ion cells powering devices like the said phones, tablets, etc. You take the USB standard voltage, which is 5V ±5%, so 4.75 min at the USB socket. Then your cable will have some resistance, so what arrives at the device can be diminished by a few 100s of mV. And then you can use a simple linear battery-charging IC like the MCP73831, which will charge the battery to e.g. 4.2V. Since the source and target voltages are near, the losses would be manageable. Linear converters are much simpler than the alternative (DC-DC converters), and are especially suitable for a low-power device, meaning simpler and more compact power electronics and lower cost. If the standard were 4.5V instead of 5V, probably the battery wouldn't charge completely in the worst case (and DC-DC would be a must). If it were 6V instead of 5V, then the linear regulator losses would start to become considerable. 5V is a good middle-ground. On the last point though, I'm not really sure what's the causality direction. It could be that Li-Ion fitted perfectly with power supply rails for typical small electronics, which led to its ubiquitous use.
H: What is the correct name for a footprint that connects to a panel mount component? Let's say you have a panel mount switch. When you create the footprint for this switch, you aren't creating it for the switch itself, rather, you are making a footprint with holes for the wires that will be run to the switch on the panel. So what do you call a footprint that isn't for the component itself, but for wires that will run to the component? It's driving me nuts not having a way to refer to this. I've been calling them "interfaces" but it's a stupid name and just a filler until I learn the correct word. What are these types of footprints called? AI: Use the most sensible name that will mean the most to most people. If the footprint connection is to a switch then call it SW1 or SW2 etc.. The switch is soldered to wires that connect to the circuit board so, it makes sense to provide meaning in the footprint name. If the panel switch is an SPST type you could even call it SPST1 or 2 etc..
H: Why do I need to use a power amplifier after using a voltage amplifier? Speaker systems usually use a small-signal voltage amplifier followed by a power amplifier: Couldn't I use a single voltage amplifier which gives me the desired voltage to drive the load? Why is there the need to have two separate amplifiers? Why is it called a power amplifier as opposed to just a voltage/current amplifier? AI: However, couldn't I use a single voltage amplifier which gives me the desired voltage to drive the load, why is there the need to have two separate amplifiers? You can, but you might find that internally it uses two stages of amplification. If you read up on gain-bandwidth product you will find that this figure limits the maximum gain of an amplifier for a given bandwidth. The workaround for this limitation is to amplify in two or more stages. Distortion will generally be lower with lower gain as well. And also why is it called a power amplifier as opposed to just a voltage/current amplifier? The 'signal' of signal amplifier indicates that we are dealing with signal levels typically of 1 V or less and low currents in the range of a few mA or less. If you look into a power amplifier you will find power components such as "power transistors" and a suitable power supply. These are required to drive low-impedance loads such as loudspeakers. The terms are old but have a fairly clear meaning for an audio engineer.
H: Beginner questions on some SMD components in phone motherboard I'm trying to understand smartphone motherboard components and have a few questions that might be easy for some of you to answer. Please refer to the attached image for the question numbers: Are these all capacitors? What is that tiny component that was accidentally moved/damaged by repairmen I guess. What are these black and silver components? Inductor coils? What is this component? It's blackish in nature than how it appears in this photo. AI: They do look like rather "gigantic" (for phone integration) caps, yes. But they could also be something else – like a whole filter. But, seeing them in this context, yeah, caps. An SMD 0201 component. That's pretty much all one can say with certainty. From here, it looks like it might be some resistor (totally unknown value), but it might also be a low-value capacitor. Probably yes, but again, since one can't look inside SMD components... But, if they are, then the closest IC is a switch-mode power supply controller (or has one built in). If you know that's the case: here's your inductors. an SMD resistor, capacitor, miniature ferrite bead, diode, or other component.
H: Shifting an audio signal from 0 - 4V to -2 - 2V I'd like to transmit an audio signal over a digital radio and I figured out I'd need an op-amp in an inverting configuration on the transmitting side to turn a -2V to 2V signal into a 0-4V one. That will be fed into an ADC which then supplies the radio with a digital signal. On the receiving side though I'd need to do the reverse in order to hear the audio properly, so that means the 0-4V signal now needs to be the -2V to 2V one again. Could an op-amp also be used for this, and how? Thanks for helping! AI: Could an op-amp also be used for this, and how? No need to use an op-amp if your signal is audio. Shifting a biased audio signal of 0 - 4 volts to an unbiased voltage requires only a RC high pass filter. It will remove the DC offset: - You decide on the values of R and C so that the lowest frequency you wish to pass is: - $$F_{LOW} = \dfrac{1}{2\pi RC}$$
H: hall current sensor potential failure mode I was curious what are potential common failure modes for hall-based ac current sensors in a mains ac environment? Specifically those like the acs712 and acs723. Assume you have a 5amp current sensor, and draw 20+ amps of current through it for a sustained period of time. What would happen? AI: You specify AC mains operation and a 5A sensor. This answer focuses mainly (but not solely) on the consequences of the internal shunt in the sensor IC failing open circuit (as can happen). My discussion below assumes potential fault currents far in excess of 5A, or indeed, in excess of the continuous 65A rated current of the ACS723. I've also mentioned DC sensing operation. AC sensing is somewhat less design demanding than DC due to the greater likelihood that an arc will extinguish. In many mains based applications limiting currents to below eg 65A under short circuit is 'easy enough'. However, if current limiting is not specifically designed in, AC mains will often happily source many many hundreds of amps under short circuit. The duration of such overcurrent events may be short - but not always short enough. I'll deal only with the ACS723 as the 712 has an inferior specification and is obsolete. Anything that applies to the 723 will apply to the 712, but more so. _____________________________________ The ACS723 is rated at 65A continuous and claims 0.65 milliohm shunt resistance. At 65A dissipation = I^2.R = 2.75 Watt. Thermal resistance is 5 C/W when mounted in their development board or 23 C/W junction to air bare. At say 3 Watt dissipation (add solder joints,...) temperature rise above ambient would be about 15 degrees c and 115 c respectively. Tjmax is specified at 165 c. That allows (just) operation in 50 c free air with no heatsinking - so quite modest heatsinking will usually keep it "cool enough". Cooler is better for long life but under those conditions no major short term failures should be expected. If you use it in a system with a battery capable of providing hundreds of amps (as I have done) or with AC mains and a good current path, and then experience a short circuit somewhere "downstream" of the sensor (as I have done) then things rapidly can get 'not so good'. At say 200A the dissipation rises to 26 Watts - the evaluation board heatsinking will keep the temperature in check for a very short while - but 26W is too much for any normal PCB copper based heatsinking. At 300A, it's toast. At somewhere above 65A and quite possibly well below 200A the internal shunt may fuse. Unless they have designed an HRC fuse into the package (and they haven't) then under DC an impressive arc will form and sustain until interrupted elsewhere. With AC it MAY not form a sustaining arc, but probably will. Once an arc forms, all bets are off. Ask me how I know :-). The package will carbonise, the PCBA (unless super super special) will join in the fun and a small fire will probably start. Worst case, and quite probably, energy from the current monitored circuit will enter the now-no-way-isolated low voltage power supply and control circuits. Results will depend on design, protection against such an event and Murphy. To prevent the above you can limit Imax to 65A in some way fuse the circuit to open the fuse below 65A. A fast blow fuse is required as you don't know how fast the IC shunt fuses, and you MUST prevent it doing so. Prevent more than 65A flowing in the shunt in some manner during higher current faults. This is a less likely approach but could be achieved with eg a fast acting electronic bypass. Placing the low voltage side of the sensor in an isolated node with 'communications' and powering via fail-safe interfaces is certainly possible and may be viable. But In situations where high fault currents cannot be designed out I'd expect high current side HRC fusing to be a reasonably good solution. In situations where 5A max load was desired and significant power loss in feed circuits was acceptable then ensuring adequate resistance (or inductance with AC) is present is probably satisfactory. eg at 230 VAC, to limit I to 65A max R = V/I = 300Vpk/65 ~~~= 5 ohms. At 5A the loss in 5 ohms is P = I^2R = 125 Watts! This is a significant dissipation level - an HRC fuse and more modest resistance levels are probably in order. _______________________ HRC Fuses!: I mentioned HRC (High Rupture Capacity) fuses several times above. The need for such fuses when arcs can form is crucial. A fuse which opens at say 20A but which can sustain an arc of hundreds of amps (which many non HRC fuses can) is worse than useless as it provides a degree of confidence which is wholly without foundation.
H: Synchronous detector question The author explains it as a synchronous demodulator. Here we can see that two multipliers which multiply both the inverted and non inverted signals. Can I do the same with only one switch for non inverted signal? Circuit shown here is from a lock in amplifier milliohm meter. 5 V pulses are coming from the reference oscillator. 1.8 V pulses are input signal coming from a preamp that amplifies drop across a milliohm resistance. Here is the link http://cappels.org/dproj/dlmom/dlmom.html AI: Yes, you can. You'd have to multiply your results with two. But, you're multiplying with an on/off sequence in that case, and thus you'd obviously lose all info on the negative cycle of your input signal, and atop of that, reduce the amount of signal energy that reaches the integrator by a factor of two. That reduces your SNR. And since you're building a lock-in amplifier, that's the worst you can do. So, analog switches are cheap, and easy to acquire. Don't skip on them. In fact, the part that the author is using comes with four switches in one package, it's unclear why you'd want to use only one of them.
H: Amplifier memory distortion application I've found an article about memory distortion issues in audio analog amplifiers. Available for free here. The author uses in the last configuration a CFP differential input with a cascode of FET controlled by the input and the feedback. I want to use the same method on the Voltage Amplifier Stage (VAS), to provide constant power: I used a CFP Vas with a cascoded MOSFET. Is this possibile? Is this good? Is the principle of memory distortion correct? Does what I'm doing make sense? AI: That's an old site I had maybe 20 years ago. I had forgotten about it... In retrospect I guess this memory distortion thing was just a red herring. This kind of stuff pop up periodically in the audio community, someone finds a magical reason that explains everything, it gets popular then is forgotten then it starts all over again with something else. Sure, if you want an opamp with quick settling time to high precision and low thermal tails then you need an input stage that doesn't get any temperature imbalance, especially when it handles strong input signal. But is that important for audio? Probably not!
H: Analyzing RC circuit that has two "switch" I need to find Vc(t) between 0<=t<=0.01 secs , but teacher draws the second switch as opened. We want to find Vc(t) when t is "less or equal" to 0.01, then why we dont take the switch as closed? Because it is closed at t=0.01 sec. Is it because of its limit from the left? Because vc(t-) is not equal vc(t+). And another thing that makes me confused, when v goes infinite, teacher takes this circuit to find v infinite.(I am talking about the first part of the question. 1-Find vc(t) when 0<=t<=0.01 secs) But after long time (after 0.01 secs), the second switch must be closed. Because infinity is greater then 0.01 sec. Then why we take that switch as opened? Thanks! AI: Well, for \$t<0\$ we know that the circuit is equivalent to: simulate this circuit – Schematic created using CircuitLab The voltage that is created across the capacitor for \$t<0\$, given by: $$\text{V}_\text{C}\left(0\right):=\lim_{t\to\infty}\mathcal{L}_\text{s}^{-1}\left[\frac{1}{\text{sC}}\cdot\frac{\text{R}_1}{\text{R}_1+\text{R}_2+\left(\text{R}_3\left.\right\vert\left.\right\vert\frac{1}{\text{sC}}\right)}\cdot\frac{\text{R}_3}{\text{R}_3+\frac{1}{\text{sC}}}\cdot\frac{\text{I}_x}{\text{s}}\right]_{\left(t\right)}=$$ $$\lim_{\text{s}\to0}\text{s}\cdot\frac{1}{\text{sC}}\cdot\frac{\text{R}_1}{\text{R}_1+\text{R}_2+\left(\text{R}_3\left.\right\vert\left.\right\vert\frac{1}{\text{sC}}\right)}\cdot\frac{\text{R}_3}{\text{R}_3+\frac{1}{\text{sC}}}\cdot\frac{\text{I}_x}{\text{s}}=\frac{\text{I}_x\text{R}_1\text{R}_3}{\text{R}_1+\text{R}_2+\text{R}_3}\tag1$$ Where I used the final value theorem of the Laplace transform and \$\$ means the parallel resistor equation. Now, for \$0\le t<\tau\$ we have the following equivalent circuit: simulate this circuit Using the discharge equation of the capacitor we get (you can also show that using KVL and KCL), we know that: $$\text{V}_\text{C}\left(t\right)=\text{V}_\text{C}\left(0\right)\cdot\exp\left(-\frac{t}{\text{CR}_3}\right)\tag2$$ $$\text{I}_\text{C}\left(t\right)=\frac{\text{V}_\text{C}\left(0\right)}{\text{R}_3}\cdot\exp\left(-\frac{t}{\text{CR}_3}\right)\tag3$$ So, for \$0\le t<\tau\$ we get that the total power in the resistor \$\text{R}_3\$ is given by: $$\text{P}_{0\le t<\tau\text{|}\text{R}_3}=\text{R}_3\left(\frac{\text{I}_x\text{R}_1}{\text{R}_1+\text{R}_2+\text{R}_3}\right)^2\cdot\exp\left(-\frac{2\tau}{\text{CR}_3}\right)\tag4$$ So, for the part when \$t\ge\tau\$, we get the same voltage equation as above. But with a different starting voltage and different resistive value: $$\text{V}_{t\ge\tau\text{|}\text{C}}\left(t\right)=\text{V}_{0\le t<\tau\text{|}\text{C}}\left(\tau\right)\cdot\exp\left(-\frac{t}{\text{C}}\cdot\frac{\text{R}_3+\text{R}_4}{\text{R}_3\text{R}_4}\right)\tag5$$ So, the total power is equal to: For \$\text{R}_3\$: $$\text{P}_{\text{total}\text{|}\text{R}_3}=\text{P}_{0\le t<\tau\text{|}\text{R}_3}+\frac{\text{V}_{t\ge\tau\text{|}\text{C}}^2\left(t\right)}{\text{R}_3}\tag6$$ For \$\text{R}_4\$: $$\text{P}_{\text{total}\text{|}\text{R}_4}=\frac{\text{V}_{t\ge\tau\text{|}\text{C}}^2\left(t\right)}{\text{R}_4}\tag7$$ Using your values I got: For \$\text{R}_3\$: $$\text{P}_{\text{total}\text{|}\text{R}_3}=\frac{32}{125\exp\left(\frac{2}{5}\right)}+\frac{32}{125}\cdot\exp\left(-\frac{4}{5}-100t\right)\tag6$$ For \$\text{R}_4\$: $$\text{P}_{\text{total}\text{|}\text{R}_4}=\frac{8}{125}\cdot\exp\left(-\frac{4}{5}-100t\right)\tag7$$
H: Precision Current Sink for LED Modulation I one of my first designs, I am attempting to simulate a high precision optical transmitter using an LED by varying the brightness in linearly with the incoming signal. The input signal is BFSK, either 30kHz or 50kHz, and ranges from 0V to 5V. The LED's brightness varies linearly with forward current. For this purpose, my goal is to have 20mA forward current when the input is 0V an 80mA forward current when the input is 5V. To do this, I've referenced this guide for higher current LED modulation:Linear Current Modulators for high-power LEDs. My circuit implements the same precision current sink. My circuit is shown below: To get the value of R5, I chose that the resting LED current (2.5V input) should be at 50mA (between 20mA and 80mA). Therefore, 2.5V=(0.050A)R_5 -> R_5= 50 Ohms This brings me to my first question: At 5V, the forward current, using a 50 Ohm resistor, would be 100mA, not the desired 80mA. How can I properly set the 20mA-80mA range using only R_5? I believe that, theoretically, the input voltage (green) and forward current through the LED (blue) should both resemble a sine wave since the input is AC. However, the output I get is different as shown below: It looks like the forward current does not rise above the designed 50mA. Looking at the opamp's noninverting input (blue) vs. the opamp's output (green), the output gets limited at 3.5V: This overall operation of this circuit deviates from what I expected since the output gets limited instead of varying linearly. What can I add or change about this design to achieve linearity? AI: According to the LM324's datasheet, its common mode input voltage can only reach as high as 1.5V below VCC and its output voltage can only go as high as 1.5V below VCC: Any one of the following changes will fix the problem: Set \$R_5\$ to a lower value so that the input only needs to be 3.5V (or less) to produce an 80mA output. Replace the LM324 with an op amp that is rail-to-rail input and output. Power the LM324 with a supply of at least 6.5V.
H: Best practice for handling buffers I'm writing some evaluation code with a lot of rx/tx operations, using the same two buffers and I started to think about how this could easily go very wrong. I can argue that it is nice to clear/reinitialize the buffers with 0's or any other val for that matter for safety purpose, and it's not like my MCU can't spare the extra X ms operations. But at the same time I could also argue that flushing them is just bloat operations as the program behaves as it should. What is the best practice / industry standard when it comes to handling buffers continuously overwritten? Is flushing the buffers after each operation, like wearing a life jacket on land ? void IIS328DQ_Read_All(void) { txbuf[0] = IIS328DQ_REG_OUT_X_H; txbuf[1] = IIS328DQ_REG_OUT_X_L; txbuf[2] = IIS328DQ_REG_OUT_Y_H; txbuf[3] = IIS328DQ_REG_OUT_Y_L; txbuf[4] = IIS328DQ_REG_OUT_Z_H; txbuf[5] = IIS328DQ_REG_OUT_Z_L; // Request X axis high and low bytes ret = HAL_I2C_Master_Transmit(&hi2c1, IIS328DQSADWR, &txbuf[0], 2, HAL_MAX_DELAY); ret = HAL_I2C_Master_Receive(&hi2c1, IIS328DQSADRD, &rxbuf[0], 2, HAL_MAX_DELAY); // Request Y axis high and low bytes ret = HAL_I2C_Master_Transmit(&hi2c1, IIS328DQSADWR, &txbuf[2], 2, HAL_MAX_DELAY); ret = HAL_I2C_Master_Receive(&hi2c1, IIS328DQSADRD, &rxbuf[2], 2, HAL_MAX_DELAY); // Request Z axis high and low bytes ret = HAL_I2C_Master_Transmit(&hi2c1, IIS328DQSADWR, &txbuf[4], 2, HAL_MAX_DELAY); ret = HAL_I2C_Master_Receive(&hi2c1, IIS328DQSADRD, &rxbuf[4], 2, HAL_MAX_DELAY); // Combine high and low bytes 0b00001111+00001111 (Endianness) to 16 bit int x_raw = ((int16_t)rxbuf[0]<<8) + rxbuf[1]; // Shift the 16 bits to a 12-bit representation x_raw = x_raw >> 4; y_raw = ((int16_t)rxbuf[2]<<8) + rxbuf[3]; y_raw = y_raw >> 4; z_raw = ((int16_t)rxbuf[4]<<8) + rxbuf[5]; z_raw = z_raw >> 4; // FS bits set to 00 - min 0.9 | typ 0.98 | max 1.1 // convert raw data using sensitivity (0.98mg/digit ~ normal mode) axisArr[0] = x_raw * Sensitivity; axisArr[1] = y_raw * Sensitivity; axisArr[2] = z_raw * Sensitivity; clearBuf(); } clearBuf() simply fills the rx/tx buffers with 0's up to sizeof() AI: In this specific example, yes I would continue to clear the buffers and call your clearBuf() function. Why? Mainly because you aren't even handling that return status from your I2C tx and rx functions. What happens if your device suddenly becomes unreachable via I2C and all your Receive calls are failing? I don't know what the HAL_I2C_Master_Receive does to the buffer when timeout duration is reached without looking in depth at their specific implementation but there's a decent chance they just leave the buffer untouched. The result could be, if not caught via checking return status or other special handling, that you continue to process data as if it is not changing at all. Real process data will typically be something non-zero so if you're reading a data stream that goes something like [1.56, 1.54, 1.58, 0, 0, 0, 0, 0, 0] a user may be alerted to your device being bad even if you didn't account for handling the specific error condition encountered (such as the one present in your code). Evaluating this single failure mode of loss of I2C communication for two possible data stream scenarios either: Your data stream is typically zero and simply doesn't respond to changes due to the failure Your data stream is typically non-zero and has suddenly zero'd out due to the failure Clearing your buffers makes the error condition visible in the second scenario even if it doesn't improve things for the first one. So--you could (and should) fix your error handling to alleviate this particular issue, but what else are you missing? Sensors go bad, I2C operations fail, power can fluctuate, are you making sure you don't lie to your users?
H: BLDC Motor PWM commutation scheme Actually I'm trying to understand how to control a BLDC motor using trapezoidal method. I've found two illustrative images that show how to PWM each motor phase: First Second In both of this images, the principle is the same. But in the second image there's also low side driven low when high side is high inside PWM part. Which one of this image is correct and why? (or which is better and why?) AI: TLDR: Both control schemes will work to drive a motor. first: very simple, not as efficient second: a little more complex, more efficient The First image is a very simple way to drive a motor and allows you to not have to worry about "shoot through" on your half bridge. "shoot through" is when both the high side and the low side of a half bridge are on shorting your supply to GND. this will usually blow up the FETs or the supply. The problem with this simplicity is that when the high side is being PWMed the motor will want to pull current when the high side FET is off because of the motor acting as an inductor. The motor will pull this current through the diode on the low side FET. this will cause energy to be lost in the low side FET diode. This causes inefficiency and heats up the low side FET. The second image is how most motors are driven because it is more efficient. the image shows that you are not just PWMing the high side FET but applying the opposite of the PWM signal to the low side FET. This means that the when the high side FET is off the low side FET is on meaning that the reverse current does not have to go through the diode and waste energy. One of the problems with this control scheme is that you must add a delay between the high side FET being one and the low side FET being on to prevent "shoot through".this delay is called "dead time". It is usually a very small amount of time 100's of ns though. most motor driver IC's will introduce this dead time for you.
H: MCP16301 fail on power up - Vin shorted to Vout I have designed a step-down converter PCB (4-layer) with MCP16301. It converts voltage from 24V to 5V. When I connect it to power source and then connect a 100ohm resistor (50mA@5V) it works normally. But when the load is applied before I power it up MCP16301 dies instantly and shorts Vin to Vout (Vout is 0.5V lower than Vin - probably a voltage drop across internal mosfet). No other components are damaged. When MCP16301 is replaced it works again. I've already destroyed 3 of them. Schematics is an exact copy from datasheet: Components: input cap 10uF 0805 35V inductor 22uH boost cap 100n 0603 50V schottky diode 60V 1A 1n4148 diode 100V 300mA PCB layout (gnd plane hidden): with ground plane: I've been troubleshooting this for a couple of days so any ideas/solutions would be greatly appreciated. Note: PCB was powered by connecting an alligator clip (not a proper switch) and there was a small spark. Power source is a Chinese lab power supply. Edit: I followed Andy aka's advice and added a zener diode (30V) but the chip still got fried. Luckily i was able to get an oscilloscope this time. Here are the photos (because of stackexchange link limitation i can't post clickable links) (blue - inptut voltage, yellow - output voltage; 10V/div) There is a 2us 60V spike at the beginning (despite 30V zener diode) so I guess zener diode is not fast enough? Edit2: I added an electrolytic capacitor (100uF, ~0.5ohm ESR) as suggested by @Peter Smith. It now works and the voltage is also a lot cleaner (ignoring some high frequency ripple): AI: PCB was powered by connecting an alligator clip (not a proper switch) and there was a small spark. Power source is a Chinese lab power supply. I've seen this problem before on switching regulators and I suspect that the answer may lie in the inductance of the power supply and cable feeding the chip. On connecting the alligator clip there is an "inrush" current to charge the input capacitor and feed current to the load. That inrush current will reduce quite rapidly and, any parasitic inductance in the supply feed wiring will produce a kick-back voltage that may take the input voltage above the absolute maximum limit of 30 volts. When the load is not initially connected, that inrush current will be smaller. The situation I saw it on was when an LC filter was inserted before the regulator and I was performing an output short circuit test. The test showed that the switching regulator was current limiting (as per the specification) but, on removing the output short, it fried. I correctly realized it was the input inductor and lived without it. You might try adding a 27 volt zener diode across the regulator power input terminals.
H: Do enclosed switching power supplies follow any standard for their chassis size and mounting hole distances? Do enclosed switching power supplies follow any standard for their chassis size and mounting holes distances? or each manufacturer has its own conventions? AI: Not generally no, they don't have the same sizes or mounting patterns. On occasion some companies will match the mounting pattern and size to compete directly with a power supply. An exception to this is industry standard supplies like ATX or supplies that are built for 1U chassis ect. It's a good idea to put a power supply on a bracket that attaches to a chassis in the event the power supply needs to be switched in a product. (I've had a few power supplies blow up and we had to find a replacement, and because we had a bracket we could make them field serviceable)
H: Preservation of power when wiring batteries in series - battery life is reduced if load is kept the same This is really just a "sanity check" type question. Am I correct that if you place two batteries in series, that the battery life is effectively halved relative to just one battery, assuming the load is the same? Suppose that we have two batteries, which are idealized in the sense that they are both at exactly Vcc voltage while the battery is alive, and then drop immediately to 0V when it isn't (rather than a gradual taper as seen in real-life batteries). As an example, and just to keep the units simple, suppose the battery is at 1V and has a total stored charge of 1 coulomb (or 1 amp-second), corresponding to a total stored energy of 1 joule. Then if we place the leads on a 1 ohm load, we get the following voltage curve: You can see that the battery provides 1 watt for 1 second, for a total of 1 joule of energy, and then immediately dies. Now suppose we have two of these batteries in parallel, and again a 1 ohm load. Then the voltage would be the same, but the time duration is doubled: So you can see we now have 1 watt for 2 seconds, and a total of 2 joules of energy (which is the correct amount for both batteries combined). Now, suppose we have the two batteries in series, again with a 1 ohm load. Naively, if you just keep the time duration at 1 second, and double the voltage, you get the following graph: You can see we have 2 volts for 1 second, which is 4 watts of power, and for one second is 4 joules of energy. This is more than the combined rating for both batteries, though, which was 2 joules. As we can see, the batteries won't be able to last that long. Assuming there is no more than 2 joules total to deliver, the correct curve would look like this: So you can see that if the batteries are only to be able to give 2 joules total, the battery life must now be half (!!) of the original. Another way to think of this is that, when stacking batteries in series, the total stored charge (i.e. in amp-hours, mAh, coulombs, etc) is kept the same. If the load is also kept the same, then the current is now doubled, so the batteries both drain twice as fast. Another way to think of it: if you put two batteries in series, the total stored energy doubles, along with the voltage. But, if the load is kept the same, then the current also doubles, so the power draw is now 4x what it would have been, and the batteries drain twice as fast. Put another way, the power draw scales with the square of the voltage, assuming the resistance is kept the same. You should get the same results for "non-ideal" batteries with some arbitrary voltage curve V(t) as it is hooked up to some load. With two batteries in parallel, you get that the voltage curve is simply stretched by a factor of 2 along the x-axis (i.e. V(t/2)) and decays twice as slowly. The integral of the square of this function (representing the transmitted energy with a 1-ohm load) is doubled relative to the original, as it should be. With two batteries in series, just doubling the voltage at each time doesn't give the right answer -- that would be 2V(t), but now the integral of the square has quadrupled. Instead, it's 2V(2t) that gives the same area, so that the voltage curve is doubled, but also decays twice as fast. So my question: is this right? If you place two batteries in series but keep the load the same, the battery life is halved? This should be a basic principle but I never see it stated this way, so I am wondering if I have missed something. AI: If you place two batteries in series but keep the load the same, the battery life is halved? Battery life implies the number of battery cycles before the battery is no longer useful. "Run-time" would be a better description. Yes, the run-time would be halved. In practice it would be even worse because battery capacity decreases at higher discharge rates. This should be a basic principle but I never see it stated this way, so I am wondering if I have missed something. You have missed nothing other than your scenario would be unusual. There aren't many loads that can function properly over a 2:1 voltage range. Most products would be designed to work at one or the other. Exceptions include DC/DC converters but these will provide constant power to the loads so that as voltage increases the current drawn is reduced.
H: Polarization of Radio-Frequency Low-Noise Amplifier I was reading the chapter about Low Noise Amplifiers from the book "The design of cmos radio-frequency integrated circuits" by Lee, and I have seen this example: I do not understand the part inside the red circle. It is used to set the correct bias point for M1. The book says that: Transistor M3 essentially forms a current mirror with M1, and its width is some small fraction of M1's width to minimize the power overhead of the bias circuit. The current through M3 is set by the supply voltage and Rref in conjunction with the Vgs of M3. The resistor RBIAS is chosen large eniugh that its equivalent noise current is small enough to be ignored. In a 50 Ohm system, values of several hundred ohms to a kilohm or so are adequate. Precisely, I have the following questions: 1) Why do we need a current mirror? The current that flows on M3 is not given to any other circuit, what is its aim? I'd say that M1 needs a biasing voltage (and not current) and that may be achieved through for instance a simple voltage divider with two resistances. 2) I do not understand its considerations about RBIAS and noise: higher resistance means higher thermal noise, so I do not understand that statement. AI: The clue is in the title... "The design of ... integrated circuits". You are correct that you could set the bias voltage with a resistive divider ... IF you knew what the correct voltage was. But you don't ... Look at some MOSFET datasheets : note that there isn't a specific value given for Vgs(at some current) e.g. Vgs(th) often refers to a threshold current of 0.1 mA - but a range, say 1V to 3V. All you can be reasonably sure of is that M1 and M3 require (reasonably closely) the same voltage, as they are made in the same process, and at the same temperature, by virtue of being close to each other on the same die. If it helps to think of M3 as an analog computer calculating the correct voltage for Vbias, that's pretty much what it is. EDIT : the point of Rbias is to isolate the RF path from all the parasitic capacitances around M3, and to attenuate any RF signals reaching M3 (which would attempt to amplify them onto Rref...) M3 is supposed to be DC only, and you can make R3 as high as you like because Ibias is practically 0. (If the book recommends kilohms, that is about keeping the physical size down)
H: Why does having a ground in middle of center tapped transform cause it to split voltage? At a round 2:52 of this video https://youtu.be/74QrYyYsftY?t=169, the narrator states that connecting a wire through the center of the transformer splits the voltages between two halfs of the transformer. Why exactly does this happen? AI: ... connecting a wire through the center ... A centre-tap connects to the centre. simulate this circuit – Schematic created using CircuitLab Figure 1. A centre-tapped transformer is the same as two independent secondaries connected in series (by blue wire on diagram). why is it grounded tho? The ground symbol just tells us what point of the circuit we are using as reference. It's convenient to measure all voltages from there - so think of that as the point to connect the black lead of your multimeter or the earth clip of your oscilloscope. and why is emf of one of them opp to the other? It's not. Both halves of the winding are oriented the same way, as indicated by the dots on the coils. simulate this circuit Figure 2. An analogy using DC cells. Hopefully Figure 2 makes it a bit clearer. Depending which point we assign as reference (GND) the other points relative voltage changes. You could consider the voltage a bit like floors on a building. In Europe, we agree that the ground floor is 0 or G, that floors above it are numbered positively and numbers below it are negatively. You now have the option of measuring everything relative to ground (the floor number) or measuring the difference in level between any two floors (the potential or voltage difference). In the left image above our man is standing on Floor 2 relative to ground. The electrical analogy is that some point on the circuit is connected to ground / earth and by convention is zero volts and all voltages (heights) are measured relative to this. An 'all above ground' building will have no negative floors. A bunker or underground car-park will have no positive floors. If the building is launched off into space he has no ground reference and is free to number the floors any way he wishes, including have Floor 0 at any arbitrary point. This is analogous to having an electrically isolated circuit with no ground connection in that we can call any point 'ground'.
H: NMOS - Bulk Voltage going from 0 to -Inf The question is Consider an NMOS device where all terminals are at constant voltage except the Bulk terminal. A voltage is applied to the bulk terminal (w.r.t. GND) that varies from from 0V to -Inf. What is the effect on the threshold voltage of the NMOS device? My understanding is that The bulk terminal connects directly to the p-type substrate of the NMOS device. By driving the bulk voltage lower and lower, you attract more free holes to the bulk terminal. This makes it easier for electrons to accumulate near the gate and form a conduction channel. Thus, since it's easier for a channel to form, threshold voltage should decrease. Is that correct? AI: This isn't correct. As \$V_{SB}\$ increases, the depletion region between the N+ implants and P body increases in width; this increases the threshold voltage as a stronger electric field is necessary to shrink the depletion region so that a channel can form. Here's a Cadence simulation I performed against my PDK (TSMC 180nm 1.8V mixed-signal). Note that the green line (representing lowest Vth) corresponds to Vbs=0, while the red line (highest Vth) corresponds to maximum body effect. Here's the schematic for my test. I performed a DC analysis sweeping Vgs to get each curve, and iterated this for seven evenly spaced (negative) Vbs values.
H: "Fully static" HD63B09EP loses state when clock is paused The HD6309 is supposed to be a fully static replacement for the MC6809, where "fully static" means that the clock frequency does not have a lower limit. The MC6809 gets the electronics-equivalent of amnesia when the clock is too slow. The HD6309 - supposedly - works fine with slow clocks and - supposedly - the clock can also be paused indefinitely. I bought a few HD63B09EP on ebay to experiment with. (B = maximum bus frequency of 2MHz (i.e. 8MHz clock frequency), E = External clock generation, P = PDIP package) I put it on a breadboard, with red LEDs on pins A0 to A7, yellow LEDs on pins A8 to A15 and blue LEDs on pins Q, E, R/!W, BA and BS. The big button on the left makes an ATtiny85 output the two clock signals E and Q, where Q leads E. The big button on the right connects to !RESET. 1.5k resistors pull the data bus to 0x12, so after a reset, the controller jumps to 0x1212 and increments its address from there. 0x12 is also the NOP instruction, nothing really is happening aside from the address bus counting up. If the clock is paused only for a short moment, things continue fine afterwards. A few seconds of pause usually cause the address bus to go 0xFFFF for a moment and then continue normally. Longer pauses cause all sorts of weirdness, like the LEDs on the address bus slowly lighting up, flashing LEDs, or the address bus going high impedance and BA coming high, which can only be remedied by a reset. Here's a video of some of the symptoms: https://puu.sh/EVJET/086da059e6.mp4 Inspiration for this was a video by Ben Eater: https://www.youtube.com/watch?v=LnzuMJLZRdU He uses a 6502-type controller which is also "fully static" and it seems to have no problem with the clock not running. (Can be seen especially well from 22:42 onwards in that video.) As far as I understand, this should not happen. Did I just stumble upon cheap "knock off" chips? Or is this behavior to be expected? The datasheet does indeed specify 2MHz minimum clock frequency (which equates to 500kHz bus frequency) but how can it then be advertised as "fully static"? AI: It's not static The minimum f.XTAL is 2MHz
H: How to combine two resistors in a circuit reduction I'm new to electrical engineering so I've been watching MIT's Open Course Ware videos on Circuits and Electronics. In one of the lectures, the professor discusses the different methods to use in order to reduce a circuit to a simpler form. One of the methods he describes as the "intuitive" method, where you consolidate components within the circuit intuitively. Here is an example he gave: simulate this circuit – Schematic created using CircuitLab The problem I'm having is, he states he takes the sum of the two conductances (R2 and R3) and that equals ((R2 * R3) / (R2 + R3)), how does he get ((R2 * R3) / (R2 + R3))? Shouldn't the sum of the two conductances just be R2 + R3? Link to course video where he describes the problem at 31:00: MIT 6.002 Circuits and Electronics | Lec 2 AI: Simplifying series/parallel resistive circuits you use two formulas. For N resistors in series, \$R_T=R_1+R_2+...+R_N\$ and for N resistors in parallel, \$1/R_T=1/R_1+1/R_2+...+1/R_N\$ or transpose to get: \$R_T=1/(1/R_1+1/R_2+...+1/R_N)\$ You can solve these circuits by identifying series connected resistors and combining them, then parallel connected resistors and combining them, and repeating until only one resistor is left. In the simple circuit you provide: simulate this circuit – Schematic created using CircuitLab There are no simple series connected resistors, so check parallel. R2 and R3 are connected in parallel, so we combine them using the formula: \$R_{2+3}=1/(1/100\Omega+1/100\Omega)=1/(2/100\Omega)=50\Omega\$ simulate this circuit And now we check for series connections again and see we can combine the remaining two resistors. \$R_T=R_1+R_{2+3}=150\Omega\$ You can invert the formulas and resistances to figure it out based on conductance, but usually this type of problem is figured out in terms of resistance.
H: Due to overcurrent, shouldn't I be extremely cautious when setting an I/O pin as Output? The question can be applied to any microcontroller with I/O capabilities, but I’m currently working with the popular ATmega328p. Consider the following circuit: A simple SPST Normally Open switch with a 10k pull-up resistor and a ceramic capacitor attached, connected to any I/O port. The specific pin should be obviously configurated as INPUT in the respective DDRx. The datasheet describes, inside the DC Characteristics section, an Input leakage Current I/O pin \$ (I_{IL}/I_{IH})\$ of 1µA, while far in the horizon the DC current per I/O pin caps at 40.0mA. Not a problem at all. DDRD = 0x00; // Entire port as INPUT Now consider that I forgot the fact that the given pin has to be set as Input, I set it as Output and set the Port HIGH. DDRD = 0xFF; // Entire port as OUTPUT PORTD = 0xFF; // Entire port HIGH While the datasheet doesn’t provide an Output Impedance it can be estimated to be 25Ω, based on the given graphs. Now at the time the button is pushed the current finds its way through the microcontroller from the 5V source with a 25Ω resistor plus negligible resistance due to the copper trace. This theoretically produces an overcurrent of 160mA above the DC current per I/O pin ceiling. Could this fry the port and the device? Analogously, if I switch over to positive logic and set the port to LOW the same problem could be encountered: DDRD = 0xFF; // Entire port as OUTPUT PORTD = 0x00; // Entire port LOW Considering this type of circuit is avidly encouraged, how it doesn't seem to bring any troubles? Now, back to the original question, shouldn’t I be extremely cautious when setting an I/O pin as Output? Or at least attach a small series resistor as a primitive protection? Note: Not a native English speaker, feel free to edit the post if you see something awkward. AI: As others have said, you shouldn't have a problem as long as you double check your code. If you do get it wrong, by and large the ATMega IO pins will limit themselves to about ~80mA due to internal resistance of the MOSFETs (value found by experiment). This is not good for the chip, but as long as you don't leave it in this condition for an extended period, they tend to recover ok. If you are worried, it can be a good idea to put a resistor in series with the inputs. Something in the order of 330R for a 5V VDD, or 220R for 3.3V VDD. This will ensure the short circuit current is limited to ~15mA which is comfortably within spec. The resistor goes between the IO pin and whatever is driving it (e.g. button w/ pull-up, or CMOS). As the ATMega has a pretty limited useful frequency range (IO freq < 10MHz), the extra resistor won't have any noticable impact on operation of the circuit as the inputs have very little in the way of leakage current and capacitance
H: Discrete linear voltage regulator I am trying to make a discrete component linear power supply. This schematic seemingly works but it doesn't work when I build it on my breadboard. I am taking 110 volts through a transformer down to 6 volts AC. I added a full bridge rectifier and then a 4700uF capacitor and I get about 8 volts out. After wiring up the mosfet, the 2 volt zener clamp with a capacitor to create a reference voltage for the inverting input of the op amp. I add a 250k and 10k pot in series on the source of the mosfet. The power goes from the capacitor to the drain of the mosfet and the output of the opamp goes to the gate of the mosfet. The opamp reference voltage is created by the zener clamp described above; the positive rail of the zener comes from +8 volt after the rectifier capacitor and the negative rail goes to ground. When I turn the poteniometer, I don't see any variation in the output from the opamp. I also notice some voltage movement when I touch the potentiometers but not from actually turning them. For a simple linear regulator like this that I want to take from 0-5V, why isn't it working? The first step was drawing out the schematic: Then I wired it up Here's a cleaner schematic simulate this circuit – Schematic created using CircuitLab It seems like there are many different ways to design a circuit but so far this circuit comes down to a few basic blocks. There's the current pass element; This can be almost any transistor. There was a comment about me using the n channel mosfet in the incorrect position. I now realize that this has to do with high side [the positive rail] vs low side [the ground rail] switching. It seems as though low side switching can be easier to wire up but causes issues with ground. High side switching is more stable and safe but more complicated to drive; usually there's a NPN type transistor driving the a PNP high side transistor. Then there's the reference voltage; there was a answer that says the output voltage cannot be lower than the reference voltage in certain configurations. With this updated schematic I think I have worked out a lot of the errors in the earlier one, although I am still a bit unsure about driving the mosfet with the smaller transistor. simulate this circuit AI: I'm going to steal this schematic from these posts: Basic Op-AMP as voltage regulator Does this voltage regulator use "on-off" control, or is it a voltage follower? So you can see that your circuit has numerous issues: Your zener reference has no power supply. Your zener would fry even if it was connected to a power supply because there is no current limiting resistor. Your MOSFET is backwards. You said the smoothing cap is connected to the drain of your MOSFET. This is correct, however, what you have drawn in your schematic is the source terminal connected to the smoothing cap. You have no negative feedback. Your zener reference is connected to the wrong input Your divider is connected to the wrong input (your attempt at a divider anyways...it's missing a connection to ground so its not actually a divider as you have drawn it). Your zener reference is already larger than your desired output voltage, yet you still step down your actual output voltage before comparing it against the zener reference. You either: a) have your reference be equal to your desired output and compare your actual output against the zener directly (no divider in the negative feedback loop) OR b) have the reference be smaller than your desired output, and step down your actual output with a divider before comparing it against the zener. Then your desired output is equal to the inverse of the divider ratio multiplied by the reference voltage. That is because when your actual output equals your desired output the voltage being compared against the reference (the actual output voltage which is stepped down and then fed to the input of the opamp) actually matches the reference voltage. I also no decoupling capacitors for the opamp.
H: Phase Crossover Frequency at 0 deg or -180 deg I've learned in school to calculate gain margin by first finding the phase crossover frequency at -180 deg, but sometimes I see people calculate gain margin by finding the phase crossover frequency at 0 deg which doesn't make sense to me. I'm confused as to why that method is used? I can't find any explanations online so any help is appreciated. AI: What causes instability problems is positive feedback, i. e., feedback with the same (or close to the same) phase as the input. In other words, 0˚ for the loop gain. So where does the 180˚ come from? Typically, it's assumed that the feedback signal is subtracted from the input signal to create the error signal. The negative sign implicit in the subtraction represents a phase rotation of 180˚. So, if you're looking at the phase shift of the loop gain without taking the subtraction into account, then you want to avoid phase shifts close to 180˚ instead.
H: Tool for measuring the frequency of a crystal oscillator I am building a digital clock from sequential logic. I’m using a 32.768kHz crystal with a CD4060 IC. I’m looking for a tool to measure the output frequency. I currently have it hooked up to an LED and it’s blinking somewhat irregularly. Could a rough estimate also be read using a basic multimeter with a Hz function? I have a klein MM400. Would an oscilloscope be a good choice? Edit: If anyone else is confused about how to select resistors and caps for these circuits I found this guide on CMOS oscillators http://www.ti.com/lit/ds/symlink/cd4060b.pdf AI: I would start with your Klein MM400's built-in counter. Based on its specs it seems to be able to measure frequencies from 1Hz to 50kHz. The problem is that it will only give you 3 or 4 digits of resolution, not enough to judge whether or not it's accurate enough for your clock. Don't try to measure the frequency right at the crystal terminal to avoid killing the oscillator completely, or loading it in such a way that causes frequency shift. Measure it at some buffered clock net instead. Scopes are typically not a good choice for accuracy better than 1%, unless it has a built-in frequency counter, like some not-too-expensive Rigol models. Technically speaking, your best option is to use a dedicated frequency counter, which can measure even more than 10 digits (depending on the accuracy of their internal frequency references)! Since you're actually building a digital clock, your best option is to simply measure the time drift after a certain period of time (one day, for instance). You will need a reference clock, which can be as simple as cell phone clock, which should be accurate at least down to a second, or a time stamp from a computer running ntp (network timing protocol).
H: AD620 reference terminal problem I'm trying to add a DC offset level to a sine signal through an instrumentation amplifier (as the figure below shows.) The problem is that, in the simulation, everything works perfectly, however, in reality I can't achieve the DC displacement of the signal. The input signal parameters are: 0.7Vpp and 100Hz The image shows the wanted behavior of the circuit, however, I'm not able to obtain that in real life. What could be the problem? Maybe the AD620 is not the best option to do that? AI: The AD620 negative supply (-Vs) is at 0 volts but if you do this, you need to respect the input common mode range and that is specified as: - −Vs + 1.9 to +Vs − 1.2 In other words, tying pin 2 (one of your inputs) to ground is an illegal condition and all bets are off. The lowest voltage allowed on your inputs is 1.9 volts. Just in case it's important to your design, you should also consider that the output signal is limited to this following range: - −Vs + 1.1 to +Vs − 1.2 So, with a single 5 volt supply, the output can typically be between 1.1 volts and 3.8 volts but, over the full temperature range this might reduce to 2.1 volts to 3.6 volts.
H: Darlington as CB Why do we use Darlington pair? I've heard that we don't use it as common base. Why is that? Why don't we just develop a BJT with high beta value istead of using this structure? What are the different types of it? How can I recognize the emitter and collector of it (for example in the image below)? AI: For high current loads. BJTs are a current-controlled device, so one might not provide enough current amplification. This is called the beta value and is normally around 100-300 for general purpose transistors The base current is being amplified and projected through the collector to the emitter (in NPN). If it's common base, the current is the same through both transistors. Stacking the base of the second transistor to the emitter of the first one provides amplification in the 1000s Good point, these are expensive! Alternatives are MOSFETs which are voltage controlled and can handle high currents. NPN, PNP and Szikial pair (push pull amplifier) These are generally labelled in Darlington ICs such as the ULN2003
H: Advice on BNC cables for beginners electronic lab I'm setting up an electronics lab so I can increase my knowledge of electronics. I've bought some equipment of ebay ('scope, power supply, signal generator etc.,) but don't know what sort of BNC cables I should get. Do I need to worry about impedance when connecting the equipment together and buy (for example) 50 ohm cables or would straight through work OK? AI: Do I need to worry about impedance when connecting the equipment together and buy (for example) 50 ohm cables or would straight through work OK? You seem to have the false impression (see my highlight in the above quote) that a 50 ohm cable will incorporate 50 ohm resistors. A 50 ohm cable (coax or otherwise) is telling you about the impedance it will present when using RF signals (greater than 1 MHz) and has nothing to do with real resistance values measured using a multimeter (for example). All cables have a characteristic impedance (including "straight through" cables) and its impedance is represented by the formula: - $$Z_0 = \sqrt{\dfrac{L}{C}}$$ Where L is the distributed inductance per metre and C is the distributed capacitance per metre. If you looked at some cables in their data sheets you might see typical values such as: - L = 0.25 μH per metre C = 100 pF per metre Take the square root of the ratio and you get 50 ohms (nothing to do with actual resistive components).
H: Why use two 0.1 µF capacitors in parallel? Below is the schematic of the Pololu A4988 driver board: There are three capacitors on the motor power input. I can understand why engineers decided to use separate 4.7 µF with larger size (1206, 0.1 µF are either 0805 or 0402): because physically small capacitors have lower ESR, and they effectively filter out higher frequencies (correct me if I'm wrong). But what is the reason to use two 0.1 µF capacitors in parallel? Can they be replaced by a single 0.22 µF in order to save PCB space and cost? Image of the board; it can be clearly seen that all capacitors are ceramic: AI: C2 is used to decouple pin 28 and C3 is used to decouple pin 22 (or vice versa): - See also the Allegro data sheet for the A4988 driver; it shows the capacitors as C7 and C9: -
H: Why does LTspice resistor noise disappear when setting value with .param? When performing a noise analysis in LTspice of a 1kΩ resistor, a noise level of 4nV/rtHz is simulated. However, if this resistor value is set to 1kΩ using .param, its noise decreases to 129fV/rtHz. Changing this resistor value does change the noise linearly. What causes this noise decrease, and what can I do to prevent it? The schematic is shown below: AI: You should use {Rg} as value for R1, so without the R=. Using the plain value 1u or R={1k} also gives 129 fV/Hz½. I've no idea what makes the evaluation of R={1k} or R={Rg} to become 1uΩ
H: Why are always used N-Channel MOSFET on both High and Low side on BLDC applications? As title, I always see an N-Channel MOSFET on both HIGH and LOW side of a 3-phase BLDC motor driver. i.e. Can you explain me why is better to use 6 n-channel instead of 3 n-channel and 3 p-channel? p.s. In this case there isn't high side driver to PWM mosfets. AI: More efficient, more available and cheaper. Also usually not any easier or simpler. PMOS requires extra high side gate circuitry anyways above ~20V (limited by max |Vgs| that the gate-source is exposed to when gate pulled to GND to turn it on in a simple PMOS high side gate drive scheme) so you don't save any effort. Max |Vds| is higher so is not the weakest link in a simple high side PMOS scheme. If you need high side gate drivers anyways then you might as well just use NMOS.
H: Recommendation on Optical Sensor (being used for Fingerprint Scanning) When I have researched available optical fingerprint sensor modules, every one comes with a processor that takes the sensor image data and processes it. They all appear to keep the fingerprint data internal to the module, and only allow commands to be sent via UART in order to scan/store/compare. Most appear similar to this Adafruit Fingerprint Scanner. I am looking for an optical sensor that transmits just the raw image data so that I can process it myself. I need this, as a part of my research is to recreate algorithms that identify/compare fingerprints. As such, I want a module that I can interface with a processor, where the sensor module transmits the image data back to my own processor, and from there I can process the data as I so wish. One alternative would be to purchase the Adafruit module, and then simply bypass the on-board processor in favor of my own, but I cannot seem to find any documentation on how the on-board processor communicates with the optical sensor. I would need to know this in order to identify the communication standards being used to capture the data. As such, I think my best alternative is to reach out for help in finding an optical sensor module that has proper documentation that I can reference, that is suitable for fingerprint scanning. My background is in embedded design, but I have no prior knowledge of optical sensor modules. If anyone has any familiarity with optical scanners, and has a recommendation for one that would be suitable for this application, I would very much appreciate hearing your thoughts! AI: The datasheet for the Adafruit module indicates it's possible to download the image ("下载图像") using instruction code 0x0b. The datasheet is in Chinese, so if you're not able to read it, it might take a bit of time, but most of the information should be there.
H: trying to get motor to turn on i'm very new to electronics and working thru an udemy course on an introduction to electronics. I'm trying to get this air pump to activate in a simple DC circuit on a breadboard. https://www.ebay.com/itm/DC-5V-6V-Micro-2-Position-3-Way-Electric-Control-Solenoid-Valve-For-Gas-Air-Pump/392190802553?ssPageName=STRK%3AMEBIDX%3AIT&_trksid=p2057872.m2749.l2649 The rating appears to be rated at 5-6v at 220mA. Given nothing else in my circuit, I'd assume that I could just use ohms law to figure out the resistance I need for the pump to work. I'm using a 5v power supply so: R = v / I Or R = 5v / 0.22 or 22.72 ohms resistance. Is this correct? I've tried a 20 ohm resistor but the pump won't activate. Unfortunately, the pump I got was a cheapo from ebay so it doesn't have a downloadable manual or anything. It just clicks once like its stalling when I power on. AI: The user "rdtsc" in has identified that this "pump" is actually a valve, in a comment. You shouldn't use a resistor with it. The valve is designed to be connected directly to 6V, and at this voltage, it will use about 220mA (assuming those are the correct numbers). The resistance of the valve itself is what you calculated (22.72 ohms). If you put a 22.72 ohm resistor in series with it, it forms a voltage divider and the valve only gets half the voltage, which is 3V. This could be useful if you were trying to run it on 12V, since then it would get 6V! But you are not. The valve might be able to activate with 3V, even though it's designed for 6V. Since you hear a click, apparently it does activate. It might be weaker somehow - with 3V, maybe it won't close when it's connected to pressurized air, for example, or maybe it will get stuck sometimes until you give it a tap.
H: What happens at hardware level when we feed a code? I wanted to know what hardware is installed in 8051 such that whenever i write a program it accepts it and execute it. My query is what happens at the hardware level whenever i feed a program to 8051. AI: Opcode - the unique identifier for each possible instruction that a computer can run. Physically, it is a unique string of binary bits which is represented in Assembler as a token (so a human can read it without memorizing a string of ones and zeroes) Program - a bunch of ones and zeroes (or low and high electrical signals) consisting of the sequence of opcodes and their arguments (numbers) to be executed when the system runs. Program Memory - This physically stores the program. The ones and zeroes are physically stored in a configuration transistors. In SRAM, the transistors act as a form of latch to tie the node to either the positive voltage rail or GND, which represent either HI or LO. In DRAM, the voltage is stored inside the parasitic capacitor that is parts of a transistor. In flash, it is stored as a charge inside the structure of the transistor that modifies the transistor's behaviour. This might sound like a capacitor, but it isn't. On a magnetic harddrive it is stored as the polarity of a ferromagnetic domain. Opcode circuitry - the physical manifestation of the opcode. It is circuitry that reads the appropriate arguments that it will operate with or on from the instruction register, processes them, and loads the result somewhere. Each opcode has one and the this circuitry will processes the data and delivers the result into a register somewhere. Instruction Register - the register that stores the instruction line which is about to be parsed and read/decoded/translated. It is loaded from wherever the program counter register is pointing at in the bits that form the program memory Instruction Decoder - this circuitry reads the opcode ID field in the instruction register and sends a signal to activate the appropriate opcode circuitry which results in execution of the opcode. It's basically a giant comparison engine that compares the current opcode against a bunch of available opcodes and if it matches, it outputs a signal to trigger the associated opcode circuitry. One way to imagine it is as an array of multi-bit comparators with each comparator having an output to trigger one of the opcode circuits. Each comparator examines the bits in the field of the instruction register that represents the opcode ID and compares it against a fixed value which is the bits for the opcode ID it is responsible for. If it matches, it fires a signal to the opcode circuitry to trigger it. Or you can imagine it as a giant lookup table that takes the bits in the opcode ID field of the instruction register as an input. It's output consist of one signal line going to each opcode circuit to trigger it. The lookup table is such that only one signal line is active for any given valid input (after all, you don't want a single opcode to end up triggering two opcode circuits to run. That just doesn't make sense.) The decoder also reads the bits in the fields of the instruction register that represent the arguments for that opcode and passes them on to the opcode circuitry so it knows what it is working with. It is a crazy, chip spanning network of signals. Alternatively, the opcode circuitry might directly access those other fields in the instruction register to obtain their operands. So in a sense, it is just a highly evolved version of a circuit consiting of AND gate circuit where one input is fed with a toggle switch and the other input is fed with a 1 or 0, depending on when you want the activity to trigger, and the output feeds a circuit that "does something specific".
H: Using "modern" batteries with old devices I have a Sony Vaio p-series laptop which is a tiny computer build in 2009. It is a wonderful device but the battery is only 2500 mah and lasts about 1.5 hours. My phone battery on the other hand is a quarter of the size, 4500 mah, and lasts almost a day and a half with heavy use. My question is, what would it take to make an upgraded battery for the little laptop? Assuming I had access to some big cell phone batteries, let's say. Can I just wire it in somehow? I assume the new battery would have to match some kinds of numbers so that it inputs and outputs energy at the same rate... Or something like that... I am pretty well-versed in how operating systems work but have no experience with actually building anything. Is this idea totally infeasible or do I just need to learn how to do it and obtain the right parts? AI: Current (Amps) is not the total power storage of a battery. Cell phone batteries are all 3.7V so they are often compared by the mAh rating of the battery. In reality to calculate run time you need to use Watt Hour (Wh) which is the total amount of energy stored. To find total Energy storage of a battery (assuming battery capacity given in amp hours): \$E[WattHours] = P[watts]*time[hours] => V*I*1hr \$. Old Battery: 7.4v x 2500mAh = 18.5 Wh Cell Phone: 3.7v x 4500mAh = 16.7 Wh So your modern cell phone battery actually still holds less power then your "old" Lithium Ion battery in the laptop. While battery technology is always getting better, it is not moving as fast as you may think. Per my comment, laptops are very power hungry compared to a phone that spends 90% of its time sleeping in your pocket. Also modern electronics constantly require less power to run, thus resulting in a longer run time for a given battery size. Update About Size: I missed the 1/4 the size in the question originally. Given that info, It would seem that a modern battery would have a higher power density and thus provide a longer run time. The hardest part would be getting cells that match the batteries form factor, since most laptop batteries are made to fit the form of the unit. If the battery could be created out of typical 3.7V cells that are available on various online marketplaces, then there is a chance you could do something. Although you would still need to ensure the battery has a similar interface for charging and add some sort of a battery protection circuit that basically all multi cell packs have.
H: LTspice Vs Matlab - Power electroncs What are the advantages in power electronics of Matlab in comparison with LtSpice and vice versa ? Thank you very much and have a nice day ! :D AI: Everyone has their own preferred simulation tool depending on what their background is and what they are simulating most often. You can get Almost all simulation tools to simulate any circuit(within reason) some just are a little easier in some scenarios. I would suggest you look at what simulation software the people around you or the people that you are working with are using because they can help you when you run into issues. They can also give you circuit files much easier then. P.S. I prefer PSIM to do power electronics simulations. I use PSpice(or LTspice) if I have to give the simulation to another engineer. I use MATLAB if I want to iterate through many different component values to make a circuit work.
H: Can the diode be ignored in this Op amp circuit? Consider the circuit below: The diode is ideal and \$R=1000\Omega\$. What is \$v_o\$ when \$v_{in}=3V\$? What is \$v_o\$ when \$v_{in}=-3V\$? So my idea was just to make node equations to solve these to find \$v_o\$, but when I do that I completely ignore the diode. I do like this. For this op amp we have: \$v_-=v_+=0V\$ When \$v_{in}=3V\$: \$\frac{v_--3V}{R}+\frac{v_--v_o}{R}=0\$ Inserting \$v_-=0V\$ and solving this equation we find that: \$v_o=-3V\$ When \$v_{in}=-3V\$: \$\frac{v_-+3V}{R}+\frac{v_--v_o}{R}=0\$ Inserting \$v_-=0V\$ and solving this equation we find that: \$v_o=3V\$ As you can see, I'm not really thinking about the diode at all. Am I solving the problem correctly? AI: simulate this circuit – Schematic created using CircuitLab When Vi > 0 the diode conducts and shorts out R2. Stability will be reached when Vo = -0.7 V (for a real Si diode) and at 0 V for the ideal diode in the question. When Vi < 0 the diode is reverse biased and is effectively out of the circuit. \$ V_O = - V_I \$. The circuit when created with a real diode is an imperfect (due to the -0.7 V output) inverting half-wave rectifier. From the comments: Doesn't an op-amp force the voltage on both inputs to be the same? Yes, in negative feedback configuration. In Figure 1b we have a current flowing through R3 tending to raise the voltage on the inverting input. This will cause the output to swing negative. When the output swings to just below zero (or just below -0.7 V with a real diode) the input will have been pulled down to 0 V and will match the voltage at the non-inverting input. The output will stabilise at that point.
H: How to receive the digital data from an ASK/FSK Receiver (E.g. TDA 5210) While reading the specs on a FSK/ASK Receiver (E.g. TDA 5210 ) I am asking myself how actually the (non Manchester encoded) digital data look like and how to I receive it when sending from another device on the correct frequency Can the DATA pin 25 "easily" be attached to a Raspberry Pi / Arduino? Will this be a UART communication? AI: I am asking myself how actually the (non Manchester encoded) digital data look like and how to I receive it when sending from another device on the correct frequency The digital data should look the same as the transmitted data, in whatever format that is. However for the data slicer to work correctly the format should be something with approximately equal high and low times like Manchester code. Can the DATA pin 25 "easily" be attached to a Raspberry Pi / Arduino? Yes. Just make the sure the logic levels are compatible. The TDA 5210's data output high level is Vs-1V, ie. 4V on a 5V supply. For the Pi this should be reduced to 3.3V using a voltage divider. Will this be a UART communication? UART communication normally uses a serial format that does not attempt to even out the high and low times, so it is not generally recommended. It can work if you are careful to not send long periods of all 1's or 0's. Note that radio links are inherently noisy. Whatever protocol you choose, it should be designed to reject noise by using preambles, sync sequences and checksums or CRC codes. This can be put on top of a UART signal, but may be more reliable if applied at the bit level. Since decoding the signal one bit at a time is quite CPU intensive, it is often done with a separate chip.
H: Screen with built-in NFC So I've started working on a small project (small at the moment) and I'm seeing some issues in my prototype plans, and I need your help with this. Short answer: I need a led touchscreen with NFC capabilities. I made a figurine (kind of those you see for games like Skylanders,...). It has a built-in NFC plate that is setup correctly. Now my problem is, when I place that figurine on the screen, I need to exactly know where it has been placed. This could be done really quickly if there was only one figurine, not even an NFC tag needed if the touchscreen can detect the figure. Now the problem is, I need to know which figurine has been placed on the screen, and on which location. Kind of a live feedback of where everything is actually. Is this duable in any way? I was thinking of a think touchscreen and then 40-50 NFC tags underneath it to cover everything but I don't feel like that is a good idea. And it will not be very acurate. AI: NFC is an inherently narrowband medium, and thus doesn't allow for exact remote location. 40-50 NFC tags does sound like it could work, but then your figurines would need to be NFC readers – that's a lot of complexity for a figurine. Conversely, you could put 40-50 NFC readers beneath your screen, but I doubt that's a financially viable option. I don't know whether NFC is a great approach here. Maybe keep the identification NFC-based, but simply use an e.g. resistive touchscreen and pressure – the moment a new NFC tag becomes visible to single reader that observes the whole table, you look for a pressure point. You know that this must be the new figurine, entering the game. The rest is just tracking the positions that you already know. Honestly, this isn't a small project – localization of multiple objects on centimeter scale is a hard problem that industrial automation still is fighting with. I'd honestly probably go with a camera mounted across the screen, looking at the tops of your figurines, and some optical object recognition.
H: Inductors in DC motor drivers I've been making some research on DC motor drivers and I noticed that most medium power boards don't use inductors, but boards that can provide high current do, like this one: https://www.cytron.io/p-60amp-7v-45v-smartdrive-dc-motor-driver-2-channels What is the inductor used for in motor drivers? AI: Your linked device can be used with a wide variety of DC voltages for various motors. There's on-board quite complex communication and motor speed controlling circuitry which needs its own stable operating voltage. To get that operating voltage properly from all possible motor supplying voltages a flexible switching power supply is needed. That power supply surely has inductors. Motor gets PWM signal, there's no inductors for motor current except possible radio interference limiting chokes.
H: How to Convert NPN to PNP transistor? I'm creating a water level indicator so I can turn on a pump when the water level gets too low. I have NPN transistors, but I would like the transistor to act as a switch that closes when the water level drops below a certain height. The NPN transistor I used for the experiment seems to do the opposite (close the switch when the water level is high enough), so I figured I need to use a PNP transistor instead. However, after following this SO suggestion and flipping the connection to the battery terminal as well as the LED, the LED did not turn on as expected when the water level gets too low. I would appreciate your advice. The circuit below lit the LED when the water level closed the circuit. How do I get the LED to turn on when the circuit is open? simulate this circuit – Schematic created using CircuitLab AI: simulate this circuit – Schematic created using CircuitLab Figure 1. Modified schematic. LED is on when probe is dry. Move the LED as shown in Figure 1. When the probes are dry Q1 is off and the LED is lit via R2. When the probes are wet Q1 is on and shorts out the LED. The disadvantage with this simple fix is that current is wasted when the LED is off. Your 100 Ω resistor value is a bit low (but is also the CircuitLab default). For an LED with a 2 V forward voltage you will drop 7 V across R2. A 1 kΩ resistor will limit the current to 7 mA which will be quite bright on a modern LED.
H: What is a "safe" amount of amps to draw from this pack I've been working on a quadruped project, and need some help determining the... safety... of my power system. To start, there's two packs, a larger "main" and a smaller "reserve" the two packs are built from the same type of battery: Coolplay 3.7V 500mAh LiPo the smaller pack is two of these wired in series to get 7.4V 1Ah, and the larger one is 8 of these wired to 7.4v 2Ah (4 packs in parallel to make 4x 3.7V 1Ah, in which they are series paired into 2x 7.4v 1Ah, which in turn are wired in parallel to get 7.4v 2Ah) I've done the prerequisite searching, and can only find safe current to apply to parts and IC's, not the safe current to pull from the battery. So, my question is, what would be a "safe" amount of current to pull from either of these packs? At idle (all IC's powered, but servos not powered), the build pulls about 0.2A, and the packs don't heat up at all, but when the build enters a "pose" such as standing (all servos powered up and under load), the load jumps up to 2A usage, and the pack temperatures start to rise, and my overcurrent kicks on and shuts the packs off (I have it set very low because, well I don't trust LiPos). So, is it safe to run my pack under these conditions? and if so, for how long? I have adjustable overcurrent protection and temperature monitoring installed, so I can utilize those as well. And if its not safe to run like this, what could I change? One of these packs powers a Syma X5C drone for 7 minutes. So some quick and dirty math tells me that the drone pulls around 4.5 amps from the packs for the duration of the 7 minutes, and the packs are pretty warm from this. So with the new information that these individual batteries get 4.5A pulled from them, what is the verdict on this? **EDIT: RESOLUTION So, thanks to @MarcusMUller and his insight, I've determined that the packs should be safe to run in these conditions but should be monitored more closely (as marcus pointed out, cheap batteries are unreliable and inconsistent) and should be housed better. Thank you @MarcusMuller for the feedback and insight **NOTE: Batteries are dangerous, but I dont need to say that. As marcus pointed out (more or less), batteries with poor documentation should make you nervous. Good batteries are a good investment, and shortcuts should only be taken by those that know the path, and even then it should make you nervous. Be safe with batteries AI: The Lipo batteries used in drones are usually rated for at least 10C, which means the maximium safe current is 10 times the Ah capacity. Your main pack has a capacity of 2Ah, so at 2A it is only being drained at 1C. Thus it would seem to be quite safe. However if current is being drawn in pulses the rms current will be higher than the measured average current, which will heat the battery more. This shouldn't be a problem at 1C though, so long as the battery has adequate cooling. Ultimately the most important factor affecting Lipo safety is temperature. Lipo cells are commonly rated for a maximum temperature of 45 °C when charging and 60 °C during discharge. At some temperature above this they will suffer thermal runaway and explode, so you don't want to go anywhere near there. Provided your batteries stay below 45 °C it should be safe, but let them cool down before recharging.
H: Oscilloscope scrolling This questions is kind of related to this: Prevent oscilloscope scrolling However, now I have a decent signal generator (well still budget, but for my needs more than enough, FeelElec FY6900, 60 MHz signal generator). And two oscilloscope (one I will not mention in this question, but in a next one). The one I want to use for now is a 10 MHz Philips PM3110 , 10 MHz dual channel scope). I use a sine signal. At 10 MHz, I get a very nice steady (non scrolling) signal at the oscilloscope using the time (x coordinate) of .5 us/square. However, when I move down the signal generator to 1 MHz, at any possible x coodinate setting, the display scrolls faster or slower. The only way to make it kind of fixed is to change the inner x-coordinate knob, however, that changes the reading (the width of the signal over the squares, so it's not really useful). I set the trigger to the correct channel, to LF, and high edge triggering, but actually, it doesn't change a thing. What am I doing wrong? (note from the oscilloscope, only the right cable is connected, channel B). Conclusion (see chat for more info) The PM3110 oscilloscope's trigger switches do not seem to work well, but the most important is that tapping the side of the case causes (in almost all instances) the beam to be steady, so the encoders/contacts are not conducting well. Besides fixing (see accepted answer: cleaning/changing caps), some tips (also see chat): Use another oscilloscope (found out my old PM3253 is working better than expected) Redirect the output of the signal generator as trigger input for the PM3110. Change HF/LF (because of video signals there is a 17 KHz switch). I noticed sometimes I have to increase the intensity of the beam to make it visible. Change trigger level (PM3110 does not have one). AI: Trigger circuit works OK @ 10 MHz but doesn't quite work at lower frequencies. This kind of fault is very often due to degraded electrolytic capacitors in such old equipment. Many fixes have been accomplished with a scattergun approach: replace every electrolytic capacitor in the trigger signal chain. Or you can start with C501, C502, C503, C508 in Unit 3 PCB where trigger signals are processed. Probably safer to replace any/all you see.
H: What's the correct sequence to start thinking about a BJT circuit A very basic circuit as shown below, the 1V step voltage is applied @ +1V @ t=0. Edit: Unfortunately the entire question was asked based on a wrong assumption, that is: "Vbe only controls the upper limit of Ic, not the actual amount of Ic, the actual amount of Ic depends on how much the outer circuit can supply" The misconception came from my effort to apply band gap model to explain BJT's circuit behavior and it is not successful so far. However many knowledgeable people mentioned many BJT transient behaviors and those answers are very informative. the sequence of events are best described in the accepted answer AI: I simulated your circuit in LTspice using a BC547B. Here is the result:- Before t = 0 the transistor's C-B and C-E parasitic capacitances are charged to 5V, and the B-E parasitic capacitance is uncharged. When the 1V step is applied the B-E junction is effectively short-circuited by its capacitance, so all terminals jump up by ~0.33V as Rb and Rc||Re divide the voltage step by 3. As the capacitors charge so the Collector voltage falls back to 5V and the B-E voltage difference widens. Vbe is 'small' so no transistor action is occurring, and the effect is the same as if the circuit just consisted of resistors and capacitors. This continues until ~30ns when Vbe gets to ~0.55V and the Base starts to draw significant current. The transistor then amplifies that current at the Collector, pulling Vc down. As more current flows from Collector to Emitter the downward trend of Ve is reversed, eventually stabilizing at 0.39V with Vbe at 0.61V and Vc at 4.61V. A simplified analysis could ignore all this and just assume that Vbe will shortly become ~0.6V. Then Ve would be 1-0.6 = 0.4V, Ic would be 1k*0.4 = 0.4mA, and Vc would be 5 - (0.4*1k) = 4.6V.
H: 16 bit R2R DAC? I want to build a 16 bit R2R DAC using two 74HC595 chip. I need the DAC to replace the potentiometer of a lab PSU. While researching, in the forums and basically everywhere they suggested that R2R DACs shouldn't be above 8-10 bits because they lose precision in higher bits and I have to use 0.001% resistors. but because I'm not going to use it for some audio stuff, even +5-10% of error is fine. as long as I'm getting steps below 1mV. Is it practical to build a 16 bit R2R DAC for this purpose? AI: You can build a 16-bit R-2R ladder DAC, but unless extremely high performance (and extremely expensive) components are selected, both the integral nonlinearity and differential nonlinearity will be poor. The transfer function (think of a graph of output voltage vs command code value) will likely be nonmonotonic, i.e. in some cases commanding a small increase in output voltage will actually give you a decrease. This tends to be problematic for many applications, particularly those involving feedback loops.
H: USB MIDI Host on a microcontroller I need to interface a USB MIDI keyboard to a microcontroller host. The microcontroller will be receiving MIDI commands from the USB and occasionally sending MIDI commands. I'm wondering if there are any implementations on popular microcontrollers like STM32, PIC24 / 32, FTDI etc. that already exist. I found a company called Hobbytronics that used to make such a board based on the PIC24FJ64GB002, http://www.hobbytronics.co.uk/usb-host-board-v2 so it seems possible to do it, however I can't find additional info regarding the USB MIDI Host stack on Microchip's website. I won't mind going for a FTDI midi to serial chip if anything like that exists. AI: I'd recommend taking a look at Vinculum chip by FTDI. It is specifically designed as external host hardware running USB stack so that your MCU doesn't have to do it. Another, somewhat harder to use, solution is SL811HS from Cypress. Both are available on convenient breakout boards, like this one for Vinculum or this for Cypress. I can't find additional info regarding the USB MIDI Host stack on Microchip's website. What info are you looking for? If you buy that HobbyTronic board all you have to do is download and install their free MIDI host software. Then the board will convert between USB MIDI data and Serial TTL packets, which you can read/write using any MCU of your choice. UPDATE: Just out of curiosity, why don't you use some of the off shelf converters with USB host functionality, like Cerebel, Kenton or iConnectMIDI4+? They all can convert USB MIDI to normal serial MIDI, easily connectable to any MCU. Admittedly, they could be pricey, but if you count time you need to make hardware, write software and cost of parts, they quickly begin to look rather on a cheap side.
H: How can I use USB output (5V DC) to power a fan 12V DC load? I would like to power a 5V DC/0.23A fan (beside another device such as 12V LED lamp, and 12V DC water pump). The only possible power source is using USB output, either from computer, mobile phone's charger, and most possible from power bank, which their output are 5V. I was trying to think to use BJT/MOSFET/IGBT, but seems are not possible, as the maximum voltage coming to the drain (in the case of N-channel MOSFET including to cascade the MOSFET, and IGBT) is 5V only, and BJT is not amplify the voltage. So, how can I do it? What component should I use? Is anyway to do that? Appreciate any helps with design. AI: Before attempting the project, lets evaluate the power budget available to ensure the USB port responsible to supply power won't get damaged. As you may know the power that a typical usb port can provide is \$P = V \times I\$ where V is 5V and I varies depending on how powerful the source is. It could go up to 3 amperes for very powerful socket USB charger. For PCs it wouldn't really be wise to extract any more then 1 ampere without protection to avoid a very costly motherboard repair for your PC. To get 12V DC from 5V DC you need to use a power converter. In this case, a boost converter. But we all know the law of conservation of energy, the amount of power that goes into the converter must be equal to the amount of power that goes out. So in an equation \$V_{in} \times I_{in} \times Efficiency_{convertor} = V_{out}*I_{out}\$ Typical boost converters on Amazon would given you an efficiency between .80 to .95 depending on design and load you apply. These boost converters feature a variable potentiometer that allows you to adjust the output voltage and get 12V DC. So now you know you can get 12V DC from 5V DC but as you increased the voltage, the output current must reduce to respect conservation principle. So in reality you can extract very limited amount of power from your converter. Also remember boost converters aren't really happy when you apply zero load to their output, and this of course depends on how well they have been designed, the output voltage may increase to a large value. If you have interest you may want to learn about designing a boost converter but that is a discussion for another day and has its own challenges. But do study boost converters online and try making one in a simulation software.
H: Full wave rectifier with inductor filter The capacitor-only bridge rectifier can't remove the ripple under heavy load and for a linear lab power supply I need to have an output without any ripple under load. after simulating the bridge rectifier circuit under 1A load I ended up with this; Ripple without an inductor: Ripple with an inductor: The transformer is 24/1A and diodes are schottky. Considering it's going to pass trough a linear regulator which will reduce the ripple to some degree and with such low power transformer, do I really need to reduce the ripple to almost nothing by adding an inductor? or is it better to have the inductor there regardless of the transformer power? AI: If I understand right, Your question whether you should require little to no ripple in the output voltage from your power supply. Well, all power supplies in the world have some ripple and typically circuits that eventually are the power consumers will tolerate some ripple. In general you would not want your power supply to provide lesser ripple then what your consumer desires because that would add drastically to the cost and complexity of your power supply. As an example you have used 2.2mF capacitor and 100mH inductors. A 2.2mF capacitor of 50V or above would be a gigantic one. A 200mH 2Ampere inductor wouldn't be a small component either. In your specific case the answer depends on the type of linear regulator you are planning to use. Lets say you want to use a 5V regulator like a 7805 then having fair ripple like around 8 to 10V could easily be tolerated. Typically linear regulators have internal or external feedback loops to compensate for output voltage changes against a reference but you wouldn't have to worry about that considering that the ripple frequency is going to be around 100Hz(the rectifier doubles the frequency as the waveform is just one sided). The max allowed ripple will depend on the final regulated voltage that you desire. So your linear regulator's datasheet will dictate what is the minimum input voltage it can have and still provide a stable constant output. Now all being said, in short, if you are eventually going yo use a low voltage linear regulator, it seems you dont need such large inductor or capacitors. If you have further interest in low ripple power converters and that without using very large components, you should study high frequency/switch mode converters. Typically switched converters would feature an IC/microcontroller that would switch a device(mosfet) using a high frequency PWM to achieve target output voltage and that too without a very large size of components. FYI thats how phone chargers that used to be really bulky suddenly got so compact around 2 decades ago because all of them now use SMPS. Best of luck learning.
H: What is the diference between concurrent 2 "when-then", sequential 2 "if-then" and "if-elsif" statements in VHDL? I want to create an 8 bit counter with reset button on a FPGA board. I have two signals: btn_up which is debounced and btn_center which isn't. R is an output signal which represents 8 bit counter. I want to use btn_up rising edge to increment the counter and btn_center to reset it to "00000000". I thought there are 3 ways to do it, but only one of them works. Here is the code: Using concurrent statement "when-else" : R <= R + 1 when (rising_edge(clk)) else "00000000" when (rising_edge(btn_center)) else R; if I press btn_center R incements by 1 and doesn't get set to "00000000" Using sequential "if-elsif" statement: process(clk, btn_center) begin if rising_edge(clk) then R <= R + 1; elsif btn_center = '1' then R <= "00000000"; end if; end process; during synthesis I get error code 9 again Using 2 sequential "if-if" statements: process(clk, btn_center) begin if rising_edge(clk) then R <= R + 1; end if; if btn_center = '1' then R <= "00000000"; end if; end process; It works. Why aren't these 3 ways of doing this the same in this case? AI: Why aren't these 3 ways of doing this the same in this case? The behaviour of the three codes is NOT identical. Number one: R <= R + 1 when (rising_edge(clk)) else "00000000" when (rising_edge(btn_center)) else R; R has to change on a rising clock edge, but if there is no rising clock edge it has to reset on a rising btn_center edge. There exists no hardware with this behavior. You have register with asynchronous reset and/or set but the asynchronous input is level sensitive, not (rising) edge sensitive. Also the rising_edge of the clk has to override the reset. Number two: process(clk, btn_center) begin if rising_edge(clk) then R <= R + 1; elsif btn_center = '1' then R <= "00000000"; end if; end process; R has to change on a rising clock edge, but if there is no rising clock edge it has to reset on a btn_center being one. There exists no hardware with this behavior. It is some sort of register with asynchronous reset and/or set but the asynchronous behaviour is overridden by a clock edge. Number three: process(clk, btn_center) begin if rising_edge(clk) then R <= R + 1; end if; if btn_center = '1' then R <= "00000000"; end if; end process; This one we have to deal with differently. You have two independent 'if' statements so the second one overrides the first one. Hence we have to start with the second one: If btn_center is one R is set to zero, else if there is a rising edge R is incremented. This is a typical register with an asynchronous reset
H: swapping a louder siren into circuit? I bought an inexpensive battery-operated door alarm that works using a reed switch and sounds a small buzzer when triggered. To beef it up, I'd like to swap in a louder separate siren/strobe light to replace the buzzer. The new siren operates at the same voltage, but I'd imagine it draws a lot more current. Can I simply swap it in if I also replace the batteries with a power adapter capable of handling the new siren's current requirements? AI: It sounds like a cheap enough experiment. The only thing to watch is the current through the reed switch. If the larger siren draws a much higher current the switch contacts might burn out. If you have a multimeter you can take some measurements. Switch your multimeter to the highest range on the mA mode, plug the leads into the right sockets and wire the meter in series with the load or across the reed switch contacts (which is in series with the load). If the current is small you can select the most sensitive range that doesn't give an ÒL`(OverLoad) indication. Note the reading. Connect your new buzzer to the battery or power supply and test it. If all is well then break the circuit at one point and connect the meter in series with the load. Note the reading. Switch the meter back to 'V' (volts) measurement and, if required, move the probe leads to the correct sockets. This step reduces the likelihood that you will forget the next time you try to measure volts only to realise too late that you have shorted out the supply with your ammeter. Then decide whether to go for it or not!
H: Why is this boost converter application circuit done this way? The schematic below comes from boost converter AP6714 datasheet - so I assume it's good, but it is very atypical. Most (all that I used) of the impulse power converters have VOUT connected to the coil. This one has VIN connected to the coil. Also why is this converter powered (VCC) from VOUT? How is it supposed to work? Usually you power PC from VIN. AI: Most (all that I used) of the impulse power converters have VOUT connected to the coil. This one has VIN connected to the coil. Apparently you are used to buck converterns, then. It might be worth a web search. A buck converter works by switching power on and off to the coil, so the coil input sees an average voltage less than the supply. Coils try to maintain zero volts across themselves, so the circuit tends to filter this less-than-input voltage to the output, which is also less than the supply. A boost converter, as you saw, has the input connected to the supply, and switches the coil output between the voltage output and ground. The coil output voltage then averages to less than the circuit output voltage. This forces the average coil current up to the point where it can hold the output voltage higher than the input. (This is an oddball description -- do a web search; the Wikipedia article is good. It'll break down the switching cycle and explain how it all works). Also why is this converter powered (VCC) from VOUT? How is it supposed to work? Usually you power PC from VIN. First, it's an IC, so they can always bootstrap the power supply from LX without putting that fact into their block diagram. LX is supplied from a coil, so it's always seeing an average voltage equal to the input, even if it may be switched between ground and Vout. Second, this converter is designed to work down to 0.9V (which is a sensible voltage for a converter running from a single cell). But FETs like more voltage than that. By running from Vout, they get a higher voltage on everything (most particularly, on the gates of the output transistors). That's going to make everything work better -- especially by reducing Rds-on.
H: A simple way to test op amps I built this small circuit to test if the op amp is working; or if I understand how they should work. I don't have a bench power supply so I take the 7 voltage that I have, I used a resistor divider to create 1 volt max; around 900mV and send that into the op amp's inverting input. I ground the non-inverting input. I also run the +7 volt to the v+ of the op amp chip and v- is set to ground. I tried switching the inverting and non inverting wires as well while using a multimeter to measure the output pin and ground. I am getting 32mV from the output. The op amp is OPA2604; dual op amps in one package. Do I need resistors or something on this op amp? How come I am getting a max of 32mV at the output and zero if I switch the inverting/ non-inverting inputs? simulate this circuit – Schematic created using CircuitLab AI: I don't have a bench power supply so I take the 7 voltage that I have, I used a resistor divider to create 1 volt max; around 900 mV and send that into the op amp's inverting input. I ground the non-inverting input. That won't work. As soon as the inverting input goes higher than the non-inverting input the output is driven as far negative as it can go. This will be close to 0 V as you found out. simulate this circuit – Schematic created using CircuitLab Figure 1. Reconfiguration as a voltage follower. We use negative feedback so that the output will follow the voltage on the non-inverting input. Your 100 Ω test load is too low for most op-amps. I've increased it to 10k. -Your R1 and R2 values could be increased by a factor of 100. The op-amp has a very high input impedance so it doesn't need to be fed from such low value source. Once you have this working have a look at non-inverting op-amp circuits and see if you can modify it for a gain of two. Figure 2. Extract from the datasheet. The op-amp characteristics are measured (unless specified otherwise) at &pm;15 V. The op-amp can operate from &pm;5 V to &pm;24 V so your 7 V supply is too low. You'd need 10 V. With a &pm;15 V supply the inputs can only be allowed to go to &pm;12 V. In other words, it can't operate and closer than 3 V from the supply rail. Your 900 mV is way to low. The output is similarly restricted. You won't get closer than 3 V from the negative supply rail. You need a better power supply for your purposes. Two 9 V batteries would do.
H: Deriving Coupling Coefficient based on Parallel and Series Inductance (of coupled inductor) Problem statement I was wondering whether it's possible to use a coupled inductor (e.g. this) as a signal transformer. However, these coupled inductors typically have a tradeoff between the ability to store energy in the core (which would then become a vacuum gap, ideally), and the coupling of the coils (which would ideally make the thing an ideal transformer). In the datasheets, only the inductance in series and parallel configuration are given; is it possible to calculate the Mutual Inductance, and more important, the Coupling Coefficient, from that? Approach So, if I'm not mistaken, if we unroll the series configuration, we get: simulate this circuit – Schematic created using CircuitLab $$L_\text{series} = L_1 + L_2 + 2M = 2(L+M)$$, \$M\$ being the mutual inductance, which we see once for every side, hence the factor of 2, and assuming \$L_1=L_2=:L\$. Solving for \$L\$ yields $$L = \frac{L_\text{series}}2-M\text. \tag S\label S$$ In the parallel configuration: simulate this circuit We get opposing EMF; thus, M contributes negatively: \begin{align} L_\text{parallel} &= (L-M)||(L-M)\\ &= \frac1{\frac1{L-M}+\frac1{L-M}}\\ &= \frac1{\frac2{L-M}}\\ &=\frac{L-M}2 \end{align} Solving for \$L\$ yields $$L = 2L_\text{parallel}+M\text. \tag P\label P$$ Equating \$\eqref{S}\$ and \$\eqref{P}\$: \begin{align} \frac{L_\text{series}}2-M &= 2L_\text{parallel}+M\\ \frac{L_\text{series}}2- 2L_\text{parallel}&= 2M\\ M&=\frac{L_\text{series}}4- L_\text{parallel} \end{align} The coupling coefficient becomes $$k = \frac{\sqrt{L_1L_2}}M \overset{L_1=L_2=L}= \frac LM$$ Question A sanity check yields near-zero \$M\$ for above linked datasheet, so that \$k\$ could become larger than one. What am I doing wrong? How to do it right (if possible)? AI: I'm beginning again with this answer because, like you, I fully expected to be able to derive leakage inductance from the values of parallel and series inductance. I'm answering it by considering that one winding has inductance \$L\$ in series with leakage inductance \$x\$. Inductance \$L\$ 100% couples to its partner inductance hence, M = L When the two windings are in series and aiding, the total inductance is: - $$L_{SERIES} = L + L + M + M + x + x = 4L + 2x$$ For the parallel arrangement you can (due to symmettry of the two windings), assume that the leakage inductances (\$x\$) are in parallel and the totally coupled inductances (\$L\$) are also in parallel and both these are connected in series. Like this: - Hence the total inductance is: - $$L_{PARALLEL} = (L + M) || (L + M) + x || x = L + \dfrac{x}{2}$$ Now, the ratio of series to parallel is always going to be 4:1 (for identical windings somewhat sharing the same core) hence, any difference between series and parallel inductance values reported in the data sheet are unrelated and therefore cannot be meaningful for understanding the coupling factor or M.
H: Is the voltage at this node 0 volts (quick yes or no) This is a very quick question, but I'm just in doubt here. In the circuit below, is the voltage at node A 0 volts? I can see that it is connected to ground, but there is a zener-diode on the way as well. Does that have an impact? So my question again, is the node A voltage 0V? \$R_1=1k\Omega\$, \$R_2=5k\Omega\$. The reverse breakdown voltage for both zener-diodes: \$V_z=1,5V\$ Both zener-diodes are ideal. AI: We don't know. Without values for R1, R2 and DZ1 it is impossible to answer. If the Zener breakdown voltage > 5 V then A will always be negative. If the Zener breakdown voltage < 5 V then the voltage at A will depend on that voltage and the ratio of R1:R2. Quick yes or no? No can do. From the comments: With DZ2 removed, the current through R1, DZ1 and R2 must be 10V - 1,5 V / (6kohm) = 1,4166 mA. That looks good. The voltage across R1 is 1,416mA * 1000 ohm = 1,416 V. The voltage across R2 is 1,416 mA * 6000 ohm = 7,08 V. The voltage at node A must then be: vA = 7,08 V - 5 V = 2,08 V. Is this correct? Yes. Now we should be able to see the effect when DZ2 is reinserted. What will happen? When DZ2 is reinserted I'm not so sure about. My initial thought would be that all the current now runs through DZ2, and none through R2, since current "prefers" a less resistive path. Yes. DZ2 will be forward biased so it looks like a short circuit. (A real diode would have a forward voltage drop of about 0.7 V.) So the effect will be that A will be pulled down to ground. With different values of R1 and R2 this might not be the case. If all the current runs through DZ2, then that must mean that iDZ2 = iR1. Calculating iR1: iR1 = (5V − 1,5V − 2,08 V) / 1 kohm = 1,42 mA. That means that iDZ2 = 1,42 mA, but the correct answer is 2,5 mA. Where am I going wrong? I've highlighted one error. Since A is now forced to 0 V the voltage across R1 is 5 - 1.5 = 3.5 V. Now you can calculate the current through R1. But there's more. R2 is still in-circuit and some of R1's current will go through R2. Calculate how much will flow through R2, subtract that from the current through R1 and the remainder goes ...?
H: Identifying a cylindrical SMD component with two banded color markings I have been looking at google images of cylindrical smd resistors, but they don't look like the ones on my board. So my question is: What component is this? Long story: This board is a 230VAC to 11.8VAC converter for a lamp which does no longer output 11.8VAC but rather drops down from 8VAC very quickly(~1sec) to 0VAC and I at least try troubleshooting it. The mystery components mentioned also behave strangely when measured by a multi-meter (they each give different resistance values even when measured from different sides ranging from 1kOhm to 150MOhm) AI: Component marking These packages are called MELF (metal electrode leadless face). They're usually used for resistors and diodes. The fact that there are only two color bands/rings makes them less likely to be resistors. See Electronic color code on Wikipedia. The missing third ring could be interpreted as zero (black), making the red-yellow component a 24 Ohm resistor. Vishay uses two-ring color codes to mark their diodes. Here's an example: Source That would make the red-yellow component a BYM11-series 400V diode. To be sure you should measure the components out-of-circuit. In-circuit measurement When measuring components in-curcuit, you should be aware that other components might influence your measurements. Examples: low value resistances parallel to diode-under-test make them appear short-circuits capacitors parallel to resistor-under-test make them look short-circuit with rising resistance These are examples, there are more combinations. Components are best tested out-of-circuit to be sure. When measuring in-circuit cannot be avoided keep the above in mind and suspect components to be a certain type. Caution When measuring components that connect to mains make sure you wait long enough to bleed existing charge off of capacitors. You might use Low-Z mode on a multimeter to test such capacitors and help discharging them using the low input impedance. Be aware of dielectric absorbition
H: Do I need additional power for an IR LED diode 50 feet away from a Raspberry Pi? I'm creating a central remote to control my mini-split HVAC units. Those units are controlled with an IR remote. Each unit is in a different room of my house. I have everything working on my breadboard and the IR LEDs are able to control the HVAC when it's in the same room. However, the Pi will be in my server room and each of the IR LEDs will be wired to a different room in my house. The rooms are anywhere from 30 to 50 feet (10-15m) away from server room. The unit will have multiple LEDs but only one LED will be sending a signal at a given time. I'm using these IR LEDs from Amazon. RX IR LED Working Voltage : 2.7 - 5.5V Working Current : 0.6 - 0.8mA Carrier Freq. : 38KHz BMP width : 8KHz Receiving Angle : 70° Receiving Dist. : 15m TX IR LED Working Voltage : 0.9 - 1.3V Reverse Voltage : 5V Forward DC : 30mA Launch Angle : 30° Emission Dist. : 12 - 13m What gauge wire should I use to connect the LEDs over that distance? Will the 3v power from the Pi be enough to power the LEDs that far away? If I need to use an additional power source to power the LEDs, what would that schematic look like? Note: I'm hard wiring this for reliability and simplicity. I don't want to create multiple wireless WiFi modules that communicate with the Pi. I just want the diode in the other rooms. Here's my schematic Thanks! AI: As earlier answer mentioned, yes its doable but I would not recommend it. Raspberry PI I/Os are pretty delicate and with a few additional components you could create a solid solution. The way you are using an NPN transistor doesnt seem to be right. I would suggest you use FET/Transistor to mimize the current you draw from the 3.3V rail. Additionally since the amount of current the LED would consume is unknown, you certainly require a higher voltage power supply and not 3.3V. (Depending on what you can find easily, Your options could be any power supply with more then 5V output, e.g a 12V adapter, 19V laptop adapter etc). The ground between this power source and your Raspberry would have to be common. For each LED, your circuit would look something like below: simulate this circuit – Schematic created using CircuitLab For any given AWG wire, the website below provide a decent table to estimate its resistance per 1000 ft and you could use that to estimate the cable resistance. http://hyperphysics.phy-astr.gsu.edu/hbase/Tables/wirega.html Now addressing the cable selection, as your current is expected to be small, typically between 50mA to 200mA depending on the LED requirement, you could easily use a AWG 28 or so cable. Possibly a simple Ethernet cable as most ethernet cables are AWG24 to AWG28 rated (and usually sturdy, easily available and low cost). by playing around the R1 value, you could actually extend the length even further easily.
H: If I use a 19V 4.7A supply to a MAX 250W ATX power supply am I an idiot or should it be safe enough? I can do the maths, I get near 90W, but I'm only planning to draw under a quarter of the power supplies (ebay link) rated max of 5V/12V combo (estimated load 30W). I therefore consider my 19V old laptop supply adequate plus a little overhead. Reading the listing I see a power rating of 150-250W, I expect that translates to 150W continuous and 250W peak, but who knows right now. I did debate splicing two old laptop chargers together, but worry although it would work I probably should have some protection circuitry to stop them fighting each other. Am I an idiot? (I accept that I am idiotically frugal to attempt to use old laptop chargers instead of a dedicated high load supply but the cost to recycling ratio doesn't add up) I understand to a level of intermediate electronics but always considered that an underpowered supply was only a problem if it was truly unmatched. i.e. you were expecting the device to draw the full load or have a relatively high startup(or intermittent) draw then your supply should match otherwise load dependent. Reading Voltage at what Amperage made me question my sanity and proneness to unnecessary fire risk. Don't get me wrong, I've always advised to have a suitably matched rating on supply and device or ideally over-rated supply to avoid running hot. End use devices are various voltage hobby microcontrollers and SATA drives via https://www.amazon.co.uk/gp/aw/d/B07R8S8VTT AI: If I understand this correctly, you intend to use this "PeakPSU", apparently a cheap PicoPSU knockoff: ...which is a board with a bunch of DC-DC converters intended to generate the usual voltages to power a PC motherboard from a 19V laptop power supply. The "specification": Note it doesn't spec all the stuff you'd really like to know about a switching converter or power supply, like how much current each output can provide, output voltage accuracy and ripple, efficiency, acceptable ambient temperature, etc. So you can't know if it will make your motherboard happy. Also it seems full of cheap "general purpose" capacitors of unspecified origin. Maybe they're the low-ESR models, but there is no way to know. If they are not rated for the ripple current they will take in use, then they will die. Maybe if you power a motherboard that only requires 30W they will die a bit slower... but they look disturbingly similar to the caps on these ubiquitous fake "LM2596" modules that are everywhere these days, and these are trash. They could at least have invested in a bit of purple paint to make them fake OSCON's. Why not buy the genuine instead of the knockoff? It will work with your 19V power supply (it says "12-32V input") and it comes with full specifications so you can check the current on each output will be what your motherboard requires, a manual, etc... and it's almost the same price!
H: 220 volt step-down transformer with 6 secondary wires I am an electronics novice. :) I opened a working Casio vintage desk calculator (likely from the late 1980s/early 1990s). It has a 220 volt step-down transformer with six secondary wires. The two mains wires go into the transformer at the bottom. The 6 wires come out from the sides (three on each side). Following are the related images: I found out continuity among the secondary wires as follows: Purple-Grey-Purple: Continuity (side one) Orange-Red-Brown: Continuity (side two) However, the wires are wired to six separate contacts on the circuit board. Are there differences in terms of voltage among each set of wires coming from the same side? If each carries a different voltage, how can I test this with my multimeter? I would appreciate guidance for using my multimeter safely/correctly. If there are no differences among each set of wires exhibiting continuity, why were they wired separately? Also, do the markings on the transformer mean anything? There's also another, smaller marking (not visible in the images) that says "E41-2L11/2". Update: The calculator has an integrated printer, and therefore a motor. (Thank you TimWescott.) Update: Calculator display: AI: Are there differences in terms of voltage among each set of wires coming from the same side? If each carries a different voltage, how can I test this with my multimeter? I would appreciate guidance for using my multimeter safely/correctly. No continuity between the two sides means two windings that are isolated from each other. The separation between the two windings at the top and the winding at the bottom indicates an additional level of physical and electrical isolation between the primary and secondary. The purple-grey-purple winding is likely a center-tapped winding. Yon can expect the voltage between grey and each purple to be half of the voltage between purple and purple. The brown-red-orange winding likely has a tap somewhere other than the center of the winding. The highest voltage will be the sum of the other two, but the two lower voltages might not be equal. Since the calculator is working, there does not seem to be any reason to check winding resistances. If the condition of the transformer had been unknown, prior to applying voltage, you would check the resistance from each lead to every other lead and the frame of the transformer. The best way to use the multimeter would be to set it to an AC range that is higher than 220 volts. Apply 220 volts to the primary and measure all of the secondary voltage combinations. They will presumably be considerably less than 220 volts. Once you know the approximate voltages, you can use a lower voltage setting.
H: VHDL "can't match slice type array type" I'm new to VHDL and I'm trying to use code off a teacher's slide that doesn't seem to work as is, and I can't tell what's wrong: library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; entity Add4 is port ( Data1, Data2 : in std_logic_vector(3 downto 0); Cin : in std_logic; Cout : out std_logic; Sum : out std_logic_vector(3 downto 0) ); end entity Add4; architecture RTL of Add4 is signal Out5bit : unsigned(4 downto 0); begin Out5bit <= ('0' & Data1) + ('0' & Data2) + Cin; Sum <= Out5bit(3 downto 0); Cout <= Out5bit(4); end architecture RTL; The error I'm getting is: add4.vhd:15:28: no function declarations for operator "+" add4.vhd:16:17: can't match slice with type array type "std_logic_vector" The first error goes away if I comment out the assignment of Out5bit and the second goes away if I comment out the assignment of Sum. What am I doing wrong? Would this code have worked without being modified on some older version of VHDL or did my instructor just give me bogus code? AI: Your ports are of "std_logic_vector" type but the internal signal Out5bit is unsigned. Numeric_std doesn't provide an "+" operator that adds the first type and returns the other, so no matching "+" operator is visible. Three approaches to fix this: 1) Type conversions from std_logic_vector to unsigned and back again. Ugly, but clearly describes what you are doing - interpreting a std_logic_vector (essentially a bag of bits) as an unsigned number. 2) "use" certain non-standard libraries that provide such operators. Can cause ambiguities especially if you also have signed data... 3) Declare the ports unsigned. In addition to just working, it clarifies the design intent - this unit operates on unsigned data (not signed, or arrays of boolean flags, or character data etc) You also have to coerce "Cin" to an unsigned number as Elliot points out... Cin is a std_logic (0 => cin) is a 1-bit array of std_logic (which should be compatible with unsigned). Note the syntax uses "named association" ... the "positional association" version of a 1 bit vector would be (Cin) which the compiler cannot detect as a vector unlike the 3 bit vector (Cin,Cin,Cin) unsigned'(0 => cin) is explicitly unsigned.
H: How many inrush current limiting thermistor do I need and where should I place them? In most designs they place a single NTC thermistor in series before the bridge rectifier and in some two or four: simulate this circuit – Schematic created using CircuitLab Isn't a single thermistor sufficient for limiting the inrush current? when and why do we need four thermisotrs? AI: NTC thermister in the AC side of the Bridge rectifier is best .The big filter cap on the DC side gives some protection for the Bridge from voltage spikes.There is these days motivation to bypass the NTC when the system is up and running in order to save power .A relay is robust and simple and the coil wastes less power than the hot NTC .When the NTC is bypassed by the relay on the AC side the relay is switching AC where it will live up to its ratings .One NTC in the AC side is adequate .Using two NTCs one in each leg can be cost effective at high power and gives a more symmectrical circuit layout which can help EMC .
H: How do you make an antenna with length much greater than the wavelength work? I've read that antennas work best when their length equals 1/2λ, so how does one make an antenna that is 3/2λ, 2λ, 3λ, etc. work? How do I calculate how much energy I am losing compared to the 1/2λ length antenna? AI: The issue is not that a long dipole is inefficient, but that it may have an odd radiation pattern. For example, from Radiation Patterns of Dipole and Loop Antennas by Bhowmik, the theoretical polar plot of a four-wavelength dipole is shown below. As the length increases in proportion to a wavelength, the number of major lobes or points of maximum radiation increases, and they move outwards aligning further with the axis of the antenna. Depending on your needs, a multi-wavelength dipole may work well... or not. Test empirically, and note that a small change in orientation can cause a large change in signal. Also consider that near-field and far-field effects may differ.
H: Does layer order matter on multi layer PCB? I have a 4 layer PCB with the following planes... Connector (Top): Holds all traces going from connectors to components. Signal Ground: Coper filled completely. Power (Bottom): Coper filled for +15V and traces for -15V Does it matter if the bottom layer is the power layer and that the ground layer is adjacent to it on the 3rd layer? Some notes about the design: Uses +15V -15V Signal is audio with some op amps. Basically building simple audio mixer, nothing fancy. AI: It depends on your design requirements, such as highest signal frequency and EMC (electro-magnetic compliance). But in general for audio type signals it doesn't matter too much. The power plane will act like a ground plane next to signal layers, so you want to use as much copper as possible on the power planes as well. If your traces need to match a specific impedance, then you'll need to calculate trace size based on the dielectric and board thickness. There are good trace calculators on the web. I'll provide an example below. Or you will need a good layout CAD program which can computer trace impedance based trace dimensions and how far away the underlying ground/power plane is. For a simple audio circuit like you have you really probably don't need to worry about trace impedance too much assuming your trace lengths are far shorter than a 20 Khz or so wavelength (20 KHz has a wavelength of about 15 km!). Trace Impedance Example Using EEWeb Trace Calculator: Board Type FR4: dielectric constant = 4.7 Layer thickness (between layers): 40 mil Copper thickness: 1 mil Trace Width: 50 mil Resulting Impedance: 61 ohms Layer Stackup I would definitely modify the layer stack up as follows: Top connectors and signal traces Power Ground Signal The above is typically what is seen. I like to have the signal layers on the outside in case any ECs (engineering changes) are needed. It is easy to modify traces on the outside, but not inside.
H: Why does it take 2 clock cycles to move to the RESET state in my state machine? I'm writing a finite sequence encoder in Verilog. Basically, an output Z will be activated if the input W is on for at least four clock cycles, or if its off for at least 4 clock cycles. See the following timing diagram Also, to get some more context, take a look at the state diagram for the sequence encoder. I've implemented a simple behavioral design and it works, but for some reason, it takes two clock cycles for the state to change when I'm trying to go to the RESET state. For example, when I'm in state C and put on the Reset, I have to press the Clock button twice for it to finally move into reset mode. Take a look at my code. Do you have any idea what is wrong? module Part2( input Reset_L, input W, input Clock_L, output reg [8:0] Y, //group of 9 flip flops output Z ); wire CLK; assign CLK = ~Clock_L; reg [3:0] SCURRENT= A; //initializing to RESET state reg [3:0] SNEXT; parameter A = 4'b0000; parameter B = 4'b0001; parameter C = 4'b0010; parameter D = 4'b0011; parameter E = 4'b0100; parameter F = 4'b0101; parameter G = 4'b0110; parameter H = 4'b0111; parameter I = 4'b1000; always @(W or SCURRENT) //next state logic begin case (SCURRENT) A: if (W==0) SNEXT <= B; else if (W==1) SNEXT <= F; B: if (W==0) SNEXT <= C; else if (W==1) SNEXT <= F; C: if (W==0) SNEXT <= D; else if (W==1) SNEXT <= F; D: if (W==0) SNEXT <= E; else if (W==1) SNEXT <= F; E: if (W==0) SNEXT <= E; else if (W==1) SNEXT <= F; F: if (W==1) SNEXT <= G; else if (W==0) SNEXT <= B; G: if (W==1) SNEXT <= H; else if (W==0) SNEXT <= B; H: if (W==1) SNEXT <= I; else if (W==0) SNEXT <= B; I: if (W==1) SNEXT <= I; else if (W==0) SNEXT <= B; default: SNEXT <= 4'bxxxx; endcase end always @(posedge CLK) begin if (Reset_L==0) SCURRENT <= A; else SCURRENT <= SNEXT; case (SCURRENT) A: Y<=9'b000000001; B: Y<=9'b000000010; C: Y<=9'b000000100; D: Y<=9'b000001000; E: Y<=9'b000010000; F: Y<=9'b000100000; G: Y<=9'b001000000; H: Y<=9'b010000000; I: Y<=9'b100000000; default: Y<= 9'b111111111; endcase end assign Z = Y[4] | Y[8]; endmodule AI: I think the problem lies in this part always @(posedge CLK) begin if (Reset_L==0) SCURRENT <= A; else SCURRENT <= SNEXT; case (SCURRENT) A: Y<=9'b000000001; B: Y<=9'b000000010; C: Y<=9'b000000100; D: Y<=9'b000001000; E: Y<=9'b000010000; F: Y<=9'b000100000; G: Y<=9'b001000000; H: Y<=9'b010000000; I: Y<=9'b100000000; default: Y<= 9'b111111111; endcase end From my understanding of Verilog and the testbench I created to test your code, I think that what is being executed in parallel is: posedged(k) (if || case) ----> posedged(k+1) (if || case) where the first posedged sets SCURRENT(k+1) <= A, and Y <= X. (where X depends on the original value of SCURRENT(k)) and the second one does SCURRENT(k+2) <= A, and Y<=9'b000000001. (since SCURRENT(k+1) is A) What you probably intended to do is always @(posedge CLK) begin if (Reset_L==0) SCURRENT = A; else SCURRENT = SNEXT; case (SCURRENT) A: Y<=9'b000000001; B: Y<=9'b000000010; C: Y<=9'b000000100; D: Y<=9'b000001000; E: Y<=9'b000010000; F: Y<=9'b000100000; G: Y<=9'b001000000; H: Y<=9'b010000000; I: Y<=9'b100000000; default: Y<= 9'b111111111; endcase end Where the case will be evaluated after the if being "executed", and since mixing blocking and non-blocking statements can lead to problems synthesizing, use this to sort it all out, always @(posedge CLK) begin if (Reset_L==0) SCURRENT = A; else SCURRENT = SNEXT; case (SCURRENT) A: Y=9'b000000001; B: Y=9'b000000010; C: Y=9'b000000100; D: Y=9'b000001000; E: Y=9'b000010000; F: Y=9'b000100000; G: Y=9'b001000000; H: Y=9'b010000000; I: Y=9'b100000000; default: Y= 9'b111111111; endcase end
H: Converting Magnetism to electricity I've been seeing a lot of videos online of people using neodymium magnets to make a motor spin to generate electricity. If we can generate electricity from magnets why isnt this being used more often? I'm assuming there are limitations. E.g heat or the amount of energy the magnets can generate? Can someone explain why this isnt a viable source for power? Edit: apparently all the videos are fakes AI: I've been seeing a lot of videos online of people using neodymium magnets to make a motor spin to generate electricity. Please link one or at least further explain what they do in the video, a lot of people do bogus videos where "free energy" is generated by magnets If we can generate electricity from magnets why isnt this being used more often? Any electric generator uses magnets or electromagnets to convert mechanical energy to electrical energy. I'm assuming there are limitations. E.g heat or the amount of energy the magnets can generate? The energy is not generated by the magnet, but by the movement of the magnet and its magnetic field. You can always use a larger/stronger magnet but then you would need to put way more effort/force to move the magnet Can someone explain why this isnt a viable source for power? Magnets are used on any electric generator, though they will not create energy by themselves.
H: Solving a linear system of equations from a mesh analysis in the s-Domain Here is an exercise from my Textbook in which one is asked to find the mesh currents: The first thing I did was find the s-Domain equivalent of the circuit: Now, I can write the mesh equations from it: From Mesh 1: $$ \frac{6s\cos{13}+12\sin{13}}{s^2+4}= \frac{4000}{3s}\left(I_1-I_2\right)+2\left(I_1-I_3\right)$$ From Mesh 2: $$ \frac{4000}{3s}\left(I_2-I_1\right)-10^{-3} +10^{-3}s\left(I_2-I_4\right)=-0.005\,I_1 $$ From Mesh 3: $$ \frac{6s}{s^2+4}=2\left(I_1-I_3\right)+\frac{1000}{s}\left(I_4-I_3\right) $$ From Mesh 4: $$ \frac{1000}{s}\left(I_3-I_4\right)-10^{-3}+10^{-3}\left(I_2-I_4\right)=0 $$ Upon simplification, the linear system to be solved is the following: $$ \begin{cases} \frac{6s\cos{13}+12\sin{13}}{s^2+4} & = \left(\frac{4000}{3s} + 2\right)\,I_1 - \frac{4000}{3s}\,I_2 -2\,I_3\\ 10^{-3} &= \left(\frac{-4000}{3s} + 0.005\right)\,I_1 +\left(\frac{4000}{3s} + 10^{-3}s\right)\,I_2 -10^{-3}s\,I_4\\ \frac{6s}{s^2 + 4} &= 2\,I_1 - \left(2+\frac{1000}{s}\right)\,I_3 + \frac{10^3}{s}\,I_4\\ 10^{-3} &= 10^{-3}s\,I2 + \frac{1000}{s}\,I_3 -\left(\frac{10^3}{s}+10^{-3}s\right)\,I_4 \end{cases} $$ Now, I would like to ask if there is a method to solve the above system with MATLAB or a calculator because it seems pretty daunting to be done by hand. AI: There is, you can solve it with the symbolic package. In Gnu Octave, I did as follows: pkg load symbolic syms s i1 i2 i3 i4 %Since the angles are in degrees, you'll need to use "cosd" and "sind" instead eq_sys = [ (6*s*cosd(13)+12*sind(13))/(s^2+4) == (4000/(3*s)+2)*i1-4000*i2/(3*s)-2*i3; 1e-3 == (-4000/(3*s)+0.005)*i1+(4000/(3*s)+1e-3*s)*i2-1e-3*s*i4; 6*s/(s^2+4) == 2*i1-(2+(1e3/s))*i3+1e3*i4/s; 1e-3 == 1e-3*s*i2+1e3*i3/s-(1e3/s+1e-3*s)*i4 ]; aux = solve(eq_sys,i1,i2,i3,i4) After that, you can calculate the inverse Laplace Transform of \$I_1(s)\$ as well as \$I_2(s)\$: syms t ilaplace(aux.("i1")) ilaplace(aux.("i2")) The expression of \$i_1(t)\$ is: $$ i_1(t) = \frac{18995427834743075\sin\left(2t\right)}{70368744177664}-\frac{17314045002411675\cos\left(2t\right)}{562949953421312} $$ Likewise, that of \$i_2(t)\$ is: $$ i_2(t) = \frac{296812200041343\, \delta(t)}{4503599627370496000}+\frac{607845269247680625947479059060193\, \sin(2t)}{2251770540398008282646577152000}-\frac{34629909136866774277122155673357\, \cos(2t)}{1125885270199004141323288576000}-\left(\frac{829655138918152783365787659}{985149611424128623657877504}\,e^{-1000t/7}\left(\cos\left(\frac{3000\sqrt{3}t}{7}\right)-\frac{341473085180277742962620803\,\sqrt{3}}{2488965416754458350097362977}\sin\left(\frac{3000\sqrt{3}t}{7}\right)\right)\right) $$
H: How can I make my PNP amplifier circuit to turn off faster? I'm using the following circuit to switch a 24V signal to a PLC. The rising edge is fast and perfect(38 ns) but the falling edge of the signal is not as good(3.5us)! How can I modify this circuit to have faster-falling edges? simulate this circuit – Schematic created using CircuitLab AI: The basic idea is something like this: simulate this circuit – Schematic created using CircuitLab There are problems with this, though. For example, \$Q_3\$ might oscillate. Some added base resistance is a common fix. But there are other approaches. In this case, I don't think there's much likelihood, though. Just mentioning it, in case it matters. Also, you can always consider adding some emitter resistance for the output BJTs, if you want. But you'd need to know something about what you are driving to figure out those values. So that's also missing. There's also no base protection for either output BJT. You might also consider adding diodes to protect them against short-term reverse-voltage transients. I've also not added local power supply capacitors. Again, you may also want those. Or not. I've also avoided the speed-ups. A fuller circuit with all the crap added might look like this: simulate this circuit In the above, I've left off the base protection diodes. But they are pretty obvious, if you want them. With appropriate component values and those fancy BJTs I mentioned above (the BFT93 and BFR93 or BFR91A), the following Spice simulation results (it assumes some source resistance, as well, for what's driving it, and drives a load represented by two \$20\:\text{k}\Omega\$ resistors in series between the \$+24\:\text{V}\$ and ground. (So a \$10\:\text{k}\Omega\$ load, in short.) As you can easily see, it's pretty cut and dried. Nice and sharp edges and very little change in the duty cycle or its delay relative to the input. And I spent exactly zero time trying to calculate resistors or capacitor values when popping that into Spice.
H: Infinite loop on microcontroller vs modern CPU On a microcontroller (more specifically, on an Arduino Uno board using the ATmega 328P microcontroller) I would normally use an infinite loop to check for inputs etc (in Arduino land, this is normally the loop() function). If I leave this function blank however, it doesn't cause any problems. On a desktop / laptop with an Intel i7 CPU etc if I ran a similar infinite loop (with nothing to do, or very little to do) it would pin the CPU at ~100% and generally spin up the fans etc ( a delay could be added to prevent this for example). Why is this seemingly ok on a microcontroller but not usually wanted on a microprocessor? Am I right in thinking that the ATmega is in fact running at 100%, and that because it is so low powered it doesn't cause any obvious heat problems? AI: Why is this seemingly ok on a microcontroller but not usually wanted on a microprocessor? It is also unwanted on a microcontroller for the same reason: it wastes power. Am I right in thinking that the ATmega is in fact running at 100% Correct. and that because it is so low powered it doesn't cause any obvious heat problems? Correct. However, if you run your microcontroller on batteries, then you have to think real hard about not wasting power. On a tiny cpu like AtMega328P it will not cause heat problems, but it will definitely shorten battery life. All cpu's, whether they're desktop powerhouses or tiny microcontrollers, use the same methods: 1- Reduce clock speed or voltage. 2- Shut down unneeded hardware. 3- Go to sleep and wake up on an event (this is a special case of shutting down unneeded hardware, in this case the cpu is shut down). In the AtMega328P you can implement this too. You can use a slower clock if you don't need all the awesome power of the 8-bit core, you can shut down unneeded peripherals... and the most important is the sleep mode. You should read the manual for details, as there are several sleep modes which differ in wake-up latencies, what peripherals remain online and able to wake the cpu, whether RAM data is conserved or lost, etc. But basically the idea is: when in sleep mode, the cpu is stopped so it uses much less power. When an interrupt occurs, this wakes up the CPU and it processes the interrupt. Of course you have to use the proper sleep mode and configure it properly so the peripheral that needs to wake up the cpu (for example, a timer or a GPIO interrupt) is not shut down. If everything is shut down, you'll have to use NMI or even Reset to wake it up, in the latter case by rebooting it. If all your application does is wait on interrupts, like: Pin Change Interrupt (PCI) to detect a button press or an incoming signal Timer Data received by UART or USB etc Then you don't need to spin the main loop. After configuring everything at boot, you'd start the main loop with a "go to sleep" instruction. The next instruction will execute after the cpu wakes up, processes all pending interrupts, and returns to the main loop. Then the main loop can, if required, do something about the received events, if they were not entirely handled by the interrupt code... and then go back to sleep. Even if you're not using batteries, having low standby current can a mains powered the switching power supply to skip cycles and waste a lot less power too.
H: IRF520 as a relay driver I am trying to use IRF520 as a relay driver for ESP32, but by reason unknown it does not works. I have replaced it twice with a new ones, but yet it keep not working. I have 3V on the ESP32 pin when the state is HIGH and 0V when the state is LOW. I am using the circuit below: Why the IRF520 never trigger the relay ? AI: What you missed is that threshold voltage for IRF520 is 4V. A MOSFET won't start conducting heavily (or completely turn ON) until threshold voltage is reached. You are using 3.3 volts which is obviously less than that.You need a separate drive circuit or just use another transistor with a lower threshold voltage, say 3 volts.