Sunday, 31 December 2017

How to understanding min/max input values of Schmitt Trigger from datasheet



I am having some difficultly understanding the values described in this product sheet for the SN74AHCT14 Schmitt Trigger Inverter:


http://www.ti.com/lit/ds/symlink/sn74ahct14.pdf


Given a Vcc of 4.5V, I would like to know the following:



  • What is the lowest input voltage that would cause the trigger output to switch from low to high output?

  • What is the highest input voltage that would cause the trigger output to switch from high to low output?


And where can I find this in the product sheet?



Answer



The parameters you're looking for are VT+, "Positive-going input threshold voltage", and VT-, "Negative-going input threshold voltage". They are given in section 7.5, "Electrical Characteristics".



They have minimum and maximum values, and the appropriate boundary must be used for the given condition. The lowest voltage that would result in a guaranteed switch from low to high would be the maximum value of VT+ at 4.5V, which would be 1.9V. Likewise, the guaranteed high to low transition voltage would be 0.5V. It is possible to characterize individual parts to get more accurate values, but those are the values you can depend upon across the board.


arduino - Find Information On This Component Of Fire Alarm


I have been trying to search for information on the component of a fire alarm that sounds the siren. My goal is to remove the siren and use the power and ground to connect to an arduino. I want the arduino to be alerted instead of sounding the alarm. The component has 3 prongs that are soldered into the board and I cannot figure out what each one does. Pictures are below:


Note: No this alarm will not be used as a normal fire alarm in a life or death situation.


top of board


bottom of board



Answer



A5366: Photoelectric Smoke Detector with Interconnect and Timer



http://www.allegromicro.com/~/media/Files/Datasheets/A5366-Datasheet.ashx


pin 7 is I/O Pin : A connection at this pin allows multiple smoke detectors to be interconnected. If any single unit detects smoke, its I/O pin is driven high, and all connected units will sound their associated horns.


The above data sheet has a nice typical circuit. Likely just what you have there. The Horn appears to be a 3 pin Piezo. Where its feed back and pulsing will not be as easy, as just monitoring pin 7 of the chip.


Be-warned: this chip runs directly off of battery, up to 15V. Typically 9V battery. So the output of the IO will be that to. So it would be best to drive a resistor divider or clamping diode or something to ensure it does not exceed the VCC of the Arduino.


here is an example circuit to protect against the higher voltage of the A5366.


schematic


simulate this circuit – Schematic created using CircuitLab


D2 is optional. BAV99 is a nice little SOT23 that can do this.


Single supply op-amp audio amplifier


I am trying to create an op-amp amplifier that would work from single 5V supply, and would be able to amplify -100mV to +100mV audio signal to around a 1V peak-peak or so. I've came across this circuit from this article, that could seem to work, but am having trouble calculating the actual values:


schematic



simulate this circuit – Schematic created using CircuitLab


From the article I read that R1 and R2 should both be the same and around 42kOhm for 5V power supply. R4 should be R3+(0.5*R1) and thats about it...


So how would I go about actually calculating the capacitor, resistor values needed for a varying frequency signal with maximum frequency at around 20kHz and gain of about 5?


Thank you for helping me!


EDIT:


In the article the author wrote by the ground symbol: "*STAR GROUND". Is it really imporant that I combine all ground trances in the schematic to one point, or can I use a ground plane across the whole circuit?



Answer



You seemed to have actually found a reasonable circuit on the internet. I heard there was out there somewhere.


The equations you cite are overly strict. Instead of just telling you the values, it's better to explain what each part does.


R1 and R2 are a voltage divider to make 1/2 the supply voltage. This will be the DC bias the opamp will operate at. C2 low pass filters the output of that voltage divider. This is to squash glitches, power supply ripple, and other noise on the 5 V supply so they don't end up in your signal. R3 is needed only because C2 is there. If R3 weren't there, C2 would squash your input signal too, not just the noise on the power supply. Ultimately, the right end of R3 is intended to deliver a clean 1/2 supply signal with high impedance. The high impedance is so that it doesn't interfere with your desired signal coming thru C1.



C1 is a DC blocking cap. It decouples the DC level at IN from the DC level the opamp is biased at.


R4 and R5 form a voltage divider from the output back to the negative input. This is the negative feedback path, and the overall circuit gain is the inverse of the voltage divider gain. You want a gain of 10, so the R4-R5 divider should have a gain of 1/10. C3 blocks DC so that the divider only works on your AC signal, not the DC bias point. The divider will pass all DC, so the DC gain from the + input of the opamp to its output will be 1.


C4 is another DC blocking cap, this time decoupling the opamp DC bias level from the output. With the two DC blocking caps (C1, C4), the overall amplifier works on AC and whatever DC biases may be at IN and OUT are irrelevant (within the voltage rating of C1 and C4).


Now for some values. The MCP6022 is a CMOS input opamp, so it has very high input impedance. Even a MΩ is small compared to its input impedance. The other thing to consider is the range of frequencies you want this amplifier to work over. You said the signal is audio, so we'll assume anything below 20 Hz or above 20 kHz is signal you don't care about. In fact, it's a good idea to squash unwanted frequencies.


R1 and R2 only need to be equal to make 1/2 the supply voltage. You mention no special requirement, like battery operation where minimizing current is of high importance. Given that, I'd make R1 and R2 10 kΩ each, although there is large leeway here. If this were battery operated, I'd probably make them 100 kΩ each and not feel bad about it. With R1 and R2 10 kΩ, the output impedance of the divider is 5 kΩ. You don't really want any relevant signal on the output of that divider, so let's start by seeing what capacitance is needed to filter down to 20 Hz. 1.6 µF. The common value of 2 µF would be fine. Higher works too, except that if you go too high, the startup time becomes significant on a human scale. For example, 10 µF would work to filter noise nicely. It has a 500 ms time constant with the 5 kΩ impedance, so would take a few seconds to stabilize after being turned on.


R3 should be larger than the output of R1-R2, which is 5 kΩ. I'd pick a few 100 kΩ at least. The input impedance of the opamp is high, so lets use 1 MΩ.


C1 with R3 form a high pass filter that needs to pass at least 20 Hz. The impedance seen looking into the right end of R3 is a bit over 1 MΩ. 20 Hz with 1 MΩ requires 8 nF, so 10 nF it is. This is a place you don't want to use a ceramic cap, so lower values are quite useful. A mylar cap, for example, would be good here and 10 nF is within the available range.


Again, the overall impedance of the R4-R5 divider doesn't matter much, so lets arbitrarily set R4 to 100 kΩ and work out the other values from there. R5 must be R4/9 for a overall amplifier gain of 10, so 11 kΩ works out. C3 and R5 form a filter that has to roll off at 20 Hz or below. C3 must be 720 nF or more, so 1 µF.


Note one issue with this topology. Frequency-wise, C3 is acting with R5, but the DC level that C3 will eventually stabilize at is filtered by R4+R5 and C3. That is a filter at 1.4 Hz, which means this circuit will take a few seconds to stabilize after power is applied.


C4 forms a high pass filter with whatever impedance will be connected to OUT. Since you may not know, you want to make it reasonably large. Let's pick 10 µF since that's readily available. That rolls off at 20 Hz with 8 kΩ. This amp will therefore function as specified as long as OUT is not loaded with less than 8 kΩ.



isolation - Designing flyback converter - multiple isolated outputs


Can I treat 2 secondary coils with dual voltage output as one with double voltage for the purpose of calculations?


This seems to be OK for all formulas based on output power as technically the secondary IS a single coil with tap in the middle.


However for LT converters that use flyback in primary as feedback the formulas for feedback resistor(s) are based on Vout and turns ratio. How do I apply these?


UPDATE:


Allow me to clarify the question. Let's say I used all the right formulas and made myself a nice stable converter that puts out +50V at 100mA from isolated secondary coil and uses flyback voltage on primary as feedback.


Now, what happens if I tap the middle of secondary coil and convert this into dual voltage supply? Will I get a nice stable converter with dual +/-25V at 100mA outputs (minus drop on second diode, of course)? Without any changes in the feedback circuit or re-calculating the whole thing from scratch?


I am about 95% sure tapping output coil will not do anything to the functioning of converter, because the transferred power did not change. Except for that feedback resistor that according to LT8302 datasheet is calculated as:
Rfb = Rref * Nps * (Vout + Vf) / Vref

The Vout part of it is confusing, since now I don't have 50V, I have 2x25V.




Data transmission through the human body


As we all know, data can be transferred through cables using electrical pulses transferred into binary codes. My question is, is it possible to transfer data in a similar manner but through the human body? Basically, can we act as a cable? The answer I am looking for is if it is theoretically possible or not?





Saturday, 30 December 2017

resistors - Maximum resistance allowing for short circuits


Consider a contrived circuit consisting of only cell and pot:
(1) a cell with constant voltage V and constant amperage A,
(2) variable resistor of resistance R initially set to its highest finite resistance and used to close the circuit with the cell.



(Assume that the variable resistor has a range of zero ohms to infinity ohms, and that its highest finite setting is guaranteed to create a closed circuit that is not a short circuit for arbitrarily large V and A, and that some resistance R greater than zero ohms is guaranteed to be a short circuit.)


Given a closed, non-open, non-short circuit comprised only of a variable resistor of resistance R, and a cell with amperage A and voltage V, what is the value of R when the circuit shorts out as we reduce R from infinity to zero?




operational amplifier - Op Amp operating conditions


We all know that, there are two assumptions that can be made whe analysing ideal operational amplifers, which are:


V+ = V-



I+ = I- = 0 (no current flows through op amp inputs)


but my question is: "Under what operating conditions are these assumptions valid?"


i am not sure if I'm right, but i said that the input resistor being infinitly big and the output resistor being infinitly close to 0, is this correct?




Mullard tropical fish capacitors


Does anyone have chart(s) for Mullard "tropical fish" capacitors?


enter image description here



I have a chart for the 5 color polyester parts but there may be 4 color parts out there. Plus, I have seen what seems to be 6 color parts. Any help would be welcome.


There also may have been a later system for non-polyester capacitors like polypropylene.



Answer



All of these capacitors are from one make and one series - they're Philips Mullard C280 capacitors. There is no such thing as 4 or 6 band ones, all of them are 5 band. Certain combinations can result in 2 or 3 adjacent bands being the same color, so they'll appear have 4 or 3 bands, but trust me - there are always 5 bands. Ones with 6 bands are simply where the coloring didn't quite cover the bottom or top of the capacitor or has worn off, so some of it's 'natural' (unpainted) color can appear like a 6th band. Just ignore it. They use the same colors as resistors.


The numerical value of the colors is the same as resistors - Better Buy Resistors Or Your Grid Bias Voltages Go West. They're read from top to bottom. Top stripe is the most significant digit, second is second, third is number of zeros after those digits and those first 3 stripes give the value of the capacitor in picofarads. 3.3nF would appear as having only 3 stripes, but there are 5. The first 3 are all orange and appear as one stripe. Note that the third stripe is always orange, yellow, or green, as these are the only multipliers they ever made.


The 4th value is always tolerance - black for ±20%, green for ±5%, and white for ±10%. The last and final band is the working voltage DC. Brown is 100VDC, red is 250VDC, yellow is 400VDC, blue is 630VDC, and finally white is 1000VDC. No other voltage ratings were made.


Note that there are also tantalum, ceramic, and VDRs from the same era that also had their own color codes which varied on the component type. All of the tropical fish film capacitors however, which have a very characteristic shape, have 5 bands.


This website is an accurate reference of various bizarre and old component color codes, including those dot codes on mica capacitors.


Finally, using old capacitors that might be under high voltages (exactly like these) is never a good idea, and as a lot of potential for property damage or injury if you're unlucky. There is no reason to use them. People claim reasons, and they're all nonsense. Sometimes you need to replace them in working equipment and that is a good reason to want to figure out the value, but please use a modern UL listed capacitor. Don't waste your money or risk safety for something that isn't actually real.


Friday, 29 December 2017

soldering - Alternatives to breadboards for high-current applications


I've read that solderless breadboards cannot handle more than 1 A of current or so. What kinds of alternatives exist to a solderless breadboard? Would a soldered board make a difference if I want to handle something like 5 A of current? What other options are there?




adc - 5V DC Voltage stabilizer circuit


I need a circuit or preferable a ic that have a stable output of 5VDC. Input range may vary between 4 - 5.5V.


I want to "drive" a Vref on a ADC. The operating voltage for this ADC can be 2.7 - 5.5V, so no proplem here. But I would really like a stable external Vref, and I have seen a variation between 4.2 to 4.9V on the system.


Any ideas. I was looking to TPS61175 or TPS40304, but there have to be something simpler? ADCs to be used: MAX11614 or MCP3208 Kind regards



Answer



Since you say your supply voltage ranges from 4.9V - 4.2V, I'd think about choosing e.g. a 4.096V reference instead (or 2.048V reference as as Photon points out your supply swings a bit too close to 4.096V for many references), and divide the input voltage accordingly. Otherwise you will have to boost the input voltage and then use this to supply the reference and ADC.


Boosting the supply is certainly possible but adds complexity, since you don't really want to drive an ADC directly from a switching regulator, so having either some pretty decent filtering or an LDO before the analogue section would be necessary.
If you do want to look at this option there are plenty of simple little boost converters which would be worth looking at (e.g. something like an MCP1640 set to 5.5V followed by a 5V LDO such as a TPS76350 with typical 180mV dropout - you would have to do some reading to work out worst case scenarios and see if things work for your specs - maybe a 6V switcher would be better for headroom but I just picked the first one I found which was max 5.5V) although I think this option is less preferable to simply manipulating the input voltage instead)


If you want an accurate and stable reference, then generally you would use a precision voltage reference IC with an opamp buffer to drive the reference input with a low impedance. Some reference ICs can drive the input directly.



Usually the ADC datasheet will have an example or two of different options for driving the ref input (some ADCs may have an internal reference you can use as an alternative also)


Precision references commonly come with voltages that are a power of two mV-wise, like 1.024mV, 2.048mV, 4.096mV, etc. This makes it easy as e.g. for a 10 bit converter and a 1.024 reference, you have 1mV per LSB.


For your two parts, the Maxim has an internal reference option of 4.096V, but the Microchip part needs an external reference. In the datasheet an example circuit is given using a reference IC:


ADC ref example


This uses one of their 4.096V ICs, but if you need 5V, you can simply swap it for a 5V reference - check on one of the major vendors and do a parametric search for "5V reference". Here is an example using Farnell (~150 results)


The other option is to use the reference with a buffer opamp for lower impedance, which may be necessary in some circumstances, here is an example:


ADC reference with opamp buffer


The above came from this TI app note.


Whatever you choose, make sure you decouple the reference input (and the ADC supplies also of course) well and pay attention to PCB layout (e.g. analogue and digital sections)


Is it possible to make a non-inverting amplifier with positive feedback?


The 'classic' non-inverting amplifier configuration uses negative feedback. What happens when the + and - terminals are switched? Based on my pencil-and-paper analysis and a Circuitlab simulation, it seems that the result is the same. Is this correct? Can we make a non-inverting amplifier with positive feedback?


Derivation for the positive feedback non-inverting amplifier: I assume that input impedance is infinite, output impedance is zero, and the output voltage is given by


$$ V_{out} = A(V^{+} - V^{-}) $$


Now using the voltage divider equation,


$$ V^{+} = V_{out} \frac{R_b}{R_a+R_b} $$


and for the negative terminal, we have


$$ V^{-} = V_{in} $$


Substituting into the equation for the output voltage,


$$ V_{out} = A(V^{+} - V^{-}) = AV_{out} \frac{R_b}{R_a + R_b} - AV_{in} $$



$$ V_{out}(1 - A \frac{R_b}{R_a + R_b}) = -AV_{in} $$


$$ V_{out} = \frac{-AV_{in}}{1 - A \frac{R_b}{R_a + R_b}}$$


If the input frequency is relatively low, and both resistors are of a similar order of magnitude, then


$$ A \frac{R_b}{R_a + R_b} >> 1$$


$$ V_{out} \approx \frac{-AV_{in}}{ - A \frac{R_b}{R_a + R_b}} = V_{in} \frac{Ra + R_b}{R_b} $$


Which is the formula commonly given for the output of the classic non-inverting amplifier. So is there any difference between these two circuits? If so, where does my analysis fail? What is a more accurate way of analyzing the positive feedback circuit presented below?


Non-inverting Amplifiers


EDIT: As suggested by Jasen, the positive feedback circuit I posted is a Schmitt Trigger. The Wikipedia article on Schmitt Triggers explains it fairly well. It turns out that they key to analyzing it is to solve for the voltages at the input terminals and then treat the Op-Amp as a comparator. That is, find equations for V+ and V-, and then ask the question "When does V+ > V- hold?"



Answer



If you do that the amplifier will amplifiy its own output and the ouput will go high or low and stick there until a sufficiently low or high input is presented, which will make it go the other way (low or high).



In essence you will have created a schmitt trigger.


What the formulas don't show is that the solution for this amplifier configuration describes the metastable point,


Another limitation of those equations is that they don't represent the limited output voltage range of real amplifiers.


Thursday, 28 December 2017

Voltage across inductor immediately after the switch is closed (again)



The switch in this circuit has been open for a very long time (such that the circuit is in DC steady state condition). enter image description here


What is v2?


The correct answer is v2 = 0 V, but how does that make sense? I know that the current through the inductor is 0 A, but why is the voltage 0?



Answer



I understand why you are wondering: the current in an inductor does not change instantly, but the voltage can.


However, there is something else in your schematic that influences the voltage: the capacitor.


After a long time, the capacitor is also discharged and its voltage can not change instantly, but its current can.


So immediately after closing the switch, the voltage over the capacitor can not change and therefore the voltage presented to the further right of your circuit is 0. Before closing the switch that voltage was also 0.


Therefore, there is no reason to have current flow in \$R_3\$. And \$L_1\$ is not seeing any change either. The voltage and the current of \$L_1\$ are 0 just after the switch closing (and that 0V is due to the capacitor)


capacitor - Why is the unit for capacitance so large?


Most capacitors are in the µF, nF and pF range. I know there are some special ones that go that high, but at the time faraday was around, and the unit was named after him, they didn't have such a thing. Why is the unit so large if we rarely use caps with that high of a value?



Answer



As others have mentioned, 1 farad is 1 coulomb per 1 volt. But the rabbit hole goes deeper -- the question then becomes why is 1 coulomb what it is, and why is 1 volt what it is?


Following this rabbit hole to the bottom will eventually lead us to the 7 base SI units, which are units of measure for the 7 physical attributes of our world: distance, mass, time, electric current, thermodynamic temperature, amount of a substance, and luminar intensity. They're like axioms in mathematics. From here, other units are defined in terms of these. So volt = (kilogram meter meter) / (ampere second second second). Meanwhile coulomb = ampere * second. You'll notice that 1 of a derived unit is expressed in terms of 1's of a base units.


So ultimately, 1 farad is so large because the base units are so large, at least relative to the sizes of electronic components nowadays where we fit billions of transistors onto several square millimeters.



solid state relay - A question on zero crossing versus random-fire SSRs


enter image description here


Figure 1.


I have the above mechanism, where I control a single-phase fan motor's switch. I mean instead of a mechanical switch, an AC/DC SSR is switching ON or OFF from a remote place by a constant DC input (DC in in figure, 10V or zero). When the SSR is ON, it will stay ON for long time like an hour or more. I mean it is not for speed controlling itself, it should act just to turn on the fan or turn off. The speed controller in the figure is an AC phase controlled speed controller(like a dimmer for inductive loads).


Here is the speed controller regarding the above figure: http://uk.rs-online.com/web/p/fan-speed-controllers/6685345/


As you see in my illustration when the SSR is ON, the hot line is connected to the speed controller. The fan speed is controlled via the poti knob of the speed controller manually.


The system above works for tests until now with the following SSR (Of course I cannot see whether there are current spikes or surges during each switching). Here is the SSR with zero crossing I have and use currently: http://uk.rs-online.com/web/p/solid-state-relays/2181959/?origin=PSF_428032|alt


The data-sheet says "Switching Type: Zero Crossing" and "Output device: SCR"



*But I started to get worried when I read the following articels:


http://www.jelsystem.co.jp/en/product/ssr/ssr_dosa.html


http://www.crydom.com/en/tech/newsletters/solid%20statements%20-%20ssrs%20switching%20types.pdf


*They claim a zero-crossing SSR is not recommended for an inductive load.


My question is:


1-) Do I need a random-fire SSR instead of a zero-crossing one considering my illustration and the articles I read? I'm asking becasue I thought the speed controller would be taking care of dV/dt effects even I use the zero-crossing one. But I'm not sure its effect on the SSR's SCR or triac if I use the one I have with zero-crossing.


Here I found a random-fire switching type below:


http://uk.rs-online.com/web/p/solid-state-relays/4092851/


Its data-sheet says "Switching Type: Random" and "Output device: Triac"


Which one would you recommend in my case?



2-) This is a bit confusing for me because I cannot find any wave forms of the inner trigger circuitry(the part which triggers SCR or the triac) when there is continuous DC input for lets say minutes or hours.


What I understand until now when there is zero-crossing, the circuitry detects zero crossing points and fires each time when the voltage crosses zero point. So what I understand is that, in one second for a 50Hz AC, the SCR fires 100 times if the DC in is constant and ON for one second . Is that right?


If above is true, my question is about the random-firing SSR. Okay in zero-crossing case the SCR detects and knows when to fire. But how about random firing case?


How is the triac inside the SSR is fired? What does firing it randomly means if the DC in constant ON all the time? How often it fires in this case and would that create some surges? Or in constant DC in case the triac is always on and there is no firing? The confusion arises because a triac is not a transistor and unlike a transistor it will not be ON when its gate is always ON right? I struggled to find an answer but I failed and had to write as a question.


I would be very glad if you can illustrate the wave form in this case.


Edit: Some simulations with LTspice:


Here is an opto-triac with zero crossing:


As you see below the opto-triac fires at each zero crossing point when DC in is 5V constant all the time. I'm asking is that the same case in zero-crossing SSRs?


enter image description here


Figure 2.



And below is an opto-triac this time with no zero crossing and DC in is always ON again:


enter image description here


Figure 3.


As you see above the opto-triac again fires at each zero crossing. What is going on here? It is not random.


Another example here. And this time again we have an opto-coupler with no zero-crossing "with an inductive load":


enter image description here


Figure 4.


And here an opto-coupler with zero-crossing "with an inductive load":


enter image description here


Figure 5.



Edit 2:


A non-zero cross optocoupler


enter image description here



Answer



If your circuit is working OK it will probably keep working OK. Some SSRs give trouble with large inductive loads as the current lags the voltage. If your fan is less than a couple of hundred watts you should be OK.


schematic


simulate this circuit – Schematic created using CircuitLab


Figure 1. Random SSR and zero-cross SSR.



  • The random SSR usually uses two triacs. The first is a small photo-triac. When the LED is turned on the photo-triac will turn on and feed current to the gate of the power triac and turn it on. R1 shunts away any leakage current to prevent false triggering. If the LED is kept lit this SSR will turn on after every zero-cross and stay on until the next one. If it is turned on mid-cycle it will turn on immediately.



enter image description here


Figure 2. "Random" or phase-controlled dimming.



  • The zero-cross SSR uses the same LED opto-isolation arrangement but usually turns on a transistor. This will pass current to the triac only when the voltage across the triac is close to zero. See Using AC current to trigger Triac for details on the inner working if the zero-cross circuit.


enter image description here


Figure 3. Zero-cross circuit being switched on and off. Note the full half-cycles.



  • In all cases the triac will remain on until the current falls to zero at the next zero cross or the power is switched off elsewhere.



Note that SSRs are not "integrated circuits" in the sense of "all on one chip". If you prefer, they are packaged circuits using multiple components, usually potted into a mini-case.


Your questions



Okay in zero-crossing case the SCR detects and knows when to fire. But how about random firing case?



Your control circuit tells it when to fire. This generally requires zero-cross monitoring so that the trigger signal timing is referenced to the zero-cross point.



How is the triac inside the SSR is fired?




Answered above. Opto-coupling.



What does firing it randomly means if the DC in constant ON all the time?



If DC is on all the time the triac will be triggered after every zero-cross.



How often it fires in this case and would that create some surges?



No because after the first cycle it is turning on at zero volts. This is the least stressful for the triac.




Or in constant DC in case the triac is always on and there is no firing?



It will fire.



The confusion arises because a triac is not a transistor and unlike a transistor it will not be ON when its gate is always ON right?



Links



"Random" SSRs"


"Random" is a misnomer as usually the trigger point is anything but random and is controlled. What is meant is "variable" trigger-point.



In your Figure 2 the DC is on all the time. As the AC voltage across the U2 rises the zero-cross circuit hasn't shut off the trigger yet. The blue trace shows the current into triac U2. Once it reaches the trigger value the triac switches on, the voltage across it drops to (almost) zero so the trigger current drops to zero. The triac keeps on conducting as is its nature.


In your Figure 3 the triac turns on as soon as possible after the zero cross. It's pretty much the same as Figure 2.


In your Figure 4 I can't make out where V[n002] is referenced but it's obviously out of phase with the voltage across the triac as the current through R1 is proportional to that.


Again, I'm not sure what you're showing in the Figure 5 trace.


More questions - comments on those you asked Richard Crowley.



1-) Does that really fire 100 times a second for a 50Hz AC?



Yes.




2-) About random-fire SSR case when DC in is always ON: How many times will the inner triac fire randomly? how would be the waveforms?



It's not "random". It's variable phase angle. Your control circuit decides when to turn on the LED. If you want 50% power you have to detect the zero-cross and wait 5 ms every half-cycle before triggering. The waveforms will be as in my Figure 2.


Comment to me:



What I understand is that if I use "random-firing SSR", I will still have fine AC but the very first cycle could be problematic. Is that right? Since the rest will fire at zeros as you said?



Correct although "problematic" might be overstating it. Zero-cross generates minimum noise, transients, electromagnetic radiation and is easiest on the triac and load.


Opto-triac only


enter image description here



Figure 4. From OPs link in comment.


In this simple circuit the LED is continuously powered. The opto-triac is in continuous conduction (once the voltage has risen high enough for it to turn on). It is behaving like a simple switch. The blue waveform is the current through the load.


In more normal use the opto-triac is wired across the power triac as shown in my Figure 1. As soon as the power triac is turned on there is (almost) no voltage across it anymore so no current flows through the opto-triac series resistor after the trigger "works".


Try dropping the excitation down from 230 V to 6 or 12 V and the resistor to 100 \$\Omega\$ or so. You should see that there is no current until the voltage is high enough to trigger the triac. This happens on the 230 V too but much sooner and the resolution of your chart isn't enough to see it.


Wednesday, 27 December 2017

parallel - LED wiring questions with 9v battery as power source


My son is working on a project in which he is using 36 total LEDs consisting of 7 different LED's. There are 6 different solid colored LEDs varying from 1.88v to 3.2v and one color changing that is around 3v - 3.5v. He is wiring the LEDs in series of 3 and wants to connect 4 series, for a total of 12 LEDs to one 9 volt battery which will be wired to a lighted switch. Ideally, I would like to experiment with him to find the best solutions, but we are on limited time, so I am hoping to get a few answers to help him along. I'm a novice with this stuff, so please let me know if I need to add any additional information.


Here is a rough overview of the layout for 4 of the series that have the biggest difference in voltage. There would be 2 other sets similar to this, but the voltages of the LED's would be closer to each other.


enter image description here


My questions are this.





  1. The switch is a lighted toggle switch (I believe it's 12v). I know that it can be powered by a 9v as we have used it in other projects, but not like this. Will the power drain from the switch impact the LED's? If so, can multiple 9v batteries be wired into the switch in parallel and will that have any impact?




  2. Will running different rated LED's in the same series have a negative impact? He is looking to put the lower voltage LED's in the front of the series. Will that hurt the higher voltage LED's that follow them? He is looking to wire 2 solid color LED's on the same series as one of the color changing LED's.




  3. What can he expect as far as battery life with this setup? He only needs it to stay powered for 10 minutes max.





  4. When running multiple series in parallel. Will he need a resistor on each series or is one resister between the end of all series and the power source sufficient?




Thanks for any help you can provide!



Answer



It's good to hear about family projects :)


I'm not sure I understand your description of the circuit topology. I'm assuming that for each 9V battery, he will have four strings of LEDs in parallel to each other, and that each string consists of three LEDs wired in series. Is this correct?





  • First, you have to add up the Forward Voltages of each string, and make sure the total is lower than your power source (9V). If there are any string that total more than 8.5V (or so), you'll need to arrange them in a different way.




  • Then, you need to figure out your desired current for each string of three LEDs. The datasheets will show what the acceptable Forward Current levels are. Since all three LEDs are in series, they each flow the same current. So you want to limit this current to lowest-current LED. Since each LED in a string is carrying the same current, it won't matter which order you put them in.




  • Now, for each string, add up the forward voltages, then divide that sum by your desired current. This will give you an initial resistance value. It's wise to use a larger resistor that you calculated, and then decide if you want to lower it later by measuring the actual current with a multimeter.




  • You should use one resistor per string of LEDs. Their forward voltages aren't going to match exactly. If you use only one resistor, and you get a large enough mismatch between strings, then you could burn one of them up.





  • Regarding the switch, it won't effect the performance of the LEDs. It will cause the battery to drain a bit faster. Basically, the switch is adding one more LED and a resistor in parallel to your circuit.




  • And finally, regarding battery life, that really depends on your LEDs. Lets assume you drive them at 20mA. If you have four strings in parallel, this will take 80mA all together. A typical 9V battery has around 500mA-hours of capacity. Divide 500mA-h by 80mA, and you get over six hours :)




I hope this helps!


clearance - Creepage distance over pcb


How to measure creepage distance over pcb ? Is creepage and clearance distance measure by pbc layout or soldering?




arduino - Powering an old RC servo - Can't find the datasheet



I'm testing my arduino with servos, and my sg90 works fine for testing purpouses.


I would like to use something stronger, and my father (that in the 80s used to work with RC autos) gave me this old but promising servo.


enter image description here


I know I can't supply power with arduino if I want it to survive august, and I know all the servos work around 4.8-6v.


The problem is I can't really find any datasheet for this servo, and I would like to know at least the current drain to dimension my external power supply (or how can I misure it. All the wires are black, making it even harder).




interface - How to build a USB controller having knobs, sliders, and switches


How does one go about building an interface for a USB device that allows interfacing pots, linear/log tapers, and momentary/toggle switches to a computer?


If someone could give me a high-level description, I would appreciate it. I can read spec sheets, so understanding details is not a problem as long as I know where to find the sheets.



Answer



I'd use one of the Teensy boards. These are Arduino-like microcontroller boards which have USB support. Unlike the Arduino, they can appear to a PC as any sort of USB device. This means that you can create your own custom USB keyboard, joystick, MIDI device, etc and have the PC use standard drivers.


The Teensy supports the Arduino IDE, or you can program in C and use LUFA (for USB support) directly.


Here are some project links to help.


Can we build capacitors on a PCB board?


For the magnitude of nF or µF capacitors, I hope I can build them on a PCB board. The capacitor is like a two metal layer and something between them.


Is this possible?


Not buying the capacitor, just design the capacitor on the PCB board. Double metal layers on the PCB board.




Advice on ground plane in my first PCB


I needed some advice on my first ever PCB. I am trying to build the circuit below (schematic drawn using OrCAD Capture), which is straight out of the datasheet of the flyback controller LT3748.


Schematic


I did some reading (including some of the posts on this forum), and decided to adopt this plan:



  1. 2-layer PCB: All components/tracks go on top, bottom layer has ground plan only

  2. All components are surface mount only.



Ok so my first attempt on the PCB is below (using the ExpressPCB software). This is a class project and we must build our own transformer. We couldn't get the bobbin we wanted and so decided to just lay down the transformer somewhere next to the board and connected it through a 4-pin connector.


First_PCB


We couldn't really mimic the layout suggested in the datasheet, as we're using only a 2-layer design for various reasons. We do realize that a 4-layer design along with a small commercial SMT transformer would have been ideal, but we're working with what we've got.


So based on some of the feedback below (and thanks to everyone who commented), I've made slight improvements to the PCB (as shown below).


enter image description here


I also have some questions:




  1. The datasheet advises to isolate or physically separate the high current ground from small-signal ground. The secondary ground is completely separate, so that's done with. As for primary, the only high-current grounds are those of Vin and R8 (the sense resistor). So, is it a good idea to connect the negative terminals of Vin and R8 with a track and then connect that track at one point to a ground plane that will have all the other small-signal grounds. The only penalty then would be that the R8 to Vin track would be quite long (since I'm using 2-layer only and wouldn't like to break my ground plane underneath, unless it is less worse than running this long track).





  2. As you see from the schematic, I'm running two tracks underneath the IC (i.e. on the same top layer). Do you foresee any problems there? My IC shouldn't get hot, as it works with small current only.






Tuesday, 26 December 2017

electromagnetic - Find the current flowing in the load of a transmission line?



enter image description here



My Try:


enter image description here



Now


\$\beta l=\frac{2\pi\times37.5\times10^6\times10}{3\times10^8}=\frac{5\pi}{2}\$



so its becomes


\$Z_{in}=\frac{Z_0^2}{Z_L} \$


\$Z_{in}=\frac{200\times200}{100}=400\Omega\$


So for part \$(a)\$


\$I_{i}=\frac{200}{600}=\frac{1}{3}A\$ also \$V_{i}=\frac{400\times200}{600}=\frac{400}{3}\$


Now for part \$(b)\$ from the generator we know the equation for lossless line is \$ I(z)=\frac{-j}{Z_0}sin\beta z V_i+Cos\beta z I_{i}\$


so current at the load, that means at \$\lambda/4\$ distance from the generator will be \$I=\frac{-j}{200}sin(\frac{5\pi}{2})\times\frac{400}{3}+0\times\frac{1}{3}=\frac{2}{3}\angle-90^{\circ}\$


but for part\$(b)\$ the actual answer is \$\frac{1}{3}\angle-90^{\circ}\$


What is the mistake i am doing can anyone help please?




encoder - AD725ARZ wrong colors


I designed device based on AD725ARZ, datasheet is here. Device is built basing on the reference circuit diagram on page 12.


TV is connected to composite output of the circuit. It does not have S-video input, thus no way to test the S-video image (at least for now).


There're two encoders connected in parallel to the CSYNC and RGB lines:


CXA1645-based circuit, and it display correct colors:



enter image description here


AD725ARZ-based circuit, and it displays incorrect colors:


enter image description here


The obvious idea comes to mind is that I just confused R and B input wires, but it is NOT the case. I checked the wiring several times, and also looked with scope onto the input pins of the AD725: the pin 8 has most activity, which must be the blue color (as picture consists 90% of blue).


The standard used is NTSC. Picture is stable, which means that sync is OK. Board is wired using air-wires, suffers from some degree of dot crawling but that's a problem of wiring and cabling.


Now another piece of information: the board based on AD725 has logic to switch to PAL in case it detects vertical sync of 50 Hz (you can see the related stuff in the reference circuit in AD725 datasheet). When machine switches to PAL mode, colors change! Here is the pic:


enter image description here


And now we see green color instead of blue one! But that's not all... even in NTSC 60 Hz mode, if I force AD725 to work in PAL mode, it starts showing same green screen instead of red...


Any ideas what could be the cause?


What can I do to troubleshoot the problem further?



Update 1: board images as requested by Wendall. It is a prototype. CXA1645 properly working board is made the same way.


enter image description here


enter image description here


Update 2: It seems there's a DC offset at all the color inputs of the chip, and sometimes colors saturate. I can not understand the source of it, all three colors are decoupled using 0.1 uF.


But CXA1645 does also have DC offset of about 3 V at its inputs, and works properly. I guess it performs some kind of leveling inside removing common DC component out of R/G/B.


Update 3: here's circuit diagram.


enter image description here


Update 4: I have removed all the logic out of equation, connecting pin 3 directly to 14.31818 generator, 16 to TTL CSYNC signal, 15 to +5V, and 1 to +5V (together with another arm of YTRAP circuit). Result is the same - red instead of blue. Seems chip is defective.


Update 5: I used this circuit from Wikipedia to sum up Y/C into composite in hope that there's something wrong with composite output. No way, red screen instead of blue again.


Update 6: I created the post at AD's EngineeringZone, and first reply refers me to some other post I have seen talking the theory of not much related to my issue without solution. That's why I prefer customer support which usually asks for pictures from scope screen and hard data rather than trying to make quick "guess yourself" answers.



But I tried to create support ticket yesterday with them, with zero result. Tried twice, no confirmation email arrived, and no support contact has been made so far.


Update 7: disconnected all other devices from the RGB lines (CXA1645 and grayscale mixer) in suspicion that there may be crosstalk between wires AD725 so sensitive to - no result. Exchanged R and B input wires - I was expecting that screen will get blue now (logical if I would confuse R and B lines), and it is NOT the case! Screen is green now! But - the border has almost correct light blue color. Note the cursor has the expected white color.


enter image description here


Analyzing the datasheet I suspect something bad had happened to the "RGB-TO-YUV ENCODING MATRIX" part of the chip.


Here're scope diagrams:


Blue: massive output (max digital value for most of the screen) enter image description here


Red: almost none (there's some white text on the screen, which has red component in it) enter image description here


Green: moderate activity, I think it is mostly caused by the light-blue border (where max blue sums up with max green value). enter image description here


CSYNC enter image description here


(Scope measurements were taken on the AD725 RGB pins after decoupling caps)



And it seems I am slightly out of spec for RGB to be 714 mVpp. And I am exactly within 1 Vpp spec for CXA1645 (datasheet's page 2).


Update 8: following conversation with Bruce Abbott I did the following tests:


1. only one wire is connected


schematic


simulate this circuit – Schematic created using CircuitLab


The results are:



  • Pin 8 (BIN) only = perfect red

  • pin 7 (GIN) only = perfect magenta

  • pin 6 (RIN) only = perfect green



2. level change with potentiometer


schematic


simulate this circuit


Potentiometer's value relative to ground: 19 Ohms versus 2 kOhm (thus it does NOT close completely to the ground).


Result: whatever I do with potentiometer I have relatively good green component picture. However: when potentiometer is very close to the ground and I touch its central contact with hand, image changes its color to blueish depending on the pressure I apply with the finger (=applied resistance), but image remains stable.


I made a mistake in the circuit when made conclusion above (connected potentiometer to unused pad rather than ground :( ). Thus result is that screen is green anyway, and turning potentiometer towards ground fades the green image away to dark green and then to almost black.


I also ensured that clock is as close to 4*Fosc for NTSC as possible: 14.3183 MHz as far as my scope tells me.


Reading some more info (e.g. here) I start to believe there's something indigestible for AD725 relating to waveform itself, CSYNC or their timing. But I still have no clue why wire with blue color information, connected to the red input of the chip, produces proper and stable green image on the screen of my TV!


Solution:



The width of the HSYNC signal was 6 us, out of spec of 2.8 ... 5.3 us for AD725.




operational amplifier - Ideal Op-amp Question with complicated feedback resistance


The question has been asked before here: Help with ideal op-amp problem


I don't understand why we simply can't reduce \$R_2\$, \$R_3\$ and \$R_4\$ into one single feedback resistance: $$R_f=R_4+R_2 \parallel R_3$$, and then just calculate the gain: $$\frac{V_2}{V_1}=\frac{-R_f}{R_1}=-\frac{R_4+R_2||R_3}{R_1}$$



The problem is shown here:


enter image description here


I understand the "correct" solution and how to get to it, but don't know why my solution would be "wrong".




mosfet - No germanium diode available for small crystal radio -- can active components handle the task?


I know that germanium diodes are trivial to find online, but as this is for a demonstration I'd rather not spend $6-7+ on shipping for a single 5 cent part for a project that's academic in exercise anyway. RadioShack has proven stereotypically useless in stocking germaniums.


I do have available to me jellybean components like the 741 and 324. I also have several varieties of N & P-channel FETs as well as BJTs. Is there some small and straightforward circuit I can use to emulate the low-voltage drop behavior of a germanium diode in a low (microwatts?) power application?



Answer



As others (@Kaz) have noted, a Schottky diode may be a simple and cheap solution. I personally haven't seen a crystal radio made with them, but that can very well be because I have really never checked for such a circuit. By all means that should be your first try.


A germanium diode is best known for two properties:



  • Low threshold voltage


  • Relatively high resistance in contrast to silicon diodes, resulting in a more curved characteristic.


The low threshold voltage (essentially 0V!) can easily be reproduced with an active half wave rectifier as shown in the image below (found on Elliott Sound Products).


enter image description here


The operational amplifier is used to eliminate the (rightmost) diode's threshold voltage by inserting the diode within the feedback loop. The positive halve waves are amplified by -1 (\$A = -\frac{R2}{R1}\$), so essentially it is an inverting rectifier. With a sine wave you won't notice the difference as both half waves are symmetric.


The leftmost diode prevents the opamp from being driven in saturation (low rail) during the positive halve input wave. Subsequently the inverting input will act as virtual ground (V- = V+) which stabilizes the circuit.


This circuit only works reliably with a dual power supply as the opamp's output will be driven about 0.6V below ground.


transistors - What is the difference between emitter and collector for BJTs?


the (surely simplistic) model of a bipolar junction transistor one is taught in foundational physics course appears to be symmetric. - So, what is the difference between the collector and the emitter of a real BJT? If the transistor were symmetric one would not make this distinction...


Also:



  • Do BJTs have a 0.6V voltage drop like diodes?


  • Are BJTs conductive in both directions, i.e. E-C and C-E?


Many thanks.



Answer



Yes, BJTs have the same voltage drop across their junctions as common diodes, that's 0.6V to 0.7V between base and emitter, and the same between base and collector. Since the junctions act like diodes they don't conduct in both directions if you apply a voltage across the two pins.


When you use an NPN transistor as a transistor, current will from collector to emitter through the base, even though the base-collector junction reverse biased.


enter image description here


The arrows indicate electron flow, not conventional flow. Conventional flow is from positive to negative and is always used in circuit analysis. But conventional flow can't explain the details of the working of a transistor, so here electron flow is shown.
Also note that the collector voltage is higher than the base voltage.


The main differences between emitter and collector are doping concentration and size. The emitter is heavily doped, while the collector is lightly doped. You could try to swap them, but you'll get a very low \$H_{FE}\$, probably even less than 1.



Monday, 25 December 2017

adc - Making voltmeter accepting bipolar input voltage, using a microcontroller


I want to build a very simple voltmeter using ATMEGA328 ADC. I can successfully measure up to 20v (using a voltage divider), but the problem is, I don't understand how to measure the voltage properly, if negative and positive terminals are switched.


Only way I could think of is adding another ADC input which is responsible for measuring the 'inverted voltage'. The join both ADC inputs, but add diodes in between, so one channel works with (+-) and the other channel works with (-+) and then 'merge' the input from both channels using code. Then I should be able to measure things like sin wave for example (where polarities switch).


Is the concept correct or is there a better way to do this? Thanks!




Answer



As FakeMoustache explained, the diode idea isn't really a good one. The easiest way to achieve this is to adjust the input range (which includes both positive and negative voltages of high amplitude) to something useable by the ADC (a voltage between GND and VREF). For this, you need to reduce the input voltage amplitude and add a fixed offset. The aim is that when you have an input at 0V, you obtain a VREF/2 voltage to feed the ADC with.


We can build this stage with an operational amplifier. But this can be more effectively done if you accept to invert the input voltage sign and fix that later from the MCU firmware. For example, the adjusting stage will output a +VREF voltage when the input is -20V and a GND voltage when the input is +20V. Basically, the transfer function is reversed. This way, you can do this without needing negative voltage biases, and with a single opamp.


Here is the basic circuit:


schematic


simulate this circuit – Schematic created using CircuitLab


Now, how to compute the values of R1, R2, R3, R4 and R5 so that you get the range you need and the correct offset? Well, basically, everything can be deduced from the following formula:


\$\dfrac{\frac{V_{OUT}}{R1}+\frac{V_{IN}}{R2}}{\frac{1}{R1}+\frac{1}{R2}+\frac{1}{R3}}=\dfrac{\frac{V_{REF}}{R4}}{\frac{1}{R4}+\frac{1}{R5}}\$


You must find the appropriate values so that when VIN is 20V, VOUT is 0V and when VIN is -20V, VOUT is VREF. You must also ensure that the total input impedance is high enough to leave your input signal unaltered (values in the 100kΩ range will probably be fine).


But I'm a bit too lazy to solve this myself...



Last thing: choose an opamp with rail-to-rail inputs and output. Otherwise, you'll get incorrect results in the far end of the input range.




Edit: It seems I'm not that lazy after all. Let's say the input range is +VMAX → -VMAX and you want to translate this to 0 → +VREF, the above formula gives the following relationships between the resistance values:


\$\frac{R1}{R2}=\frac{V_{REF}}{2V_{MAX}}\$ and \$\frac{R4}{R5}=1+2\frac{R1}{R3}+\frac{V_{REF}}{V_{MAX}}\$


So, a possible solution for VMAX=20V and VREF=5V would be:



  • R1 = R3 = 12.5k

  • R2 = 100k

  • R5 = 10k

  • R4 = 32.5k



I checked with the circuitlab simulator, it seems consistent. Here is the transfer function:


enter image description here


imu - Magnetometer dynamic calibration


I am working on a Magnetometer AK8975 being a part of an IMU. Which seems to be very tricky for me. This chip gives a 3D vector as output describing earth's magnetic field at any place on earth or near it.


I tried two types of heading calculation algorithms: One is simple arctan(-y/x) and another is inclination (pitch) and bank (roll) canceled maths as mentioned in below. Both on inclination and banks give wrong output.


I am able to get the correct heading w.r.t the earth (using simple available open study resources) when it is rotated keeping horizontal w.r.t the ground plan using any of the two algos.


I tried calibration for soft and hard iron errors. I Could plot it in 3D and shows a perfect 3D sphere. Still doesn't work on inclination or declination.


Any pointer will be helpful.


The code and its implementations are as below:


void Compass_Heading()
{
double MAG_X;

double MAG_Y;
double cos_roll;
double sin_roll;
double cos_pitch;
double sin_pitch;

cos_roll = cos(roll);
sin_roll = sin(roll);
cos_pitch = cos(pitch);
sin_pitch = sin(pitch);


//// Tilt compensated Magnetic filed X:
MAG_X = magnetom_x*cos_pitch + magnetom_y*sin_roll*sin_pitch + magnetom_z*cos_roll*sin_pitch;
//// Tilt compensated Magnetic filed Y:
MAG_Y = magnetom_y*cos_roll-magnetom_z*sin_roll;
//// Magnetic Heading


MAG_Heading = atan2(-MAG_Y, MAG_X) ;


}

Where magnetom_x, #_y and #_z are components of a 3D vector which actually are RAW values from the Magnetometer. roll and pitch are from a mysterious Kalman-filter output from onboard accelerometer and gyroscope. These three sensors are in ATAVRSBIN1. The roll and pitch are ok till this stage.


Now a simple heading calculation according to journal_of_sensors_renaudin et al_2010c.pdf should have been MAG_Heading = atan2(-magnetom_y, magnetom_x) ; and with compensation as above.


Overall code is simply from OPEN AHRS.




Data in format Roll, Pitch and Yaw. I rotated the device by my hand only. First three have been concentrated on only Roll, Pitch and Yaw respectively. Rest two are first rotated the device around 45 degrees along X (Rolled) then rotated along Magnetometer's local Z. Then same has been repeated with around 45 Degrees rotation along Y (pitched) then rotated along Magnetometer's local Z.


The graphs plotted within the range of -180 to 180 degrees.


Roll Angles in degrees in a file The YAW characteristics on Roll.


Pitch Angles in degrees in a file The YAW characteristics on Pitch.



Yaw Angles in degrees in a file The YAW characteristics on Yaw itself.


Yaw w.r.t 45 degrees inclined (rolled) Angles in degrees in a file The YAW characteristics on Yaw with 45 degrees rolled.


Yaw w.r.t 45 degrees banked (pitched) Angles in degrees in a file The YAW characteristics on Yaw with 45 degrees pitched.


Note: For last 2 pictures: First kept in home position, that is same for all (refer txt files). Then Rolled 45 degrees then using the plane device (with magnetometer) has been rotated along Magnetometer's Z-axis.


Similarly for last image the device has been pitched 45 degrees then along Magnetometer's Z-axis.


I hope these will help solving my issue.




New developments are as follows:


I worked some on the Heading. I got following output. Roll csv


Pitch csv



Yaw csv





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

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