text stringlengths 83 79.5k |
|---|
H: Buck Converter Control Scheme- Why isn't just a comparator not enough?
I am supposed to come up with some control schemes for the converter before understanding the standard PWM control scheme.
Isn't it just enough if the output of the converter is compared with a fixed reference voltage to drive the output to required voltage level? Although I'm not sure there is a lot more to it, this seems to work pretty well.
I've tried simulating this circuit with L,C and R values from an example.
Schematic:
The required output voltage is 6V. S2 is a voltage controlled switch, controlled by the output of comparator.
V2(green) is the output of comparator and V1(red) is the output of buck converter.
AI: What you have here is a hysteretic-style buck converter. It may simulate well for a static load, but real-world performance may not be as robust as you'd imagine. A previous answer to this can be found here. In a nutshell, the switching frequency is dependent on the load and will vary greatly. This makes filtering out the ripple challenging.
Try quickly changing the load during the simulation and see what happens.
Now this kind of supply would work well as a pre-regulator, fed into a low-dropout linear regulator. The output of that would be very flat and virtually ripple-free. |
H: Is the given voltage Peak Voltage or RMS Voltage
In circuit diagram problems is the labelled voltage RMS voltage
or Peak Voltage ?
For example say in problems like this what is the usual convention?
I recently started learning about circuits and i'm in high school.I don't know if the question is suited for this site or not.But I thought of giving it a try.Do let me know if it's off-topic.
AI: RMS should be assumed unless otherwise indicated. In this problem, "effective current" should be assumed to mean RMS current and the supply voltage should be assumed to be 200V RMS. |
H: MOSFET fast turn-off not enough
I have a PWM bridge driving a higher than 1k load from 200V supply. The simplified, equivalent schematic is this:
The drivers I'm using are slow turn-on/fast turn-off and, in the schematic, it's a 50% duty-rati.,The parasitics modeled here also involve some capacitance across the filtering inductor. These will cause some spikes, sure, but they pale compared to the switching problem and, while I can get away with 100-200mA peak, what I have here is a bit scary:
The driving, as seen here, is a much nicer version to what will be in reality. The problem is that the mid-point voltage, V(mid), doesn't fall with the ending of the commanding pulse, only with the rising of the complementary pulse, which makes it overlap a bit and cause a spike, in addition to the inevitable parasitic. Here's a zoomed-in portion:
You can see that the upper drive, V(gh,mid), is turned off fast and has plenty of dead-time, while V(mid) keeps on going until V(gl) starts.
I know there are circuits trying to circumvent the parasitic capacity, but they only affect the response (slow zero as opposed to a notch), because the current as seen from the bridge is still there, which is what is the problem.
My question(s): is there any way of making V(mid) fall with the end of the command pulse, actually having a dead-time in there? Another winding with a forced current, maybe? Some clever snubbers? Anything? Or is this "unobtainium"?
Update: This is a close-up with Id(M3):
The dead-time is 25n but the rise time is imposed to be 25n, too. Tfall=1n but, apparently it doesn't affect the response as I'd want. Increasing the dead-time to 50n (keeping tr) results in this:
AI: Just because M1 turns off (and M3 isn't on yet) doesn't mean that v(Mid) will go low -- what happens depends on the load current (and load inductance).
However in your circuit, that's not what is causing the shoot through current -- notice that in your 2nd waveform, V(gh,mid) rises slightly at around 6.05 us. This is because V(mid) is falling (by M3 turning on), but M1 (which was off) turns back on again. M1 turns of because of drain-gate capacitance which couples the increasing VDS of M1 to the gate of M1.
You can improve this by reducing the value of the 12 ohm, and/or slowing down the turn on of M3. Basically in these situations you need to ensure the turn-off 'strength' is stronger than the turn-on capability.
In more technical terms -- when turning on M3, the dV/dt of v(mid) is limited by the Miller capacitance CDG of M3 to dV/dt = I_gate/Cdg. However, similarly the gate current induced in M1 is also I = Cdg*dV/dt, which is a similar amount. To avoid M1 turning on, you need to have a higher magnitude of gate turn-off current than turn-on current. |
H: Step motor intermediate position
Is it possible to change the position of arrow to be a little more to upper winding or right winding? If we supply different values of voltage to two winding what will happen to arrow?
AI: Yes.
It will tend to move to an angle of arctan(V1/V2). |
H: Amplifier impedance matching with constant voltage speaker systems
I understand that in order not to potentially overload an amplifier one should connect a speaker with an impedance no less than that specified, and I have just recently come to understand that for maximum power transfer the amplifier and speaker impedances should match.
So here, I know the AMP and speaker impedance should match for the best possible power transfer, and that a speaker impedance should not exceed the amplifiers specification:
However, I don't fully understand the implications for a constant voltage speaker system, like this:
The constant voltage speaker system makes perfect sense to me, I understand that like national power transmission, the high voltage low current means less loss... but... my question is...
Does the transformer coil impedance now have to match the amplifiers impedance/specification, OR, because of the dark magic of reactance, or other forces beyond my comprehension, does the presence of the two transformers become irrelevant so that one must still match the amplifier and speaker impedances?
I'm afraid that despite reading numerous articles I must admit I have yet to fully grasp impedance, reactance, inductance, capacitance, admittance, conductance, susceptance. I obviously now have SOME understanding, but really it's mostly far to shaky for much practical use yet.
AI: I have just recently come to understand that for maximum power
transfer the amplifier and speaker impedances should match.
Not this is not the case with audio - an audio amp can have an output impedance that is substantially lower than 1 ohm yet nobody makes (as far as I know) 1 ohm speakers. If the amp had an 8 ohm output it could only deliver half the voltage to an 8 ohm speaker and the rest of the power would be wasted in its output impedance.
It's only RF circuits that you need to be concerned about matching impedances but this is more to stop reflections down PCB tracks and cables.
The rest of your question is based on a false premise about audio impedances so it's not worth attempting to answer. However I will try and give some insight about the transformers used.
Like any power transformer without a secondary load, ideally you want to be able to apply a voltage to the primary and have zero current entering the transformer - that would be perfect and, when you connected a secondary load that consumes power, the power needed to be input to the primary would be identical to that consumed by the load. Reality isn't that bad actually.
Primary magnetization inductance is basically what the primary impedance is when the secondary load is disconnected - it can't be infinite but it can be relatively small but, not as small as a speaker impedance because then a lot of the power amp's energy is wasted driving a reactive current that serves no purpose.
If it were a 50 Hz power transformer connected to 230V ac, a 10 henry mag inductance would take a "standby" current of 73 mA. If such a transformer were designed for audio and, you weren't too bothered about below 100 Hz (deep bass) then a 10 henry inductance would take 35 mA at 100 Hz BUT, it's possibly a 20V RMS drive and not 230VRMS so a 100 mH mag inductance would do and it has an impedance of 63 ohms at 100 Hz. This, of course will only get higher (better) as the audio frequency rises into the mids and the treble.
63 ohms is fine for an amplifier that can drive an 8 ohm speaker so that hopefully takes care of that side of things. Next - there are turns (windings) on the primary that do not couple power to turns on the secondary and these can be a right royal pain for audio transformers because they are in-series with the power transfer and at high frequencies these "leakage" inductors are going to somewhat attenuate high frequencies. The bottom line is that audio transformer designers try to make sure that approximately 99.5% of the magnetic flux in the primary is coupled to the secondary so, if the primary is nominally 100 mH open circuit then less than 500 uH is seen as useless to the transformer and a detriment to high audio frequencies.
Even so, 100uH as a blocking impedance is nearly 13 ohms at 20 kHz.
Bottom line is that audio transformers are really good at providing low loss power transfer across a wide range of frequencies. No impedance matching is necessary. |
H: Extending diode with a buzzer
Basic idea is to extend existing device with a buzzer: I want to make noise when one of the diodes lights up (DL12 on the attached picture). From the layout of the board I assume that U1 (M74HC595) is driving both rows of LEDs (DL8-12 and DL13-17, only one diode from each row is lit at a time) in turns (fast enough that there is no flicker).
I want to read from U1 which is a tri-state logic IC and detect both QB and QG (Q1 and Q6 below) to make logical AND on them.
I was also to build simple circuit based on transistors but without luck (NE555 circuitry is omitted) :( What have I done wrong?
AI: I traced out part of the circuit and it appears that the LEDs are turned on by pulling the 74HC595 outputs to GND, not VCC. If this is correct then your 'Q1' transistor will be turned on whenever DL12 is not turned on. Furthermore, 74HC595 pin 6 is pulled low to supply power to the LEDs, so your 'Q2' transistor will only turn on when (if ever) power to all the LEDs is turned off. |
H: How do TTL NAND gates work?
This is supposed to be a simple NAND gate.
I understand how the output is 1 if one of the inputs is zero
but if both inputs are 1 then the base of Q1 is supposed to be zero. This is what I don't understand. I know that Q2 and Q3 will be in cut off so the base of Q1 is floating. If that is true, how is it zero then?When A and B are open does current flow through Q2 Q3 via R1 to turn on Q1?
AI: I know that Q2 and Q3 will be in cut off so the base of Q1 is floating.
Incorrect. A BJT is also a pair of P-N junctions, so if the emitters of both Q2 and Q3 are high then current will flow from the bases to the collectors instead, turning Q1 on. |
H: What are limitations of Kirchhoff laws in presence of A..C current.what are the bounds on its application in such case?
I'm not able to understand while Kirchhoff's laws seem to be based on very fundamental logic they are still not applicable in some cases.
I tried to look for answer in text book but got no clear view. On internet too I heaven't got very clear presentation but only lines such as
"They are accurate for DC circuits, and for AC circuits at frequencies where the wavelengths of electromagnetic radiation are very large compared to the circuits."
Please clarify my doubt.
AI: Kirchhoff's laws are applicable if the lumped element model of your circuit is valid, i.e. if you can assume that \$\frac{\partial B}{\partial t}\$ and \$\frac{\partial q}{\partial t}\$ are zero or neglectible outside all of your circuit elements (they may be non-zero inside the lumped elements like inductors or capacitors).
Kirchhoffs's laws are not valid, e.g. if you have to consider induction in one of your circuit loops or displacement currents into/out of your circuit nodes.
This is the case e.g. in antennas (as Ignacio pointed out) or inside parts of some lumped circuit elements (inductors, capacitors). |
H: How to calculate base-emitter current
I want to use a BC547 transistor to switch a MOSFET. The base-emitter side should be driven by a Raspberry Pi. The maximum output from the Pi is 3.3V, maximum current is 15mA but I would not like to have more than 6-8mA for safety reasons - output pins are connected directly to the ARM chip and I do not want to risk damaging it.
My problem is that I do not know how to calculate the base-emitter current.
The datasheet of the BC547 says that the base-emitter side is saturated at about \$V_{BE_{sat}}\$ =700mV, but I have no idea about the \$I_{BE}\$. I could measure it with a multimeter, but this question became a theoretical one for me.
How can I calculate the \$I_{BE}\$ for any \$V_{BE}\$ value and any datasheet?
Would it be wise to use a resistor to limit the base current?
AI: The base-emitter junction will drop around 0.7v when fully "on", so...
3.3v - 0.7v = 2.6v to drop
Ib = 8mA (the amount of current you desire into the base)
E = I*R
R = E/I
R = 2.6v / 8mA
R = 325 Ohms
325 Ohms (330 standard value) will give around 8mA into the base, at 3.3v and with 0.7v being lost from base to emitter. |
H: Calculating Power and Setup using resistors as heating elements
I looked around at other questions, and either I didn't understand what all I was reading, or it didn't answer my question so if there is an article that I've missed feel free to redirect me.
I'm fairly new to electronics, and came in through Arduino so I'm pretty fuzzy when it comes to the actual electronics behind how things work.
I'm trying to create a heating device for heating a chest freezer that I'm trying to convert to a incubator. I have the "coding" side done with Arduino, now I'm trying to build the electronics. I have some relays that I'll be using to turn things on.
HERE IS MY QUESTION
I have a 12v 6a DC power supply that is powering my entire project. I'm trying to use 4 x 10W 12ΩJ Cement resistors. How should they be configured to produce my needed heat.
So I thought to myself, "I have 12v * 6a = 72w power supply, if I'm using 4 x 10w resistors 72 watts would be too much for them." I hooked them up this way though, the resistors in series, and they barely heat up, so I must not know how these things work even though I thought I did.
Is there a good way to calculate how much power a resistor should get for me to reach a specific temperature. Is there a calculator, or anything that can be used, or a formula, or is it resistor specific?
If I connect Just 1 or 2 in series they get ALLOT hotter, but then I'm worried about burning out the resistors.
Any help would be great, even if its a bunch of "Go look and read over here." comments.
Thanks all.
ADDITIONAL DETAILS as Requested
The space being heated is about 1.5 Cubic meters, I don't know the insulation type, its a freezer, and the other unit I'm looking to make this for is a wine cooler.
The reason for using 12v DC is incase of prolonged power outage that it can be easily run off of a battery back up, or a solar panel / battery system.
The space can be heated with a 40w light bulb fairly well. There are other commercial devices like this, that use a similar setup.
The temperature I'm hoping to achieve varies depending on the egg, but no more then 100F.
As far as the 72 WATTS I was just saying that is what my DC supply is putting out, It would be much more convenient to run it on less obviously.
AI: First concentrate on each of your 12 ohm resistors. Their max rated dissipation is 10 watts. The quickest way to find volts and current from power and resistance is max_voltage = sqrt(max_power * resistance) (or you could simply calculate current and hence power for each of several applied voltages). In this case, sqrt(10*12) is roughly 11v.
As you have a 12v supply, you need 2 in series, where the 24ohm total will give you 0.5A, and so 3 watts per resistor. With a 10w rated resistor, if you feel it's getting too hot at 3w, that may mean it's not heatsinked sufficiently, or your expectations need recalibrating. A 10w resistor would need to be big to be air-cooled, or to get very hot. If it looks like it can be bolted down, do bolt it to a heatsink. If it's ceramic with no flat surfaces, then it's supposed to run very hot in air.
Two parallel strings of two series resistors will give you a total of 12 watts. Is that enough for your application?
[hooligan alert] In my world (turn it up until it blows up, then back off a bit), 12v on a 12ohm resistor will give you 12 watts, which a 10w resistor will probably survive for a while, as long as you keep it cool. Four such resistors in parallel would give you 48 watts, enough? [/hooligan alert] |
H: Why do I get a "[Synth 8-5413] Mix of synchronous and asynchronous control for register" warning in Vivado?
The code bellow is to take the reciprocal of a fixed point number using Newton's method. When start is asserted the state machine enters the estimate state. To get a starting point, I start at 1/2^N where N is the index of the most significant bit. It seems to work fine in simulation but when I synthesize it I get the following warning:
[Synth 8-5413] Mix of synchronous and asynchronous control for register abs_n_reg in module qinv. ["/home/chase/vivado-workspace/FixedMath/FixedMath.srcs/sources_1/new/qinv.v":45]
I'm not really sure why I'm getting this or how to fix it. abs_n_reg is the absolute value of n. I'm only setting its value from one of my always blocks.
module qinv(output reg signed [63:0] inv,
output reg ready = 1'b1,
input signed [63:0] n,
input start,
input clk);
reg sign;
reg [63:0] abs_n;
reg [63:0] cur_inv;
reg [63:0] next_inv;
localparam READY = 2'b00,
COMPUTE = 2'b01,
ESTIMATE = 2'b10;
reg [1:0] state = READY;
reg [1:0] next_state = READY;
wire [5:0] mb;
msb m(abs_n, mb);
always @(posedge clk or posedge start) begin
if(start && state == READY) begin
if(n[63] == 1'b1) begin
abs_n <= -n;
sign <= 1'b1;
end else begin
abs_n <= n;
sign <= 1'b0;
end
ready <= 1'b0;
cur_inv <= 64'b0;
state <= ESTIMATE;
end else begin
state <= next_state;
cur_inv <= next_inv;
if(state == COMPUTE && next_state == READY) begin
ready <= 1'b1;
if(sign) inv <= -next_inv;
else inv <= next_inv;
end
end
end
wire [63:0] p1, p2;
qmul m1(p1, abs_n, cur_inv);
reg [63:0] diff;
qmul m2(p2, diff, cur_inv);
always @* begin
next_inv = 0;
next_state = READY;
diff = 0;
if(state == ESTIMATE) begin
next_inv = {1'b1, 63'b0} >> mb;
next_state = COMPUTE;
end else if(state == COMPUTE) begin
diff = {30'b0, 2'b10, 32'b0} - p1;
next_inv = p2;
if(next_inv[63:1] == cur_inv[63:1])
next_state = READY;
else
next_state = COMPUTE;
end
end
endmodule
module msb(input [63:0] n, output reg [5:0] m);
integer i;
always @* begin
m = 0;
for(i = 0; i <= 63; i = i + 1)
if(n[i] == 1'b1) m = i;
end
endmodule
module div_test();
reg clk = 0;
always #5 clk = ~clk;
wire ready;
wire [63:0] out;
reg start = 0;
reg [63:0] in = {8'd207, 24'b0};
qinv d(out, ready, in, start, clk);
initial begin
#5 start = 1;
#10 start = 0;
#1000 $finish;
end
endmodule
AI: It's exactly as the warning says, you are mixing synchronous logic with asynchronous logic.
You can not use ... or posedge start .... |
H: How does a momentary dpdt switch function?
Ok I'm feeling dumb right now. I got one of these momentary dpdt switches and can see via ohm meter that the middle terminals are normally connected to one of their corresponding edge terminals when the switch is "NOT pushed." However, when I push the switch, I see the connection broken on the terminal that was previously connected, but I also expect the middle terminals to be connected to the "other" set of edge terminals. However, I don't see continuity. IOW, I expect the dpdt functionality explained in this article, albeit a toggle dpdt. I want to hook this up as a "normally off" switch rather than a "normally on" switch. I do need a dpdt since I need it to control two circuits. I have used TWO different ohm meters just to make sure. What gives?
AI: There is no guarantee it will be the center terminal that is common. Just probe it out. It will almost surely be symmetric on either side, but it may be one of the end terminals that is the common for each side.
In any case, there are only two 'states' for the switch, so write down what is connected to what when the plunger is pressed and what is connected to what when the plunger is released. If there are 6 connections you need to make a total of 30 continuity tests (5 + 4 + 3 + 2 + 1 for each state) to be completely systematic about it. If you short a few together and have a good guess you can cut it down to just a few tests.
Edit: Here is a similar looking part, and the middle indeed is the common: |
H: Is it a good habit to route wire under chip resistor/capacitor?
Is it good/safe to route under resistor/capacitor? As below, it's a 0.5mm wire under a 1206 chip resistor.
AI: It depends.
If you have a high density board, you might have too, otherwise it means you need a via, or have to take some irregular path on your board.
The problem might come from crosstalk. If you have a sensitive analog signal, and you pass it between a 1206, and the 1206 is part of a digital circuit, well you may get some coupling. However, this is true regardless if placing a trace between a component. Anytime you have any traces < 2-3 trace widths apart, will have cross talk. How much so, depends on frequency, plane distance, geometry etc..
Fortunately, from what in your picture, its a very short distance, and the coupled length is only the width of the pad. This should not be a problem if its a digital signal. If its analog, then it would depend on what your requirements are for that signal. How much noise can you handle before the going out of spec.
So it safe to do so, from a manufacturers perspective, but will it affect your circuit would depend. If you stick with the, keep analog and digital away rule, then you wouldn't have much of a problem. |
H: Calculated MOSFET switching time does not agree w/ expected results
In preparation to design my own boost converter, I am trying to analyze the poorly-performing 555 boost converter circuit discussed here (so that I know which mistakes to avoid):
555 timer boost converter doesn't meet spec
The circuit is reproduced here for convenience:
The accepted answer's comments suggested that the power MOSFET attached to the 555 has a switching-on time in the microseconds range and a current of approximately 1 mA. While I trust the posters' judgments, they do not explain how they reached those values. I wanted to try to calculate the expected switching time on my own and see if I could reproduce the results.
Using an IRF740 datasheet and an appnote (not enough rep to post the links) for calculating the switching speed during turn-on, I found the following equation:
$$
t_{ir} = (R_g + R_{g\_app})*(C_{iss}~at~V_{DS})*\ln(\frac{g_{fs}(V_{GS\_APP}-V_{th})}{g_{fs}(V_{GS\_APP}-V_{th})-I_{DS}})
$$
where:
\$R_g\$ is gate resistance.
\$R_{g\_app}\$ is external gate resistance (0 Ohms).
\$C_{iss}\$ is input capacitance (1400pF @ 9V).
\$I_{DS}\$ is Drain-Source current.
\$g_{fs}\$ is forward transconductance (5.8 S).
\$V_{Th}\$ is threshold voltage (4V worst case).
I made the following assumptions when trying to calculate switching time with the above equation:
\$R_g\$ is not given. Assume 1 Ohm.
Input \$V_{GS}\$ is 9 - 1.7 = 7.3 Volts, according to voltage drop from 555.
\$I_{DS}\$ at maximum is 1.44 Amps (worst case), according to the linked answer.
Inductor current is constant just before switch, so MOSFET sees 9V across drain and source.
\$C_{iss}\$ is assumed from chart (25C) on page 3 of the datasheet.
When I do the calculation, my predicted switching speed is approximately:
$$
1.4*10^{-9}*\ln(\frac{5.8(3.3)}{5.8(3.3)-1.44}) = 1.09*10^{-10}s
$$
My calculated switching time seems orders of magnitudes too fast, considering the output current calculated is in the milliamp range. Does anyone have an idea of what assumptions I made that do not hold, and what assumptions I should replace? It would be nice if I can get my predicted current and switching speed within an order of magnitude of previous analyses done by others (which I assume to be correct).
AI: Well, the guy that wrote that comment is an idiot. What should have been more clearly expressed was that at a switching frequency of 30 kHz, the energy spent to just switch the MOSFET is probably about 1 mA (out of the 100 mA you are measuring on the input). This was in response to the original version of the answer saying that all 100 mA was being used to switch the MOSFET gate. This is different from the peak magnitude of the gate drive current, which is heavily dependent on your 555 output.
So on to the 1-2 µs switching time figure... that was a guess because there were no oscilloscope waveforms. It is incredibly difficult to troubleshoot some circuits (or some "failure" modes) without any oscilloscope over the internet. I still think poor switching time is a reasonable guess (and maybe 1-2 µs is a bit high, but it's an estimate that's within an order of magnitude). Note that you can effectively prolong your switching time beyond the design spec if the MOSFET oscillates during switching.
Current saturation of the inductor is also a reasonable guess, and some proper ripple current analysis for a boost converter would really answer whether the inductor is appropriately sized.
@Autistic points out that the diode, as specified, is a 1N4004, which is a terrible choice for a switch mode converter. Slow diodes don't turn off quickly, which means that the output is discharging through the diode into the power MOSFET. Obviously, this is bad, so pay attention to the reverse recovery time of a diode when you're picking one out.
The system may also be unstable in a no-load configuration, as you will need to have a discontinous current mode operation in order to maintain the voltage. These are things that can go wrong, and without sufficient information all we can do is throw stuff at the wall and see what sticks. I think we were looking for 90mA of input waste or so.
On to your equations:
First off, be honest with your numbers (or worry when you start setting important variables to zero). You may not have a resistor in series between the 555 output and the MOSFET gate, but that doesn't mean that the external drive resistance is 0Ω. The Photon points out that the current rating for a 555 output is 200 mA, which gives an optimistic 45Ω. The internal gate resistance seems reasonable.
The next thing to mention is that the equation you mention (which is equation 17 in the linked app note) is only the switching time for the drain current! Note that equation 18 covers the voltage switching, and that time gets added to your current switching time. Understand that this is for a configuration commonly called a "clamped inductive load", meaning an inductor with a diode return path. Look at Fig. 4-6 in that app note and make sure you understand what is happening and why - it is not intuitive for many people.
Now with hopefully most misconceptions removed, lets look at the actual switching time from equations 17 and 18, with numbers. I'll use your numbers, with the following exceptions:
Rg_app = 45Ω (probably low, but lets go with it)
Qgd_d = 21nC (estimated from Fig. 6 in the MOSFET datasheet, 200V curve)
Vf_d = 0V (Vds_off >> Vf_d)
Vf = 0V (Vds_off >> Vds_on)
Vds_off = 170V (assuming steady-state condition), Ciss = 1.25nF
\$t_{ir}=(R_g+R_{gext})C_{iss} \ln(\dfrac{g_{fs}(V_{GSAPP}-V_{th})}{g_{fs}(V_{GSAPP}-V_{th})-I_{DS}}) = 4.5ns\$
\$t_{vf}= \dfrac{Q_{gdd}V_{DS}(R_g+R_{gext})}{V_{DS}(V_{GSAPP}-\dfrac{I_{DS}}{g_{fs}})} = 134ns \$
This gives a total turn-on time of about 140ns, if our assumptions are valid and everything is going right. Note that even in the app note, the calculated tvf was 1/3 the measured tvf. Read what the app note says about their calculations. Also, read through the wikipedia article on boost converters, that will help understanding the system. And finally, don't use a 555. There are hundreds of better alternatives for what you want to do that are not hacks that will work better. |
H: Why does capacitive loading occur when using passive oscilloscope probes?
I was recently reading an article written about oscilloscope probing. And at one paragraph there is a comparison between active and passive probes as in the below quote:
"For high-frequency applications (greater than 600 MHz) that demand precision across a broad frequency range, active probes are the way to go. They cost more than passive probe and their input voltage is limited, but because of their significantly lower capacitive loading, they give you more accurate insight into fast signals."
What does "capacitive loading" means in this context? Why are passive scope probes more prone to it in high frequencies?
AI: For a passive device the probe, the cable and the scope input have capacitance seen at the input: -
Here's a circuit of an active probe: -
It uses a JFET (or MOSFET in the case above) to buffer the input. Here's a typical comparison between the probes: - |
H: How actually an integral transformation(Fourier and Laplace) works?
After seeing a question on one of the posts I got this confusion in my mind. Here I'm not much interested in just mathematical explanation but I would like
to know how a transformation actually turns a time domain signal to frequency domain. And what frequency domain representation actually means.Since the signal say a unit step has 0 frequency.
Is it just a plot of magnitude of signal with frequency parameter or there is more to it?
AI: I can only explain why they work mathematically, b/c the way time-domain functions get turned into s-domain functions is mathematically-based.
Fourier and Laplace Transforms are based on a mathematical concept known as an integral kernel. An integral kernel is defined to be the \$f(x,t)\$ term in an integral of the form:
$$
F(x) = \int_{t_0}^{t_1}f(x,t)g(t)dt
$$
\$f(x,t)\$ defines a family of functions parameterized by x, such as \$e^{-jxt}\$, for example. There are an infinite number of functions that take this form one for each (uncountably!) infinite number of values of \$x\$ from, for instance, \$-\infty\$ to \$\infty\$.
Let's assume we're given a value of \$x\$, call it \$x_0\$, and a function \$g(t)\$ that we want to analyze. Let's assume the domain is \$\pm\infty\$. The above integral can be written as:
$$
A = \int_{-\infty}^{\infty}f(x_0,t)g(t)dt
$$
The above integral is known as an inner product, analogous to the concept for vectors in linear algebra. Informally, an inner product produces a number \$A\$ which measures "how similar in shape is \$f(t)\$ to \$g(t)\$?".
It turns out by summing every single function of the family \$f(x,t)\$, each with a constant multiplier \$A\$ obtained by evaluating the inner product with \$g(t)\$ at each \$x\$, one can get the original \$g(t)\$ as a result.
Now, to answer your question, Fourier Transform decomposes a function \$g(t)\$ into a set of complex exponentials \$f(x,t)\$ of the form \$e^{-jxt}\$. These are very closely related to sinusoids of an angular velocity \$x_0\$ by taking the magnitude of the resulting complex number.
Laplace transforms are similar, but of the form \$e^{-xt}\$, where \$x\$ is a complex number, and \$t\$ is limited from 0 to \$\infty\$ (\$x\$ is normally called \$s\$ in this transform. I am using \$x\$ for consistency). They don't have as nice an intuitive interpretation that I'm aware of. Wikipedia says the Laplace Transform decomposes functions into moments. Analyzing the values of the Laplace transform for values of \$x\$ of the form \$jx_0\$ gets you back to the sinusoidal interpretation as above.
As Lorenzo also points out, there are convenient properties of integral transforms that appear in the frequency domain, such as convolution of two functions \$f(x_0, t)\$ and \$g(t)\$ become a multiplication in the s-domain. |
H: Can an opamp be neither in linear region nor saturated?
I'm trying to build a voltage controlled DC current source. For this, I built this circuit:
A little bit of context. The voltage supply is 5V. Current range must be from 0mA to 30mA or so. Load will be an LED but for now I'm just connecting the collector to Vcc and measuring current with an amp meter. The transistor I'm using is BC337 and the opamp is OP07 connected to 5V and 0V. Vset is a PWM filtered with an RC circuit. Rset is 100 ohms.
Now for the part that doesn't work. For voltages above 1V, 20% of Vcc, in the input Vset, the circuit behaves as expected. That is, I get a 10mA current at 1V and I get Vset/Rset current for every Vset until the transistor enters saturation around 30mA.
For voltages under that, the opamp does something I'd never seen before, it operates neither in linear nor saturation region. As I start lowering the voltage on Vset, both inputs separate, the inverting input lowers less and less until it gets stuck at around 500mV. So the final result is that I have 0V in the non inverting input, 500mV in the inverting input and thus 5mA through Rset. This is obviously not linear region because there is no virtual short circuit. However, the voltage on the base isn't Vcc, if it were Vbe would be huge and I'd get a bigger current. Instead, it gets stuck at around 1V.
How can the opamp do this? What sort of operation is this and how do I stop it?
AI: Input voltage range.
Lets have a look at your opamp.
First notice that this table is for when you are using +/- 15V. Second, have a look at the input voltage range. Notice how it does not go up to the rails (+15V and -15V).
Now you say that when your input is 1V, everything is good, and the problem happens when you go below. This is because you are now outside the input voltage range and you must be within 1-2V of your supply. In your case, your supply is 5V. So what that means is that your input range must be between 1V and 4V (maybe even 2V and 3V. You'll have to measure it out, but seems like within 1V of the upper and lower rail will work.
When you start to do things that the datasheet says you shouldn't do, weird things can happen. The opamp will stop having predicted behavior and quite possibly, you'll get something called phase reversal. Instead of the opamp driving the output to one rail (as expected), it instead, will drive it to another. Fun times.
If you require your signal to go up to the rail, then what you need is a "rail to rail" or RRIO (rail to rail input output). These opamps can go have an input that goes up and down to the supply voltages AND output up and down to the supply voltages. The OP-07 does not.
As @Asmyldof pointed out in the comments, there are a lot of general purpose opamps that can do down to the lower rail such as the mentioned LM324
Notice that its input range extends down to 0V but it can only go as high as Vcc-1.5 (3.5V when using a 5V supply). This will address the below 1V problem you are having but you may not be able to reach your max current of 30mA.
If the Vbe of your transistor is 0.75V, and the max output voltage of the opamp is 3.5V, then the max current you can get is 27.5mA.
You can do one of the following with an opamp that at least extends to the lower rail
Decrease your emitter resistor slightly such that it is at most 91 ohms
Increase your supply voltage so that its at least 5.25V
Swap your opamp with a RRIO.
Basically, the opamp you selected is not exactly the best for your application or voltage range. |
H: LED light bulbs flicker when switched off - where does the energy come from?
Outside my house, at the front, I have a set-up of 3 lights attached to the wall. These lights can be switched on using a switch inside the house. Furtermore, they are attached to an infra-red sensor which can switch the lights on for 2 minutes at night time, when someone passes by. I have this same set-up at the back of my house. So far, so good.
I recently changed the light bulbs from incandescent to LED. At the back of my house, this worked fine. The set-up at the front of my house resulted in the LED lights flickering when switched off. If I place back 1 incandescent light bulb, leaving the other two lights LED, this problem does not occur. Following the post Mains LED light bulb flickers when switched off, I understand how LED lights work and why they can flicker. My remaining questions are:
Where does the energy come from leading to the flickering?
Can I
change something in the switch or the sensor to make it stop?
Why does the addition of an incandescent light bulb stop the LED lights from flickering?
Is a set-up with all incandescent light bulbs using up the same amount of energy, without me noticing as easily?
AI: Apart from what Brian says, which may very valid in some cases, there are also other options for why this happens:
The IR sensor hasn't got a relay but solid state switches: Solid state switches can always leak a tiny amount of current. This is why solid-state switch or dim packs in lighting rigs for shows need to be un-powered before people are allowed to modify cabling, as the leakage a "turned off" >10A triac can give, especially when aged a little can be dangerous or lethal in some cases. Depending on the design and Q.A. of the IR sensor the difference in leakage between one and another can be quite large.
The sensor showing the problem has more contamination/dirt on the inside, due to wind or rain or even due to sunshine degrading the plastic joints letting water and dirt in over time. This then creates creeping current between the switch contacts.
The IR sensor has a snubbering circuit that creates a leakage capacitance across contacts, which acts the same as the wire capacitance Brian mentions: A capacitor at AC (changing current directions) becomes a sort of resistance to the current flow, and thus allows a little leakage current through.
One of the switches in the system has a NEON pilot light, either hidden or still visible, which leaks a few mA of current through the load lamp.
A pilot light is connected like this, for reference:
simulate this circuit – Schematic created using CircuitLab
With an incandescent lamp, when the switch is open, you can see that the 250 Ohm of the lamp does not add much to the 30kOhm already in the loop, so the neon light will turn on, and only 1 to 2mA will go through your ceiling light, which will not turn it on at all, won't even get warm, as across the 250 Ohm it presents 2mA is only 0.5V, way too little for a 115V lamp to turn on.
Now a leaking Triac will also be in the range of 2mA to 10mA, so will most capacitive coupling. Creep (before other paths will trigger earth faults that should cause a power shut off) usually stays under 50mA. All of those current are much too low to cause any noticeable effect in the wire of the incandescent.
But what happens when that current goes through a LED bulb? Well, a modern CFL or LED bulb usually has very low, to nearly zero internal leakage, so then the internal circuitry can be seen as this (they are much more complicated if well designed, but for this purpose, this is the representation):
simulate this circuit
When you have a hard switch, all is well, switch on: Light on. Switch off, light off.
Now, what happens if you have something "pumping 5mA" into the lamp continuously? 5mA is still not enough to power the LED, right, so... That should not turn it on at all, 5mA is only 500mW, and your LED bulb is, let's say 10W, so the maths is clear.
Well, because there is no leakage, the 5mA will just charge the capacitor. If we assume the current to be perfectly constant (not entirely true, but close enough), it will charge up over time like this:
dV = (dt * I) / C with C = capacity of the capacitor, I is the constant current, and dt is the time period, and dV is the change in voltage.
At some point the capacitor charges to the turn-on voltage of the controller, and the LED will turn on, using the energy in the capacitor. Because your bulb drains the energy in the capacitor much quicker than the current can replenish it it will drop to the turn-off voltage and turn off.
Depending on the size of the capacitor and the turn-on and turn-off voltages of the controller, the flickering can be quick, slow, or even so quick that it looks like an always-on bulb that flickers in brightness.
These flickering speeds also get influenced by the number of bulbs connected.
Funny thing is, that based on the flickering pattern of 3 or more lamps connected to one system it is possible to make some assumptions about what might be the cause. While no guarantee, it has some basis in analysis that is valid.
If they all flicker in an nearly synchronous pattern, the leakage current is highly voltage dependant, whereas if they flicker less in sync the leakage current is more constant, and this may give hints about where to seek when there is a full scope of the entire system.
As a side note: If the flickering is a real "fluid" flickering in an on-state it may be that the LED controller leaks the current through into the LEDs without actually turning on and the flickering is caused by much smaller on/off margins and inferring anything from a pattern is much harder.
Will this energy also leak away if there are incandescents? Yes! As I showed you above, the current flows, you just don't see it. So in a way with the LED lights you're already winning, if you can get past the flicker annoyance, because now at least the leakage is doing something for you.
The reason the flickering stops when you add only one incandescent is basically also already answered: If you add the low-resistance lamp in the loop, the leakage will only cause up to a few volts maximum on the wires, which is way too little for the High-Voltage LED driver to turn on, or to leak into the LEDs themselves. |
H: Multi channel variable speaker design problem
As part of my my consideration of possible solutions to my multi channel variable speaker number problem arising from my attempts to restore radio functionality to an old hotel intercom system (see previous post on the subject if interested) I have been considering how to distribute say three audio streams delivered to multiple locations (by way of three/four cores per location), where a switch at those locations can be used to select an audio line.
My inexperience is leaving me slightly unsure of what approach to take in terms of the big picture / over all design. Basically what I want to achieve is this...
BUT... I want it for many (10+) rooms (the room being the right hand side of the diagram, where the switch and speaker is).
The problem is this leads to a design that looks more like this:
That's three 'rooms', but with a maximum design consideration of 4 audio channels and 13 'rooms' this means over 50 amplifiers. Small amplifiers are cheap, but still, I can't help feel it's a bit of a mad design!
Trying to come up with something more sane, I considered this:
BUT... The system should obviously survive usage, and here the impedance of the load applied to the amplifiers will change dramatically as variable numbers of speakers are turned on and the audio lines tapped... Obviously it's going to halve just from a second speaker being brought online with the same channel, and whilst it's not a likely use case, what if someone went round turning on 10 or more speakers all on the same channel!? The impedance of the load is going to be REALLY low now, and I have no idea if it is allowable to have such a variable impedance load for an amplifier. I do realise it's not normal or ideal, but is it acceptable if the amplifier is big enough to handle it?
I'd really appreciate any comments and/or help with the above questions or any suggestions for an alternative approach. I'm obviously more than happy to put time and effort into researching and working to expand the ultimate solution, but it's not currently clear to me which direction to go in at the moment!
AI: Yes, it is allowed to have that variable a load on your amplifiers, given certain precautions. Most amplifiers can tolerate open circuit on their outputs, and, subject to limiting the output so they don't get too hot, somewhat lower than their 'rated' load.
A common method for supplying multiple speakers from a central location is the '100v line' method. Each speaker has a transformer before it to raise its impedance. This can get expensive in transformers, that have to be rated for the audio range.
You should be able to buy high impedance speakers, 32 ohm is not uncommon. Ten of those in parallel would present around 3ohms to your amplifier, which most audio amps should be able to drive at less than max output with little distress. How much fi and power do you want, I suspect these higher impedance speakers will be lo-fi and low power.
You could precede each speaker by its own local amplifier, which would raise the per room loading to a level where it ceases to be an issue. If powering the amplifiers via the CAT5, you would want a beefy electrolytic across the supply at the amplifier. |
H: Connecting a Raspberry Pi to a 220V switch
I have a switch that works at 220-230V AC and I'd like to link it to my Raspberry Pi and I want to know what I have to do from an electrical point of view.
So my switch, when switched on, places 220V AC on a wire, which somehow I'd like to transform it to 3.3V DC so I can react from software when the switch is on.
I should mention that the switch may stay switched on or off an indeterminate period of time (which of course I will handle in software) and I wouldn't like to damage my raspberry.
How do I do this? Is a transformer the solution here?
AI: You can use an opto-isolator to convert your 220V to a 3.3V logic system. You can use this circuit for the same:
When you turn on the switch, the optocoupler will get some of the current from it (1-2 mA). This will turn on the transistor and you will detect a HIGH logic with your raspberry pi. Also, your ac input will be sinusoidal so the DC side output will be sinusoidal as well. To take care of this, a capacitor has been used which will ensure a continuous HIGH logic till the ac switch is turned ON.
Once you turn the ac switch OFF, the capacitor will discharge through the 390K resistor and you will get a logic LOW. There will be a delay of approx 100-200 milliseconds though, between switch getting turned OFF and your raspberry Pi detecting LOW because capacitor will take a while to discharge.
Besides being low cost, this circuit also gives you the added benefit of optical isolation. Even if something goes wrong on ac side, your raspberry pi is safe. |
H: Reset Power using 555 timer
I'm trying to cut the power for 5 seconds to my circuit every 30 minutes using a 555 timer. I've been trying to design my circuit using 555timer and NPN but im not having any luck with it has anyone got any suggestions?
Input Voltage: 5v
AI: The evil 666 555 timer is inappropriate for durations as long as 30 minutes.
What you want to do can be trivially done with a tiny microcontroller, like the PIC 10F200. It has a built in oscillator that is more accurate than what a 555 can do with common parts, is smaller, takes less power, and requires no external parts other than the bypass cap.
The firmware counts ticks to get arbitrarily long time delays. Since this is done digitally, all derived times are as good as the internal oscillator, which is a few percent.
If low power is important, then you have the PIC sleep most of the time, counting wakeups by the watchdog timer to keep time. The watchdog isn't very accurate, but it won't drift quickly. I've used it in low power projects where every 1000 wakeups I kept the processor on to calibrate the watchdog against the internal oscillator. It still sleeps 99.9% of the time, and the long term accuracy is only slightly worse than the internal oscillator. Note that a 555 with ordinary parts can't achieve that accuracy anyway, and would draw way more power.
If power isn't the issue, keep the processor running and counting instruction cycles. At a nominal 1 M instruction cycles per second, 30 minutes only requires a 31 bit counter, so you'd use 4 bytes (32 bits). |
H: Arduino's Resolution with Multiple Analog Inputs
Resolution of an analog to digital conversion means the ratio between the maximum value of the measured signal to the number of data point that it can resolve(0-1023). So for Arduino(10-bit) my resolution is 5V/1024=4.88mV. Now I wonder if this value changes when I read voltage from multiple analog inputs. For example if I read analog values from 5 inputs, is this means that my resolution decreases to 5*5V/1024=24mV?
AI: No, each input is multiplexed into a single 10 bit ADC. Regardless of how many analog inputs you read from, the resolution is 10 bits. In the future, carefully read documentation and all will become clear! |
H: generate high voltage using LM555 with a transformer
I'm a French student (please forgive my bad English spelling) who works on a system of portable echograph (you can find the information of the project on the wiki of echopen). Could you help me please?
I would like to generate a tension of 100V. First, I took a transformer from a system which is used to transform 230v to 12v. I tested it with a frequency generator to determine the inductance of the coil and the transformation coefficient:
L1 = 11.13mH
L2 = 31.89 mH
I saw that at 13kHz the voltage was higher.
I transformed 15Vpp to 110V and I wanted to integrate it into a system which used 10v.
So, I used a LM555 component to have a oscillating circuit.
The circuit I used:
My observation and problem:
I want to use a MOSFET to control the 10v but the voltage is dropping
The generating voltage from the transformer is not enough maybe I
need two elevation stages
When I plug the transformer, the square wave signal is distorted
I can't have more than 50V from the transformer (I have more using
the frequency generator)
You can find my work on this page
Edit: I forgot to tell, I can't have more than 50V from the transformer using the oscillating circuit, with the frequency generator I have 100V from 15Vpp (the problem is the tension dropping with a load resistance I suppose the frequency generator don't have power enough)
Edit 2 (02/31/2015) : this circuit works thanks a lot to everybody and especially "jp314", I have 130V from 12v!
AI: You need to determine how much power you need to transfer. From your wiki, I think you need plenty of peak power, and this circuit won't do that.
You don't actually need a transformer -- a flyback converter (boost DC/DC converter) will work, although you will need a high duty cycle to get 230 V from 12 V at high power. At low power, you can use discontinuous conduction, and simpler control (maybe even a 555).
To get started, use a single inductor between supply (12V) and a switch transistor (rated at > 230 V). drive the transistor on with the 555 for a time so that Ipeak = Vsupply*T_on/L, and Ipeak reaches the peak you need (related to the power you need). Then turn off the transistor, and the collector voltage will spike up (because of the inductance) to a high value -- use your D1 & C7 to rectify that. If you limit may duty cycle from the 555 to < 90 %, your circuit won't run away. Regulated the output by masking pulses when VOUT > 230 V. |
H: VHDL simulation shows 'X' for input
I'm new to VHDL and I'm trying to simulate an array multiplier.(I have used verilog before). However in the simulation results it shows 'X' for inputs which used to be '1'.Here is the result:
And this is the Testbench:
LIBRARY IEEE;
USE IEEE.std_logic_1164.ALL;
ENTITY array_multiplier_tester2 IS
END ENTITY;
ARCHITECTURE timed OF array_multiplier_tester2 IS
SIGNAL A,B:std_logic_vector(3 DOWNTO 0):="0000";
SIGNAL product:std_logic_vector(7 DOWNTO 0):="00000000";
BEGIN
UUT:ENTITY WORK.array_multiplier(main)
PORT MAP(A,B,product);
A<="0000"; B<="0000";
PROCESS BEGIN
WAIT FOR 23 NS;A(0)<='1';B(0)<=NOT B(0);
WAIT FOR 23 NS;A(3)<='1';B(3)<='1';
WAIT FOR 23 NS;A(2)<='1';B(2)<='1';A(0)<='0';B(0)<='0';
WAIT FOR 23 NS;A(1)<='1';B(3)<='0';A(0)<='1';B(0)<='1';
WAIT FOR 23 NS;A(3)<='0';B(2)<='0';
WAIT;
END PROCESS;
END ARCHITECTURE timed;
I've also tried to use A<="0001" instead of A(0)<='1', but the result was the same. I'm using Modelsim for simulation.
I don't know why it shows 'X' for input!
AI: You have multiple drivers for the signals A and B here:
A<="0000"; B<="0000";
and here:
PROCESS BEGIN
WAIT FOR 23 NS;A(0)<='1';B(0)<=NOT B(0);
WAIT FOR 23 NS;A(3)<='1';B(3)<='1';
WAIT FOR 23 NS;A(2)<='1';B(2)<='1';A(0)<='0';B(0)<='0';
WAIT FOR 23 NS;A(1)<='1';B(3)<='0';A(0)<='1';B(0)<='1';
WAIT FOR 23 NS;A(3)<='0';B(2)<='0';
WAIT;
END PROCESS;
The signal assignments at the first place continuously assign "0000" to A and B. These are not an assignment of an initial value.
Then your process assigns something to the same signals, thus, you have multiple drivers which are resolved. But, if you drive 0 at the first place and 1 in the process the resulting value is undefined shown as X in the simulation.
If you just want to initialize A and B, then move the first assignment into the process:
PROCESS BEGIN
A<="0000"; B<="0000";
WAIT FOR 23 NS;A(0)<='1';B(0)<=NOT B(0);
WAIT FOR 23 NS;A(3)<='1';B(3)<='1';
WAIT FOR 23 NS;A(2)<='1';B(2)<='1';A(0)<='0';B(0)<='0';
WAIT FOR 23 NS;A(1)<='1';B(3)<='0';A(0)<='1';B(0)<='1';
WAIT FOR 23 NS;A(3)<='0';B(2)<='0';
WAIT;
END PROCESS; |
H: Jumper Setting Modes in PIR motion sensor
I was going through the data sheet of the PIR motion sensor when i saw this:
So what i couldn't understand was the H and L trigger and how to change from H to L or L to H (like to do we have to provide HIGH to the H trigger to activate it or something else). I found a little bit of description here but i'm not fully able to grasp this:
AI: If you move the jumper to L position the sensor will 'toggle' (change state) every time motion is detected - probably providing the on-board timer has timed out. This is unlikely to be of much use in a practical application. (Watch the comments for corrections!)
Moving the jumper to the H position will result in the more usual sensor logic. The sensor will turn on when motion is detected and turn off some time after the last motion is detected. This sensor will reset the timer (which would otherwise turn the output off) every time motion is detected and would be suitable, for example, for room occupancy lighting control where you don't want the lights to blink off while the unit resets.
Select the mode you want using the jumper and connect the output of the module (and ground and power) to your other circuitry to use the detector. |
H: What does this schematic symbol mean (similar to solder bridge)?
this symbol is similar to solder bridge, but there is a connection on both end.
what does this symbol mean, and what is the equivalent pcb for this symbol
AI: It really is a solder bridge, with a separate trace connection as well. The trace can be cut if needed, and then the solder bridge can be used to rejoin the connection if circumstances change. |
H: Barkhausen condition on a Wien oscillator
Consider the Wien oscillator:
We can determinate the operational amplifier gain defined as:
$$A(s)=\frac{\bar{V_o}}{\bar{V_a}}$$
and the gain from the feedback network:
$$\beta(s)=\frac{\bar{V_a}}{\bar{V_o}}$$
where \$\bar{V_a}\$ and \$\bar{V_o}\$ are the complex amplitudes of \$v_a\$ and \$v_o\$, respectively.
For an oscillator we have the Barkhausen condition:
$$A\beta(s)=1$$
To determinate the dimension of the components from the circuit which satisfy the previous condition, we usually calculate \$A(s)\$ and \$\beta(s)\$ doing some circuit analysis and then impose \$Re\{A\beta(s)\}=1\$, \$Im\{A\beta(s)\}=0\$.
But starting from the definition of \$A\$ and \$\beta\$, we can say that:
$$A\beta(s)=\frac{\bar{V_o}}{\bar{V_a}}\frac{\bar{V_a}}{\bar{V_o}}=1$$
which already satisfies the Barkhausen condition for any dimension of the circuit components. So where is the point of finding the dimension of the components that make the circuit an oscillator, when any of them could do it?
This makes me confused...Is this thought correct?
AI: ....my only problem is how is possible that Aβ=1 for any dimension of the components
Well, the answer is relatively simple.
You have forgotten the most important condition for a circuit to oscillate:
1.) The Barkhausen criterion applies to the LOOP GAIN only. That is the gain of the loop under open conditions. In this case, the product (loop gain) Aβ(s) can assume any values (<1 or >1). This is because in this case Va is NOT identical to the input at the non-inv. opamp terminal. The criterion requires (under ideal conditions) that htis product is unity.
Further conditions:
2.) The Barkhausen criterion requires (and is applicable for) a linear system only. That means: The opamp must be operated in its linear transfer characteristic, and
3.) This criterion must be fulfilled for one single frequency only. |
H: How to fade in and out light bulb(220V) (Arduino)
I have relay conected with arduino and high voltage bulb, now how can I control voltage to fade in and out bulb? I know that a relay is an on off device so maybe a triac or IGBT would be needed?Would an optpcoupler be good for isolation? Should I use a PWM output on the arduino?
AI: With a relay? You can't.
The relay contacts are either open (lamp fully off) or closed (lamp fully on) and can't switch a relay fast enough to give a dimming effect.
simulate this circuit – Schematic created using CircuitLab
What you're looking for is a triac controlled dimmer.
simulate this circuit
In this case an opto-coupled triac is used. Your micro would switch the LED D1 on at the appropriate point in the mains half-cycle turning on the triac. The triac stays on until the next zero-cross of the mains and then turns off. At 100 (50 Hz) or 120 (60 Hz) half-waves per second the flicker is not noticeable.
Your code would have to monitor the mains zero-cross somehow, ramp the delay in triggering the triac and pulse the optoisolator at the right time. Plenty of examples on a web search. |
H: Arduino - Detect tone
I've got a strange setup:
Background:
I'm building a wireless binary transmitter with a couple of low powered CB radios. I've re-soldered the activator button and microphone on one; that sends two different tones (1500hz for 1, 1000hz for 0); this end of the setup runs beautifully with my Arduino.
My issue is with the receiving end: I've tried reading directly from the speaker pins using analogRead, but can't see any difference in the values from before the sounds are received, to after.
My question: how can I patch my way into the speaker on the second CB to Arduino so that I can read the tone/pitch value?
Sort of what I have:
simulate this circuit – Schematic created using CircuitLab
AI: Edit: skip to the bottom for a decent solution.
By default, analogRead() is far to slow to properly sample signals at 1kHz+. There are several things you can/should do if you want to use the Arduino ADC for tone detection:
Change the ADC clock prescaler. At 16MHz, I've been able to set ADPS as low as 3, although accuracy will be reduced.
Stop using analogRead(), and write your own ADC read wrapper. There is a lot of cruft in analogRead() that you don't need if you know what you're doing.
Put the ADC in free-running mode, so you don't have to wait for it to sample.
By doing all these things, it's possible to bring the sample rate of the ADC close to 10kHz or beyond, which is fast enough for your purposes. Note that unless your are quite clever with your code, this process is likely to use up almost all your cycles, leaving you with a not very useful Arduino.
However, there's an alternative: good ol' analog filters. Build two peak filters with high Q at your frequencies of interest, run them both into peak detectors, and then your Arduino need only look at two digital signals.
Edit: another way to do it. Rectify the audio, and clip it to a digital signal. Then count pulses in a constant time interval with the Arduino. This is the easiest way to do things (least hardware, doesn't require too many cycles, can run in an interrupt). |
H: Safety when using ATX power supply as benchtop supply
I found many pages where people convert an ATX power supply to a benchtop power supply to give 12, 5, 3.3V.
However the current output can be very high (several amps).
When using this and you NEED high current, that is great. However, when using this for typical benchtop hobbyist needs (e.g. supply 5V to a microcontroller) the current supply needs are small. I understand that it will draw as much current as it needs -- but my question is one of safety. Since the current "compliance" is essentially set to several amps, what happens if I accidentally touch + and -? Or what about if something in my circuit suddenly blows up and shorts + to -? Then I suddenly have several amps running thru my circuit. I believe then an internal fuse in the ATX unit will probably blow (right?) but at least for some short length of time there were several amps running thru my resistor right? or Wrong?Would anybody have a simple adjustable current limit circuit that I could build and add to my PSU?
AI: It's quite far from certain death (indeed, it's voltages "generally recognized as unlikely to be hazardous", but we just had a big long discussion of that starting from a more hazardous and less useful premise.) Summary - you're a lousy conductor, you won't carry several amps at those voltages. Doesn't mean you can't make a big messy spark, or start a fire, but it won't electrocute you if you leave the box closed, unless you walk off into very marginally possible or probable scenarios.
The simple answer if you want a small-amperage supply is some in-line fuse holders with fast-blow fuses of whatever size floats your boat. If a quarter-amp suits your needs, it does not matter if the supply can provide 50 amps. You won't pull much more than 1/2 amp for a very short period before the 1/4 amp fuse vaporizes.
The short-term probably more expensive, possibly long-term cheaper option is DC circuit breakers. |
H: How to automatically switch RF path to external antenna
I'm designing a circuit that has 2 antenna options for one transceiver @ 1.6 GHz. One antenna is internal and is the default RF load. Another antenna is external - to be attached by the user if desired. If and when the external antenna is attached, an RF switch will change the path from the internal to the external antenna. Here's a simplistic sketch of what I'm thinking...
I was thinking of using a directional coupler to measure the VSWR on my external antenna line and using the result to control the RF switch automatically.
Does this make sense? I'm not very experienced with RF designs... Are there any do's, don'ts or gotcha's? Best practices?
edits
My average transmitted power is 1.6W during a TX sequence. This is for a hand-held device (walkie talkie size)
AI: A few points which might be useful:
1) there are connectors with an RF switch in them, which are designed for exactly your situation. They pass RF to an internal antenna if there's no connector installed.
Of course they can't tell if there's a working antenna, only a connector plugged in. Also they're only available from tiny on-board connectors up to about mcx size, which is still pretty small, not rugged, not designed for many insertions, so this would only be useful for a one-off switching event, say if you had two installation options.
2) you may be able to detect the external antenna by its DC short circuit. Most antennas are DC shorted, it's good practice, and this would simplify your circuit a lot. Just a bias T, a power supply, and the RF relay. Don't forget protection diodes to prevent any spikes from ending up on the RF line. In fact, best to use a transistor and keep the voltage and current on the RF cable as small as possible.
3) detection by looking for return power means the radio will see an open circuit for a while, is this OK? If the wrong antenna is selected, the whole packet will be lost, what is the impact of this.
4) you'll need a supervisory crcuit to check regularly for the presence of an external antenna, every few minutes I suppose. You can only check this when the modem transmits, so you have a fairly tricky operating procedure. Think this through carefully.
5) your RF switch might end up being switched hot - is that a problem? Depending on the power levels that can damage a switch. It would be best for the transceiver itself to detect the antenna and make the switching decision. Not sure if this is possible for you though. |
H: Schematic to wiring diagram check for 3 mic mixer circuit using TL081
Need a bit of community validation to see that mapping of the following circuit schematic:
to this hand-drawn wiring diagram seems correct, and there are no obvious mistakes:
Also, does having 2 (or 3 inputs) instead of the 4 shown in schematic impact the circuit characteristics in any way ?
Similarly, does having more than 4 inputs instead, impact this circuit characteristics in any way ?
AI: The major issue is that the wiring diagram omits the input coupling caps in the schematic. The previous stage may have an output coupling cap built-in, but you should not depend on that.
Another issue, which is both in the schematic and the wiring diagram, is that the ground connection is tapped off between the two batteries. This could unbalance the batteries, which in the case of secondary (rechargable) batteries could lead to irreversible damage to one of them. I recommend that you switch to using a rail splitter instead; a precision splitter IC would be the easiest solution, but even a simple voltage divider/voltage follower combination would suffice. Failing that, don't use rechargable batteries in this circuit.
As for the number of connections, the input resistors attenuate the input signals and the feedback resistor causes the op amp to amplify them back up to their original combined volume. This scheme is called a summing amplifier since its output is simply the sum of all inputs. The number of connections should not matter provided the input and feedback resistors are all of very similar values. |
H: Overcharge Lithium-Ion when using charge controller + Arduino Load
I'm trying to determine if I need to rethink my circuit for a solar + Li-Ion powered Arduino. Basically a solar powered module with 3.7V Li-Ion backup for night / clouds (to be charged during the day). Being my first go at utilizing solar + rechargeable batteries, I've been looking at this [1] instructable, specifically Part 6.
Essentially my circuit is a solar panel connected to a TP4056 Li-Ion charge controller's IN connectors. I have my BAT+ connected to a 3.7 Li-Ion + terminal and the IN+ boost regulator to boost up to 5V, and likewise with the negatives. My boost regulator then connects to the Arduino.
My worry is that with all these in the same circuit, the charge controller will never stop outputting power to the regulator in order to run the Arduino, which could then cause anything unused to flow into the Li-Ion battery, possibly overcharging it.
Is this a legitimate possibility, or is there just something I've yet to learn more about?
[1]
http://www.instructables.com/id/SOLAR-POWERED-ARDUINO-WEATHER-STATION/?ALLSTEPS
AI: The TP4056 reports that the charge-point accuracy is 4.2V within 1.5%. Your battery is essentially acting as a nice, large pseudo-capacitor in feeding the input of your 5V boost regulator. In an ideal world, if your solar input is sourcing enough power to keep the battery fully-charged, and run the Arduino, I would expect the TP4056 to sit in constant-voltage mode keeping the battery topped off while the boost regulator operates nominally. This would keep the voltage around 4.2V (assuming some hysteresis) and you're set.
The major 'concern' here in my head is that while the battery is a beefy enough device to feed your boost regulator, I don't know how the TP4056, which appears to be a mass-market ASIC out of Shenzen for consumer devices, deals with a potential switching load on its output. You don't want a scenario where the boost regulator causes such ripple that the TP4056 oscillates wildly; luckily, you have a large reservoir known as a battery on the line, so it should bear the brunt of the load. I assume it was at least considered, thinking about the types of product the chip ends up in, but the boost regulator will apply some ripple to the battery as it continuously switches current into its inductor. I've seen enough projects and products do this that damage is not going to happen, but I'd personally get scope waveforms of what's going on on the BAT+ rail. |
H: LM358 as a comparator output problem
I've got an LM358 based ground fault detector circuit that I've recently revised, and the revision broke it, so far as I can tell.
To make a long story short(er), what it amounts to is using one of the LM358 stages as a comparator has whacky output levels. There's a 5 volt supply, and the inverting input has a 20k/100k voltage divider, for a fixed .833 volt comparison level. When the non-inverting input is 0 volts, I would expect the output to be 0. In fact, it's 4.32 volts. If I make the non-inverting input rise up above the threshold, it goes up to around 4.5 volts.
Now, the old version of the circuit had a 1N4148 diode on the output with a pull-down resistor to ground after that.
What is the diode and pull-down supposed to achieve? Why isn't an LM358 acting as I expect without it?
AI: Not every op amp is perfect, nor is an op amp a good substitute for a comparitor. Please consider replacing it with an actual comparitor. As for why you should, that op amp must be pulled down with a 2KOhm resistor or higher in order to meet TTL logic specs (Vcc-1.5 = 3.5V in this case). It's in the datasheet. The Diode is there to prevent the op amp from sinking current and even out the H->L and L->H transition time.
As for why your output is not working. I'd have to see a diagram. From what you describe it should be working. |
H: Why does this circuit work?
I'm suffering from a bit of confusion here and I was hoping that some kind soul here would be able to help me out. I want to build a small DC motor circuit just for fun, but I can't understand some aspects of the circuit (shown in the picture below)
.
So basically I understand that Ic = Beta * Ib. Thus (assuming that D3 is 3.3 V and Beta is around 100), I can say that Ic = 100*(3.3/1000) = 0.33 Amps.
Then, in order to find the voltage available to the motor, I must find the voltage drop across the 33 Ohm resistor and subtract that from my power rail voltage (5 V).
So 5V - (0.33)(33) = 5V - 10.89V
Which is quite clearly ludicrous. Can anybody quickly explain to me the fault in my reasoning? I'd really appreciate it.
AI: ... I can say that Ic = 100*(3.3/1000) = 0.33 Amps.
Incorrect. You can say that Ic has a maximum of 0.33A (or whatever it would actually be with the correct values and formulae). If the supply isn't actually capable of supplying that much for any reason then the transistor is operating in saturation mode, where it acts as a switch. Which is exactly what we want it doing for operating a motor. |
H: Which is correct, kohm or kOhm?
Should the unit "Ohm" be capitalized or not? For example, "kOhm" versus "kohm" vs "kΩ", which is most correct?
AI: In my experience "kΩ" is preferred, but if you don't have the "Ω" symbol available on your computer then you need to write out the full words in lowercase: "kilo ohm".
See here for the standards on writing out SI units: International System of Units
The Wikipedia article on the ohm says it should be "kilohm" (not "kiloohm")
if written out, which I've not seen in my experience, but I'll include this for full reference. |
H: Volume of sand in a cat box - ultrasonic sensor?
My cat is always making fun of the sand that is inside of his sanitation zone :)
In order to better control the amount of sand that is present on the container I'm developing a communications circuit to collect data from the box. But I would like to develop something that could give me volume of the sand that is in the box. The idea is to collect values 4 times per day. Is it possible to achieve this with an ultrasonic sensor ? I have no experience with this kind of sensors. Any ideas or tips ?
I was also thinking in taking photos and having a service to analyse the photo. But this option is more time demanding and needs light adjustments...
The box has 100cm depth x 100cm width x 70cm height (I can expand if necessary, which will be for the sensor)
Can I make it with ultrasonic sensor ?
Thanks!
Best.
AI: If you're trying to setup some sort of auto-refill or alerts based on litter box levels I would rather look into a system based on weight measurement setup to determine amount of litter present instead.
Although this would need to be adjusted for different brands of litter. |
H: Glass fuse identification - Siran No. F 13 4A
We have a glass fuse for a 12v lighting circuit that has
"Siran No. F 13 4A" written on paper inside it. The circuit takes 5.5A at the moment with all the lights switched on without the fuse blowing. Can someone tell me what this is rated at? It seems to be a fast blow (F) so can it really be a 4A?
I figure my options are
13A (so what does the 4 mean?)
13.4A
4A (why is it still working at 5.5A?)
Thanks for reading, Steve
Edit: Images added as requested. Fuse shown with left side in holder
AI: It might be a 4A fuse allowing 5.5A at the moment. To understand why/how this can happen, you need to know the working of a fuse. The fuse will have some finite resistance R and a current I through it will start adding heat to the fuse as per the equation - IxIxRxt where t is the time. This heat energy will raise the temperature of the fuse and at one point, it will melt. However this isn't the only thing going on in there. The fuse is also losing some of the heat to its surroundings and hence the surroundings also play a role in deciding the current at which the fuse will blow and the time it will take to blow. Here is an excerpt from a fuse sizing guide:
In your case, one of the following might be the case:
1) Lack of quality control - Maybe the fuse company didn't control the tolerance very well.
2) Fuse is losing too much heat to its surroundings.
3) Fuse is not a fast one and it might blow given enough time.
4) It's not a 4A fuse. |
H: Is a Van de Graaff generator a voltage or current source?
I'm currently studying basics of electrostatics and this question comes to me as any generator must be from either of the two types but which is the fact I'm not able to justify which. From its internal construction it does not simply fit in either of the two.
AI: A van den Graff generator is considered a current source because it is capable of providing the same current no matter the voltage that is developed. There is a constant transfer of charge
The fact the current capability is tiny doesn't change the fact it's behaviour is that of an almost ideal current source. |
H: Startled by a notation of operator for combining two signals
I am studying electronics and when practising, I got stuck at this simple problem of summing two signals. I believe I know how to work out everything except the combination of the two signals with two "minus signs".
The problem is
i.e. one signal of 0.1 V (rms) going through amplifier block with gain of -3.3 dB and other signal of 0.4 V (rms) going through amplifier block of voltage gain of 0.902 are combined together and then go through amplifier block of gain 4 dB. Both signals consist from an uncorrelated noise.
I think that the attenuated signal from the first source is
$$ V_1 = 0.1 \cdot 10^{\frac{-3.3}{20}} \approx 0.068$$
and that the signal from the second source is $$V_2 = 0.4\cdot0.902 \approx 0.36$$
I have then tried to add these signals together and get the \$V_\text{out}\$:
$$
V_\text{out} = (V_1+V_2) \cdot 10^\frac{4}{20} \approx 0.680
$$
which is quite far from the correct answer of \$582\:mV\$.
I believe that I have not combined the signals correctly — I have also tried combining them with negative signs, but that would just yield negative voltage. Could someone please explain me what this notation of combining signal means?
AI: V1 is 100mV attenuated by 3.3 dB and +3.3 dB = a ratio of 1.462.
Therefore V1 becomes 100mV/1.462 = 68.4 mV (as you have said).
V2 is 400mV reduced by 0.902 to 360.8 mV (as you have said)
Here's where the problem lies - these are uncorrelated noise sources and have to be added using pythagoras....
So, the output from the summer is \$\sqrt{0.0684^2 +0.3608^2}\$ = 367.2 mV
This is then increased by 4 dB (ratio of 1.584) to 1.584 x 367.2 mV = 582 mV. |
H: Mosfet is getting hot under 3v drive
I have a Arduino controlled RGB strip, which uses PWM to control the brightness of each colour. I have been using an Arduino UNO to do this but I have have just upgraded to a Photon by particle. Similar to a micro Arduino but with wifi shield built in. The main difference is that the Arduino Uno is 5v and the Particle is 3.3v.
When I do the switch using the same value for analogWrite the particle seems to make the mosfets (STP16NF06L) heat up, not to a burning temperature but warm. I have checked the minimum threshold for the mosfet, which is 1v, and the power being used by the strip is not exceeding the drain current.
I just want to check that I am doing this right and not damaging the mosfet, thanks in advance.
Here is the datasheet for the mosfet http://www.farnell.com/datasheets/1690175.pdf
The circuit diagram
(source: makeuseof.com)
AI: The answer to this is fairly simple. The MOSFET turns on more (i.e. to a lower drain to source resistance) when it is given more gate voltage. In your case the 5V gate drive was letting the FET go to lower resistance than what you are now getting with the 3.3V gate drive. At the same load current this increased FET resistance is causing more heat to be produced in the FET thus they get hotter.
BTW.....the 1V level that you mentioned is not the instant threshold where the MOSFET goes from Off to fully On. The MOSFET has a range of voltage on the gate over which it turns on. |
H: Charging all night and its effect on the charger
I googled about this topic and I found that keeping the charger plugged in the wall for days will consume a very small amount of energy and will not cost too much. And most of smart phones disconnect the battery from the charger automatically when the battery is fully charged. So The battery, The phone, and The money are in safe.
What about the charger itself? If I keep it plugged in the wall mains for all night or for many days, Does that affect the life time? I would NOT like to buy a new charger every month :)
AI: Failure of electronic components can be caused by a range of different mechanisms, but the common factors that accelerate failure are heat, applied voltage and applied current.
If your charger is well designed, and stays cool, and your mains doesn't suffer from large voltage spikes, then I wouldn't expect it to fail from staying plugged in - at least not within the expected lifetime of the device it was intended to charge. If the charger is allowed to continually get hot because of poor ventilation, or if it's badly designed or cheaply made such that one or more components are operated close to or outside their voltage, current or power handling capabilities, then I guess unplugging it when not in use might extend its lifespan.
There are some failure mechanisms that arise from thermal cycling, i.e. alternate heating up and cooling down, which might argue for leaving the charger powered, but it'll probably undergo thermal cycling anyway because it will heat up when charging a device and cool down again when idle.
(Some background information on failure mechanisms of electrolytic capacitors and semiconductors, which I would guess are the most failure-prone non-mechanical parts of a switch-mode charger circuit.) |
H: Advice needed: comparing two parts
I want to buy some 0402 SMD capacitors (well some is about 1 to 10k).
I always use the method of use the cheapest part for the given specs approach. But today I noticed something odd:
I was comparing these two parts on digikey:
Partno. Price/piece Price for 10k
-------------------------------------------
490-10777-2-ND 0,00317€ 31,68€
399-8942-2-ND 0,08236€ 823,63€
The top one is from a company called murata (never heard of them) and the bottom one is from KEMET (which I know of).
But looking at the specs given, there is absolutely no justification for the much higher price:
I know there might be some other parameters which might come in to play which are not listed by digikey.
But really 10 times the price for some capacitors? What is the justification ? Is it because of the brand-name? If so, why should I care?
AI: Making an 100nF/10V X7R in a tiny 0402 for $0.002-0.003 is close to bleeding edge. My take is that Kemet is an older U.S.-based company and they simply have not mastered it yet. They do have competitive prices on 0603 parts.
Since you have the choice of many well established Asian companies you're probably fairly safe with that size - Samsung (Korea), Taiyo Yuden (Japan), Murata (Japan) and Yageo (Taiwan) all have competitive prices in your one-off quantity (one lone reel is not reely a large quantity). If you're not buying for mass machine production, 0402 is not pleasant for hand assembly- 0603 is worth the small difference IMHO. |
H: Ways to voltage shift a wave down to ground
Say I have a wave signal that is always above ground, that is, the signal is positively clamped to the ground.
(EDIT: from an input of a helpful user, I now know this should be called "negatively clamped", my mistake)
simulate this circuit – Schematic created using CircuitLab
How do I voltages shift this to ground? I mean, have the average of a single period of the original wave exactly at ground; the upper half of the original at positive; and the original lower half at negative voltage.
Assuming we only work with sinusoidal waves, I believe this can be done using a transformer and capacitor and the upper half of the original wave, but what are my other options?
simulate this circuit
-- I don't know how to chop off the other half of the sine wave from V_IN
EDIT:
In the 2nd circuit, when I mentioned only taking the upper half of the sine wave, I mean that's just the minimal input we need. I suppose we can simply leave out the capacitor and take the whole wave. Though I've never been sure of creating reverse direction currents (on the 2nd winding) if the input (1st winding) happens to be simply oscillating, but negatively clamped to ground.
EDIT:
Here's what we're trying to do:
to:
In other words we are trying to remove the DC component which happens to be the average of a period.
Another way of saying it is using a differential amplifier of gain of 1.
AI: No need for a transformer (which, being far from ideal, do terrible things to most signals.) This is what a capacitor coupled input does - removes any DC bias on an AC signal. [and it couples to the whole input signal, not "the upper half"]
simulate this circuit – Schematic created using CircuitLab
Source is a 10V sine with a 5 v offset (ie, all above ground) out is centered on 0V. Feel free to alter the wave shape if it makes you happier, makes no difference. |
H: What is the difference between worst hold slack and worst negative slack
I have been looking all over google and I can't find a clear answer for what is the difference between worst hold slack and worst negative slack in the timing summary in vivado. Right now I am building a integer divider and I am passing the worst negative slack but failing the worst hold slack. What is the difference between the two?
AI: Worst negative slack is likely referring to setup times as opposed to hold times.
If you are failing hold timing, you should try to improve the setup slack (even if it is passing). Doing that will allow the fitter to basically make the routing delay longer to increase the hold times (at cost of setup time). |
H: How to pick MOSFETs and drivers for FPGA BLDC driver?
I am building a Brushless DC Motor driver based on an FPGA.
I need to pick the transistors and drivers.
Do I need an IC driver or can I use smaller transistors?
The motor runs on 15A/16V.
I am estimating 50kHz switching frequency.
To be able to use them without cooling i calculated a maximum Drain-Source resistance of about 4mOhm.
CSD17506Q5A seems to fit the requirements. Is this a good choice? How should I drive it?
Do I need external diodes?
AI: Driving the ~1.5nF input capacitance of the specified MOSFET might be more than you could muster from an FPGA. With 50 kHz switching, the period is 20 us and you'll want switching times to be less than (say) 5% of this period (to maintain efficiency) and there are two switching events in that time so, you want to be able to charge (or discharge) the gate in about 500 ns.
I = c dv/dt and if your dv/dt is (say 3V/500ns) 6 MV/sec, I estimate the current injected needs to be 9mA but the potentially bigger problem is with the mosfet - it needs more gate voltage: -
With a gate-source voltage of 4V, the volt drop at 15A is about 0.07 volts - that's an equivalent on resistance of 4.7 milli ohms - can you provide a 4V drive is my big concern?
My next concern is that you probably haven't figured out how to drive the transistors at the top of the H bridge - these cannot be easily driven from an FPGA - you need a specialist driver chip. Probably something like this: -
The chip above is an ISL83202 but plenty of folk make similar offerings like this one from IR: -
So, do a bit more digging around and find the driver that suits your logic levels and the mosfets you want to use. |
H: High Current DC Power Supply
I'm attempting to build a compact way to charge six laptops (of the same model) so that I may avoid using six individual power cables. I'm trying to make it cost-effective yet safe.
My initial design was to take a simple 24V 15A DC power supply off Amazon and branch the output connection to six individual boards that each drop the voltage to a specific value using an LM317T. However, all parts including an enclosure came out to be about $45. I need 5 of these power hubs. Additionally, the charger for this brand of laptop is rated at 19.5V 3A. Wouldn't that mean that all six laptops draw a combined load of 18A, or does the manufacturer design the charger with some sort of leeway?
I am unable to find any DC power supplies that exceed 15A and are under $30. How hard would it be to build something that is capable of providing, let's say, 20A? Could I take a circuit designed for 5A and substitute parts that are rated for higher amperages?
Below, I've provided an image that illustrates the device I'd like to build:
AI: This is unlikely to work. Most laptops nowadays have more than just power and ground going between them and the charger. There is often a communication channel too. The laptop and the charger communicate over some proprietary protocol so that the laptop can scale back and not give you full charging features if you try to use something other than the manufacturer's charger.
Some of this is legitimate in that the manufacturer doesn't want to be on the hook for a warranty repair if the unit got damaged by a crappy charger. Much of it though is to force you to pay for their overpriced charger. Nonetheless, it is what it is.
Some third parties have gotten the specs or reverse engineered them for certain laptop brands, and you can by their chargers for much less than the laptop manufacturer's. Instead of trying to do what you suggest, it would be better to get a bunch of such laptop chargers that are compatible with your brand of laptop. They can usually be had for low 10s of $, so a small fraction of the price of the laptop. |
H: Does PCIe hotplug actually work in practice?
I've got into a discussion in the comments of https://security.stackexchange.com/questions/109199/is-physical-security-less-important-now-for-securing-a-server?noredirect=1#comment194327_109199
The question is simple. Has anyone experience of successfully hotplugging a PCIe card? Does it require special motherboards and cards, or is it supposed to work on all consumer hardware?
AI: I used to design PCI-Express hardware that required full hot-plug support in hardware and software, and it certainly is possible, but it's quite involved and requires extensive software support -- the hardware is actually quite simple. I had to design the hardware, then implement BIOS (UEFI) and kernel (Linux) support for hot-plugging arbitrary PCIe devices over fiber and copper.
From a software point of view, one must remember that PCIe continues with the PCI software model, including the concepts of bus, device, function addressing. When the PCI bus is enumerated, it's done as a breadth-first search:
PCIe enumeration is generally done twice. First, your BIOS (UEFI or otherwise) will do it, to figure out who's present and how much memory they need. This data can then be passed on to the host OS who can take it as-is, but Linux and Windows often perform their own enumeration procedure as well. On Linux, this is done through the core PCI subsystem, which searches the bus, applies any quirks if necessary based on the ID of the device, and then loads a driver who has a matching ID in its probe function. A PCI device is ID'd through a combination of it's Vendor ID (16-bits, e.g. Intel is 0x8086) and Device ID (another 16-bits) -- the most common internet source is the PCI ID Repository.
The custom software part comes in during this enumeration process and that is you must reserve ahead of time PCI Bus numbers, and memory segments for potential future devices -- this is sometimes called 'bus padding'. This avoids the need to re-enumerate the bus in the future which can often not be done without disruption to the system. A PCI device has BARs (base address registers) which request to the host how much and what type (memory or I/O space) memory the device needs -- this is why you don't need jumpers like ISA anymore :) Likewise, the Linux kernel implements PCIe hotplug through the pciehp driver. Windows does different things based on the version -- older versions (I think XP) ignore anything the BIOS says and does it's own probing. Newer versions I believe are more respectful of the ACPI DSDT provided by the host firmware (BIOS/EFI) and will incorporate that information.
This may seem pretty involved and it is! But remember that any laptop / device with an ExpressCard slot (that implements PCIe as you can have USB-only ExpressCards) must do this, though generally the padding is pretty simple -- just one bus. My old hardware used to be a PCIe switch that had another 8 devices behind it, so padding got somewhat more complicated.
From a hardware point of view, it's a lot easier. GND pins of the card make contact first, and we'd place a hot-swap controller IC from LTC or similar on the card to sequence power once the connection is made. At this point, the on-board ASIC or FPGA begins it's power-up sequence, and starts to attempt link-training its PCI Express link. Assuming the host supports hot-plugging and the PCI Express SLTCAP/SLTCTRL register (in spec: PCI Express Slot Capability Register, PCI Express Slot Control Register. There is a 1 and 2 for this as well -- enough bits to split across two regs). for that port was configured to indicate the port is hot-plug capable, the software can begin to enumerate the new device. The slot status (SLTSTA, PCI Express Slot Status Register) register contains bits that the target device can set indicating power faults, mechanical release latch, and of course presence detect + presence changed.
The aforementioned registers are located in 'PCI (Express) Configuration Space', which is a small region of the memory map (4K for PCIe) allocated to each potential bdf (bus:device:function). The actual registers generally reside on the peripheral device.
On the host side, we can use PRSNT1#/PRSNT2# as simple DC signals that feed the enable of a power switch IC, or run to GPIO on the chipset / PCH to cause an IRQ and trigger a SW 'hey, something got inserted, go find it and configure it!' routine.
This is a lot of information that doesn't directly answer your question (see below for the quick summary), but hopefully it gives you a better background in understanding the process. If you have any questions about specific parts of the process, let me know in a comment here or shoot me an email and I can discuss further + update this answer with that info.
To summarize -- the peripheral device must have been designed with hot-plug support in mind from a hardware POV. A properly designed host / slot is hot-plug capable as well, and on a high-end motherboard I would expect it to be safe. However, the software support for this is another question entirely and you are unfortunately beholden to the BIOS your OEM has supplied you.
In practice, you use this technology anytime you remove/insert a PCIe ExpressCard from a computer. Additionally, high-performance blade systems (telecom or otherwise) utilize this technology regularly as well.
Final comment -- save the PDF that was linked of the Base Spec, PCI-SIG usually charges bucks for that :) |
H: Is there any material that obstructs or resists capacitive sensing?
For example, is there any material I can place over a capacitive sensor, or the finger or conductor approaching it, so that the sensor will no longer activate?
AI: A capacitive touch sensor sort of forms a parallel plate capacitor with your appendages. As capacitance increases above a threshold, the sensor triggers. So, let us examine the capacitance of a parallel plate capacitor and see what we can do to reduce it:
$$
C = \frac{k \epsilon_0 A}{d}
$$
where \$ \epsilon_0\$ is the permittivity of space, a constant; \$ k\$ is the relative permittivity of the dielectric, dependent on the material between the two plates; \$A\$ is the area of the plates; and \$d\$ is the distance between them.
You can increase \$d\$ by a little bit by adding some material, but as you said in your comment, this alone is not enough.
\$A\$ is tricky to change; you don't want to modify the sensor, and your fingers aren't going to shrink.
It seems the obvious solution, then, is to reduce \$k\$. Unfortunately, as far as I am aware, \$k \simeq 1\$ for air, and all solids have \$k>1\$.
So, it seems like this is not possible. |
H: Question about FTDI USB-to-Serial Evaluation board
The evaluation board
I am talking about the FTDI EVAL232R evaluation board which can be found at the bottom of this page. It employs a FT232RL IC.
What I want to do
I would like to connect a USB joystick to the board´s USB port, then connect the RS232 interface to my PC, move the joystick and check out the incoming stream of information.
What I tried
I know that those converters usually are used to program a microcontroller over USB and similar things. There the USB port connects to the PC and the RS232 interface to the chip. In the datasheet I can not find any clues as to which extent a reversed flow of information (from joystick to PC) is possible.
Is the above board the right one? If not, could you please point out a device that would better suit my needs?
Edit: I rephrased the title to make it more general.
AI: The FT232 chips are USB-UART bridges that act as USB devices. From your description, you want it to act as a USB host. That won't work. |
H: Does a boost converter lower the source current of a solar panel?
I am trying to build a solar powered phone charger using small size solar panels. I have two solar panel connected in series, each of them are 4 V and 50 mAmps. When I connect the solar panels to the input of the following boost converter, it shows its charging but the battery level actually goes down, instead of going up.
http://www.amazon.com/Module-Battery-Converter-Charge-Samsung/dp/B00C93Z8JY/ref=sr_1_9?ie=UTF8&qid=1451591616&sr=8-9&keywords=dc+dc+step+up+converter
I am not sure if using a boost converter a good idea since in cloudy days the voltage goes down to approximately 4-5 V. The current for the solar panels are 50 mAmps. So is the boost converter actually lowering the current?
Thank you
Sorry I meant connecting the solar panels in parallel giving an output of 4V and 100 mA
AI: I'm confused -- if you have two 4V solar panels in series, your open-circuit solar cell voltage is going to be 8V, and you want to have a buck converter to get 5V for charging a phone. Hooking up 8V to that Amazon module will likely damage it.
If you have two 4V solar panels in parallel, now a boost converter would make sense to get 5V, and that module could potentially work for you.
Regardless, think about your problem in terms of power. A solar panel with 4V open-circuit voltage, and let's say your 50mA number is short-circuit current, we can back-of-the-envelope as a 200mW device. If you put these both in parallel, you have about 400mW (theoretical) you can deliver to your device, assuming perfect power transfer (which of course we cannot do).
Now, assuming that you are not doing any peak-power tracking and are applying the output of the cells straight into a boost converter to get 5V, assuming perfect everything (which again, is not true), your best case delivery to a phone is 5V @ 80mA...which is not very much. I doubt that's enough to even trickle charge a modern smartphone. If we assume that your energy conversion process is 80% efficient, that's even less transfer -- only 64mA delivered ((0.8 * 400mW) / 5V).
In the scenario where you have placed them in series, you would have the same amount of power available, but you would use a buck converter instead of a boost converter.
So:
Don't hook up the panels in series to a boost converter.
You don't have enough power in either scheme to do what you want and charge a phone sufficiently (best case, you charge a phone that is off very, very slowly). |
H: Help understanding transformer AUX winding
I'm new here and I'm looking for someone to help clarify the AUX winding of a transformer, more specifically in a switched psu.
I see schematics where it's being used either as feedback or voltage input to an ic on the primary taken from a winding on the primary (at least that's how it seems to me). Here lies my confusion.
My understanding is a magnetic field created in primary creates a flux in secondary that outputs different voltages dependent on winding/s. So how can there be a second winding on the primary side that induces voltage in the hot side used as an AUX? Am I missing something simple like are the windings really on the secondary but the pins are connected to primary/hot side?
AI: Consider this circuit of a smps circuit:
You can clearly see three windings. Right one is secondary which is producing the output. Top left is primary and bottom left is auxiliary.
Auxiliary is nothing but an additional secondary. Usually in a switching circuit, we need some low voltage power source for the working circuit. You can't power them using 220V or 110V line directly. So you are left with two options -
1) Somehow use the low voltage output which is being generated which will be a very bad idea because the sole purpose of using such a schematic is to provide galvanic isolation to the secondary side and by connecting output side to switching IC, you have defeated the purpose.
2) Make a separate low power winding just to provide enough power for the chip to run which is what we do by making an auxiliary winding. When you cut open a transformer, you will find that secondary winding will be usually made using thicker wire because it has to handle a larger current whereas auxiliary will be made using thin wire because it has to carry just small amount of current to keep the chip functioning.
Both secondary and auxiliary windings get their energy from primary winding. You can add more windings to the transformer and call them aux2, aux3, sec2, sec3 etc in case you need such an arrangement. |
H: 4s2p lithium ion battery charging from USB
I am newby in electronics. I planning to design a 4s2p (3.7 V, 3000mAh) li-ion battery pack and a charger. I want to use TI BQ series (BQ24618) ICs for charging. I know we can charge battery pack with 14.8V+ DC.
Can we charge the battery pack also from a USB (5V) input. I would like to know how is it possible to charge a large battery pack like 4s2p from USB.
Multicell BM Unit
AI: You can certainly charge a battery like this from a USB port -- all you need to do is boost the voltage to the appropriate charging voltage.
With a 4s pack, the trickle charge voltage should be approximately 4.2V * 4 or 16.8V. So, you'd have to boost your 5V supply up to 16.8V, which isn't an extraordinary demand -- a boost controller IC or module can do this for you.
Here is where I think you may need to consider practicality over feasibility (e.g. yes it is technically possible, the best kind of possible :), but is it practical?). If you want to charge from a 'regular' USB port, they are specified for 5V @ 0.5A, or 2.5W. When applying 16.8V, 2.5W means you deliver a current of approximately 148mA. It will take quite some time to fully charge 8 cells at 3000mAh each, considering you can deliver at best (neglecting conversion losses) 2.5W.
So yes, it's possible to do what you ask, but I don't know if it's the most practical or not. |
H: In a circuit with the TI TPS61165, how was D2 chosen?
Looking at datasheet for the TPS61165, I don't see how they chose D2 - it looks like it will only work if the voltage supply is above 12v due to this diode, but the chip's input range is 3-18v. I would like to know if I can replace it with say a 9v diode, could I use a 10-15v range for powering it, or should I stick to the 12v, even if my supply voltage drops below it?
AI: The datasheet you link to is for the -Q1 grade device, which is qualified for automotive applications. At times, e.g. when cranking the engine, the supply voltage can go well above 12V, therefore we must have some sort of protection for the IC since it can only safely handle 20V on its supply input. This is sometimes referred to as 'load-dumping' -- here is an application note (also from TI) that explains why it happens.
If you are certain to never see transients above 18V then you can omit D2 entirely and tie the supply input pin directly to the supply. |
H: Noob Measurement Mystery
I am taking up electronics and bought some used test equipment. I have been measuring anything and everything, sometimes with unexpected results. Above is one of those cases.
The function generator is outputting a sine wave of 1kHz at 5Vpp. It shows up as expected on the oscilloscope. The multi-meter on the other hand shows 1.77Vac and 0.02Vdc Perhaps someone here would be kind enough to explain to me why the multi-meter does not display 5Vac?
AI: Your meter reads AC in \$V_{rms}\$, which is very different from \$V_{pp}\$.
For sinusoidal signals:
\$ V_{rms} = 0.3535 \cdot V_{pp} = \frac{1}{2\sqrt{2}} \cdot V_{pp}\$
And therefore \$ 5V_{pp} = 1.767 V_{rms} \$
Also, because you've set your DC offset to 0V, the DC average of the sine wave is 0V, hence the \$0V_{dc}\$.
Therefore, both your measurements are exactly as expected. |
H: Calculating the time for current reducing to zero from a charged inductor in a series LC circuit
I'm wondering how you calculate the time taken for the current in a charged inductor to reduce to zero with the only current path being through a capacitor. I'm looking at this from the perspective of an unloaded boost converter where at the end of the switching phase, the inductor is charged up to a certain current with the only current path being through a diode (neglected in my question) and into a capacitor (without an extra load).
Obviously the capacitor voltage will increase as the current through it is positive (the integral of the current will be non zero and positive) but how do I calculate the time for current to hit zero given a peak current in an inductor and the value of both inductance and capacitance, ignoring circuit losses?
AI: An idealized model during the discharge, when the output diode is on, is a simple LC circuit. The solution to that model for the voltage and current are the sine and cosine resulted from the 2nd order differential equation. so you can use the sine and cosine solution fitted with initial conditions for the calculation.
But in practice, for a boost circuit, you don't see people using the LC model for this calculation. The reason is, the output capacitor is specifically chosen so that the output voltage is near constant (usually less than 1% ripple).
It becomes much simpler with the output voltage (Vout) assumed to be constant:
$$ L \frac{dI_L}{dt} = V_L = V_{in} - V_{out} = constant $$
Integrate and fit chosen initial conditions, you get a simple negative ramp:
$$ I_L(t) = I_{Lpeak} - \frac{1}{L} (V_{out} - V_{in}) t $$
The typical way of using this relationship for boost circuit design is:
$$ I_{Lpeak} = \frac{1}{L} (V_{out} - V_{in}) t_{discharge} $$
\$t_{discharge}\$ is the time it takes for the current \$I_{L}\$ to discharge from \$I_{Lpeak}\$ to 0.
When \$I_L\$ reaches 0, the output diode turns off. \$I_L\$ stays 0 and \$V_L\$ also drops to 0. (Therefore, there is no oscillation.) |
H: Backup power supply with led
My project requires a backup power supply, and I want to include an LED to determine when the backup power supply becomes active. My thought was a voltage divider to limit current to the LED, and allow the excess to bypass the LED and go straight through to the load.Would connecting a BJT as an amplified Zener where the Zener is in fact the LED be relevent?
I am told the correct way to do this would be to utilize a transistor, however I cannot think of a way to connect a transistor where I am not connecting it or an LED to ground(else there will always be current regardless of whether the backup power supply is active), or running the full load current through the gate of a transistor.Would a BJT be better here?
What is the correct way to approach this? I suspect using a transistor would be correct, I have just not been able to create a working circuit with a transistor myself!
EDIT: More info
When the 12v supply is droped it is disconnected and creates an open circuit.
AI: Use a PNP - -e.g. 2N3906; connect emitter via a 1N4148 (or any other) diode to +9V; connect base via ~ 10k to +12V. Connect the collector via a R (e.g. 10k) suitable for LED brightness to the LED to GND.
When the 12 V falls below 9V-2*0.7, the PNP will will turn on and light the LED.
The 1N4148 is to protect the E-B junction of the PNP if 12 V is present and 9 V not. If you are still concerned, you can add > 1Mohm in parallel with the E-B junction also. |
H: Why more, smaller transistors increase power efficiency?
Transistors, bjt, MOSFETs OK got it.
More transistors = better computing got it.
But compressing the transistors closer to each in my mind only helps reduce the physical dimensions.
So does a CPU or any electronic become more efficient because the transistors use less voltage? Does more computing reduce power usage, thus simply having more transistors the reason?
I am asking because as a newb and soon to graduate engineer, I think basic stuff like this is important to understand. But I always learned this concept as a rule of thumb and not by "first principle" or actual theory of transistor efficiency.
PS I did take a class in where the math of L and W was calculated and compared to new L' and W', reduced on a npn. The theoretical frequency increased but I don't think the math translation well in my head because I don't see how that helps power efficiency, only performance and/or area.
AI: Most of the power consumption in CMOS circuits is 'dynamic power' -- power from devices switching state. This power is basically the power required to drive the capacitance of the other gates, as well as the capacitance of the wiring.
In modern CMOS, there is additional static leakage power because when the MOS transistor is 'off', it still allows a little leakage current to flow, and given the numbers of devices in a modern CPU, the total current becomes significant. There are techniques to minimize this though.
As devices get smaller, you get a number of benefits:
Device capacitances decrease, so less power is required to drive this capacitance.
Devices are smaller and closer together, so parasitic capacitance of the wiring also decreases.
Devices can be made operate at lower supply voltages, so both leakage current, and power required to drive parasitic capacitances decreases.
Generally, the leakage currents increase as devices get smaller (not really because they are smaller, but because the lower threshold voltages allow higher leakages). More complex power-switching techniques are used to keep this in check. |
H: How do I lay out PCB traces for a given "differential impedance"
This is an attempt to craft a good general question and answer for a topic that's been asked before, but only in specific situations.
Could you describe what I need to know, prior to laying out a PCB board for a differential signal pair with a specified "differential impedance"?
Differential pairs are used for various high speed serial buses, including USB, MIPI, RS-422, RS-485, PCI Express, DisplayPort, LVDS, HDMI and more.
What's the definition of "differential impedance"? On a PCB board, do I need to twist or alternate the wires, as is done for differential pairs in a cable? Is the impedance of each length matched trace half the "differential impedance", or is it more complicated that that? How close must length matching be, given the maximum signal frequency?
References that may be of help:
Differential Pair Routing
Differential Impedance…finally made simple
AI: I'll try to answer this briefly, but a great resource for this type of question is Eric Bogatin's Signal and Power Integrity -- Simpified.
You've listed and described several very high speed protocols that have signal edge rates in the hundreds of picosecond range. What this means is that even traces of just a couple of inches can be considered as electrically long, and that these transmission channels must be routed as transmission lines.
Put very, very briefly, presenting a transmission line with a known impedance to a high speed driver (serial transceiver on the input/output of a SerDes) allows the transmission of data cross that line without deletrious signal reflections that can interfere with successful communication. This can manifest as intersymbol interference (ISI), crosstalk, additional jitter rendering an UI (unit interval) unusable and many other effects. Recall that some of these protocols (like PCIe) are pushing in excess of 8GT/s over conventional copper on low-cost FR-4; in order to do this, designers must take care to do all they can to provide a high-quality channel for data transmission.
A given protocol (or specification) generally lists a desired characteristic impedance. As an example, Intel may request PCI Express traces for their Xeon platforms be routed as "100 ohm differential pairs". This means that they have qualified and designed their PCI Express transceivers to expect a 100 ohm characteristic impedance transmission line for data transfer. USB commonly requires 90 ohms, RS-422 can be 120 ohms, and Ethernet is 100 ohm. I'm not going to go into single-ended transmission line structures in this post, but as mentioned below in the comments, to an approximate first order, you could consider each 'half' of the structures below as half the pair impedance.
Now, to create the transmission line structure on a conventional FR-4 PCB (in order to keep this stuff affordable!), we have several options. For differential traces, we have several options. Let's say your traces are on the top or bottom layer -- option one is edge-coupled microstrip (the picture I have is 'coated', where solder-mask is above it. Technically, there's edge-coupled coated, and edge-coupled surface for top/bottom layer options -- for really high frequency RF work, even the presence of solder-mask can be an issue).
Based on the distance to the return plane below it, the spacing between the two lines, and the width of each line, your PCB fab can deliver you a structure that presents the target impedance.
Now, let's say you're on an inner layer. The structure used here is generally edge-coupled embedded microstrip:
Similar to the first one, this one also factors in the distance to the nearest reference plane. A lot of designers favor burying their high-speed pairs on internal layers to benefit from the 'free' shielding of copper planes to reduce radiated emissions. Edge-coupled offset stripline is used when you have a signal layer sandwiched between two plane layers:
To get these differential structures, you contact your PCB fabrication house and tell them the differential impedances you're looking for -- this is part of the PCB stack-up design process. The fabrication house runs the actual materials they use (which have differing Er values) for cores and pre-preg materials, and come back to you with a set of geometries to follow in your design tool, e.g. (not real numbers) "0.2mm thick traces with 0.15mm spacing on Layers 1 and 8 for 100 Ohm impedance +/- 10%". You then input these values into Altium, and it will intelligently make sure that when you route pairs you've called out as differential that they follow those geometries.
By design, when you fabricate your PCB with your shop and send them the stack-up that has been designed, those traces will result in the desired characteristic impedance. You should request an impedance coupon, which is generally a piece of your PCB from the outer portion of the array where a duplicate structure of the transmission line has been created, and a TDR (time-domain reflectometer) is used to provide you the actual impedance constructed. Typical tolerance is around 10%.
Length-matching does not affect the differential impedance and differs from protocol to protocol. There is intra-pair skew (P to N), and inter-pair/inter-lane skew (i.e. from PCIe Tx Lane 0 to 1) skew, where the latter is generally more tolerant of mismatch than the former. This is something you generally analyze near the end to add meandering or serpentine routing to get the members of the pair to meet the manufacturer specification. I use a script that dumps the raw net lengths to Excel, and then conditional formatting to let me know how I'm doing in meeting spec (redacted somewhat -- this is a board with a module that has some mis-match, and a carrier PCB that has mis-match):
And here is an example of Altium set-up for 100 ohm differential pairs based on my vendor's recommendations:
Here are some other tips I've picked up along the way that may help you out in no particular order:
Given a tolerance for mis-match from a manufacturer, start out by halving it if possible. In a case like PCI Express where you have a host PCB and a carrier PCB, this (sort of) splits the tolerance between the two.
When fabricating a board with differential impedances, use "D-Codes". Use the hundreths or thousandths digit in trace widths to differentiate between different impedances. For example, if 0.20mm was called out as the width for both 90 ohm and 100 ohm, I would make 90 ohm 0.201mm and 100 ohm 0.202mm, and add fabrication note explaining what I did. The CAM engineer can then easily pick out the pairs using his software and do what he needs.
So, before you start your next PCB project with protocols / requirements that imply differential trace routing:
Identify all the different impedances to be controlled, and what layers they will be on (i.e., what are your signal layers).
Contact your fabrication house with the above information and work with them to define a stack-up for your project and get the required geometries. Alternately, as stated in the comments below, with the appropriate material and other information, your EDA tools might be able to provide you with the required geometries.
Set-up your CAD tool with the appropriate rules based on the numbers from step 2.
Define net classes for the pairs and route away!
Utilize a script or similar to generate a report that shows intra-pair/inner-pair mismatches and whether they are within spec or not. |
H: Switching 15V, 1.5A AC with SSR
I need to switch 15V, 1.5A AC into a resistive load with a 5V control signal. Will this SSR work?
http://cpc.farnell.com/crydom/aso242/ssr-2a/dp/SW03811
To be specific, I do not understand the term 'minimum operating voltage: 24Vrms'.
AI: If your operating voltage is 15Vrms then it will work according to the datasheet.
In the datasheet, it's written that operating voltage is in the range 12Vrms to 280Vrms. It might have been a typo on that webpage (24Vrms). However make sure that 15V is rms and not peak to peak. |
H: Meaning of strong and weak drive in VHDL?
What is the meaning and effect of "strong" and "weak" drive shown by (0,1) and (L,H) in VHDL's package ieee.std_logic_1164?
AI: The ieee.std_logic_1164 package allows two drive strengths.
(0,1) are normal drive strength and used for all normal purposes.
(L,H) are weak drivers, they are normally used to model pull-up and pull-down resistors.
Formally, ieee.std_logic_1164 distinguishes between the std_ulogic and std_logic types, even though they share the same set of values (U,L,H,0,1,X,Z etc).
The difference between them is this : std_ulogic is an unresolved type. It is an error for a std_ulogic signal to be driven by two signal sources (like short circuiting 2 wires together - it's usually a mistake) - such errors will be caught (by the compiler) and fixed (by you!) even before you get to simulation.
On the other hand, std_logic is a resolved type. It is legal to have two or more drivers on a signal. The result is determined by a "resolution function" which looks at all the driving values and combines them into the value you will see on the signal. For example, 0 and '1' combine to produce X (the Unknown state) , and X and anything else produces X so that once Unknowns happen, they propagate through the design to show there's a problem.
But '0' and 'H' combine to produce '0' (because H is weak) and similarly, '1' and 'L' combine to produce '1'. So a strong driver can legally overpower a weak one : no harm done.
Let's look at the 'Z' state : it signifies Undriven, or High Impedance (High-Z). Now Z and H combine to produce H because H, though weak, is still stronger than no driver at all.
This is just a brief summary : for all details see a good VHDL book or even the ieee.std_logic_1164 package source code.
So one use of a weak H is in the so-called "wired-or" configuration, as used in I2C buses.
SDA <= `H`; -- permanent pullup resistor
SDA <= `0` when I2C_Master_SDA = '0' else `Z`;
SDA <= `0` when I2C_Slave1_SDA = '0' else `Z`;
SDA <= `0` when I2C_Slave2_SDA = '0' else `Z`;
We are safely combining 4 drivers on the same signal : one I2C master, two slaves, and a permanent weak pullup. |
H: Why does this bridge rectifier claim to have no diode forward voltage drop?
I was, "OK, this is feasible," but then I traced how it worked and it simply blocked current through drain and source when a P and N pair are reverse biased. When the other P and N pair are forward biased current flows through forward fiodes, then alternatingly. Then it's the same, one is just using diodes to bridge rectify. Worse still, MOSFETs generally don't have a low diode voltage drop. Maybe I'm missing something here.
AI: Just look at how the biasing works: -
With positive on the top input rail the lower left N channel FET is switched on and, with negative on the bottom input rail the top right P channel FET is switched on. |
H: Transfer function in a 2L2C circuit
I have to find the transfer function of the following circuit (AC, sinusoidal), using complex numbers, Kirchoff point rule with potentials or Millman's theorem.
The transfer function is \$\underline{H}=\frac{\underline{i_1}}{\underline{u}}\$ .
Here is what I did for now. Schematic using complex impedances:
simulate this circuit – Schematic created using CircuitLab
Then we have :
\$-(V_B-V_A)\frac{1}{Z_L+Z_C}-(V_B-V_A)\frac{1}{Z_C}+(V_C-V_A)\frac{1}{Z_L}+u(t)\times i_1=0\$
^-- False, check in comments for the right one
But what to do now, how to find i1 and u?
Thank you in advance.
AI: One way of seeing the question is that it demands for net conductance of the circuit. Which is inverse of net impedance offered by the circuit u/i1.
As i1 signifies net current drawn by ckt.
The following explanation is based on that methodology.
I assume you have to find transfer function of the=is ckt.
One simple method might be.
Replace Z by Laplace equivalents in circuit.
Find impedence(net) of the circuit.
Znet = (sL)+inv(sC + inv(sL + 1/sC)) which is u/i1
Take inverse and you have your answer.
Just to warn nodal might go slightly long. Second is just adaptation of a visible fact(not too much of ideal nodal analysis) it is use (u-Va)/zl = i1 . Then you find Va interms of Z and u replace it in this second eq. And then u should have ur answer. Hop this ans satisfies your query. |
H: Set multiplexer inputs to a logic 1 state
How can I set, in Orcad, all the entries of multiplexer(in the picture) (except: 1, 13), to logic state '1' (for example, I understand that if I place 'ground' to some entry, then it will be equivalent to '0' logic state. That's what I want to do for '1' logic state) ?
AI: http://pcmunro.people.ysu.edu/Class/ECEN.Public/OrCAD.Review/DigitalOrcadSimulation.pdf
The 'PULLUP_1k' part in 'DIG_MISC' library, will provide 'permanent high to an input '. |
H: Connecting active filters in parallel
I would like to connect a signal coming from a line receiver to several op-amp based filters in parallel. The basic topology (high-shelf) looks like this:
simulate this circuit – Schematic created using CircuitLab
What I don't understand is the meaning of R1. Why does the positive input have to be shunted to ground? Doesn't it act as a voltage divider since the inputs of the op-amp have their specific input impedance?
My question is, if I want to connect several of those in parallel from one output, do I need both R1 and R4, or is one time enough? Do I need them at all?
simulate this circuit
AI: Yes, you can do this with little or no side effects. The resistor is not needed for your application because you are using an opamp buffer to drive the shared line. Just ensure the output of the buffer is nominally centred between the supply voltage rails. |
H: How to "spread linearly" the force of a solenoid
For a pet project of mine, I'm interested in finding a tubular solenoid which force is spread linearly over a longer length. The project is based on IA and uses a programmed controller (and sensors) to feed several solenoids (the question is for one solenoid) quickly in order to "grab" something falling vertically, from below, this silently (done) but also a bit more smoothly (the problem). Currently, while the programming seems to work, the test prototype with two solenoids lack control. Basically the solenoids force goes from 0 / 1 [didn't try to control current yet].
I bought and tried from the Net, something like
but the force is basically 0 / 1... meaning the force grows exponentially over a short distance.
Ideally, the force would be linearly spread over a length I decide. Thus my question
Preferably with only one solenoid, how to choose/select the core and wires in order to spread the force over a longer length (i.e. not exponential growth)
If 2+ solenoids are necessary please explain how you would arrange them to reach such result (1 is preferable though).
Note: if that helps, the current applied to the solenoid can be precisely controlled from a chip.
AI: The force of a solenoid is a function of both its position and the current. If you have position feedback, you should be able to control the current to achieve nearly constant force over some portion of its travel.
That said, there are linear actuators that don't involve rotary motors with gears or screws. They are basically linear BLDC motors, and they can be very quick. The downside is that they are rather expensive and require a relatively complex controller. |
H: Summing amplifier with bypass
I am trying to sum three audio signals using a non-inverting summing amplifier as shown below. If I want to bypass one of those signals, what is the correct way of doing that (let's say with a switch)? Connecting the route to ground as shown?
I assume just disconnecting the signal from the circuit would affect the amplification of the other two, right?
simulate this circuit – Schematic created using CircuitLab
AI: Yes, not grounding a disconnected input will change the gain of the other two. The gain of the amplifier itself will remain 3, but the other two signals will be less attenuated into the amplifier.
Note that using a inverting summing amp gets around this issue. The gain from each input to the amplifier output remains the same whether other inputs are driven, disconnected (left open), or shorted to ground. |
H: Influential factors setting the operation point of a bipolar transistor?
I do know why and where we should set the operation point of a transistor. We also learned calculations during lecture. However I do not know, what values do we change to set the Ib DC current. Are we changing the resistances in the system, or what else?
AI: There is no one way to bias a BJT. Generally it is good for some DC feedback to stabilize the bias point so that it varies little for transistor gain over a reasonable range. A classic example is resistor from collector to base with another resistor from base to ground for NPN.
The bias values are likely adjusted by resistances. However, to say you change the bias by "changing the resistances" may often be correct but is oversimplifying things to the point of uselessness. |
H: OrCad issue: Logic circuit simulation....ambiguous output
After simulating the following logic circuit(in OrCad),the resulting output -'y' is unclear. It seems to me that everything is fine, yet the result is ambiguous.
Can you, please, explain what is the problem here ? Thank you in advance.
The Circuit:
The Stimulus Editor:
The Result of Simulation:
AI: The problem is the 'VCC' element.
I intended to use 'VCC' to set input to permanent '1' logic state, but that's not the right way to do this.(Using 'VCC' element, the output of simulation, in my case y, will be two parallel red lines, one for '1' logic state and the other for '0' logic state).
As I already mentioned in this post, "The 'PULLUP_1k' part in 'DIG_MISC' library, will provide 'permanent high to an input '".
So, after I had put 'PULLUP_1k' part instead of 'VCC', the simulation result was correct. |
H: Keeping inputs to opamps
I'm trying to get the hang of op-amps, and I've run into a stop. I'm trying to implement a differential op-amp, where the two inputs are from a wheatstone bridge. Please see attached diagram
The problem I'm facing, is that the inputs \$V_{left}\$ and \$V_{right}\$ change, due to the impedance seen to the op-amp. I do not want these voltages to change, since that will cause the output of the op amp to be "wrong".
The immediate solution I see is to decrease the resistance of the bridge, and increase the resistance of the op amp. This only minimizes the error, and does not remove it.
The op-amp is ment to output \$V_{o}=2.2(V_{right}-V_{left})\$. How do I deal with this? Thx in advance! :)
AI: You can implement an instrumentation amplifier if you need high input impedance. This requires another 1-2 op-amps.
simulate this circuit – Schematic created using CircuitLab
The 3-opamp version is the best in many circumstances- you only need to change one resistor to change the gain (top right- change R10). |
H: How to replace a switch with a NJK-5002c hall sensor?
I'm building a 3D printer, and I want to replace my endstop switches with hall sensors instead. I've bought some NJK-5002c hall sensors from Ebay, but am unsure how I can hook them up to replace the switch.
The previous setup that I have, which works, is that each endstop uses a simple two-pole switch. When the 3D printer reaches the top it hits the button on the switch, and connection is made. The two wires from the switch is connected to two pins on a RAMPS board.
The NJK-5002c doesn't have a lot of documentation, but I've found that if I connect the brown wire to V+ (12V), and blue wire to V- then the black wire will toggle between V- and V+ when a magnet comes close to the sensor.
Now, I'm unsure how to hook this up to replace the passive switch. I'm worried that the RAMPS board will be damaged if I hook up V- and the black wire directly to the two pins on the RAMPS. What do you suggest?
EDIT:
Link to the item I bought.
Schematic of RAMPS 1.4 board
Actually, it seems like the RAMPS 1.4 board has three pins for the endstops, and thus matches the hall sensors perfectly. The passive switches I'm using are connected to the "Endstops" pins between signal and GND, and I think that I can just plug in the NJK-5002c sensors directly to the three pins. I've connected it, and think it might work. Just need to reinstall some software tomorrow to confirm that the software detects the triggering.
AI: There is a previous post about these here at this thread.
If you look at the "overview" section of the item on Newegg, it describes it as:
Detection method: Inductive
Switch frequency: 320kHz
Detective distance: 10mm
Model: NJK-5002C
Working voltage: DC6-36V
Output format: 3-wire NPN normally open
So the black wire is an NPN collector output, which means it switches from open (not connected to anything) to ground (connected to the blue wire.)
If the previous switch output is switching some wire to ground (call it the red wire), then it's a direct replacement: black to red.
If the previous switch output is switching the red wire between two voltages, such as ground and +5v, then do the same as previous, but tie a 10k-1k resistor from black to the +5v power rail. This will "pull-up" the volts to +5v while not activated.
You may find that this new sensor outputs the inverse of the previous switch (functions backwards.) If that's the case, you can either get a different sensor with the inverse output, or use a variety of methods to invert the signal, such as an NPN transistor or FET. Better yet would be a comparator, as a setpoint or threshold can be specified, allowing better position control, such as figure 3 here. |
H: Help me to identify this pin
I found this type of pin in some 3 pin female connector. I want to buy it but I don't know what is name of this pin :)
Any idea?
(I put dimensions approximatively)
Here are dimensions of plastic connector:
AI: It's most likely part of Molex's KK Series.
There are many alternatives made by other brands, and cheap generics, but that connector has perhaps been 'made famous' by its use as the default fan header in the ATX specification. |
H: Blocking DC without blocking any frequencies?
Is there any practical way of blocking DC without blocking any AC frequencies (or as few as possible)? Suppose I wanted to block DC and let through all frequencies between 2Hz and 10Ghz with minimum resistance.
The first methods that spring to mind would be to either use a very large capacitor or many capacitors in parallel with different values adjusted for different frequencies.
Is there something blatantly obvious I've missed?
AI: Because you asked for "practical" methods, I'll provide an answer which differs somewhat from the others.
Yes, a capacitor (followed by a resistor) will block the DC component of a signal. And yes, if you want low-frequency rejection you'll need a big capacitor.
But, and this is a big but, large capacitors by their nature are physically large and have large inductive components. This interferes with high-frequency performance, and I seriously doubt that you'll find a unit which will give you 2 Hz to 10 GHz. About 3 orders of magnitude is a reasonable goal for low price. See here, for instance for a line of RF DC blocks with a good unit reaching from 10 MHz to 40 GHz. If you're willing to spend the bucks, there are specialty manufacturers such as Picosecond Pulse Labs (now part of Tektronix) which provide 7 kHz to 26 GHz. A Google on DC block will provide other possibilities. |
H: Transistor Based Wien Bridge Oscillator
I've been studying the schematic for this RLC Bridge from Heathkit (IB-5281). The full pdf can be found here (search for the part number): http://www.vintage-radio.info/heathkit.
The circuit contains an AC source to drive the bridge which is basically a JFET Wien Bridge oscillator with selectable oscillation frequencies. A spice version of the circuit (for 1KHz) is given below:
I recognize most of the constituent pieces: the band bass filter, the voltage amplifier and push-pull follower, etc.
But I have a few questions:
1) Is the purpose of the feedback through R7 to present a zero phase shifted signal to the source of the jfet to "select" the resonant frequency (similar to how the op amp version works)? How exactly does this mechanism work?
2) What exactly does the section in the red box do? My feeling is it acts like a variable resistor (operating the jfet in its linear region) and pulls more current through the J1 source on positive going half-waves thus providing negative feedback to control the gain, but that's just a guess. I have no clue about D3, C5 and C6.
Thanks.
AI: J1 & Q1 provide voltage gain which is buffered by the circuit contianing Q2 & Q3. R7 provides feedback to regulate the voltage gain -- gain is approx (R6+R7)/(R6 + R13+JFET+...).
The circuit in the red box regulates the output amplitude. D3 and C6 (peak) rectify it, and as the amplitude increases, C5 gets charged more and more negative. This pulls the gate of the JFET more negative, and it turns off, thus (because it is in the denominator of the gain equation) decreasing the gain. The gain stabilizes at some (hard to determine) point.
C4 & R17 (especially) provide some specific feedback to make the JFET 'resistor' more linear with drain voltage -- e.g. see this Vishay linearize JFEThttp://www.vishay.com/docs/70598/70598.pdf. This keeps overall distortion low(er).
Not sure what you have for R18 ! |
H: How do I calculate the voltage in this circuit?
I have the following circuit:
I am a beginner at this stuff, so... ;)
Ok, the question is to calculate the voltage across the terminals A and B? I have no clue how to do that? You can't just take together some of the resistors. The Node method seems a little overkill (only based on the small amount of elements).
Question: What is the voltage across the terminals A and B?
P.S. The weird box (for some) in the top is a current source.
AI: First of all, lets re-arrange the components to see what's actually happening. As you can see, you have a simple voltage divider:
simulate this circuit – Schematic created using CircuitLab
To get the voltage across A and B, use Ohm's Law:
$$
V = I*R
$$
To find the total R, you first need to find the parallel value of R1 and R2:
$$
R_p = {R1*R2\over R1+R2}
$$
and then
$$
R_t = R_p + R3
$$ |
H: Noise in simple BC547-Raspberry Pi GPIO doorbell?
I've connected a Raspberry Pi to my Friedland "Ding Dong" doorbell. The doorbell has two (apparently unused) terminals, over which there seems to be a stable voltage of 1 mV when the button is not pressed, and a stable voltage of 4.8 V when the button is pressed.
To get this signal into the Raspberry Pi, I've come up with this simple design:
Between the switch and the resistor is 10 m of UTP cable. The resistor is the largest one I had, and it can still trigger the transistor. I'm running the GPIO input high (pull-up resistor) so a signal on the base pulls it down to ground.
My problem is that every once in a while, a signal will be detected when there is none. I know noone rang my doorbell, but the Raspberry Pi detects a signal (I'm using Python3 GPIO.wait_for_edge, like this:)
GPIO.wait_for_edge(pin,GPIO.FALLING)
So I suppose some noise can trigger the transistor? But what can I do about it?
AI: Your voltage-detection circuit has a very high impedance. I would go for a (much) lower impedance, for instance an 10k resistor, with an additional 10k resistor between the base and emitter of the transistor. This makes it much less likely that a stray voltage (moisture?) triggers your circuit. |
H: Detect position of walkers along a path using IR transceivers
I am working on a project that the position of people walking along a path needs to be known. I'm a hobbyist so I don't know what options I may have.
I want to use IR sender and receivers to detect the position of people. I need to use around 20-25 sensors (one every 50cm). The easiest solution that may come to mind is to connect each IR receiver to one pin of my Arduino, but it requires too many pins and also huge amount of wires. To use less pins and wire I thought I could use an arrangement like analog keyboard, similar to the following image, keys representing IR sensors.
But this way only one input can be detected. Is there any way to detect multiple inputs using only a few wires?
AI: Use resistors spaced apart by a factor of at-least 2
eg: 1K, 2.2k, 4.7K, 10K, 22K, 47K, 100K, then combinations will non-ambiguous.
7 resistors per 10-bit ADC input is about all that seems likely to work well. use 680 ohms for the fixed resistor. |
H: Analog sensor reading and calibration
I have what I think is simple question regarding the use and data calibration of variable analog sensors (such as a force-sensing resistor). As more pressure is applied to this sensor, its resistance changes. This value can be collected by an Arduino device using the analogRead() function, which outputs a value from 0-1024, with 1024 being no pressure and 0 being the most pressure. I am assuming that analogRead is measuring the voltage, but I could be wrong.
My question is this: If I provide current to these devices from a battery, as the battery's voltage drops with use, will it affect the value read by an Arduino or other device? The value doesn't appear to change linearly as more pressure is applied, so would multiplying the read value by the battery voltage to get a constant work if the value does change with the battery voltage?
Thanks for your help!
AI: You are correct: analogRead() returns a value indicating the proportional voltage of the input to the Analog Reference Voltage, which is either the supply voltage, 5V or 3.3V, or another value depending on the Arduino you're using and your settings.
IF you are powering the Arduino with the same battery as your sensor, as your battery's voltage drops below the Arduino's regulated voltage, if it's still high enough to power the Arduino, the analogRead() function will continue to return a proportional voltage between 0V and your battery voltage. So there's no need to multiply the result by a constant as this is "automatic".
However, if you're powering the sensor from a battery and your Arduino from another source, you would need to know the battery voltage and adjust your analogRead() value proportionally.
Use a multimeter to ensure the voltage being fed into the Arduino is indeed changing as expected.
Also, please show a diagram of your circuit if possible. |
H: Effect of BJT common emitter amplifier resistor(Rc,Re) ratios? How to select it?
Above is a part of a BJT common emitter amplifier with 15V Vcc(all caps ignored for DC). I was following a tutorial which explains how to setup parameters step by step. When explaining the DC biasing section, the tutorial first sets up values for Q point Vce i.e VceQ, Rc and Re.
For a maximum Vout swing, we should choose VceQ as Vcc/2. This can be seen by a DC load-line. I think it is because the maximum change in Vce will logically yield a maximum swing in Vout. At Q point we can then take VceQ = 7.5V. So far so good..
Then the tutorial chooses the ratio of Rc/Re as 3 i.e Rc = 3*Re. And then it goes to investigate other parameters without explaining why the ratio is 3.
I tried to setup this ratio first 3 and then 4 and then 14. What I found out is the more the ratio the more swings the Vout.
Since we know Vcc = 15V and at Q point VceQ = 7.5V, we can check Vout for different Rc/Re ratios.
Case_1:
Lets first take Rc/Re as 3 as the tutorial suggests:
Vout_max (when Q1 is in cut-off) becomes: 15V
Vout_middle (when bias current is zero) becomes: VceQ + (15-VceQ)/4 = 9.5V
Vout_min (when Q1 is in saturation and Vcesat = 0.2) becomes as follows:
Vcesat+(15-Vcesat)/4 = 3.9V
So what we see above is a Vout which has a middle point at 9.5V when no bias current exists and which swings up to 15V and down to 3.9V. This corresponds a total swing of 11V.
Case_2:
Now lets take Rc/Re ratio as 14 and redo the same calculation:
Vout_max (when Q1 is in cut-off) becomes: 15V
Vout_middle (when bias current is zero) becomes: VceQ + (15-VceQ)/15 = 8V
Vout_min (when Q1 is in saturation and Vcesat = 0.2) becomes as follows:
Vcesat+(15-Vcesat)/15 = 1.2V
Here what we see above is a Vout which has a middle point at 8V when no bias current exists and which swings up to 15V and down to 1.2V. This corresponds a total swing of around 14V.
Here is my question:
1-) If my logic is right it seems to me Rc/Re ratio determines the Vout swing (after setting VceQ as Vcc/2). And the Vout swing increases with Rc/Re ratio. Is that right?
2-) Of course Re shouldn't be too small but what is the rule of thumb here for Rc/Re ratio? And why?
AI: They apparently set the Rc/Re ratio to 3 because they wanted a voltage gain of about 3. Presumably that was desirable for the role of this circuit. Basically the Rc/Re ratio is the voltage gain assuming the transistor's gain is "large". Large means that you can approximate the collector and emitter currents as being equal, which also means the base current is 0.
You are right in that the Rc/Re ratio also sets the fraction of the supply voltage that the output can swing. As a simplification, consider that the transistor can vary from open to short C to E. When open, the collector (output) voltage is Vcc. When short, it is Vcc out of the voltage divider formed by Rc and Re. When Rc/Re is large, the output when the transistor is fully on approaches 0, and the output can swing the whole 0 to Vcc range. When Re is a significant fraction of Re+Rc, then it eats up some of the output voltage when the transistor is on, and the output can't swing as low to ground.
For good linear operation, you want to leave about a volt or so across C-E. The lowest output voltage swing is therefore Vcc-1V divided by the resistor divider, plus the 1 V across the transistor:
Vomin = [(Vcc - 1V) Re / (Re + Rc)] + 1V
At high Rc/Re ratios, this approaches the 1 V you leave across the transistor. For lower ratios, the output voltage swing "lost" to Re is significant. All this is to say, yes, you're right, the output voltage swing depends on Rc/Re.
There is no rule of thumb for setting Rc/Re. This is basically the voltage gain of the amplifier. You set this to what it needs to be for other reasons.
However, you can't just make the gain infinite since then other factors that we can reasonably ignore at modest gains get in the way. These other factors are often hard to know. I'd say, try not to exceed a voltage gain of about 1/5 the transistor current gain. That's of course a tradeoff I picked out of the air, but with a reasonably good transistor gain, like 50 or more, a voltage gain of 10 is doable. Beyond that, the approximation that the transistor gain is "large" and you can mostly ignore the base current becomes less valid. So does the approximation that the B-E voltage is fixed.
As you can see at high gains the exact parameters of the transistor matter more and more. Since transistor gain varies widely, we generally want circuits to work with some minimum gain, but not rely on any maximum gain. Put another way, we want circuits to work with transistor gain from some minimum to infinity. The higher the gain, the more sensitive the circuit is to the transistor's gain and other parameters.
As a exercise, see what happens in your circuit when Rc/Re = 3 and the transistor gain is 50 (a quite reasonable minimum guaranteed value for a small signal transistor). Then analyze it again with infinite gain. You'll see only a rather small difference. Now do the same with a gain of 30, and you'll see much more sensitivity to the transistor gain. |
H: Gain of particular op-amp circuit (A combination of inverting, non-inverting and differential configurations)
I have a following circuit with an operational amplifier. It is a configuration I haven't seen before and I am not quite sure how to calculate the gain in terms of its inputs A and B.
The input B is just the configuration of Inverting Amplifier
$$Gain_B = -\frac{470}{240}$$
Then I am puzzled by the 4k3 resistor. If the resistor wouldn't be there, the configuration would be similar to the differential amplifier and the gain would be
$$ G = \bigg(\frac{240+470}{240}\bigg)\bigg(\frac{3k6}{3k6+510}\bigg)A-\bigg(\frac{470}{240}\bigg)B$$
However, that is neglecting the 4k3 resistor, which somehow changes the gain - it reminds me of the non-inverting amplifier configuration, which would have gain of $$G_\text{part} = 1+\frac{470}{4k3}$$ and the two resistor in front of it would just act as a potential divider \$\frac{3k6}{3k6+510}A\$
The correct solution should be $$G \approx 2.687A-1.9583B$$
Just to clarify, I am assuming and ideal op-amp here (i.e. infinite gain, etc.). This should not be a hard problem, however, I have failed to find even after a hour of googling (it might be caused by the fact that I do not know how to call this circuit configuration).
AI: It's just a supeposition of two common circuits, ground B and evaluate the gain you get from A, then ground A and evaluate for B.
you've got the B term right "-470/240" = -1.9583
for the A term ground the B input so the 4.3K is parallel with the 240
$$ \bigg(\frac{240||4k3+470}{240||4k3}\bigg)\bigg(\frac{3k6}{3k6+510}\bigg)A $$ |
H: Verilog: How to avoid 'Redeclaration of ansi port'
I am trying to implement a start condition for i2c. And to ISim simulation I did. However, I keep getting this warning:
WARNING:HDLCompiler:751 - "timer_A.v" Line 40: Redeclaration of ansi port flags_timer_A is not allowed
WARNING:HDLCompiler:751 - "start_i2c.v" Line 31: Redeclaration of ansi port rst_to_tmr is not allowed
WARNING:HDLCompiler:751 - "start_i2c.v" Line 35: Redeclaration of ansi port start_done is not allowed
I am confused because I think I only declared reg flags_timer_A in timer_A module and only declared regs rst_to_tmr and start_done in start_i2c module. Also simulations shows it works but why do I keep getting thee warnings? Am I doing something not right? If so what is it? Thanks.
This is timer_A module:
module timer_A(
input clk, // which clock?
input rst, // sets to 0 or up counter
//output [7:0] flags_timer_A, // sets flag when counts to the value
input mode, // if mode 0, counts up to A only flags A, if 1 counts to
// A and B, C, D ... flags if they are not 0.
input [15:0] count_to_A, // counts to first value
input [15:0] count_to_B, // counts to second value
input count_to_C,
input count_to_D,
input count_to_E,
input count_to_F,
input count_to_G,
input count_to_H,
output [7:0] flags_timer_A
);
reg [15:0] timer_A_Reg;
reg [7:0] flags_timer_A;
/*
timer_A_flag_A = flags_timer_A[0]
timer_A_flag_B = flags_timer_A[1]
timer_A_flag_C = flags_timer_A[2]
timer_A_flag_D = flags_timer_A[3] ...
*/
always @(posedge rst) begin
flags_timer_A = 8'b0;
timer_A_Reg = 16'b0;
end
always @(posedge clk) begin
if (rst) begin
flags_timer_A = 8'b0;
timer_A_Reg = 16'b0;
end
else if (!rst) begin
if (mode == 1'b0) begin
if (timer_A_Reg != count_to_A) begin
timer_A_Reg <= timer_A_Reg + 1;
end
else begin
flags_timer_A[0] <= 1'b1;
end
end
else begin
if (timer_A_Reg != count_to_A) begin
timer_A_Reg = timer_A_Reg + 1;
if (timer_A_Reg == count_to_B) begin
flags_timer_A[1] = 1'b1;
end
else if (timer_A_Reg == count_to_C) begin
flags_timer_A[2] = 1'b1;
end
else if (timer_A_Reg == count_to_D) begin
flags_timer_A[3] = 1'b1;
end
else if (timer_A_Reg == count_to_E) begin
flags_timer_A[4] = 1'b1;
end
else if (timer_A_Reg == count_to_F) begin
flags_timer_A[5] = 1'b1;
end
else if (timer_A_Reg == count_to_G) begin
flags_timer_A[6] = 1'b1;
end
else if (timer_A_Reg == count_to_H) begin
flags_timer_A[7] = 1'b1;
end
end
else begin
flags_timer_A[0] <= 1'b1;
end
end
end
end
endmodule
This is start_i2c module:
`include "timer_A.v"
module start_i2c(
input start,
input [7:0] flags_timer_A,
input clk,
output rst_to_tmr,
output start_done
);
reg [0:0] resetter_flag;
reg [0:0] rst_to_tmr;
reg [0:0] scl;
reg [0:0] sda;
reg [0:0] mode_to_tmr;
reg [0:0] start_done;
/*
timer_A_flag_A = flags[0]
timer_A_flag_B = flags[1]
timer_A_flag_C = flags[2]
timer_A_flag_D = flags[3] ...
*/
always @(posedge start) begin
resetter_flag <= 1'b0;
mode_to_tmr <= 1'b1;
start_done <= 1'b0;
scl <= 1'b1;
sda <= 1'b1;
end
parameter min_SDA_on_time = 0;
parameter min_SDA_SCL_fall_delay = 0;
always @(negedge clk)
begin: RESETTER // this resets up when start is on immediately
if (start && !resetter_flag) begin
rst_to_tmr = 1'b1;
resetter_flag = 1'b1;
end
else if (start && resetter_flag) begin
rst_to_tmr <= 1'b0;
end
end
always @(posedge clk) begin
if (start) begin
if (flags_timer_A[1]) begin
sda <= 1'b0;
end
if (flags_timer_A[0]) begin
scl <= 1'b0;
start_done <= 1'b1;
end
end
else begin
end
end
always @(negedge start) begin
resetter_flag = 1'b0;
start_done <= 1'b0;
end
timer_A start_timer(
.clk (clk), // which clock?
.rst (rst_to_tmr), // sets to 0 or up counter
.mode (mode_to_tmr), // if mode 0, counts up to A only flags A, if 1 counts to
// A and B, C, D ... flags if they are not 0.
.count_to_A (min_SDA_on_time + min_SDA_SCL_fall_delay), // counts to first value
.count_to_B (min_SDA_on_time), // counts to second value
.count_to_C (16'b0),
.count_to_D (16'b0),
.count_to_E (16'b0),
.count_to_F (16'b0),
.count_to_G (16'b0),
.count_to_H (16'b0),
.flags_timer_A (flags_timer_A) // sets flag when counts to the value
);
endmodule
and this is the test module:
`include "start_i2c.v"
module start_i2c_tb(
);
//defparam start_test.min_SDA_on_time = 16'b11001000;
//defparam start_test.min_SDA_SCL_fall_delay = 16'b01100100;
reg [0:0] start;
wire [7:0] flags_timer_A;
reg [0:0] clk;
initial begin
clk = 1'b0;
start = 1'b0;
#5 start = 1'b1;
#40000 $finish;
end
always begin
#1 clk = ~ clk;
end
start_i2c #(16'b11001000, 16'b01100100) start_test(
.start (start),
.flags_timer_A (flags_timer_A),
.clk (clk),
.rst_to_tmr (rst_to_tmr),
.start_done (start_done)
);
endmodule
AI: It's quite simple, you are redefining an ANSI port declaration.
output [7:0] flags_timer_A //Defined here as an output wire
);
...
reg [7:0] flags_timer_A; //redefined as just a register
If you want to declare it as an output and a register in the ANSI style, you declare it simply as:
output reg [7:0] flags_timer_A //Defined here as an output reg
); |
H: What to do with USB power and ground when you have an external power supply?
I have a externally powered USB device. (It's actually my old VIC-20 computer, sort of)
USB data is handled by an ATTiny85. The USB interface is based upon the V-USB easylogger. The ATTiny85 receives inputs from the VIC-20 on three of it's pins and is powered by the VIC's power supply.
My question is, do I need to worry about the VBUS line at all if I'm getting my +5v from another supply?
Also, I'm currently sharing grounds between the USB, ATTiny and VIC-20. Is that a possible problem?
Here's the USB portion of my schematic.
AI: You could leave it disconnected but it is conventional practice to do two things with the VBus Line when you are an externally powered device.
VBus is often connected into a detection circuit that will determine if 5V is present or not. This is useful for the device to know that it is connected to the host or not.
USB D+ and D- lines are often equipped with clamp diode packages to help eliminate transient spikes that may come in the cable of the USB. It is sometimes appropriate to connect these clamp devices between the USB GND and the USB VBUS. |
H: Negative voltage using boost converter
I am referring a schematic where 16V,10.4V,-7v is generated from TPS61040
R12 and R17 are used to set 16V from TPS61040 IC and zener diode is used to generate 10.4V.
But how -7V is generated, I am not getting. Please someone guide.
Thanks.
AI: Think of it like a single-action pump. The capacitor blocks DC voltage, so the only thing going through is an AC waveform (\$\approx V_{OUT}\$ peak-to-peak, as seen at the switching node).
On the falling edge, current is sucked through D1, and during the rising edge, current is pushed through D3. Since current is being pulled from the top side of C5 and being deposited at ground, a negative voltage develops across C5.
D2 and R10 are then used to control the output voltage in the same way that D5 and R11 are used to control the positive output voltage. |
H: CJMCU-75 -- seting the I2C adress
I just got embedded system CJMCU-75 which has LM75A I2C temperature sensor on top of it. I dig into the LM75A documentation and found out that it's I2C address consists of four fixed MSB and three LSB bits which can be set up externally by pulling pins A0/A1/A2 towards VCC or GND.
So I looked again at my newly bought embedded system and found that designer already took care of this on the bottom of the board where he put three pads for setting A0/A1/A2 pins:
Do you have any advice on how to solder A0/A1/A3 pads to VCC/GND in order to be able to change them easily afterwards.
AI: Pick a surface mount resistor that is just the right size to go from the center pad to either GND or VCC. It should be low value resistor. If you have 0 Ohm jumpers, that would be ideal. But any low value will work fine, for example 10 or 22. Solder it in the desired location. Later it should be fairly easy to move or remove the resistor.
If you don't have any SMT resistors, cut off a small piece of copper wire or a small piece of a lead from a leaded component, and solder that in place as a jumper. Make sure it is physically short so that it does not accidentally contact both VCC and GND. That would not be good.
Good luck! |
H: How can I supply 5v voltage to circuit in a portable way?
I have made a circuit which needs 5v to operate, I want to give 5v supply to that in portable and compact way. I didn't find any battery with 5v specs. I managed to run it with 9v battery in combination with 7805 voltage regulator but that battery is too heavy, bulky and I don't want to waste 9v for getting 5v only. Please let me know most compact and efficient way of supplying 5v voltage to a circuit.
P.S. Can I use 3v coin cell to run that circuit. Is there any way to step up from 3v coin battery to 5v?
AI: First, if it's really that important that this device be small and the batteries minimal, design it for 2.5-3.3 V power. Then you can use a coin cell directly. You will also find that most parts that run from this power voltage will draw less power than when running from 5 V.
Second, you can convert between voltages with a switching power supply. However, these things will have some losss. Right now you're getting (5 V)/(9 V) = 56% efficiency. A small booster from a single AAA cell can do better than that, and the energy density of a typical AAA cell is better than of a typical 9 V battery.
However, it's difficult to make recommendations without knowing what the current demand is. If it's 10 mA, then a coin cell isn't ever going to work, for example.
When designing for low power, you have to take the whole design into account, not just try to find the best power supply once other choices have been made that didn't consider low power. |
H: Is there a typical 'ferrite' for use in a PCB?
I have a circuit diagram that I am trying to replicate (actually the Teensy 3.0/3.1 circuit diagram shown here https://www.pjrc.com/teensy/schematic.html) and there is a component called simply 'ferrite'. On the board it is a SMB component, maybe in a 1206 package but with no markings.
Is this a common component such that there is a 'standard' value for it? (e.g. 'pullup resistors' are usually around 10kOhm or specified according to the internal resistance of the driving pin)
AI: No, there isn't. Each ferrite has its own characteristics and curves, and selecting the correct ferrite involves examining them and seeing how they interact with the system. Sure, there are a wide range of things you want to filter across a large number of circuits, but a ferrite large enough to do so is too large to belong on most PCBs (which is usually why they're on the cables leading in and out instead). |
H: uC-controlled high-side switch
I designed a circuit that powers on when the car is started (key is in ACC or ON). The circuit's uC then enables 12V from the battery by setting port PC5 high. The uC detects when the key is switched off when port PC4 goes high via the opto-isolator and the uC then remains on until it sends port PC5 low removing the 12V battery supply disabling the circuit until the key is switched on again. There are many previous questions that cover high-side switching but I haven’t seen one quite like this. The circuit works fine on the breadboard, but I don’t know that it’s the best approach. Should I consider using a FET rather than the 3906 BJT? Would a BJT be more appropriate than the opto-isolator? Any glaring errors with this design (unnecessary or incorrect value components, etc)?
AI: The 2N3906 power switch looks OK as far as circuit topology is concerned. The 2N3906 is rated for a maximum of 200mA and as long as your total load on the regulator is less than that they you should be good to go. If you need a larger load current than say 150mA or so then I would recommend that you find another PNP transistor with a higher current rating.
As designed right now the base current you pull from the PNP transistor is around 1mA. Considering that the worst case current gain of a 2N3906 is 30 you may want to consider changing the R10 to a lower value to increase the PNP base current up to the 8 mA level so that the PNP can fully saturate when the rated current is drawn. |
H: Charging two 12V lead-acid series batteries separately with one 12V solar panel
I am working on a senior design project and just wanted to ensure the following charge configuration would work. I have a 12V solar panel that I plan to run its' output to TWO separate PWM solar charge controllers. Despite the vehicle running off a a 24V system, I would like to charge the batteries separately. I think that I need some sort of changeover relay to alternately charge the two 12V batteries .I think I need some control for the relay . Could I use just one PWM charge controller if I employ the relay ? Do you think that my concept will be cheaper than 2 solar arrays and 2 PWM controllers? Just wanted some input from those who have more experience than me with solar energy. Thanks for the help and sorry for the rotated picture!
AI: You can do that only if the outputs of the solar charge controllers are fully isolated from the inputs.
If the controller output grounds are directly connected to the input grounds (as is likely), you would be shorting the "bottom" battery through the ground leads. |
H: Demux realisation in hardware
Following the previous post
Output of XOR gate with high-impedance input
I am interested further how four-valued logic of SystemVerilog gets eventually implemented in hardware.
Could someone correct / confirm my next observations?
Consider
assign LED = (select) ? value1 : value2;
Observation 1:
select ? value1 : value2
in four-valued logic is not equivalent to
(select & value1) | (!select & value2)
When
select = u; value1 = 1; value2 = 1;
during simulation and in hardware value of LED will be one, whereas
(u & 1) | (!u & 1) = u | !u = u | u = u;
(note, in SystemVerilog undefined value u is represented as x)
What is the semantics of (a ? b : c) expression? What about semantics of case and if statements?
Observation 2:
X value after synthesis is initialised to 0 by default.
For example:
select = x; value1 = 0; value2 = 1;
turns the LED on, whereas
select = x; value1 = 1; value2 = 0;
keeps the LED off.
If in hardware x is 0 by default, why is extra value required during simulation, wouldn't having 0, 1 and z be enough?
Observation 3:
The hardware behaviour when
select = z
is super-weird. In this case LED is on if and only if
value1 = 1; value2 = 1;
What is happening in this case (c.f. observation 2)?
AI: The X value only exists in simulation or as an input to synthesis - it does not exist in hardware.
In a pure algebraic system, each unknown value would be given a unique variable name, like \$x\$, \$y\$ and \$z\$ or \$X_{1}\$, \$X_{2}\$, and \$X_{3}\$. A symbolic or formal evaluation would be \$x|!x \equiv 1 \$. However, Verilog simulation uses a single \$x\$ value that represents all unknowns. So the \$value(x)|!value(x) = value(x)\$. In fact, any binary operation will return an x value.
Verilog's conditional operator \$select?value_{1}:value_{2}\$ is less pessimistic in simulation. When \$select \equiv x\$, it evaluates \$value_{1} \equiv value_{2}\$ and returns either value when they are the same.
The branching statements in Verilog like if are overly optimistic in simulation. An expression that evaluates to an X value is considered false, and takes the false branch. |
H: Please review my RGB Controller
First off, I just want to say that I'm still pretty new to PCB and schematics design, and electronics in general, so any suggestions on improvement are much appreciated!
I'm creating a basic circuit to control a string of addressable RGB LEDs. The circuit is powered by a 12v DC wallwart, and then the power is stepped down to 5v to run the heart of the circuit, an ATTiny45. There is also a switch to choose between 5v and 12v for the power output to the RGB string. The micro USB is used for serial communication so I can send commands to a sketch running on the ATTiny to tell it what to display on the RGB string.
As I'm still learning electronics, and as the main parts of the schematic is different schematics I've found from Google searches pieced together, I wanted to get you guys to look over my schematic before I get it printed.
The URLs below some parts of the schematic point to the sources where I found the schematic needed to put together that part.
Any suggestions on improvements, better ways to do things, or critique is appreciated!
EDIT: Changed the barrel jack component to a proper one
AI: There should be a low ESR cap on both the input and output of the switching regulator. I didn't look up the datasheet, but didn't it say that? Even if not, it's still a good idea.
You forgot the bypass cap across the microcontroller power and ground. |
H: Is it possible to use an optointerrupter as a optoisolator?
I currently can't buy an optoisolator, so I was wondering if I could wrap a optointerrupter in tape to shield it from light and use that as an optoisolator.
Is this possible?
AI: Don't have an opto-isolator? Make one.
All transistors are photo-electric until put in a can or some opaque plastic. If you have a small signal metal can transistor you can cut or file the top off and super-glue it to an LED.
LED superglued to 'photo-transistor'.
The finished article with heatshrink sleeving.
The transistor is a 35-year old BC108. LED is a generic red - probably same vintage.
Watch out for light getting in the back of the LED. Current transfer may not be very good so you may need to 'Darlington' the output. |
H: Comparing current from two 9V batteries
I have two 9V batteries, an Energizer and a very cheap Gettop that was bundled with some equipment. The Energizer is down to 7.2V, the Gettop is at 9V. If I connect each of these separately to an LED via a 560 ohm resistor, the Energizer's current through the circuit is 7.1mA, while the Gettop only manages 1.1mA. Can someone help me understand what is going on here. Is the chemistry of the Gettop limiting the current? Is this telling me to avoid the very cheap batteries, or only to know their limitations?
Thanks for reading.
AI: As a battery goes flat, the voltage will slightly reduce. But at the same time, the internal resistance rises substantially.
So even if the battery gives 9V with no load, as soon as you connect a load, the output voltage drops.
So if you're testing how good a battery is, you need to apply a load, and then measure the voltage. |
H: Verilog: how to synchronously assign wire out with register?
This is the output of ISim simulation:
I want to decrease tx_data_ctr by 1 when flags_from_clk_div turns to 4'b0000 so sda_flag_from_transmit_byte take initial bit from tx_data[7:0]. However, I could not find a way to do it. What I actually ask is if there is a way to set flag or do something else synchronously with the certain change of a register?
It is like @(reg_x == 4'b0001) - do_stuff but of course I know there is no such command.
Also, is one able to do stuff with posedge like when register change immediately execute something?
I use configurations like:
always @(posedge start) begin
// stuff stuff
end
but can we apply something like this to a register has more than one byte? I hope I could explain.
edit: I added codes below:
scl_counter.v:
module scl_counter(
input rst,
input start,
output reg [3:0] flags,
input clk
);
parameter clk_divider = 0;
reg [15:0] scl_counter;
always @(posedge start) begin
flags = 4'b0;
scl_counter = 16'b0;
end
always @(posedge clk) begin
if (rst) begin
flags = 4'b0;
scl_counter = 16'b0;
end
else if (!rst) begin
if (clk_divider != 1) begin
if (scl_counter != (clk_divider*2)) begin
scl_counter = scl_counter + 1;
if (scl_counter == (clk_divider/2)) begin
flags[0] = 1'b1;
end
else if (scl_counter == (clk_divider*3/2)) begin
flags[1] = 1'b1;
end
end
else if (scl_counter == (clk_divider*2)) begin
scl_counter = 16'b0;
flags = 4'b0;
end
end
else if (clk_divider == 1) begin
end
end
end
endmodule
transmit_byte.v:
`include "scl_counter.v"
module transmit_byte(
output reg [0:0] sda_flag_from_transmit_byte,
input [7:0] tx_data,
output reg [7:0] rx_data,
input clk,
output reg [0:0] scl_flag_from_transmit_byte,
input start_scl_div,
output reg [0:0] reset_to_clk_div,
input [3:0] flags_from_clk_div,
output reg [2:0] tx_data_ctr
);
reg [2:0] rx_data_ctr;
reg [0:0] ready_to_start_flag;
reg [0:0] resetter_flag_clk_div;
always @(posedge start_scl_div) begin
scl_flag_from_transmit_byte = 1'b0;
ready_to_start_flag = 1'b0;
resetter_flag_clk_div = 1'b0;
tx_data_ctr = 3'b111;
rx_data_ctr = 3'b0;
ready_to_start_flag = #1 1'b1;
end
always @(negedge clk)
begin: RESETTER_TO_CLK_DIV
if (ready_to_start_flag) begin
if (start_scl_div) begin
if (resetter_flag_clk_div == 1'b1) begin
reset_to_clk_div = 1'b0;
end
else if (resetter_flag_clk_div == 1'b0) begin
reset_to_clk_div = 1'b1;
resetter_flag_clk_div = 1'b1;
end
end
end
end
always @(posedge clk) begin
if (start_scl_div) begin
if (ready_to_start_flag) begin
if (flags_from_clk_div == 4'b0) begin
sda_flag_from_transmit_byte = tx_data[tx_data_ctr];
end
else if (flags_from_clk_div == 4'b0001) begin
scl_flag_from_transmit_byte = 1'b1;
end
else if (flags_from_clk_div != 4'b0001) begin
scl_flag_from_transmit_byte = 1'b0;
end
end
end
end
always @(negedge start_scl_div) begin
ready_to_start_flag = 1'b0;
resetter_flag_clk_div = 1'b0;
end
//b01100100
scl_counter #(16'b00001000) c_1(
.rst (reset_to_clk_div),
.start (start_scl_div),
.flags (flags_from_clk_div),
.clk (clk)
);
endmodule
timer_A.v:
module timer_A(
input clk, // which clock?
input rst, // sets to 0 or up counter
//output [7:0] flags_timer_A, // sets flag when counts to the value
input mode, // if mode 0, counts up to A only flags A, if 1 counts to
// A and B, C, D ... flags if they are not 0.
input [15:0] count_to_A, // counts to first value
input [15:0] count_to_B, // counts to second value
input count_to_C,
input count_to_D,
input count_to_E,
input count_to_F,
input count_to_G,
input count_to_H,
output reg [7:0] flags_timer_A
);
reg [15:0] timer_A_Reg;
//reg [7:0] flags_timer_A;
/*
timer_A_flag_A = flags_timer_A[0]
timer_A_flag_B = flags_timer_A[1]
timer_A_flag_C = flags_timer_A[2]
timer_A_flag_D = flags_timer_A[3] ...
*/
always @(posedge rst) begin
flags_timer_A = 8'b0;
timer_A_Reg = 16'b0;
end
always @(posedge clk) begin
if (rst) begin
flags_timer_A = 8'b0;
timer_A_Reg = 16'b0;
end
else if (!rst) begin
if (mode == 1'b0) begin
if (timer_A_Reg != count_to_A) begin
timer_A_Reg <= timer_A_Reg + 1;
end
else begin
flags_timer_A[0] <= 1'b1;
end
end
else begin
if (timer_A_Reg != count_to_A) begin
timer_A_Reg = timer_A_Reg + 1;
if (timer_A_Reg == count_to_B) begin
flags_timer_A[1] = 1'b1;
end
else if (timer_A_Reg == count_to_C) begin
flags_timer_A[2] = 1'b1;
end
else if (timer_A_Reg == count_to_D) begin
flags_timer_A[3] = 1'b1;
end
else if (timer_A_Reg == count_to_E) begin
flags_timer_A[4] = 1'b1;
end
else if (timer_A_Reg == count_to_F) begin
flags_timer_A[5] = 1'b1;
end
else if (timer_A_Reg == count_to_G) begin
flags_timer_A[6] = 1'b1;
end
else if (timer_A_Reg == count_to_H) begin
flags_timer_A[7] = 1'b1;
end
end
else begin
flags_timer_A[0] <= 1'b1;
end
end
end
end
endmodule
start_i2c.v:
`include "timer_A.v"
module start_i2c(
input start,
input [7:0] flags_timer_A,
input clk,
output reg [0:0] rst_to_tmr,
output reg [0:0] start_done,
output reg [0:0] scl_flag_from_start_i2c,
output reg [0:0] sda_flag_from_start_i2c
);
reg [0:0] resetter_flag;
reg [0:0] mode_to_tmr;
/*
timer_A_flag_A = flags[0]
timer_A_flag_B = flags[1]
timer_A_flag_C = flags[2]
timer_A_flag_D = flags[3] ...
*/
always @(posedge start) begin
resetter_flag <= 1'b0;
mode_to_tmr <= 1'b1;
start_done <= 1'b0;
scl_flag_from_start_i2c <= 1'b1;
sda_flag_from_start_i2c <= 1'b1;
end
parameter min_SDA_on_time = 0;
parameter min_SDA_SCL_fall_delay = 0;
always @(negedge clk)
begin: RESETTER // this resets up when start is on immediately
if (start && !resetter_flag) begin
rst_to_tmr = 1'b1;
resetter_flag = 1'b1;
end
else if (start && resetter_flag) begin
rst_to_tmr <= 1'b0;
end
end
always @(posedge clk) begin
if (start) begin
if (flags_timer_A[1]) begin
sda_flag_from_start_i2c <= 1'b0;
end
if (flags_timer_A[0]) begin
scl_flag_from_start_i2c <= 1'b0;
start_done <= 1'b1;
end
end
else begin
end
end
always @(negedge start) begin
resetter_flag = 1'b0;
//start_done <= 1'b0;
end
timer_A start_timer(
.clk (clk), // which clock?
.rst (rst_to_tmr), // sets to 0 or up counter
.mode (mode_to_tmr), // if mode 0, counts up to A only flags A, if 1 counts to
// A and B, C, D ... flags if they are not 0.
.count_to_A (min_SDA_on_time + min_SDA_SCL_fall_delay), // counts to first value
.count_to_B (min_SDA_on_time), // counts to second value
.count_to_C (16'b0),
.count_to_D (16'b0),
.count_to_E (16'b0),
.count_to_F (16'b0),
.count_to_G (16'b0),
.count_to_H (16'b0),
.flags_timer_A (flags_timer_A) // sets flag when counts to the value
);
endmodule
**start_i2c_tb.v:**
`include "start_i2c.v"
`include "transmit_byte.v"
module start_i2c_tb(
);
//defparam start_test.min_SDA_on_time = 16'b11001000;
//defparam start_test.min_SDA_SCL_fall_delay = 16'b01100100;
reg [0:0] start_start_i2c;
reg [0:0] start_scl_div;
reg [7:0] tx_data;
wire [7:0] flags_timer_A;
reg [0:0] clk;
wire sda_flag_from_transmit_byte;
wire scl_flag_from_transmit_byte;
wire scl_flag_from_start_i2c;
wire sda_flag_from_start_i2c;
wire [3:0] flags_from_clk_div;
wire [2:0] tx_data_ctr;
initial begin
clk = 1'b0;
start_scl_div = 1'b0;
start_start_i2c = 1'b0;
#5 start_start_i2c = 1'b1;
tx_data = 8'b10101010;
#40000 $finish;
end
always begin
#1 clk = ~ clk;
end
always @(clk) begin
if (start_done && start_start_i2c) begin
start_start_i2c = 1'b0;
end
else if (start_done && !start_start_i2c) begin
start_start_i2c = 1'b0;
start_scl_div = 1'b1;
end
end
start_i2c #(16'b11001000, 16'b01100100) start_test(
.start (start_start_i2c),
.flags_timer_A (flags_timer_A),
.clk (clk),
.rst_to_tmr (rst_to_tmr),
.start_done (start_done),
.scl_flag_from_start_i2c (scl_flag_from_start_i2c),
.sda_flag_from_start_i2c (sda_flag_from_start_i2c)
);
transmit_byte start_transmit(
.sda_flag_from_transmit_byte (sda_flag_from_transmit_byte),
.tx_data (tx_data),
.rx_data (rx_data),
.clk (clk),
.scl_flag_from_transmit_byte (scl_flag_from_transmit_byte),
.start_scl_div (start_scl_div),
.reset_to_clk_div (reset_to_clk_div),
.flags_from_clk_div (flags_from_clk_div),
.tx_data_ctr (tx_data_ctr)
);
endmodule
EDIT: Based on Dave Tweed's answer, I added the following code block and it works now. Is it right way to do it?
always @(posedge clk) begin
if (flags_from_clk_div == 4'b0) begin
if (tx_check) begin
tx_data_ctr = tx_data_ctr + 1;
tx_check = 1'b0;
end
end
if (flags_from_clk_div == 4'b0011) begin
tx_check = 1'b1;
end
end
AI: You can always create a new signal that represents the condition you want to test, such as:
wire x_is_one = (x == 1);
Then you can look for events on that signal.
However, basing a design on a lot of asynchronous events is a risky approach, very prone to error. Try to find a synchronous solution — one in which all of the logic is clocked by a common clock. This is especially true when working with FPGAs, for which both the hardware architecture and the software tools are strongly oriented toward synchronous designs. |
H: Does magnetism affect the likelihood of an electrical arc occurring?
Would magnetism affect the likelihood of an electrical arc occurring?
AI: Yes, magnetism can and does affect arcs. Some large switches have permanent magnets to reduce arcing. This technique is more popular on DC, where arcing is generally worse. The magnetic field bends the arc, increasing its length, which makes it go out faster. |
H: Connecting Vcc pin to a logic gate
I have a sonar sensor which has 4 pins and may be due to a bug in my code, they are freezing in a few seconds after functioning. I found out if I reconnect the Vcc pin, they start working and yeah they freeze again. So I'm thinking rather than unplugging and plugging in the Vcc pin, to use an inverter (NOT gate) to activate it when I need the sonar to work and disable it whenever I don't need it. With an inverter we are setting ground voltage as we are disabling and I wonder if it would harm the sensor circuit by any mean.
AI: If there are no other input pins on the device, I don't see how setting the VCC pin to ground would cause any problem. However, will the NOT gate provide enough output current to operate the device? Note that many devices can draw power from input pins (https://www.youtube.com/watch?v=2yFh7Vv0Paw) and continue working even in the absence of a VCC connection. But pulling VCC low while other inputs are connected may cause excessive current or damage. |
H: Emulating Old Tektronix Coded Probes
I've got an older Tektronix 2430 100MHz oscilloscope. The older probes are "coded" and according to the manual are supposed to automatically select the proper scale based on the probe type. My last original probe just broke, so I ordered some inexpensive generic replacements. These have a 1x/10x switch on them to select the attenuation built into the probe. Obviously, the 'scope doesn't know anything about the generic probes and always defaults to 1x mode.
Thus, when trying to use the 400mV P-P 1 MHz square wave for calibration it shows up on the display as 40mV P-P (10% of actual value).
Normally, there is an attenuation setting on the 'scope itself to get the scaling right for display, but this this one is either automatic-only or there is a really cryptic setting that I can't find... Sure, I could always do the 1:10 conversion in my head, but it would be more fun to build something that fakes the 'scope out.
Question: Does anybody know how this "coding" works so I can fake it out and make the 'scope think that the probe is a 10x probe all of the time?
Images below for your reference. Thanks for your help!
Connection on 'scope:
Genuine Tek probe (P6131)
Generic replacement probe
AI: According to the manual of my Tek 465B scope, the coupling ring is connected through a resistor to the base of a transistor that controls the illumination of the 1X and 10X LED indicators. A typical probe (P6105) has an 11k resistor connected between the coupling pin on the probe body and ground. Thus when the probe is connected to the scope BNC connector, the transistor is connected to ground through this resistor. This changes its state which then turns off the 1X indicator and turns on the 10X indicator. If you could take the Tek probe BNC (with the coupling pin) and substitute it for the generic probe BNC, you might be able to make the probe sensing work. |
H: Variable frequency AC power source
I'm looking for a variable AC power source for use in some electromagnetics experiments and longer term for testing inductors, transformers, core material frequency response, and that sort of thing.
I'm thinking my dream instrument would have voltage variable between 0-125V, be capable of providing a few amps, maybe 10A at low voltages (say 24V or less), accept an arbitrary waveform from my signal generator to determine the AC out (possibly including a DC offset), and have a frequency response from DC to say 10kHz.
I'm willing to compromise on all of those however, especially to get started. I already have a variable 60Hz AC supply, one of the Variac + Isolation transformer type. So the first big addition would be variable frequency.
I've done a lot of searching around on the web, and such a device seems to be difficult to find. The closest thing I've found is called an AC Power Source and these seem to have a limited frequency range, especially on the lower end, bottoming out around 45 Hz it seems. They also seem to be limited to sinusoidal waveforms. These have great power capabilities, but appear to be somewhat targeted toward mains supply simulation for compliance testing or whatever. At about $2k to get started, they're also a bit more than I wanted to spend for essentially academic/hobbyist purposes. Here's an example of one I found:
Based on this answer I'm inclined to think a possibly better approach would be to use an audio power amplifier. I think the frequency response would be good enough and taking in an arbitrary waveform is natural for such an amplifier.
I'm not sure about the peak voltage I'd be able to attain with such an amp, I expect it would depend on the source voltage (say 25 VAC in the amp suggested in the answer above). But I'm curious enough about that approach that I'm thinking about hooking up my 40+40W Pyle amp just to see what it can do :)
So I guess my question is this:
Is there a standard lab instrument available for this sort of thing and I just haven't found the right search term yet?
Or should I really be thinking about a power amplifier for these sorts of purposes and be focusing on how to get the output voltages and currents I want, possibly by adapting such a circuit?
AI: Look around for audio amplifiers in the 2kw / 3kw power region. I think you'll be surprised at the low price (I was).
What is advertised as a 3kW amplifier is usually a 1500w stereo into 4ohm loads that's bridgeable into a mono 8ohm load.
If you do the sums, that's a mono output capable of 150 vrms into 8ohms, as long as you are happy with a floating load, as the outputs are bridged. If you parallel the two stereo channels, that would drive a ground referenced 2 ohm load with 75vrms, or over 35Arms.
To buy a tranformer, even in the sub-kw range to convert a lower power amplifier's output up to the 100v region, is quite expensive (at least I was surprised by how much they tend to cost). With a transformer, not only do you have a lower frequency limit with voltage (core volt.seconds), but you also have an upper frequency limit with winding capacitance and leakage inductance, and core losses. I can't see a 'mains' transformer getting to 10kHz.
For your voltage, current and frequency requirements, I'd just go for a single commercially available kw audio amp.
WARNING just because it's audio doesn't mean it isn't dangerous. Even a 1kW amp can develop lethal voltages, and fire-starting currents. Take all the precautions with the output of such an amplifier that you would take with mains. |
H: Will this simple four n-channel mosfet H-Bridge Circuit work?
This is my H-bridge circuit without considering Back EMF. In the real circuit I would put four fast recovery diode to eliminate the Back EMF.Maybe schottkies?
Before I came up with this design , I googled "DIY H-Bridge". And I only found out H-bridge design that is composed of two p-channel mosfet and two n-channel mosfet , as follows. My question is: Will this four n-channel mosfet H-Bridge circuit really work? If it works. Why the 'TWO N-CHANNEL TWO P-CHANNEL' plan is more popular? I mean. It is said that N-channel mosfet can handle high current much better than P-channel mosfet.I have concerns that the top N channel Fets are not getting enough drive .Will they run hot ?My proposed circuit is simple but do you think it needs refinement? Do you think that shoot through could be a problem?
At first , I didn't know what is high-side switching.This thread might help for people who also have question about what is high-side and low-side switching.
http://www.edaboard.com/thread182857.html
AI: No. it won't work.
there's nothing to turn the top two mosfets all the way on, you need to get gate voltage higher than the drain voltage, else the mosfet will overheat.
for a solution search on high side MOSFET driver |
H: Powering cordless drill
So getting to the point. Ive got makita brushed cordless drill with dead batteries as those arent really cheap ive decided to try to power it through a microwave transformer. According to the switch it draws 12A at 12V. So after rectifying(kbpc2510) the 14V AC to around 12.2V DC i though this would run perfectly. But it didn't. The drill didn't work if i didn't press the switch fully and after I applied a load to the motor the bridge rectifier fried. So im asking what i should do to power this with a cable from microwave transformer?
AI: The internal PWM control on the cordless drill consumes current in trapezoidal pulses most of the time. The low impedance NiCad battery is no longer there to soak things up. What I did was place low ESR caps inside the drill along with some status LEDs. I then used a bridge made from Schottkys and huge 20000 \$ \mu \$F total electrolytic caps. I used a 12V transformer that was thermally protected with a self resetting fuse. I know that not all cordless drills are equal but what worked for me should work for you. |
H: Will any rom file for a Z80 computer work with any hardware?
A few months ago I made up some PCBs for a Z80 computer using designs from allthingsmicro.com
Unfortunately their website has been down and there seems to be no way of contacting them.
I have had the boards laying around for a few months and finally decided I want to try and build the thing. Only problem is that I don't have the ROM file.
My question is that if I go and download any ROM file for a Z80 computer off the internet, will it work with the board? Will any firmware work with any Z80 computer.
From my understanding the board is pretty standard, using the Z80 CPU, SIO and CTC and 256k of RAM.
Thanks for any help!
AI: No. You cannot use just any Z80 ROM with an arbitrary hardware design. There are aspects to the hardware design that will be very specific and the proper ROM for that hardware would uniquely address these factors. Some of the issues:
Size of memory space decode for the ROM.
Address base for the ROM space decode.
Speed of the ROM in terms of access time versus Z80 clock frequency.
Size of any RAM memory space.
Decoded address range for the RAM.
Whether the HW design requires the built in refresh for DRAM.
Supported range of I/O peripherals.
Specifically supported I/O base address for each peripheral.
Method by which user interacts with the Z80 system whether that be via UART, keyboard/video or some other means.
When you take even this small set of factors into account it becomes obvious that there is no such thing as a "standard configuration". |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.