text stringlengths 83 79.5k |
|---|
H: Low-side gate driver consistently shorts VDD to GND upon circuit power-up
I am using the UCC27423DGN dual low-side MOSFET driver as a current sink in order to drive some piezo elements. In general the gate drivers I am using are inverted, so on a high pulse on the Pulse_A/B lines, the outputs Pulse_A/B_Out should drop from VDD to GND.
In the design, VDD is 10.5 V from a switching regulator, and Pulse_En, Pulse_A, and Pulse_B are all 3.3 V signals from the microcontroller.
With no output connected (no piezo element attached), on circuit startup I am seeing that the gate driver is consistently shorting the VDD signal to GND once VDD is applied, seemingly permanently damaging the gate driver. Even after removing the IC from the board, a short can be seen between VDD and GND on the TSSOP pins.
The small resistor and capacitor on the output are meant to act as a low-pass filter. As far as I know, the voltages should be within spec and the circuit fails before a load is attached. Any help would be appreciated, as I am not sure what I am missing.
AI: You're simply operating the gate driver way outside of its absolute maximum ratings.
According to the datasheet, the driver can drive up to 4.5A pulses for at most 0.5µs. It can only drive 0.2A continuously. Its output resistance is typically 2.2 Ohms.
When the driver switches its output low, a current of around 4.5A will flow through it as the huge 3.3µF capacitor discharges. Unfortunately, an RC low-pass with 2.2 Ohms and 3.3µF has a time constant of around 7µs, and the current only decays to a safe level after 3 tau. As a result, you're whacking the driver with an excessive current for more than 20µs, while it's only specified to survive this current for 0.5µs.
In other words, you're exceeding the safe operating area by a factor of 40. It's no wonder that the driver dies. You simply can't drive such huge capacitors with this MOSFET driver. |
H: LED still on when transistor is closed with Arduino
When simulating the following circuit, there is no problem. However, when I do it in real life, with a BC558 transistor, the LED stays on even when the Arduino is not sending any voltage.
The resistor going to the base is 20 kΩ and the one connecting to the LED is 1 kΩ. The power supply is sending a constant 12 V to the circuit.
When using a multimeter (irl), I notice that the power supply's voltage seem to be going through the Arduino causing it to seem like it is sending a voltage to the transistor.
Any help would be greatly appreciated.
simulate this circuit – Schematic created using CircuitLab
AI: when I do it in real life, with a BC558 transistor, the LED stays on
even
The BC558 is a PNP transistor and, I expect you should have used an NPN transistor like the BC548.
Images from here.
When using a multimeter (irl), I notice that the power supply's
voltage seem to be going through the Arduino causing it to seem like
it is sending a voltage to the transistor.
Yes that will happen because the collector base region is incorrectly forward biased with a PNP transistor. |
H: Moving magnet frequency over a coil
It's my understanding that :
Changing magnetic field over a coil induce current in the coil itself.
Current running through a coil makes it magnetic. (To put it simply)
Can these 2 rules affect each other to reach a point of equilibrium, and if so, is there a formula to get that precise point of frequency / attraction ratio ? Is there a specific name for that phenomenon ?
Ex : Would it be true to state that if i were to oscillate a magnet back & forth very quickly over a coil connected to a load, enventually the coil would emmit a magnetic field, thus attracting / repelling the magnet and slowing down it's oscillation ?
AI: Yes, there's a school physics demonstration you can do fairly easily: take a length (1m or so) of conductive but non-ferromagnetic pipe (copper or aluminum, say) and a strong cylindrical magnet that is slightly smaller in diameter than the inner diameter of the pipe so it can slide freely. Drop the magnet through the pipe and you'll see that it takes longer to fall through than an equivalent length of e.g. plastic pipe (or just in air) since the induced eddy voltage sets up an opposing magnetic field that slows the passage of the magnet.
See: https://www.youtube.com/shorts/o8RiIPi5OB8 |
H: Digital Counter not initializing to 0 or rolling over to 0
I'm trying to make a 3-bit counter using D flip flops that loops through the sequence (0,3,4,5,7) repeatedly.
So far, I've made a timing trace, block diagram, operation table, Karnaugh maps, rough circuit diagram, and implemented it in Multisim.
The sequence somewhat works. When I start the simulation from scratch, the 7 segment goes 3, 4, 5, 7, 5, 7... It does not initialize to 0 unless I press the reset button, in which case it does the prior, but with a 0 before the 3. I cannot fathom why it decides to stick between the last two numbers of the sequence instead of rolling over to 0.
Any tips on how to proceed would be appreciated.
Thank you
AI: Your Karnaugh maps are correct (although not optimal since you haven't made use of the don't cares) but you're reading the sum-of-products off wrong.
Given that you are mapping 3 inputs, a product of only a single term must be a rectangle covering 4 cells. Your rectangles cover only 2 cells, and therefore must be the product of two terms.
F0(Q0, Q1, Q2) = /Q0 /Q1 + /Q1 Q2
and
F2(Q0, Q1, Q2) = Q0 Q1 /Q2 + /Q1 Q2
If you fully minimize your k-maps,
F0(Q0, Q1, Q2) = /Q1
F1(Q0, Q1, Q2) = /Q1 /Q2 + Q0 /Q1 = /Q1 (Q0 + /Q2)
F2(Q0, Q1, Q2) = Q0 /Q2 + /Q1 Q2 |
H: Three-phase motor Delta/YY connection diagram and windings troubleshooting
I am trying to troubleshoot this 1.4 kW three-phase motor and I'm unsure how its internal windings are interconnected or whether they are shorted.
On the plate it says "Delta/YY 400 V", and I'm not sure what YY means. Most articles online describe delta and star (Y) configurations. But what is YY? Star-star?
The motor has 6 wires coming out of it, color coded in pairs of red, green, and white.
I assumed the pairs with wires of the same color are the two ends of a winding, but then this wiring diagram on the motor got me confused.
"niedrige Drehzahl" means "low speed", and "hohe Drehzahl" means "high speed". But how is the Delta configuration the "low speed"? I thought Delta was the high speed, with more power.
And how is that even a Delta configuration with 2U, 2V, and 2W left disconnected? Either the diagram is incomplete, or the motor already has some connections done internally, or something else.
Measuring resistance with a multimeter I get these values:
Between 1U and 2U -> 11.8 Ω, 1V and 2V 21.4 Ω, 1W and 2W 11.8 Ω. If these were to be the ends of each winding, the resistance should have been the same and close to zero, right?
What is also weird to me is the resistance value between wires of different colors, which I assumed correspond to different windings, and should have an "infinite" resistance between them, i.e not be shorted.
But I get between U1 and V1 19 Ω, U1 W1 19 Ω, V1 W1 19 Ω, and the same respectively for U2, V2, and W2.
The motor spins fine in both configurations, but without any load attached. I didn't test it under load, and I'm not sure if I should.
How can I find if the windings are damaged? Is it working just because somehow a magnetic field is still rotating even with damaged windings? Does this motor have more than 3 windings? Is this wiring scheme common? What is YY?
AI: Shorts between the turns of a mains AC powered induction motor windings reveal themselves quickly as smoke - it's like a shorted transformer.
Leaks between different windings and the motor body are revealed by using an insulation meter,"megger" is a traditional tool for it.
Your motor is a dual speed motor. The motor can have either 2 fully separate stators for different speeds, only one is used at a time. Or there's 2 stators used in the same time, but their windings are ingeniously interleaved so that the number of poles is doubled if the windings of the second stator get reversed voltage. Doubling the number of the poles halves the synchronous (=no load, no friction) speed. Your motor is an example of that 2nd type.
For more data search for dual speed induction motors. Heres's a randomly picked advertisement http://www.donbassmotor.com/documents/Multi-Speed_Three-Phase_Induction_Motors.pdf (Disclaimer: they do not pay to me)
It contains also the connection explanations. Here's a screenshot from the linked ad. You have only 6 free wire ends, so a half of the connections are made internally and they cannot be changed.
This technology was new in the same era when landline telephones and spark transmitter radios were the state of the art in electronics. |
H: Why does my SSR’s heatsink have a small positive voltage?
I have an SSR in open state, split phase 220 across the inputs (heater inline), for now ground is not connected to anything, but I noticed, I have ~6.5 VAC from the heat sink to ground. I checked and there is no path the multimeter can find between either input terminal and the heat sink. What is causing the heat sink to be hot with low AC voltage? Is it safe to just ground the heat sink to bring the 6.5 VAC down? I can’t just leave the heat sink floating because I want to mount it to a conductive chassis that we need to handle.
It’s a bit of a knock off relay, but I’ve seen this now on two separate systems (same brand but different relays) in two different buildings. Doesn’t happen with just 120 VAC across the inputs. For both instances, the relays still open and close fine and are currently operational with 220 split phase and 120.
AI: Parasitic capacitance between the electrically hot internal semiconductors and the isolated SSR baseplate causes this. You can prove this by placing a 10k resistor across the high impedance voltmeter and the small potential you measured will disappear. These currents at powerline frequencies are safe to go to ground. At much higher frequencies like switch-mode the currents can cause issues. |
H: Why do battery cells fail in groups?
I have been observing for a long time that battery cells seem to fail in groups that are in close proximity.
I agree that observing 3 cells in a flash-light is not a very ample set, but I recently had the chance to observe several boxes with close manufacturing dates that have held sets of about 100 cells each (in close proximity) and in which several failed. All batteries with expiry date way into the future:
In all sets one could observe one battery failing bad and the others next to it following in the same path, as if one was acting as catalyst in the process.
Is it known why this happens in this way?
AI: several boxes with close manufacturing dates that have held sets of
about 100 cells each (in close proximity) and in which several failed.
All batteries with expiry date way into the future
Properly stored Alkaline cells should not fail, so if you have several that did then there is a problem - perhaps defective manufacturing (fake cells?) or improper storage.
However as the saying goes "One rotten apple spoils the whole barrel". An alkaline cell is more likely to leak when discharged, due to build up of hydrogen gas which makes it vent. One cell may have high self discharge, or the electrolyte might eat away part of the case, or the seal might be defective. In either case the result may be electrolyte leakage. The leaked electrolyte is conductive, so it can discharge adjacent cells and make them leak too. This may be why you see clusters of failed cells.
Due to the increased chance of leakage, alkaline cells should not be left in a device when they are nearly flat. Some devices draw a small current all the time (even when 'off') eventually discharging the cells, with a similar risk. The worst case scenario is if the device is accidentally left turned on, when the chance of leakage is much higher. Therefore it is best to remove the cells from the device before putting it into storage. |
H: How to use the "Sense Function" of RT9080?
I'm testing the RT9080 as a voltage regulator, and on the datasheet I do not have too much information on what the "Sense Function" is.
I have the circuit connection, but how does it work, and how to use it?
In my case I was expecting info that can help to get the state of charge of the battery in order to integrate a battery level check in my build with an Arduino.
AI: A regulator senses its output voltage and then uses that signal to regulate voltage. The sense pin is used to sense the output voltage:
(Taken from the datasheet)
If you buy the version with the external sense pin you must hook this up to the output. Presumably you would do this close to the load to avoid any voltage drop in traces. |
H: Data collector: how much power will my system use (Linux vs. RTOS)?
This is about a data collection device. It mainly contains a Linux operating system, various data interfaces such as RS232/RS485/CAN/SDI-12/RJ45, etc., and a communication module for 4G and satellite communication. Of course, there are some analog ADC conversion circuits.
I am using an NXP i.MX 6ULL series chip at 900 MHz main frequency.
I would like to know how much more power I will consume with a LINUX system than with a real-time OS like FreeRTOS.
AI: The difference in power usage will be mostly defined by how efficiently you are managing device power states, including those of your CPU, and that is more dependent on driver support than the system core.
Your system needs a model of dependencies between devices (e.g. "the USB controller needs to be active for 4G to work"), and a policy to set the power levels so that your application can still work.
You want to reduce your CPU clock, possibly core voltage as well, and turn off any radio functions you are not currently using, that are the biggest items.
Communication uses magnitudes more power than anything else in the system, so you need a way to turn those components off for as long as possible. If a daily report is sufficient, turn on the radio once a day, if you need to receive commands, investigate if it is sufficient to check for commands once every hour, or if you can use a more lightweight protocol.
Once that is done, the other thing to look into is "tickless idle" mode, where the CPU will not even set a periodic timer to switch tasks and advance the clock, so ideally the CPU is turned off between collection of data points.
If the choice of CPU is not fixed yet, a slower and smaller CPU might also make a difference. |
H: Where do I hook up a speaker in this schematic?
I'm working on a project that needs to drive a single speaker. I've used LM2879T chips in the past to drive two speakers, so I have a couple extra I'm trying to use for this single speaker project.
Since I'm using a single speaker, I've heard I should 'bridge' the two outputs of the amplifier. From the datasheet, it gives this example circuit. Maybe it is a silly question, but I'm not sure where I'm supposed to attach the speaker in this scenario. My best guess is that it takes the place of RL, but I wanted to check with others first.
Elsewhere in the datasheet, it gives this example for a typical two speaker setup, and it is fairly obvious where the speakers go.
Again, I'm using this chip just because I have it on hand. I've been eyeing some better options I would go for instead if this chip isn't worth it.
Thanks for any help!
AI: The speaker connects where RL is on your bridge amplifier chip. The app note says 16 ohms so you know that a 16 ohm speaker can be safely connected. If your intended single speaker is lower than 16 ohm like say 4 ohm or 8 ohm then check the fine print in the data sheet. Remember that all these audio chips are pretty much voltage sources so lower speaker impedences will mean that the chip will try to make more current. It might not be able to do this. It might shut down, it may die young. |
H: Is my circuit ok, using an N channel MOSFET to switch a P channel MOSFET for a high side switch
I'm using an CP361 voltage protection to ensure 5 V, this switches an N channel MOSFET which then creates a link to ground for the P channel MOSFET.
The link to ground turns on the P channel MOSFET and allows power to the circuit.
Do I have everything in order here from my schematic? Thanks
AI: NCP361 voltage regulator
NCP361 is an overvoltage-protecting switch. You're using it to control a CMOS Sziklai pair. Fine enough - this configuration is fast to turn off, and slower to turn on - just about what you want.
You seem to be using same size complemetary devices as Q1-Q2. That's not necessary. The first device can be much smaller than the 2nd one - it will react faster as well. A logic-level 500mA-1A 10V mosfet will be plenty enough, just to keep the gate capacitance small.
C5*R1 determine the protection time constant. In your case, it's 1E-6*1E3=1ms. It will take a couple ms to turn the output off. Is that fast enough? If too slow, C5 can be made smaller.
Side note: Don't use those "bridge" crossings for wires on a schematic. It's an outdated practice and unnecessary to communicate your intent. If anything, modify the NCP361 component symbol to have GND on the bottom, making the current flow on the schematic more conventional (top-to-bottom, left-to-right).
E.g.:
simulate this circuit – Schematic created using CircuitLab
P.S. To get the no connect "X" symbol in KiCad schematic editor, press the Q key :) |
H: IC for translating 5V to 1.8V I2C signals
Looking for an IC to translate between 5V and 1.8V I2C. I need to connect an I2C sensor with MCU. MCU I2C pins are pulled-up to 5V while the maximum voltage on the sensor's I2C pins is 1.8V.
AI: You could use 2 NMOS for bidirectional levelshifting of I2C. The cathode of the integrated body diode should point towards the higher voltage. The source of the NMOS should be connected to the lower voltage.
Make sure you pick a NMOS that has low-enough V_GS threshold and low-enough gate capacitance. For your application i would recommend a SSM6N37FU or a similar part. |
H: Why is the air gap important in a flyback transformer?
Why is the air gap important in a flyback transformer?
How should we consider the equivalent circuit of a standard flyback transformer?
If we are going to wrap all the windings of transformer to the airgap what happens?
What is the difference between these two transformers:
Imagine them with bobbin.
AI: Why is air gap important in flyback transformer?
$$\color{darkblue}{\text{Short story}}$$
A gapped core has a lower peak flux density for the same inductance carrying the same current. This means it is less likely to suffer from core saturation problems. Put another way, it can tolerate a higher energy transfer to the secondary winding if primary current is increased.
$$\color{purple}{\text{Longer story}}$$
For a flyback transformer, the most fundamental thing to get right is the primary inductance. So, with an ungapped core, you might use 10 turns to get a required inductance of 100 μH.
$$\color{orange}{\text{I'm using convenient numbers to illustrate the point}}$$
When you introduce an air-gap, the core permeability drops and, to counter this, you need more turns to get the original inductance value. So, if the permeability reduces by a factor of four (due to the air-gap), 10 turns only gets you 25 μH.
To restore the inductance from 25 μH to 100 μH, you need to double the turns to 20.
$$\color{red}{\text{This is because inductance is proportional to turns squared}}$$
So, your gapped transformer has 20 primary turns and the ungapped transformer has 10.
"So what" you might say?
$$\color{blue}{\text{Here's where the benefit is seen (reduction of magnetic saturation)}}$$
The "things" that cause the magnetic core to saturate are current, turns and permeability. But, of course, the current in the ungapped core still has to match the current in the gapped core to ensure the correct level of energy is transferred each switching cycle.
We can't do anything about that; current and inductance make the energy to be transferred.
So, the gapped transformer (compared to the ungapped transformer) has: -
Twice the number of turns (bad for avoiding saturation)
One-quarter of the magnetic permeability (good for avoiding saturation)
Hence, the peak flux density in the gapped core is half the peak flux density of the ungapped core. That is why we gap many, many magnetic components.
If we are going to wrap all the windings of transformer to the airgap
what happens?
Because of fringing fluxes around the air-gaps, we tend to be careful about applying windings in those areas because the copper wire local to those spots can heat up excessively. So, just be careful about this.
It's better to apply several smaller gaps than one big gap because fringing is less with a smaller gap. And, of course, we can find ferrite materials that have low permeability (in effect, the gap is homogeneously distributed around the core).
How should we consider the equivalent circuit of a standard flyback
transformer?
I treat a flyback transformer no differently to any other transformer; two (or more) highly coupled coils. How we think of the flyback transformer in a circuit is a little different because we need to recognize that a flyback design doesn't push significant energy through the secondary circuit when the primary inductance is being charged hence, we use dot notation on circuit diagrams and ensure we are diligent when we wind the transformer. |
H: How to use isolated amplifier to measure voltage
I want to read the cell's voltage with a microcontroller, but the cell does not share the same GND with the microcontroller. I want to keep them separate. I read some suggestions for this problem, and I try to use an isolated amplifier (I.A). I am considering using this isolated amplifier AMC1200 to measure the voltage of a solar cell. This is the first time I work with I.A., so I want to ask if my design looks reasonable.
Problem Description
In the schematic, Vcells+ is the positive terminal of the cell, and CGND is the negative terminal of the cell. The maximum value of the cell's voltage is 7.2V. Since AMC1200 has an input range of +-250mV, I use 300kOhm and 10kOhm for scaling the cell voltage to the I.A. range. That gives V.S.IN.DIV, and the maximum value of this is 240mV. This is fed into the VINP of the I.A. VINN of I.A. is connected to CGND.
The output of the I.A. is differential output. Therefore, I use an external opamp to implement a differential amplifier with a gain of 2 to get a single output. This output voltage is read by an MCU.
Questions
I am not sure what will output from the VOUTP and VOUTN of the I.A. According to the simplified schematic, assume my V.S.IN.DIV is 240mV and the gain is 8, my VOUTP will be 240mV*8 + 2.5V = 4.47V and my VOUTN will be 0 + 1.29V = 1.29V. So, the output of my external opamp will be (4.47-1.29)*2 = 6.36V. Is my calculation correct? Also, is this a reasonable solution to measure the cell's voltage?
AI: Just a couple of issues with your calculations:
VOUTP and VOUTN are centered at 2.55 volts if VDD2 is 5 volts, so the gain of eight (1.92 volts) means that VOUTP will be 3.51 (2.55 + 0.96) and VOUTN will be 1.59 (2.55 - 0.96).
Your gain of two will give you 1.92 x 2 or 3.84 volts at your op amp output. (You could never have achieved 6.36 V since the op amp power rail is only 5V.)
Your circuit approach is fine as is. |
H: PCB Review / Signal Return Path
I'm trying to design better PCB layouts and as for now only work with 2 layers boards.
My question is about the signal return path on this PCB, is the design in the "right" path or I'm doing something wrong?
Any feedback will be appreciated.
Thank you in advance.
Obs.: In this particular design I can't change any pin on the microcontroller as is a legacy project and we will not create a new firmware.
Transparent 2D View:
Edit.: Top View:
Bottom View:
Transparent 2D View (no GND polygon):
Top View (no GND polygon):
Bottom View (no GND polygon):
AI: The ground does not look super great and could be continuous, a noncontinuous ground means that the return currents have to go all the way around the traces back to their source which could lead to Common mode voltage problems and EMI issues
Another thing is the VCC traces could be increased in size.
Think of traces is very small resistors you can actually calculate the value of the copper with a tool (like the Saturn PCB tool). You can then take the schematic (maybe a printout) and draw the little resistors in. Then ask yourself if that would be a problem to have that much resistance. But mainly it's the current that's an issue if you have high currents it will cause a voltage drop, 1amp through a 10 milliohm Trace is a 10mV difference in voltage, so go through your design and find some of the higher current areas or areas that might be sensitive to changes in voltage and make sure there won't be any issues with common mode voltages |
H: Why is it that for most Bluetooth audio devices, you can't use them while charging?
Over the past several years, I've had many small Bluetooth devices. I'm not one to buy many of these and, some how, over the years I've been gifted decent "SWAG", portable speakers and they've all had one thing in common--plug it in to charge, and you can't use the speaker.
Last year, I bought a pair of Skull Candy head phones that were Bluetooth. I spare the personal anecdotes, but generally speaking, I don't like wireless headphones so there were the first one's I've owned that weren't super-cheap and made by a "named brand".
To my agitation, I found out that even with these, if I plug them in they turn off. And I mean completely. They disconnect from my paired device (though they don't unpair) and then when I unplug the charger, they re-connect to my PC.
Why is this a thing and so common? Again, I'll spare my personal details and preferences, but this is a large part of why I don't like wireless devices--batteries die at the most inconvenient times, but this could be alleviated as a problem if I could at least plug the device in too charge and use it at the same time. Why is this seemingly not a thing, even with "named brand" devices?
After googling a bit, I see that there are some devices that allow for use and charging, but they are uncommon. I just want to know, why isn't this a thing? It seems like it shouldn't be that difficult to engineer into such a simple device.
AI: I can answer definitively for some cases, because I've been involved in the design of the charging scheme for some of these types of products.
There are different schemes for charging. One charging scheme often called "Power Path" allows for the system to operate during charging even when the battery is very low. This scheme puts a FET (often called BatFET) in between the charger output and the battery. When the battery is low, the FET can go into linear mode and regulate the charge current, yet still allow the system to operate from a higher voltage.
Here's an example of the different architectures from here:
You can see that in the power path scheme if the battery voltage is low, the system can still operate if Q2 drops the voltage between the system load and the battery, while regulating the battery charge current .
The other scheme is direct charging where the battery and system are tied together. When the battery is too low to run the system during charging, the system can't operate. Often, the system is just locked out until charging is complete so the charging current can be properly regulated.
The power path approach needs the additional FET, which has to be a fairly large device. It requires additional complexity, back-gate switching for bi-directional current control, and often higher component count.
A bare-bones direct-connected charger IC is substantially cheaper, so in many cases that's the main reason for choosing that architecture and locking out use of the device while charging. Obviously in some cases there could be other considerations like safety. |
H: What is the function of this pin in this BMS schematic?
I am implementing my own 3-cells battery management system charger based on the BQ76920 but I have a doubt about the REGOUT pin, in the datasheet it says that pin is the output of LDO (Low-Dropout Regulator according to what I read).
In the typical circuit application of the datasheet in the same way, this pin is connected directly to the VCC terminal of a microcontroller MCU. So that makes me think that this pin regulates the voltage between Pack+ with respect to VSS (GND) to supply voltage to the microcontroller? doesn't it?
I am also considering for reference a github project schematic which implements a BMS with the same integrated circuit (IC) but it uses different devices connected to the REGOUT terminal (Note that it connects the REGOUT terminal to SDA and SCL pins with 10 kΩ resistors R2 and R1, and a bridged solder jumper, and also the capacitor C1 to GND in the same way as the above circuit):
Another connection of REGOUT is to a LED D23 as indicator:
REGOUT pin is also connected to ATMEGA328 microcontroller VCC pin (exactly as the typical application of the datasheet) and to the PC6 pin of the ATMEGA with a 10 kΩ resistor R14, what is the purpose of that?
And finally, REGOUT pin is connected to a voltage regulator (I guess), and a CH340G USB to serial converter which is working in 3.3 V according to the configuration mentioned in datasheet.
So basically, the REGOUT pin supplies voltage?
So my final question is: Do I really need the voltage regulator to feed the microcontroller? Or could I only connect the REGOUT terminal to the VCC terminal of my microcontroller?
My schematic is this: (I would connect REGOUT to a female connector to connect a cable to another PCB where the microcontroller is.)
The last question would be: Do I really need the REGOUT pin connected to the SDA and SCL terminals? (Why is needed? if the datasheet does not show it?) Thank you so much!
AI: The functional block diagram of the BQ76920 shows an LDO regulator built into the chip that supplies the REGOUT pin:
The datasheet specifically calls out its purpose:
8.3.1.3.5 Output LDO
An adjustable output voltage regulator LDO is provided as a simple way to provide power to additional
components in the battery pack, such as the host microcontroller or LEDs
This LDO outputs either 2.5 or 3.3V depending on the particular part number of your IC, which is detailed in the device comparison table.
For all intents and purposes, you should treat the output of the REGOUT pin like you would treat an LDO external to the chip. The regulator can only supply between 30 and 45mA per the I_EXTLDO_LIMIT spec in the electrical characteristics section, so as long as whatever you're connecting to the REGOUT pin draws less than 30mA, you should be fine to power your 3.3V (or 2.5V, depending on part number) circuits from this pin instead of an external regulator. Be mindful that the REGOUT net also powers internal circuitry, so even if you don't use it to power external circuits, it still requires an external capacitor.
In some of the schematics you show, the I2C lines (SCL and SDA) are pulled up to the output of the REGOUT pin because I2C lines are open-drain and require pull-ups. You should have pull-ups on your SDA and SCL lines, but whether you put them on the output of REGOUT or another logic-level supply voltage in your design is largely up to you. |
H: VHDL: Counter occasionally does not reset
I'm using ISE Project Navigator 14.7 with a Xilinx XC95144XL-5TQ100C CPLD in conjunction with a LM1881 video sync separator. I've also got a 14.3 MHz clock. I'm trying to generate VSYNC pulses in response to the LM1881 FIELD line changing (and yes, I know the LM1881 also has a VSYNC output; but I'm constrained due to the PCB I'm using which only allows me to view FIELD).
Here is the code I am using to generate the VSYNC signal (I tried to remove non-relevant parts):
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.NUMERIC_STD.ALL;
entity outputGenFromLm1881 is
Port ( clock14_3 : in STD_LOGIC;
lm1881Field : in STD_LOGIC;
vsync2_prime : out STD_LOGIC);
end outputGenFromLm1881;
architecture Behavioral of outputGenFromLm1881 is
constant cyclesPerVsync : natural := 238875;
constant cyclesPerHalfLine : natural := 455;
constant cyclesPerLine : natural := cyclesPerHalfLine*2;
constant cyclesPerVsync2Pulse : natural := ((cyclesPerLine * 11)/2);
-- we need 18 bits for range of vsync plus an extra bit to detect/prevent wrapping back to 0
signal iVsync2Count : std_logic_vector(18 downto 0) := (others => '0');
signal fieldOld : std_logic := '0';
begin
vsync2_prime <= '0' when (unsigned(iVsync2Count) < cyclesPerVsync2Pulse) else '1';
lm1881FieldThink: process(clock14_3)
begin
if (rising_edge(clock14_3)) then
-- if field has changed
if (lm1881Field /= fieldOld) then
iVsync2Count <= (others => '0');
fieldOld <= not fieldOld;
-- we never want to wraparound back to 0 unintentionally
elsif (iVsync2Count(18) = '0') then
iVsync2Count <= std_logic_vector(unsigned(iVsync2Count) + 1);
end if;
end if;
end process lm1881FieldThink;
Most of the time it behaves correctly as shown here:
But occasionally, the counter never resets even though fieldOld is getting changed properly.
There's nothing else that modifies iVsync2Count except this process so I'm thinking somehow the section of the process that increments iVsync2Count is taking precedence over the reset. The trouble is I can't see how this is possible or how to fix it.
Can anyone explain why iVsync2Count sometimes does not get properly reset?
AI: You're using lm1881Field as an input to your state machine. I'm guessing that this input is not synchronized to your 14.3 MHz clock.
In the state machine, this input affects 20 different state bits — 19 in your counter iVsync2Count, plus fieldOld. Each of those bits has logic associated with it that determines that bit's next state. Each of those pieces of logic has a different delay (from the asynchronous input) associated with it.
So, if that input changes state at a "random" time with respect to the clock, there's a chance that some of the bits will see the change, and some will not. This leaves you in an inconsistent state.
This is why all inputs to state machines must be properly synchronized to the state machine clock. |
H: Why is the output voltage 5V when supply voltage is 18V?
I am building a headlight driver circuit for my solar car team at school. The circuit uses transistors to drive the headlights and an 18 V power supply. My HIGH and LOW signal is a 5 V signal and 0 V signal respectively. When I measure the output voltage it reads ~4.2 V, even though the power supply is 18 V. Why are the transistors giving me a voltage drop of nearly 15 V?
simulate this circuit – Schematic created using CircuitLab
(The old schematic below:)
AI: Your bipolar transistor is driving the lamps in a voltage follower fashion, meaning the output voltage can't be higher than the controlling voltage.
The basic rule to turn an NPN bipolar transistor ON (or just bias it) is to have about +0.6V on its base relative to its emitter, meaning the emitter can't go higher than the base potential minus 0.6V, in this case 5V-0.6V=4.4V.
simulate this circuit – Schematic created using CircuitLab
In order to apply the "full" supply voltage, you need to connect the bulb(s) on the opposite end of the transistor, that is, to the collector pin.
In that case, the emitter is connected to ground, and even a 1.0V logic or control voltage can turn the transistor on fully for whatever output/supply voltage (up to the transistor's withstand voltage limit, of course). This type of a circuit is also used in logic level translators due to this fact, as the output can swing from 0V to the full supply voltage.
The collector can now reach almost 0V (almost at the ground level), so if the bulb is connected to the positive end of the battery on one side and to the collector of the transistor on the other side, it will have almost the full 12V across it (let's ignore the voltage drop across the transistor for the sake of simplicity).
Here is the way it's done:
simulate this circuit
The R1 resistor serves to limit the current through the base which acts like a diode (base-emitter diode) and would burn without the resistor. The base-emitter junction stays at about 0.6V or slightly more while the transistor is on.
The collector-emitter junction now acts like a switch, open with no current through the base, and closed (ON) with a sufficient current running through the base.
Because a bipolar transistor has significant voltage drop across it while conducting a significant amount of current, it will dissipate a lot of wasted energy as heat and possibly burn out. At 0.5V across it and a 10A current, that is 5W of wasted energy and heat that needs to be removed from it.
You are also wasting energy to keep the transistor ON via the current running through the base. If you're running 10A through bulbs, you may need 1A through the base, which is not only additional 0.6-1W of heat added to the transistor, but a full 5W of energy needed from the 5V supply.
A much better and more modern solution would be a MOSFET transistor as a switch. It needs practically no current to keep it ON, while having a very small resistance and voltage drop across it.
Here is an example schematic:
simulate this circuit
As you can see, there is a very small voltage drop (a few times smaller than for a bipolar transistor) across a MOSFET when it's turned on. This means there is a few times lower loss and a few times less heat dissipated in a MOSFET.
Additionally, almost no current at the controlling leg (gate) means that basically no energy is needed to keep a MOSFET on.
For example, while you may need from at least about 50mA and up to about 2A of base current for 10A at the output with a bipolar transistor, you would only have a gate leakage current of 0.0002mA (0.2µA or 200nA) in a typical MOSFET at the most. That is less than the self-discharge current of a typical CR2032 3V coin cell!
To put it another way, a 3V coin cell could keep a MOSFET turned on for years, while with a bipolar transistor the same amount of energy would barely last a few hours at best (this could be improved with a "darlington" arrangement, but it would cause higher output losses, and it would still not come close to the MOSFET efficiency).
The included MOSFET model is just an example, you could use one with a lower resistance while on (called RDS(on)) to have an even lower voltage drop across it, or use a logic-level MOSFET which works better when you don't have 7-15V typically used to turn it on.
The only drawback to using a MOSFET is the voltage required to turn it ON needs to be significantly higher than for a bipolar transistor, at least 3-4V though typically 7-10V vs. 0.5-1.0V
You could also use an 8V to 10V regulator (LM7808 to LM7810) to supply the NE555 (which can run at up to 16V at most, but uses more quiescent current with higher supply voltage, unless it's a CMOS version like TLC555 or ICM7555), which would let you use any MOSFET that has the lowest RDS(on).
For the sake of simplicity, I have kept the answer to the most often used and practical examples, but you can also use a PNP bipolar transistor or P-channel MOSFET (the above was an N-channel). |
H: Having trouble understanding textbook explanation of "hot chassis" in full-wave voltage doubler vs half-wave
The textbook explanation is not doing it for me.
The half-wave voltage doubler shown in Fig. 4-27(a) offers some improvement in safety over the full-wave voltage doubler. Compare Figs. 4-24(a) and 4-27(a). The chassis is always hot in the full-wave
doubler. In the half-wave doubler, the chassis is hot only if the connection to the AC outlet is wrong.
Textbook is Electronics Principles and Application, Ninth Edition, by Charles A. Schuler.
Could someone elaborate on how 4-24a is chassis hot but 4-27a is not? Google has not been helpful.
4-24a
4-27a
AI: In 4-27(a), you can see that the ground symbol, by which I am assuming they mean chassis ground, is connected directly to one of the AC inputs, which I am assuming is the neutral one. Neutral is emphatically not ground, though they are bonded together at your service panel so there should only be a volt or two difference between them.
In 4-24(a), the neutral input is connected to the node between C1 and C2. Ground with respect to the load is also assumed to be connected to chassis ground and if C2 is charged then it is at line potential relative to neutral. |
H: How do I make a good frequency multiplier for a basic sound chip? It uses a DAC, so it needs a high input frequency for lower output frequency
I'm building a simple triangle-wave sound chip based around a 4-bit DAC. It works, but I have to have each individual square wave for each of the 16 notes (which are bass-range, 60Hz-238Hz.) I want to have one square-wave source and a set of multipliers for each frequency.
Following is a link to the simulated circuit on Falstad circuit simulator. The text next to the column of CLK tags shows the output frequency of each tag. The inputs on the bottom cause the circuit to output different frequencies from 60Hz (far left) to 238Hz (far right) in increments of about 11.5Hz.
Falstad link
AI: Early sound chips usually worked in a couple different ways.
First way is to have a single large frequency, then divide down by two to get into correct octave, and then divide down with a divisor to get to the correct note, or reasonably close to it. The Philips SAA1009P operated like this, with 8 octaves and range of 256 to 511 as the divisor to get to correct note.
Another way is to have just a phase accumulator, where you increment a counter by some number, and use the high bits of the counter as index to waveform memory, or simply, use it as-is for triangle wave and use the MSB for up/down ramp. This approach was used by the C64 SID chip for example.
So it is easier to just have a high frequency and divide the output down with different methods, than to generate multipliers. If you want 16 specific notes then you could use some sort of look-up table. |
H: Why is this p-channel MOSFET blinker not blinking?
I'm not a professional electronics person, just enthusiastic about it so my knownledge is limited. I first tried this with a n-channel mosfet, and worked well:
But it switches negative, and I need a positive switch, so tried this with a p-channel mosfet but didn't work:
In fact, I need the circuit to be in series between the battery and the bulb, which is grounded.
Requirement: the circuit should blink grounded bulb by turning on/off positive to the bulb, indefinitely until circuit gets its positive feed disconnected. Like a car's turn lights flasher relay... something like this:
UPDATE
So...for the sake of science :) I experimented with this (pmos):
It starts blinking, not a full on/off but about half way (LTspice sim shows 12v then down to 7v, then a new cycle). However on each cycle it blinks less and less until the bulb remains ON.
AI: Your NMOS circuit seems to work just as well with the lamp from source to GND. Here's the simulation (but using 10 uF capacitors to reduce simulation time).
I found that the circuit needs to have power connected quickly, so here is a simulation with 100 uF capacitors, and it starts flashing in about 1 second. |
H: Need help understanding this UART to RS485 adapter circuit
I am trying to understand how this circuit works.
Below is the explanation provided in the manual I am referring to:
"Receiving data: P_TX is in idle state, which is high level, transistor breakover, RE pin of
SP3485 is low to be active. RO pin begins to receive data from 485AB port.
Sending data: P_TX will get a pull-down level, toggle that sending data. Transistor cut
off, DE pin is high to enable sending. In sending states, if the data sent is “1”,
transistor will turn to breakover which looks like Receiving states, however, the chip is
in high impedance sate, data “1” will still be sending instead of changing to
receiving"
Link to the user manual:
https://www.waveshare.com/w/upload/2/29/RS485-CAN-HAT-user-manuakl-en.pdf
Page 7
I would be great if someone can help me understand this circuit.
AI: The explanation is bad and needs a lot of interpretation. However, here is what it tries to say. Please be aware that English is not my native language, though. ;-)
Receiving data:
If P_TX is in the idle state, which is the high level, the transistor conducts producing a low level on RE and DE. This means that the receiver part is enabled (RE = receiver enable, active low) and the driver part is disabled (DE = driver enable, active high). The RO pin produces data as received from the RS485 bus via A and B.
Sending data:
For bits of "0", P_TX is low and the transistor switches off producing a high level on RE and DE. This means that the receiver part is disabled and the driver part is enabled. For bits of "1", P_TX is high and the RS485 bus is not driven, as while receiving. The resistors R1, R9, and R10 put the bus in the "1" state, given that no external component changes this.
Conclusion:
Situation
P_TX
Receiver
Driver
Bit on RS485 bus
RO
Bus idle
1 (high)
enabled
disabled
"1" (via resistors)
1 (high)
Receiving "0"
1 (high)
enabled
disabled
"0" (actively)
0 (low)
Receiving "1"
1 (high)
enabled
disabled
"1" (via resistors or actively by another component)
1 (high)
Sending "1", other components are idle
1 (high)
enabled
disabled
"1" (via resistors)
1 (high)
Sending "1", any other component sends "0"
1 (high)
enabled
disabled
"0" (actively)
0 (low)
Sending "0"
0 (low)
disabled
enabled
"0" (actively)
undefined (high impedance)
As shown in the schematic, this circuit is apparently not a real UART-to-RS485 adapter. It does not send the "1" bits actively, but by the provided pull-up and pull-down resistors.
This has at least the disadvantage that depending on the other components on the RS485 bus, "1" bits can be disturbed or overwritten.
However, the advantages are:
The UART part does not need to control the DE and RE pins separately.
This adapter can be used in CAN networks, which expect "1" bits to recessive. Only "0" bits are dominant.
Note: Commonly a CAN module expects to receive the bits from the bus also during sending. For this to happen with this adapter, only DE shall be driven by P_TX. RE shall be enabled (low) all the time.
The working of the adapter can be changed by using other combinations of the resistors R8, R11, R12, and R13. |
H: SMD components and PIC microcontroller
I'am working on a digital clock project with a PIC16F877. I'm designing the PCB with Proteus. The PCB contains mostly SMD components and I don't have any experience with that so I have some questions:
Do SMD components work the same as through-hole components? Should I use the same type of copper plates and everything?
For the PIC microcontroller, do I need to add a crystal to the circuit or does it have an internal crystal?
Do SMD components have any space between them and the plate for the traces to go in between (like through-hole ones)?
Where do I connect the 5 V input on the PIC? I am using a 12V adaptor as power source and I'm decreasing the voltage with 7805.
AI: 1- Do SMD components work the same as through-hole components? Should I use the same type of copper plates and everything?
SMD components work same as TH components, but, there is some difference. We use SMD components to reduce the area of them. Also, power of an SMD resistor, breakdown voltage of an SMD capacitor etc. can be changeable, you must reach them from datasheets or something else. Some THT components can be hard to find in SMD type. For example, high capacitance electrolytic capacitors.
2- For the PIC microcontroller, do I need to add a crystal to the circuit or does it have an internal crystal?
Some of the microcontrollers may have an internal oscillator, but an oscillator can be connected externally. The datasheet of the microcontroller used should be examined. When using a microcontroller with an internal oscillator with an external oscillator, programming changes may be necessary.
3- Do SMD components have any space between them and the plate for the traces to go in between (like through-hole ones)?
Pads are used in SMDs, while pads with vias are used in TH so that soldering can be done on the PCB.
4- Where do I connect the 5 V input on the PIC? I am using a 12V adaptor as power source and I'm decreasing the voltage with 7805.
After reducing the voltage to 5V with your regulator, you should connect the output of regulator to the microcontroller's VCC pin. |
H: Class AB Amp slight distortion at any level
I wanted to build an amplifier for a spare set of 4 ohm 20W speakers I have laying around. After three days of searching circuits on the internet and trying them out on a breadboard not having much knowledge in amplifiers, I've finally managed to piece together this circuit that actually amplifies the signal instead of doing nothing. The problem that I'm having is, there's a slight amount of distortion at any input amplitude. RV1 has been tuned to drive the opamp just enough to 0V before the output starts clipping, directly hooking the inverting input up to 0V distorts the audio like crazy. Not having and oscilloscope and only a cheap multipeter how would I go about improving this circuit?
Changing R1 and R2 to something lower makes the problem worse, to something higher and nothing happens, above 10k and the amplification fades away signifficantly. And the LM358 is the only op-amp I have
The reason why I used MOSFETS is because I've had them laying around and nothing else.
And yes the power source is sketchy atm but that'll be changed out for a proper power source once the circuit is finalised and works without distorting.
AI: Q2 is upside down (S and D are reversed): -
You should also use a 2.2 kΩ pull-down resistor on pin 2 of U1A to 0 volts and use non-polarized 10 μF decoupling capacitors. The 100 uF electrolytic will act like a diode when Q2 is conducting so change it to 10 μF non-polarized.
And, given that you say that Q2 is connected up correctly and that only the schematic is wrong, you will need to increase the bias across the LEDs more than likely to something like 3 volts for each. This is based on the transfer characteristic graph in the IRF540N data sheet: -
This is the gate-source voltage that just about causes the MOSFET to begin linear conduction. Around 2 volts the MOSFET will be relying on the negative feedback of the op-amp to jump over the hump of cross-over distortion and, given that the op-amp you have used is fairly slow, you will get distortion if the biasing is much below 2.5 volts. Start with 2.5 volts is my recommendation.
You might also try a 330 Ω resistor from the op-amp output to the speaker output to allow the op-amp to handle the low power signals feeding the speaker. This will linearize things too. It's quite a common-practice.
If you are using red, green or yellow LEDs, they will only produce a forward drop of about 2 volts and, that is a little low. I'd say aim for 2.5 volts. |
H: Driving high-side MOSFET with another voltage source
I am trying to create a negative voltage source with a high-side MOSFET using another voltage source which is 4 V higher than the MOSFET's drain voltage.
In the schematic Q3's drain has 12 V and gate sees 16 V pulses. In this design, is 16 V enough for driving Q3 or will it need a higher voltage on the gate?
Feedback is going to an MCU and I used a voltage divider. In the worst case the feedback sees 12 V which is too much for feeding back to the MCU and in the best case feedback sees 1.09 V. Is there a better way to return feedback to the MCU from a negative voltage source?
AI: Sadly, 16V is not high enough, but neither is 0V low enough for Q3's gate.
Q1 is supposed to drive Q3's gate high, but its base-emitter junction drops 0.7V (it's operating as an emitter follower, don't forget), leaving only 15.3V at the gate, for \$V_{GS} = 3.3V\$. Q3 could require \$V_{GS}=4V\$ to just begin switching on. To switch it on and pass significant channel current (without dropping significant voltage between drain and source), I expect you'll need much more than 16V at its gate.
Fig. 1 on page 3 of this datsheet shows you what voltage \$V_{DS}\$ you can expected the channel to have at various \$V_{GS}\$ and channel currents. For instance, looking at the curve for \$V_{GS}=4.5V\$, you can see that at 3A channel current, you lose 0.4V. I think you should be aiming for \$V_{GS}=6V\$ at least for this application, which implies a gate potential of 18V.
The worst issue you will face is that by using an N-channel MOSFET high-side, you are operating it common-drain, as a source follower, whose source is never further than 4V below the gate; \$V_S = V_G-4V\$. You bring the gate down to +0.7V (not 0V, again because Q2 is an emitter follower), and Q3's source gets clamped to a minimum of -3.3V. This is bad, since the source (cathode of D1) must be free to swing to -12V in order to charge C1.
You must therefore drive Q3's gate with potentials +18V and -8V or so, which is quite the dilemma. The NMOS solution in the answer by "Kuba hasn't forgotten Monica" can be simulated; watch how gate potential swings between these extremes. The easiest solution to both of these problems is to use a P-channel device, which you can switch with 0.7V and +11.3V.
Update: I made it sound like PMOS answers all the problems, but be aware that in this setup it's easy to get \$V_{GS}\$ to exceed ±20V, which is a common maximum for many MOSFETS. Either make sure you use a device which can handle ±24V between gate and source, or take measures to protect that gate. |
H: How did my CO detector know it had reached EOL?
I was recently awakened by my CO alarm beeping. I take CO exposure very seriously and attended to the beeping immediately. It was not a CO concentration alarm, but rather an end of life alarm indicating that it needed to be replaced. Note that there is a different alarm for a malfunction, which also requires replacement.
Let me state up front that I have no desire whatsoever to defeat this warning. In fact, I promptly ordered a new one and then proceeded to take apart the old one. Others have done a breakdown of one similar to mine.
The sensor is a TGS5042. I went through an app note.
My unit included a date [m/d/y] and it was nearly 8 years ago – generally in the window for how long these sensors last. It looks like the EOL alarm worked and I am happy that.
How did the circuit know that the sensor was too old?
Certainly it is unlikely that there is any kind of clock/calendar involved - that seems unlikely to me. It also seems unlikely to me that operating time could be collected and used reliably because the sensor life may not be dependent on operating time – e.g., a 25 year old sensor that has operated for 30 days only.
The sensor has an analog output proportional to CO concentration, but CO concentration should be zero or near zero in a normal indoor environment. Is some baseline property of the sensor checked for a signal that is too weak or something similar? How could that characteristic be distinguished from a malfunction?
AI: Pages 7-9 of the linked app note describe a self test procedure that the device using the sensor should repeat periodically.
Based on the results of the test, the device can determine if the sensor is still usable or not. There's a certain voltage range that the sensor output should reach at the end of the test. If it is outside that range, then the sensor would be deemed end of life.
While there will have to be a timer of some kind involved because the self test has to be repeated periodically, I wouldn't expect the timer to the only criteria because the gel in the sensor will dry out over time regardless of whether or not it is in use. |
H: Transistor not totally acting like a switch
I have made two different circuits that, to my knowledge, should give the same result if the transistor is acting like a switch.
The current "passes" through the first switch/transistor and "passes" through the last switch/transistor before going to ground.
Circuit with switches:
Circuit with transistors:
I am not getting the same voltage going across the resistors.
I am under the impression that it has something to do with the battery powering the transistors, but I am not sure how to fix it.
AI: This is the circuit you have (leaving out the transistors that aren't being driven)
simulate this circuit – Schematic created using CircuitLab
Look at the biasing for Q1. 3.3 V goes through R1 and into the base, the emitter then has two 1k resistors and another transistor between it and ground, so the base voltage will have to be higher than the voltage drops across those. What would happen if the voltage across the two resistors was 12 V like in the mechanical switch version? The base of Q1 would need to be at 12 V + 0.7 V + Q2's Vce. You're not going to get that out of the 3.0 V battery. What you'll get is roughly 3.0 V - 0.7 V = 2.3 V, which is what you're showing.
So while Q2 is getting fully switched on, Q1 is not.
One thing you could try is change Q1 to a PNP transistor with it's emitter to +12 V and add an inverting driver something like this: |
H: Equation relating alternating magnetic field strength to induced voltage in search coil
I have a search coil (loop area A, N turns) placed normal to an alternating magnetic field with equation B(t)=Bp.sin(2.pi.f.t), B=field strength at time t, Bp=peak field strength, f=frequency, t=time. What is the equation to find the induced voltage in the search coil?
How would this change if the coil was at an angle to the normal?
Thanks!
AI: I have a search coil (loop area A, N turns) placed normal to an
alternating magnetic field (strength B, frequency f), what is the
equation to find the induced voltage in the search coil?
Assuming that the magnetic field flux density (\$B\$) is constant across the aperture of the search coil, you can calculate the the total flux entering the aperture of the search coil by multiplying \$B_{peak}\$ by the area of the search coil. This converts teslas to webers.
Then, given that the frequency is \$f\$, this defines the peak value of \$\frac{d\phi}{dt}\$ (assuming a sinewave).
It's then a simple matter of multiplying by the number of turns (\$N\$) to get the peak voltage. Assuming the applied field is sinusoidal, the RMS voltage is easily found.
How would this change if the coil was at an angle to the normal?
Multiply the number derived from what I said above by \$\cos(\theta)\$ (where \$\theta\$ is the angle of the coil). In other words, an angle of \$\theta\$ less than 90 ° reduces the effective area of the coil to zero when at 0 °. |
H: Is there any voltage regulation on this board from an Apple Trackpad teardown?
Board:
Teardown, with brief descriptions of the major chips below:
Red: Broadcom BCM2042 for Bluetooth connectivity
Orange: Broadcom BCM5974 touch screen controller chip
Yellow: SST 25WF020 provides 2 Mbit of serial flash memory
Blue: TI CD3238 RS232 line driver/receiver.
Context: I have an Apple Magic Trackpad, the old version. It is modified for improved ergonomics. It also eats batteries (like 2 AAs per week). I want to just plug it in instead of dealing with batteries.
I have connected the trackpad to an AA-shaped power adapter, which is directly connected to a USB plug. Obviously the trackpad expects 3v, and USB supplies 5v. Do I need to put a voltage regulator or other step-down solution in between the trackpad and the plug? Or is the board already doing something that addresses this? I started looking up some of the chips, but have not yet found a definitive answer, and I hoped someone here would be able to tell at a glance.
For example, according to this, "A key component enabling the BCM2042 to reach extremely low system cost is the inclusion of a high-performance boost regulator. This enables direct connect with mouse electronics requiring 3-volt operation without
adding expensive external components".
Yes, there may be something wrong with this device, it didn't always eat batteries like this. Yes, I could buy a new one, designed to be charged via USB. This would be more expensive, and slower (due to needing to re-design the ergonomic mod for a new form factor). Even if I need to adjust the voltage, this is still the fastest, most convenient solution for me.
AI: Yes; circled in red below.
At least three, including one most likely onboard the Broadcom chip, as you note.
Regulators are fairly easy to spot as they are almost always paired with inductors -- these are most likely switching regulators. What are not so easy to spot are LDOs (which have lower efficiency, but no inductor is required), charge pumps (switching but using capacitors only, usually to make rough voltages; or in combination with an LDO externally, internally, or in effect, for regulated outputs at modest efficiency), or integrated modules (very high frequency regulators are available these days which integrate the inductor in-package, or indeed even on-chip).
Whether this means anything with respect to input or output voltage or current ratings is another matter entirely.
As Andy aka commented, this may not be very useful without complete schematics. I don't know about this device in particular, but Apple in general is notorious for using proprietary variations of commercially available chips. You may not be able to identify all components on the board, even if you're willing to trace the circuit and reconstruct the schematic, at least in relevant part (such as around the power-input section so you can figure out the ratings). Or if you can, datasheets may not be available. It is a complex design, almost certainly multilayer, and I don't know how many components are on the backside. While it can be reverse-engineered, it will take very many more hours than the equivalent value of buying a new one. |
H: How does this siren circuit work?
I am a beginner studying electronics and I have recently learned about the 555 timer. My course includes the following circuit diagram:
The goal of this circuit is to have the speaker produce a siren sound, however, I don't understand how the second 555 accomplishes this.
I understand that the output of the first 555 will be fed into the Resistor/Capacitor pair. When the pulse goes HIGH, the capacitor will be charged and once the timer flips, the capacitor will be discharged, which will cause the pulses to look like this.
This output is then fed into pin 5 on the second 555. This is the part that I don't understand. What exactly does the second 555 do, that makes the speaker produce a siren sound?
Thank you in advance.
AI: Pin 5 of the 555 is the CONTROL pin and is normally held at 2/3 VCC with a resistor divider network internal to the chip. The timing capacitors C1 and C4 charge through R1 and R2 or R4 and R5 respectively, which makes the voltage at pin 6 (THRESHOLD) and pin 2 (TRIGGER) rise. When THRESHOLD rises above the voltage on CONTROL, pin 7 (DISCHARGE) shorts the timing capacitor to ground through R1 or R5, respectively and pulls pin 3 (OUTPUT) low. When TRIGGER falls below 1/3 VCC, OUTPUT is pulled high and DISCHARGE stops shorting the timing capacitor, allowing the cycle to continue.
On the left-hand 555, OUTPUT is used to slowly charge and discharge C2 through R3. This voltage is applied to the CONTROL pin of the right-hand 555 which overrides the internally generated CONTROL voltage and changes the voltages at which TRIGGER and THRESHOLD cause the timer to start and stop its timing cycle. And, since R4/R5/C4 are still being supplied from +V, this changes the frequency of the output. |
H: Which is the correct way to connect the gate and pull down resistors?
There are two forms of connecting this two resistors
If in both cases Rg=1k and Rpd=10k which connection is better?
I mean, i know that in the first connection there is a voltage divider so Vin!=Vgs and in the second connection Vin=Vgs.
In the first connection there is a Rt=11k and in the second it s a Rt=10k, so yeah the first one is a little bit more efficient
Now, imaging the driver is not an MCU and it is a mechanical switch, the first connection discharges a little bit faster than the second.
But the second one is more efficient in terms that there are no voltage divider and Vin=Vgs
I know if Rpd=100k in the first connection we also can say that Vgs= =.99Vin.
So which is the best connection?
I think that for "normal switching" like turning on/off an AC motor once per hour the second one is better, but for fast switching applications or "hard" PWM the first one is better because it reduces a little bit the switching frequencies; is that ok?
Or is it there something else to consider (a.k.a ringing) that determines which is better?
Thanks for your time.
AI: As so often, the answer "what is correct" depends on the circumstances.
If you need 'equal' switch on/off times you would prefer (b) as the GPIO can be seen as 'GND' too. The pulldown is just during RESET - when the GPIO is High-Z.
If you want fast switch on/off times you also use (b) - your voltage divider also slows the switch on edge.
If you need fast switch off times in case GPIO goes HIGH-Z you use (a) as the Gate-GND resistance is smaller.
And the list goes on ...
If you are doing a simple switch ... just don't care. Both ways work, both have their pro's and con's - you don't care.
In case you need a "pro" zou will have to take the "con".
In short
If you don't need to know: don't care
If you need to know: simulate |
H: Equivalent electrical circuit changing and power balance calculation
I tried to change this circuit in three different ways, but the power balance is not the same. The least power balance that I got was ~50 W more and we need to find the balance between 0 and 5 W. Ignore the number 16 in the picture; it is the variant number. I would really appreciate the help.
U=100 V;
R1=7,6 Ω;
R2=6 Ω;
R3=8 Ω;
R4=12 Ω;
R5=10 Ω;
R6=7 Ω;
R7=7 Ω.
AI: Find your coloured pencils or felt-tip pens or crayons and, superimpose a coloured line on the node that is to the left of R2. Then, in a different colour mark the node on the right of R2. Then, do you see that R2, R3 and R4 are all in parallel.
Redraw and simplify.
Does this help?
EDIT - The OP's struggling so here's what I aid above as a picture: - |
H: What is the simplest way to adjust the input voltage for a linear regulator?
I have a garage door opener for which I need to replace the radio receiver. The opener outputs a DC supply voltage for a receiver at 34 VDC. The receiver has an input range specification of 12-24 V AC/DC.
I'm attaching a photo of the receiver's input stage below. It consists of an MB6S bridge rectifier and a 78L05 (SOT-98) linear regulator with 5 V output.
According to the datasheets I could find for the 78L05 it has an input-voltage range of 7-20 V with 30 V absolute maximum. It has 220 uF/50 V input and output filter caps and apparently a 51 R series input resistor. The receiver has a specified input current of < 10 mA.
What would be the simplest modification or addition to the receiver's input that would make it compatible with the 34 V supply voltage?
AI: I would cut the trace after the MB6S's positive terminal and replace it with a 15V zener, like this:
This way, the input cap will 'see' around 19V, which would be in spec. |
H: 24 V input, three 5 V outputs DC-DC buck converter design
I would like to make a DC-DC buck converter which has 24 V input and three 5 V outputs, but a typical buck converter circuits have only one output. How to change it to three outputs without an extra chip? Is it even possible?
AI: Hmmmh you are up for a ride here!
(1) In general it is possible to build a 'Single-Input, Triple-Output' DC/DC.
But without any IC - if you see at least FETs and their driving circuits as ICs - it will only be possible with 'extreme engineering'.
(2) Judging from your question - be aware: mis-interpretation can happen - i would say: You are best off with using of-the-shelf parts.
I had a quick look at my favourite suppliers Digikey DC/DCs and Mouser DC/DCs. I guess you could use e.g. three of these Single 24V/5V 5W DC/DC in parallel - so one for each of your 5V Rails. |
H: Finding Ve for a 3 input AND gate TTL circuit for different logic combinations
I'm designing a circuit that takes 3 24V input signals and pulls a 50 ohm resistor to ground when all three signals are high. My main concern is the voltages across different pins of the transistors for different logic combinations.
The circuit is designed such that when HIGH input received on all 3 transistors, the transistors act as a closed switch, pulling the 50 ohm resistor to ground. The Calculations I have done for this circuit tells me it should work as intended.
My concern is that when the first transistor is in cut-off mode (acting as an open switch), anything but a HIGH HIGH signal on the other two bases causes Voltage from the base to the emitter of first transistor to be high in magnitude and negative on circuit sims. I'm unsure how to calculate this value.
Additionally, when all signals are LOW, how is Ve calculated for the first two transistors. From my understanding, the circuit is open therefore there should be no connection from collector to emitter, however the emitter voltage seems to depend on the collector voltage.
I apologise if there is something obvious I'm missing.
AI: While this stacked arrangement of bipolar transistors is often taught to be an implementation of AND, it's fraught with problems, not the least of which is reverse-biased base-emitter junctions.
Base-emitter junctions behave like zener diodes, with reverse breakdown voltages as low as 5V. That junction begins to conduct when the base tries to drop lower than 5V below the emitter, and clamps the difference at 5V. In your circuit, if you raise the second input potential, the result is a current path shown in red here:
simulate this circuit – Schematic created using CircuitLab
That may or may not be problematic, but it's certainly not desired behaviour.
Another issue you face is what happens when you take inputs above 12V:
simulate this circuit
The base-collector junction is just another diode, conducting freely when that junction is forward biased. Here you see significant current flowing the wrong way through the load, which may not be enough to activate a relay, but it's not ideal.
Another problem is the stacking of collector-emitter voltage drops when they are all on. \$V_{CE}\$ can be many tenths of a volt (depending on the transistor model), when passing a lot of collector current. They all add up, reducing the voltage available for the load:
simulate this circuit
All these problems are easy to resolve. Here we use diodes D1, D2 and D3, and resistor R1, in a "Diode-AND" arrangement:
simulate this circuit
Node X is held high by R1, unless any of the inputs A, B or C are brought low. Then one or more of the diodes become forward biased, pulling X low. The forward voltage of those diodes prevent X from falling below the transistor's own base threshold, so we use D4 and D5 to raise the voltage required at X to switch on the transistor.
In your circuit, and mine above, we rely on the the gain of a single transistor to drive the load, but even with a gain of 100 or so, it requires significant current (tens of milliamps) from the inputs. Your 1kΩ input resistors dissipate more than 500mW, and would have to be quite beefy. These inconveniences can be mitigated with an additional transistor:
simulate this circuit
R1 has increased ten-fold, requiring input sources to sink only a milliamp or two. Q1 will sink about 10mA from Q2's base, and Q2 will be able to provide up to 1A to its load, if ever you needed that. Everything is much less stressed. The only other significant change is that the load is now low-side.
In both these last two designs, inputs can be 24V without upsetting anything, but anything above 0.7V will be considered "high". |
H: What happens to GPIO pins that are not exposed in a (small) package?
In one of our projects, we use an STM32L071 MCU in an LQFP48 package. It exposes GPIO port pins PA0 to PA15, PB0 to PB15 and PC13 to PC15 on the pins of the package.
The LQFP48 package doesn't expose GPIO port pins PC0 to PC12. But I can still program these pins; they are available in the GPIO registers. These pins are exposed when, for instance, using an LQFP64 package.
How are these non-exposed GPIO pins connected internally in the package? Is their 'hardware' present in the die of the MCU or are the GPIO registers not connected to anything?
I would expect that they use the same die for several packages to limit the amount of different dies they have to make or is each die made for a specific package?
If non-exposed GPIO pins are not initialised, they default to 'analog mode', so the input Schmitt-trigger is disabled. This prevents additional sleep current for these 'floating' pins.
AI: You are likely correct when assuming the same die is used in different packages. The die pins are just not connected to anywhere, just like when you have a MCU package pin that has no connection on a PCB. To the best assumption is that the pins are there but just floating.
The default state for STM32 IO port is an analog input. It won't be a digital input unless initialized. So floating pins do not cause problems. You can also configure them as outputs or inputs with a pull-up or pull-down resistor, but leaving them as analog inputs is fine too. The worst is to confgure them as digital inputs with no pull-up or pull-down. |
H: Does the capacitance of a Schottky diode depend on switching frequency?
In datasheets they write '1 MHz' in the capacitance vs voltage figures. For example:
I suppose it is some sort of a standard to measure the capacitance at 1 MHz, but is there a dependence of the capacitance on the frequency or is it just the dependence on the reverse voltage?
AI: The supplier has to measure capacitance using an oscillator and, that oscillator has to use a certain frequency. Given that a nominal value of 30 pF at 1 MHz implies a capacitive reactance of 5305 Ω, it's a fairly easy thing to measure.
For instance, if 1 kHz were used, the reactive impedance would be over 5 MΩ and, simple measurement techniques would be susceptible to diode leakage currents (these are quite high on Schottky diodes).
So, in a nutshell, stating the frequency as being 1 MHz is a means of giving confidence in the measurement method because you wouldn't want to use a frequency ten times lower (or worse) because of "other effects" such as leakage current.
I don't think there are any significant effects on capacitance related to frequency but, the higher you go (up to a certain point where transmission-lines effects take place), the more accurate the measurement is. |
H: avr-gcc optimization deleting register writes on ATTiny402
I'm using avr-gcc (12.1.0, built with this script: https://github.com/ZakKemble/avr-gcc-build) to compile for the ATtiny402 and encountering problems with code optimization. Specifically, the compiler appears to be 'optimizing out' repeated writes to register variables, in some circumstances. So, if I compile this with -Os (required for timing functionality, apparently, as well as for avoiding huge binaries), it doesn't work (i.e. the pin output does not change as expected):
void led (uint8_t status)
{
if (status)
PORTA.OUTSET |= PIN6_bm;
else
PORTA.OUTCLR |= PIN6_bm;
}
int main ()
{
PORTA.DIRSET |= PIN6_bm;
led (0);
_delay_ms (1000);
led (1);
_delay_ms (100);
led (0);
_delay_ms (100);
led (1);
_delay_ms (100);
led (0);
_delay_ms (100);
led (1);
_delay_ms (100);
led (0);
return 0;
}
The pin output goes high, but does not go low afterwards. The above does work if I turn off gcc optimization.
The following works just fine, both with and without optimization:
int main ()
{
PORTA.DIRSET |= PIN6_bm;
PORTA.OUTCLR |= PIN6_bm;
_delay_ms (1000);
PORTA.OUTSET |= PIN6_bm;
_delay_ms (100);
PORTA.OUTCLR |= PIN6_bm;
_delay_ms (100);
PORTA.OUTSET |= PIN6_bm;
_delay_ms (100);
PORTA.OUTCLR |= PIN6_bm;
_delay_ms (100);
PORTA.OUTSET |= PIN6_bm;
_delay_ms (100);
PORTA.OUTCLR |= PIN6_bm;
return 0;
}
I've taken a (very quick) look at the generated assembly language, and it does look like this is an optimization feature (it seems to have created two different versions of the led function).
I can avoid the problem by applying #pragma directives to the function, but it feels 'messy' and I would very much like to understand what's happening here.
I'm not sure this is the best place to post this, as it's a compiler issue rather than hardware, but I'm hoping that somebody here might have seen this before.
EDIT to add excerpt of generated assembly language (optimized):
_Z3ledh.part.0:
/* prologue: function */
/* outgoing args size = 0 */
/* frame size = 0 */
/* stack size = 0 */
.L__stack_usage = 0
ldi r30,0
ldi r31,lo8(4)
ldd r24,Z+5
ori r24,lo8(64)
std Z+5,r24
/* epilogue start */
ret
.size _Z3ledh.part.0, .-_Z3ledh.part.0
...
_Z3ledh:
/* prologue: function */
/* outgoing args size = 0 */
/* frame size = 0 */
/* stack size = 0 */
.L__stack_usage = 0
tst r24
breq .L6
rcall _Z3ledh.part.0
ret
.L6:
lds r24,1030
ori r24,lo8(64)
sts 1030,r24
/* epilogue start */
ret
...
main:
/* prologue: function */
/* outgoing args size = 0 */
/* frame size = 0 */
/* stack size = 0 */
.L__stack_usage = 0
lds r24,1025
ori r24,lo8(64)
sts 1025,r24
ldi r24,0
rcall _Z3ledh
ldi r18,lo8(3199999)
ldi r24,hi8(3199999)
ldi r25,hlo8(3199999)
1: subi r18,1
sbci r24,0
sbci r25,0
brne 1b
rjmp .
nop
rcall _Z3ledh.part.0
ldi r18,lo8(319999)
ldi r24,hi8(319999)
ldi r25,hlo8(319999)
1: subi r18,1
sbci r24,0
sbci r25,0
brne 1b
rjmp .
EDIT: the following is the entire assembly generated for the original, non-working example:
.file "flashing-led.cpp"
__SP_H__ = 0x3e
__SP_L__ = 0x3d
__SREG__ = 0x3f
__CCP__ = 0x34
__tmp_reg__ = 0
__zero_reg__ = 1
.text
.type _Z3ledh.part.0, @function
_Z3ledh.part.0:
/* prologue: function */
/* outgoing args size = 0 */
/* frame size = 0 */
/* stack size = 0 */
.L__stack_usage = 0
ldi r30,0
ldi r31,lo8(4)
ldd r24,Z+5
ori r24,lo8(64)
std Z+5,r24
/* epilogue start */
ret
.size _Z3ledh.part.0, .-_Z3ledh.part.0
.global _Znwj
.type _Znwj, @function
_Znwj:
/* prologue: function */
/* outgoing args size = 0 */
/* frame size = 0 */
/* stack size = 0 */
.L__stack_usage = 0
rcall malloc
/* epilogue start */
ret
.size _Znwj, .-_Znwj
.global _ZdlPv
.type _ZdlPv, @function
_ZdlPv:
/* prologue: function */
/* outgoing args size = 0 */
/* frame size = 0 */
/* stack size = 0 */
.L__stack_usage = 0
rcall free
/* epilogue start */
ret
.size _ZdlPv, .-_ZdlPv
.global _ZdlPvj
.type _ZdlPvj, @function
_ZdlPvj:
/* prologue: function */
/* outgoing args size = 0 */
/* frame size = 0 */
/* stack size = 0 */
.L__stack_usage = 0
rcall free
/* epilogue start */
ret
.size _ZdlPvj, .-_ZdlPvj
.global _Z3ledh
.type _Z3ledh, @function
_Z3ledh:
/* prologue: function */
/* outgoing args size = 0 */
/* frame size = 0 */
/* stack size = 0 */
.L__stack_usage = 0
tst r24
breq .L6
rcall _Z3ledh.part.0
ret
.L6:
lds r24,1030
ori r24,lo8(64)
sts 1030,r24
/* epilogue start */
ret
.size _Z3ledh, .-_Z3ledh
.section .text.startup,"ax",@progbits
.global main
.type main, @function
main:
/* prologue: function */
/* outgoing args size = 0 */
/* frame size = 0 */
/* stack size = 0 */
.L__stack_usage = 0
ldi r30,0
ldi r31,lo8(4)
ldd r24,Z+1
ori r24,lo8(64)
std Z+1,r24
ldi r24,0
rcall _Z3ledh
ldi r18,lo8(3199999)
ldi r24,hi8(3199999)
ldi r25,hlo8(3199999)
1: subi r18,1
sbci r24,0
sbci r25,0
brne 1b
rjmp .
nop
rcall _Z3ledh.part.0
ldi r18,lo8(319999)
ldi r24,hi8(319999)
ldi r25,hlo8(319999)
1: subi r18,1
sbci r24,0
sbci r25,0
brne 1b
rjmp .
nop
ldi r24,0
rcall _Z3ledh
ldi r18,lo8(319999)
ldi r24,hi8(319999)
ldi r25,hlo8(319999)
1: subi r18,1
sbci r24,0
sbci r25,0
brne 1b
rjmp .
nop
rcall _Z3ledh.part.0
ldi r18,lo8(319999)
ldi r24,hi8(319999)
ldi r25,hlo8(319999)
1: subi r18,1
sbci r24,0
sbci r25,0
brne 1b
rjmp .
nop
ldi r24,0
rcall _Z3ledh
ldi r18,lo8(319999)
ldi r24,hi8(319999)
ldi r25,hlo8(319999)
1: subi r18,1
sbci r24,0
sbci r25,0
brne 1b
rjmp .
nop
rcall _Z3ledh.part.0
ldi r18,lo8(319999)
ldi r24,hi8(319999)
ldi r25,hlo8(319999)
1: subi r18,1
sbci r24,0
sbci r25,0
brne 1b
rjmp .
nop
ldi r24,0
rcall _Z3ledh
ldi r24,0
ldi r25,0
/* epilogue start */
ret
.size main, .-main
.ident "GCC: (GNU) 12.1.0"
AI: While having no idea why the code presented shouldn't work,
led(uint8_t status) should look
void led (uint8_t status)
{
if (status)
PORTA.OUTSET = PIN6_bm;
else
PORTA.OUTCLR = PIN6_bm;
}
to take advantage of those separate SET&CLR addresses. |
H: Is AM29F040B CMOS EEPROM TTL Compatible
I can't really make any sense of the datasheet regarding whether the AM29F040B EEPROM can be used with TTL inputs, so wanted to ask on here.
It is a 5V CMOS IC, but there are mentions in the datasheet on page 20 (AM29F040B Datasheet). There are two tables showing TTL/NMOS compatibility and CMOS compatibility, but they don't mention different part number which I do not understand. Other EEPROM ICs that I have worked with (like the AT28C64B make it obvious it is TTL compatible and show one table with the pin min and max voltage ranges. How should I interpret a datasheet like this, and is this EEPROM TTL compatible?
The address lines and the I/O lines of this EEPROM will be driven/read from TTL IC
AI: It's certainly odd to have two tables for DC characteristics, but note that most of the entries are the same in both. I suspect that they did this to show that the part meets the requirements of both kinds of interface, expressed in terms that are conventionally used to describe each one.
Bottom line is yes, it's TTL-compatible. |
H: Proteus Ares traces do not connect
I am trying to connect a Vcc pin to a power source in Proteus Ares, but it does not let me do anything different from what I designed in Schematic Capture.
How can I connect the selected trace to the Vcc pin? I could try and connect the Vcc pin in the schematic first but the problem is that in the schematic version the Vcc and GND pins are hidden.
AI: In case anyone else has the same problem, I'm sharing my solution. So apperently if you double click the PIC Microcontroller, you can see Hidden Pins and you can type the pins you want to connect. That way PCB lets you draw the needed tracks. Here you can see, I connected VDD - VCC and VSS - GND.(VCC and GND pins are output pins of a LM317 circuit) |
H: Cockcroft–Walton generator "charging" cycles
I am studying the Cockcroft–Walton generator and one question comes to mind.
Let's say we have a load consuming every watts the generator can provide.
Would it be wrong to state that the generator would need to disconnect it's output from the load and wait n AC cycles to be able to generate the same voltage again , where n is the number of stage(s) in the generator ?
Ex:
Voltage source AC : [-3V, +3V]
CW Module 1 Output : [6V]
CW Module 2 Output : [12V]
CW Module 3 Output : [24V]
We see here that it takes 3 AC cycles to go from [3V] to [24] volts.
If a load then consume all this power stored in the CWMs capacitors in an instant, for the generator to be able to "charge" up to 24 volts again, it would need to wait for 3 more AC cycles, correct ?
AI: If the load is rapidly being removed and applied, then yes, the output voltage would vary. As the rate of output voltage growth is finite, it would take several cycles to regain its peak voltage, to replenish the energy, the charge (not the power) stored in its capacitors.
However, that's not how we would usually use a CW multiplier. The load would tend to be steady. Each input cycle, some charge would be transferred from stage to stage to meet the output current demand.
It's not clear where you get your 'per stage' figures from, but if the first two stages are 6 V and 12 V, the third stage would be 18 V, each stage only adds the input peak-peak voltage (less of course the diode drops).
Don't confuse a Cockcroft Walton with a Marx generator, which is intended for transient loads, and can look similar in photographs with 'two vertical towers cross-connected by diagonal stuff'. The CWM capacitors will tend to be 'small', little energy stored in them compared to the power output expected of the multiplier into its load. Marx capacitors OTOH are 'big', they store all the energy required for the output pulse. |
H: How can I unlock two relays at the same time with one push button?
I am making a circuit to control the opening and closing of a small gate with two push buttons and two limit switches. The gate open and close functionality already works, but I want to add a general emergency stop button. I can't find a way to put a normal closed push button to disengage the two relays and brake the motor, I have tried putting it in different places in the circuit without success.
This is the circuit:
Any other comments on the circuit are also appreciated.
AI: Consider something like the following:
simulate this circuit – Schematic created using CircuitLab |
H: Voltage behaviour in battery-powered vehicle when motors regenerate
I am wondering how the voltage in a battery powered vehicle will behave in case its BLDC motors are acting as generators (i.e. while decelerating). In a system powered with a DC/DC converter for example, the voltage would rise by the amplitude of the back EMF. Would that also be the case if the system is powered by a battery that supports energy recouperation and could thus act as a current sink?
AI: When the motors act as generators you're exactly correct, the voltage rises based on the speed of the motor and BEMF constant. If you load the motor as in regenerative braking, you have to have somewhere to put the energy.
Generally, the traction inverter will control the torque, and the input voltage bus to the traction inverter will start to rise in voltage. That energy (RPM*braking torque-losses) is then used to charge the traction battery, keeping the voltage from rising to a point where it could be destructive.
If there's excess energy over the amount that the batteries can handle, the braking torque has to be reduced, or the energy has to be dissipated somehow. (Electrically as heat or mechanically as heat in the brake rotors.) |
H: How is a mains-connected medical device made safe against electrocuting me?
I am in physical therapy now. Some of the devices are connected to wall power, and used for muscle electrostimulation. The patient information states that no single malfunction can connect me to 230V, and any malfunction that would allow a second one to do so, would prevent device from turning on, or sound an alarm.
This all feels nice and dandy, but I have a bit hard time to believe that. Can it really be achieved? What methods are used to do it?
Sadly, there's a strict policy disallowing anything with a camera in the facility, and I can't remember the names of the devices. But I don't expect schematics etc, just a general answer to put my mind at ease when I'm there, connected to electricity.
AI: There are a massive amount of regulations covering patient-attached medical equipment. IEC 60601 is the generally accepted standard for medical electrical and electronic equipment, required for the commercialization of this type of equipment in many countries. Leakage currents must be controlled, single-point failures shouldn't cause an usafe condition, and these are tested. Primary to secondary insulation and isolation are specified and tested as well. So equipment meeting the common standards is pretty safe.
Now, if you buy a TENS unit from AliExpress or Amazon you're on your own. |
H: Use of Zener diode
I was constructing the UC3843 on PSIM from scratch. The circuit diagram and the application note state that if the input voltage is greater than 34 V, the Zener diode does not allow the circuit to run.
This is how it seems in the block diagram of the UC3843:
However, in my PSIM, the circuit still works normally when I design it like this:
This means that the output at that point is still VCC even if the VCC is >34 V. In that case, what's wrong here and how to modify this part so that the VCC >34 V will turn off the circuit just like the application note says?
AI: The Zener diode is intended to clamp the supply voltage. You're supposed to place a resistor in series with VCC to limit the current flowing through the Zener diode.
In other words, if you supply the chip with more than 34V, it will pull the supply voltage down to 34V and turn the excess voltage into heat. It will still operate with more than 34V, but if you omit the series resistor, the chip will blow up.
The resistor required for 100V operation should be on the order of 47k Ohms (resulting in 2mA startup current). |
H: Is there a specific definition for the tolerance value of a resistor?
Is there any authoritative definition for what the tolerance value of a resistor actually specifies, or is it just a de-facto common understanding, or are the details left up to individual manufacturers?
To put it differently, If I very precisely measured a large number of nominally equivalent resistors with the same tolerance, what does that tolerance value actually tell me about the distribution of resistances I would actually see? Would I expect a bell curve with, say, a mean at the nominal value and a standard deviation corresponding to the tolerance, or a random distribution strictly within the tolerance range, or something else entirely? All I can find on any descriptive sites are generic statements like "the amount a resistor may vary from its stated value," but I realized there are multiple possible interpretations to that kind of statement. (For example, if they just reject resistors that fall outside the tolerance range, I might expect to see a flat distribution within that range and nothing outside of it, as opposed to maybe a normal distribution with or without some less accurate cases.) This question sounds very similar, but is concerned more with changes in observed resistance over time. I'm specifically asking about the definition of the tolerance value itself (if one exists!). This page mentions specs ("High accuracies also go hand-in-hand with closer tolerances, but the two specifications are actually different") but doesn't elaborate on the specifications. This answer, about the feasibility of averaging resistances to try to tighten the equivalent tolerance, very nearly answers my question (and suggests it's more the bounded unspecified distribution with no guaranteed mean) but I'm still curious about an authoritative definition, say from some IEEE or IEC standard or something. (Otherwise, how can I assume that interpretation for any particular batch of components?)
AI: AFAIK, no there is not. This is done manufacturer to manufacturer, the distribution can vary considerably depending on the manufacturer. It's generally understood to be an upper and lower bound. A manufacturer could theoretically have 99% of their resistors at near the same value and then 1% at say - 5% tolerance, and they would list the resistors at a 5% tolerance.
The actual distribution varies considerably here is an example of actual measured tolerances of an SMT resistor:
Source: https://lambdafox.com/resistor-tolerances/ |
H: Output current of full-bridge rectifier with LC filter
I am learning about the properties of a full-bridge rectifier (with LC filter).
Now, I want to find the output current of the 124 Ω resistive load.
(Vpeak of the AC voltage source is 311 V with no DC or phase offset)
My idea is to first find the impedance of the LC filter, which is
$$\begin{align}
Z_{eq}&= Z_L+\left(\frac{1}{R}+\frac{1}{Z_C}\right)^{-1}\\
&= j\omega L+\left(\frac{1}{R}+j\omega C\right)^{-1}\\
&= j(2\pi50)(131\mathrm{~mH})+\left[\frac{1}{124}+j(2\pi50)(1.6\mathrm{~mF})\right]^{-1}\\
&= 0.0319+39.166j
\end{align}
$$
Then I can find the current across the inductor by the following:
Suppose the voltage drop across diode = 0.7 V
$$
\begin{align}
I_L &= \frac{V-2(0.7)}{Z_{eq}}\\
&= \frac{311-1.4}{0.0319+39.166j}\\
&= 0.0064-7.905j
\end{align}
$$
Finally, I can find the output current on the resistor by:
$$
I_R = \frac{Z_C}{Z_C+R}I_L = \;\;...
$$
However, from my calculation of IL, it should having a peak at around 7.905 A, which is completely different from my simulation of this circuit in LTspice or web simulator from falstad.com (around 3-3.2 V).
If my method to find out the output current IR is incorrect, how can I find it by hand, without a simulator?
AI: If my method to find out the output current IR
is incorrect, how can I find it by hand, without simulator?
Once you have full-wave rectified the output and then used a 2nd-order low-pass filter to smooth the output voltage, the average voltage seen across the 124 Ω resistor is the average voltage of an unfiltered full-wave sinewave. That value is 63.7 % of the peak value. So, if the peak value is 311 volts then the average voltage across the 124 Ω resistor is 198 volts.
Proof: -
Image from here.
So, the current in the 124 Ω resistor is 198/124 = 1.597 amps.
Simulation of output voltage: - |
H: P-channel MOSFET saturation condition: math contradiction
I am using a P-channel MOSFET with Vt = -0.4 and Vgs > -0.4 => Vs = 0 Vg > 0 always so it's not supposed to conduct.
Vdg > -Vt = +0.4 for the linear state.
At V2 = 0.2 our plot is linear state, but mathemetically I get the opposite: Vdg = 0.2-1.8 > -(-0.4) = 0.4 FALSE.
Where did I go wrong?
AI: The threshold voltage Vt is -0.4V.
Vgs is held constant at -1.2V, below the theshold voltage. A sweep of Vds from 0 to -1.8V is performed. The drain current is plotted against Vds.
The plot shows the transition from linear to saturation regions as Vds decreases from 0 to -1.8V.
Vgs-Vt is -0.8V (1.2 - 0.4), the plot also suggests a transition about -0.8 volts.
Vds = -0.2V is within the linear region, as it is greater than -0.8v (Vgs - Vt). |
H: Transistors falsely latch with EMI
I have a very basic NPN - PNP latching circuit:
[Sorry for the upside down image]
The latch initially is off, and when the op_amp_Signal_and_latch turns on, the transistors should latch and there should be output to SignalOut+ which drives other transistors.
I just made the latch part in a breadboard with a 10uF snubber capacitor connected to +ve and ground.
It works great until I turn on the fan, the light (even incandescent bulb) or the AC, or pretty much anything in the room. Doing so, latches the transistors, and I've to press the button to release the latch.
Sometimes touching any part of the circuit also latches the circuit.
I've connected an oscilloscope to see the noise that turns on the transistor, but unfortunately I was not able to catch any extra voltage induced by the EMI in the base and collector of the transistors.
My idea was to add a RC Delay circuit to delay latch signal, but with enough EMI it might charge up the capacitor and latch the circuit, just a bit delayed. But it will eventually happen.
So false triggering defeats the purpose of having the latch. When making PCB I'll surely take care of the copper area connected to the ground and also use SMD components which might stick to the board well and reduce the EMI effect due to the grounded copper area.
But I don't like the circuit. How do I get rid of the false triggering?
AI: Looks like all I needed is a 0.1uF capacitor I had lying around and connect them between the signal capacitor (Q3 in question) and +ve:
Now:
It doesn't falsely trigger no matter how many times I touch the circuit
No effect from EMI
As mentioned by @Tim Williams in comment, the bigger the value of the capacitor the longer you have to press the button and also longer activation time.
For example, I replaced the 100nF capacitor with a 1000uF capacitor, and here's what happens:
The activation time is also higher:
With a bigger capacitor (4700uF):
So for now the 100nF capacitor works perfectly and I ran the circuit for 12 hours straight without getting it latched. |
H: Can I convert a 36 volt battery to a 48 volt battery or how do I extend a 48 volt 10 amp hours to 48 volt 20 amp hours?
How do I convert a 48 volt 10 amp hours to 48 volt 20 amp hours battery? Can I convert a 36 volt battery to a 48 volt battery?
AI: The only way to convert a 48 V 10 AH battery to a 48 V 20 AH battery is to connect 2 in parallel.
You can use a boost converter to increase the voltage of a 36 V battery to 48 V.
The Amp-Hour capability will be whatever the 36 V battery is, but keep in mind the current draw will be higher from the 36 V battery to compensate. Assuming a decent converter (best case): Your amp hours at 48 V will be whatever the 36 V battery's is multiplied by the voltage ratio. (It will be 3/4 to AH of the 36 V battery)
$$1\ AH\ @\ 36\ V = 36/48\ AH\ @\ 48\ V = 0.75\ AH\ @\ 48\ V$$ |
H: Problem with mini sliding gate
I am learning about relays and to practice what I have learned I have decided to make a small electric gate using the following method. I am making a circuit to control the opening and closing of the gate with three push buttons and two limit switches. Pushbutton S1 opens the gate, S2 closes it, S3 is an emergency stop pushbutton, FCI1 is the left limit switch and FCD1 is the right limit switch. Everything works fine, but there is a problem, if the motor is turning in one direction and I press the push button to turn the motor in the other direction, the motor stops (it should keep turning until it reaches the limit switch or S3 is pressed). How can I do so that when it turns in one direction, no matter if it is given the order to turn in the other direction, it keeps turning until it reaches the limit switch or when S3 is pressed (as far as possible without using another relay)?
Circuit:
AI: Try this. The buttons are powered only if the opposing relay is not latched. |
H: I think that these gate resistors are 2.2 kΩ, isn't that rather high?
From this video, Pace MBT 250 rework station with a Gordak handpiece and Arduino by Fodor Tibor, @ 17:27, this "close up" photo is shown of the board:
Note the seven blue metal film resistors that go between the digital output pins to the gates of the seven n-channel logic level FETs (I don't know exactly what model of FETs they are).
I may very well be mistaken, but the colour bands look like: red; red; black; brown, and; silver - thereby implying 2.2 kΩ resistors.
However, isn't this a rather high value for a gate resistor, given that ~150 Ω is a more usual figure?
Additional info
A 150 Ω gate resistor is shown in this diagram from Driving motors, lights, etc. from an Arduino output pin)
Admittedly, the gate doesn't need to switch particularly quickly, maybe 5 Hz at an absolute maximum (probably 0.1 to 1 Hz typically), so a low value of resistor isn't strictly necessary... but even so, a difference of an order of magnitude in the value of the gate resistor seems a bit extreme.
On the underside of the board, from the output pins of the Nano, there are also a set of seven 10 kΩ resistors to ground:
FWIW: This board converts from a K-type thermocouple to a "PTC equivalent" resistance, using a resistive ladder, where the resistors are switched by the Arduino.
Here is the full schematic that I came up with:
Finally, for complete disclosure, I have also made some notes/analysis about this board online, Gordak soldering iron on a Pace MBT 2xx. The details given in the video about the circuit are rather sparse.
AI: The gate resistor R1 is principally to limit the transient current drawn from/into the mcu pin into the gate capacitance when the pin goes high/low. For a 5V mcu, a 150R resistor limits the maximum current to 33mA which is quite close to the maximum recommended for several mcus, and is rather more than you would want to draw from something like a RP Pico (although that's a 3.3V mcu, so the current would only be 22mA).
Having a low resistance allows the mosfet to switch more rapidly. With a Vgs=5V, an IRL530 has a maximum total gate charge of 28nC to charge or discharge on transitions, meaning it will take almost 1μs to switch on or off with a current around 30mA. An IRL540 with a maximum total gate charge of 64nC would take over twice as long.
Similarly, a 2K2 resistor will limit the current into/out of the mcu pin to about 2.3mA, which would not be a problem for any of the common mcus. However, an IRL530 could take up to 12μs - and an IRL540 up to 28μs - to complete each transition.
Switching mosfets dissipate almost nothing when fully on or fully off, but can dissipate significant power during the switching transition. For low speed switching such as your 5Hz application, even with a worst-case switching time of 30μs, it would represent a duty cycle for the pulses of high power dissipation of only 30μs/100ms = 0.03%, so you can see that the size of the gate resistor is really not crucial to an order of magnitude or more. If you had a application switching in the tens of kHz, it would be a different story. |
H: Maximum Ambient temperature
In this IC, on page 35, the maximum operating temperature is given as 70degC or 85degC.
Is the datasheet maximum temperature value of 85C applicable to the surrounding medium? I ask because air will not be in contact with this component; it will be another material.
AI: The data sheet is specifying the maximum ambient temperature in still air. Usually they are assuming some sort of mounting configuration, that had a specific thermal resistance from the die to the ambient. A quick scan of the specification sheet gave me no more information about the thermal resistances of the part. If you are serious about some sort of mounting scheme that is much different from standard you will have to contact the manufacturer for guidance. Still air usually means no fan in an enclosure. It's really not completely still though as there is still convection inside the enclosure.
If you are considering potting the board that the part will be on then consider the heat conductive properties of the potting compound. Typically parts on circuit boards are cooled first by conduction into the board and then by convection, as the warm regions of the board set up air flow. If you are are potting the part you will only have conduction. If the thermal resistance is equivalent or better than typical conduction plus convection, then you might be able to run the part at a higher Ta. You still need to know the thermal resistance of the die to the package, though. |
H: Using a PNP transistor with a NPN transistor not working as intended
I have an element represented by the two resistors in between NODE1 and NODE2.
I want to be able to open and close the circuit before and after the element, just like having two switches before and after it.
At the moment I have this schematic. (The 5 V sources with switches are supposed to represent an Arduino):
simulate this circuit – Schematic created using CircuitLab
My thought is that when SW1 is closed transistor Q3 allows the current to go through the transistor and to the base of Q1. Q1 is a PNP transistor and this would mean that when SW1 is closed, there is no current going to NODE1, just like having an open switch.
The second switch is much easier since it is after the element and I can use a simple NPN transistor to open/close it.
When I open SW1 and close SW2, I get a voltage of 11.98 V at NODE1 and almost 0 V at NODE2 which is what I am expecting.
However, nothing changes when I close SW1.
Is my schematic flawed and if so, how can I fix it to achieve my goal?
Update:
Here is the updated schematic that now works.
simulate this circuit
AI: Q1's base is always connected to 0V. When Q3 is turned on, it lets some extra current through R6 but doesn't affect Q1's base.
Instead of connecting Q1's base to Q3's emitter (bottom side), connect it to Q3's collector (top side). Also, put a resistor in series with Q1's base. |
H: 10 MΩ resistor needed on op-amp input for correct operation
Circuit:
The 3 kΩ in series with the switch in the circuit represents a metal probe that gets connected to ground when water is present (switch open = no water; switch closed = water).
Due to the metal probe starting to corrode I need to use a bi-polar square wave (approx. -2.5 V to 2.5 V) to drive the resistor divider/metal probe. I achieved this by adding a differentiator circuit on the output of a 555. The output of the resistor divider is fed into a rectifier circuit to have a DC signal again. That DC signal is then fed into a unity-gain buffer to be able to read the value on an ADC, and also fed into a comparator to read the signal on an I/O pin. The op-amp used is an LMV324.
Problem: The op-amp circuit begins to work only when an oscilloscope probe (set to 10x) is connected to the input of the op-amp. With a probe on the input I can at least see values on the ADC and get an accurate reading on the I/O pin.
I assume if I were to use a 10 MΩ resistor to ground on the input signal of the op-amp it would fix this issue, but can someone explain why this is happening? I am relatively new to using op-amps.
Note: Everything up to the input of the op-amp has been tested and works as expected!
AI: You'll need to add a suitable resistance in parallel to the 4.7nF capacitor for 2 reasons:
a) the diode + 4.7nF cap act as a peak detector and for it to track the peak of the input signal properly, you need this parallel resistance. For eg., let's say the switch is open. The peak value is +2.5V. Now, the 4.7nF cap will charge to +2.5V minus the diode voltage. Now, when switch is closed, the peak value will drop to say 0V. Who will discharge the 4.7nF cap from +2.5V to 0V?
b) opamp will have an input leakage. Let's say the direction is such that it is flowing into the 4.7nF cap. The cap voltage will keep increasing with time and saturate to a high value. So,, we need a parallel resistance to discharge this opamp input leakage. |
H: Help with PNP transistor schematic
I would like to build a FM radio reciever with PNP germanium transistors but I can not find a simple yet efiicient schematic for this. Does anyone know of a schematic I can use?
I have found one schematic that I've built, but it doesn't work. Maybe it's because I have used other transistors?
AI: Your "replacement" transistor would not work.
The P423 transistor has the following characteristics:
Material: Germanium
Transition Frequency (ft): 100 MHz
Collector Capacitance (Cc): 10 pF
Forward Current Transfer Ratio (hFE), MIN: 24
The BF324 from the schematic:
Material: Silicon
Transition Frequency (ft): 350 MHz
Collector Capacitance (Cc): O.1 pF
Forward Current Transfer Ratio (hFE), MIN: 25
As you can see, not only are they made of a different material which makes their base-emitter bias voltage different, but more importantly they have significantly different maximum frequency.
The transition frequency is the frequency at which a transistor has a gain of 1, meaning the frequency at which it stops acting as an amplifier, and after which it actually reduces the input signal.
Another important factor is a transistor's own inter-electrode (between its own electrodes/pins) capacitance, which can significantly weaken a high-frequency signal.
The original, BF324 has only 0.1pF collector capacitance, while your replacement has 10pF, which is 100 times higher! That will definitely make a difference at very high frequencies.
Your replacement transistor can't amplify FM signals because their frequency is too high for it, but the BF324 definitely can.
In high-frequency circuits, you should always check to see if the replacement transistor's maximum supported operating frequency is as high as, or higher than, the original, or at least close to it. |
H: Can I use a buck converter and a 12 V adaptor to create a 5 V and a 12 V circuit?
I have a microcontroller that is powered by 5 V and some solenoids that need 12 V. At the moment I power the solenoids using a 12 V adapter and switch them on and off through MOSFETs which are in turn switched on and off by the microcontroller.
The microcontroller is powered by a separate 5 V power source which means I have two power sources now. Ideally I would like to be able to power the microcontroller using the 12 V adapter so I only have to work with one power source.
Now I read somewhere that with a buck convertor, you can step down voltage. For example, 12 V to 5 V. So I understand how I can create a 5 V circuit. But the thing is that I need both 12 V and 5 V. So in a sense, I want to create two sub-circuits (if you can call it that), 12 V and 5 V, using only a 12 V adapter.
Can someone answer the following question?
Is this possible using a buck converter?
If so, would you recommend this approach? Is there a more efficient way of achieving this?
How is this usually done in professional applications? For example, a DVD player. The smaller electrical components in a DVD player almost certainly need a lower voltage than the little motor that spins the DVD disk. However, I only see one power inlet. So this seems like a problem that was fixed a long time ago.
Can someone draw a little schematic showing how each component would be wired?
AI: Yes, possible and commonly done.
Yes, good approach. Less efficient approaches but also simpler and cheaper are just linear regulators.
If you are making a device and need a power supply anyway, the power supply can be designed to have multiple outputs. Or a boost or buck converter for converting a single voltage up or down. Or linear regulators.
It depends what components you use. You can design the converter from scratch or buy a module so no schematic can be given. Basic rule is, 12V in, 5V out. |
H: Quiescent current in battery circuit
In this circuit I'm using an MCP73832 for battery charging and an AP2210 LDO. The mosfet is a DMP3099L. With the USB disconnected, VBAT set to 4.2V and the MCU (STM32F030F4P6) in standby mode (drawing < 10uA), the total current graph looks like this:
The average current is around 50uA, which seems very high. Candidates for this high average current are the mosfet, the LDO and maybe the MCP73832 (but VCC is not connected, not sure if it can run from VBAT alone, the datasheet doesn't say anything about this that I can see).
This high average current consumption is the main problem, but perhaps the spikes are related?
The frequency of the spikes decreases with VBAT voltage, and their cadence is not fixed. For example, here's the graph when VBAT = 3.8V, where the spikes are between 6 seconds and about 0.8 seconds apart.
The STAT pin is connected to a GPIO on the MCU which is in high impedance mode while the MCU is in standby mode.
So the questions are:
Why is the average current consumption so high?
What is causing the intermittent current draw?
AI: The average current is around 50uA, which seems very high.
The AP2210_3V3 has a quiescent current (aka ground current) specified as being 100 μA typically. It's also shown in this graph: -
And, in case there's any doubt what ground pin current means, read note 10: -
Why is the average current consumption so high?
It's the quiescent current of the LDO voltage regulator as outlined above. If you were building a batch of these circuits I'd advise that the current consumption in MCU standby might be over 100 μA in many.
What is causing the intermittent current draw?
It might be your MCU coming out of deep-sleep now and then to perform some housekeeping task. |
H: Op amp stability consideration
I would like to have your opinion on this circuit :
The source voltage V12 is a feedback of an other loop hidden. So the operating point of the system is changing.
When the 47 Ohm resistor R1 is connected to the NPN, the system seems to be stable according to LTspice and it makes sense according to the theory :
Nevertheless, if the operating point is making working the PNP and not the NPN, the system is unstable as the resistor of 47 Ohm is "removed" from the open loop gain.
What I am asking is the following : if the circuit is working with the NPN, i.e with the stable part of the system, can the system be lightly unstable? I ask this question because I have a circuit which looks like to be unstable. Sometimes the output op amp seems to change completely of state and then go back to its value. It is particurlarly the case when the 47k5 resistor is not placed. But it has a low effect on the open loop gain and so on the stability ...
Thank you,
AI: Instability occurs when the PNP is active because the feedback path to the op-amp uses a 47 Ω resistor (R1) and, when that happens, the influence of C6 is very significant. This could add significant phase shift to the feedback and cause instability.
Compare this when the NPN is active. The NPN's emitter is "strong enough" to over-power the effect of C6 and this means the system is more stable. I'm assuming the the inductor is shorted out by the red line you appear to have added.
if the circuit is working with the NPN, i.e with the stable part of the system, can the system be lightly unstable?
It can be closer to the borderline of instability (C6 being the big factor to worry about). |
H: Why does the MOSFET drain potential show this strong turn-off overshoot? How to fix it?
I am trying to build a PV charger (PWM), which I guess is kind of a buck converter. Below is a first LTSpice simulation. V1 are the PV modules, V3 is the battery. V2 is the microcontroller's supply voltage. L1 is my estimate of the wire inductance. For D1 I chose whatever came to my mind first. M1 is about as close to my future buyer's choice as it can get.
The current is rather smooth, but the potential at the MOSFET drain jumps pretty high when the MOSFET turns off (and only then, turn-on is uncritical). The reverse current (discharge current) through the battery is only of the order 200 mA for the duration of that transient, so probably nothing much to worry about (battery capacity is 120 Ah). But who knows... batteries are said to have a human-like qualities.
Why does it happen and how can I stop the circuit from doing this?
AI: how can I stop the circuit from doing this?
You don't need to fix it. All buck regulators that enter DCM will exhibit this behaviour. Basically when the inductor energy has nearly depleted and cannot push current through the reverse diode any more you find that you get a decaying sinewave resonance where the frequency is dictated by the inductance and the parasitic drain-source capacitance of the MOSFET.
But, you do need to apply labels to your nodes and note plot using node codes like n007. It's only because the circuit is simple that I could see it was associated with the MOSFET drain node.
Another thing; this is an unusual (but valid) buck regulator circuit and, the advantage you get is the N-channel MOSFET is easily driven relative to 0 volts but, your load must be totally floating for this to work correctly and, that means connections from the MCU to anything else. |
H: Which transistor is the best for switching on/off a LED with an ESP32?
I have bought a transistor set a while ago and I never used it so I thought I would give it a shot to make a simple circuit. I'm very new to electronics and the math behind it so I'm sorry if it's a really simple question. These are the transistors:
I have built a simple schematic to the best of my understanding:
Now I'm scratching my head on how to calculate the resistor value and which of the transistors will suit my application best. The LED is a 3 V SMD2835 that consumes 120 mA.
AI: In general, you would search data sheets for each transistor and look up what their properties are, such as if they can switch 120mA or not.
Also the LED would burn up without a resistor in series. The LED needing 3V to work may be difficult to power from 3.3V which is only 0.3V more, so limiting the current to 120mA will not be very precise, as LEDs usually have some tolerance. |
H: How to design a circuit with dual power source?
I have a LED that can be powered and controlled by a MCU (ATmega328) and would like it to be able to take power from battery.
The battery (5 V) can be plugged or unplugged when needed, it's the secondary power source.
Requirements:
When battery available led should use only its power source (5 V).
When battery not available LED should use the power from MCU (3.3 V).
The MCU should always able to turn on or off the LED.
How to design that? I will add the necessary resistor for the LED later.
Is it possible here the current go from B to C mixing voltage?
Thanks
Update:
Here is the @sai's answer circuit made from multisim.com
AI: You can try something like this.
You can adjust R1, R2 to get the LED brightness that you need for the 3.3V and 5V cases respectively.
R3 is to ensure that 5V goes to 0V completely when the battery is removed.
Choose a PMOS and NMOS whose RON is low enough (say few ohms or less) when VGS=3V
Update: I did the simulation in multisim and here are the results. Note that I added another PMOS to take care of a case when 5V is available and the LED is OFF. Note that I also made the PMOS and NMOS much stronger than you so that they can carry higher current.
Case1: 5V OFF and LED OFF
Case2: 5V OFF and LED ON
Case3: 5V ON and LED OFF
Case4: 5V ON and LED ON |
H: How does the TI CD14538BM96 behave in response to long input pulses?
This is related to my earlier question on driving dual coil latching relays from a single logic signal.
This question is on how whether the TI CD14538BM96 monostable multivibrator can be used to convert an input signal with very long pulse durations into edge-triggered output pulses of a shorter, well-defined duration:
In case it is relevant to the answer, let's assume that I use the leading- & trailing-edge re-triggerable configuration.
How will this device behave in response to input pulses that are longer than the configured output pulse duration?
Will the output pulse length always be of the configured length beginning with time of the last matching edge?
Or will the output pulse length be dependent on the much longer input pulse length?
Initially I thought 2 would apply, but after some reflection I more or less convinced that 1 applies. Can somebody confirm this either way?
AI: Like mentioned in the other answer, it is an edge triggered monostable. So, however long your input pulse is, the output pulse length will always be of the configured length beginning with time of the last matching edge provided you do not have multiple closely spaced input pulses within the duration when the monostable has triggered
If there is a possibility of getting multiple closely spaced input pulses within the duration when the monostable has triggered, you have to be careful and select re-triggerable or non-retriggerable mode whichever makes sense to your application.
Please take a look at the block diagram
For your use case, you can draw a timing diagram and confirm for yourself these conclusions. |
H: Is it OK to route a signal trace under an STM32?
Is it okay to route an SWCLK signal (for programming the STM32 microcontroller) under the STM32?
I will use it only to program it whenever I need it; it is not something that is always active.
Please see the attached figure:
Look at the yellow trace under U1 (STM32G071RB) routing from P3:2.
AI: There's absolutely no problem with that. You can route underneath TQFP/TSOP/SOIC/DIP chips (and anything else that's isolated on the underside) as much as you want. |
H: Multiple 10-bit, 500 Hz PWM outputs from a shift register (e.g. 74HC595) with a single 16-bit input (e.g. from an ATmega328P)
I would like to produce as many 10-bit PWM outputs at 500 Hz or less as possible using a single pin of a microcontroller, in this case an Arduino Uno, and a SIPO shift register.
I found this question which led me to Binary Code Manipulation / Bit Angle Modulation and while this seems to have hints of an answer, my project requires the outputs of the shift register to be PWM. I need to maintain a minimum of 10-bit resolution, but the frequency could be anywhere between 300 and 500 Hz.
I assume I will have to use the 16-bit timer and sacrifice a bit if resolution to succeed. I wasn't sure if it was as simple as 16-10 = 6 outputs, and even if it is, I need a little help getting started, especially assuming it will involve register manipulation. I'm not a strong coder so I'll have to use (probably bad) pseudo code, but I imagined something like:
make an array of n rows with 1024 binary values
interlace this to a single row of 2^16 binary values
output this to a shift register
latch every n timer cycles // (only wire up the first n outputs of the shift register)
accept inputs to any row in the array at any time, but...
only update the single row fed to the shift register every 1/500th of a second
Thanks for any assistance. If it's not too much, I'd also like to know how many pins I can use as an output for the provided method on an ATmega328p if such information isn't apparent in the answer.
Edit: Thank you for the response ElectronicsStudent. I have some AL8861 ICs which accept pwm or analogue input for dimming. I would like to drive one of these per single LED cell, (around 750 mA peak current,) and through experimentation I have found 256 dimming stages to be too abrupt for the fades I want. I only need to find a solution to drive a dozen or so AL8861s initially, but would like the project to eventually accommodate more. The esp32 seemed viable with 16 pwm outputs at 10 bits each, but I still hoped for a way to avoid buying one esp32 for every 16 AL8861 chips.
AI: Okay, let's see.
10Bit Resolution at 300Hz nom. means a "Latch-precision" of
(300Hz)⌃(-1) / 2⌃10 = 3.25us
To have some headroom, you should have a bit extra (Nyquist and so on)! Therefore:
(300Hz)⌃(-1) / 2⌃11 = 1.62us
This is the time available to shift data via the GPIO, setup/reconfigure/execute the Timer ISR, compute the actual bit-states and do the housekeeping in your software.
On a ATMega328p running at 20MHz tops (You can go this high, but it is outside of the recommended range) this equates to:
20MHz * 3.25us = 65 Cycles
So in best case (Highest CPU Clock and lowest resolution) you will have a maximum of 65CPU Instructions (some Instructions aren't even single-cycle).
So in short: Not realy a practicable approach!
Other possible approaches:
Implementation in an FPGA
External PWM ICs configureable via SPI/I2C
More powerful MCU (ARM > 100Hz)
MCU with many Timers You could controll like 4 PWM signals via a single Timer. But be aware of phase lag and especially Jitter between timers!
Spin a custom CPLD/FPGA for e.g four/eight PWM Channels and make it interfaceable via SPI/I2C
But:
If there are some "options" to constrain your requirements, you can make it work.
If all your channels are "the same" signal, you can use discrete logic to multiplex it.
If all channels have the same PWM period and phase and you limit the PWM % to 30<x<70 (rough estimate) your controller will have enough time to compute the data for some channels.
If all periods are multiples of each other and you limit the PWM % to 30<x<70 (rough estimate) your controller will have enough time to compute the data for some channels.
Edit 1:
After you updated your question, i had a look around. Something like LP5012 could fit the bill. You could either drive the LEDs directly, or - if you require more current - condition the output signal (via Pullup) and feed it into a driver IC/Mosfet.
There is a fair chance you could get this to work even with 400kHz I2C (depends on your requirements).
Only problem is: These chips are not available for lowisch PWM frequencys like 300Hz.
Edit 2:
May i recommend the following approach:
You design a little PCB with an ARM M0+ or M3 running at around 100MHz. Look for an ST-PArt optimized for industrial-/motor-control. They have a nice feature set (many timers, enough processing grunt, communications IO and so on). Each of these PCBs drives a single of your LED-Strips (This way you keep the load per CPU down).
They are connected together with some kind of RS485 (cheap, simple, realiable) and a custom protocoll or maybe even DMX (Or other existing systems for ligth control applications).
This array of slaves is controlled by a single net-ready device like ESP32.
The ESP32 handles the overall business logic (What RGBs with which dimming should be set where and when and so on...) |
H: Which component for disconnecting RS485 data signal?
I have a situation where I'd like to be able to connect/disconnect the RS485 signal path between two PCB-mounted XLR connectors with one 3V3 output from an ESP8266.
What's the best way to achieve this? My instinct is some kind of small SPDT relay, but a lot of the ones I find online are overkill for such low voltage signals, and my instinct says that's not optimal. Is an optocoupler another option? I'm not sure whether that would work with an RS485 signal though.
Pins 2 and 3 of the NC5FAH are what need to be optional. I need to do this because a downstream device attached to the NC5FAH will auto-power off when "signal" is lost down the cable, which is what I'm trying to trigger.
AI: I probably would just use a relay. The thing about RS-485 transceivers is that the I/O are hardened and if you just use any regular analog switch or mux it won't be as hardened as the RS485 inputs.
An optocoupler output has the same issue, but on top of that an optocouplers simply won't work because RS-485 is a bidirectional bus, and optocouplers are not two-way switches.
Alternatively you could try to find out how the downstream device detects that the signal is lost. |
H: Delay.h on ATtiny45 vs. ATtiny461 in Microchip Studio
I noticed that the Delay.h wasn't working well in a project when used with an ATtiny45, so I've made a small piece of code to test where I went wrong with my coding. I've just made a blinky-LED program on PB3 which goes on for 200 ms and off for 500 ms.
#define F_CPU 1000000
#include <avr/io.h>
#include <util/delay.h>
int main(void)
{
DDRB |= (1 << PB3);
while (1)
{
PORTB |= (1 << PB3);
_delay_ms(200);
PORTB &= ~(1 << PB3);
_delay_ms(500);
}
}
What I've noticed is that the LED goes on for 200 ms and then the LED goes off for a very, very short time. After a lot of testing, searching, and failing I've figured out that the problem could be that the linking to delay.h isn't working well.
The problem is you are creating an object file, but not linking it. Without linking, branch instructions in the machine code are not filled with the required destination addresses, so the code simply executes linearly until it 'falls off the end' into unallocated memory. Eventually it reaches the end of memory and wraps around to zero to execute your code again. The end result is the LED flashes with a very low duty cycle.
(Source: Delay doesn't work (avr attiny 26, delay.h))
(Another post with same issues: Using avr-gcc _delay_ms causes chip to freeze)
Now I've been using (Atmel &) Microchip Studio for 5 or 6 years to make all kind of small ATtiny projects. There are some features I don't know a lot about, but everything always worked without any problems.
I've started a few new projects to be sure I didn't change any settings or stuff like that, but it always failed with an ATtiny45.
Now the strange part is, when I started a new project with an ATtiny461 (and used an ATtiny461 ofcourse), and used this code to try it on, it worked without any problems. After that, I tried to change the device to an ATtiny45 and it failed again, and reverting back to a 461 made it work again.
Can anyone explain why it's not working on one device and does work on the other?
Is my assumption correct that this Delay.h doesn't work on an ATtiny45??
The links above are talking about a linker-file, but as said before, these are the features I'm not familiar with. If this is the problem, where or how should I change this? And how come there's a difference between the two devices?
Also, in the project-properties>ToolChain>AVR/GNU C Compiler: The compile-string is the same (with the exception of Attiny45<->Attiny461)
Extra info:
I'm using Microchip Studio to write (in C) and compile the whole thing and I'm using AVRDUDESS to write the .hex via USBasp to the Attiny.
Edit:
As @Martin said/asked, the MCU restarts (I didn't put that clear in the question). I had done some tests with different times and an input to trigger different scenarios, but it clearly restarted every time.
Below you can find the assembler code (well the .lss, but I hope it's what you asked for). I've put them also in a compare-file and the differences don't seem too big (as far as I understand everything).
The only thing I see what could be something is the fact that with the ATtiny45 the 5th last line says:
60: ea cf rjmp .-44 ; 0x36 <main+0x6>
which could mean to restart the MCU? (assumptions, assumptions.)
Attiny45:
JustANotherTestProject.elf: file format elf32-avr
Sections:
Idx Name Size VMA LMA File off Algn
0 .text 00000066 00000000 00000000 00000054 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
1 .data 00000000 00800060 00800060 000000ba 2**0
CONTENTS, ALLOC, LOAD, DATA
2 .comment 00000030 00000000 00000000 000000ba 2**0
CONTENTS, READONLY
3 .note.gnu.avr.deviceinfo 0000003c 00000000 00000000 000000ec 2**2
CONTENTS, READONLY
4 .debug_aranges 00000020 00000000 00000000 00000128 2**0
CONTENTS, READONLY, DEBUGGING
5 .debug_info 0000056c 00000000 00000000 00000148 2**0
CONTENTS, READONLY, DEBUGGING
6 .debug_abbrev 000004dc 00000000 00000000 000006b4 2**0
CONTENTS, READONLY, DEBUGGING
7 .debug_line 0000022c 00000000 00000000 00000b90 2**0
CONTENTS, READONLY, DEBUGGING
8 .debug_frame 00000024 00000000 00000000 00000dbc 2**2
CONTENTS, READONLY, DEBUGGING
9 .debug_str 00000336 00000000 00000000 00000de0 2**0
CONTENTS, READONLY, DEBUGGING
10 .debug_loc 00000048 00000000 00000000 00001116 2**0
CONTENTS, READONLY, DEBUGGING
11 .debug_ranges 00000010 00000000 00000000 0000115e 2**0
CONTENTS, READONLY, DEBUGGING
Disassembly of section .text:
00000000 <__vectors>:
0: 0e c0 rjmp .+28 ; 0x1e <__ctors_end>
2: 15 c0 rjmp .+42 ; 0x2e <__bad_interrupt>
4: 14 c0 rjmp .+40 ; 0x2e <__bad_interrupt>
6: 13 c0 rjmp .+38 ; 0x2e <__bad_interrupt>
8: 12 c0 rjmp .+36 ; 0x2e <__bad_interrupt>
a: 11 c0 rjmp .+34 ; 0x2e <__bad_interrupt>
c: 10 c0 rjmp .+32 ; 0x2e <__bad_interrupt>
e: 0f c0 rjmp .+30 ; 0x2e <__bad_interrupt>
10: 0e c0 rjmp .+28 ; 0x2e <__bad_interrupt>
12: 0d c0 rjmp .+26 ; 0x2e <__bad_interrupt>
14: 0c c0 rjmp .+24 ; 0x2e <__bad_interrupt>
16: 0b c0 rjmp .+22 ; 0x2e <__bad_interrupt>
18: 0a c0 rjmp .+20 ; 0x2e <__bad_interrupt>
1a: 09 c0 rjmp .+18 ; 0x2e <__bad_interrupt>
1c: 08 c0 rjmp .+16 ; 0x2e <__bad_interrupt>
0000001e <__ctors_end>:
1e: 11 24 eor r1, r1
20: 1f be out 0x3f, r1 ; 63
22: cf e5 ldi r28, 0x5F ; 95
24: d1 e0 ldi r29, 0x01 ; 1
26: de bf out 0x3e, r29 ; 62
28: cd bf out 0x3d, r28 ; 61
2a: 02 d0 rcall .+4 ; 0x30 <main>
2c: 1a c0 rjmp .+52 ; 0x62 <_exit>
0000002e <__bad_interrupt>:
2e: e8 cf rjmp .-48 ; 0x0 <__vectors>
00000030 <main>:
#include <avr/io.h>
#include <util/delay.h>
int main(void)
{
DDRB |= (1 << PB3);
30: 87 b3 in r24, 0x17 ; 23
32: 88 60 ori r24, 0x08 ; 8
34: 87 bb out 0x17, r24 ; 23
while (1)
{
PORTB |= (1 << PB3);
36: 88 b3 in r24, 0x18 ; 24
38: 88 60 ori r24, 0x08 ; 8
3a: 88 bb out 0x18, r24 ; 24
#else
//round up by default
__ticks_dc = (uint32_t)(ceil(fabs(__tmp)));
#endif
__builtin_avr_delay_cycles(__ticks_dc);
3c: 8f e4 ldi r24, 0x4F ; 79
3e: 93 ec ldi r25, 0xC3 ; 195
40: 01 97 sbiw r24, 0x01 ; 1
42: f1 f7 brne .-4 ; 0x40 <__SREG__+0x1>
44: 00 c0 rjmp .+0 ; 0x46 <__SREG__+0x7>
46: 00 00 nop
_delay_ms(200);
PORTB &= ~(1 << PB3);
48: 88 b3 in r24, 0x18 ; 24
4a: 87 7f andi r24, 0xF7 ; 247
4c: 88 bb out 0x18, r24 ; 24
4e: 9f e9 ldi r25, 0x9F ; 159
50: 26 e8 ldi r18, 0x86 ; 134
52: 81 e0 ldi r24, 0x01 ; 1
54: 91 50 subi r25, 0x01 ; 1
56: 20 40 sbci r18, 0x00 ; 0
58: 80 40 sbci r24, 0x00 ; 0
5a: e1 f7 brne .-8 ; 0x54 <__SREG__+0x15>
5c: 00 c0 rjmp .+0 ; 0x5e <__SREG__+0x1f>
5e: 00 00 nop
60: ea cf rjmp .-44 ; 0x36 <main+0x6>
00000062 <_exit>:
62: f8 94 cli
00000064 <__stop_program>:
64: ff cf rjmp .-2 ; 0x64 <__stop_program>
Attiny461:
YetANotherTest.elf: file format elf32-avr
Sections:
Idx Name Size VMA LMA File off Algn
0 .text 0000006e 00000000 00000000 00000054 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
1 .data 00000000 00800060 00800060 000000c2 2**0
CONTENTS, ALLOC, LOAD, DATA
2 .comment 00000030 00000000 00000000 000000c2 2**0
CONTENTS, READONLY
3 .note.gnu.avr.deviceinfo 0000003c 00000000 00000000 000000f4 2**2
CONTENTS, READONLY
4 .debug_aranges 00000020 00000000 00000000 00000130 2**0
CONTENTS, READONLY, DEBUGGING
5 .debug_info 000005fc 00000000 00000000 00000150 2**0
CONTENTS, READONLY, DEBUGGING
6 .debug_abbrev 00000564 00000000 00000000 0000074c 2**0
CONTENTS, READONLY, DEBUGGING
7 .debug_line 00000244 00000000 00000000 00000cb0 2**0
CONTENTS, READONLY, DEBUGGING
8 .debug_frame 00000024 00000000 00000000 00000ef4 2**2
CONTENTS, READONLY, DEBUGGING
9 .debug_str 0000035e 00000000 00000000 00000f18 2**0
CONTENTS, READONLY, DEBUGGING
10 .debug_loc 00000048 00000000 00000000 00001276 2**0
CONTENTS, READONLY, DEBUGGING
11 .debug_ranges 00000010 00000000 00000000 000012be 2**0
CONTENTS, READONLY, DEBUGGING
Disassembly of section .text:
00000000 <__vectors>:
0: 12 c0 rjmp .+36 ; 0x26 <__ctors_end>
2: 19 c0 rjmp .+50 ; 0x36 <__bad_interrupt>
4: 18 c0 rjmp .+48 ; 0x36 <__bad_interrupt>
6: 17 c0 rjmp .+46 ; 0x36 <__bad_interrupt>
8: 16 c0 rjmp .+44 ; 0x36 <__bad_interrupt>
a: 15 c0 rjmp .+42 ; 0x36 <__bad_interrupt>
c: 14 c0 rjmp .+40 ; 0x36 <__bad_interrupt>
e: 13 c0 rjmp .+38 ; 0x36 <__bad_interrupt>
10: 12 c0 rjmp .+36 ; 0x36 <__bad_interrupt>
12: 11 c0 rjmp .+34 ; 0x36 <__bad_interrupt>
14: 10 c0 rjmp .+32 ; 0x36 <__bad_interrupt>
16: 0f c0 rjmp .+30 ; 0x36 <__bad_interrupt>
18: 0e c0 rjmp .+28 ; 0x36 <__bad_interrupt>
1a: 0d c0 rjmp .+26 ; 0x36 <__bad_interrupt>
1c: 0c c0 rjmp .+24 ; 0x36 <__bad_interrupt>
1e: 0b c0 rjmp .+22 ; 0x36 <__bad_interrupt>
20: 0a c0 rjmp .+20 ; 0x36 <__bad_interrupt>
22: 09 c0 rjmp .+18 ; 0x36 <__bad_interrupt>
24: 08 c0 rjmp .+16 ; 0x36 <__bad_interrupt>
00000026 <__ctors_end>:
26: 11 24 eor r1, r1
28: 1f be out 0x3f, r1 ; 63
2a: cf e5 ldi r28, 0x5F ; 95
2c: d1 e0 ldi r29, 0x01 ; 1
2e: de bf out 0x3e, r29 ; 62
30: cd bf out 0x3d, r28 ; 61
32: 02 d0 rcall .+4 ; 0x38 <main>
34: 1a c0 rjmp .+52 ; 0x6a <_exit>
00000036 <__bad_interrupt>:
36: e4 cf rjmp .-56 ; 0x0 <__vectors>
00000038 <main>:
#include <avr/io.h>
#include <util/delay.h>
int main(void)
{
DDRB |= (1 << PB3);
38: 87 b3 in r24, 0x17 ; 23
3a: 88 60 ori r24, 0x08 ; 8
3c: 87 bb out 0x17, r24 ; 23
while (1)
{
PORTB |= (1 << PB3);
3e: 88 b3 in r24, 0x18 ; 24
40: 88 60 ori r24, 0x08 ; 8
42: 88 bb out 0x18, r24 ; 24
#else
//round up by default
__ticks_dc = (uint32_t)(ceil(fabs(__tmp)));
#endif
__builtin_avr_delay_cycles(__ticks_dc);
44: 8f e4 ldi r24, 0x4F ; 79
46: 93 ec ldi r25, 0xC3 ; 195
48: 01 97 sbiw r24, 0x01 ; 1
4a: f1 f7 brne .-4 ; 0x48 <__SREG__+0x9>
4c: 00 c0 rjmp .+0 ; 0x4e <__SREG__+0xf>
4e: 00 00 nop
_delay_ms(200);
PORTB &= ~(1 << PB3);
50: 88 b3 in r24, 0x18 ; 24
52: 87 7f andi r24, 0xF7 ; 247
54: 88 bb out 0x18, r24 ; 24
56: 9f e9 ldi r25, 0x9F ; 159
58: 26 e8 ldi r18, 0x86 ; 134
5a: 81 e0 ldi r24, 0x01 ; 1
5c: 91 50 subi r25, 0x01 ; 1
5e: 20 40 sbci r18, 0x00 ; 0
60: 80 40 sbci r24, 0x00 ; 0
62: e1 f7 brne .-8 ; 0x5c <__SREG__+0x1d>
64: 00 c0 rjmp .+0 ; 0x66 <__SREG__+0x27>
66: 00 00 nop
68: ea cf rjmp .-44 ; 0x3e <__SP_H__>
0000006a <_exit>:
6a: f8 94 cli
0000006c <__stop_program>:
6c: ff cf rjmp .-2 ; 0x6c <__stop_program>
AI: That is a documented feature of avr-libc. Please read manual how to use built-in avr-libc functions.
Maximal possible delay is 262.14 milliseconds if you are running with 1 MHz clock.
As many say, it should switch to less accurate version if larger delays are called, but that is according to modern documentation, which may not apply if you run an older compiler suite. Also many compiler defines and optimization settings affect which version of delay functions are actually used.
In reality, the solution for your problem is easy and has been in use for more than 15 years; for example, write a function yourself that calls 1ms delay in a loop so you can have any amount of 1ms delays you want. The functions given in the library were originally meant for short delays of up to 255 loops of 3 machine cycles or 65535 loops of 4 machine cycles and these were just extension wrappers around them.
Since you say the MCU simply restarts, then you have the watchdog left on, and you need to disable it, or at least keep resetting the watchdog before it resets the MCU.
EDIT:
It's NOT a software or watchdog issue. It's a purely hardware issue caused simply by not using a resistor for the LED.
With the new info given that MCU resets only if a red LED is driven from a GPIO pin without a resistor is that depending on capabilities of the power supply and amount of bypass capacitace, turning on a red LED with less than 1.8V forward voltage will eventually discharge the supply voltage below the level of MCU working properly and the brown-out detector resetting the MCU because it does not have enough voltage to run. |
H: Getting started with STM Nucleo boards. Mapping from processor pins to board functionality (like LEDs)
Please tell me if there is a more appropriate group!
I'm just starting with STM developmeent using STM32CubeIDE. I have a background in programming (C#/C++/C) on the desktop and some minor experience in electronics. I am able to follow along simple labs like "Blinky" no problem.
HOWEVER, I'd like to know a little bit more about what is going on with the labs. For example, this step:
"In this example we are going to use one of the LEDs present on the STM32C031
Nucleo board (connected to PA5 as seen in the schematic below)"
I did this fine, but how would we know that PA5 is connected to the LED? Where is the schematic showing how the various pins and outputs from the chip are connected to the NUCLEO board? As a specific example, my board is the NUCLEO-C031C6 which I believe means that the processor its the C031C6. I have reason to believe there is only one user available led on the board, BUT I fail to see how one would know that PA5 is the correct GPIO_Output to use. Why not PA4, PA6, etc. And on more powerful boards, I believe there are more than one user led available correct? It would be fun to redo or extend the lab to use other leds.
I have done research and have found:
https://www.st.com/resource/en/user_manual/um2953-stm32-nucleo64-board-mb1717-stmicroelectronics.pdf
but I don't see a diagram linking the processor pins and outputs to the board peripherals.
As you can probably guess, I'm curios how to figure out what is available and which outputs to use, for a more advanced board, not just the NUCLEO-C031C6. I feel like there is some systematic way I'm missing....
Bonus question. The board I have actually says:
NUCLEO-C031C6
NUC031C6$KU1
What extra info, if any does the second line with the "$" give?
Note, I believe the C0 series is just a more limited version of the G0 series. Hence my picking stm32g as a tag.
Thanks!
UPDATE: I do see on the IDE itself, if you pick the board number to start the project and say "Yes" to map peripherals, it will show you how some (all?) of the pins from processor are wired to board. Thanks to @justme to point this out. However, the question still remains, is there a document showing how the pins are mapped from processor to board?
AI: Generally, you look at the board schematics and then you control the pins where LEDs happen to be.
The document you linked does not have a schematic, however, it has a section called "LEDs" where it is listed that one of the LEDs is on pin PA5. Try doing a search on the PDF.
For the boards made by ST, the examples are written to work on the ST boards, and CubeIDE comes with CubeMX which allows you to start a new project on a specific board so the IO pins and peripherals are already mapped for you, so you don't have to look at the board schematics and configure the IO pins and peripherals according to the hardware. |
H: Turning on a transistor if one voltage is higher than another
I would like transistor Q1 to turn on if V1 > V2 with a maximum tolerance of about 0.5 V.
I want to feed the entire circuit with 5 V. Which operational amplifier do you recommend?
And how should the circuit be wired?
simulate this circuit – Schematic created using CircuitLab
AI: You want a comparator (not an op-amp!). Unless you follow it with an inverting stage (as shown below) you want to connect V1 to the '+' input and V2 to the '-' input.
You want to choose a comparator that will work on your available power supply, and whose common-mode input voltage range with your chosen power supply voltages matches V1 and V2. You want one with a push-pull output that's capable of supplying full base current to the transistor, and can swing close enough to the positive rail to actually supply current.
Your choice of a \$100\Omega\$ resistor and your statement about a 5V supply implies you want 50mA to the base of the transistor -- this is a lot to ask from most comparators, and will severely restrict your choices. So you may want to boost the current with a PNP-based inverter:
simulate this circuit – Schematic created using CircuitLab
Note that R2 and R4 are kind of optional here -- they make sure that Q1 and Q2 (respectively) turn off quickly and reliably. R4 is definitely optional if the comparator you choose has a rail-rail, push-pull output. If you choose a "superbeta" transistor at Q1 then R1 can be higher yet. With that \$2.2\mathrm k \Omega\$ resistor at R1 that I called out, you need a comparator that can sink 2mA.
So you need a comparator that can:
Operate off of 0 and 5V
Has a voltage offset of less than 0.5V (it'd be a poor comparator that couldn't match this).
Can sink 2mA -- this is moderately low, but you will find parts -- especially ones called "micropower" that can't do this.
Your schematic calls out a \$100\Omega\$ base resistor. This is way way lower than you need for the load you've called out for that transistor (and lower yet if you reduce the current to the LED to be within it's capabilities.
Also, you've chosen an LED that generates 90 mcd of light with 10mA of current. There are easily-available (in the US and Europe, at least) LEDs that generate 100 times that much light for the same current. If you did some shopping and chose a brighter LED there, you could use a higher resistance at (your) R2 and R1, or you could just drive the LED directly from the comparator, probably with less than 1mA of current. |
H: understanding the slew rate step of implementing gm/id method question
I am trying to follow method descibed in the article bellow.
we need GBW=100MHz SLEW_Rate=50 V/us Load=1pF
In step "A" they try to find Width of NMOS we have the plots
Gm/Id Vs Id/W, ft vs Gm/Id, gm /gds vs gm/Id for L = 180 nm
Gm/Id=GBW/SR=12.6 So when we go to Id/W vs Gm/Id plot we get that
Id/W=17.3
Slew rate units is Volts/seconds why they put 50u instead of Id in equation 5?
W=Id/(Id/W)=50u/17.3 \
https://www.researchgate.net/publication/334010793_A_GmId_Based_Methodology_for_Designing_Common_Source_Amplifier#fullTextFileContent
AI: The load capacitance is 1 pF. In order to charge that capacitance at 50 V / microsecond, a current of 50 μA is required (this follows from the branch consitutive equation for a capacitor, viz. \$I = C \frac{dV}{dt}\$. M1 obviously cannot carry less than zero current no matter how hard you cut it off, so the capacitor's charging current is limited to the drain current of M2.
Slew rate units is Volts/seconds why they put 50u instead of Id in equation 5?
Because 50 μA is Id. They know current density and they know the current, so that's how they get the width. |
H: NOR gate turned into a LED killer
I'm trying to build a simple NOR gate, but I've accidentaly made it so that whenever all the switches are off the LED is on, but when I close one of the switches, the LED simply dies.
This is the circuit I have:
simulate this circuit – Schematic created using CircuitLab
I figured that I might need a resistor at NODE1, but when I do use a resistor, the light gets even brighter when I close one of the switches.
AI: The circuit isn't the problem. The transistors I was using were fried. Changing them for different ones solved the issue. |
H: Get Motor RPMs from Resolver Signal
everyone.
I have a servo motor that outputs a resolver signal (sine, cosine, and reference). Each of the three signals is a differential pair (+A/-A, +B/-B, etc.). And the three signals are encoded using an 8 kHz carrier signal. Below is a plot that I made from an oscilloscope data capture.
The plot shows the sine (A) signal only. I took the difference (+A - -A) to reduce the noise. The three colors (red, blue, green) represent measurements at three RPMs: 10, 20, and 40, respectively. The bands, or what look like bands, are actually the envelope functions. If you zoom in (see small breakout plot above the larger plot), you can see that each band is composed of a higher frequency (8 kHz) carrier signal. The 8 kHz frequency does not change with motor RPMs, but the phase between the sine and cosine signals does change with each zero-level crossing. My understanding is that this is a normal way to encode resolver data.
My question is this: What is the best way to extract the RPMs? I do not need the azimuth, just the RPMs. I would like a robust way of extracting the motor speed, and I would prefer simple solutions over complex solutions. I have an idea of how to do it, but I want to make sure I'm doing this is the best way before I burn too many more calories on this.
Thank you in advance
Edit: My current strategy is to demodulate the signal with a diode and a low-pass filter. Then digitize it using a LM311/Schmitt trigger, and measure the frequency using a Teensy 4.0 microcontroller. I would like accuracy in the 1% range or better. As for resources, I can design and build SM and TH boards. I have standard equipment: DMMs, oscilloscopes, signal generators, lab power supplies, etc.
As for 'simple,' sorry for the subjectivity of the word. That just means that I would prefer not to have to involve an FPGA or anything at that level. I don't want to curve-fit the data to get the derivative if I can just digitize and count pulses. That sort of thing.
AI: Trigger a sampling of the A signal when the reference peaks. (pick positive or negative peak) thses peaks should be at the same time the A (also b and c waves are peaking)
Count how many times the sampled A signal changes polarity in a minute (or see howe long it takes for it to change)
You'll probably need to de-noise the signal a bit, (maybe ignore readings with low magnitude, boxcar average, etc) |
H: Using resistor to drop voltage in circuit with changing current
I have no problem calculating and understanding how to drop voltage using resistor for circuits with purely resistive loads - for example look at much current will an LED draw, subtract source and LED voltage and just use Ohms law to find out the right resistor complete the circuit.
Now I need to drop voltage from 24V to 12V for a thermostat (which can change its current draw by activating its relay) and I am trying to wrap my head around it if a similar solution using simple resistor is even possible. (Yes, I know I can use a step-down or LR.)
In my case, the thermostat draws 20mA and 100mA respectively depending on the relay state at 12V and I have a 24V PSU. Once again, if the current was constant it would be trivial, but with the current changing... what are the mechanics here?
I guess the "voltage drop" achieved by the resistor is not just a voltage drop but also a "current cap" right? Let's say I pick a resistor that would match the 20mA current draw and the thermostat is in relay off state - it should run alright. What would happen when the thermostat switches the relay on? According to Ohm's law the resistor should not let anymore current pass through without the source voltage rising, right?
I guess you get my point.
AI: A resistor has a voltage across it which is proportional to the current through it. If you double the current through it, you also double the voltage through it. If you half the voltage across it, the current through it is halved too. That's Ohm's law.
Another law that helps you understand the mechanism at work is Kirchhoff's voltage law (KVL), which tells you (paraphrased) that voltages across things connected in series all add up. So in the following circuits the voltage across all the resistors in each case must add up to 24V, regardless of their resistance:
simulate this circuit – Schematic created using CircuitLab
The other law at work is Kirchhoff's current law (KCL), which says (again, paraphrasing) the current entering one end of a two terminal device must equal the current leaving the other end. Applying that logic, we must conclude that current everywhere in the loop is the same.
In your setup you are trying to control the voltage across something, your thermostat (the blue box below), setting it to 12V, by "splitting" that into two potential differences across two "resistances", one of which is the thermostat. It looks like the circuit on the left here:
simulate this circuit
That's fine, while the thermostat is off. When it switches on (right), though, its own electrical resistance changes, and that changes the total current flowing around the loop.
Since the current everywhere in the loop is the same, changing current anywhere in the loop changes it everywhere (KCL), including R1, and that in turn must change the voltage across R1 (Ohm's law). If the voltage across R1 changes, the voltage across R2 must also change, to have the same total (KVL).
In other words, any change you make to R1, R2, supply voltage, or even adding something else across R1, will change the loop current, and that changes the voltages everywhere. It's a terrible way to create a constant 12V, when you aren't sure that everything in the loop will stay the same.
what are the mechanics here?
My somewhat trite answer is that KCL, KVL and Ohm's law are the mechanics.
There's no way to break any of those laws, so if you only have a source greater than 12V, but you want to keep the voltage across R2 (your thermostat) at exactly 12V regardless of what else is going on in the circuit, then you need R1 to also change its value as conditions elsewhere fluctuate.
There are magic resistances that do this, they are called "linear regulators". One such device is the 7812, which promises (almost) to have exactly the right resistance to keep the voltage at its output at 12V, regardless of the current state of R2, the power supply voltage, or the current in the loop. You replace R1 in the loop with the regulator:
simulate this circuit
The GND terminal of the regulator is connected to the place you call "zero volts", so it has a reference point to know if its output is the correct 12V or not, and adjust accordingly.
Its effective resistance, the one it is adjusting, is between its IN and OUT pins.
On the right, I have decreased battery voltage to 20V, and also decreased R2 (simulating the change in resistance of the thermostat, as it switches on). Consequently current in the loop has changed, but the voltage across R2 has stayed fixed at 12V. That's the 7812 working its magic. Notice how it's dropping 8V, leaving exactly 12V for the thermostat R2, in accordance with KVL. |
H: How to wire a 6-pin relay?
I have the relay described in this datasheet. I have the z-type. It has 6 pins on the bottom.
I want to control this relay with an Arduino device and all it has to do is work like a switch.
simulate this circuit – Schematic created using CircuitLab
How do I wire up my relay to function like this? Do I need to use all 6 pins? I don't understand the wiring diagram in the datasheet at all: -
I want to know what each pin on the relay does. Between which pins should I connect my load? Which pin controls the state of the relay?
AI: The white rectangle is the coil so you drive the two pins leading to the coil.
The two pins on right are both the switch contact common terminal.
The pin on bottom left is the normally open switch contact. |
H: TVS diode vs capacitor
I've gone through this link which is a similar question.
In some places, capacitors are also used for ESD purposes.
In some places, along with capacitors, TVS diodes (or ESD diodes, not sure which term is correct) are used.
Can someone tell me where TVS diodes should be used and where capacitors should be used?
AI: The difference is that ESD diodes have a much lower capacitance; this is often a feature that is advertized.
If you have slow/low-frequency signals, you can afford to put a capacitor directly on the signal line; slowed-down signal edges do not hurt, and will even be useful to prevent EMI.
But if you have high-speed signals, then a capacitor would reduce signal quality too much. So you need a diode to shunt the ESD current into the power supply rails, where it can be eaten by the decoupling capacitor(s). |
H: SPI interrupt signal
My question is based on this question over here.
I just want to clarify what is the purpose of the SPI interrupt signal. Isn't the 4 SPI clock and data lines, & chip select sufficient for the SPI interface?
Also, is the SPI interrupt signal an input or output signal?
I'm using this module. Want to understand whether the host (module) generates the interrupt or receives the interrupt from the slave?
AI: The SPI bus does not contain an interrupt signal. But an SPI target device can route an interrupt request to the SPI bus master as a sideband signal i.e. nothing to do with the SPI bus itself.
The below diagram from your MCP2210 Breakout Module User’s Guide illustrates this. The SPI bus and interrupt request are separate.
If any of your SPI target devices (ICs) have an interrupt request output, which they may not, they can connect it to the MCP2210 GP6 input.
From the MCP2210 datasheet Table 1-1, GP6 can be configured either as an interrupt input or a Chip Select output but not as General-Purpose I/O (GPIO).
The other SE.EE question you reference is about the internal interrupts within an SPI bus master microcontroller (MCU), as the SPI bus master peripheral interrupts the CPU within that MCU. That's different to what you're looking at in this MCP2210 documentation. |
H: Long Term Drift of IC
I wanted to calculate Long Term Drift of output voltage of an IC and in datasheet the value is given as 60 ppm/√kHr. I dont know what exactly this means as there is square root of kHr. Can anyone pls help me for 3000 hours what would be the long term drift of this IC? attached is the graph from datasheet.
AI: Not a clear way to notate it, but my interpretation would be:
kHr = kilo hours = thousands of hours of active use
total drift = drift rate 60 ppm/√kHr * √time = 60 ppm/√kHr * √3 = ~104 ppm
The manufacturer seems to expect the long term drift to follow 1/sqrt(x) pattern. That may be through the part stabilizing or the errors to counter each other. Looking at the data, it is would be difficult to claim such, possibly due to counter measures in place within the IC.
Why at least one value in the data set is out of the spec - the spec might mean that 1 or 3 or 6 sigma limit of the full data set is at the specification, so 68.3 / 95.5 / 99.7 % of parts comply. |
H: Watt to amp-hours of AC device
Please help me understand the calculation in this table. The writer has a 12V batery connected to a 12V/110V inverter connected to standard house-hold AC appliances.
The calculation for the 1000W induction stovetop is:
1000W/12/0.85=98. 98*0.75h=73.5Ah (where 0.85 is 15% power conversion loss.)
Shouldn't it be 1000W/110V/0.85=10.7. 10.7*0.75h=8Ah?
AI: If you were running the stove-top from AC you would use 120 V to figure the current, but they are calculating the Ah drawn from the battery so they use 12 V.
If you drew 8 A from a 12 V battery for an hour that would only be 96 Watt-hours, hardly what you'd expect for a stove.
So, you need 1000 W for the stove, to get 1000 W at 12 V the current would be
$$ \frac{1000W}{12V} = 83.333A$$
Running the stove for 45 minutes it would use
$$83.333A\times0.75h=62.5Ah$$
Accounting for 85% efficiency
$$\frac{62.5Ah}{0.85}=75.53Ah$$
Which agrees with their calculation. |
H: How can I recreate a circuit like the WS2812 addressable RGB LEDs without the actual strip?
I've tried googling, youtube, even chatgpt but I'm not quite finding what I need.
Can you point me in the right direction for how to create a custom circuit similar to an addressable RGB LED, where I can connect multiple outputs to the same 4 pins where I send an address along with the data such as [address, val1, val2, val3] and the specific output only sets its val1, val2, val3/outputs if its address matches? I want to drive arbitrary logic, not actual LEDs.
I know I need some kind of controller/logic gates at each output, but how/what do I need to use. I don't think I want basic multiplexing as I don't want to have many outputs connecting back to the multiplexer, rather daisy chained outputs connecting to each other.
Alternatively, is it possible to "hack" an addressable LED strip and connect to the outputs at each LED, then just control those outputs with an LED control library?
AI: If you actually want to implement a WS2812 receiver ...
In short, you program a small microcontroller to decode the input signal. It's a little tricky as the pulses are short. The signal is a long low pulse (>50us) followed by a chain of bits, each 1.25 us. Each device uses the first bits it sees, and passes on the rest. I'd do it with an ATTiny, perhaps, depending on what you want to do with the signal.
The WSD2812 datasheet shows the timing (T0H is 0.4 us and T1H is 0.8 us):
But you might well want to read this resources:
Detailed timing experiments link
Notes about newer timing requirements link
Arduino forum entry about this (without code): link
On the other hand, if what you want is something functionally similar, but with no compatability requirements ...
The industry standard for architectural and theatre lighting is DMX512, for which there is a lot of information (including public specification), many vendors, and a lot of open source code for sending and receiving, for Arduino and many other microcontroller platforms. Unless you have a reason otherwise, DMX makes a lot of sense. Not least of which is that, on being on top of RS485, it deals with distance very well, and with RDM you can do things like enumerate the listeners.
DMX is a bus of up to 512 logical channels per "universe", transmitting at 250 kbit/sec. With Artnet protocol (amongst others) you can easily send the data over IP protocol.
It's in general terms a lot better and a lot easier than coopting the WS2812 protocol. |
H: First time designing an SR latch; I'm using it to control the enable pin on my eFuse IC. Just want to know if I'm overlooking anything
I just finished designing my rectifier module that has a built-in voltage monitor IC and an eFuse IC.
Its purpose is to convert the 3-phase AC output from my wind turbine and use it to power my USB type-C charger.
My biggest hurdle with the type-C charger is that it only turns on with a hard start, and won't function from a soft start. Unfortunately, since the power is coming from my wind turbine, it's going to get nothing but soft starts.
So in order to get around this, I made this circuit to force a hard start, allowing the charger to work correctly, yet also allows a range of hysteresis (about ~1.4V) between turning on and turning off.
I chose to use a TPS3700 voltage detector to drive an SR latch, which controls an NPN transistor that switches the Enable pin (EN/UVLO) on and off for the TPS2595. The TPS3700 sets the SR latch when the rectified turbine voltage is greater than 5.2V, and then resets the SR latch when the voltage falls below 3.8V
If my TPS3700 is wired correctly(I think it is), the OUTA pin will go high when the input voltage is more than 5.2V (INA+ pin senses more than 400mV). And, the OUTB pin will go high when the input is less than 3.8V (INB- pin senses less than 400mV). I used a voltage divider to make sure the 400mV threshold voltage at INA+ and INB- pins are met at the correct time.
According to the datasheet for the TPS2595, the Enable pin (EN/UVLO) has a turn-on threshold of 1.2V and a maximum threshold of 7V. Because of this, I used a voltage divider to keep the voltage under 7V, yet high enough that it will remain over 1.2V throughout operation. I remember someone mentioned a Zener diode could be used to prevent the threshold from exceeding 7V, but I am unsure which method is better than the other.
Also, I designed my SR latch in reference to various schematics found on google, so I just chose the resistor values according to what I saw. Is there anything I'm overlooking as far as the SR latch layout goes?
Same thing goes for capacitor layout, I just want to know if there is anything I'm overlooking. I used three 220uF capacitors to smooth the rectifier voltage, and a 100nF capacitor in front of each IC to absorb noise (the datasheets said it's good to do this). Are there any other locations I should insert a capacitor?
Any help is greatly appreciated, as well as all of the help I've received in the past! Thank you!
Here is the circuit, I circled the SR latch and the transistor that it controls.:
TPS2595 Datasheet:
https://www.ti.com/lit/ds/symlink/tps2595.pdf?ts=1678518905267
TPS3700 Datasheet:
https://www.ti.com/lit/ds/symlink/tps3700.pdf?ts=1678532115159&ref_url=https%253A%252F%252Fwww.ti.com%252Fsitesearch%252Fen-us%252Fdocs%252Funiversalsearch.tsp%253FlangPref%253Den-US%2526searchTerm%253DTPS3700DDCR%2526nr%253D13
AI: One issue I see in your schematic: The OUTA, OUTB of TPS3700 need pullups because they are open drain outputs.
The other point is w.r.t FLT resistor. It seems the max voltage recommended is only 6V. Please ensure this. Since you have a voltage divider on EN pin to ensure that the voltage is lower than 6V, I am guessing that you have to do something similar here also. Also, in my view, the FLT resistor should be connected to an always ON supply not the output of TPS2595. |
H: SMD component identification: ADI "8 8A"
I'm having trouble identifying this ADI part on this board I'm working on. I'm assuming it's ADI from the logo on the left, and the text on the right just says "8 8A". I've had no luck finding this IC from the ADI package marking database and general searching. Would anyone be able to help me out?
AI: It's probably this part AD8512 JFET opamp. |
H: Weired result of Ltspice Zin measurement, Phase shift of -104°
I am trying to measure the input impedance of this amplifier to design a matching network for it. But the input impedance I get has a phase of -104° at the frequency of interest. I thought that Phase could only go from -90° to 90° how is -104° possible and where do I plot it on a smiths chart? Magnitude 31 Ohms. Thanks for helping out.
AI: Any phase angle is possible between two sinusoidal signals. For example, 180° means that they're perfectly out of phase - or in other words, inverted with respect to each other.
-104° means that power is flowing in the opposite direction than what you expected.
In general, any impedance vector pointing into the right half plane of the coordinate system means that power is flowing into the device in question, while a vector pointing into the left half plane (such as yours) indicates that power is flowing out of it.
You might've just accidentally flipped the sign of the current or voltage that you're using to calculate the impedance. Alternatively, the circuit might exhibit resonant peaking, causing it to deliver power to the signal source rather than consuming power from it.
Also note that the input impedance of this amplifier will vary drastically with the gain of the transistor. It's anything but well-defined. The 2N3904 is also extremely ill-suited to operation at such high frequencies. The DC operating point of your circuit also looks to be questionable; the transistor is likely not amplifying at all given its low collector-emitter voltage. |
H: Is the voltage / power running through an exposed Bluetooth keyboard enough to be hazardous?
Unusual question and potentially not the right forum for it. Apologies in advance.
In short, I have cracked the shell off a Bluetooth keyboard and modified it (read: Jerry rigged it) to be as light as humanly possible while still functional to type on
Naturally as this has a battery attached and power running through it to function there is an electrical hazard here
But as I'm not an electrical engineer I simply don't have the experience to quantify the following:
Risk of potentially dangerous voltage being exposed to me through contact either via typing on it or picking up the exposed back / touching board etc
Risk of shock being transferred if I were to place this on a conductive surface such as a metal table that could be dangerous to my health and safety
Modification where everything is clearly exposed
AI: The risk is not electrical shock, the voltages are not hazardous, but the real risk is that it is a fire hazard.
The problem is the battery and battery wiring. Lithium batteries are not safe to be used like that. However they seemed to be taped on cardboard anyway, which was not safe to begin with due to fire hazard. Unless that's your jerry-rigging.
They are now exposed to mechanical damage.
Wear and tear may damage the wire insulation or battery pack. The wires may get short circuited and depending on the quality and safety of the battery, it may or may not have short circuit protection, so the wires may heat up red hot, melt the insulation and start fires.
The battery pack may also get punctured and liquid electrolyte may leak out, and sometimes when the battery internals are exposed to air (oxygen) they may again heat up and burst into fire.
Do not bed or deform the battery pack. If you did, I suggest to disconnect it and put it into a place where it can't do any harm if it is damaged and starts to burn. |
H: How do I properly route my signal to this BNC connector on my PCB?
I am looking to use several of these Amphenol BNC connectors on my PCB.
When I look at the datasheet, my instinct tells me that I should route my signal to pin 1 and then ground the rest.
Here is the PCB symbol and the datasheet. Neither have good indicators regarding what to do with each pin.
How do I know what to attach to each pin? Are some of the pins just used as mounting support and are supposed to be left isolated?
AI: Here's how.
The centre pin is to be soldered to its trace and the common / mounting pins to the ground plane.
Here's a view of a similar Amphenol connector.
The common / mounting pins are integral to the metallic body. |
H: LM317 output too low
I am trying to figure out an issue that I have with LM317 regulator.
It is producing ~ 1.7V at VOUT instead of desired 5V.
I've used this design in several other PCBs with no issues.
The schematic is following:
The layout from both sides:
Couple of observations:
Vin measures stable 12V at first pin of LM317 as well as other places of the system - F1 fuse is not damaged (measured resistance between pin 5 of J7 and pin 1 of U10 is 0.9Ohm)
Voltage at ADJ pin is ~ 0.4V while powered on
There is no short between VOUT and GND: measured resistance is 898Ohm as expected - individual resistors R31 and R32 also measure according to the schematic
5V is connected to supply of several of CMOS ICs each of which has 0.1uF capacitor near its power supply - none of the ICs are heating while powered on
Replacement of LM317 with brand new IC did not produce any observable change
I would appreciate if you could point out what may cause this behavior in my prototype and what additional measurements I should do.
AI: Based on the resistor values, there should be 0.4V on ADJ pin which you have, and there should be 1.65V on OUT pin, which you have.
The circuit works as per the schematics. The resistors are just incorrect for what you want. |
H: Module with LM7815 and LM7915 voltage regulators has 3 pins for input and output - why?
Why does this +-15 V voltage regulator have 3 pins at the input and at the output?
AI: It has two voltage regulators on board, and can handle two input voltages, positive and negative plus common ground, and has two outputs, one for the +15 V, one for the -15 V, plus common ground. The voltage regulators both need this ground to work, and you need it at the output. |
H: Are inductors used in series with power rails/power supplies for unregulated noise/ripple filtering?
I am wondering if I should use a inductor in series of my power supply rail at the input of my PCB to reduce potential noise coming from the cables connected to my PCB like this:
simulate this circuit – Schematic created using CircuitLab
And lets assume the inductor: LPS5030-475MRC 4.7mH, 110mA saturation, 26R internal, 1.1MHz SRF. And I am drawing 30mA which goes on microcontroller so there will be a frequency variation of the voltage drawn.
What I am afraid of, is the possibility for the inductor to oscillate. Each non ideal inductor has a parallel capacitor so it could oscillate. The oscillation would happen to its two terminals, and that is where we measure the oscillation:
simulate this circuit
But in my case, the inductor is not parallel to anything else. If it tries to oscillate, there will be a voltage difference to its two terminals, so wont it short itself and the oscillation would stop before it starts?
I didn't manage to find any sources of such filtering, so I guess its not wise to use the inductor to filter voltage without regulation ( aka without using the inductor on a switching power supply which has feedback), but I want to be sure.
AI: You are missing the bigger problem of the inductor resonating with the LDO regulator's input capacitance. I'm talking about the capacitance that is needed at the input of every linear and switching regulator.
That capacitance will be at least 100 nF and completely swamp any parasitic capacitance from the inductor. It can also cause a significant problem when power is applied to the raw input because it will form a resonant low pass filter and create an overshoot voltage at the LDO regulator's input that is up to twice the applied external DC voltage. This does damage regulators and it has happened to me. It will look like this: -
The Vout port connects to the LDO regulator and, the Vin port is the raw input. If I check your values (assuming a 100 nF input capacitance on the LDO regulator) I get 82% overshoot (lowest image in the picture below): -
Calculator image from my basic website. If I increase the capacitance to 1 μF, the overshoot is 54%. A 10 μF produces a 9.5% overshoot. You can test this your self using the calculator or do a simulation.
I reckon, providing you have at least 10 μF you shouldn't have any significant problems. The worries about the parasitic parallel resonance of the inductor are unfounded. |
H: GP2Y0A21YK0F Sharp IR sensor not counting below a certain distance threshold
I'm building a self-navigating robot that uses IR sensor (GP2Y0A21YK0F model) with Arduino to navigate through a terrain, however during testing phase when I put my hand closer than 7cm it bugs and doesn't detect if anything can be closer than that distance as you can see on the screenshot.
The code I am using for distance measurement:
#include <SharpIR.h>
// Define model and input pin:
#define IRPin A0
#define model 1080
// Create variable to store the distance:
int distance_cm;
/* Model :
GP2Y0A02YK0F --> 20150
GP2Y0A21YK0F --> 1080
GP2Y0A710K0F --> 100500
GP2YA41SK0F --> 430
*/
// Create a new instance of the SharpIR class:
SharpIR mySensor = SharpIR(IRPin, model);
void setup() {
// Begin serial communication at a baudrate of 9600:
Serial.begin(9600);
}
void loop() {
// Get a distance measurement and store it as distance_cm:
distance_cm = mySensor.distance();
// Print the measured distance to the serial monitor:
Serial.print("Mean distance: ");
Serial.print(distance_cm);
Serial.println(" cm");
delay(1000);
}
AI: The sensor is rated from 10cm to 80cm; reading the graphs in the datasheet shows that you won't get usable results outside this range. |
H: How does balancing via resistors work? Why isn't it needed inside of batteries?
I am building a hobby project - a sort of supercapacitor powerbank, where I basically connected twelve 500F 2.7V supercapacitors in series. Despite these capacitors being from same manufacturer and same batch, I instantly hit the disbalancing issue, that was mentioned, for example, here, and figured out that for this kind of stuff a balancing circuit is needed.
The simplest solution is just using "balancing resistors", for example like this:
I would like to understand how this works. I found many places that explain that this is needed, but nowhere that explains how such circuit actually works.
How are these resistors actually balancing anything?
What is the current path?
The way I understand it, they are basically connecting + and - of each capacitor, which probably increases its self-discharge rate, with higher voltage capacitor having higher self discharge. Is that it? Is this how it "balances" them? By discharging more charged capacitors faster than others? Is there some other path of current that actually does balance them (eg. moves charge from higher charged to less charged)? Can someone explain this balancing in simple way?
Also if balancing of power sources that are connected in series is so important, why is it not implemented inside of batteries that consist of multiple cells? For example, a 12V battery contains six individual cells connected in series, but there is no balancing circuit for them, yet they remain balanced and don't explode or catch fire over time. Why is this different from connecting two same batteries in series? I found that batteries suffer from same problem as capacitors and should be balanced when connected in series.
AI: What you might be missing is the fact that the leakage resistance of one super-cap might be 1 MΩ whereas for another, it might be 9 MΩ. So, if you connected these two in series across a 5 volt supply, the voltage on each would start off equal (balanced by their respective capacitances being equal) then drift away from each other as determined by their individual leakage resistances.
In the example I gave above, you would end up with 0.5 volts across the capacitor with 1 MΩ leakage resistance and, 4.5 volts across the capacitor with 9 MΩ leakage resistance.
So, the added external resistors are present to equalize the leakage resistances.
Also if balancing of power sources that are connected in series is so
important, why is it not implemented inside of batteries that consist
of multiple cells?
It is on cells that are extremely vulnerable to over-charge scenarios i.e. lithium cells. For lead acid cells, it's not so important or critical.
Mini calculation based on external balancing resistors of value 100 kΩ
If you placed 100 kΩ resistors in parallel with the super-cap with 1 MΩ leakage resistance it's net leakage would be 91 kΩ. For the super-cap with 10 MΩ leakage, the net value would become 99 kΩ and, across a 5 volt supply you would get: -
2.395 volts on one super-cap
2.605 volts on the other super-cap
This is a much more balanced scenario. Of course, an active balancing circuit would make both super-caps have very nearly the same voltage across them but, that's quite an expense to go to and, best left for the guys trying to balance hundreds of series super-caps (there are a few applications). |
H: Multichannel voltage measurement system
I have to make a simple system that measures the output voltages from a power supply. In total there are 8 voltages from 3V to 32 V to measure. The system is based on an STM32 microcontroller. The sampling frequency will give very low, say around 500Hz.
The analog input (the measurement input) will be very simple, a simple resistive divider and then directly into the ADC.
Can I safely use the internal ADC of the MCU (single internal ADC + AMUX) or is it better to use an external ADC?
Between the resistive divider and the ADC, is it necessary (advisable) to use an op-amp as a buffer?
In the system, I have two DC-DC power supplies available, one at 3.3V and one at 5V. For the analog part is it better to use the 5V directly from the DCDC or is it better to insert an LDO that brings the voltage to 3/4V? Is it better to have a higher voltage but directly from a DCDC or a lower voltage but from an LDO?
AI: Q1/2 "Safety" is a very variable thing, and really a better question is will my circuit survive all reasonable faults/circumstances?
You can use the internal mux, that's what it's there for. You could put an external opamp to act as a buffer, but that might be overkill. The main concern I would have is an over-voltage transient causing damage to your uController, so you could add a transient suppression diode to limit this.
Q3, you haven't said why you might want one over the other. What are you concerned about? Typically you might choose to limit the number of regulators to bring down the cost and increase the overall efficiency, or you might want to add an LDO to get a lower noise supply in order to improve your measurements. |
H: RC frequency for PWM signal
I have recently read this project and would like to ask for some clarification regarding this statement/calculation:
"The values shown work well an operating frequency of 1.95KHz or 13 bit operation with 8192 steps (2 to the power 13 = 8192)."
It filters the PWM signal with R and C, but I do not understand the reasoning behind it and the calculations made.
I know the 1/2piRC cut-off frequency ... but I don't understand what it has to do with the '13 bits' he talks about.
AI: The program uses the ATMega328's "fast PWM mode 14" mode on a 16-bit counter clocked at 16 MHz (on this hardware.)
From the source of the linked project:
TCCR1A = (1 << COM1A1) | (1 << COM1B1) | (1 << WGM11); // Fast PWM mode
TCCR1B = (1 << WGM12) | (1 << WGM13) | (1 << CS10); // Fast PWM mode, no clock prescaling possible
OCR1A = 3240; // Start PWM just below MOSFET turn on
ICR1 = 8191; // Set the number of PWM steps
With this mode, the basic frequency of what we're counting is fixed at 16 MHz. We count 8192 clocks which controls the period of our output. The middle transition is controlled by OCR1A, giving a duty cycle effectively OCR1A / ICR1. As there are 8192 possible time slots to change the phase, we have 13-bit resolution of the duty cycle.
The calculation is 16 MHz / 8192 ≈ 1.95 kHz. The alternative mentioned is 16 MHz / 256 ≈ 62.45 kHz, where 255 is used as the ICR1 value. There is no reason you couldn't use any value you liked, including for example 99 or 999. You choose it according to how much precision you want of the duty cycle, and trade that off against a slower frequency.
Once you have the frequency of the output, you adjust the RC network to smooth it appropriately.
Of course the ATMega 328 datasheet covers it (section 16.9.3), but it's terse, and you may find this post at wolles-elektronikkiste.de or a very similar one at Wellys helpful. |
H: Approach for programmable power supply that provide positive and negative voltage
I want to design power supply that output sweep from positive to negative voltage for dc motor parameter estimation. About +-12V 5A.
Are there any approach for this kind of application.
I have some concern as following.
I try to avoid using relay to switch because it disconnect the load.
I preferred single supply so I can use any SMPSU to powered its.
AI: Are there any approach for this kind of application
A H-bridge controlled via pulse width modulation can take a supply of (say) 12 volts DC and produce an effective output ranging from +12 volts to -12 volts DC for a floating load such as a DC motor. This to me would be the simplest method.
Of course, both terminals of the DC motor would be used so, if one terminal cannot extricated from (say) ground then, a H-bridge may not be so easy.
Effectively, you're not designing a supply (more complex) but using an existing power supply and adding control functionality to its output.
Using a H-bridge with PWM to control the voltage and polarity of a load: - |
H: How to implement a 2-layer PCB antenna on a 4 or 6 layer stack-up?
I am new to antenna designs. Lots of design guides mentions that no ground is required on the second layer (antenna on the TOP layer, IFA or MIFA for example.)
I'm wondering to how to implement a 2-layer PCB antenna (MIFA) design for example on a 4 or 6 layer stack-up (prepreg + core) PCB.
Should I simply not do ground pouring from 2nd layer of the stack-up and then tuning since the dielectric material (prepreg and core) are slightly different?
AI: As you already know, no ground plane needed underneath the antenna.
All you need to do is,
Copy the existing antenna design (with exact dimensions) to the top layer,
Remove all the copper that drops under the antenna on the remaining layers.
Good thing is that the PCB thickness is unimportant here. So it doesn't matter if the PCB is 1.0 mm or 1.6 mm, or if it has 2 or 16 layers. As long as you leave the area without any copper you're fine. |
H: Are TO-220 and TO-247 MOSFET heatsinks compatible?
Are TO-220 and TO-247 MOSFET heatsinks compatible?
AI: Not in general, but it is possible.
While the mount-holes are approximately the same size, the TO-247 is larger than the TO-220.
The problems you will run into:
A heatsink made for TO-247 when used on a TO-220 will likely interfere with the PCB if the mount hole is lined up, as it will be too long. This can be mitigated by mounting the TO-220 higher (i.e. not all the way seated).
A heatsink made for TO-220 used on a TO-247 will likely be too narrow and/or too short to be fully effective. This could work if your heatsinking requirements are not too critical.
Edit: As pointed out in comments by Hearth, there exists heatsinks made to work with both. One Example
TO-220 Dimensions:
Image Source
TO-247 Dimensions:
Image Source |
H: Single-supply non-inverting op-amp for summing DC voltages at unity gain
Is it possible to use this single supply, non-inverting, summing op-amp configuration to sum multiple arbitrary DC voltages at unity gain?
I've used the inverting summing op-amp config on bipolar power supplies to sum AC and DC input voltages (paired with a second op-amp to 'un-invert' them) but this is my first time trying to do the same thing with a single supply, non-inverting config - and I'm struggling with how the R values are interacting.
Needs to be this config as it will be running off a single 12V supply but I don't need anything past whole number precision for the DC summing and how close the op-amp can get to GND or VCC is also not that important at this stage.
In this first example - I get the expected output. +5V at input R3 and +2.5V at input R4 gives me +7.5V at VOut.
But in the second example - if I disconnect either one of these inputs - I start getting a gain of 2x at the output i.e. just +5V at input R3 gives me +10V at Out.
How can I configure this so adding or removing outputs will always give me a gain of 1x?
Thanks
AI: The inverting summer sums current. The non-inverting summer attempts to sum voltage but the source resistances of the other inputs form a voltage divider.
If you choose the resistors so that a loss of a factor of 3 occurs then the non-inverting gain of 3 will compensate.
When a non-inverting input is removed, it must be connected to zero volts I order to maintain the voltage divider.
simulate this circuit – Schematic created using CircuitLab |
H: What is the difference between PACK- and BAT-?
I have a doubt about what is the difference between BAT- and PACK- in this battery management system available in a github project:
As I read in the datasheet of the BQ76920, the N-Channel FETs are for cell balancing and protection, and the R10 is for sensing overcurrent, so my doubt is, what is the purpose of having a connector for BAT+ and BAT-, and what is de purpose of having another connector with PACK+ and PACK-?
Is PACK+ and PACK- a connector for connection of the load and the NCH FETs and resistor R10 performs the overcurrent and short circuit as mentioned in the datasheet?
And BAT+ and BAT- is a connector for charging the cells?
So do I have to charge the battery though the BAT+ and BAT- terminals?
Thank you
AI: The BAT+ and BAT- are connected to the highest and lowest potential of the battery stack. The PACK+ and PACK- are connected to an external load or charger.
While BAT+ is directly connected to PACK+, the current on the low side connection from BAT- to PACK- is measured with a shunt resistor and can be blocked by turning of the corresponding charge/discharge MOSFET. So in essence, the battery stack is always connected to the BMS but the charger or load on PACK can be disconnected.
This has nothing to do with balancing FETs. Those switch on a resistor directly across a single cell to discharge individual cells when necessary. It appears that the IC internal balancing FETs are used here. |
H: EMF Sensors - Tri-axial Inductors vs Tri-axial Magnetometers
I took apart a bunch of EMF sensors (such as this one) and found that almost all of them instead of having a magnetometer inside, have usually three inductors. In the case I just shared, it has 3 33mH inductors, each orthogonal to each other. Here's a picture
My question: There are tons of off-the-shelf magnetometer ICs that you can buy now, such as the MLX90393SLW or LIS3MDLTR. Why do engineers of these types of sensors use the three inductor configuration instead of a magnetometer IC? Both approaches seem to have similar maximum values and resolutions. What's the deal?
AI: They are probably picking up AC magnetic fields in the ~10hz to 200kHz range (look at the datasheet to see if they define it). Typically magnetometers pick up magnetic signals lower than 100 Hz to DC for direction finding. |
H: What power supply should I use for this 12 V peristaltic pump?
I have a project I am doing where I have to control three simple peristaltic pumps with an Arduino. Originally I started with cheap $13 6 V pumps powered with 9 V batteries which only worked for a day, then wouldn't even work when connected directly to the battery. The circuit works in Tinkercad, so I assume the system failed because the pumps were cheap.
I bought nicer 12 V pumps, but now I'm wondering what battery/power supply I should use to make these things run. Ideally they'd be as small as possible. The website says that it requires "0.7 A" at 12 V, but I'm not really sure where to find a battery to match those specs.
Here's a photo of the pump:
AI: Your setup didn't fail because the pumps were cheap, it failed because 9V batteries are not suited for motors of any significant size. Here are the discharge curves for a few different brands of PP3 9V batteries under 1A loads:
Image source: PowerStream - Testing 9 Volt Batteries for mAH capacity and voltage sag during discharge
You can see that the voltage starts well below 9V and very quickly (within seconds) falls below 7V and hangs out around 5-6V before falling off a cliff after a few minutes - 4.2 minutes for the Duracell - when the battery is considered "dead". 9V batteries are very well for smoke detectors or remote controls where the current draw is measured in microamps or milliamps, but for pumps you will need something designed for high current instead of longevity.
As you can also see from the curves, the voltage is not constant over the discharge range so you will also need to figure out how you want to deliver a relatively constant 12V to your motors. This is fairly easily accomplished with a DC-DC converter that can also boost the battery voltage. Fully-integrated modules are available that require no extra parts, just be sure to size it appropriately for both the continuous current draw of your motor and the initial starting surge of up to 3x the continuous current.
The very popular 18650 lithium-ion batteries have capacities ~2000mAh, an order of magnitude higher than a 9V and can handle 1A discharge rates easily. Some of them have integrated charge circuitry or I would find a charging system compatible with your batteries. Purchasing bare cells is not worth your time or effort. Wall warts are another option if the device doesn't need to be portable. |
H: SMD inductor soldering tab termination
I'm not very expert with SMD components. When I was looking for an inductor I found this component:
The termination style is solder tab. How can this be an SMD inductor when the leads are perpendicular instead of being flat?
How are the leads soldered to the surface and not through hole?
AI: The datasheet shows it as a through-hole model. Solder tab isn't a strictly-SMD designation like J-lead or no-lead. Not the case here, but it's also very possible for big component distributors to mis-categorize parts or for the manufacturer to use a picture that doesn't match the exact configuration of the part. The dimensioned drawings on the datasheet are the truth, everything else is suspect. Screen capture from the datasheet. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.