text stringlengths 83 79.5k |
|---|
H: Determining output impedance for a pulse generator
I have a basic question about determining the output impedance of a circuit. Output of this circuit is through R6 in the Figure above. This will be an input for a data-acquisition hardware channel which has 1Gohm input impedance. Setting R7 and R6 an equal resistance, the output can be adjusted to 6V pulse.
So far so good.. My question is as follows:
If I choose R6 = R7 = 1k or R6 = R7 = 10k or R6 = R7 = 100k I get the same voltage output with different currents.
Seems as long as R6 = R7, all works if you just want to have 6V output. But it kind of didn’t satisfy me choosing an arbitrary resistor values.
So in my case which R6, R7 resistance you would choose for an optimum circuit design perspective and why? What is the basis principle of choosing the output impedance here? Is that the current drawn?
AI: The output stage of the lm290x series comparator is an open collector bjt.
R6 and R7 are simply acting as a voltage divider. If R6 = R7 the voltage at the mid point will be half the supply (i.e. = 6V) regardless of the actual value chosen between 1k and 100k.
Over this range of resistance the current through the output transistor will of change, this has the effect of changing the saturation voltage across the transistor (typically 100mV).
The data sheet (http://www.diodes.com/_files/datasheets/LM2901_03.pdf) suggests a range of 6mA minimum with 16mA typical. This minimum value would be achieved with R6= R7 = 1k0. |
H: Figuring out mininum/maximum clock frequency [VHDL]
I made my first design in VHDL with arctgs and sums and now I'm trying to synthesize it into an FPGA.
However, before that I need to understand more about:
How to discover how many clock cycles my design takes?
How can I discover the maximum (is there a minimum also?) frequency that my design accepts?
Can someone give me some guidelines please?
AI: You don't discover how many cycles it takes, you design that into the circuit.
You set your maximum clock speed target via a "timing constraint" (useful search term), and the synthesis tool will try to achieve that, or report which bits of the circuit fail to meet that timing. If you are using proper synchronous design, there will be no minimum speed.
If there are failures, you rewrite those bits so they are faster - if necessary, adding a clock cycle and splitting them across both cycles.
If you meet your speed goals with ease, Place&Route will proceed smoothly. If they don't, you go round the same loop again. |
H: Why put vias underneath an IC?
Several designs I've seen have a load of vias underneath high frequency or analog ICs. For instance, this is a part of a PCB design for a DDS unit:
Design from http://rudius.net/oz2m/ngnb/dds.htm
Note the grid of vias underneath the AD9912. This is not a particularly good example, as the AD9912 has an exposed analog ground pad and the ton of vias is presumably just for a low impedance return path to the ground plane, but I'm sure I've seen this in lots of other places too, some of which don't have exposed pads underneath.
Is this perhaps to effectively move the ground plane closer to the sensitive IC, reducing impedance further?
Apologies if this has been asked before but I couldn't find it.
AI: With non-microwave devices, it's usually to conduct heat down into the copper planes within the board, or through to the heatsink attached to the back of it. This particular DDS device is fairly watty, so needs more cooling than the top surface and the leads can provide. One of the major manufacturers has registered the term 'power pad' for the exposed bit of metal under the IC.
Many microwave devices also have exposed pads on the back, but these are usually for grounding as well, where a good microwave match needs a very close ground.
Some surface mount power FETs have an exposed pad, and this can be intended to take tens of Amps (yes, scary), which needs a good array of vias down to multiple wide tracks.
Beware, almost all ICs with exposed pads are designed for them to be connected to ground. Just a very few are not. My team have been bitten twice by components, one amplifier, one analogue switch, where the exposed pad went to the -ve rail instead of ground. Much wailing and gnashing of teeth while we waited for the corrected board to get made. Check twice before you lay your board out. |
H: Whats does "hr" mean among "V" and "Ah" in batteries?
I have a battery which indicates 12V25Ah/10hr.
What does 10hr mean here? I guess "hr" stands for "hour".
But 25Ah already means if battery is fully charged and if I load 12V 25A (=300W) to it, it should last for an hour (correct me if I am wrong).
What does "/10hr" mean here?
How many watts I can load to use the battery for an hour?
AI: It means that the battery has a capacity of 25 Ah when discharged in 10 hours. 25 Ah is 25 Amps for 1 Hour which is equivalent to 2.5 Amps in 10 Hours.
So if you load the battery with 2.5 Amps it will last 10 Hours.
If loaded with a higher current usually battery capacity decreases so that is why the 10 Hours is mentioned, it results in a higher battery capacity making the battery look "better".
How many watts: simple 2.5 Amps x 12 V = 30 Watts and that for 10 Hours. |
H: DIP package: meaning, dimensions and nomenclature
I'd like to know exactly what DIP means, since googling it gives me several outright contradictory answers.
I used to assume that DIP and DIL mean these guys only:
That is, through-hole packages with two symmetrical rows, 0.1" (2.54mm) spacing between leads and 0.300"~0.325" (about 8mm) spacing between rows. If I wanted to specify the number of pins, I'd call them DIPn, where n is the total number of pins (obviously, n is always even). I call these guys "regular DIPs".
Then I found out these guys exist, and apparently are also DIPs (I call them "big DIPs"):
Then I found out this guy exists: ("mutant middle sized DIP"?)
So, lots of questions: are they really all DIPs? If yes, how do I specify which size I am talking about? And what about acronyms like PDIP, CDIP, SDIP and SPDIP? And finally, when referring to pin number, some sources say DIP8 and others 8-DIP. Is there a difference? Also, can I always use "DIL" and "DIP" interchangeably?
Also, Wikipedia tells me SMD DIPs are a thing. What about that?
AI: DIP and DIL are synonomous.
The width of a standard DIP depends on the pin count. Low pin count DIPs are 0.3 inch row spacing. High pin count DIPs are traditionally 0.6 inch spacing. I think 22 pin and below were traditionally 0.3 inch while 24 pin and above were traditionally 0.6 inch but i'm not 100% sure on the exact cutoff.
A P or C prefix usually reffers to the packaging material. P for plastic C for ceramic.
A S prefix usually reffers to "skinny". This term is used for 0.3 inch wide packages in pin counts that would traditionally be 0.6 inch wide. Typically this is seen with 24 and 28 pin packages.
There was also something called "shrink DIP" which had a smaller pin spacing within the rows but i've never actually seen one.
Surface mount DIPs did exist but were/are rare. Most surface mount chips are SOIC or smaller.
You do occasionally see other variants (in my current project i'm using some optoisolators that come in a 0.4 inch wide DIP). If in doubt check the diagram in the datasheet. |
H: In-place programming of ATtiny85
I've been playing around with an idea for a little hand-held gaming device using a Nokia 5110 screen and an ATtiny85.
The ATtiny is programmed using my Genuino UNO as ISP.
I was wondering if it's possible/sensible to include a breakout connector on the attiny pins so I can just plug it in whenever I want to update the code, rather than having to remove it from the gaming device? I'm worried about how signals from the ISP would interfere with the other devices connected?
I used Fritzing for the very first time to create a diagram of what I'm thinking of so far (I've breadboarded parts of it with the UNO instead of the ATtiny, and I haven't actually tested sharing the clock & data pins with the 3 controllers yet! The real thing would have more buttons and LEDs!)
AI: Yes, it is very common to put a 6-pin ISP header on your board to allow the AVR to be reprogrammed in place. Even the Arduino has one of these on it.
Here is a nice application note from Atmel describing the typical pinout of the header along with some suggestions on how to make sure there will not be conflicts with the normal operation of the programming pins...
http://www.atmel.com/images/doc0943.pdf
If you plan on mass producing the board, you can even avoid needing the header by using this handy connector...
http://dangerousprototypes.com/2012/12/10/isptouch-header-less-isp-connector-for-avrs/
...or this one...
http://www.tag-connect.com/
Finally, you can connect directly to the chip itself using a chip clip like this ...
http://www.amazon.com/8-Pin-Gold-Plated-SOIC-Spacing/dp/B00DDE7N3C |
H: A question on pulse conditioning implementation
Here is the aim of the circuit from input-output perspective:
Below on the left side of the arrow are the possible input pulse train signals. On the right side are the desired sharpened output pulses.
input .............. output
0 - 100mV --> 0 – 5V
0 - 3V --> 0 – 5V
0 - 8V --> 0 – 5V
0 - 12V --> 0 – 5V
3 - 12V --> 0 – 5V
2 - 5V --> 0 – 5V
How is it possible to implement this without using a level-shifter? By using a single or maybe two opamps.
Any ideas appreciated.
AI: At minimum, you would need a selector switch, or some means of telling your "pulse conditioner" what input to expect. Otherwise your "pulse conditioner" would have to be an anticipatory system (which isn't going to happen).
Envision the simplest op-amp comparator with a switch to select different threshold voltage to determine low and high levels, as a minimum system. The op-amp would have to use power rail of at least 12 volts, to accommodate your highest voltage input. |
H: What does "frequency test" mean with regards to inductors?
I am shopping on Digikey for an inductor for use in a radio application. The frequency range I am working in will be 200kHz - 900kHz. I noticed that there is a "frequency test" column where most of the inductors have 1kHz written in (a few have 250kHz written there). The datasheet provides no information about this and I'm not sure how to interpret it.
Do all inductors behave the same over a range of frequencies? If not, can I assume that they will at least behave with consistent inductance up to 1Mhz (a reasonably low frequency)?
What does this mean?
AI: No. All inductors don't behave the same way over a range of frequencies. That's why the data sheet specifies the test frequency. Rejoice that it does specify that, some don't and leave you guessing.
The frequency range of an inductor is governed by two things, one is the core material, the other is the winding geometry.
The core material tends to have an upper frequency limit, above which it becomes too lossy to use, the effective permeability often changes as well. This is expressed either as Q, for signal uses, or power dissipation, for power uses. Materials designed for high frequency tend to have lower permeability than those for low frequency, which means that low frequency inductors will be 'better' on other specs, like inductance, and residual resistance.
As the frequency goes up, the self capacitance of the windings can start to turn an inductor into a parallel resonant circuit. The cure for this is to reduce the capcitance by reducing the number of turns, and to use fancy winding techniques that pack less wire into the available space. Again, to make a high frequency capable inductor means sacrificing inductance and series resistance. It is because of the windings issue that even 'air-cored' inductors have frequency limitations.
The specified test frequency will be in the range of 'good' use frequencies. Not necessarily at the top end of the range, it depends what equipment the test house has to hand. For high frequency inductors, the low inductance can mean that Q is very poor at 1kHz, and there is little point measuring at such a low frequency. |
H: Extra spacing between some traces and the ground plane
I have seen several designs where there is extra spacing between some traces and the ground plane. For example, see the traces between the points A and B or C and D in the following picture (this is a Raspberry Pi 2, but I have seen it on other boards too):
What is the purpose of this extra spacing?
My guesses:
Reducing ground plane noise.
Controlling trace impedance (for high speed signals).
Perhaps for some EMC reasons.
AI: I would put money on #2.
That is clearly a differential pair between A and B, referenced, no doubt, to a plane on the next layer. Between C and D appears to be a single ended signal.
That is a microstrip configuration, and if the surface plane gets too close it would change it to a coplanar waveguide with ground, which apart from changing track and gap for a given impedance, also induces (if you are not careful) propagation mode differences.
No hyperlinks - on mobile. Maybe tomorrow.
Edit: updated with simple picture.
Looking at the top picture, we have the classic differential microstrip configuration. The required clearance is beyond the scope of this post, but we do not want to couple the fields to anything other than the pair and the reference below.
If we allow the same reference to approach from the sides, we get a coplanar waveguide with ground, a very different beast indeed. I am not going to post the equations, but they are easily available with a search. |
H: Diodes in boost/buck converters?
In either dc power converters, there must be a diode. I don't understand the need for it? Would a buck/boost converter function without a diode?
Also, what is the maximum reverse voltage for a diode in both cases? Does it have to be higher than the output voltage?
AI: If you look at literature, you will find that switching converters operate by charging and discharging an inductor. The main building block is composed by an inductor and two switches, connected in such a way that one switch charges the inductor and the other discharges it.
Now, you have to give a signal to those switches, so one of them must be a controllable switch (aka transistor; usually MOSFETs are used).
The other switch is usually substituted by a diode, because its usual behavior (allowing current to flow in just one direction) is enough to guarantee the proper functioning of the device.
Anyway of course you can remove the diode and substitute it with another MOSFET. Your control logic then becomes more complicated (it needs to control two switches), bit the performances increase (the voltage drop on the diode, usualli 0.3V, is now reduced to almost 0). These converters are called synchronous converters (see here for more infos).
The maximum reverse voltage depends on the device. For buck converters the reverse voltage on the diodes is roughly Vin, while on boost ones it is Vout. |
H: convert 2.5VAC to 5V DC wave
I have converted mains from 240V RMS (330V) AC @ 50Hz to 2.5V AC using a transformer and am now trying to put the wave into an ADC that operates at 0-5V.
I am looking to convert a 1.76V RMS (2.5V) AC @ 50Hz (5V pp) sin wave into a 5V DC sin wave (5V pp), i know i require an op amp although i'm pulling blanks from my mind. Thanks for all the help. The reason is is i need to input the wave into an ADC that operated between 0-5V.
At this point i guess i need a summing amplifier that acts as a DC level control.
AI: This circuit creates a 5V peak DC sine wave.
Can someone check this circuit please. All my simulations lead me to believe that this is the solution. Thanks. |
H: Altium error: Un-connected Pin Constraint
I have a pad in a IC left unconnected. I have set No ERC on that pin in the schematics to suppress of all violations.
But I still get "Un-connected Pin Constraint" error in PCB.
How can I suppress this error in PCB editor?
AI: I could not come up with a good direct answer to the question, but here's something to consider regarding this rule.
I've personally never used this rule and from reading the documentation it appears that it is redundant anyway:
[This rule] detects pins that have no net assigned and no connecting tracks.
Basically, this rule will only find pins which have no net assigned to them. NC pins are very common, so you should instead use the Un-Routed nets rule on the PCB level.
Unconnected pins should be checked on the schematic level (run ERC before pushing changes to the PCB) and you can use No ERC to mark the pins that are unconnected by design. |
H: Can I use a Zener diode to convert 14 V into 5 V in a small-current circuit?
I'm working on a microcontroller-based device, and I need it to detect an input voltage (distinguish between zero and non-zero). When it's not zero, it can be anything between 10 V DC and 14.6V with some added noise of various frequencies. When it is zero, it will either be at GND or floating, I'm not sure yet.
Can I use a 5V Zener diode to stabilize this voltage and connect to the 5V-tolerant MCU's input? The current consumed will be however much the MCU requires, I expect it to be in the range of 1-3 mA (but I should probably see if I can find input current in the MCU's datasheet, which I couldn't so far but I'm sure it's there).
AI: I think the best thing would be to use NMOS with gate connected to 14V. The drain would be connected to 3.3V (the same one powering the IO for your microproceessor), and the source to your IO pin.
simulate this circuit – Schematic created using CircuitLab
With the Zener circuit, if the 14V is present when your micro power is not present, current will flow into the microprocessor by way of the clamp diode internal to your microprocessor IO pin. Even if the current is limited, this could cause a partial or complete power-on of your microprocessor. Best to avoid this situation.
This circuit will only turn on when VIN_14V is well above 3.3V. But when it is on, all it does is connect the 3.3V VCC to the IO pin. So if 3.3V is not present, then there is no harm, and no current will flow into the IO pin.
You might want to add a series resistor on the gate to prevent ringing.
The 100k resistor (R1) is just to make sure the node does not float high after 14V goes away. 1M may be enough if you want to reduce sleep current.
Note: I am assuming that there is enough load on VIN_14V that it will quickly decay to below VCC_3.3V. But if not, you might want to add a resistor from VIN_14V to GND to provide a path for decay. |
H: Multiplexed LED matrix resistors
I'm trying to build this multiplexed LED matrix with 216 LEDs, NPN transistors, a PIC microcontroller and several shift registers (74hc595) , however I don't know how to calculate the value of the resistors that are connected to the anodes, and also would like to know if I should add any additional resistors somewhere else.
I plan to turn on a maximum of 16 LEDs at once, like 3 columns of 6 LEDs.
AI: Since you are using so many LED’s, I will assume you are using inexpensive common LED’s. Typical LED needs about 1.5 volts across LED (look up your LED voltage at the current you choose for your LED). Depending upon the brightness you desire, you could end up somewhere between 10mA and 20mA.
Using 74HC595, looks like you will be driving the LED’s using 5 volts out. So, if LED voltage is 1.5 volts, then the resistor voltage will be 5v – 1.5v = 3.5v . . Use ohms law to calculate resistor R = V/I .
One word of caution. The 74HC595 on several different data sheets shows a maximum of 6mA output drive or current sink capability. Data sheet also shows output clamp current of 20mA, depending upon the manufacturer. If you try to get the 74HC595 to drive more than 6mA, the output voltage of the 74HC595 will begin to depart from being 5 volts.
You may want to set up one of your 74HC595 shift registers with a resistor and LED on the output to assure the performance is as you desire. In your schematic the 74HC595 will be sourcing current, not sinking current, but the data sheet seems symmetric for output current sinking or sourcing.
As you draw more and more current from your 74HC595, the output voltage will begin to droop (reduce) down from 5 volts. Also, the 74HC595 will begin to heat up some more.
EDIT : Just noticed that if you turn on ONE Column, and MORE than one Row, you will be lighting more than one LED. This puts the several LED's in parallel, and the brightness of each of those LED's will dim. Fortunately the resistor will still limit the current drawn from the 74HC595.
EDIT EDIT : Also just noted you did include your LED as 3.8 volts at 0.02 (20mA). Your resistor is going to end up near 100 ohms. That is a lot of current to ask from the 74HC595. |
H: Calculating Timer Tick STM32F4
I'm trying to use the timer (TIM4) to log rising and falling edge times from an external sensor.
I need to set the timer so that it ticks every 1µs and has a period of 40ms (so counts 40, 000 ticks before overflowing).
TIM4 has a source clock speed of 84MHz.
The datasheet says:
"16-bit programmable prescaler used to divide the counter clock
frequency by any factor between 1 and 65536".
However in most tutorials divide by 84 - 1 to obtain 1MHz. Can someone provide the exact formulas to calculate the parameters? Thanks in advance
AI: The prescaler register description states, that the input clock is divided by the register value + 1. So if your input frequency is 84 MHz and you want the timer to count at 1 MHz you have to program 84-1 to the PSC register to get a divider of 84 and thus a counter clock of 1 MHz.
The internal PSC counter is not accessible, so there is no work around for the 16 bit limitation.
Program the ARR register with 39999, the overflow will occur on the next (the 40000th edge). |
H: Comparator latch circuit
I need a VERY simple latching circuit using a comparator that will simply be off until a signal hits it (can be either + or -, I have no preference). The circuit should remain on until I reset it.
AI: You could do something like this- the comparator output goes low when the input passes +2.50VDC (the voltage set by the R3/R3 resistor divider, which turns on the LED D1 and also Q1. Q1 pulls the inverting input up to +5 regardless of the voltage at the input so the LED will not turn off. SW1 shorts out the transistor drive so the LED will turn off and, if the input voltage is less than 2.5V, will stay off when the switch is released. Otherwise it will come on again immediately when the switch is released.
simulate this circuit – Schematic created using CircuitLab |
H: r0 vs ro in transistors ac modeling?
I'm a beginner in electronics field . In hybrid and pi and T models we have a resistance called r0 or ro . What's the correct name ? Is it "r-zero" or "r-o (15th alphabet letter)". Pls give references . Different people say different stuff !
Thanks ...
AI: It's a subscripted letter O. \$r_o\$ is the output resistance of the transistor. It represents the fact that the transistor is not an ideal voltage-controlled current source. The collector/drain voltage does have some influence on the current, and that's what \$r_o\$ models. |
H: Is a linear voltage regulator necessary in AC to DC?
I was doing research on AC to DC power supplies and I came across a lot of schematics that use regulators like the one below:
credit: http://www.instructables.com/id/Make-a-simple-12-volt-power-supply/
Initially I drew out what I thought an AC to DC schematic would be and I basically did everything except including the LM7812 regulator.
Is it necessary or could someone get an equally good power supply by just using an effective transformer, bridge rectifier, and capacitors?
From the (Wiki) page it says the regulator is, "... conceptually an op amp with a relatively high output current capacity." Why this might be important, I do not know.
It seems to be the de facto standard in the AC to DC converter world and I would really like to know the importance of it.
AI: The rectifier alone produces very rough DC; it is not smooth at all and contains much of the AC signal called "ripple."
A filtering capacitor helps to smooth this out some, but the output is still not perfectly invariant.
The addition of the 7812 in this schematic, regulates that DC down to 12v, and eliminates almost all of the remaining ripple, producing a very nice and clean DC output.
There is nothing stating that you must use a regulator; and in fact, they are sometimes not used. Such as if the power supply were just lighting a lamp or operating a fan. Those "loads" do not require precise power control. But for more sensitive electronics such as digital IC's and analog chips, their supply voltage must remain very steady for correct operation. So the answer is, whether or not to use a regulator depends on the application. :) |
H: average of dBs or dB of average?
In several papers, books etc. I have encountered to expression of "average gain of the path is ... dB", now I wonder this is the average of dBs or dB of averages? The sources have not mentioned anything about their usage. Which one is used as a common definition?
AI: Strictly speaking, when taken an average of numbers expressed in dB, you should convert each one to its corresponding ratio, average the ratios, and then convert back to dB. Otherwise, as already pointed out, you would be calculating the geometric and not the arithmetic mean. In practice, however, if the values in dB are not far apart, say a few dB, then the average of the dB's will be very close to the dB of the average. Thus you can usually skip the conversion step. For example, if the values are 9, 10, and 11 dB, then the difference in the two procedures is only about 0.03 dB. |
H: BLDC Motor Driver: Justifying better design approach
When and why it is better for a design engineer to design a BLDC driving circuit using individual MOSFETs, instead of selecting a ready made driving IC to simplify the design?
Here I just do not mean to run a BLDC but also control its different parameters. For instance: Speed; which can be controlled using a potentiometer but programming seems more practical in certain cases.
AI: one of the most important points is power handling
using individual MOSFETS will give you a very wide range for how much power it can give you
for example
if your BLDC require 30 or even 50 amps to reach its max power(torque and speed) I think it will be hard to find off-the-shelf integrated circuit that can support this amount of power, usually at this case there is no escape from using individual transistors to handle this power
also heat dissipation is a big problem you must handle in your design
in case of using ind. Trans. it would be much easier to distribute the heat over multiple packages instead of one package which would be in the other case the IC
one disadvantage is the size of the final design
sometimes you need the minimal amount of components in your design, but if you will use multiple MOSFET approach you will definitely need a controller also (microcontroller as an example) |
H: What is shunt regulator in comparison with voltage reference
I know what is voltage reference but I am really confused about the difference between voltage reference and shunt regulator
for example TL431 can I use it as voltage reference ?
what is the applications for the shunt regulator anyway?
AI: The main difference between a regulator and a reference is that the accuracy of a device intended for use as a reference will be fairly good- usually +/-1% or better for tolerance and similarly good regulation and output noise level. Many regulators are only guaranteed to +/-5%, down to perhaps +/-1%. Regulators are usually designed to handle more current. Series voltage references almost always can sink as well as source current, whereas that is rare in voltage regulators.
There is a some overlap- it's quite possible to use (especially a lightly loaded) regulator as a reasonable reference, and you can certainly use a reference as a voltage regulator in some circumstances.
Most regulators are "series" type, as opposed to shunt type. A shunt voltage reference (or regulator) behaves like a very accurate Zener that requires a certain relatively high minimum current to properly regulate. For example, the cheapest variant of the LM431 requires an anode current of 1mA minimum.
Series regulators and voltage references have a minimum of 3 pins- an input, a ground, and an output. Series references are widely available, though they tend to be more expensive than shunt types. An example of a series reference would be an ADR4550. It can supply 5V at up to 10mA, which does not sound very impressive for a voltage regulator, but is accurate to +/-0.02% (+/-1mV) for the highest grade.
The LM431 is the voltage reference used in many (probably most) isolated switching supplies such as PC power supplies- tied together with an optoisolator it allows closed-loop control of the output voltage.
It could be used as a voltage regulator, similar to a zener diode, with similar limitations (plus a higher minimum anode current). Shunt supplies don't work so well when there is a lot of input voltage variation and especially when the minimum input voltage approaches the output voltage and output current is substantial. That's because the series resistor must be low enough to deliver the maximum load current plus the minimum regulator anode current with the minimum input voltage. So suppose your load could draw as much as 10mA @ 5V and minimum 1mA, and you want an input voltage of 6V-15V. The resistor can be no higher than (6V-5V)/0.011A (1mA for the LM431) = 90\$\Omega\$. In reality there are a couple other tolerances so suppose we make the resistor 82 ohms. Now when the input voltage is 15V, and the load current is 1mA, then the LM431 must conduct 121mA, which is above its rating, and dissipate 1.21W which is well above its capability, especially for an SMT SOT-23-5 type. |
H: MOSFET H-Bridge Shunt Resistor position
I am designing a MOSFET based H-Bridge to handle high current. I would like to place a SHUNT resistor in the circuit in order to detect over current. The voltage across the shunt resistor is to be read by a PIC micro controller (so the + voltage side cannot exceed 5V). The only place in the circuit i can think to add the shunt resistor is after the H-Bridge, however this means placing a tiny load on the source side of a MOSFET (as shown in image). Will this be a problem when considering the load is only 0.0001 Ohms? and is there a better place to position the shunt resistor?
AI: That is the location where it is commonly placed.
If your shunt is really only 0.1 mohm, you will need to ensure you use a 'Kelvin' connection to measure the voltage across it. You will have to connect GND of the micro controller at the bottom (GND) connection of the sense resistor, else the additional wiring resistance will swamp your readings.
You will also need to be careful about inductive spikes, and perhaps need a decoupling capacitor on the 24 V to make your whole system work. |
H: Minimizing mosfet interactions and overshoots. A case study
I'm back again with another headache of my own creation. It seems I'm constantly learning things the hard way.
Straight to the point questions:
I've noticed that my reverse voltage protection mosfet interacts with another p-mosfet switch in a bad way (yikes!). Does making the mosfets identical help with this interaction / do I want the switch to be more / less capacitive than the other?
I've made four copies of this design. One "works" and the others (that are in my opinion much more cleany routed) don't. Can sloppiness in soldering ever contribute to system performance?
Are there any easy ways to tell if a microcontroller is browning out vs resetting? (I'm thinking just scope the reset line / add a cap and see if it goes away?)
How I got here:
I'm making microcontroller switch boards. The design utilizes three mosfets:
1: Reverse voltage protection (p-mosfet)
2/3: n-mosfet / p-mosfet pair to turn on a 12V rail.
Here is the full diagram of the circuit:
It seems like a simple circuit! I have used this type of circuit all the time (minus the reverse voltage protection). I figured everything would be aok. I constructed one, and it worked as expected. All good, right? So I made three more. None of the new ones work. The microcontroller resets when the switch is thrown (brownout?). After some head scratching I got out the oscilloscope and attached the leads to the 12V rails after each mosfet, the 3v3 rail after the first regulator, and the flip signal to the n-mosfet gate:
Looks innocent enough. ENHANCE!
Uh oh. Is that a wiggle? ENHANCE!
Great. So I have a HUGE ripple going through my system. That needs to get fixed, right? I'm assuming this is part of the problem. (4V overshoot on the 12V... and a 3v3 ramping to 5v5... ouch). The 5.5v might significant because the microcontroller is rated for 1.8-5.5V? I know the controller shuts down if it's below 2v7. I'll change the brown-out level and see if that helps, but figure I should address the ripples head on.
I've researched the options.
1. Put a cap on my reset line (2V might be reading as logic low?)
Put larger caps on v_out for regulators. Currently I have the recommended 2uF, but it's not looking like it's enough?
Slow down the turn-on:
I plan on going with swapping the n-mosfet with a transistor (and maybe an rc circuit to drive as well). It's a battery operated circuit, so I'd like to save current (hence the n-mosfet). I'll watch the spec's for the mosfets to make sure I don't fry them on the way up, but this is a once/day thing so they have plenty of time to cool. Are there any tips / things I'm overlooking?
Also one other thing:
The first circuit I built has WORSE swings (on the 12V rail) but seems to hold it's own / doesn't reset. I'm unsure of whether the reset is because of brownout, or because of the reset switch (I will add those pictures soon). The reset area is a little bit of a maze, so maybe the capacitance of the wiring is helping out? Any thoughts on this?
Many many thanks as always.
Matt
UPDATE:
Sure enough, sometimes you gotta slow down. I'll let the data speak for itself:
I put a 100k resistor on the gate of the large mosfet. Slowing that down prevented squeezing the system all at once. Great response. Clear as night and day. I'm going to get started on chapter 2 of horowitz. Really should get a solid grasp on this stuff. Thanks jp!
AI: The ringing is possibly because you have long wires at your input or output, but that is not generally a problem.
Do you have a good ground connection when doing those measurements ? It is possible that the ringing is not real.
Consider slowing down the turn-on of the high side PMOS -- put 10k .. 100k in series with its gate. |
H: The ratio of the current to base vs the current to the collector
I'm doing an experiment while reading the self-study book by Kybett "electronics self teaching guide" In the experiment I measure the current to the base and collector of a NPN transistor then observe that the ratio is basically constant and consistent with the manufacturer's specs.
But my ratio isn't constant. In addition I'm having trouble locating "beta" , the ratio on the datasheet. I see one mention of "beta=10" this is nothing like any of the values from my test.
Here are my data. What am I missing?
Rb=base resistance
Vc=base collector voltage
Ib= current base
Ic=current collector
Rb Vc Ib Ic Ic/Ib
1Mohms 6.89 V 8microA 1.51mA 189
690kohms 6.25 V 12microA 2.17mA 197
470kohms 5.24 V 17microA 3.20mA 188
220kohms 1.89 V 36microA 6.57mA 182
194kohms 1.07 V 41microA 7.40mA 180
147kohms .247V 54microA 8.24mA 152??
94kohms .173V 85microA 8.31mA 97.76???
47kohms .137V 171microA 8.35mA 48.83?????
What is going on?
AI: For a collector current of 10 mA, the Electrical Characteristics state that the Hfe can be between 100 and 300 - you have about 190, so that seems fine to me.
In the last three lines of your table, the transistor is in or near saturation - the Emitter-collector voltage is very small, so the Hfe calculation is meaningless - the transistor can't possibly increase the collector current beyond about 8.3 mA.
Try the experiment again with a lower value collector resistor, or higher collector voltage, so you can get a higher collector current. |
H: Selecting a capacitor for use in feedback loop
I'm designing a DC Lab Power Supply; the voltage regulation circuit looks like this:
I'm developing the BOM, component by component, and next in line is specifying the capacitor in the feedback loop for the op amp, C1 in this schematic.
As I'm going through the selection of specific components, I've developed a new appreciation for the diversity of available capacitors and the relative complexity of what I originally thought was a pretty straightforward component type. So my dwelling on this particular component is as much for the learning opportunity it presents as the desire to pick the right item for this specific case.
My PCB is SMD wherever possible, and I'm inclined to believe a garden-variety 0805 X7R would do the job just fine. However, I've learned they can have surprising behaviors depending on, for example, the voltage applied, so wanted to get the perspective of more experienced designers.
The design of the feedback loop itself was by far the biggest time investment in the circuit overall. I had to refresh my foggy recollection of Body plots, transfer functions, op amp particulars, etc. And it took me quite a few tries to get it this right (and understand why it worked then :). So I'm inclined to think if there's anywhere in the overall where the capacitance in critical that this would be it.
So my question is: Is a regular surface-mount ceramic cap the right choice for using in this feedback loop? Or should I be thinking something a little fancier, like perhaps a film capacitor of some type?
AI: DC bias effects have already been noted (there is an excellent application note from Murata on this). This link appears to be broken; this FAQ page may be of use.
C0G, although marginally more expensive, bring other things to the table, and in a feedback loop such as yours (I am designing some right now in an interesting application switching a few hundred volts that requires a linear ramp), I want to have a part that will remain at its rated capacitance across bias, time and temperature.
C0G: No DC bias effect from most manufacturers (this has to do with the material used). This is definitely true of AVX, Murata and Johnson.
No capacitor ageing
Tempco <= 30ppm: This will be important if the power supply box heats up significantly.
Compare that to X7R and you will find that in a control loop, C0G is the best choice in a ceramic. I would not normally need to use a better part than that.
I am actually using a 1nF C0G, 50V, 5%, 0603 part from AVX (but all the usual suspects have them). |
H: finding the gain of a two stage voltage amplifier
i currently do not know how to approach this question, in terms of simplifying the circuit and which formulas to use in order to find the gain
AI: General approach
First, you must calculate the bias conditions, as any of these values will serve to find transistor parameters applicable to small signal model.
Then, you must determine the small-signal equivalent circuit, based on the hybrid model of transistor.
From the equivalent model, it comes down to solve the network to find the relationship between the output variable and input, i.e. the gain. With the same model, you can find the input and output impedances.
Recommendations
If this is the first time you solve a circuit of this type, it may be easier to start with a single transistor. The resolution principle is the same.
Draw many equivalent circuits as needed. Draw these circuits carefully.
It is very important to correctly appliques concept impedance reflection, especially in the example circuit having emitter resistors without uncoupling. |
H: How to send out 60khz signal from antenna?
BACKGROUND
In Japan there are radio-controlled clocks. Time is synchronized by 40khz (in west Japan) and 60khz (in east Japan) radio, which is broadcast from transmission towers. The signal is known as JJY:
https:/ /en.wikipedia.org/wiki/JJY
After the earthquake in 2011, the tower in the east Japan was collapsed. Time synchronization in the east Japan is affected. Hence, someone Japanese has made a simulators and shared on the Internet.
I am from Hong Kong. I have a radio-controlled watch and clock bought from Japan. I want my devices to be synchronized. There are iOS and Android app JJY-simulators. I have tried some of them. This one works well:
https:/ /play.google.com/store/apps/details?id=jp.houryo.jjyemulator&hl=ja
The principle behind is, using time from NTP server, emulating the JJY signal, sending out through 3.5mm audio port.
Now I want to implement the emulator on a Raspberry-Pi. There are some tutorials found on the Internet. Below is the one I am following to:
http://itpro.nikkeibp.co.jp/atcl/column/14/093000080/093000002/?ST=oss&P=1 (Japanese)
Instead of the source-code in the tutorial, I use this one:
https://github.com/snt/rpi_jjy_server
PROBLEM
I have made the circuit following the tutorial:
However, most of the time my watch does not read any signal.
If there is signal, the signal status is "low", and eventually the time-sync is failed. (For the Android-app one, my watch can read a "high" signal.)
Note: I am using Toshiba 2SC1815-GR transistor, 30k ohm resistors, which are suggested in the Git-hub article. And a telephone-line made antenna.
I have tried using a 9V battery replacing the 5V Raspberry-Pi power source. But it does not help.
My knowledge on electronic is very limited. Please kindly forgive me if I have asked silly questions or made silly mistakes. Could anyone please point out if I am made anything wrongly? Or, by what means could I boost the signal from the antenna?
Great appreciation for any help!
AI: "Actually does the antenna really work with only one end connected onto the breadboard?" No, not this type of antenna. What you have is a loop antenna and it creates a magnetic field. You're now using it as if it is an electrical antenna and that would work IF it was very long, for 60 kHz we're talking 1250 meters (!!!) and not rolled up like yours.
I suggest you connect the open end of the antenna to +5 V BUT to limit the current, use a series resistor of value 1 kohm or so.
If you build this then I think there's a good chance it will work.
Note how the Antenna is a coil (long wire with many turns) and both ends of the wire are connected !
simulate this circuit – Schematic created using CircuitLab |
H: Eagle-how to change footprint?
I know its basic but google just doesn't give me anything .
I have Eagle on a mac, i have a design with a few resistors, i would like to change their footprint to 0805 .
The menu is just not showing me this option to see the part footprint.
thank you.
AI: Right click on a component and go to open device. This will show the symbol and the package.
This only works with library parts that are in the lbr folder of the root eagle directory. If you have your own custom libraries you have to open the library directly.
Also when placing components using the add tool, it shows you a preview of both the symbol and the package. |
H: How do I increase the drive current from the arduino digital pins?
I'm new to the Arduino (using the Leonardo). I am working with a heatplate that gets hot when you apply power to it.
When I use the 5V Vcc pin it works fine. But when I use the digital pins I don't get enough current.
Is there any easy way to increase the amps you can get from the digital pins?
Would somebody have a simple driver circuit?
Thanks for the answer. This is my setup. I don't know exactly how much current the plate needs to get a high temperature fast, but i'm guessing in the range of 0,5 A - 1 A.
So basically, I need to use the transistor as a switch and then use another power supply for the heatplate-thingy ?
EDIT
This is a picture of how I planned to do the setup. Feedback is very much appreciated.
AI: You will have to use a transistor to drive the heatplate.
Something similar to this:
simulate this circuit – Schematic created using CircuitLab
Note that this is a simplified general circuit. Without knowing the specs of the load you are trying to drive, we can't specify which components to use.
EDIT:
Based on your info of the voltage of the load's supply and that you already have a TIP120 to switch its power, consider this circuit that I found in this site. As @Matt pointed, a flyback diode will not hurt anybody.
simulate this circuit |
H: Tradeoffs when choosing the op-amp package: quad vs dual vs single
Let's say as an example that I need to use four op-amps in my project. I don't have any super strict requirement of space and price.
Which are the parameters to take into account when choosing the package to use, beside the space occupied on the board and the total price?
What are the tradeoffs, and what are the differences in using two dual packages or even four different single packages instead of using a quad package?
Thanks in advance for every answer.
AI: With no exceptions that I can think of, using four op-amps requires that all the op-amps be of the same type. In many cases this means that some of the op-amps will not be optimal in some way. The type you would pick for an output circuit might have high slew rate, high power supply voltage capability, high drive current and be tolerant of capacitive loads, however those characteristics might be unimportant for the front end which requires (say) very low noise, offset voltage and low input bias current. So chances are good something in the performance or cost is being compromised compared to using more part types. There are many types of amplifiers that all co-exist in the market for good reasons.
Crosstalk, which others have mentioned, can take place even at DC in The form of slight shifts in offset voltage of one op-amp with the output voltage of the other- possible significant when they are operating at very different levels. Thermal crosstalk also as mentioned is also possible and can cause distortion or intermodulation.
Layout is often easier with singles or duals compared to quads, in my experience. There is little advantage in board space with quads over duals, however quads can be cheaper per op-amp (the ubiquitous LM324 is typically the same price approximately for the dual and quad so you are almost getting two op-amps for free - except board space and power consumption). Higher performance op-amps usually are not like that.
Modern op-amps include many types that have very limited power supply voltage- perhaps as low as 5V (+/- 2.5V) maximum. Parts with similar performance that can handle +/-15V are much more expensive or unavailable. So using a mix of supply voltages may make sense, which requires different packages.
I can't really answer the question about what parameters are important - every number and graph and paragraph in the data sheet and any application notes is important in one application or another, as well as other things which may be unstated or hidden on the datasheet. For example, a cheap LM324 is used in an application where one amplifier is used as a comparator, but the requirement changes and higher performance is required, so the designer substitutes a more precise type, unfortunately the substitute is a wonderful op-amp but does unfortunate things with a large differential input voltage causing much gnashing of teeth and loss of hair. The information is hidden in a block diagram on page 27 of the datasheet where series resistors and back-to-back diodes are shown but not in any performance number since they are not specified under such conditions. |
H: BJT Amplifier has different gain for negative and positive inputs
There were some errors in my old question so I decided to close it and redo it here.
I am working on a 3 stage npn bjt amplifier for my circuits class. The first two stages are common emitter stages. These are responsible for achieving the required voltage gain of at least 1800. The last stage is an emitter follower which provides for low output impedance. My group is having a strange issue when we run the circuit through cadence (a circuit simulator). Everything looks fine, we have a good transfer function the expected cut-off frequencies. However when we ran the transient analysis we noticed that the bottom peak of the sin wave at the output is larger than the top peak. We are unsure why. We checked the voltages across all of the bjt and they are all in the FAR region. Has anyone seen this before or have any advice.
Here is the diagram of the circuit we are working on. Sorry if it is a little messy since it has undergone a lot of revision.
Here is the transfer function of this circuit plotted from 1 Hz to 1 MHz. This transfer function seems to fulfil the requirements. Also if you are wondering the capacitor which goes to ground at the end of the circuit acts as a lowpass filter since out 3DB cutoff was too high. We ran the analysis without it an it did not change the problem. We also tested the stages individually and they only seem to distort the output when combined. The distortion is visible after the second stage when combined with the first.
Finally here is a picture of the distortion. This is from a transient (minus DC) analysis with a 20 uV input running at 1 kHz. See how the top peak goes up to about 69 mV where the bottom goes to -76 mV. Also note that I have tried running it with smaller and larger input voltages. We get the same issue.
Note that I also just tried to run the transient analysis at different frequencies. This does not change anything and the problem is still there.
AI: Your first two transistors look incorrectly biassed so that Ve is about (0.5*Vcc - 0.7V) in Q0, Q1 maybe slightly better.
This means (thanks to symmetry between Re and Rc (e.g.R0 and R3) that Vc is about Vcc/2+0.7V, in other words Vce=1.4V approx, and the transistor is close to saturation.
First step : run a DC analysis to confirm this for both common-emitter stages (the emitter follower is fine).
To maximise the linear dynamic range you want to maximise the possible collector swing, so as a first pass, re-bias for Vc=9V, Ve=3V, i.e. Vb = 3.7V, calculate the base resistors for that - and see if it's improved.
This gives you up to 6V p-p swing at the collectors. It's not the best you can do as you have less AC swing at the emitter therefore you can increase headroom further, but I'll stop here. |
H: Advice on wiring power supply to digital temperature controller
I'm trying to wire a power supply to a digital temperature controller. I know squat about electrics, but am following this guide - I bought the same components he used to keep it simple, but it seems that the wiring on the temperature controller is different to his so was hoping I could double check that I was going to wire it correctly before proceeding!
This is how I currently plan on wiring it:
AI: You would want to wire it just like the picture shows...
..where...
The Black wire is N or Neutral
The Red wire is L or Live
Notes:
You use a short jumper to to connect the red wire from the power input terminal to the load terminal. This is the same electrically, just maybe easier to connect...
You could switch the red and black wires and everything would work, but typically you want to disconnect the live (red) line when turning off the load so that there is no high voltage getting to the load when the switch is off. This is for safety. If you turned off the black wire, there would still be high voltage AC going to the load on the red wire, but the load would not turn on because there was no circuit.
There is no connection to the green (earth) wire on your controller, but you should connect the green wire from the plug to the green wire on the load, again for safety. That would look like this... |
H: what will be the output of the following circuit
simulate this circuit – Schematic created using CircuitLab
I want to find the value of Vo in terms of E1, E2 , E3, E4 , R.
Note that E1, E2 , E3, E4 are voltage sources.
I don't know how to proceed for positive feedback.
EDIT 1: My answer
Apply nodal analysis at V2
\${E_4-V_2\over R}\$+
\${E_3-V_2\over R}\$=
\${V_2-V_o\over R}\$
\$Vo=3V_2-E_3-E_4\$ ...(1)
Apply nodal analysis at V1
\${E_1-V_1\over R}\$+
\${E_2-V_1\over R}\$=
\${V_1-0\over R}\$
\$3V_1=E_1+E_2\$
\$V_1={E_1+E_2\over 3}\$ ...(2)
Now I need to eliminate V2 from equation (1).How can I do it.
Is there a relation between V1 and V2?
AI: Usually I solve this kind of problems in this way.
The "positive feedback" forces the opamp to deliver either +Vcc or -Vee (i.e. the positive and negative supply voltages) to its output.
So there are two cases:
Output voltage is +Vcc. This condition is held until the V+ terminal has a greater voltage than V-. So I calculate V+, V- and say "the threshold from high to low is when"...
Output voltage is -Vee. This condition is held until the V+ terminal has a lower voltage than V+. I proceed exactly in the same way as above.
One numerical example.
simulate this circuit – Schematic created using CircuitLab
Let's assume the output is at +5V. It will stay at +5V until V+ > V-, so
V+ = (Vout + V2) / 2 = V2/2 + 2.5V
V- = V1/2
The value changes, consequently, when V- > V+, so when
V1/2 > V2/2 + 2.5V
V1 > V2 + 5V
So the threshold from high to low is V1 = V2 + 5V
As for the other, when the output is -Vee (0V) the condition is
V+ = (Vout + V2) / 2 = V2/2
V- = V1/2
It will stay in this condition until V+ < V-; consequently it will change status when
V+ > V-
V1 < V2
So the low-to-high threshold is V1 = V2
So, let's assume V2 constant. When V1 raises above V2 by more than 5V the output will switch to high (Vcc). Then it has to go lower than V2 in order for the output to become low.
Of course I didn't solve your exercise, because you need it in order to understand if you understood it |
H: BLDC Outrunner Motor Windings
Is there a specific way Outrunners are normally wound? (Wye or Delta)
What are the pros/cons to winding the motor a certain way?
AI: A Wye connected BLDC motor will have a \$K_t\$ that is \$\sqrt3\$ larger than a delta connected motor (assuming they are wound exactly the same. This means that delta connected motors will run faster for a given voltage and produce less torque for a given current.
The only issue you may run into with delta connected windings is that each phase needs to be identical in resistance or you can get circulating currents that don't produce useful power (making the motor less efficient). |
H: Split a 512 bit numbers into 16 words of 32 bits using HDL
How to split a 512 bit binary number into 32 words of 16 bits using HDL?
AI: input_word[511 downto 0];
zeroth_output = input_word[15 downto 0];
first_output = input_word[31 downto 16];
...
thirty_first_output = input_word[511 downto 496]; |
H: Summing Amp Response in a Cascaded Butterworth Notch Filter
I'm having trouble with a cascaded butterworth notch filter I'm designing and was hoping to get some insight on the summing amplifier stage at the end. I'm still a student, so my question may be a bit basic. I'm trying to get a unity gain response for the filter, but the summing amp pushes the response more positive rather than overlaying the responses.
I tried an inverting summing amplifier with 1kohm resistors to achieve a unity gain, and I've generally fiddled with the resistors as much as I can to get the response I want. That didn't work, so I tried switching to a non-inverting summing amp, thinking my response was pushed upward due to the inverting nature of the original design (seen below).
simulate this circuit – Schematic created using CircuitLab
The non-inverting amp didn't work for me either. It could be because I was using bad values for the resistors in the non-inverting summing amp, so I'm looking for any insight as to what I might be doing that is causing this response to behave the way it is.
EDIT: I should add for clarity that the filter is a notch filter in the range of 77.5KHz with a B of 15KHz using a 4th-order butterworth design.
AI: It looks like both filter sections are designed with the -3dB point at the same frequency, or very close together, so this filter is doing what it should.
In the crossover region, both sections contribute to the output, so it is higher than either alone. The slight peax at the crossover frequency would be 3dB if both signals were in phase(so they added coherently), so presumably they aren't. EDIT : apparently the small separation between -3dB points, rather than phase, accounts for this peak being less than 3dB.
For a classic design without that bulge, read up on the Linkwitz-Riley crossover, commonly used in loudspeakers where you want HPF and LPF outputs to sum to unity.
I don't know what you were expecting but if you wanted a notch you'd have to separate the -3dB frequencies, then the depth of notch will depend how far apart they are, and it won't be a deep notch.
If you wanted a deep notch, one approach is the Twin-T filter which can be made as narrow as you want.
Or start by specifying the frequency, notch width (at -3dB), and notch depth you want, and research filter design techniques to meet that specification. |
H: How to derive apparent power formula for three phase AC system?
I know that the total power output of a three phase system is √3 EI cosØ
Where E and I are the line voltage and line current.
Now my question is how can one derive the apparent power equation i.e.. √3 EI
from the totalpower equation √3 EI cosØ ?
AI: May I introduce, the power triangle: - |
H: High Frequency Transformer Design and Materials
I have designed fly-backs and inductors and understand the basics about flux density, saturation and core losses. What I have never been very clear on is design of SMPS transformers. I get the concept that ideally you want to transformer to not hold any magnetic energy and instead to transfer it all, but what material properties allow this?
I’m assuming you want to have a high permittivity \$\mu_o\$ to transfer flux better but also a linear \$\mu_o\$ so there is a linear transfer of energy, what else? I have spent time over the years looking for good tutorials or information on this topic and never found anything very complete, there is a lot of information on inductors, or sometimes the application is not really clear but someone with a bit of experience can discern between true transformer design vs inductor based on if the design holds a lot of flux?
For instance I want to design an impedance matching transformer (1:3 step-up) for driving a load at ~300khz. I’m having a hard time selecting core materials, I was going to use a toroid because they are readily available but most of them are metal power instead of true ferrite. I know that metal powder “can work” but what properties of it should one look for it to be more ideal then other metal powder.
For reference I have posted images of some metal powder cores provided by Micrometals, For a high current inductor I would pick the -2 material, but for a transformer what would I want the \$\mu_o\$ curve to look like, and what is a good B-H curve for a transformer vs. inductor?
I guess my real question is, does anyone know of a book or good resource for high frequency transformer design that also goes into material property selection?
AI: I get the concept that ideally you want to transformer to not hold any
magnetic energy and instead to transfer it all, but what material
properties allow this?
This concept doesn't fit into my way of thinking. For a straight transformer with an AC voltage applied to the primary and a secondary on load, the ampere turns of the secondary (magneto motice force) is totally cancelled by the ampere turns in the primary that resulted from that secondary load. Should you disconnect the secondary load, the primary is just an inductor having an inductance determined by the core material, shape, gaps (if any) and number of turns.
To that end, for a HF transformer, you pick a ferrite material that has low losses at the operating frequency (read the material data sheets for this) and then you begin the process of determining the number of primary turns so as not to cause excessive saturation.
This means trialling an estimate of inductance, calculating the number of turns and therefore calculating the MMF (ampere turns) for the primary under no load conditions. You then factor in the mean magnetic field length (it's a core parameter contained in the data sheet) to calculate H: -
H = ampere turns per metre
Amps is based on inductance, frequency and AC voltage applied to primary just as any inductor would be. Take the peak current and multiply by primary turns and divide by effective core length.
Then go to the core parameters in the data sheet and see if the value of H is going to cause excessive saturation - i.e. use the BH curve.
If it looks like too much saturation then you'll need to increase the turns and possibly implement a gap. Same method as a flyback transformer. |
H: Proper storage of ferric cloride PCB etchant
I etch about half a dozen printed circuit boards each year at home, using an aqueous ferric chloride AKA iron(III) chloride etchant solution. As I want to minimize the costs and hassle of buying new and disposing of old etchant, I would like to know what steps can I take for maximizing the amount of boards I can etch with a given amount of etchant. I have no background in chemistry, so any suggestions are appreciated.
I prepare a certain amount of etchant solution at a time, use it until it fails to dissolve copper effectively, and finally transfer it to a waste tank awaiting disposal. Does the batch size affect the amount of circuit boards I can etch with a given amount of ferric chloride?
Is etchant sensitive to light or fluctuating temperatures while in storage?
Is etchant oxygenation beneficial or detrimental? Many vendors of the chemical and several PCB fabrication tutorials clearly state that FeCl3 etchant stores indefinitely if kept in an airtight container. On the other hand commercial PCB etching devices purposefully stir the etchant by blowing air bubbles trough it, oxygenating the solution in the process, seemingly without adverse effects.
AI: If you store Ferric Chloride in a sealed glass jar, it stays viable for years - I have some that I prepared 10 years ago and it still works fine. Just keep the jar out of direct sunlight and somewhere not too warm - mine is stored in the garage out of the way - it's not temperature controlled and that doesn't seem to matter.
You can also prolong the etchant by the way you use it. Typically you would just dip the board in a pool of the etchant, but this is not so good as it will reduce the effectiveness of the etchant as it fills with cupric chloride (remnant from etching).
The way I read somewhere (and subsequently use) is to put a small amount on a sponge (like the sort you use for washing up, though not one that you ever plan to use for washing up ever again!). Then, making sure you are wearing gloves, simply wipe the sponge across the board that you are etching. You will notice the sponge starts going green. You can keep adding small amounts more onto the sponge as it gets used up.
This actually results in a nice quick etch, and it means pretty much all of the etchant on the sponge is used up. It also means you don't pollute your jar of ferric chloride with copper meaning it stays at full strength.
Ferric Chloride isn't nice stuff in terms of disposal (well in terms of anything but etching speed really), so the alternative would be to go the safer route of using Hydrochloric Acid + Hydrogen Peroxide. This stuff is easier to dispose of as far as I know. |
H: Does the order of connections on a protoboard matter?
I am a beginner in the field of electronics. I am trying to learn about applying schematic diagrams to protoboards.
Let's say that I have a schematic depicting connections between pin #2 of a fictional IC chip, then a resistor, then a capacitor, then pin #6 of the IC.
Does it matter if on my protoboard I connect pin #2 to the capacitor first (first as in the first node of the protoboard next to pin# 2), then pin #6 (the next node), then the resistor (the furthest node from pin #2)? Ignore any other components for this example.
They are all connected by the conductive strip of the protoboard so it seems like the order doesn't matter at a basic level.
AI: Schematics are a representation of wires and elements, not the position of elements. As long the parallel connection remains parallel an serial remains serial, then it's ok. Some exceptions however exist, like RF circuits and decoupling capacitors. |
H: Is there a way to proof that you don't see the cut-off frequency in the plot?
In my previous question, I've asked something about acut-off frequency (Finding the cut-off frequency).
But in my plot I don't see those, I see the one that I find when I pick the zero and the pole ones. Is there a way to proof that we don't have a cut-off frequency in my question?
Thanks in advance
AI: I don`t know exactly what your problem is. However, perhaps the following clarifies something:
With your previous question you gave the transfer function which, however, was not yet shown inthe so called "normal form", which means that the denominator of the transfer function should be D(jw)=1+jw*b+(jw)²c.....
In your case, we simply get by dividing the whole function with (R1+R2) :
H(jw)=N(jw)/D(jw) with
N(jw)=[R2/(R1+R2)][1+jwL/R2) and
D(jw)=1+jwL/(R1+R2).
From these expressions you immediately can derive that there is one zero at wo=R2/Land a pole at wp=(R1+R2)/L.
This pole is not really identical to the 3dB cut-off but very close to the value as given elsewhere in an answer to this thread (fp=175kHz). |
H: How much power can a 20AWG USB cable safely handle?
I recently got a device that uses a USB cable (USB on one end and a power connector on the other end) as a charge cable. The device draws 16.5V, 3.65A Max. I want to extend the charge cable by using a USB extension cable. I tried using a 26AWG USB cable and it started to get warm so I unplugged it. My question is, will a 20AWG USB extension cable handle that power? Here's a link to the cable:
http://belkinbusiness.com/products/f3u134b06-usb-aa-extension-cable-mfdstp-6
AI: 2m (6-ish feet) of AWG20 should have a resistance of about 0.1 Ohm, assuming some inefficiency in cable make up and "wear and tear" over time. To and from would be 0.2 Ohm.
Which means that extension cable, in its wire, will create a voltage drop of up to:
V = I*R = 3.65A * 0.2 Ohm = 0.73V
That's probably acceptable on a 16.5V budget, as it's slightly less than the normal 5% minimum margin taken on external voltages. Most devices would/should work with a 10% margin on the external voltage.
The power dissipated in AWG20 would be:
P = I^2 * R = 3.65A*3.65A * 0.2 Ohm = 2.7W
Over a 2m cable that may just get a little warm, but should be fine, as long as the cable is made properly. That's where using USB extension cables for such manners of current may fall down a bit, because the main application 5V/2A would not account for 1/4th being lost in the cable. But, they'd have to be very old fashioned in their making of the cable for the slight warming to be seriously problematic.
One question does come up though: Why don't you just extend the power plug side with a proper coaxial power wire. Those come in current carrying capabilities up to 5A with limited voltage drop. |
H: Is it ok to connect batteries in parallel?
I've seen some questions about connecting batteries in parallel to increase capacity, and the answers all indicate that it's fine to do. But why? Isn't that creating a short if the batteries aren't at the exact same voltage? I understand there's some internal resistance in the batteries, but is that enough to make this safe?
Is there any benefit to isolating the batteries with diodes? E.g., give each battery it's own diode, with the positive terminal connected to the diode's anode, and then putting each of these battery-diode pairs in parallel?
I'm concerned entirely with off-the-shelf alkaline batteries, like AA, AAA, possibly 9V.
Resolved
No, it's not ok in general, for the reasons I described in the question (creating a short circuit).
AI: Nothing is "fine" with connecting two batteries in parallel if they aren't the same (bought the same day also). With diodes you get additional loss, because there is a voltage drop across diode 0.7V. |
H: How to create an interrupt based on potentiometer value(s)?
I am using an Arduino to power a motorized potentiometer and I wanted to know if there is a way to create an interrupt (stop the motor) when the potentiometer reaches within a certain range of values (like in one case stop motor if the potentiometer is between 1023 and 1000, another case between 500-600, and another between 0 and 100)?
I'm using the motor driver l293d, if that is helpful.
AI: The typical way that this would be handled to generate an interrupt would be to feed the voltage from the motorized pot into one side of a voltage comparator. The other side of the comparator would be fed from a settable voltage. The settable voltage level would be under software control either from the output of a D/A converter or through use of a digi-pot component. The latter is often the simplest to implement of you find an I2C controlled digi-pot.
As the motor controlled pot voltage changes it will eventually cross the threshold set by software to the other side of the comparator. This will make the output of the comparator change state. This output is used to generate the interrupt. Since the comparator threshold crossing could be either direction then it is necessary to use an interrupt input that can be configured to generate the interrupt on the positive or negative edge as needed depending on the current circumstances. |
H: Brand new soldering iron tip turns black, solder won't stick
I have a brand new soldering iron, the tip turned black while heating on my first use, and now solder won't stick to it, it just rolls off.
All the answers in similar questions here tell me to stick solder to the tip but it won't stick because the tip is black. I have never used this iron and have been unable to tin it.
I've tried cleaning with a damped (not wet) sponge as several people suggested, but nothing comes off with several minutes of scrubbing.
How do I solve this chicken / egg situation?
AI: As pointed out in the comments and other answer, you need to clean the tip.
There are two options for cleaning, depending on what you have, or what came with the Iron.
A Compressed Cellulose sponge, which has been wetted with water. You want it to be damp, but not soaking wet. If it is soaking it just cools the tip down and doesn't help clean it. If it is dry, the sponge will burn, putting more crap on the tip.
Image from here
A Brass Wire cleaning sponge. These are not the same as steel wool. Steel wool is an abrasive which will damage the tip (as will sand paper). The tips are made internally of copper which is great for heat transfer, but will be damaged/dissolved by the tin in the solder. To allow the tip to work, it is plated with Iron which will withstand the soldering process, and is key to ensuring the tip can be used. This plating is thin and can be easily damaged by abrasives, or scratching against things. The brass wire sponges are not abrasive, they are like the scrubbing pads people sometimes use for washing up. They look like this:
Image from here
For both cases you need to do the same thing, basically just drag the tip across the sponge a few times (may only take a couple, may take a dozen, depends on how much grot is on there) at a sort of medium pace (like washing up really). You should see the tip start to go shiny and silver. Once it is, put some solder on, and then again wipe on the sponge. Finally put some more solder on (tin the tip) when not in use.
So why did it happen so quick? I can think of a couple of reasons:
There was some coating on the tip to protect it when sitting on a shelf for ages. Not sure if this would be done - if it was tinned, that should be enough, but you never know.
If it is not a temperature controlled iron, then who knows what temperature the tip is at - ideally it should be around 360-380°C, but the non-controlled ones can be anywhere, even as much as 450+°C. The higher temperature will cause the tip to oxidise from stuff in the air much faster. Hopefully you should be able to clean it off on a sponge. Then once clean always leave it |
H: Fast Fourier Transform (FFT) of power consumption signals
I want to compare two power consumption signals, i.e., how the power consumption varies throughout a day. Now I have two options:
Take two raw power signals and compute the Euclidean distance between them
Convert the input power signals using Fast Fourier Transform and then take Eucliden distance of outputted FFT signals
I was ok with the first option, but recently I remember that I read about second option somewhere. So, my question is - which option is better? and what is the intuition behind taking the FFT of input power time curves.
AI: If you take two raw signals and subtract, you will get a value that could be used to indicate the difference between the signals.
However, if you do the FFT you will lots of signal information, perhaps the power line is very noisy on one signal line. This would affect power consumption but may not be the component you wish to measure.
You could do multiple plots, say at 50Hz, 40Hz, etc. and compare.
FFT gives more signal detail than Euclidean distance. |
H: Soft-on/off circuit turns on on startup despite being jumpered to stay off, why?
So, I am building the soft-on/off circuit shown below and described here on a breadboard to test it out before I actually put it into a design.
However, to better fit the parts on hand, I decided to alter a couple of the R and C values slightly, and use a pair of TO-220 FETs instead of the SO-8 dual FET, resulting in this:
simulate this circuit – Schematic created using CircuitLab
which yields the simulation results below when turned on without RL connected (NFG tracks Vout in both plots, so it's not shown):
and with RL connected for a 10mA load at full Vout (PFG, Vin, and PB track each other here):
However, when I prototype the same circuit that's in the simulation, without a load, I get this gem of a result on power-on:
Along with that, Vout comes up to a steady 12V, tracking Vin. What in the world could I have done wrong here? Is the circuit given really that sensitive to part selection? Or how could I have miswired it to produce the results I'm receiving? And where on Earth is that 370us pulse on PFG at startup coming from?
AI: Summary from comments: I think you need a load for this circuit to work.
Shamelessly taking credit for this, here is an answer for you to mark :)
You should also take a look at Linear Technology's line of push button controllers. They are very low power and have worked well for me in the past. |
H: Is there any reason to prefer one MLCC manufacturer over another?
I'm specifying some SMD chip capacitors for the first time and I note there are several manufacturers out there: muRata, Yageo, Vishay, AVX, Kemet in particular, perhaps others.
Is there any good reason to prefer one of these manufacturers over the others for chip capacitors?
They all look the same from the pictures, of course, and the prices seem to be quite comparable. Are these just a pure commodity or are there real differences? If there are differences, how would one typically go about discovering them, other than "asking around" like this? :)
AI: In the good old days, with low k dielectrics like NP0 and X7R, you could well have expected caps to be reasonably interchangable. In low value, <100nF ballpark, this is probably still the case.
Now, with new high k X5R and Y5U types, which are pushing capacitance per volume to eye-watering densities, and temperature and voltage coefficients exploring the worst the market will accept, things are different. The dielectric code, X7R for instance, defines the temperature coefficient, not the voltage coefficient. A Y5U from two different manufacturers might have two different voltage coefficients. A Y5U range of capacitors in the same range from the same manufacturer might have caps with the same value with different voltage coefficients in different package sizes, as they try to cram a given value into a given package or voltage rating.
If a parameter matters to you, test it. If the capacitance stability matters to you, get the manufacturer's voltage and temperature coefficient specification for that cap value, voltage and package size as well. If they don't make this available, don't use that manufacturer. |
H: Consequence of uncomplimentary MOSFETs in Hbridge
I am constructing my own H-Bridge to control a high current motor (24V at 25A), as such I was looking to use high current MOSFETs for each quadrant of the H-bridge. My go too MOSFETs for these applications is the IRF1405 unfortunately the manufacture for these MOSFETs do not offer a complementary P-channel equivalent. What will be the consequences of using a P-channel MOSFET which is not exactly complement to the N-channel MOSFETS in my bridge.
Also does anyone have a suggestion for a complementary MOSFET pair which has similar specifications as the IRF1405? (RDS = 5.3mOhm ID= 169A)
The P-channel replacment I am considering is the IPB120P04P4L.
I have attached an image of my proposed H-Bridge for your reference.
AI: In my opinion you would need complementary transistors only for more linear/analog applications like in a (audio) power amplifier.
In an H-bridge you're using the MOSFETs as switches, they're either on or off. I would prefer to use FETs with the same Rdson (on resistance) though although as long as Rdson is low enough that might not even matter.
I would also pay attention to the threshold voltage but also here different Vt for NMOS and PMOS would not matter so much if you drive them properly with a large Vgs (which you should to make Rdson low).
So I would just try to find a suitable PMOS that can do the job and not worry about it not being complementary to the NMOS. |
H: How to plot "voltage drop" across a specific component in LTSpice?
In the above circuit I can only be able to plot |Vr1+Vc1| = V1 in green plot and Vc1 in blue plot. I use the voltage probe in LTSpice and click on the lines to obtain the plots. If I click on the line between V1 and R1 it plots |Vr1+Vr2| = V1. If I click on the line between R1 and C1 it plots Vc1.
Is there a way to see also Vr1 (the voltage drop only accross R1) along with the others?
AI: Click on the left side of the component (cursor will be a red probe before, then turning gray), drag over the component to the right (cursor will be a black probe), then release the mouse button.
Now the graph shows something like V(N002,N003) which is the voltage between those nodes. If you know the node names you can also manually enter these expressions into the graph view, or move things around or do calculations there. |
H: Auto start and stop water AC motor using these two circuits
Problem:
I have a AC motor (pump) which pumps water from the ground floor to 4th floor. On 4th floor, I have water tank. The problem is I have to start the motor in 5AM in morning. I have installed a water alarm buzzer which beeps when tank is full. I want to automate this using some circuits.
Solution: Automatic solution which will start motor at 5AM daily in morning. There is no automatic turn off (based on time). Motor will stop automatically when water tank is full.
I have purchased Two items
Daily Weekly Programmable Electronic Switch.
http://www.ebay.in/itm/Daily-Weekly-Programmable-Electronic-Timer-Switch-220V-AC-16A-MCB-Digital-Relay-/191748990517
Water Level Controller.
http://www.ebay.in/itm/Water-Level-Controller-Tank-Level-Controller-Works-On-12VDC-AC-/111819716037
There first device has capability to turn on motor at scheduled time. The second circuit behave differently. Second circuit start motor when water is below certain level and automatic switch off when it certain level.
Can i use these two device and create something which I want ?
May be I need to purchase some more circuit/devices. Please help to guide to make this hack.
final thought : I want, my AC motor pump to auto start at 5 AM in morning and automatic switch off when it full.
I do not need any other kind of logic that if Water is below at certain level then auto start motor. Because, there is no use to start even if water is below certain level because in my area water supply happens only for 4AM to 6AM.
I am software guy and understand basic electronics. Solution like have a Pi board or use GSM kind of things will not be helpful, because I want a minimum solution for my problem and not a fancy luxury solution like (app controlled switch etc).
I searched a lot on Internet and found these two cheapest circuits which can help me.
Let me know if you know any other cheaper way to achieve my goal.
I have purchased first device in $13 and I am going to buy second circuit in $4.
Thanks
========== Update 1========
After reading answers, and with my limited understanding on electronics, I have created this circuit picture !
Let me know If I want need to add extra resistors or this circuit will blow my house !
Image attached here.
AI: You can wire outputs from each module in series, so you'll get the AND function. Thepump will start if the time is in the interval AND if water level is below AND not at higher level. You should use this signal to control a contactor (not directly as depicted) and you put a circuit braker for pump, yet better to use motor protection switch. But this isn't a very stable solution. Better would be using floating switches - it's a switch that is anchored in the tank, when water level falls (or rises) the float switch is inclinated so it switvhes the contact. With latching float switches with relays you can obtain a simple and durable solution.
simulate this circuit – Schematic created using CircuitLab
simulate this circuit |
H: critical inductance value when designing a buck converter
From the formula used in this literature from Texas Instruments
http://www.ti.com/lit/an/slva057/slva057.pdf - Page 15
Here are my requirements:
Vo-Output voltage(v) 98
Vi(max)-Maximum input voltage(v) 120
Ts-Time period(sec) 0.000001
Io(crit)-Minimum current to maintain continuous conduction(A) 0.1
Calculating the inductor value i get it:
L(min) 8.98E-05 H
So am i correct in assuming that any value of inductance above L(min)will ensure BUCK operation in continuous mode?
If that is the case ,can i remove the catch diode/free wheeling diode,without causing damage to my MOSFET during operation?
AI: Operating in continuous mode doesn't mean you can forget about the diode - how will the inductor remain in continuous conduction when the power transistor switches off? It relies on the diode for circulating the stored energy into the capacitor. |
H: Symmetrical components: phase voltages
In the following question on symmetrical components, the 11kV of the source is the line-to-line voltage. When using symmetrical components you want to be working with line-to-neutral voltage. Am I right in saying this? In the memo for this question the 11kV is devided by squareroot 3 in order to obtain the phase voltages. Initially I used the 11kV without dividing by squareroot 3. How would I determine which path to follow (divide or not by squareroot 3), by looking at this question? Is there a standard which I should always follow, or am I missing key words in the question which tells me exactly what to do?
I am fine with the rest of the question, I'm just confused in determining the phase voltages. Thank you
"A 11 kV source delivers power to a power
system with terminal voltages at rated value.
A fault occurs in the source and it causes the
b-phase voltage Vbn of the source to fall to
zero (not an open circuit). With the a-phase
voltage Van of the source as the zero
reference, calculate the sequence network
voltages V0, V1 and V2."
AI: Usually when talking about 3 phase machines, the voltage is indicated by line to line.
It is easy to remember this because the terminals that are accessible by the operator are a, b, and c. So a measured or applied voltage would only be between a-b, b-c, or a-c. Which is line to line. |
H: Is it safe to connect a USB port to a transistor to a power strip, so I can control Christmas lights with a USB port?
Okay, so a usb port has 4 pins, a ground, two I/O pins, and a (may or may not be switchable) 5V pin. I had an idea to to connect one of the pins to the base of a transistor. Then I would rip the button out of power strip, and connect the other two leads of the transistor where the switch used to be.
If I connect it to a data pin, it would turn the thing on and off essentially at random. Since I want to hook this up to a Christmas lights, that would be awesome!
If I connect it to the 5V pin, I could switch it on and off by turning the USB port on and off.
My question is, is this safe/would it work? What transistor should I use (since I'm writing the software, the software could accommodate the specific transistor if needed.)
AI: No. Nothing you have mentioned will work, and is in fact dangerous.
I strongly advise you not to experiment here.
First, the data pins on a USB port are just that, DATA. Not simple I/O. Second, the power pin is not really controllable.
And if you hook up a transistor the way you describe, you will probably destroy whatever the USB port is plugged into and the transistor. |
H: How can a powersupply have a large input volt range
I see that computer power supplies that can take a voltage input of anything between 90V and 260V at a frequency between 47Hz and 63Hz.
Meanwhile it can output power at a very precise voltage.
How does that work?
AI: It is done by magic ;-) Just kidding, it is not. It may look like a big deal but it's not actually. See the other answers, they are also correct.
The power from the mains is actually converted into MAGnetIC energy (do you see what I did there ;-) )and then back to electrical energy. Using very fast switches at the high voltage side the amount of energy that is transferred to the low voltage side can be precisely controlled. This conversion to magnetic energy also has the advantage that the output can be isolated from the mains supply so that you do NOT get an electrical shock when touching the output, I consider this is a very nice feature !
A reference voltage is made internally in the power supply's chip(s). Generating such a stable reference voltage is done using a bandgap circuit. The output voltage is compared to this reference voltage and adjusted so that it will be the correct voltage, this is called feedback. This feedback controls the circuit on the mains (high) voltage side and tells it to put more or less magnetic energy in the high frequency transformer depending on what the output voltage is doing. If the output voltage is too low: more ! If it is too high: less ! Simple as that. This feedback signal usually travels through an optocoupler (so using light) so that it does not need a direct wired connection to the mains side electronics and so keeping the isolation from the mains voltage side.
Due to this feedback the input voltage can vary over a wide range while the output voltage remains constant. Brilliant isn't it ? ;-) |
H: Is using a high sample rate on an oscilloscope ever a bad thing?
A while back i was gathering some ECG data for a colleague at a reasonably high sample rate (around 20kHz - 100Hz is enough for ECG). She came back to me and asked me to regather the data at a lower sample rate - claiming that the high sample rate was introducing extra noise.
Is this plausible, realistic, or based in truth? I can't see how a higher sample rate would make a signal worse - especially considering the data was gathered on an expensive hi-spec oscilloscope
AI: Your college does not seem to remember her statistics lessons. The additional higher frequency noise can be trivially filtered with a low pass filter, and the filtered signal might be better than one sampled at low frequency (oversampling).
Note that using a standard oscilloscope to record live ECG violates patient protection, as medical equipment requires better electrical isolation than those devices usually provide. |
H: Understanding Peak Current given in datasheet
I am using M.2 LTE module in my design. The datasheet says "The host board shall provide 2.5 A peak current." What does this mean from supply current point of view??
Also, in the power consumption table it says 1629 mW max. That makes around 484 mA @ 3.3V.
What should I consider on power supply side 2.5A or 484mA??
AI: You need to consider both. The supply must be able to provide brief current pulses of current of up to 2.5A. If you have the ability to supply 2.5A continuously then you are done. However if the supply cannot supply at least 2.5A continuously it must at least be able to supply the specified maximum average current on a continuous basis.
Take this user guide: |
H: When to use State Machines - FPGA
I've read a lot about FSMs (Finite State Machines) when doing VHDL tutorials. They are easy and I've used them a lot but I still don't understand something and can't find the answer online:
When should I use FSMs (Moore or Mealy) in my VHDL design?
For example, if I implement an algorithm (previously in C language) in VHDL, shall I use an FSM?
AI: If you have to split an operation across multiple clock cycles, you have two options : pipelining, and sequencing
Let's consider a mythical operation consisting of four multiplications , for example - where each multiplication (except the first) requires the output of the previous multiplication as one of its inputs. However the basic ideas are much more general.
In pipelining, you have enough hardware to perform every operation simultaneously, interconnected by pipeline registers. This implies four multipliers, separated by pipeline registers. It will take 4 clock cycles to get the first result (so we say the pipeline is 4 stages deep, and the latency is 4 cycles) but then you get a new result every clock cycle (so we say the throughput rate is 1 cycle). A little more info on pipeline design...
Downside : this is a large piece of hardware - 4 multipliers are relatively expensive (which is why some FPGA families offer many small multipliers as highly optimised blocks).
The alternative is to sequence each operation in the same multiplier, giving a much smaller design, but delivering a result every 4 cycles.
In this case you can use a single multiplier, storing its result in a single register, for a much smaller design.
Every 4th cycle (or whenever something else signals a new input in ready) you connect the new input to one input port of the multiplier; in other cycles you feed that port from the output register (to use the previous multiply result). And in every cycle you feed the appropriate data (filter coefficients, matrix values, whatever) into the other multiplier port. Four cycles later, you present the final result as your output, and signal to your consumer that a new result is ready.
The obvious way to sequence these operations is a state machine (FSM).
Indeed the computations can be embedded in the actions associated with each state, for example:
if rising_edge(clk) then
Done <= '0'; -- and any other default actions
case state is
when Idle =>
if Start = '1' then
Temp := Input * C1;
State := S1;
end if;
when s1 =>
Temp := Temp * C2;
State := S2;
when s2 =>
Temp := Temp * C3;
State := S3;
when s3 =>
Temp := Temp * C4;
State := S4;
when s4 =>
Output <= Temp;
Done <= '1';
State := Idle;
-- optional alternative for bombproof handshaking
-- if Start = '0' then
-- Done <= '1';
-- State <= Idle;
-- end if;
end case;
end if;
If you are interacting with other units - SPI interfaces, UARTs etc, the FSM is again usually the best method. |
H: Inferring D-latch on Zedboard within Vivado Error
I'm trying to implement a simple latch on a ZedBoard via Vivado.
begin
process(D,Enable) begin
if(Enable = '1') then
Q <= D;
Qbar <= not(D);
end if;
end process;
I'm using user I/O on the constraints for the inputs/outputs. I assign the inpus to two SWITCH Pins and the outputs to two LED pins.
The routing (implementation phase) gives me the following error:
[Place 30-574] Poor placement for routing between an IO pin and BUFG. If this sub optimal condition is acceptable for this design, you may use the CLOCK_DEDICATED_ROUTE constraint in the .xdc file to demote this message to a WARNING. However, the use of this override is highly discouraged. These examples can be used directly in the .xdc file to override this clock rule.
< set_property CLOCK_DEDICATED_ROUTE FALSE [get_nets Enable_IBUF] >
Enable_IBUF_inst (IBUF.O) is locked to IOB_X1Y125
and Enable_IBUF_BUFG_inst (BUFG.I) is provisionally placed by clockplacer on BUFGCTRL_X0Y31`
The two suggested solutions to the problem are here and setting the < set_property CLOCK_DEDICATED_ROUTE FALSE [get_nets Enable_IBUF] > works but I would like to understand solution 1
1) Move the clock input to a clock capable pin. since it seems important.
How can I find a clock capable input that I can press/move like I do on the switch?
Edit: Link of the ZedBoard pins (already tried C19 -> FMC_CLK1)
AI: What's happening here is that the tools are interpreting your Enable signal as a clock. (You can view your implemented design in the tool to check this.) If you attempt to design some asynchronous logic, the tools generally try very hard to find a clock, because FPGA timing models assume a synchronous system.
So you are getting the CLOCK_DEDICATED_ROUTE warning because the tools think the enable signal is a real clock. If it was a real clock, you would want to use the special clock pins on the FPGA that are directly connected to clock routing resources. (These are labelled MRCC and SRCC, for multi-region and single region, respectively.) But since your signals are coming from physical switches, for the purposes of your experiment the non-ideal routing doesn't really matter. |
H: Misbehaving CD4021BE Shift-in
I have a CD4021BE set up very similarly to the Arduino ShiftIn Tutorial (the main difference being that I don't currently have 8 buttons so have just connected PI-5 to PI-7 to ground with a resistor, I get the same misbehaviour if these are left floating).
All of the values that I'm getting are being shifted up 1 bit, so with 5 buttons connected to PI-1 to 4 and PI-8), pressing the one connected to PI-1 gives me the value 00000010, pressing PI-2 gives me 00000100 and PI-8 just gives me 00000000.
I have my data pin connected to Q8, which as far as I can see in the Datasheet is the right place. Just to see what happened I connected it to Q6 and get 00001000 from PI-1 and so on.
I got 5 of these chips when I ordered them and have tested 3 so far and all perform in the same way, which really just suggests that I'm doing something stupid.
This is the code I'm currently using:
#define CLK 10
#define LATCH 9
#define DATA 8
int data;
void setup() {
Serial.begin(9600);
pinMode(DATA, INPUT);
pinMode(CLK, OUTPUT);
pinMode(LATCH, OUTPUT);
Serial.println("Begin...");
}
void loop() {
digitalWrite(LATCH, HIGH);
digitalWrite(LATCH, LOW);
data = shiftIn(DATA, CLK, MSBFIRST);
Serial.println(data, BIN);
delay(500);
}
CLK is connected to CLOCK on the chip, and LATCH is PARALLEL/SERIAL CONTROL.
Why is this happening?
AI: After much further googling, I found an 'answer' of sorts. An Issue on the Arduino implementation of shiftIn() with a workaround:
There is a workaround:
If you turn the clock on before turning the control flag down, you avoid the extra positive clock transition.
digitalWrite(shiftClock, HIGH);
digitalWrite(shiftControl, LOW);
I'm not sure if this is a bug or a missing feature. The problem is that the first bit is already on the Q8 output when first positive clock transition happens in shiftIn. I think this is what is described in the datasheet as "In the HCC/HCF4021B, the CLOCK input of theinternal stage is ”forced” whenasynchronous parallel entry is made".
I added a CLK high between the LATCH pulse and it now works:
void loop() {
digitalWrite(LATCH, HIGH);
digitalWrite(CLK, HIGH); // Set clock high to catch first bit.
digitalWrite(LATCH, LOW);
data = shiftIn(DATA, CLK, MSBFIRST);
...
}
Just when I feel like I've actually started to get the hang of things I start hitting weird bugs in the libraries! |
H: Is the datasheet of the AVR ATmega32 wrong?
I'm currently using an ATmega32 to keep time, so I carefully read the datasheet and configured the Timer 1 to generate an interrupt each second.
According to the following formula on the datasheet, using a 16 MHz clock, a prescaler of 256, and OCR1A = 31249, I should get a frequency of 1 Hz in CTC mode:
\$ f_{OCnA} = \frac{f_{clk\_I/O}}{2\: \cdot \: N \cdot \: (1 \: + \: OCRnA)} \$
This formula is available on page 99 of the ATmega32 datasheet.
I've configured Timer 1 as follows:
TCCR1A = 0;
TCCR1B = (1<<WGM12)|(1<<CS12);
OCR1A = 31249;
TIMSK = (1<<OCIE1A);
Here is the interrupt code
ISR(TIMER1_COMPA_vect){
sec++;
}
Then, I use an LCD to continuously print the value of sec, and I get a timing of 0.5 seconds. In other words, for each second that passes, the timer generates two interrupts.
At first I thought maybe I got the fuses wrong, but that doesn't seem to be the case, as delays work just fine. Anyway, here's how I configured the fuses:
-U lfuse:w:0xff:m -U hfuse:w:0x99:m
I have absolutely no idea of what's going on, I've double checked everything, tried another ATmega32, tried another 16 MHz crystal oscillator, and I still get the same result.
Is the datasheet wrong, or am I missing something here?
AI: If the system clock is 16 MHz and the prescaler is 256, you timer will run on \$ \large \frac{16\,MHz}{256} = \small 62500\,Hz \$ , so there will be an increment in every \$ \large \frac{1}{62500\,Hz} = \small 16\, \mu s \$. An interrupt will be generated when the counter's value is 31249. If we calculate this time: \$ \small 16\, \mu s \times 31250\, ticks = 0.5\, s\$, which is exactly the same result you have.
The equation in the datasheet is for a different purpose:
For generating a waveform output in \$ \small CTC\$ mode, the \$ \small OC1A\$ output can be set to toggle its logical level on each compare match by setting the compare output mode bits to toggle mode \$ \small (COM1A1:0 = 1)\$. The \$ \small OC1A\$ value will not be visible on the port pin unless the data direction for the pin is set to output \$ \small (DDR_{OC1A} = 1)\$. The waveform generated will have a maximum frequency of \$ \small fOC1A = fclk_{I/O}/2 \$ when \$ \small OCR1A\$ is set to zero \$(0x0000)\$. The waveform frequency is defined by the following equation: (...)
If you would measure the frequency of specific pin, I think it would be 1 Hz.
To achieve an 1 s, \$ \small 16\, \mu s \times 62500 = 1\,s\$ interrupt generation you need 62500 ticks and as the counter starts from 0, set OCR1A to \$ \small 31250 \times 2 - 1= 62499\$, and since Timer1 is a 16 bit timer this value is not too high (<65535, \$ 2^{16}-1 \$). |
H: VHDL: TextIO, End of Line, Hread
process
variable vGoodRead : boolean := true;
while (vGoodRead = true) loop -- read till end of line.
hread (vLineIn, vInData, vGoodRead);
........
end loop;
vGoodRead := true; -- cos at End of line, it turns false
end process;
I am using this code, to read in Hex values.
There are multiple (and different no of) hex values on a single line.
This code works, provided all hex values on the line/s are correct.
My problem is, I have not been able to figure out, how to detect a case, when there is an incorrect input value, somewhere within the line.
I.e. there is FO (f, cap O) versus F0 (f, zero). The latter being valid, while the first is invalid.
Thanks for your help.
AI: If there are characters remaining in the line when you detect vGoodRead as false, then the following will print the number of characters and print the actual characters that are left in the line:
if vLineIn'length > 0 then
write(OUTPUT, "Number characters remaining in line: " &
to_string(vLineIn'length) & LF) ;
write(OUTPUT, "Actual characters are: " & vLineIn.all & LF) ;
end if ; |
H: Where is the ground/earth used in the Sparkfun Logic Level Converter
I am studying the Sparkfun Logic Level converter and the basic aim of this is to understand how these BSS138 transistors are used in logic level conversion. I have used transistors before in driving high current motors with MCU's i.e. small time h-bridge configurations. Now I want to use them to make my own logic level converters.
So went to the SparkFun GitHub repo and downloaded the eagle files. Something just does not add up in the schematics for me and I seek clarification around this.
Lets look at how the BSS138 is wired up:
The first thing that strikes me as odd is that I cannot see a earth/ground connection here seems like the low voltage side is connected to the Gate and Source while the High voltage side is connected to the Source.
However there is a clearly defined GND on both the HV and LV side of the board designs and on the schematic? See below:
I must be missing something fundamental here.I can even see how current wuld flow without the BSS138 having some sort of grounding.
AI: You are right, in that a common ground is needed between the circuits connected to each port of the translator.
However, this particular circuit fragment depicted in your diagram of the translator out of context does not involve any connections of its own to ground apart from the possible ones through whatever is connected to its ports.
Effectively, this circuit is a sort of bidirectional pass gate, sitting between two pullup resistors which can generate high states. Generating low states is left to the drivers connected to it, which would presumably have some kind of low-side switch that can connect to their shared ground. If either side does that, the other will see the "low" pass through the FET, while if neither does so each sides see a pullup towards its own positive rail.
It would be useful if that schematic diagram had a nice clear net line between the ground ports on each side. It may have been prepared in a style where the name of the ground terminals being common means that they are in fact connected in the netlist (as they would need to be on the PCB), despite this not being shown visually.
Here's an excerpt from the xml-format Eagle schematic:
<net name="GND" class="0">
<segment>
<wire x1="25.4" y1="88.9" x2="27.94" y2="88.9" width="0.1524" layer="91" style="longdash"/>
<pinref part="JP1" gate="G$1" pin="3"/>
<label x="27.94" y="88.9" size="1.27" layer="95" xref="yes"/>
</segment>
<segment>
<wire x1="66.04" y1="88.9" x2="63.5" y2="88.9" width="0.1524" layer="91" style="longdash"/>
<pinref part="JP2" gate="G$1" pin="4"/>
<label x="63.5" y="88.9" size="1.27" layer="95" rot="R180" xref="yes"/>
</segment>
</net>
Which indicates there there is a named "GND" net having two visually separate segments, which are nonetheless the same net as they have the same name. |
H: How to step down from 5VDC to 3VDC?
just a newbie here.
I just want to ask how I can step down my 5vDC adapter to 3VDC? Cause I'm afraid that my LED lights will burn out. Thank you so much for answering.
AI: If you're worried about burning out LEDs, then current is your problem, not voltage. You can limit the current with a series resistance (which LEDs always need).
If you're using standard 5mm LEDs, a 1k resistor for each LED will only allow a few mA through (I usually try to stay under 20mA for these).
LED Strips already have series resistors, so as long you don't apply a voltage higher than they're rated for, they should be fine. |
H: Brushless DC Outrunner Motor Control
My question arises from interest mainly in Outrunner motors which are used on RC planes/drones.
With that being said, I understand that these motors are controlled by an Electronic Speed Controller (ESC), which is used to switch DC power into two of the three different phases of the motor at a specific time by monitoring the back EMF (for sensorless operation) on the third phase. I also understand that to regulate speed, the ESC will use PWM to "modulate" the average voltage to the motor.
If my understanding is correct, then I am utterly confused why I have read, in multiple places, that Brushless DC (BLDC) motors are speed controlled by frequency.
For example:
"BLAC, BLDC (AC stator, DC rotor)
These are basically just Synchronous machines but they have permanent magnets on the rotor. Higher the stator frequency the higher the rotor speed. AC & DC just comes from the type of current control that is used."
Also, I know that Brushless Outrunner motors experience slippage, which means they are definitely not synchronous. Correct?
I am left with the thought that there must be different types of BLDC motors, or different forms of control. May I please have a clarification on this subject or even a correction if I am completely wrong?
EDIT: Changed "Engine Speed Controller" to the correct term: "Electronic Speed Controller"
AI: Brushless DC means exactly that - a DC motor with brushless commutation. The controller's job is to switch the phases in and out at the correct rotor angles (not frequency) just like the commutator in a brushed motor. The motor spins at whatever speed it wants to, depending on supply voltage and load.
If the motor has sensors then the controller can be very simple, since it just has to read the sensors and turn on the appropriate phases depending on rotor angle. It has no direct control over commutation frequency, but it can 'control' motor speed indirectly by varying the effective supply voltage (using either a regulator or PWM).
Sensorless controllers have a harder job because they must monitor the back-emf waveform for zero crossings. At startup there is no back-emf so the ESC cannot detect the rotor's position. To get the rotor spinning it pulses the phases at low power like a stepper motor, gradually increasing speed until it gets a strong enough back-emf to switch into synchronous operation.
During this startup period only, the sensorless ESC controls motor speed by varying commutation frequency. However since it is basically dragging the rotor up to speed, any sudden change in load can cause it to loose sync. Also the motor may start in reverse, then it has to stop and try again. This may result in the rotor jumping back and forth a few times until the ESC sees a good back-emf. |
H: MSP430 how to make configurable ISRs in a module (Code composer studio C)
I have a question that I think the answer to is quite simple. But I've been unable to find a straight answer to.
If i have this service routine in some module foo.c
#pragma vector = SOME_VECTOR
interrupt void fooISR(){
dosomething;
IFG = 0;
}
if i have in my main.
#include "foo.h"
Then it appears that the fooISR() does indeed get loaded into the SOME_VECTOR and the ISR will trigger whenever the corresponding IFG is set.
I wanted to ask if this is the right way to write modules that utilize interrupts. Because with this approach the fooISR() will be in the SOME_VECTOR whenever I include foo.h this doesn't really allow for much configuration for the person working in main.
For example if in main.c I wanted to access some functionality of foo.c but wanted to write a separate ISR for SOME_VECTOR I'd be outta luck with this method right?
AI: The concern that you express in the last paragraph is correct. It doesn't seem to be a good idea to bundle an ISR with other functionality that you might want to reuse separately from the ISR.
I usually do one of the 3 things:
Put the ISRs and main into the same file as main(). ISRs are short, so they don't clutter the main.c too much.
Put all ISRs together into a separate module. No other functionality in that module. No intention to make this ISRs module reusable.
Put each ISR into its own module. No other functionality in those modules.
You could put the ISR inside of an #ifdef block, if it makes sense in your particular situation. |
H: Is there anyother way to construct an FM transmitter
I recently built an FM transmitter that uses a combination of coil and capacitor as an oscillator to generate the carrier frequency.
I built this transmitter:
Now my problem is that I find it difficult to wind coils properly. The chance of winding properly is very low. I tried to reconstruct nearly 10 to 15 times and it worked hardly twice or thrice. Also the received signal was very faint and consisted of lot of distortion.
Therefore, Now I would like to know if there is a way to build a transmitter that does not involve any coil. I googled it and found that I could use a crystal oscillator or an IC like 555 or LM385, etc.. How can I do it?
AI: I made this circuit before and it works properly. Here are the issues I met, they might be useful for you:
1- Don't use a battery lower than 9v. You can use a higher voltage.
2- Using a very long antenna will help you a lot. If you don't have a long wire, you can connect an aluminium pot :)
3- The frequency is not stable. so, Each time you turn on the circuit, you should tune your receiver (Change the frequency of your receiver) until you get the best result.
4- You should Not use a Mic as "Audio In". And I think it's better to rise the volume (Volume up) of the input audio.
5- The Capacitor C3 is important.
6- Don't worry about the shape or the number of turns of L1. Just bring a pen and turn a wire around it 5 or 8 times. and If you need to change the transmitter frequency, Change the values of C4 and C5.
7- I actually used a lower value of R3. I used 100 ohm instead of 470 ohm.
8- After all of the previous steps. If it still does not work, Change the value of R2 using a potentiometer.
9- My transistor part number is S9014. I did not use 2N3904 because I don't have it.
If you need another circuit, the following circuit is easier to construct and it works too: |
H: Connect to external monitor using HDMI
I want to connect my laptop to external monitor, but it doesn't have VGA socket. It only has HDMI.
I recently purchased a HDMI to VGA cable and tried with it, but still it doesn't recognize the input.
I checked on the internet and found that I need to use HDMI to VGA Adapter and not just the cable with two different plugs.
So is it true or is there any way to use the cable which I have already purchased.
AI: It is true and there isn't any useful way to use the cable you have bought. In fact, many of these HDMI-VGA cables are actually completely useless as there are virtually no devices that output any useful VGA signals via the HDMI port.
You would need to purchase a proper adapter which has what is essentially a separate video card in it (something like this). I use a similar device with my own laptop which converts the digital DisplayPort data into Analog VGA signals. |
H: Cascading Common-Emitter Common-Collector for maximum power transfer
Hi Am trying to understand what am doing wrong, I connected CE to CC with a small Rload am designing it so Zout of the second stage equal Rload to get Maximum output.
From what i read in CC-amp Zout = RE||(r'e+ ((R1||R2||RS)/Bac)) were RS is the source resistance, i figured since CC-amp is connected to CE-amp then RC takes place of RS.
I reedited the calculation and obviously it came out wrong.
Bac = 100
Rload = 30
RS= RC = 1800
(R3 || R4 || RS) / Bac = 18 since RS << R3||R4
r'e + 18 = 30 => r'e = 12
IE = 25mV /r'e = 2.08mA
RE = 100*Rload = 3000
VE = 6.24V
Zout = RE||(r'e+ ((R3||R4||RS)/Bac)) = 29.7
Zout = Rload
Recalculate DC for final result
Vth = VE +VBE + Delta= 7.2V
Rth = Bdc(Vth - VBE / IE - RE) = 12500
R3 = Rth * (VCC / Vth ) = 15625
R4 =1/ (1/Rth - 1/R3) = 62500
Tried different ways but nothing, is the cutoff caused by first stage i tried to keep Q1 in midpoint and without CC it Amplifies signal without distortion, is it a cap problem or is it cause the current is to high
thank you for the help
AI: Let's say the base of Q2 is biased to an average voltage of Vbias. Ideally, C3 would be charged to an average voltage of Vbias minus Vbe_of_Q2.
When the signal going to the base of Q2 is in the positive phase, it would be higher than Vbias, Q2 turns on. The output impedance is similar to your calculation, being the combination of the output impedance of Q2 and RE2.
But when the signal goes into the negative phase, it would be lower than Vbias. Given the voltage charged across C3, current flows backward, and Q2 turns off. Now the output impedance is simply RE2. RE2 cannot drive Rload because it is 100 times of Rload. Therefore the lower part of the sine wave signal is lost at Rload.
It is actually worse than the description above because C3 would be charged to an average voltage higher than Vbias minus Vbe because of the imbalance. So I actually cannot explain why the yellow trace only lost about half of the sine wave and not more. |
H: Using an Arduino to measure wire capacitance
I wanted to use an Arduino as a capacitance measurement device for a coaxial wire. I started at measuring the wire capacitance using digital multi-meter UT58B. I turned the knob to 2 nF and then measured the capacitance depending on the wire length. These are the results:
After the measurements I got the function (y = 0.0032x + 0.0268) on how the capacity changes depending on wire length. Now I wanted to use the Arduino to measure the capacitance and then calculate the wire length depending on the capacity. I tried following a guide to make the Arduino be able to measure the capacity.
Now the problem. I tried calculating the needed resistance using R = TC/C for one seond and got:
R = 1/(0.019*10^(-9)) = 52631578947.37 ohm
As you can see the resistance is too big. My questions:
Should I decrease the time constant? And how small could it be so that arduino can still measure the time? What maximum resistance can you suggest?
Maybe I wrongly read the multi-meter values? (the 2 nF scale)
Maybe there are other solutions you can suggest to measuring capacity with Arduino?
AI: In actuality, you can use an Arduino and you do not need to utilize an oscillator with the test capacitor in the tank. This will work quite well for capacitors of 10pF or more, and with care even below, though that is not something I would have believed until trying it. You do however need your PCB to be very clean without flux residue or remains of efforts to remove it.
The key is not to use the low impedance, slow ADC, but rather the comparator, and utilize the timer block to measure the charging time.
This is what the Arduino capacitance measurement example does, and also the ATmega based kits with LED digit display which you can buy for around $11. Source resistor is typically selected be a GPIO and in the 100K - 1M type of range. Stray capacitance is calibrated out by measuring the time constant with only the meter and test fixture, but no capacitor under test. Provided you don't move the fixture or get your hands into the field of measurement, adding even a tiny test capacitor then linearly increases the time constant. |
H: Silkscreen versus assembly layer
Is there any example, preferably by photos, how does assembly layer on PCB differ from the silkscreen? I understand, that silkscreen reference designators should be left visible after the parts are mounted on the board, and assy layer information can be obstructed after the assembly process. Is that the only difference? I cannot find any exact information on this over the internet, everything I have found is a unclear to me. Thank you.
AI: Dave's answer is a good one and correct in that assembly layer is not included on the pcb, it is simply to aid the assembly, just wanted to add a bit to it.
The assembly layer is useful for setting up the pick and place machine in that you can make the reference designators very large and put them in the middle of the part so there is no confusion as to what part the refdes is for. You can also put large dots to indicate where pin 1 is. On busy boards with lots of closely spaced parts, an assembly layer can be invaluable since it will prevent the assembly company from contacting you with questions (I have had an order put on hold before because they were not sure where pin 1 was on a part due to poor assembly layer on my part).
See below picture for an example of how assembly layer is useful. Note that it is very easy to see with the bare eyes which part is which refdes as opposed to having small silkscreen refdes numbers next to each part. Also note the dots in the corner of some of the parts, clearly indicating where pin 1 is located. You can also see some parts crossed out in red, indicating they are do not place. |
H: FPGA IP core vs. AFU
What is the difference between an FPGA Intellectual Property core and an Accelerator Function Unit?
As far as I understand, an AFU is an IP core developed by the end-user (as opposed to IP cores delivered in the hardware by the vendor). Is it correct?
AI: The term IP core typically refers to a design delivered by a third party.
The accelerator function unit might be part of that IP core or it can be your design.
If you distribute your design for others, then it will be an IP core for them. |
H: Programmed IO vs interrupt for devices
Although I can understand the difference between programmed IO (PIO) and interrupt (INT) transfers, still there is something vague.
In PIO, the processor repeatedly checks READY pin to see if the device is ready. However, in interrupt mode, the processor checks the INT pin at the end of the instruction cycle.
My question is, in interrupt mode, the processor still has to repeatedly checks the INT pin. I know that in this mode, the external device send the interrupt signal, but how processor becomes aware of that interrupt? The processor has to repeatedly check the INT pin on every cycle (or instruction cycle). Doesn't it?
References:
{1} http://www.louiewong.com/archives/137
{2} https://www.quora.com/What-is-the-difference-between-programmed-driven-I-O-and-interrupt-driven-I-O-What-is-one-advantage-and-one-disadvantage-of-each
{3} http://homepage.cs.uiowa.edu/~ghosh/Chapter3.ppt
AI: In PIO mode the processor is executing instructions that check the IO. That means it's not executing other instructions during that time.
In IRQ mode the check is performed by the same part of the hardware that normally increments the instruction pointer, or handles jumps. The check itself doesn't "cost" anything other than a tiny bit of processor chip area. |
H: Is there altitude limit for GSM(SIM908)?
I'm using GSM(SIM908) in the machine. I need to know whether there is an altitude limit for gsm to operate. Does GSM just stops working after reaching certain height? I will use SIM908 or SIM808.
AI: I often have cell service at 25,000 feet. I have also launched a weather balloon with a GSM tracker and depending on your antenna, you could have service as high as 30k-40k feet. Maybe much higher depending on many variables such as humidity, antenna shape and type, cell tower position and power, local transceiver power, and your circuitry that interprets the signal. I would say 30,000 feet is very doable based on my experiences. |
H: bi-directional flyback diode for relay spike protection
A flyback diode is used to protect circuits against the reverse voltage generated by removing power from a relay coil.
Like this:
simulate this circuit – Schematic created using CircuitLab
But what to do if the polarity of my power supply isn't known?
placing two diodes in parallel in opposite won't work (short circuit)
Any idea for bi-directional flyback diode?
AI: You don't need to use a diode; a capacitor will limit the open-circuit energy from the relay coil to a voltage usually not greater than twice 9V.
Lets say your inductance is 1 henry and the coil resistance is normally 750 ohm. The current into the 1 henry is limited to 12 mA and therefore the coil stores an energy of 1 x 0.012 x 0.012 / 2 = 72 uJ.
If all of this is transferred to a 10uF capacitor the voltage increase above 9V on the capacitor is: -
V = \$\sqrt{\dfrac{72uJ \times 2}{10 uF}}\$ = 3.8 volts
i.e. the 9V, when disconnected by the switch, will create a peak voltage of 12.8 volts on the capacitor and it will likely but much less than this because of the series resistance of the coil burning off energy in the transfer of micro joules to the capacitor.
To address Spehro's comment a small values resistor in series with the capacitor can reduce inrush when activating the relay. |
H: How to make a 240v ac to 12v 2amp dc transformerless step down circuit
I want to make a 100-240vac to 12vdc 2amp transformerless stepdown circuit any safe reliable circuit digram is accepted
AI: This circuit should work...
Where compnoent U2 in the above circuit is this...
Note that this component type is highly orientation sensitive- high voltage AC feeds to the large flat metal parts on the body and the 12 DC is extracted from the round connector at the far end of the wire. Try not to connect backwards or it will likely not operate as expected. |
H: Non-unique Sample Rate
Given
$$x[n] = \cos\left(\frac{\pi}{3} n\right)$$
That was obtained by sampling
$$x_c(t) = \cos(4000\pi t)$$
At \$T\$ samples per second, find \$T\$. Is \$T\$ unique? Why or why not?
$$x[n] = x_c(nT)$$
$$\cos\left(\frac{\pi}{3} n\right) = \cos(4000\pi nT)$$
$$\frac{\pi}{3} n = 4000\pi nT$$
$$T = \frac{1}{12000}$$
So far so good. Is \$T\$ unique? No, because either of these periodic signals can be phase shifted by \$2\pi\$ and remain essentially unchanged. E.g.
$$x[n] = \cos\left(\frac{\pi}{3} n + 2\pi\right)$$
EDIT TO SHOW STEPS
$$\cos\left(\frac{\pi}{3} n\right) = \cos\left(\frac{\pi}{3} n + 2\pi\right)$$
So,
$$\cos\left(\frac{\pi}{3} n + 2\pi\right) = \cos(4000\pi nT)$$
$$\frac{\pi}{3} n + 2\pi = 4000\pi nT$$
$$\frac{1}{3} + 2 = 4000 T$$
$$T = \frac{7}{12000}$$
END EDIT
Using this new \$x[n]\$, which is equivalent to the original, and the same relationship as defined above, we find that \$T = \frac{7}{12000}\$. While the math checks out (unless I've seriously screwed up), intuitively this makes no sense to me.
How would lowering the sample rate simply shift the resulting discrete time signal? By this logic, lowering the sample rate won't change the output, which is fundamentally wrong (isn't it??)
I must be missing something here, please enlighten me!
AI: You're doing something wrong with the additional \$2\pi\$. You might just be forgetting that \$cos(x + 2\pi) = cos(x)\$. I assume you are leaving it in and ignoring the order of operations (bad parenthesis).
$$\cos\left(\frac{\pi}{3} n + 2\pi\right) = \cos\left(\frac{\pi}{3} n\right)\require{cancel}$$
So, using your steps and adding the \$2\pi\$.
$$\cos\left(\frac{\pi}{3} n \cancel{+ 2\pi}\right) = \cos(4000\pi nT\cancel{+ 2\pi})$$
$$\cos\left(\frac{\pi}{3} n \right) = \cos(4000\pi nT)$$
$$\frac{\pi}{3} n = 4000\pi nT$$
$$T = \frac{1}{12000}$$
It's a pretty simple mistake, thus rather easy to make.
Edit:
if we shift ONLY x[n] and not x_c(t), then T changes
$$\cos\left(\frac{\pi}{3} n + 2\pi\right) = \cos(4000\pi nT)$$
$$\cos\left(\frac{\pi}{3} n \cancel{+ 2\pi}\right) = \cos(4000\pi nT)$$
$$\cos\left(\frac{\pi}{3} n \right) = \cos(4000\pi nT)$$
$$\frac{\pi}{3} n = 4000\pi nT$$
$$T = \frac{1}{12000}$$
No, it doesn't.
Edit 2:
$$\cos\left(\frac{\pi}{3} n + 2\pi\right) = \cos(4000\pi nT)$$
$$\frac{\pi}{3} n + 2\pi = 4000\pi nT$$
Ok, the problem is you're ignoring the sum angle in your cosine when canceling it. Trigonometry doesn't work that way. You can leave the \$2\pi\$ in, apply the proper identity, and cancel the result. Or, you can simply cross off any multiple of \$2\pi\$ and proceed as you were already doing. |
H: How does a logic gate behave with an input changing faster than its propagation delay?
I am attempting to create a simple logic circuit simulator. I am having a hard time figuring out how does a logic gate behave with an input changing faster than its propagation delay.
When attempting to connect a high frequency clock to an invertor logic gate with a 1 second delay in a simulator, the output stayed the same for 1 second and then started following the pattern of the clock.
It seems as if the output was a following function: output(t) = NOT(input(t - delay)). Is this true? If so, why? Also, how would this work with different rise and fall delays?
AI: It really depends on how the gate is constructed. For a completely accurate simulation, you have to do a transistor-level analog simulation. However, it is possible to extract timing parameters from a transistor-level simulation and abstract them out a bit. The output rise and fall times and propagation delays will depend on the input rise and fall times, output load capacitance, power supply voltage, temperature, and the state of the inputs. Yes, it is possible for the same input transitioning to have a propagation delay that depends on the state of the other inputs. These techniques are used in the timing models used in ASIC and FPGA design in both static timing analysis as well as timing-driven place and route.
Fundamentally, the propagation delay is determined by how long it takes for the output to transition in response to a change at the input. This depends on exactly how the gate is built at a transistor level. For a single two transistor CMOS inverter, the propagation delay is determined by the analog electrical characteristics of the transistors and their parasitic capacitance. The input will slew at some rate, then once the threshold is reached the output will start slewing. If the input changes before the output finishes slewing, then the output will start to slew back the other way and you will end up with a highly distorted output. So for a single inverter, the output for a change faster than the propagation delay would be an invalid logic level (i.e. x). However, "gates" can be far more complicated than a single inverter. For example, if you have a "gate" that is built from a string of 100,000 inverters, then the propagation delay of the whole unit will be 100,000 times the propagation delay of a single inverter and it is certainly possible to have multiple transitions 'in flight' at the same time, so long as these transitions are not faster than each individual inverter can handle. |
H: How to avoid garbage values received in UART communication
I am new to the embedded programming. I am doing a UART communication in PIC32MX795F512L MCU. I have somehow managed to transmit and receive data but not able to receive complete string.
I am doing something like this:
char Rx[5] ; //variable to store rx data
int i;
for(i=0;i<=4;i++)
{
while(!DataRdyUART1()); //This check if data is ready to be received
Rx[i] = getcUART1(); //This get one character from UART
}
putsUART1(Rx); //Putting all the Rx data on UART
But whats happening is If I type 12345 then I get 123452345&+ its taking the last values. Again if I type asdfg then I get asdfg2345&+. After the 5th character, its showing some garbage values.
This should not happen. I don't know why its taking up 2345&+. How can I remove this. Please help. Thanks.!
AI: The string needs to be zero terminated so that the sending function, putsUART1, knows when it's reached the end. So make your array one character larger and add a null (zero) at the end.
Something like this:
char Rx[6] ; //variable to store rx data
int i;
for(i=0;i<=4;i++)
{
while(!DataRdyUART1()); //This check if data is ready to be received
Rx[i] = getcUART1(); //This get one character from UART
}
Rx[5] = 0; // add null terminator
putsUART1(Rx); //Putting all the Rx data on UART |
H: BJT power dissipation - Which value to use? (Ta vs Tc)
I'm using a TIP120 (Darlington pair BJT) brought to saturation for a project of mine. I have \$V_{CE(sat)}=1V\$, \$I_C=2A\$, \$V_{BE}=2.5V\$ and \$I_B=0.005\$A, which give me a total power dissipation of:
\$P_D=V_{CE(sat)}*I_C+V_{BE}*I_B \approx 2W\$
When I look up the component datasheet to check the absolute maximum ratings, there are two values given for power dissipation: one at 65W (@ \$T_C=25°C\$) and one at 2W (@ \$T_A=25°C\$), as seen on the image below:
So my question is: what is the difference between the two values? What is the difference between \$T_A\$ and \$T_C\$?
Sorry if this is a common question, I've searched everywhere to try and answer that question, but search engines are not very helpful when I want to know the purpose of parameters found in electronic datasheets (if there exists a glossary for the most common parameters found in datasheets somewhere, and someone has a link, I'd be very happy to use it!).
I suspect that I should use the first value for some reason, but given that my calculated \$P_D\$ value is pratically the same as the second one, I don't want to take any chance and destroy my future setup, making all that magic smoke escape...
Thanks!
AI: The ON datasheet is rather confusing (or rather doesn't explain its notations). The 65W refers to the [max] power dissipation if you manage to keep the case at 25C. The 2W refers to an ambient temp of 25C, but no restriction on the case temp. This is a bit more clear from the Bourns datasheet of their similar product.
What this means in practice is that 65W is the max you can hope for with an ideal [possibly very large] heatsink.
Both of these data are actually a rather convoluted way of saying the same thing, namely that the max junction temperature allowed is 150C. This can be verified using the following data:
1.92*65 + 25 = 124.8 + 25 = ~ 150C
62.5*2 + 25 = 125 + 25 = 150C.
Which is actually given as such in the datasheet:
Now for practical purposes, I would suggest using a small heatsink rather than betting you won't fry it at exactly the dissipation limit for use without one.
If you want to calculate the temp rise with a heatsink, say one which gives 13C/W, then you add the heatsink's thermal resistance to that of the case (1.92C/W) and the interface material, let's say 1C/W, which would give you about 16C/W total resistance. For 2W that translates into 32C temp rise over ambient, so at 25C you'd have 57C. That's pretty decent for not frying yourself when accidentally touching it. |
H: Will this short range AM transmitter constructed using crystal work?
I have designed a circuit as follows:
simulate this circuit – Schematic created using CircuitLab
There are a few corrections in the circuit. I couldn't do it in the editor because I don't know. The corrections are:
1. The input is audio input.
2. The capacitor is electrolytic.
Now my question is whether this circuit will be able to generate the carrier frequency to transmit the audio input. If not, then what are all the required additions and corrections?
Also can anyone explain how to design the receiver to receive the signals.
AI: Now my question is whether this circuit will be able to generate the
carrier frequency to transmit the audio input. If not, then what are
all the required additions and corrections?
My advice is do some research and forget your circuit. Google is your friend. Type "crystal AM modulator" and look at the images that it finds: -
Next choose one that appears to give good information about how it works and try it out. Also be very aware of your country's laws on illegal transmitters.
Also can anyone explain how to design the receiver to receive the
signals.
Get your transmitter working on a band that a regular transistor radio works on then think about designing a receiver (much trickier). |
H: INA122p replace to INA126p
I made a working circuit for an INA122p, for arduino, so it has a 5V PS . I bought 2 ina 126p ic's, because they are nearly the same, but when I change the ics, the 126p has a fixed 0,6v signal output. the gain is set to 500.
here is the modified circuit:
AI: The INA126 does not have the same capabilities as the INA122. The 122 can work with input signals that swing as low as the most negative rail of the device which, in your example, appears to be 0V. The 126 has problems in this respect: -
I've circled the bit that shows the common mode input range when on a 5V/0V supply. Two things to note - the input range only goes down to about +1V and the output can only swing as low as about 0.6 volts. Here's the 122 equivalent picture: -
The input range includes 0 volts and the output looks like it will swing down to below 100 mV. |
H: STM32 chip specs do not match the datasheet?
I've recently purchased a couple of STM32L152R8T6 chips from a local electronics shop.
According to the page 11 of the datasheet, this chip is supposed to have 10K of SRAM and 64K of FLASH.
However, when I query one of those chips (that I've already soldered onto a perfboard, along with simple transistor UART 3.3v<>5v level shifter) with 'stm32flash', it responds with this:
$ stm32flash -b 115200 /dev/ttyACM0
stm32flash 0.4
http://stm32flash.googlecode.com/
Interface serial_posix: 115200 8E1
Version : 0x30
Option 1 : 0x00
Option 2 : 0x00
Device ID : 0x0416 (L1xxx6(8/B))
- RAM : 16KiB (2048b reserved by bootloader)
- Flash : 128KiB (sector size: 16x256)
- Option RAM : 16b
- System RAM : 4KiB
And the linker script from STM32L1xx Standard Peripheral Library v1.3.1, for Medium Density devices, sets the size of FLASH to 128K, and the size of RAM to 16K.
The questions are:
Why memory sizes do not match the ones described in the datasheet?
Do I have some dodgy/fake/counterfeit chip?
What memory size should I state in the linker script? (that one is probably a bit offtopic).
I've also tried to use it with ST's own Flash Loader Demonstrator (through Windows 7 on VirtualBox VM, don't have it on the actual hardware, maybe I'll test that later), but it keeps saying that it's an "Unrecognized device... Please reset your device then try again".
I use an Arduino Mega 2560 as an USB<>UART bridge, using RX0/TX0 to connect to STM32. Of course, Arduino's AVR chip is disabled by wiring its /RESET to GND.
With such setup, I can easily, without any errors along the way, upload and verify (with stm32flash and a serial port) a simple program to blink a LED, and it will work. I've also played around with integrated DAC and ADCs, they also seem to work just fine (although a bit slower than I expected, but that's probably not related - I'm only starting with ST micros).
I've also stumbled upon this thread that might have an answer to this question, but I don't know if it explains why ST's own tool is not able to see the chip.
AI: The device ID of your controller is the following:
Device ID : 0x0416 (L1xxx6(8/B))
and I think the key is this part: L1xxx6(8/B), this ID must be the same for STM32L152R8 and STM32L152RB devices.
If we have a look at ST's table of flash/RAM sizes, the STM32L152RB has 128K/16K.
I am not sure, maybe the SPL can only assign the RB values when this device ID is read.
You can give a try and set the 64K/10K values manually, and check if you can program the MCU.
I do not think that your ICs are fake, check the text on them to make sure it's an 8 and not a B. |
H: Discrete Logic with Seven Segment Displays Problem
As a small project, I decided to make this circuit from Gadgetronix. However after wiring it, the display is stuck on 20 and when I activate the pushbutton, the 0 (display of IC2) just dims, and when I let go it goes back to normal. Now, I know just showing the circuit and telling you this is far from being sufficient to solve my problem, but I didn't think posting a picture of a rat's nest of wires was going to be helpful...
Is there any place in the circuit that has the possibility of causing this problem? A probable place where I could have shorted out a couple of pins?
Thanks!
AI: To troubleshoot first review all of your wiring ("rat's nest"). Especially check the connections going to the 7-segment displays. Since the schematic doesn't show the pin data for the displays you will need to rely on the spec sheet for the parts you have used. Per my other comment be sure you do have common cathode displays. (Normally there would be low value resistors to limit the current in each abcdefg line, but the CD4026 may limit the current well enough, but if interested about 390 ohms in each line is a safe start.)
Start by reading through the "Working of..." paragraph from the schematic page. Use a voltmeter or logic probe to follow the pulse signal from the top of the push button then to the 555 output. As each pulse gets to the first CD4026 (IC2) you can then check each of the abcdefg pins for changes, each output change from low to high should turn on a new segment.
Unfortunately there is no reset signal included in the schematic. So the only way to clear back to 00 may be to cycle the power. To add a reset you could take the two MR lines and connect them to a single resistor going to gnd (about 5k should work), then connect a switch (push button) that momentarily supplies +5 to the MR-resistor connection. |
H: Questions involving Injecting power into WS2811 RGB strands
I'm currently using an Arduino UNO (but may need to switch to a MEGA due to memory issues) to control about 20 strands of WS2811 RGB LED Strings(see similar product here). I'm Using the FastLED library to send all of the data at once through a central data line. My questions are in regards to properly and safely injecting power.
I'm more of a programmer than an EE, I've done similar before but it has been years. For my safety I have a few questions:
When injecting power do I want to splice the positive and negative in so that the end of one strand is connected to both the new 5v line and the next strand(is this series with injection?)? or do I want to cap off the first strand and simply run the 5v from the power supply to the next strand(straight parallel correct?)?
What effect will the series vs parallel from the last question have on Amps?
I'm using a 5v 60 amp power supply. It has multiple positive & negative terminals. Does it matter if I run all of the injection wires off one positive and one negative terminal? or should I split them evenly across terminals?
The previous question probably effects the setup of my fuses? If I split the injection wires into 4 channels, should I then use four 15 amp fuses?
Am I missing any important safety factors?
I remember finding a simple (for kids) browser app that let you place nodes than showed the difference between voltage and amps. Does anyone have a link to this?
Sorry for all the questions at once, especially since I'm sure they've been asked before. Since this will be going on our Christmas tree, I'd like to be thorough.
AI: When injecting power do I want to splice the positive and negative in
so that the end of one strand is connected to both the new 5v line and
the next strand(is this series with injection?)? or do I want to cap
off the first strand and simply run the 5v from the power supply to
the next strand(straight parallel correct?)?
I'd connect the power lines from the output of one strip into the input of the next AND also inject power into those power lines at points along the full length where needed to keep the voltage from dropping too low for any pixel in the string.
Injecting power this way has 2 benefits that I see...
Because the power from the injection point can run in both directions down the sting, you can get away with fewer injection points. Stated another way, for a given number of injection points you are halving the farthest distance any pixel is from the nearest injection.
This ensures the voltage of the last pixel before the injection point is the same as the first pixel after. Otherwise, the last pixel before the injection would have a much lower voltage because it sees the voltage drop from the far away previous injection point. This can cause problem because the voltage of the data signal coming out of the last pixel will be referenced to the low power voltage it sees, and the minimum data voltage needed by the first pixel after the break will be reference from the high power voltage it sees.
What effect will the series vs parallel from the last question have on
Amps? I'm using a 5v 60 amp power supply. It has multiple positive &
negative terminals. Does it matter if I run all of the injection wires
off one positive and one negative terminal? or should I split them
evenly across terminals?
Use as many terminals as possible because...
It will be easier than trying to get all the wires under one screw.
You will have less current going though any one screw terminal and less current is better. This is why they give you multiple screw terminals.
The previous question probably effects the setup of my fuses? If I
split the injection wires into 4 channels, should I then use four 15
amp fuses?
Yes, better to have an separate fuse for each of the runs since these fuses can be smaller. The fuses should be close to the power supply connection so they will blow if there is a short anywhere along their length.
Am I missing any important safety factors?
I typically use lots of small and independent power supplies connected along the length. This prevents me from needing lots of long runs of thick cable and keeps everything low current everywhere. I think that several distributed small supplies is safer than one giant centralized one since the maximum current a short can cause in any one place is much smaller. If you drop a screw driver across the terminals of a 60 amp supply you basically made a DC welder.
You are basically getting high-voltage/low-current mains power as close to he strip as you can and then converting it to low-voltage/high-current on the spot. It is also easier to deal with a bunch of small power supplies connected to normal plug-in extension cables than one giant power supply connected to really high high-current wires.
Here is a video of a string of 1,000 pixels powered by small supplies along it length...
http://wp.josh.com/2014/05/13/ws2812-neopixels-are-not-so-finicky-once-you-get-to-know-them/
If you look carefully, you'll see the many brick power supplies connected every 2-3 meters. No thick wire anywhere.
All that said, if you already have a big supply and want to use it, you can use a similar strategy. I'd have a home-run connections from the supply to the strip every 2-3 meters. Using home-runs means that no one run will have to carry that much current. You can fuse these lines with relatively small (safe) fuses where they connect to the power supply so in case there is a short someplace these wires will not get too hot. |
H: ULN2003 based stepper driver not driving 28BYJ-48, and nothing coming up on the indicator lights
I recently received five of the ULN2003/28BYJ combos, as described on the below link:
http://www.4tronix.co.uk/arduino/Stepper-Motors.php
I am powering the stepper controller with a 5v supply from the YwRobot breadboard power supply, which in turn is powered by a 12v wall wart. I have tried to use both the breadboard output pins and the 5v jumpers directly on the YwRobot PSU.
I am using an Arduino Nano to run the controller, and I am using digital pins 8,9,10 and 11, which are connected to cables IN1, IN2, IN3 and IN4 respectively.
Pretty much everything is stock standard as described on the 4tronix site, I am even just running their sample code, and have nothing else fancy going on.
I am not seeing any LEDs come up on the driver controller, and the motor does not turn. I have tried three of the units, and double and triple checked my wiring, but it seems for all intents and purposes that the controllers are just not getting any input.
I have tested the Arduino ports with LEDs and temperature sensors, and tested another Nano as well, to no avail.
How can I best trouble shoot the controller, or else figure out how to get these to work?
AI: First, get yourself a cheap DMM.
Next, measure the 5 volts on the 2003 board, between V- and V+ (are you sure you connected the V- to your 5v ground?)
If you've got a good 5 volts, start measuring your control lines. If all 4 are zero (or less than about 0.5 volts), that will explain why your LEDs aren't lighting. |
H: Voltage drops not adding up - beginner question
I'm fairly new to electronics and playing around with a very simple series circuit - 2 resistors of ~220k Ohm and a 3v power supply, which I'm measuring with a digital multimeter.
If I measure the voltage across both resistors (or direct across the power supply terminals) I get a reading of 3.37 volts, but if I take a reading across the individual resistors I get 1.656 and 1.676 V (adding up to 3.332). I'm wondering what would account for the difference in total voltage? Even if the multimeter wasn't calibrated properly I'd expect it to be consistent?
Thanks!
AI: I'll assume this is the circuit you`re testing
Usually a voltmeter (PMMC) type:
Is a galvanometer with a HUGE series resistance (Mega ohm), such that a very small amount of current pass through it whenever this voltmeter is connected in parallel with a resistance
For the circuit shown
Voltage source is 3.3 V
Current = 0.0075 A
Load resistances = 220 Ω each
The voltage drop across each of the 220 Ω is 1.65 V = (0.0075 * 220)
BUT when you connect your voltmeter now
Assuming that: R:The voltmeter resistance = 10 MΩ
And you want to measure the drop across one of your resistances
so you'll now connect your voltmeter in PARALLEL with one of these 220 Ω resistances
Now you`re adding a parallel resistance with your load of value 10 MΩ
So the current is now not 0.0075 A since the circuit equivalent resistance is no longer the two series 220 Ω resistances only
its a combination of two parallel resistance 220 Ω,10 MΩ and a series resistance 220 Ω such that the equivalent resistance is now 439.9951 Ω (Almost less than 440)
so you'll not have the same amount of current (0.0075 A) but a slightly more amount of current in this case (0.00750008249 A) Almost 0.0075!
this in turn affects the voltage drop across each resistance by a very very small value that we usually neglect
So you'd expect a slightly smaller reading than the calculated value
Other factors also affects your reading such as
The source output resistance
Wire losses |
H: Verilog: slow clock generator module (1 Hz from 50 MHz)
I wrote a clock generator module. I think the problem is in my Reg4 module. The errors are:
ERROR:HDLCompilers:246 - "UpDownCounter.v" line 74 Reference to scalar
reg 'clk_1Hz' is not a legal net lvalue
ERROR:HDLCompilers:102 - "UpDownCounter.v" line 74 Connection to
output port 'clk_1Hz' must be a net lvalue
1 Hz clock generator:
module slowClock(clk, reset, clk_1Hz);
input clk, reset;
output clk_1Hz;
reg clk_1Hz = 1'b0;
reg [27:0] counter;
always@(posedge reset or posedge clk)
begin
if (reset == 1'b1)
begin
clk_1Hz <= 0;
counter <= 0;
end
else
begin
counter <= counter + 1;
if ( counter == 25_000_000)
begin
counter <= 0;
clk_1Hz <= ~clk_1Hz;
end
end
end
endmodule
Here is my Reg4 bit module:
module Reg4(I, Q, clk, reset);
input clk, reset;
input [3:0] I;
output [3:0] Q;
reg [3:0] Q;
reg clk_1Hz = 1'b0;
slowClock clock_generator(clk, reset, clk_1Hz);
always@(posedge clk_1Hz) begin
if (reset == 1)
Q <= 4'b0000;
else
Q <= I;
end
endmodule
Can you see the problem in my code?
AI: In the Reg4 module, change:
reg clk_1Hz = 1'b0;
to:
wire clk_1Hz; |
H: Using NPN-Transistor as switch not working
I have following schematic:
simulate this circuit – Schematic created using CircuitLab
But the motor is not working, the NPN-Transistor does not seem to let any current through. What am I doing wrong? the transistor does work, I checked, but there may be something very basic wrong, electronics is not really my strong suit.
AI: You're very close. instead of having the NPN in its present location, it need to be between the motor and GND. So disconnect the NPN's emitter from the motor, its collector from the 9 V supply, and connect:
Emitter -> GND
Collector -> Motor
Base -> 1k & 5 V as you have it.
The motor will go between the 9 V supply and the NPN's collector.
Whether or not 1k will work depends on the motor current. 5 V and 1k will give about 4.3 mA of base current -- probably about 100 mA of collector current. This sounds low for even a small motor.
simulate this circuit – Schematic created using CircuitLab
Also, it is possibly you have (partly) damaged your NPN -- the way you have the circuit now, the base-emitter junction is reverse biased. These usually break down around 6 V, and when they do, the beta (gain) of the transistor gets degraded. |
H: Why is it bad to have traces close to the edge of the board?
I keep reading that one shouldn't have traces close to the edge of the board and am curious as to whether there is an electrical reason behind this or if it's a mechanical issue (like when they cut the pcb, it might somehow rip up the traces)?
AI: From Sunstone (my favorite high quality short run PCB shop)...
A very high percentage of orders are placed on hold due to
insufficient board edge to copper clearance.
We care about exposed copper at the board edge for a couple of
reasons.
Copper can tear when it is routed, leaving strings that can short to adjacent layers.
Exposed copper can wick solder in a wave solder process, causing shorts at assembly.
Exposed copper at the board edge can make contact with your product chassis, causing a short to ground and/or risk of electrical shock.
So, both mechanical and electrical! |
H: Ideal SPICE Model of Op-Amp with Power
I know that the ideal operation amplifier model is a single voltage controlled voltage source. My question is how to extend this ideal model, in a minimal way, to account for power supply rails (V- and V+).
AI: LTSpice offers the ability to make a VCVS with piecewise-linear transfer function:
Syntax: Exxx n+ n- nc+ nc- table=(, , ...)
A look-up table is used to specify the transfer function. The table is a list of pairs of numbers. The second value of the pair is the output voltage when the control voltage is equal to the first value of that pair. The output is linearly interpolated when the control voltage is between specified points. If the control voltage is beyond the range of the look-up table, the output voltage is extrapolated as a constant voltage of the last point of the look-up table.
(source: LTSpice help file)
With this you could make a transfer function with linear characteristic for \$-V_s/A < V_{in} < V_s/A\$, and fixed output at the supply rails (or whatever limits you think best model your op-amp) outside those bounds.
Other SPICEs likely offer similar capabilities. |
H: Motorola 68030 minimum frequancy
I am working on building a computer with a Motorola 68030. The one I got my hands on is the 40Mhz version. In the electrical specifications pdf they list the minimum clock frequency for the 40Mhz version as 25Mhz. I would prefer to at least at the beginning run it slower so I don't have to worry about memory timing. What will actually happen if I run it too slow?
AI: That device uses 'dynamic logic' for some blocks. This is logic that requires a clock signal just to remain operational.
The 25 MHz spec is probably actually a worst case, high temperature requirement. I expect that at room temperature you could operate 10x slower. |
H: Where is pin 1 in Molex connector?
In 54722-0604, which is the pin #1?
connector page at molex.com
AI: Since the drawings don't indicate a pin numbering arrangement, it is up to the user to define it, I suppose.
I do see that there is a trademark on one end - I'd probably call that the pin 1 end, and number it like a DIP IC. If you are designing a pair of boards connected with this connector and its mate, you just have to be consistent in numbering the pins on both boards. |
H: Choosing components to clone ZX80
I have an idee fixe to make a clone of Sinclair's ZX80 computer.
So now I'm trying to find out which ICs I need for the basic prototype - and here are a few questions:
it seems Z84C00xxx is a modern substitution for original Z80 processor, right?
for SRAM, will UT62xx or LY62xx be the proper choice (I think of 6264 or 62256 chips, preferably in DIP, though it would not be hard to manage SOIC also);
what to use for ROM? FLASH-chips I can find usually contain megabits of memory while I only need few kilobytes - would EEPROM will do instead? Though it seems there are not very much with parallel interface, but I believe I can get along with Atmel's (like AT28C256)? I also had idea that I can use some MCU with enough pin count and internal flash instead, but I suspect it will not give good timing (unless I pump the flash content to RAM at first).
what series for discrete logic chips I should prefer, I believe 74HCxx or 74HCTxxx should be ok with the given CPU?
AI: The Z84C00xxx is not exactly 'modern', but it is still available new. Another advantage is that being CMOS it uses much less power than the NMOS version. It is specified to work at TTL logic levels, so for best compatibility I would use HCT logic chips.
For SRAM I would use a 62256 (32kx8) because they are readily available and often cheaper than smaller capacity static RAMs. If you can't get it in DIP then use a SOIC to DIP adapter board.
For ROM you can use either EPROM or (parallel) EEPROM. I prefer EEPROMs because they are quicker to program and don't need a UV lamp for erasing. The AT28C64 (8kx8) is readily available in DIP package at a good price. |
H: How would I find the total resistance of the following circuit?
I tried finding the total resistance but my answer isn't correct. The answer is supposed to be 6.66 kΩ.
AI: In this case whenever you are calculating the circuit resistance you want the total resistance seen by your only voltage source (18 V battery)
you better start from the node C,
Such that i can see a 1 KΩ series with another 1 KΩ
The equivalent resistance of this combination is a 2 KΩ resistance
so your circuit now looks like this
i can see now a 2.2 KΩ (Node B) parallel to a 2 KΩ (Node C)
We can now simply estimate the equivalent resistance of this combination which should be equals to
Now we place this resistance at node (B) and remove the node (C) branch (Open circuit) or vice verse
Such that your new circuit will look like this
Now i can see a 22/21 KΩ Series with a 1 KΩ resistance
Such that they are combined into a new resistance of value 43/21 KΩ
Your circuit will look something like this
Now this circuit can be easily solved
you have a 43/21 KΩ parallel with a 2.2 KΩ
and this whole combination equivalent resistance is series with the 5.6 KΩ resistance |
H: Formula for amplitude of volatge, decibell
There is a formula for power 1 and power 2 to convert to decibell. 10*log(P1/P2), but when I have a amplitude of voltage in DC, formula is 2*10*log(U1max/U2max). Why is there a 2? Thanks.
AI: Power is \$\dfrac{V^2}{R}\$ therefore (assuming the two R's are the same) the ratio of powers in this form becomes: -
Power ratio = \$\dfrac{V_O^2}{V_I^2}\$ = \$(\dfrac{V_O}{V_I})^2\$
The "square" becomes a multiplier outside of the log hence the 2 multiples by the 10.
For example log(\$x^2\$) = 2log(x) |
H: precision and accuracy of a measurement system
I have read the difference between precision and accuracy. As normally (mistakenly) they are considered to be the same, but in actual they are two different things.
My question is regarding the accuracy and precision of a measurement system. Lets say if i am measuring current across a resistor, which has a voltage tolerance of ±0.25%, and it is connected to a micro-controller having an ADC which is 0.5% accurate (including all the offset,gain and INL errors), my total accuracy with which I'm measuring the current is ±0.75%, i.e i will have a total absolute error of ±0.75%.
I have the following question:
1) If my system is ±0.75% accurate, can i say that its 1.50% accurate (i.e without the "±" sign) ?
2) For the above described system, can i say that if i take 20 different readings, and try to observe the precision of my system, will it be ±0.75% (maximum) as well ? For this i made a rough sketch attached herewith, showing the accuracy of ±0.75% by a red circle. Some readings are taken which (should always) lie inside this circle. So by looking at these readings, i think that we can say that our system's maximum precision will be ±0.75% as well. Am i right ?
3) I asked about precision in 2), am i right to say --> ± 0.75% i.e can precision be denoted by ± ? (like for accuracy ± is used.)
4) If precision can be denoted by ±, then just like 1), can i also say that the precision for this system is 1.50% ? (i.e without the "±" sign) ?
NOTE: The reason i asked 1) and 4) , is because normally i see things written like, this thing is x% precise or x% accurate, i.e with no ± sign with it. So without going in its detail, one should think of it as ±x% or ±0.5x% ? I mean what is the norm here ?
I hope i made my self clear.
Please help me clear my doubts. Your helpful suggestions and comments would be appreciated.
Thank you.
AI: Generally if an accuracy is given as 1.5%, it is assumed that this means ±1.5% unless otherwise stated. Thus you should not substitute one for the other.
Precision can be better than accuracy. In your example, however, since the readings are near the edge of the circle and spread around, the precision is not much better than the accuracy. If the readings were closer together then the precision would be better than the accuracy.
Precision could be expressed using ± meaning that the readings will cluster around the average reading within that percentage.
Again, if you express precision without the ± sign, then the ± will generally be assumed. It is better to use the ± sign and avoid any ambiguity. |
H: Help to identify
I'm trying to identify a burnt component on a PCB. This is receiver from Hubsan H301 RC glider. Wings got detached mid air and it slammed into high grass. I forgot to release throttle stick and prop got entangled in the grass. When I found glider there was a smoke coming from the plane. I quickly removed battery but damage was already done. As soon as battery is connected motor is spinning at full power and immediate smoke from the board is observed again. All other functions of the board work as before. Visual inspection revealed obvious damage to one component. See the picture below. This component controls power to the motor. To my surprise positive lead of the 2S battery supplying power to this board has direct connection to the motor. Second wire of the motor is connected to the common top row of the damaged component therefore it controls ground connection to the motor.
Leftmost three leads in the bottom row of the 8 pin component are also connected together. As far as I can tell writing on the component is 330CSAD or 3300SAD.
I think this is some mosfet similar to SIR330DP. http://www.vishay.com/docs/67089/sir330dp.pdf Is this true or did I get it completely wrong?
Picture of the board. Original is from http://images.amain.com/images/large/hub/hubh301f-07.jpg
AI: The broken component is a N-channel power MOSFET being used to control the motor current.
simulate this circuit – Schematic created using CircuitLab
The MOSFET was packaged in one of the propietary variants of the 8 pin SOIC, such as PowerPAK SO-8, P-TDSON8 or LFPAK power-SO8. It probably had a maximum drain to source voltage of 20 V or more, an on state resistance of 10 mΩ or less, and a continous current rating of 10 A or more. In order to save costs, it was likely being driven by a microcontroller directly instead of a proper gate driver, necessitating good performance at a low gate to source voltage. As such, the mosfet was probably of the "logic level" type, having a very low treshold voltage.
You do not have to find the exact same transitor that blew up. Find a power MOSFET in a compatible package which is sure to be electrically equivalent or better than the original. There are many suitable mosfets out there from different manufacturers and distributors. For example SIR158DP, BSC014N04LS, PHK31NQ03LT or AO4310 should all work just fine. |
H: What is going on in this VCXO circuit?
Here's a schematic of the VCXO oscillator section from a Siemens S55 mobile phone. AFC signal coming from the processor tunes the crystal via a varicap. There's also a thermistor going back to the processor for temperature compensation. It looks like a Colpitts oscillator, but I have no idea why there are two transistors. The upper transistor base is AC-coupled to ground, which hints a cascode configuration.
Why did they choose to use such two-transistor configuration?
What is the role of R955 if AC is shorted to the ground anyway - or rather why is the upper transistor base polarization connected with the signal path?
What do C958 and C952 do?
AI: Invariably, using a cascode like this is to overcome the effects of the miller capacitor in the low transistor - it's collector is held at a fixed bias point by the emitter of the top transistor and, the top transistor's base is fed DC. The fact that it couples via R955 to the crystal is unimportant - it's important that the base of the top transistor is higher than the base of the bottom transistor or it won't be biased correctly.
C952 is in parallel with the varactor and it basically adds to the varactor capacitance thus making the range of the varactor a bit less than if C952 wasn't there.
C958 is there to make that whole varactor setup appear strongly capacitive - without C958 shunting R960 it probably wouldn't oscillate. Why R960 is there at all is the most puzzling but I expect it is to stop the AC waveform superimposed on the DC control becoming too distorted (as it passes through or close to zero volts) because of the potential rectifying effects of the varactor. |
H: Clamping Inductive Kickback in AC Circuits
I want to eliminate/clamp the inductive kickback that would result from turning off a large inductor, such as a relay or a transformer.
In a DC circuit, I would use a diode to flywheel the current. But what do I use in a line voltage AC circuit?
Is an MOV an acceptable device to use? Should I connect it parallel with the inductor or parallel with the switch? MOVs fail closed circuit, so this could be a fire hazard. Fire safety is a very important consideration.
Or should I use a TVS or something else?
Please describe how the suppressor device should be connected to the circuit.
AI: You can use a capacitor - the peak current of the coil implies an energy level in that inductor and, when the supply is disconnected that energy flows into a capacitor to charge it up (rather than form an arc). This cycles back and forth between coil and capacitor and eventually dies down as all the stored energy becomes dissipated as heat in the coil's dc resistance.
The peak voltage on the capacitor can be derived from Energy = \$\dfrac{CV^2}{2}\$
The energy in a coil = \$\dfrac{LI^2}{2}\$ for reference.
This is the basis of a snubber except a snubber has extra R in series with the capacitor to dissipate the energy a tad more quickly. Here's a typical snubber for use with a triac and inductive load (see circuit note): - |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.