text
stringlengths
83
79.5k
H: for Loop Through String in VHDL I'm trying to write a loop in VHDL that will print a certain message on an LCD screen. I have predefined the following: constant LCDHP :integer range 0 to 1056:= 1056;--horizontal period constant LCDHPW :integer range 0 to 30 := 30 ;--horizontal pulse-width constant LCDHBP :integer range 0 to 16 := 16 ;--horizontal back-porch constant LCDHFP :integer range 0 to 210 := 210 ;--horizontal front-porch constant LCDVP :integer range 0 to 525 := 525 ;--vertical period constant LCDVPW :integer range 0 to 13 := 13 ;--vertical pulse-width constant LCDVBP :integer range 0 to 10 := 10 ;--vertical back-porch constant LCDVFP :integer range 0 to 22 := 22 ;--vertical front-porch type coordinate is record H:integer range LCDHP'range; V:integer range LCDVP'range; end record; constant TP:coordinate:=(H=>LCDHP-LCDHFP,V=>LCDVP-LCDVFP);--text-position function char2ascii(char:character)return std_logic_vector is begin case char is when'0'=>return conv_std_logic_vector(16,7); when'1'=>return conv_std_logic_vector(17,7); when'2'=>return conv_std_logic_vector(18,7); when'3'=>return conv_std_logic_vector(19,7); ... end function char2ascii; constant message0:string(1 to 60):= "Hello, I'm Doron Behar and I'm the developer of this project"; I will not deliver all the content of this file because it's very long and most of it is not relevant. Yet, I have managed to print text on the screen with a different method: The standard (and simple) method is to write a asynchronous process. (It could also be written in a parallel way without a process and using when else) I'll show an example for the standard method: process(pixel_row,pixel_column) begin if pixel_row>TP.H - 16 and pixel_row <= TP.H then if pixel_column <= TP.V - 0 * 8 and pixel_column > TP.V - 1 * 8 then char_code <= char2ascii(message0(1)); elsif pixel_column <= TP.V - 1 * 8 and pixel_column > TP.V - 2 * 8 then char_code <= char2ascii(message0(2)); elsif pixel_column <= TP.V - 2 * 8 and pixel_column > TP.V - 3 * 8 then char_code <= char2ascii(message0(3)); elsif--well you get the idea.. char_code <= ...; else char_code <= char2ascii(' '); end if; else char_code <= char2ascii(' '); end if; end process; This is not a smart way to print the text, it's good if the string is not long and it's working but in the case of a full sentence it's not very efficient because it requires to write 2*message'length (which is 120 in my example) lines for 1 message. The solution I thought of was using a loop: process(pixel_row,pixel_column) begin for i in message0 'range loop if pixel_row>TP.H-16 and pixel_row<=TP.H then if pixel_column<=TP.V-(i-1)*8 and pixel_column>TP.V-i*8 then char_code<=char2ascii(message0(i)); else char_code<=char2ascii(' '); end if; else char_code<=char2ascii(' '); end if; end loop; end process; From some reason it just doesn't work! I'm not sure what is the reason why I see nothing on the screen while I can print text with the 1st method. I've also tried using for generate: txt:for i in message0'range generate char_code<= char2ascii(message0(i)) when pixel_row>TP.H-16 and pixel_row<=TP.H and pixel_column<=TP.V-(i-1)*8 and pixel_column>TP.V-i*8 else char2ascii(' '); end generate txt; But I got the following errors: Error (10028): Can't resolve multiple constant drivers for net "char_code[6]" at display-control.vhd(339) Error (10029): Constant driver at display-control.vhd(339) Error (10028): Can't resolve multiple constant drivers for net "char_code[5]" at display-control.vhd(339) Error (10028): Can't resolve multiple constant drivers for net "char_code[3]" at display-control.vhd(339) Error (10028): Can't resolve multiple constant drivers for net "char_code[2]" at display-control.vhd(339) Error (10028): Can't resolve multiple constant drivers for net "char_code[1]" at display-control.vhd(339) Error (10028): Can't resolve multiple constant drivers for net "char_code[0]" at display-control.vhd(339) Is there something wrong with the way I treat the string's range? Is it even possible to do what I'm trying to do or should I think of a totally different method? Any Help Appreciated :) AI: You don't want a loop here. But your process does need to generate i (the index into the message) from TP.V, probably through division by 8. Something like: process() variable i : natural range 0 to LCDVP/8; begin if pixel_row>TP.H - 16 and pixel_row <= TP.H then i := pixel_column / 8; if i <= message0'high then char_code <= char2ascii(message0(i)); else char_code <= char2ascii(' '); end if; else char_code <= char2ascii(' '); end if; end process; You may object to the use of division in synthesis, but I've never seen a synthesis tool out there (this century at least) that can't make the obvious optimisation for a fixed division by 8. I'll note the you are also making life unnecessarily hard for yourself with the declaration of char2ascii : its body should be pretty much a one-liner too.
H: Is the P.D across a wire with no resistance always zero? According to my very basic understanding of Electrical Circuits, the P.D. across a wire with no resistance is sometimes zero. Take this question for example: "If voltage is measured between two points on a wire, with no resistance in between is the voltage zero?" From what I can see, the reason why the potential difference of a wire is 0 is because the voltage at the two points on the wire are the same. Thus, they have a difference of 0V and hence, the P.D is 0. (Please clarify if I have misunderstood) Can I say that in other words, as V=RI, and R=0, so V=0? So here is my question. In the figure below, what would be the P.D. of the wire BE? Suppose that the EMF of the battery is 2V. And the resistance of the wire is negligible. So I can come to 2 possible conclusions: The P.D. is either 0 or -0.8 or it could be neither I could be 0. V=RI and as the wire has technically no resistance, therefore, the P.D. has to be 0. Or it could be -0.8V. Voltage at point A and D is both 2V as voltage splits evenly in parallel circuits regardless of resistance. Using the formula: PD[a]=[R[a]/(R[a]+R[b])] x V The P.D of the 2Ω resistor is 0.8V and hence the P.D at B is 0.8V(Or should it be 1.2V?) The P.D of the 4Ω resistor is 1.6V and hence the P.D at E is 1.6V(Or should it be 0.4V?) Therefore, taking 0.8(P.D at B)-1.6(P.D at E) = -0.8 Is my workings correct? Or is my understanding of Voltage flawed. (which it probably is) Please clarify and include an answer to the above question if possible. AI: Lets redraw the schematic: simulate this circuit – Schematic created using CircuitLab Circuit diagrams are topological meaning that the "wires" do not really exist, they merely indicate what is connected to what (essentially they are ideal and 0 Ohms). The circuit above is exactly the same circuit as you have shown, but it should make thinks much clearer. Notice how R1 and R2 (labels given in my diagram) are in parallel. Also R3 and R4 are in parallel. The total resistance for parallel resistors is given by: $$\frac{1}{R_t} = \frac{1}{R_1} + \frac{1}{R_2} + \frac{1}{R_3} + ...$$ For two parallel resistors, this simplifies to: $$ R_t = \frac{R_1 R_2}{R_1 + R_2}$$ So you can find the total resistance of the two parallel branches, and then use the simple voltage divider equation (below) to work out what the voltage drop of each resistor must be. $$ V_{mid} = V_{sup} \times \frac{R_{bot}}{R_{bot}+R_{top}}$$ As a side note, P.D is not a very well know acronym, and quite ambiguous. When I first read the question it took a moment to work out what you were talking about - was it power dissipation? potential difference (voltage)? or something else. Furthermore, you can't have a potential difference at one point (well you can but it is always zero). You can have a potential difference between two different points. So saying "(P.D at B)" is nonsense.
H: Speed control on a ceiling fan induction motor I've managed, through the help of others here on Electronics StackExchange to get a ceiling fan motor running, at least at one speed, and in the right direction. I want to enable 3 speed settings on the motor. How can I enable speed control of the motor? I came across the following circuit diagram, is this method advisable? Won't this cause a lot of humming in the motor? http://electronics-diy.com/1000w-ac-motor-speed-controller.php AI: Have a look at this article. simulate this circuit – Schematic created using CircuitLab Figure 1. 3-speed fan control. It appears that the standard speed control uses additional capacitors in series with the windings. By switching in one or two capacitors three speeds can be obtained. Table 1. Speed selection. | SW1 | SW2 | Speed | +-----+-----+-------+ | Off | Off | Off | | On | On | High | | On | Off | Med | | Off | On | Low | +-----+-----+-------+ Table 1 shows that switching in all the capacitance gives highest speed. What's not so obvious is that it also gives highest starting torque. Most ceiling fans use a pull-cord switch which cycles through the sequence above. The switch deliberately goes from off to max so that the fan will start reliably. The user can then slow down the fan by one or two further pulls. The capacitor values will depend on your supply voltage and the rating of the fan motor. They need to be mains voltage AC rated.
H: Low-noise amplification of microphone signals, tubes or chips? When trying to capture faint acoustic phenomena, are vacuum tube amplification designs superior to ICs? In this type of application sensitivity and low-noise amplification are the desired objectives. Should I be satisified with typical modern low-noise op amps, or if I want the best possible performance do I need to dredge up old books and plan for having a custom vacuum tube constructed? AI: In outline, it depends on the signal source, i.e. the type of microphone. There are some very low noise vacuum tubes. There are some low noise IC amplifiers, but not many. There are also discrete semiconductors, both bi-polar and JFET, and these are often the best choice for an input stage, possibly using an IC for the later gain and output stages. Among vacuum tubes, the 7586 (Nuvistor) has a good reputation. (Ditto some makes of 6060 triode if I recall correctly, and, I think, the V301 if you have a reliable source of WW2-era components...). To use a valve as a low noise amplifier, you have to remember that it actually has quite a high noise resistance, so it achieves its best noise figure at a high source impedance. You can after all keep the grid circuit impedances arbitrarily high. So a valve operated as a cathode follower is a good choice to provide current gain when fed from a capacitor mic capsule (typically 30pf). It is necessary to bias the input with a grid leak resistor in the region of 1 Gohm or higher (consider the RC time constant and you will see this determines the LF performance of the mic). See Neumann U47 etc. But for a low source impedance such as a ribbon microphone, the only way the valve can achieve low noise performance is by matching that source impedance to the mic's noise impedance with a high ratio step-up transformer. A good replacement for a vacuum tube in similar applications (high source Z) is a suitable low-noise JFET. Get hold of the NatSemi "Discrete Databook" from 1978 : now a rarity but containing more good info than you can find almost anywhere else - including noise voltages vs frequency and current for a range of devices. You'll find that some relatively large area FETs (aimed at switching) have relatively low noise voltages. Effectively these are multiple small JFets in parallel. See rms summation of noise sources... Pay special attention to "Process 55" (2N5459) operated at drain currents of 1mA or more. For low source impedance, as far as I know, you still can't beat bipolar transistors - usually PNP, and usually medium power (again, relatively large area). Even the BC214 isn't bad (see the Nat Semi databook again) but some designers recommend the Hitachi 2SC2547 (and if you need an NPN equivalent, I think the 2SA1075). With these, at currents around 10mA, you can reduce the noise resistance of the transistor to somewhere in the 10-30 ohm range. I'll leave you to convert that to nV/rtHz and compare with the best opamps you can find, or the AD797... Between vacuum tubes and discrete semiconductors, each used to its best, I doubt you'll find more than a dB or so difference in noise level. Ultimately, of course, you are bound by the noise figure of the mic capsule itself, i.e. the Brownian motion of the air molecules hitting it. Again, a large area capsule is quieter (sensing a theme here?) at the expense of inferior HF performance (when its dimensions exceed 1/4 wavelength of the sound signal). There have been twin-diaphragm mics (large LF, small HF) with internal crossovers to overcome this downside. And as @pjc50 notes, any further improvement beyond this comes from, effectively, multiple microphones in parallel : with DSP to not only overcome the disadvantages of their spatial dispersion but also offer advantages such as synthetic beamforming.
H: Need to identify this cable I recently bought this product from Amazon, but need to get a splitter for the 20V output. I need to know what to look for though, and cannot identify what kind of cable this is / what to search for. The print on the cable is (UL) SPT-1 2X20AWG VW-1 105°C 300V E307922 WL C(UL) SPT-1 2X0.519²(20AWG) FT2 105°C 300V WL +LF+ Please let me know what kind of cable / splitter to look for. Thank you! AI: Thats sounds like a 5.5mm x 2.1mm "barrel" connector, the most common size. Do a search on 5.5 2.1 Y cable The actual print on the cable just describes the flexible part of the cable, not the connectors on the end.
H: Difference betweeen analog and digital IC deisgn flow I tried to find the main differences but not too sure on what could be the main differences in analog and digital design flow. Apart from the circuit design and verifying your circuit level or test bench level design what should one be more concerned about for Analog and digital design ? Would be great if you guys share some light on the same ! AI: Your question is really too broad to answer. Our formal flow is the same as far as steps, but the outcomes are very different. I do both analog and digital design, and they are very different because your constraints are very different. Also, your goal is fundamentally different things. For instance, in an analog design I spend most of my time trying to keep noise to a minimum so I am burning a lot of relative constant current. In digital designs, I am more concerned about timing and clocks. With subthreshold asynchronous FPGAs, I am most concerned about my completion trees being fast so I burn power there, and my other circuits never get above Vt. The point: they are all different and you are trying to do different things for the same medium. This is also why you will find that courses are broken into analog VLSI, digital VLSI and RF VLSI.
H: How power meter works for residential buildings? If power is current times meter shouldn't the overall resistances and inductances and capacitances of my house appliances be known so the power meter could calculate the power. I look at my house as a closed circuit. some people say the amp meter measures the current that is used by the appliances but according to ohm's law I need to know the impedances to measure the current.The voltage is standard 120 rms volts. AI: The impedance is just the voltage phasor divided by the current phasor. If you measure both (as energy meters do) then the impedance could be known (it's a complex number in general). The impedance of a pure inductance or pure capacitance load will be imaginary (no real part). However there is no need to calculate the impedance. The energy (what you pay for) is just the time integral of the instantaneous product of current and voltage. Since the meter measures both current and voltage, that is all that is needed. In the case of old-school energy meters, it's done cleverly with a motor-like arrangement using eddy currents. Modern electronic energy meters do the calculations digitally after digitizing the current measurement (from a shunt, current transformer or Rogowski coil) and the voltage measurement (from a voltage divider or potential transformer).
H: Electric bill for reactive power I have read that if you don't unlug the charger from the socket after charging your phone, although it is not connected to the phone, it still consumes power and your electricity bill adds up. On the other hand if I leave the charger plugged without the phone I assume the only power is reactive power and in residential buildings we don't get charged for reactive power. AI: There are a couple of factors to consider. 1) Old-style wall-wart chargers use a transformer that runs at line frequency (50 or 60 Hz). High-quality line-frequency transformers do present a large reactive load to the AC Mains. Unfortunately, most wall-wart chargers do NOT use high-quality transformers. They usually run very close (or into) saturation and thus run warm or even hot. That heat shows up on your power bill as energy consumed. 2) Modern chargers use a switch-mode power supply. These can be extremely efficient when idling. Bottom line is: If the charger is running warm, it is consuming energy and that usage will show up on your power bill.
H: Voltages to keep my circuit running at 200mA with NMOSFETS Im trying to build a circuit to send information using IR led, using pulse signals my leds (TSAL6400) operates at 1.35V, and their maximum pulse current is rated 200mA After struggling a bit with BJT transistors, and realizing that since I'll send the data using RPI (Gpio is 3.3V, 16mA), I switched to NMOS transistors. I found a local dealer with RFP30N06LE Vgs(th)= 1-2V (min,max) Rds(on)=0.047Ohm My circuit (due to other limitations, and the fact I need to decide on which branch of leds to send the command on, each branch is a different room in my home) As I demonstrated in this sketch, each of the branches represents a room, and I want to each time send a command to a specified room. So, for instance, to send to the second branch from the left, I will turn the M2 on ("1" = 3.3V of my gpio at 16mA max), and will send the pulses by turning on and off M5 In order to reach 200mA I need a total voltage drop of 2.3V over my resistors and transistors. If R1=11.5Ohm, for M1-M4: Vds=0V, Vgs=3.3V Since Vds=0V will keep the transistor closed (no current flow), I assume I need to raise the voltage just a bit, but not sure how to make it appropriate for case with two transistors, one after the other. If I will use Rtot=8.5Ohm + 1.5Ohm + 1.5Ohm, and placing R1 where it is already, R2=1.5Ohm before M5 and another one after. Is that the correct way? This way: Vgs(M2)=3V Vds(M2)=0.3V Vgs(M5)=3V Vds(M5)=0.3V Is that correct? AI: You do not need the extra resistors around M5, the circuit will work just as it is, but with R1 11.5 ohms. Vgs(th) for those MOSFET's is between 1V and 2V, so you just use 2V which is the worst case in this circuit. The RPI outputs 3.3V so it can easily turn on M5. When M5 turns on its drain will be almost 0V, which means the source of M1 to M4 will also be 0V. The RPI can easily turn on M1 to M4 because the 3.3V output from the GPIO exceeds the Vgs(th). When M5 is turned off then it doesn't matter what happens with M1 to M4 because no current can flow in any case. In addition I suggest that you do not need M5 for the circuit to work. You can send the IR data to one MOSFET M1 to M4, while keeping the other MOSFET's turned off. Answers to your questions How do I calculate the resistors required for the gates, in order to lower the voltage to 2V? You don't need to lower the gate voltage to 2V. Unlike a BJT where you have to control Vbe, a MOSFET works with any gate voltage up to its maximum Vgs (this is for a digital circuit which is on or off). Just apply 3.3V from the GPIO. A MOSFET takes almost no gate current - it is specified as Gate-Source leakage current with a maximum of 10uA but is typically much less. You don't actually need a gate resistor, since you don't need to drop any voltage. However, it is still a good idea to add one, especially to larger MOSFET's. The gate of a MOSFET looks like a small value capacitor which has to be charged up to turn the MOSFET on, which can result in a large current flow from the GPIO pin until the cap has charged. When I am driving it from a processor I prefer to limit this current to be within the current rating of the GPIO pin. In this circuit I would limit it to 10mA with a 330 Ohm resistor. Also, Why is M5's drain almost and not exactly 0V? When it is turned on the MOSFET has a small resistance between drain and source (rDS(ON) ID) which will drop a very small voltage when current flows through it. Hence, its drain is nearly 0V. In this circuit you can ignore it and assume it is 0V.
H: If a battery case falls apart is it safe to just glue it back together? I've got a battery with two Li-Ion cells inside that has a two-parts rectangular case and those parts were somehow tightly connected (I guess glued together) but then fell apart and now the cells and the service electronics are in one half and the other half is just on its own. There's nothing like ventilation holes in that case. If I just glue the case parts together carefully - will that pose any risk? AI: No great risk compared to original condition as long as No part of the wiring is now more able to short circuit to (connect with) some other part that is unintended. The batteries are as well supported and protected as before. Lithium Ion batteries are prone to "vent with flame" type sudden 'self-dismantlement' if subject to heavy discharge or if the battery casing is ruptured or penetrated by a sharp (or other) object. 'Vent with flame' is not quite an explosion, but the difference is sometimes hard to spot - especially if you are standing close by, or you bag is in an aircraft overhead locker at the time, or inside your laptop :-(. The following are examples of what could go wrong. All are very unlikely, but Murphy loves a challenge :-). ie this is "no biggie", it should be easy to repair but DO do it properly as there is a small but finite change of "interesting outcomes" if you don't. If contact between two parts not intended to come in contact can occur the aboVe can apply. If you left a slit between the two halves that eg a steel ruler could slide into when both were in a bag together then the above could occur. If there was the opportunity for bits of foil (off candy or medicine etc) or a small coin to penetrate then the above can occur. If you dropped the battery and the case was able to re-separate under impact so that the batteries moved, then the above can occur. Likley? - No. Interesting if it does? - Very. You don't say what the battery pack is out of. If it's like a cellphone or laptop it may clip or slide into a present battery holding location and making it fatter with tape or ties may cause it not to fit. Worse, if you use thin tape or ies it may cause the battery to jam. Levering a LiIon battery out of something is better avoided if possible. So - you say "glue together". How was it joined before? If their glue failed, why should yours last? What is it made of? How long will your glue last? If you can use a mechanical method that is easy and works well, consider using it. Super glue (cyanacryloate) is good for positioning and quick tacking but has an unknown long term result with unknown plastics. Silicone rubber works for most plastics but has long pot life. Using the two together (on different locations on the case for each) gives you fast set and the long life of silicone rubber. If the case was ultrasonically bonded originally, as has been suggested, it may be hard to glue (or not). Murphy says that if they did not need to glue the plastic there is a moderately good chance that they chose one that is hard to glue for whatever reason. One option, usually not pretty but which can be effective, is to heat seal the two parts back together with a soldering iron or other suitable hot tool. You can also get specialised plastic welding tools which are (understandably) well suited to this task. Care needs to be taken not to overheat the batteries or to slip and insert a conductive iron tip into a suitably unfortunate location. Given due care this can be a good solution. Play, Report. Enjoy
H: How to ground a vintage device that was powered without a ground? This is a follow-up to Is there a mathematical relationship between the battery AH rating, and that of the transformer in the charger Since that post I've uncovered a vintage battery charger (Manufacturer: Philips Model: PK-5000) in the old house itself. The device looks good, albeit it has probably not seen service in easily 3 decades ... or so; certainly not since I was a little boy. It has a 2-point supply (without a ground point); what should be done to ground the device so it may be powered by a proper 3-point plug? AI: If this charger has metal case, then you can connect ground wire to the case. However, first measure that there is no connectivity between case and any line right now. If there is connectivity, then do not connect ground and do not use it at all.
H: How to include schematic page name in OrCAD BOM I am generating BOM in OrCAD. How can I include a part's schematic page name in the Bill of Materials csv file. AI: You can't do that directly. You could generate the xref file and use that plus a one-part-per-line BOM and merge them in Perl or Excel.
H: LPC2148 ADC problem with voltage divider for battery edit: solution found with our new board revision; outside of careless mistakes, buffering the signal with an op amp seems to have resolved the issue (as suggested by Joshua below). I am working with a custom PCB using the ARM LPC2148. I'm trying to measure the battery voltage, which can be up to 4.2V or so, by using a voltage divider. However, using different resistors causes huge changes in the accuracy of ADC readings. Why is this? Details: I set the power supply to 3.0 V and hooked it up to an ADC pin, and got a reading of 2.987V, which is accurate enough for our use and shows that everything is working. Using the voltage divider we built into the PCB with 47K and 100K resistors, the readings from the ADC vary in a non-linear manner -- I mean, not by a simple scalar factor -- (data below). I built a voltage divider using 5% 10K 1K and 100K resistors (divides by 11 101), and took a reading on the ADC. Software showed 0.029V, or 0.319V after being scaled according to the voltage divider. This is obviously wrong, but the reason we're using large resistor values is that it limits the current draw; the power supply is showing less than 1mA being used. I built another voltage divider using much smaller 5% resistors, of values 4.7 and 8.2 (divides by 2.745), and took a reading on the ADC. Software showed a value of 1.071V, or 2.940V after being scaled according to the voltage divider. This is obviously much better than the other voltage divider, and we could probably use this. However, the current draw is 228mA, which is unacceptable. It seems that the path forward is to redesign the board to use smaller resistor values and to hook the divider up to a transistor to limit current draw. ADC Vref is 2.5V. My question: why the huge change in accuracy from the different resistors? Data: power supply: voltage coming from the power supply to the board input voltage: voltage reading taken at the voltage divider voltage after divider: the voltage reading taken at the output of the voltage divider raw from ADC: value from the ADC; average of a few readings scaled by divider: value obtained by taking the ADC reading and scaling by the voltage divider (the first row is 0.28/0.32, etc) voltage divider: resistor values for the current data set +---------------+---------------+-----------------------+--------------+-------------------+-----------------+ | using the voltage divider on the board (47K / 47K + 100K) | | | | power supply | input voltage | voltage after divider | raw from ADC | scaled by divider | voltage divider | | 3.8 | 3.80 | 1.22 | 0.28 | 0.87 | 47,150 Ω | | 3.7 | 3.70 | 1.18 | 0.29 | 0.89 | 100,000 Ω | | 3.6 | 3.60 | 1.15 | 0.30 | 0.92 | 0.320 | | 3.5 | 3.50 | 1.12 | 0.31 | 0.95 | | | 3.4 | 3.40 | 1.09 | 0.32 | 1.00 | | | 3.3 | 3.30 | 1.06 | 0.33 | 1.04 | | | 3.2 | 3.20 | 1.02 | 0.35 | 1.08 | | | 3.1 | 3.10 | 0.99 | 0.37 | 1.15 | | | 3.0 | 3.00 | 0.96 | 0.39 | 1.21 | | +---------------+---------------+-----------------------+--------------+-------------------+-----------------+ | using an external voltage divider (4.7 / 4.7 + 8.2) | | | | power supply | input voltage | voltage after divider | raw from ADC | scaled by divider | voltage divider | | 3.8 | 3.79 | 1.39 | 1.37 | 3.76 | 4.7 Ω | | 3.7 | 3.69 | 1.35 | 1.33 | 3.66 | 8.2 Ω | | 3.6 | 3.59 | 1.31 | 1.30 | 3.56 | 0.364 | | 3.5 | 3.50 | 1.28 | 1.26 | 3.47 | | | 3.4 | 3.40 | 1.24 | 1.23 | 3.37 | | | 3.3 | 3.30 | 1.21 | 1.19 | 3.27 | | | 3.2 | 3.20 | 1.17 | 1.16 | 3.17 | | | 3.1 | 3.10 | 1.13 | 1.12 | 3.07 | | | 3.0 | 3.00 | 1.10 | 1.09 | 2.98 | | +---------------+---------------+-----------------------+--------------+-------------------+-----------------+ | using an external voltage divider (10K / 10K + 100K) | | | | power supply | input voltage | voltage after divider | raw from ADC | scaled by divider | voltage divider | | 3.8 | 3.80 | 0.35 | 0.35 | 3.81 | 9,820 Ω | | 3.7 | 3.70 | 0.34 | 0.34 | 3.71 | 98,400 Ω | | 3.6 | 3.60 | 0.33 | 0.33 | 3.63 | 0.091 | | 3.5 | 3.50 | 0.33 | 0.32 | 3.53 | | | 3.4 | 3.40 | 0.32 | 0.31 | 3.43 | | | 3.3 | 3.30 | 0.31 | 0.30 | 3.33 | | | 3.2 | 3.20 | 0.30 | 0.29 | 3.23 | | | 3.1 | 3.10 | 0.29 | 0.28 | 3.13 | | | 3.0 | 3.00 | 0.28 | 0.28 | 3.04 | | +---------------+---------------+-----------------------+--------------+-------------------+-----------------+ AI: By your values, I have to assume that you are measuring off of the 10kOhm resistor on the bottom. I would hazard a guess that your 10kOhm resistor is a little high and the 100kOhm resistor is a little low. This would mean if your 10kOhm resistor is taking more of the voltage in the voltage division than expected. There are a few problems at work here. The first is the resistor value error. Ohm's Law: V=I*R. So if there is 5% error in R, then for a constant I, there will be a %5 error in the expected value of V. The %error from resistor tolerances are the maximum +/- error. So in reality, there could be a resistor with +5% error and other with -5% error. So there is a much larger possible range in output voltages for a constant current. This can be eliminated by either hard-coding the real resistances in software or adding a reference voltage that is more accurate than the resistor or A/D quantization error. This reference voltage would be used to get the real resistance values as the A/D sees them. A/Ds can have an offset error. This really has to be calibrated out. Some A/Ds have this built in. A/Ds also have quantization error. So if a voltage falls between two consecutive quantization levels, it will have to be rounded to one of those two, introducing error. There are ways of increasing the number of bits for an A/D by oversampling and averaging blocks of samples into one sample. There are other errors that could be at work, but those three are the main ones I have run into. If the A/D is fairly linear, then measuring two accurate voltages with the A/D circuitry would let you build an affine linear equation to correct the data. This builds off of the problems in 1 and 2. A/Ds can appear linear, but end up being very nonlinear at a particular range. I have heard of some implementations using a look-up table to correct the nonlinear behavior. But that is getting a little beyond your current problems. Edit: One more item. It is a good idea to buffer your analog signals to the A/D. It does a few things, like add another device to protect the microcontroller, and limit any possible transient sampling behavior from the A/D go into the analog signal.
H: What's the simplest way to generate a VGA signal for a totally white screen? Preferably with an AVR MCU I'd like to make a simple board to plugin a LCD monitor and get a blank white screen. The idea is to use any monitor as a makeshift light table. I have a preference for 8-bit AVR micros since I have a couple laying around. So what is the simplest way to generate a VGA signal for just a white screen? AI: In actuality, you will likely need to switch the R, G, and B lines as well as the HSYNC and VSYNC. Most monitors will not continue to display those colors if a steady DC voltage is present on their inputs. Instead, they usually respond to the difference between the voltage present when the scanning is "off screen" and that present when scanning the intended display area. You might find an odd monitor that would respond to DC, but it's atypical. Since you want monochrome you can of course drive all three together. A resistive voltage divider is the usual way of creating the right voltage levels. So basically, you will need to generate a sequence of pulses on HYSYNC, RGB, and VSYNC, with moderately precise delays in between. None of the events really overlap, so this is quite feasible. Your program will probably consist of a for loop producing the desired number of horizontal lines with a sequence of hysnc and RGB turn on-wait-turnoff actions, inside an infinite while loop that drives the vsync to produce full screens. Many monitor manuals would show timing diagrams; often even the manual for a different monitor than you are using would be applicable at least for a suitable resolution/vertical refresh rate. You could use the hardware timers to generate timing, but since it doesn't sound like you need your micro to do anything else, you could also use a delay loop. Traditionally a video card generates all it's timing as a multiple of a multi-MHz dot clock, using a programmable counter to count each state as some number of dot clocks and read through the frame buffer. But since you aren't trying to produce any narrow features, you can probably just use a delay loop for whatever the shortest event is (likely the hysnc pulse), and define all the longer events in multiples of that or with their own delay loops if they are not close to an integer multiple thereof. Access to an oscilloscope would certain simplify the task of getting your implementation right, though it's not an absolute requirement. A monitor will likely generate "something" even with the timing rather off, and you can then "walk" it into position by changing the delays. It's worth mentioning two things about monitor technologies; CRT's may not be real happy being driven at unusual scanning frequencies and the magnetics may audibly complain; theoretically they could even be damaged. LCD's are pretty tolerant, but go out of their way to adapt to whatever you feed them and make the most of it with their rescaling circuitry. You may find yourself hitting the re-adjust button frequently as you change your timings. I suppose it's also possible that they could fail to adapt to a signal that generates a big rectangle with no high frequency content that they could use to try to align their sampling rate with your non-existent dot-clock in order to sharply display fine text or graphics features that you aren't generating. If using a CRT with an all white display you will definitely want to get the vertical sync rate as high as you can with valid timings to avoid flicker (picking relatively few vertical lines may help with that, since the constraint is often the maximum horizontal frequency the monitor can handle); for an LCD it's not directly an issue so people usually time things to 60Hz.
H: Voltage Required to Ignite 10ohm resistor I just read http://www.bigclive.com/ignite.htm It shows igniting a 10ohm resistor with 12 volts. I was wondering, could a 10ohm resistor be ignited with less voltage(say, 9Volts), and if so, what is the minimum voltage? AI: DO NOT destructively test resistors or any other devices without the DIRECT SUPERVISION OF AN ADULT QUALIFIED TO INSURE SAFETY It depends on the wattage rating of the resistor, airflow, atmospheric pressure and composition, what the leads are connected to internally and externally, the temperature coefficient of the resistor, and the degree to which its materials are flame retardant. DO NOT destructively test resistors or any other devices without the DIRECT SUPERVISION OF AN ADULT QUALIFIED TO INSURE SAFETY You can find out if you are exceeding the manufacturer's rating by comparing the square of voltage, divided by resistance, to the rated power limit in watts. For example, 9*9/10 or 8.1 watts is drastically more than the 1/4 watt rating of most small through hole resistors so it's clear that the component is being abused and there is a substantial risk that something bad and potentially dangerous will happen. (1/2 and 1/8 watt units are also common, though you can get higher rated ones). DO NOT destructively test resistors or any other devices without the DIRECT SUPERVISION OF AN ADULT QUALIFIED TO INSURE SAFETY And don't assume the resistor will just burn; it could also explode. Either one can be hazardous to your health and surrounding property. Also consider that it could be hot enough ignite other materials or produce nasty gases even if the resistor itself does not burst into flame. You could also overheat whatever is sourcing power to the resistor. DO NOT destructively test resistors or any other devices without the DIRECT SUPERVISION OF AN ADULT QUALIFIED TO INSURE SAFETY
H: AC current sensor What would be a simple circuit to monitor a 120 volt line current? Connecting an Arduino to the circuit would allow one to detect when the attached device has shut down, for example a washer, dryer; or perhaps to monitor usage, a child's TV. AI: Many exist: Two possibilities: Current transformer (CT) - search this site for recent dicussion. Available from many surplus and hobbyist sites. A CT consists of a single "turn" "winding" on a magnetic core with an N turn secondary. The 1 turn winding can be just a wire transiting the enclosed core centre. Many CTs are available with "split cores" which may be opened to allow the CT to be inserted over existing wiring. A CT must ALWAYS be used with a terminating resistor so that the output current can produce an output voltage. Without this it will make very very very large voltages indeed. For 1:N transformer Vout = Iin/N x Rload If desired a CT can be used stand alone with very few other pars as an on/off current monitor. Buy a CT here from Sparkfun The fabulous Arduino enegy monitor project LOOKS easy :-) Hall sensor Stack exchange discussion here Related by=ut not identical Related - Hall sensor
H: How to control a Water Valve through a circuit using latches or flipflops? I need a circuit that can "simulate" opening/closing a valve for a water tank. The circuit has only 2 inputs, 'm' (minimum) and 'M' (Maximum), and an output 'V' (valve). The valve is only open if V= High(1). The tank has a floating water meter that goes up and down with the tank water level. When the tank is emptying, as soon as the water meter reaches a certain level, minimum(m), the entry 'm' is Low and the valve should open to fill the tank. As soon as water meter reaches minimum(m) again in the rising direction, 'm' will become High but the Valve should remain open (=1). When the tank is filling, as soon as the water meter goes above a certain level Maximum(M), the entry 'M' is High and the valve should be closed. If the tank starts emptying again, 'M' will become Low but the valve should remain closed. m=Low(0) and M=High(1) will never happen simultaniously. I need to make two versions of this circuit: one using only NAND gates, and another using a JK Flip-Flop. I tried using http://logic.ly/ for simulation purposes. One of the answers has a working NAND gate implementation, but I just can't wrap my head around the circuit with the JK flip-flop. AI: m=Low(0) and M=High(1) will never happen simultaniously I didn't understand what you mean by above statement. But what I understand is m and M will never be high at the same time. Since then, I think what you need is an SR Latch. It is easy to build an SR Latch using NAND gates. Here are the circuits I tried: The Basic RS NAND Latch says: Edit It is understood that when the water is at the minimum when min=0, so it is reversed. Just add a NOT gate after the min, and you can use the circuits above. A NOT gate could be build by a NAND gate by shorting its inputs.Here is the final circuit:
H: Why are deep cycle batteries rated in amp hours instead of watts hours? Why are deep cycle batteries rated in amp-hours instead of watt-hours? For example if I see a 85Ah battery, I multiply 85Ah x 12V to get 1020 watts. As household electricity use is measured in watt hours (hence a kill-a-watt) this information seems more useful. What is the important thing that I am missing with the amp labeling? AI: Simply put, watts measures a rate of consumption, and amp-hours or kilowatt-hours measures the total energy consumed. Batteries store energy, so a unit that quantifies the amount of energy stored is useful. Watts are 'Joules per second', so 1 Watt is the consumption of 1 Joule per second. Watt-hours is the energy consumed by a load with 1 Watt power consumption for one hour. This is the same unit that the power company uses to determine your electric bill. So the question may be altered to be "Why are batteries expressed in Amp-Hours instead of KiloWatt-Hours", and there's a good reason for that as well. By specifying voltage separately, the unit of 'Amp-Hours' allows convenient recalculation for different series/parallel combinations of batteries, as well as easier calculation of battery lifespan (measuring load current is easier than load power).
H: Onboard temp sensor for household thermostat - accurate enough? Many microcontrollers, such as the TI MSP 430 have an on board temperature sensor. If one is designing a typical smart thermostat for heating/air conditioning is this sufficiently accurate or would there be any practical advantage to using an alternative sensor? AI: IMO using the on board sensor simply won't cut it. Majenko already talked about accuracy and self heating. I have an issue with the slow time constant of your solution: If for example a window is opened, the room temperature will fall within several minutes (let's assume it's cold outside). Every layer of material around your sensor will delay the reaction of the control system and thus worsen the system performance. You absolutely want to make sure, that the temperature sensor gets any change in room temperature ASAP. This means: Ventilation holes/slots in the housing of the control unit, I've seen even little fans in automotive applications to ensure a steady airflow around the sensor. If reaction time is not an issue, you could try and account for the self heating of the chip in software, but this will only reduce the error for stable temperatures.
H: Starting motor for 5 seconds after 30 minutes, turning it off and start in reverse direction after 30 minutes I want to start a 9v DC motor in one direction for 5 seconds after 30 minutes delay, then turn it off and then after 30 minutes, restart it for 5 seconds in reverse direction and then stop it. The same process should continue in cycle. I already have a 30 minutes timer circuit which can turn on the motor after 30minutes. I need this circuit for a Hatchery, the motor will be used to turn eggs on another side after each 30 minutes. What I want to ask is that can I make a circuit with these functions without using micro-controllers? Please guide me so that I can proceed in the proper direction. AI: Since this is for a real world application, not a hobby project or a school assignment, the requirement not to use a microcontroller is just silly. A micro is the obvious and easy way to do this. A very small micro like a PIC 10F200 could do this, but since this is also apparently a one-off there is no need to economize. Something like a PIC 18F2520 would be easy. That's way overkill, but the extra $3 or so will be made up with easier programming. This part has a internal RC oscillator, so you pretty much feed it power with bypass caps and it can run. I agree with Wouter in that relays are appropriate for this since it's a one-off and you are switching very slowly. One DPDT relay is used to set the polarity, and a second SPST is the on/off switch. Now you only need circuits to drive the relay coils from two digital output lines from the micro.
H: What flip-flop should I use to design a logic circuit with minimum number of logic gates? How can I know with which flip-flop I can design a complex logic circuit with minimum number of logic gates? In our homework and exams, we are supposed to use minimum number of logic gates. In one problem, we are asked for designing a register with simple binary counter, serial load, 2 bit rotation, and parallel load options(synchronization is not mentioned in problem). We are free to use whatever flip-flop we want to use. Which flip-flop would you use in this case? And why? Is there a way to know with which flip-flop we could design the logic circuit with minimum number of logic gates? Thanks in advance. Edit: In this assignment, we're allowed to use D, T, SR, JK flip-flops. The problem is, when we use different flip-flops, our combinational part of the circuit is different, is there a way to know with which flip-flop this part would be smaller(contains less number of logic gates). The register we are asked to design is holding 4 bits. We have 2 bit input which specifies the operation will be running on register(counting, rotating, parallel loading, serial loading). And by "rotation", I mean Circular Shift Also, nothing mentioned about "synchronization", so I think it's up to us. AI: Serial/parallel-load shift registers and bit rotations are going to work most naturally with a D flip flop, since they just send data straight through; binary counters are going to work most naturally with a T flip flop, since each counter bit Ck = Ck,previous XOR carryk, where carry is the carry bit from the previous stage. If you look at JK flip-flops, however, they are the "universal" flip-flop that can act as a D- or T- flip-flop depending on the input signals. To get a D from a T, or vice versa, you need an XOR gate. To get a T from a JK, you just tie the JK inputs together. To get a D from a JK, you need an inverter, as the J/K inputs need to be opposites. In your application, you've got enough complexity, that I suspect the gate counts are going to be very close, and it's probably not worth worrying about -- unless you have to optimize, in which case you'll just have to try it for each case. IMHO, the D flip-flop is conceptually the simplest to use, and it works naturally with most of your operations, so I'd start with that.
H: How do I calculate the required value for a pull-up resistor? There are many tutorials that use a pull-up or pull-down resistor in conjunction with a switch to avoid a floating ground, e.g. http://www.arduino.cc/en/Tutorial/button Many of these projects use a 10K resistor, merely remarking that it is a good value. Given a a particular circuit, how do I determine the appropriate value for a pull-down resistor? Can it be calculated, or is it best determined by experimentation? AI: Quick Answer: Experience and experimentation is how you figure out the proper pullup/pulldown value. Long Answer: The pullup/down resistor is the R in an RC timing circuit. The speed that your signal will transition will depend on R (your resistor) and C (the capacitance of that signal). Often times C is hard to know exactly because it depends on many factors, including how that trace is routed on the PCB. Since you don't know C, you cannot figure out what R should be. That's where experience and experimentation come in. Here are some rules of thumb when guessing at a good pullup/down resistor value: For most things, 3.3k to 10k ohms works just fine. For power sensitive circuits, use a higher value. 50k or even 100k ohms can work for many applications (but not all). For speed sensitive circuits, use a lower value. 1k ohms is quite common, while values as low as 200 ohms are not unheard of. Sometimes, like with I2C, the "standard" specifies a specific value to use. Other times the chips application notes might recommend a value.
H: Simple transistor switching example should show LED off UPDATE So even when I remove the switch, the LED is still on (see image below). I.e. there's nothing connected to the base; only to the collector. I'm using the same 2N2222-331 transistor that's in the book (I actually got all my components from the Kit sold separately at http://www.makershed.com/Make_Electronics_Components_Pack_1a_p/mecp1.htm). I also tried another transistor (of the same type) to make sure that the one I was using wasn't faulty but to no avail. Is it possible the author messed up the transistor type? In at least 90% of these kinds of cases it's my error an not the author's. Reading "Make: Electronics". Trying to implement Experiment 10 on Transistor Switching. Diagram shown below: Problem I'm having is that my circuit always has the LED ON when in theory the LED should be off when the button is not pressed because there is no voltage applied to the base of the transistor. What am I doing wrong here? I'm sure I have the right components (except possibly for the push button) and that I'm using 12V DC. My guess is that I've got the orientation of something wrong but I'm not sure. AI: Very nice presentation of your problem. Well done, and thanks. (1) Check that your switch connects left to right when pressed and not top to bottom. Remove switch - does LED go out. Use a piece of wire. Does LED turn on? (2) It appears that the problem is that the circuit they have given you is utterly and completely and inexplicably scrambled. It would be hard to have the circuit much wronger that that and still light the LED! It just MAY be sort of correct given several unlikely assumptions. How can this be? I so didn't believe what I was seeing that I checked several times. 2N2222 data sheet here What transistor are YOU using? What is the pinout. Even if YOU are not using a 2N2222 they should be. The circuit is wrong because: They say 2n2222 so it should be NPN It is normal to put the LED in the collector circuit but not essential. If R3 is in collector then it should not go to V- power rail but to V+. If we assume LED is in Emitter circuit then R1 must be in collector circuit and the transistor is being used as an "emitter follower". Not what you would usually do or for a beginner but say that's correct. And the pinout is backwards. Let's assume it is. Then base should be being pulled +ve to turn on. It is. They should have a pulldown on the bas to ground to turnthe transistor off - especially when used as an emitter follower. Connect another 10k from SW1/R1 junction to ground. Test . report. BUT Ensure transistor is CBE bottom to top as per 2N2222 datasheet or find what it really is. Identify C B E with certainty. Ensure NPN transistor. Collector via R3 and LED to V+ Emitter to ground 10K from Base to ground 10K via switch to V+ Like this with different values, but I have added extra 10k from base to ground (a wise precaution). I checkd 2N2222 data sheets from several manufacturers. ALL I found including metal can ones show transistor is CBE readingUP the breadboard as shown. (terminals 48-49-50) SO there is NO DOUBT that they have the circuit VERY WRONG as shown. Their C (terminal 48( goes via R3 to B- (ground). For an NPN transistor it should be B+ / +12v. etc. Build the circuit as I have suggested. It will work ;-). Transistor MAY be dead. Datasheets metal can [TO18 & TO39 metal can both the same](metal can ) All TO92 plastic seem to be ONSemi - several distributors: Did they provide a proper circuit diagram? If so please show it. ONSemi TO92 plastic Update: Here is the book concerned . (1) The transistor is reversed. Turn it around 180 degrees and their circuit is as they intended. Their basic data shows the transistor wrongly. (2) And / But - the circuit is an emittee follower as it was obvious it would be if you "just" reversed the transistor. This is such an 'interesting' way to do things that it was hard to believe that it was intended. It was. Their "rather interesting" circuit:
H: A Battery Charger which can extend LEAD ACID Battery life I am making a battery charger for a 45AH LEAD Acid Car Battery. That I will use with 100 W (1 A 100 V AC) UPS. I need to know that what things I should keep in mind so that the battery charger charge the battery efficiently so as to extend its life. For now I only have this hint that a charger should stop charging the battery after it is fully charged. What are the other features of a charger which extend battery life? AI: There are two important things to know about charging lead acid batteries. There is very very deep and arcane* magic involved, without the knowledge of you are doomed to miserable failure. (*But not necessarily dark). The magic has been very well investigated over 100+ years and there are exponents of the deep and arcane arts willing to share with you most (not all) of the secrets. If you are serious about your quest you should avail yourself of their expertise. If not, just take the red pill. If you read what the masters say and follow it, your battery's life, and maybe your own as well, will be a long and successful one. If you fail to diligently study the advice of the masters then you may get lucky. But, probably not. Below I point you to the beginnings of your lead-acid journey, but as I do so I'll note: Starting with "A Car Battery" [tm] is not the ideal way to meet your objectives. While it is possible to make a car battery last much longer than it would have without suitable care, it will not last anywhere near as long as batteries made for the task that you have in mind. Car batteries may tend to contain stuff like antimony - because it makes them more resistant to physical abuse. Batteries that wish to live long and prosper (but that are less worried about mechanical abuse) may contain calcium because eg of its effect on self discharge rate . It is unlikely that you will buy an off the shelf charger that really does what you want unless the sales pitch/blurb specs spell out that it does what you want in some detail. Most chargers are liable to do the basic charging thing and may be designed to "float" the battery. Any thought of equalization / topping cycles et al are usually far from their minds, as sales rather than performance are a priority. Good does not have to be horrendously expensive (but can be). But, incredibly cheap is also usually "cheap and cheerful". Here is a superb starting place: How Lead Acid Batteries Work by Constantin Von Wentzell. Note that his interest is "Marine Batteries" for use in his boat. The usage patterns of his application differ from yours. His: fast charge, deep, often daily discharges, float when charged versus, Yours: long term float with occasional deep discharges.(). Despite this he has much to say that is useful and valid. If you read outside this page you will see that he started his investigations due to very bad advice given by a person whose positions in the industry would lead you to expect his advice to be good. But it isn't. ie "appeal to authority" is risky. Accept that an expert should know much, but also use your brain and consult multiple experts. This site was referred to by a stack exchange member today - I has not seen it before [This is such a good page that it is plagiarized in many other places to help vend ads. If you see it elsewhere be sure not to buy the products advertised.) Follow the arrows and read. Once suitably informed have a look at the next level up. He has links there to a number of other good resources. THEN All battery roads lead to Battery University. They don't know everything, & not everything they say is correct - but you may never notice the flaws! :-). A good site. ( They note: "Sponsored by Cadex batteries".) You should glance at their top level Learn about batteries page to get a feel for the scope of the site, and then leap into. Charging lead acid . DO note the subject menu on the left side of the page. From the above page: Charge in a well-ventilated area. Hydrogen gas generated during charging is explosive. Choose the appropriate charge program for flooded, gel and AGM batteries. Check manufacturer’s specifications on recommended voltage thresholds. Charge lead acid batteries after each use to prevent sulfation. Do not store on low charge. The plates of flooded batteries must always be fully submerged in electrolyte. Fill battery with distilled or de-ionized water to cover the plates if low. Tap water may be acceptable in some regions. Never add electrolyte. Fill water level to designated level after charging. Overfilling when the battery is empty can cause acid spillage. Formation of gas bubbles in a flooded lead acid indicates that the battery is reaching full state-of-charge (hydrogen on negative plate and oxygen on positive plate). Reduce float charge if the ambient temperature is higher than 29°C (85°F). Do not allow a lead acid to freeze. An empty battery freezes sooner than one that is fully charged. Never charge a frozen battery. Do not charge at temperatures above 49°C (120°F). OR You could just buy a charger that claims to do all the things that these and other pages say a charger should do. But, you'd know a lot less :-). Example of A plagiarising ad server ripping off this sites copyright material. And again more plagiarism and yet again. Better: A site acting as if it is a search engine and accumulating related sites to try and sell ads - actually useful - Performs a service and no copyright infringement.
H: How does the efficiency of a transformer change with its load? How does the efficiency of a transformer change when the load changes, and why is that so? AI: Increasing current causes increasing copper losses due to resistance. Resistive loss is determined by current^2 x resistance. BUT, Power is determined by voltage x current. So if you increase power from 100% to 110% the copper losses rise by (110%/100%)^2 = 1.1^2 = 1.21 ie losses increase by 21% for 10% more power. Copper resistive energy loss is turned directly into heat. A transformer will be designed to have a safe temperature rise at rated power in the worst case environmental conditions that it is guaranteed to work in. Add 20% more heat and things may get "interesting"/ Short term failures may occur. But, if not, inter-winding insulation will "cook" and perish, wire insulation may fail. Iron losses due to hysteresis will also increase. Brain offers that this will be linear with current but brain may be wrong. Increased temperature may affect magnetic property of the core steel. IF core permeability drops even slightly then flux will drop and inductance will drop and current per applied volt will rise and copper loss will increase and temperature will increase and ... . Thermal runaway is not usually seen in domestic size transformers. Fortunately. This page from Elliot Sound products notes: Keeping a transformer as cool as possible is always a good idea. At elevated temperatures the life of the insulation is reduced, and the resistance also increases further because copper has a positive temperature coefficient of resistance. As the transformer gets hot, its resistance increases, increasing losses. This (naturally) leads to greater losses that cause the transformer to get hotter. There is a real risk of drastically reduced operational life (or even localised "hot-spot" thermal runaway) if any transformer is pushed too far - especially if there is inadequate (or blocked) cooling. It is generally accepted that any transformer will have one part of the winding that (for a variety of reasons) is hotter than the rest. It's also a rule of thumb that the life expectancy of insulation (amongst other things) is halved for every 10°C (some claim as low as 7°C). When these two factors are combined, it is apparent that any transformer operated at a consistently high temperature will eventually fail due to insulation breakdown. The likelihood of this happening with a home system is small, but it's a constant risk for power distribution transformers. Despite all this, mains frequency iron cored transformers typically outlast the product they are powering, and even recycled transformers can easily outlast their second or third incarnation. Once a transformer is over 50 years old I suggest that the chassis be earthed, as the insulation can no longer be trusted at that age. Added 8 years on :-). Not directly asked about but related and worth noting: Transformer manufacturers seek to minimise cost (of course) and using as little lamination material as reasonably possible is a target. The core is usually designed to operate at the knee of its flux BH curve where increasing amp-turns start to give increasingly less flux per amp-turn as the core is driven further into saturation. Transformers designed for 60 Hz operation can use usefully less core material due to the increased impedance at higher frequency (Z = 2.Pi.f.l). However, operating a transformer designed for 60 Hz in a 50 Hz environment can lead to very substantial excess heating. While this is not normally encountered it does happen. Two examples: People bringing equipment from eg the US to NZ not only need to adjust transformer tappings (if availaable) to accommodate the 100 VAC to 230 VAC change but also need to take account for the change from 60 Hz (USA) to 50 Hz (NZ) I once had a custom 500 watt mains power transformer would in New Zealand for use in a test box in a Taiwanese factory. Their mains is 110VAC and hours is nominally 230 VAC. I specified two primary windings that could be connected in series or parallel to allow operation in either country. In the specification I did not mention Taiwan but I did tell the manufacturer that it was for use in Taiwan, ultimately. He took it on himself, without asking or telling me, to design it for 60 Hz operation. NZ uses 50 Hz. While a 50 Hz design would have worked well in Taiwan, the opposite was not as true as I would have liked. In NZ on test it ran VERY hot - it took me a wee while to realise why.
H: Client server WiFi structure We have 3 measurement system and a master computer. Only the master computer have access to the Ethernet because of this we would like to use WiFi connection, but for this purpose I have no idea which part fits the best. The measurement systems are 500m to 2000m away from the master. I found this solution but one of this is cost around 850Euro. I have no idea where can I buy the antenna and the modules and which does it fit to this purpose. AI: Good directional antennas at both ends can extend WiFi to 2 km, but it won't be legal. Maybe it's not a issue if you're in the middle of nowhere or your beam is well focused such that it doesn't spill past your own installation. But that only means you are unlikely to get caught, not that it's legal. Directional antennas are said to have "gain", but what that really means is gain in some direction as apposed to either a isotropic radiator or a dipole. With a properly designed antenna, the WiFi circuitry can't tell the difference and it will send out the same power RF signal. The high gain antenna will concentrate this power in a narrow beam, thereby increasing the radiation levels along that beam compared to a normal antenna. However, the legal limit is specified as a particular maximum field stength (Volts/meter) at some specified distance from the transmitter. This limit must be met in all directions, hence making conentrated beams with the same transmitted power as a dipole illegal. In practise, the FCC (in the US) doesn't go looking for such violators. It would take a complaint by a neighbor or someone to get them to look into it. If you can focus the beam such that it stays on your property or ends at your installation by hitting the ground, going up, or getting blocked, then in practise you'll be OK. Just don't go around advertising the fact that you're doing this.
H: Looking for a chip to connect to internet and display text I am looking for a small chip that will be able to connect to the internet and display black & white text. I'd like to program the chip to connect to a remote service and display text accordingly. What chips do you recommend? Do you know the prices? I am not very experienced in hardware of any kind, I hope this is the correct place to post this question. Thanks AI: I am not sure if there is a single chip avaialbe to do this, but you can have a look a few examples.. The arduino can be be programmed very easily and all the tools, code and IDE is free and open source. This not the only available one and there are several different architectures that benefit from their own subset of features,pros and cons. Building a simple internet bassed arduino wont cost you too much. But this is not recommended if you want to go mass production though. Here are some projects that could interest you. Arudino Based RSS Reader Arduino based Gmail Reader Top 40 Arduino Porjects of the Web! If you need some help making this have look at my career profile, I am available for freelance hire now.
H: Will this setup create much audio interference for me? I'll be installing a ipod adapter kit in my 2004 honda accord, and on the device that connects to my stereo, it includes stereo outputs - red/white - that i can connect with a stereo to 3.5mm cable to plug in any other device and listen to it through the stereo. My question is, since I bought a 6ft cable without really thinking, will I get much interference from winding up the cable in bunch to fit it under the stereo? As opposed to just getting a shorter cable. Here is the cable for reference: http://www.amazon.com/Belkin-Audio-Cable-Splitter-1-Mini/dp/B00004Z5CP/ref=sr_1_5?ie=UTF8&qid=1323873682&sr=8-5 This is the interface that I will be installing: http://www.amazon.com/USA-PA15-HON2-Interface-Select-Factory/dp/B001JT5G4G/ref=sr_1_1?ie=UTF8&qid=1323879039&sr=8-1 Wasn't sure how much self-interference from the cable being bunched up together - like in the amazon pic - I would get, if any. AI: You should be fine bunching it all up. Normally, in a car, interference on the cable is minor compared to other sources of interference-- like the noise the ignition system puts onto the power.
H: Will there be a problem if I stay almost in the border in trace spacing when dealing with line voltages? The IPC-2221 standard shows that 1.25mm will be enough at less than 3050m at 250V (220V is the line voltage here in Turkey), even if the coating gets damaged. However, people generally recommend 5mm even 10mm. Why is this precaution taken? What is going to happen if I stand in the border and make the trace spacing 1.25mm or 1.5mm or 1.75mm or 2mm? That is a lot of options :) Here is the table for IPC-2221. (I just saw IPC-2221 in the first line in Google that's why I've chosen that. My question is not standard specific meaning it could be other standards too.) 1.25 mm = 50 th 1.5 mm ~= 60 th 1.75 mm ~= 70 th 2 mm ~= 80 th 5 mm ~= 200 th 10 mm ~= 400 th AI: There are various standards. Some companies I have worked for have claimed to go thru them and determined that 5mm spacing for "line voltage" was going to cover all the cases. That is deliberately a superset, so of course there will be individual standards less tight than that. If your design can tolerate 5mm space, then do it and you're done. If not, you have to spend some time figuring out which standards apply, and then check them carefully to see what the minimum required spacing is for your particular type of device and target usage. For example, home and industrial often have different limits. There are several reasons spacing requirements might be larger than you would think. The different levels of importance placed on these has something to do with different specifications. Line voltage spikes. You say your line voltage is 220V, but that is nominal. At least 10% should be expected, which brings it to 242V RMS. The peaks of that are +-342, and that's with everything working normally. In reality power lines can have fairly large spikes on occasion. How large depends on what you believe and what probability you want to protect against. Rectification. From above we have to expect +-342V on a good day. However, some line circuits may couple things such that one peak or the other is held at ground, so the worst case the high voltage may be double the ground-referenced line peak, or 684V in your case. Whether this is considered, allowed, or made a separate catagory varies. Dirt. A perfectly clean PC board has quite high resistance and therefore would support very little leakage accross even a small gap. However, dirt is a fact of life, and accumulated dirt will significantly lower the insulation resistance, especially with high humidity. You may think that 10 MΩ/square is pretty good, but if two such traces are running next to each other for 10x their spacing, then you've got 10 squares in parallel and you're down to 1 MΩ. Again, how this is considered in a spec varies. How dirty is dirty? What are the consequences of a few 100 µA leakage? The answers differ, and thereby so do the specs.
H: Why are audio transformers required? I was looking at simple AM radio schematics and came across this one: As you can see it has an audio transformer. I'm still attempting to grasp the concept of impedance and such, so can someone explain why this is necessary? And how would such a transformer even work to change the impedance? What would be the difference if you didn't use an audio transformer? AI: This is a bit of a tricky circuit. Normally, a transformer produces a voltage ratio matching its turns ratio, a current ratio that is the inverse of its turns ratio, and therefore an impedance ratio that is the square of its turns ratio. Now in this circuit, we have a mystery box which is most likely a square wave clock oscillator. By appearance, the transformer secondary is being used to couple the audio as an A/C "ripple" on top of it's power supply, in the hopes that this will produce some AM modulation of the output. It's not entirely clear that the transformer is being correctly applied; without knowing the output impedance of what the jack is plugged into or the beyond-data-sheet properties of the oscillator, we can really only speculate if the transfer is best the way shown, turned around the other way, substituted with a 1:1, etc. Likely this is a "pragmatic" circuit as much as a "calculated optimal" one. It's possible that the use of a transformer at all may be primarily to provide isolation between the circuits. Powering through a small series resistor with a capacitor to couple in the audio could be another option, though perhaps less efficient. There are two additional problems which merit some thought before building this: 1) The oscillator probably isn't rated for a 9v supply. Most want 5v, or 3.3 or perhaps today something even lower. It's not clear that the DC resistance of the secondary will drop the supply voltage enough under this small load to be within the limits. 2) The oscillator is going to output a square wave, which is rich in harmonics. Without a low pass filter to round the square wave to a perfect sine wave, this will not only transmit at 1 MHz as intended, but also at 3, 5, 7, 9, 11, etc MHz, potentially up into places where such spurious emission produces harmful interference (for example, 7 MHz + the audio frequency would land in the morse code allocation of the 40m ham band, where trying to receive extremely weak signals is common and interference detested) . Needless to say, there are regulation about spectral purity for various transmitter power levels.
H: How to solve speed issues in a double buffered + video overlay system I've decided to start a small project over this break for creating a very simple GPU. As far as the GPU will go for now is simply receiving pixels and outputting pixels to SDRAM. In addition, there is another part of the circuit that will get pixel data from the SDRAM and output it to an LCD (I've already made the timing controller for the LCD, just need an interface to the SDRAM which makes sense). The last part somehow does a video overlay with a stream from some sort of CCD/CMOS sensor. As for the SDRAM, I've made controllers before and have enough of an understanding of VHDL to do this, so that's a non-issue. My main problem comes in with the timing. First off, the LCD runs at 9MHz so that's fine so it takes ~111ns per pixel with a 25ns setup time before the falling edge. Suppose I'm running the SDRAM at 100MHz. After a burst setup, I can get 10ns per pixel, so as long as we're in a burst, there's more than enough time to get the data. But this speed is only in a burst. If I were to load the row every single time, I would be cutting it close. This means that during the time where I actively need to read data for the LCD, I am completely held by it. No writes. The only time I can do the writes are during the columns (~480 col) ~4100ns of Hsync in each line (~280 lines) and the ~525000ns during Vsync. Suppose that worst case, my GPU needs to write to every pixel of the screen. This means that I can do ~410 pixels per Hsync, which leaves maybe a hundred or so pixels left that I need to write during the Vsync. This write data will be writing to a 2nd frame area in the memory (hence, double buffering). That timing works out, ... assuming my GPU has its own (large) pixel cache during it's waiting times and so on so forth. That's an issue I'm going to deal with later. My main issue right now is the video overlay. In addition to what's currently happening, I have my pixel data from the CCD/CMOS. After my worst case GPU usage, I have less than ~525000ns to write 480x280 (~1344400ns) which is definitely impossible by an order of a bit less than 3. Am I doing something terribly wrong? How does the computer I have in front of me right now do this? The display is SO much larger and I doubt that SDRAMS with a MUCH shorter latency exist (maybe DDR). :( AI: I see two questions here, each with it's own answer. First how to multiplex the SDRAM. My suggestion would be to grab a bunch of output pixels from the SDRAM in a burst, stuff them in a smaller external memory or FIFO (easy if your logic implementation platform is an FPGA) and then feed them to the LCD at its slower rate, during which time the GPU can use the SDRAM. When you run out of queued pixels, claim the SDRAM back from the GPU and get another bunch. Second, how to do the overlay. Quite simply, for best performance don't commit the overlay data to the SDRAM, instead, put it in it's own memory and multiplex it in front of (or transparently mixed with) the output of the SDRAM under the control of a state machine with programmable size parameters.
H: Reading From a Large Array of Photoresistors I'm an undergrad just starting to study Electrical Engineering. For the first hobby project I'm starting, I want to use a microcontroller to read analog voltage values from a very large array of photoresistors (18x24). From these values I will pinpoint the location of various light sources near the sensor array using some algorithm I haven't thought much about yet. What is the "correct" way to structure the circuit so that I can access one resistor at a time from my microcontroller. I want to select one specific resistor using some sort of parallel output from the microcontroller that is set to the resistor's address. Once the resistor is selected I want a voltage corresponding to it's resistance to be put through a common analog-to-digital converter connected to the MCU. Then, I will read and analyze the value. AI: This likely calls for an X-Y grid approach in the circuit topology as well as the physical layout, with the photoresistors connected between the rows and columns. Let's just say for sake of argument that you will drive one of the rows and read one of the columns, though the other way is fine too. First off, to read a photoresistor, you need to make a voltage divider between it and another resistor, chosen so that you get a nice range of voltage variation between light and dark conditions. Many micro-controllers have an internal analog multiplexer which lets the ADC read one of several input pins, but likely not enough, so extend the idea by buying analog multiplexors to have one input for each of the columns you need to read. At each input, connect a fixed pullup resistor to VCC, which will form the voltage divider with the selected photo-resistor. Now we need to drive a low voltage onto one of the rows at a time, while leaving the others floating. This is probably best done with a chip having open-collector (or today, open-drain) outputs, but it could also be done by putting diodes in series with normal outputs. If you had enough micro-controller pins for all the rows, you could in software make all but the drive-low pin an input (provided that it's a truly floating high impedance input, not one with a pulling resistor), but you probably don't and would be using external demultiplexor chips to fan out from a binary code to one driven output and a bunch of undriven ones. (for examaple, a couple of 3-of-8 decoders should do the job). There are both extremes and variations of this idea; the electrical grid doesn't have to have the same dimensions as the physical one. You can also substitute measuring the time to charge or discharge a capacitor in place of the ADC. (In fact, you can time a capacitor that is itself the image sensor, measuring the leakage of charge from the capacitors that form DRAM cells either in a purpose built device or an old ceramic DRAM chip with the cover pried off - though you have to keep light off the output logic as once the lid is off "ordinary" transistors celebrate by indulging their latent photo-transistor urges)
H: Interrupts with 16f887 and MPLAB need some help with interrupts and the 16f887. I'm using MPLAB and writing my code in C. I am using the 44-pin demo board from Microchip. There is a push button wired to RBO/INTO which is normally high, and pulled low when the button is pressed. I've already verified that the input and push button are working, however I dont think I'm setting up the interrupt properly. When the button is pressed, I'm try to turn PORTD on, and when the interrupt returns, PORTD is turned off. However when I run the code, PORTD turns on right away. Any ideas? #include <pic16f887.h> #include <htc.h> __CONFIG (DEBUG_ON, LVP_OFF, FCMEN_OFF, IESO_OFF, BOREN_OFF, CPD_OFF, CP_OFF, MCLRE_ON, WDTE_ON, FOSC_INTRC_NOCLKOUT, BOR4V_BOR21V); void intMain() { PORTD=0xff; INTF=0; GIE=1; } void main(void){ TRISB = 0xff; //set PORTB as inputs TRISD = 0x00; // Set PORTD as an Output ANSEL = 0x00; ANSELH = 0x00; GIE=1; INTE=1; PORTD=0x00; while(1) { PORTD=0x00; } } EDIT I've updated my code based on some suggestions below. Here is the current code. I've written it so that, when the ISR is called, port D will count from 0 to 256, then clear and exit the ISR. I've written in a trap to stop the ISR from exiting and keep it in an endless loop. When i start the controller, the port counts to 256, clears and restarts repeatedly. #include <pic16f887.h> #include <htc.h> __CONFIG (DEBUG_ON, LVP_OFF, FCMEN_OFF, IESO_OFF, BOREN_OFF, CPD_OFF, CP_OFF, MCLRE_ON, WDTE_ON, FOSC_INTRC_NOCLKOUT, BOR4V_BOR21V); void interrupt intMain() { int i,k; i=0; k=0; while(i<256) { while(k<3000) //delay k++; i++; k=0; PORTD=i; } while(1){} //trap //INTF=0; } void main(void){ TRISB = 0xff; //set PORTB as inputs TRISD = 0x00; // Set PORTD as an Output ANSEL = 0x00; ANSELH = 0x00; INTE=1; GIE=1; INTEDG=0; nRBPU=0; WPUB0=1; PORTD=0x00; while(1) { PORTD=0x00; } } AI: Try clearing INTEDG bit of OPTION_REG register. From the datasheet page 30(32): INTEDG: Interrupt Edge Select bit 1 = Interrupt on rising edge of INT pin 0 = Interrupt on falling edge of INT pin When PORTD is high, does the LED turn ON or OFF? Also check out switch contact bounce. Here is a link on it and how to debounce. To check it is the contact bounce causing the thing that is seen as a "problem", add a delay of 500msec or 1 sec after PORTD=0xff; in the interrupt routine. If the port is high, your problem is contact bounce if the above suggested solution doesn't solve your problem -that is clearing INTEDG bit. You don't need that GIE=1; in the last line of the interrupt block. I have no experience with Hi-Tech C compiler. Chances are low but try doing INTE=1; before GIE=1; in the main function. Edit Try changing void intMain() to void interrupt intMain(). According to HI-TECH C® for PIC10/12/16 User’s Guide 3.8 INTERRUPT HANDLING IN C (Page 86) Link Edit After Second Question According to the same manual mentioned above page(299): To produce an infinite loop, use for(;;). You are trying to assign an 'integer' value to a 'character' variable as I quoted below. Define variable i as unsigned char. Compiler should take care of this, but it is worth trying. ... int i,k; ... PORTD=i; ...
H: Virtual Breadboard design I am building a open source application in which digital circuits can be built on breadboard using IC, wires, LED and some off board components(clock, 7-segment etc). I have made a initial design of breadboard (through programming, not in image processor), i have some questions regarding this breadboard shown below - It is as i said in initial stages. So as you can see the area is quite small.(100% size) Is it incorrect to have only 2 bus rows? (by this i am concerned, if you as a user will be annoyed or angry without top and bottom bus) Is the spacing between various contacts appropriate? [Answered well] Is the Top View only, for IC, wires, LED etc. confusing? [Answered well] I have used Red, Blue, Green, Yellow and Black wires in my laboratory. Have you used any other contrasting color which should be used here? Any other fault with this design? Criticism is welcome. AI: 1) Physical breadboards are available with core sections and bus sections as individual dockable modules, so the arrangement you show is realizable but my personal preference would be for a pair of bus row on top and bottom as well. 2) Spacing seems to be right for the core module, should be 300 mills or 3 units between top and bottom halves. However the spacing on your bus rows is different than the physical example in front of me, which has 5 holes lining up with those in the core, then one missing, then another 5, etc. The spacing across the gap to the bus row is also 300 mill. 3) I'm not sure I'd say confusing, but the color choices and graphic thicknesses induces eye strain. Consider taking a photo and more closely duplicating that with more shades of color. Reading your question I immediately wondered if you know about http://fritzing.org/ - at the least, check it out and identify in your own mind the reasons why your open source effort should be separate from theirs. You don't have to post your conclusions, but if you decide to remain distinct thinking about how yours would be better may provide some useful guidance.
H: Conceptualizing an analog input pin on a microcontroller? As I am trying to learn basic circuit design I would like to build and simulate simple models to test my conceptual understanding. One of the first designs I am trying to tackle is to use an analog input pin on a microcontroller, but it is not clear to me how the pin itself should be modeled (and indeed thus how it behaves in a real circuit). Can I think of an analog input pin as behaving like a multimeter set to read DC voltage, with the negative lead attached to ground? And does it, like a multimeter, have some large internal resistance? AI: As a basic approximation, yes, the input is similar to a multimeter. If you want to take this further for high speed or high accuracy signals, you will find that most microcontroller ADCs use a Successive Approximation Register Architecture to read the voltage. These take some time to read the analog signal, so there needs to be a method to hold the signal on the pin. A sample and hold circuit is normally used to take a sample of the signal. This involves connecting the input to a small capacitor (pF range I believe) via an op-amp buffer. The measurement is then taken against the voltage held on this capacitor. For a higher accuracy approximation, we can look at the input as the input to a op-amp, configured as a voltage follower. This will be a very high input resistance as it will be a gate of a mosfet, with some capacitance becoming more significant at higher frequencies So as a simple approximation, a large resistance will be reasonably accurate. For a more complex model, a small gate capacitance with some series resistance from the switch, and a very small inductance from the package and wires connecting to it,
H: Can I wire the two sides of a L293D Dual H-Bridge together if I only need one H-Bridge? Background: I'm using an L293D dual H-Bridge to drive a DC motor, but only one motor, and the package contains two complete H-Bridges. This is all being soldered onto Veroboard (stripboard). Question: Is it possible to use the two sides of the chip sort of "dual wired" in parallel? Arguably to supply more current (not strictly necessary) but really so I don't have to cut as many strips on the stripboard. Here's my reasoning... Apart from Vin and 'enable', the two sides of the chip are mirror images, in other words, it seems to me that I could leave the stripboard intact across the chip for The inputs, outputs and ground pins. I would use output 1 and 4 together for one terminal of my motor, and Output 2 and 3 for the other. I'd then also have Input 1 joined to 4 and Input 2 joined to 3. (The input signals are coming from a Netduino) I was already planning on having all the GND connected, as they're also used by the chip for heat sinking. Here's a badly drawn pinout of the chip. Edit: Datasheet here: http://oomlout.com/L293/IC-L293D-DATA.pdf 2nd Edit: Having read the datasheet in reference to Olin's answer I Can't find any reference to whether they use FETs or not, (in fact the word "transistor" only appears once in reference to a possible load). I have found reference to people stacking or Piggybacking these chips on top of one another (to provide more current). If that's possible then I'm guessing wiring across should work. I will give it a try and report back. AI: Yes, you can definitely parallel the two outputs of an L293D. I made a few stepper drivers based on L293D with parallel outputs and had no problems. As this application note from ST Microelectronics (APPLICATIONS OF MONOLITHIC BRIDGE DRIVERS) states: Higher output currents can be obtained by paralleling the outputs of both bridges. For example, the outputs of an L298N can be connected in parallel to make a single 3.5 A bridge. To ensure that the current is fairly divided between the bridges they must be connected as shown in figure 2. In other words, channel one should be paralleled with channel four and channel two paralleled with channel three. Apart from this rule the connection is very straightforward - the inputs, enables, outputs and emitters are simply connected together. The outputs of an L293 or L293E can also be paralleled - in this case too, channel 1 must be paralleled with channel 4 and channel 2 with channel 3. But you should be aware that the total current capability of the parallel outputs would be less than the sum of the two channels (< 1200 mA). EDIT: The only differences between the L293/L293E and the L293D are that: the L239D has internal clamp diodes included the L293/L293E has higher output current capabilities.
H: Aluminum project box: should BNC conenctors touch it? I want to make a aluminum shield box (this is my first time!), I made some holes to host some female BNC connectors. Now my question is, should I isolate the BNC connectors from the box? Or should the outer shield of the coaxial cables touch the shield box? Update What I am trying to do is making a test fixture to measure leakage current of a diode. I found the picture below on the net: If I have 2 female BNC connectors and an aluminium box, what will the representation of that metal shield connected to the LO of both ammeter and source in the picture above in my case? does it mean bnc's should betouching shield box ?? AI: Ground them all!!! In the large majority of cases the BNC connectors should make good electrical contact with the box and the whole assembly should be at ground potential. There are specialist cases where this is not so but by the time you encounter them you will know why you may wish to do it - and will sit agonising over whether you in fact should and at which end and more. The material below relates to why sometimes you shouldn't or what happens when you do or what issues relate. BUT for a start, ground them all, and read up on the why not's for future reference. For later years: Ground loops in testing: Excellent discussion A ground loop results when two or more separate ground paths are tied together at two or more points. The result is a loop of conductor. Connecting the ground lead of an oscilloscope probe to the ground in the circuit-under-test results in a ground loop if the circuit is “grounded” to earth ground. Typically the metal chassis of both scope and device under test are connected to safety ground and internal power supply common. Scope probe ground connects to scope chassis at the input BNC connector. In the presence of a varying magnetic field, this loop becomes the secondary of a transformer which is essentially a shorted turn. The magnetic field which excites the transformer can be created by any conductor in the vicinity which is carrying AC or changing current. The potential difference seen on oscilloscope probe ground can range from microvolts to as high as hundreds of millivolts. Mysterious ground Related enough to need to be aware of. Video ground loop breakers - Expert anti-agonising devices. Ground loop isolator SP-G01 CCTV Video Ground Loop Isolator, Coaxial Cable, BNC And another Good intro discussion What is a Ground Loop A ground loop occurs when there is a potential difference between inter-connecting equipment such as the camera and DVR and is due to an imbalance in the power loading of the two systems. The potential difference cause a loop current to flow between the two inter-connecting equipment and as a result any interfering source such as 50 Hz mains power is picked up by the ground current flowing through the braiding of the coaxial cable instead of it acting as a shield to protect the interfering source from entering the coaxial cable. The 50 Hz mains power or hum is then passed on along with the wanted video signal from the camera and displayed on the monitor as a rolling hum bar
H: Maximum attainable delay with Micro controller I am designing a microcontroller based delay circuit to implement delays of 2 hours, 1 hour, 45 minutes, and 30 minutes. The circuit will automatically turn on off a relay after this time period has elapsed. I am stuck with a narrow selection of microcontrollers available locally in market: 89C51 89C52 89S51 89S52 89C2051 PIC 16C71 PIC 16F84 I have checked the datasheets of these microcontrollers but there is no information about the maximum delay they can produce. What is the maximum delay that can be produced with these microcontrollers? AI: The delay can be as long as you want. If a timer won't give you the delay you need, simply increment a register, or several registers, each time it overflows. Here is a simple program using Timer0 that illustrates the technique: #include "P16F88.INC" #define LED 0 errorlevel -302 ;suppress "not in bank 0" message #define RB0 0 #define INIT_COUNT 0 ;gives (255 - 199) * 17.36 = 972 us between interrupts cblock 0x20 tick_counter temp endc ;reset vector org 0 nop goto main ;interrupt vector org 4 banksel INTCON bcf INTCON,TMR0IF ;clear Timer0 interrupt flag movlw 0x00 ;re-initialise count movwf TMR0 decf tick_counter,f retfie main: banksel OPTION_REG movlw b'00000111' ;prescaler 1/128 movwf OPTION_REG ;giving 7.3728 Mz/128 = 57600 Hz (period = 17.36 us) banksel TMR0 movlw 0x00 ;initialise timer count value movwf TMR0 bsf INTCON,GIE ;enable global interrupt bsf INTCON,TMR0IE ;enable Timer0 interrupt banksel TRISB bcf TRISB,LED ;RB0 is LED output banksel 0 mainloop: goto mainloop bsf PORTB,LED call dly bcf PORTB,LED call dly goto mainloop dly: movlw 20 movwf tick_counter dly1: movf tick_counter,f skpz goto dly1 return end
H: Need help with 16F887 and Microchips 44-pin demo board I need some help using a PIC16F887 and the provided 44-pin demo board from Microchip. Its being programmed with a PicKit2. On this demo board, there is a push button connected to RB0 in such a way so that the level at the pin is high all the time, and pressing the button drops the level low. The purpose of the push button is to simulate an external interrupt signal. I am trying to experiment with interrupts on this chip but cannot read any status change on this pin. I have a simple piece of code which tests the status of RB0 and sets RD0 accordingly. However, nothing happens whether or not the button is pressed. Can anyone see something wrong here? I know the IC itself is fine as I can run other programs that dont use this input pin. Here is a PDF on the demo board if anyones interested. http://ww1.microchip.com/downloads/en/devicedoc/41296b.pdf #include <pic16f887.h> #include <htc.h> __CONFIG (0x20E4); __CONFIG (0x2EFF); void main(void){ int i; int k; TRISB = 0xff; //set PORTB as inputs TRISD = 0x00; // Set PORTD as an Output while(1) { RD0=RB0; } I made the following changes as per the solution by Dave below with no change. void main(void){ int i; TRISB = 0xff; //set PORTB as inputs TRISD = 0x00; // Set PORTD as an Output while(1) { i=PORTB; PORTD=i; } } AI: I've found my answer to this question. I had to set ANSEL and ANSELH to 0 to allow for digital I/O Thanks for everyone's suggestions.
H: Properly charging and discharging Lithium cells during battery testing? I'm working on some software that automates charging and discharging battery cells to generate discharge curves. I have a few concerns about properly charging and discharging of lithium-ion / lithium-polymer cells: Concerns: I understand when charging, bringing a lithium cell to maximum voltage doesn't necessarily mean it's been charged to full capacity. I've read that charging only up to 80% capacity is optimal for long storage life. Questions about Testing: Should I bring cells to full capacity or just 80%? After maximum voltage is reached during charging, what percentage should current drop to before I terminate the charge? Is discharging to cutoff voltage equivalent to a complete discharge? Note: the cells I'm using don't have protection circuitry, but the load and power supply I'm working with will enforce minimum and maximum Voltage limits. References: [1], [2], [3], [4] AI: Edited 2017 - changed recommended long life storage voltage and added comments on fast charging using some recent systems. RM. What YOU do as regards several of these questions depends largely on what YOU are trying to achieve or test. Discharge to cutoff is fully discharged (to whatever remaining % that voltage represents). That's the easy one :-) Percent dropoff of current in tail sets final % of max possible charged reached. There was a superb table given here within last week or so. Can supply later if you don't find it. Real Men™ plateau at 4.2V and tail down to 10% or even 5% of the constant current rate. This gets the battery full and knocks the stuffing out of it. Others terminate the current tail at say 25% of cc value. Optimum lifetime for ongoing usage is at about the end of the constant current phase. That makes it very easy to locate - charge at specified current until desired max voltage is reached, then charge at constant voltage as desired. Here "desired" is to stop immediately. This is the point at which batteries tend to give significantly longer whole of life mAh of storage without grossly reducing mAh capacity per cycle. This is liable to be the point where older "fast chargers" tell you they have finished. Actual % total claimed varies but probably 70% - 80% range. Newer USB input fast chargers use the term differently. In the case of USB the maximum available charge current at 5V is 5A so that the battery MAY be able to be charged at ~= 6A for the CC part of the cycle using an efficient buck converter to drop voltage and raise current. [For a buck converter: Vout x Iout = Vin x Iin x efficiency_of_conversion] Some systems such as QuaqlComms Quick Charge system allow the use of higher charger voltages (9, 12, 20) with specifically designed equipment, so battery charging can be faster for a given voltage provided that the battery specification allows this. Maximum charge rates for LiIon and LiPo batteries are usually C/1 = 1A per Ah of battery capacity. At 5V, 5A a USB charger can charge a 6000 mAh 1 cell LiPO battery at max rate - so eg a 10,000 mAh single cell battery used in some larger tablets can not be charged at the allowed 10A ! rate. For long life storage where actual stored capacity is unimportant, LiIon and LiPo cells should be stored at about 3.7V. ___________________ Using cells without protection adds to the rich tapestry of life. As long as you don't mind the occasional scorch mark on the tapestry that's fine. Note that part of the protection is a one time high capacity fuse under the cap for when things get out of control. Undervoltage discharge destroys. Charging from below a certain voltage at full rate can get fun, I'm told. Charging at reduced rate can bring cell up, I'm told. Below another second level they say don't even think about it. I've had very poor success in trying to get LiIon to misbehave. I have a box of unprotected cells that are very uncooperative about venting with lame etc. Strange. Sony and Apple and even HP seem to be much better at it :-).
H: Splicing tiny wire inside broken mouse cable I don't know a lot about electronics repairs, but I've got a relatively expensive laser mouse that got a frayed connection on the wire: I'm wanting to repair it as it's out of warranty. I've cut the cable on either side of the "stopper", isolated each of the individual wires, and stripped the ends off in preparation for splicing. Stripped http://img163.imageshack.us/img163/196/dsc2886c.jpg I've read some instructions that indicate I should do an inline wrap and then apply some solder. Is there a better way for wires this small? Is there a particular type of heat shrink wrap I should put on this after it's spliced? Or will electrical tape suffice? Inside the mouse, the cable is connected to a little plug. To me, it looks a lot like the fan plugs inside a PC. It's got 5 pins each 1mm apart. If there were a replacement plug I could buy and crimp the wires into, that'd be great! http://img171.imageshack.us/img171/5205/dsc2893d.jpg AI: I disagree with Chris in that you don't just want to shorten the cable. It's not the length of cable I'm worried about, but that tiny connector you don't want to replicate. The connector and the wires immediately coming out of it look to be intact. Replacing that will be a major pain in the butt, so I'd go to reasonable length to preserve that piece. Since that piece is now short, you'll have to make a splice. Just realize up front you're not going to make a splice in such small cable that is anything like the size of the cable. The splice will be big, fat, and ugly in comparison. It looks like it can be made to serve as the strain relief too, so that helps a little. To splice such tiny wires, see if you can sortof stick the stranded ends into each other. That may take some persuasion under a magnifying light, and then some weighty objects on your bench to hold them in place while you solder. This won't be easy, but it should be doable. If that just isn't practical, give up and bend each wire into a U and hook the two U ends together, flatten them together with a needlenose, then solder. Once you have the connections made, wrap each one individually in a small piece of electrical tape, then wrap the whole bundle in electrical tape so that is looks like one fat section of cable. Like I said, big, fat, and ugly, but it should work. All that tape will act like a strain relief, so that section shouldn't break again.
H: Very small camera or endoscope like device with minimal electromagnetic noise generation I need to be able to visually monitor movements of a recording electrode inside an electromagnetically shielded chamber. This is a cylindrical chamber of 1" X 1" and is in absolutely dark environment (I can use a light source when the camera is on). One of the concerns is introduction of noise into the recording electrode by the cameras body (acting as an arial, or by its power source or control circuit). This is why a device like and endoscope with a fiberoptic tube might be better (to put a distance and allow for shielding around the camera). My question is, is there any camera that best fits this use case? I hope question is clear. To make it a bit more clear, this is biological signal recording setup, that amplifies and filters signals in the microvolt range. AI: Didn't you answer your own question? You suggested an endoscope. They are commercial products that can have their own cameras and displays. They would not add electromagnetic interference since they use a fiber optic cable. Here is an example of one:
H: resistor equivalent for non parallel non serial What formulas do I need to calculate the resistor equivalent for not just the normal parallel and serial connection? e.g resistance from A to B og these five resistors: Is Kirchhoff's laws and hard work my only option? AI: Yes, when you're faced with a bridge (which is the common name for this topology), Kirchoff's laws, and pain, are your only choice. There is one shortcut you can try, which MAY simplify your life. Treat R1,R2 and R4,R3 as independent voltage dividers, and R5 as an open circuit, and see if the two ends of R5 would be at the same voltage. If they are, then the bridge is said to be "balanced", and no current flows in R5. If they are not at the same voltage, then the bridge is "unbalanced", and you get to start calculating loop currents and node voltages, while cursing creatively. When you see a bridge, ALWAYS calculate the conditions necessary for balance. You may get a pleasant surprise.
H: Maximum operating temperatures of different lead acid batteries What are the (generally) safe maximum operating temperatures of various lead acid batteries such as wet cells, sealed lead acid, glass mat? I'm looking for a battery that can withstand around 60 degrees C at a low discharge rate (recharge would be at room temperature). If lead acid batteries are not appropriate, what would be a better alternative? operating-temperature AI: Look long and hard at Lithium Ferro Phosphate (LiFePO4) batteries. Serveral times the cost of lead acid insom cases. Lowest whole of life cost in most cases. Much on web. From battery university : Here are a few CLAIMS. Ping batteries Shanghai -20 - +70 C Making LiFePO4 batteries since 2007. YESA batteries Hong kong. -20 - +75 Liberty elecric bikes PA, USA. -20 ~ +70
H: Why do we need 100nF cap in the output of an SMPS? I was looking at Micrel AN-53 and I have noticed that in a circuit in the first page (circuit is below), at the output of an 400KHz, 27V, 7A, 180W boost converter, there are two 680 uF, two 10 uF and one 0.1 uF capacitor. I can understand that 680uF capacitors are the bulk output capacitors and instead of 1360 uF, it is better to use 2x680 uF with the benefits of low ESR and rejection of higher frequencies than the ones rejected using 1360 uF. I may understand that 10 uF is to smooth out even higher frequencies and they have much lower ESR than electrolytics. However, I cannot understand why is 100nF capacitor is used? Load will use decoupling cap if needed. In addition to that, shouldn't the 100nF capacitor be placed very close to the supply and the ground to keep the lead inductance low? Won't the filtered signal get nasty on its way to the load? Using it in the output makes no sense but unnecessary and extra PCB area to me. So, could you please explain the function and the need of 10uF and 100nF capacitors in the output (C3, C4, C10)? AI: Second question first - 2 x 680 uF often will have a better ripple current rating than a single larger cap - sometimes very significantly so. 2 x 680 uF also may be lower height or easier to fit in board space - MAY have more area but be less obstructive than a single larger cap. Also, as you say, ESR may be better, but often a single large cap is as good. The 0.1 uF capacitor is intended to remove very high frequency components better than the larger capacitors do. The small capacitor will usually have have low ESR, low lead and internal inductance, a higher self resonant frequency and a lower overall impedance at higher frequencies. At least, that's the plan. Reputable manufacturers may publish tables showing impedance with frequency and from these an excessively keen [tm] designer can provide a filtering combination that produces a best overall result. It was traditional to consider a 0.1uF cap as the standard HF filter cap, but there have been two schools of thought to that in recent times. One argument is that increasing frequencies of both SMPS and processors and target ICs make smaller caps better suited to the typical frequencies. The other holds that the new ceramic caps are far superior to those of, eg, a decade ago and that a 1uF or even a 10 uF ceramic will do a fine job at relevant frequencies. Both arguments have merit. If you use a 0.1 uF modern ceramic instead of going to a 1 uF then you arguably get the benefit of both arguments :-). (ie it's bigger than you might have used and smaller than you might have used). I do not see at a quick read anything that says where that capacitor is physically located. While the caps are shown sequentially on the diagram, that is only an electrical diagram and actual layout is not strongly suggested by it. General component placement will often have some resemblance to circuit diagram flow, but nothing is necessarily fixed. In this case the 0.1uF can be physically near the cathode of D1 and the ground side of R2, R14, R16 and that is where I would try to locate it. Cypress excellent - Using decoupling caps How to select bypass caps Goodish Tends to suggest that bigger is better mostly :-) : From this excellent guide - A practical guide to high speed PCB layout Useful and related but not 100% on topic here Useful Related - caps and ESR Wikipedia
H: What's the automatic equivalent of a variable resistor? I have a circuit which controls the volume on a speaker by a wheel which is attached to a variable resistor - I want to reproduce this but instead of using a manually operated variable resistor, I want to use ...something else instead - Ideally something where you can apply a voltage to change the resistance from low to high. I've done a little research but I think I'm being stumped by not knowing what I'm actually looking for. AI: You can use a transistor to do this. Although less common that the other types, a JFET works much like a voltage controlled variable resistance. You'd have to apply an analog voltage to the gate to get a specific resistance. You'd have to be careful about the range of this voltage. The Drain and Source would act as the effective two terminal resistor. Even a mosfet has a linear resistive region so this is not your only option. There are many other options as well which I'm sure will be mentioned.
H: generic term for inductors/capacitors/transformers for power-handling applications Can anyone think of a generic term to cover capacitors and magnetics for power-handling applications? (is there one?) I want to distinguish from power semiconductors and signal-level capacitors/magnetics. AI: I don't think there is a standard term to differentiate components used for power handling as apposed to signal handling. Sometimes you hear the term "power magnetics", but I've never heard anything like "power capacitors". There are certainly "power transistors" versus "small signal" or "switching" transistors. Even if you find a term, it would be dangerous to use without definition anyway. In general, it's good to be clear and explicit without relying on specialized terms unless you are really sure they will be understood as intended. Just say what you mean.
H: Best size of heat shrink tubing? I'm attempting to shrink wrap wire connections for the first time and I am wondering what size of heat shrink is needed for i.e. a single 22 AWG wire. Could it be any heat shrink tubing that fits the wire? Or is there a certain size that it shrinks to so that I must purchase one not too large? Thanks! AI: I have some typical 22 AWG wire here and 1/16", 3/32" and 1/8" diameter heat shrink tubing that has a 2:1 shrink ratio. In the not shrunk state each fits over the wire. In the shrunk state the 1/16" and 3/32" grip the wire firmly, but, the 1/8" is just slightly larger in diameter and slips. Don't forget that you may want a fatter solder join or two wires to be under the shrink wrap. For that reason my recommendation is to buy all three sizes. The stuff is not that expensive and it is good to have a good selection around. You can buy a kit that contains several diameters like this for under $20: I got mine for $7 when it was on sale.
H: Accepting a Range of Input Voltage that Straddles Operating Voltage I want to design a system that runs at 5V and about 350mA. I want that system to accept an input voltage between 1.8V and 15V. How can I achieve that goal with a minimum component cost in my input power circuit? Is there a single "regulator / boost converter" out there that will boost a 1.8V input voltage up to 5V and step a 15V input voltage down to 5V? Or is the only way to achieve this to have separate input ports and sub-circuits for the "high" input voltages and "low" input voltages, with a Schottky diode union delivering the operating voltage as shown below in my (admittedly simplified) schematic? If I wanted to allow for both "high" and "low" voltage inputs to be present at the same time (say if I wanted the "low" to be a battery backup, and the "high" to be a DC wall power jack), and there were a part that could accomodate the range of input I described, I might instead do something like the following: AI: (1) "Perfect" solution: The LT1945 seems to do what you want. Found using leads from others. See (2) below. Whether this comes close to "minimum component cost is TBD. (2) or Use a boost converter IC: A design using almost any boost regulator IC which has Vin_min <= 1.8V will probably cost less - see (1) below. (3) or Use a Classic BB converter - IF polarity inversion is acceptable. A boost buck converter can be made very simply an cheaply using a special case of a boost converter, provided that an inverted polarity output is acceptable. In a "normal boost converter an inductor has one lead connected to V+ and the other end is alternatively connected to and dsiconnected from supply On disconnection the free end will "flip" positive to above supply. In the boost conveterter variant an inductor is connected to ground and the free ens has sitched V+ applied. On switch off the free end will "flip" to below ground and a negative voltage of any negative voltage (within sensible limits) can be obtained.This is what was invariably meant by a "bbost buck converter " into the 1970's. Classic buck boost converter: From this better than some EDN article tracing the changes in BB converter toplogies. (1) A SEPIC converter can act as a boost-buck converter, and almost any IC intended as a boost regulator and that uses an external switch (eg MOSFET) will be able to be used in SEPIC topology with as high a Vin as you wish. Vin minimum is set by the IC you use and Vin max is set by the voltage rating of the MOSFET used as the main switch. While the "proper" control of a SEPIC is complex for mathematical reasons [4 poles plus 3 right half plane zeros that wander around based on parasitic resistance values, should you wish to peek inside Pandora's box ...] the practicality is that many people seem to get extremely good results with no apparent problems. This paper explains why and how a SEPIC is a nasty badly behaved brute that you should never take out with you in public. whereas This TI application note explains how to design them and does not note any great problems in doing so. This largely seems to be what people find. Typical SEPIC converter circuit below. Cs provide DC blocking allowing Vout to be lower or higher than Vin. The switch see Vin but if the IC Vdd_max is less than Vinmax a voltage reducing startup arrangement can be provided (2) LT1945: LT1945 data sheet This is a dual switching regulator IC capable of boost and SEPIC operation in each section (and more). (Almost any boost converer IC is capable of SEPIC operation but SEPIC has some nasty inherent stability problems which some IC's may not handle well. This is not the cheapest SMPS IC - $4.25/1 dropping to about $2.12/100 Digikey in stock pricing BUT you do get two smps regulators with some VERY nice features. 42 mV voltage feedback sense - low loss when using as a constant current source when eg LED driving. About15 uA quiesec=ent operating per smps. Below shows a tyical use (fro the data sheet). While CUK is not mentioned anywhere in the data sheet theleft hand regualator is CUK topology and the right hand one is a standard boost converter. The CUK can just as easily be a SEPIC .(~~~ swap L and output diode. Many web examples).
H: Creating 1 hour delay with 89C51 micro controller I am writing an Assembly Program function for 89C51 which can create one hour delay. I can't use any other micro controller as only 89c51/52 is available locally. So I am stuck here because even when I set R5 to #255 the maximum delay I can create this way is only 2 minutes. As my knowledge is somehow weak in Assembly C I think there may be an easier way to do this. Please help me how I can I do this with Assembly C. Here is my code with timer: DELAY: MOV R5,#24 AGAIN: MOV TMOD,#01 MOV TL0,#0 MOV TH0,#0 SETB TR0 JNB TF0,$ CLR TR0 CLR TF0 DJNZ R5,AGAIN RET Code for doing it without timers with loops: DELAY2: MOV R5,#12 L4:MOV R6,#255 L3:MOV R7,#255 DJNZ R7,$ DJNZ R6,L3 DJNZ R5,L4 Please Help! AI: What's the problem you are having? Did you write this code or have you copied it from somewhere else and are trying to make it work? Considering the code below. Does it work when you run it? (This should be identical to your code.) The answer was: yes it works but it creates a much lesser delay. I want to create one hour delay. ... I need some help/hints to modify the function so that it can generate one hour delay. Let's see if that makes sense. The inner loop decrements R7 - always set to 255 on entry. This is called 255 times by the R6 loop This is called 255 times by the R5 loop L2 loop R7 is 255 decrements L3 is 255 x (decrement, jump) L4 is 255 x (decrement, jump) Even treated simplistically as if each loop was a single instruction. Operations = 255 x 255 x 255 = 16,581,385 ~= 16 million instructions. As this produces a 2 minute delay there would be 8 million instructions/minute As we actually have a jump and a decrement in most cases we'd expect 2 or 3 cycles or intstructions. So maybe 24 million instructions per minute depending on the instruction. That's only about300,000 insructions per second. That sounds horrendously slow - but see below. So, the is not able to create a delay which is nit long enough. If you added another loop outside the existing one you'd expect about 255 x 2 minutes = 510 minutes = 8.5 hours. So - add one more loop. Fine tune delays to suit.
H: Voltage across a surge protector plug Firstly, this applies to the UK - so 3 pronged sockets and 240V. Short and sweet question - should there be any voltage difference between the live and neutral prongs on a surge protector once it has been unplugged? AI: Transmogrifying your "should there be any voltage?" into "will there be any voltage?" the answer is "There might be, it all depends on circumstances and equipment involved". I don't know if "a surge protector" tends to be a reasonably specific device in the UK but here in the antipodes at the dawn of time it could mean a wide range of things. BUT IF a surge protector consists of a device which conducts when line to line voltage exceeds normal max by a significant margin - such as back to back zeners, a MOV, a transzorb, a gas discharge tube, a neon or similar. but which is of very high resistance when no voltage is applied and IF the surge protector contained X and/or Y capacitors (line to line or line to ground) then YES voltage would be very likely to be present, because the capacitor(s) would probably retain some charge if the mains was disconnected with the load switched off. If mains is disconnected by opening a switch or pulling out a plug, then line to line voltage and this capacitor voltage could be anything from about +330 to about -330 V as the disconnection timing is not synchronised with mains zero crossing. A capacitor connected across the line or leg to ground capacitors will be left with the mains value at the time of disconnection. If there is no load present this voltage could remain "for some while".
H: Disabling digital input buffers on output only pins (PIC18) Not really a problem, just curious. I'm using a PIC18LF13K22 and the datasheet mentions that I can disable the digital input buffer for a pin by setting its corresponding bit in the ANSEL register. Since I'm using some pins as digital outputs only, would I gain anything (less power usage?) by disabling their digital input buffers? AI: No, don't disable the digital inputs when using the pin in digital mode. The digital input circuit doesn't really consume power as long as the pin voltage is solidly high or solidly low. You don't save anything by turning it off, and it might cause trouble. All pins that can be analog inputs wake up that way because it is most tolerant of the external circuit. If a pin is held near the middle of its voltage range, then the digital input circuit in the PIC could draw unnecessary power and possibly even oscillate. So the PIC starts out in the most tolerant mode and the firmware then switches specific pins to other modes as only it knows how the micro is being used.
H: Converting Power/Watts in DC to Power/Watts in AC? How can we convert Watts in DC to Watts in AC? for e.g A device needs 1A and 12V DC input i.e (1A x 12V = 12 Watts) 12 Watts DC. If we use an AC to DC adapter/converter to generate 1A,12V (12Watts) DC then What will be the AC Power/Watts that we have to input into the device's adapter/converter? AI: Summary: Watts out DC = 75% to 90% of AC Watts in, in most cases. See below: At 100% efficiency ADC Watts out = AC Watts in. Energy is 'conserved" and energy = Watts x time. eg we often measure energy in Watt.seconds = Watts x seconds operated = Joules. The efficiency of conversion depends on the technology. Power level and voltage also give an effect. Using a conventional iron transformer the AC mains to AV low voltage conversion probably is > 95% efficient. Rectification efficiency depends on voltage and diodes used. As a silicon diode drops 0.6V or more, a single diode can account for (0.6V/(5+0.6)V) ~= 11% efficiency loss. If a bridge rectifier is used there are two diodes in the circuit and this can account for over 20% efficiency loss. If a switching power supply is used the overall efficiency is liable to be in the 75% to 90% range. More than 90% efficiency is possible with special care. So Watts out DC = 75% to 90% of AC Watts in in most cases. Q: "you mean that for 90W or 75W DC out we will need 100W AC input?" A: Rearrange these equations: DC_Watts = 75% AC_Watts so AC_Watts = ..... DC_Watts = 95% AC_Watts so AC_Watts = ..... i.e. Watts_Out = Watts_in x Efficiency ( 0 <= Efficiency <= 1.0) Then Watts_in = Watts_Out / Efficiency. ( 0 <= Efficiency <= 1.0)
H: Values of inductance - what is the "base" value? I have a selection of salvaged inductors, and I don't (yet) have an inductance meter. I would like to know what the inductances are, but I have a problem. They are numbered with 3 digit numbers - I assume this is in the same format as capacitors and resistors - 2 digits and a number of 0's. However, what is the "base" value of the inductance? e.g., I have a "221" inductor: Is this going to be 220pH, 220µH or 220mH? Where do they start counting from? With resistors it's easy enough - it's from 0. With capacitors it starts with pF. What do inductors with this kind of numbering system start from? AI: That looks like a 220 µH inductor. These size inductors (like a lot of electronic parts) are labeled with something a lot like a floating point format in a computer. The first N-1 digits are the mantissa and the last digit is the exponent of 10 to apply to the integer mantissa value. In this case, the mantissa is 22 and the exponent 1. The value is therefore 22 x 10^1 = 220. The fact that the units are µH is obvious from the general size and windings. Some very small inductors are labeled like this in nH, but this one is obviously a lot bigger than 220 nH.
H: Calculate the value of an inductor using an RL or LC circuit Given an inductor of an unknown (though magnitude-estimatable) value, and a resistor of precisely known resistance, how can one calculate the inductance of the inductor? Tools I have at my disposal: Oscilloscope (both digital and analogue) Signal generator (can make any waveform up to around 20KHz) DMM Some things I have noticed during my experimentations: If I apply a sine wave I see a phase shift. If I vary the frequency I see different levels of attenuation. If I apply a square wave I see sharp peaks at the rising edge and sharp troughs at the falling edge. Ultimately I'd like something I can sample in some way with a microcontroller - be that with analogue inputs, the use of timers / input capture / output compare, etc, or whatever other means, to then calculate the inductance in use. I know how to do phase measurement of digital signals, but can this be adapted to measuring the phase of a sine wave? Alternatively, could I use an LC circuit and use the resonant frequency of that combination in some way? AI: We've actually thought about how to do this from a microcontroller to make a cheap L/C/R meter. It needs to be cheap and small because we plan to make a business card that has a useful circuit on it. Anyway, the answer is probably different from doing this manually with a signal generator and scope or automatically with a microcontroller. Manually, you can set up a L-R low pass filter. That means input signal to one side of L, R to ground and output other side of L. By feeding in a square wave and looking at the result on a scope you can measure the exponential time constant. The time constant is T = L/R. When L is in Henrys, R in Ohms, then T is in seconds. This will be the time a step gets to 1 - 1/e of its final value, or about 63%. It may be easier to measure the 1/2 decay time, which occurs in .693 time constants. From that you can find the time constant, and from the equation above the inductance by knowing the resistance. The automated way we will probably use is to measure the magnitude of a known AC signal fed thru the same filter. Higher frequencies will be attenuated more. If you feed in a square wave instead of a single pure frequency (sine wave), then you'll have to do a little more math. But the inductance can be calculated if you know exactly what you stuck in, the value of the resistance, and the magnitude of the outcoming AC signal.
H: mute de-amplify sound volume I want to de-amplify the sound volume of my television. My native language is not english, and I do not know the correct word, if any, for the opposite of amplify. When my TV is turned from volume zero to volume one, the heard sound jumps to something that is too loud. TV volumen scale : 0, 1, 2, 3, 4, 5,...,49,50,51,52,...100 Corresponding subjective scale: 0,11,12,13,14,15,...,59,60,60,60,...60 What I would really like is a sound volume on this subjective scale from e.g. 3 to 20. So I would like to decrease the volume by a factor of app. three. Can it be done by connecting a suitable resistor in series or in parallel with the internal speakers? AI: Absolutely. Your internal speakers will have some nominal impedance, perhaps 8 ohms (you would need to do some research to know for sure). If you were to hook an 8 ohm resistor in parallel (across) the speaker, then half of the "volume" (power actually) would come out the speaker and the other half would simply be wasted as heat in the resistor. Assuming the same 8ohm speaker, if the resistor were greater than 10 ohms, then less power would go to the resistor and the volume you hear would be louder. As a practical matter you could try a few different resistors to see what works best for you. One thing to be aware of is that you need to use a resistor with an adequate power rating, perhaps 5 watts. While it would be possible to compute the value of an "ideal" resistor, the mathematics is not as simple as you may think due to the way the human ear perceives sound. The perceived volume is not a linear relationship but rather a logarithmic function measured on the decibel scale.
H: EtherCAT topology and timing constraint question I'm trying to understand how EtherCAT works. The Wikipedia page says that data is processed as the packet passes through the device. Does this mean devices must be linked in a string formation? What if processing of a packet where to take longer than the time the packet takes to pass through the device -- what does it do then? AI: EtherCAT networks can have different topologies: line, tree, or star. During start-up, the network topology is determined so that devices know which ports to pass the data through. For synchronous operations, the master device initiates sending the packet frame through the network. The slave devices read or write to the bits that they have been allocated. The bit locations are pre-determined during network configuration. This is done "on-the-fly" as the frame is passed along to the next device. The amount of processing performed by the slave device when passing the packet through is minimal. Often just reading/writing bits to/from a buffer or register. More complex "processing" is handled across multiple cycles. For example, a servo drive that is configured to take a position command may take many seconds to control cycles to complete the trajectory. The drive will report its "not-done" status in each EtherCAT packet until it has reached the target position. Review the references on the Wikipedia page for more details.
H: Frustrated With D flip flop assignment We are doing a project at school with AOI, NAND and NOR logic. The logic is used sequentially to display a number on an LED display, more specifically it is suppose to display the numbers of your birthday in this order: MM-DD-YY. The output of the LED display is determined by 3 switches that are used as inputs. I labeled my inputs X Y and Z. When you turn the switches on and off to represent counting in binary, it displays your birthday. Now, my teacher said that anyone who can display the numbers using a counter or flip flops would get extra credit (much needed). The problem is, is that I cannot figure out how to get my Positive-Edge-Triggered D flip flop to work properly. I am unfamiliar with flip flops and i have been trying to research them on the internet with no luck. Every page i read i get lost and frustrated. How can i use Positive Edge triggered flip flops to count in binary to 7? All relevant answers are appreciated! AI: If you are interested in creating a mod 8 counter you should start with a state diagram and work your way through to an excitation table. As JustJeff mentioned the characteristic equation for a DFF is: D = Q+. You will need to use 3 D flip flops because you have 8 possible states. Keep it organized and start with a diagram! After you create a diagram you can create a state table. After you create a state table you can create a transition table. Finally you can construct your excitation table and equations based off of your Flip Flop equation (D = Q+) and the transition table Q --> Q+. From there you can get the proper IC's or program the equations directly in VHDL or Verilog.
H: How to supply a negative voltage from a simple battery or psu? I am using an op amp (741). I need to supply its pin 4 with -5 volts using a power supply unit from a computer or from a simple battery. How am I going to do that? AI: The best thing to do with an LM741 in most cases is to replace it with a more modern single supply opamp. An LM358 dual or LM324 quad is about as good, usually cheap and available. (The LM324 is now a very ancient single supply opamp BUT it still works well in roles where its limitations are acceptable. It is a good fit for many DIY/hobby applications and still has a place in commercial applications due to its extremely low price in quantity. (eg 2.51 US cents each from this Chinese supplier (as at early 2023).) As of 2011: This page from a project by someone at the CIT in CEBU suggests 100 PHP each which is far too dear. Digikey has them for about 20 PHP in 1's prices here and about 13 PHP each in 25's - and you get 4 amplifiers per package. Datasheet here for LM324. Single supply from as little as 3V (5V 0r more is a lot better). BUT If you want to use an LM741 you can use a negative voltage that is greater (more negative) than -5V without affecting the results in almost all cases. To use a battery to create a negative supply: Obtain a 9V transistor battery or a 4 or more cell AA alkaline battery pack or other source of 5V or more. (Or a mains "plugpack" power supply of 5V or more.) Connect the +ve terminal of the supply or battery to ground and the -ve terminal will be at -V. eg a 9V battery will give -9V etc.
H: Chaining up two solar panels of different wattage? I have a 30 watt solar panel and I'm looking to add a 80 watt solar panel to help power an 85AH battery. I know I need to connect them in parallel (positive to positive, negative to negative) but I wonder if the difference between the wattage of the two panels would cause a problem? AI: If you have blocking diodes in each panel you will do no harm to the panels by paralleling them. I assume that the panels are both of the same nominal voltage - ie made for use with the battery voltage you are using. If a 12 V battery they are probably 36 x PV cell panels with a nominal voltage of about 18v. This allows them to be loaded to about 80% of their rated no or low load voltage and still do all the things that a lead aci battery may need done to it. IF they have the same Maximum Power point voltage (Vmpp) then they will parallel up well. If Vmpp of one panel is lower than that of the other the low Vmpp panel will take most of the load until the load exceeds the panel capacity and then the other one will join in. No harm will be done but loading is not even. This imbalance occurs because the low Vmpp panel will produce a greater percentage of its output at a given voltage. If you REALLY want balance (and there is no real reason to have it) then place a resistor of value about R = 0.5/Imax in series with each panel where Imax is the maximum rated current of the panel concerned. These resistors will drop (by design) half a volt at full power which should be enough to help them track each other. Power rating of resistors = > 0.5 x Imax. Example. 85 Watt panel at 12v probably has Imax ~~ 85/15 = 5.7 A. 30 Watt panel Imax probably ~~ 30/15 = 2A. *Iuse 15V as a guess at likely Vmpp Resistor for 85 Watt panel = V/I = 0.5/5.7A = 0.18 ohms. This resistor is so low that just including extra wiring length in the high wattage panel may be enough. Power dissipation = Vr x Ir = 0.5 x 5.7 = 2.9 Watts. A 5 Watt resistor would notionally suffice.
H: ATX power supply max current 12V P8 connector I'm using a ATX power supply as a unit for my project. The power supply is of the type "be-quiet" straight-power E8 480W with cable management. I cannot figure out how much current can I get from the 12V P8 connector, which has 4 12V poles and 4 ground poles. My need is 20A in total for the 4 couple. I read that this kind of ATX power supply has 4 12V rails, each one can give up to 18A. How are these rails physically placed and distributed among the different connectors? AI: According to the EPS12V standard section 6.1.2 Processor Power Connector, the requirement is that the connector uses two different power rails (12 V1 for pins 5 and 6 and 12 V2 for pins 7 and 8) if the 240 VA limiting is in place. So if nothing else is connected to those two power rails, you should b able to pull 20 A through the connector if it's divided correctly among the two "rails".
H: How does this Digital-to-Analog converter work? This question: RoboCup Junior IR Ball detection has a link that includes the attached circuit for D-A conversion. I understand that the output of the sensor contains several amplitudes, and that the "summation" of the signals is being stored as a charge in the capacitor. Is this correct? Why is the function of the resistor? Is it the low pass filter, and if so what does that do? AI: Rushing ... This seems to be how it works from inspection. Some fine detail may vary. The transmitter sends a series of pulses as shown below - amplitude varies in 4 steps. The signal modulates an IR LED such that the amplitude structure is maintained. ie looking at the signal with a linear photo detector at close range would show this signal. Simple on/off COTS IR receiver ICs are used "such as TSOP1138 (Vishay) – 1,52Eur from Farnell or GP1UX511QS (Sharp) – 1,09Eur from Farnel" ( quoting table 8 from here ). The signal is reflected off a target and returned to the receiver. As seen below I have modified the original diagram to make the pulses heights taller. The receiver has finite sensitivity and is either on or off. At close range (as in 1. below) every received reflected pulse triggers the receiver.The receiver detection threshold is below the height of th eloe=west oulses so every pulse is "seen". The RC filter turns the series of pulses into longer pulses. Note on the diagram tha the large fultered pulses are displaced slightly to the right wrt the input pulses due to the time dely in the RC filter. At greater range the inverse quare law of signal strength with distnce means that returned amplitude will be lwer. - as shown in 2. below only the largest amplitude ulses are high enough tp trigger the receiver. The pulses repeat at the frame rate. The width of the "on" pulse will decrease with increasing distance,
H: Stripboard layout for a 16x16 dot matrix display I've been planning a Veroboard/stripboard layout for four dot matrix LED displays. Most of the complexity is due to the daft way companies break out the pins on the 8x8 modules. This is what I have so far: The fat lines are wires, and the striped orange bits represent stripboard. The colored dots are the pins of the 8x8 dot matrix displays. I only intend to use the red dots, not the green ones I've got a couple of questions concerning this layout: How can I physically connect the strips of perpendicular stripboard at the top and bottom (which will have male headers attached) to the main board? Hot glue? Overlap the boards and "sew" them with wire? Is this really an achievable thing to do? Should I be looking into PCBs? EDIT: Looking into PCBs. Board design: AI: To answer your first question, either glue/wire or both should work fine. As will anything you can come up with that's suitably electrically/mechanically sound. To answer the second question: Yes it's achievable with stripboard - folk have built entire discrete logic based processors and other similarly complex circuits using stripboard. That said, anything past a rough prototype is better done with a proper professionally made PCB. If it's a personal (i.e. one off non commercial) project then you could maybe etch your own. There are plenty of cheap prototyping services available nowadays that offer far better results that you can get at home. We just tried out the Seeed Studio service (10 boards for $10, sounded a bit too good to be true) and the results were excellent. The "catch" is the $10 is only for the smallest (5cm x 5cm IIRC) boards but even for the larger ones it's cheaper than any place I have seen so far (e.g. 10cm x 10cm is only an extra $15) In the end which route you choose it depends very much on the project's end requirements, but the stripboard will certainly work okay for something like this.
H: Measuring a soundcard output voltage I have been experimenting with a Soundcard Oscilloscope and I am having some problems understanding what's going on! I have attached a screenshot of my digital scope setup. My hardware setup is simple. I have a male to male TRS jack running from my line out into my mic input. I have been experimenting with a simple sine wave. When I measure the output voltage of my line out (Stereo plug - TRS) with a voltmeter I get a reading of 26mV for the right channel and 12mV for the left channel (Left and Right speakers not the left and right scope channels). However, the scope is reporting an effective voltage of 508mV rms for the left channel and the right channel (not in the screen shot) is saturated at 783mV rms. Why do the 26mV and 12mV readings remain constant on the line out when I adjust the signal from my sine wave amplitude or change the volume and balance control of my PC soundcard? The voltmeter reading never changes. The voltage changes on the scope, but not on the voltmeter. What am I missing? My second question has to do with the soundcard max voltage readings I am getting. When I boost the frequency or amplitude of the wave it saturates at 2 volts. I am guessing +2 and -2 is the max input/output of my soundcard? The research I have done would agree with this conclusion but I would appreciate some input! If this is the case why can't I get a 2 volt reading on the voltmeter instead of this micro volt jitter? Thanks for your time! AI: Firstly, as mentioned the multimeter in DC mode will only give you the DC level of the signal, which if it's swinging around 0V will be 0V (or close enough) You would need a half decent meter with a low range AC mode to get a reasonable reading. Secondly the sound card oscilloscope software will almost certainly need to be calibrated. All it receives from the card is a value ranging between 0 and its full scale, e.g. in a 16-bit card this would be from 0 to 65,536. It does not know how these values translate into voltage without calibration (the software may have a default setting based on usual sound card ranges, e.g. +/- 2V or whatever, which may be what you are seeing now, and may or may not be so accurate) For example if your sound card range is +/- 1V then 65,536 would equate to +1V. If the software is set to a default of +/- 2V for full range then it will see a value of 65,536 as 2V, when in face the actual signal level would be 1V. The fact you have your line out feeding mic in may cause the default calibration and reported levels to be a fair bit off, as line level out is a fair bit higher than what a mic input will expect. If the software is any good it should have a calibration setting which you can use to set things up correctly. This will probably involve feeding a signal of a known level into the card and telling the software what the level is, then it can work the rest out. Since most soundcards have a DC blocking capacitor you will need an AC signal for this.
H: A few questions regarding B/E-fields in practical circuitry I have been trying a few learning resources to help unlearn some of the notions that electrons flow through as energy. Chiefly this resource is what I have used: Amasci - IN A SIMPLE CIRCUIT, WHERE DOES THE ENERGY FLOW? My questions are: Does energy transfer from the battery through the load through B-fields, i.e. "electromagnetic current" and not really through any other means? Is "Electricity" simply heavily concentrated electromagnetic fields when flowing through a conductor? For example, an arc between two high voltage electrodes is the electromagnetic energy jumping the gap, the heat and light of the arc are just by-products of this? The resource shows an E-field existing between the circuit path: efields What if the path were something like a wire surrounded by a magnetic insulator, would the e-field be pointless, or not "care" that anything is blocking it just existing on either side to create a difference in potential? Would there be less energy available? I am greatly interested in how energy is transferred through the wire, at least correctly. (addition) Does the insulation of wiring (i.e. plastic) also help in reflecting some of the energy so that it does not drop over a distance? This could sense, being that an exposed wire may pick up energy in the air, and an insulated keep it out. AI: Does energy transfer from the battery through the load through B-fields, i.e. "electromagnetic current" and not really through any other means? The vast majority of energy transfer is from the electromagnetic fields (E & B-Fields which are coupled). There might be some fringe situations where ion or electron (-e) transfer contribute to total energy transfer, but I can't think of any off the top of my head. That's the primary point of the page you've linked, and the POYNTING diagram in figure 7 should show you the energy transfer (that's what they do). Notice that it shows all arrows pointing to the load and away from the source. Is "Electricity" simply heavily concentrated electromagnetic fields when flowing through a conductor? For example, an arc between two high voltage electrodes is the electromagnetic energy jumping the gap, the heat and light of the arc are just by-products of this? Well, this question isn't well phrased, so I'm going to assume that you are asking what is the principal method of energy transfer, which is the same as your first question. Directly speaking, electricity is the flow of charged particles. The other point to make here is that the electromagnetic fields flow AROUND a conductor, not through it. Someone might nitpick about this, but it's essentially true. As to the arc, it is caused by the electromagnetic fields exciting atoms of air to the point where you see a reaction. This is akin to asking, "What is fire? Is it just a byproduct of Oxygen combining with Carbon?". Yes, it is, but what you see is an excitation of gas molecules around that combustion. What if the path were something like a wire surrounded by a magnetic insulator, would the e-field be pointless, or not "care" that anything is blocking it just existing on either side to create a difference in potential? Would there be less energy available? I am greatly interested in how energy is transferred through the wire, at least correctly. Here you need to understand that E and B fields are COUPLED. So, no, the E-Field wouldn't not (double negative, sorry) "care", it would be affected and so would the flow of electrons in response. What you've mentioned here would actually be a passive inductive element in the circuit! Look up the theory around inductors and you'll get a good idea of what's happening here. Does the insulation of wiring (i.e. plastic) also help in reflecting some of the energy so that it does not drop over a distance? This could sense, being that an exposed wire may pick up energy in the air, and an insulated keep it out. I'm not exactly sure how to respond to that one. The real job of the insulation is to keep the circuit in isolation from the environment, so your second sentence makes some sense, but reflecting energy isn't the appropriate way to think of what it is accomplishing.
H: Should I ground my case I built up a LM317 power supply which is working great. I have moved it into a large case as I am now powering it off 240VAC (fused) down to 18VAC then rectified into the power supply. Which is going well. I also put a much bigger heat sink on it (1.4C/W). The plan is to set up another one in there as well and have dual variable supplies. Now the question is should I connected the ground pin off the 240V connect to the case? The case is a 19" rack mount. It is aluminium? I am pretty sure that is what most people do but thought I would ask. It would stop the case from becoming live if something shorted to the case would it not? AI: I think a good starting answer is (1) - It would stop the case from becoming live if something shorted to the case would it not? :-) (2) BUT, not only stop it becoming live, but also provide the intended means of operating the provided protection equipment if a phase to case fault occurred. aka "blowing the fuse" or "tripping the breaker" as the case may be. The operation of fuse or breaker in the case of a fault is probably more important than keeping the case from reaching mains voltage at all. Both achieve much the same result in terms of case potential above ground BUT breaker/fuse tripping both tells you there is something wrong and removes a potentially lethal problem which may otherwise manifest in some different manner. (3) Along the way it may stop nuisance shocks which occur from current through any X and Y caps that may be fitted (probably none in your power supply). Also ground referencing your supply stops the whole assembly wandering off to a semi-random voltage of it's choice relative to ground that has nothing to do with the power supply proper. eg in some cases an ungrounded case may be driven by electrostatic charge from the effect of carpet on clothes etc and gain a voltage of thousands of volts (very literally) relative to ground. Touc it when grounded and you may feel a small or not so small kick as the stored energy "discharges". What feels small to you may be the last thing that your circuitry ever "feels".
H: Explanation : Latching Relay Circuit I need to understand the flow of this circuit well. The objective of this circuit is to switch the latching relay "OFF" or "ON" (in two states) depending on the state of the I/O's of the MCU. I need to understand how this works. The relay is a 9VDC, 60A, 250VAC relay, and the bridge gives an output of 12Vdc. Thanks! AI: This looks very similar to a half bridge. When both the IOs are at the same level, both the left and right circuits are providing the same potential to the relay. When one of the IOs changes, the potential provided at that side of the relay changes. The difference in these two potentials is what switches the latching relay. It's just like driving a motor in forward/reverse. Let's take a closer look at the right-hand side of the circuit. When the IO pin is low, what is happening? Well, Q4 and Q6 both have their bases pulled low. This switches them off. In doing so the pull-up resistor R2 pulls up the base of Q3, switching it on. Thus, the power from the +12V rail is allowed to flow to the relay. If the IO is set to high, what then? Well, Q4 and Q6 are both switched on. This connects their collectors to ground. Q4 links the relay to ground, and Q6 links the base of Q3 to ground, switching it off. This isolates the +12V from the relay so you don't get a nasty short. so that side of the relay is now at ground potential. Combine that with the same thing happening to the left side of the relay, and you can see how different combinations of IO can give different potentials at the relay terminals. A | B || L | R | Vdiff ====================== 0 | 0 || + | + | 0v Nothing happens 0 | 1 || + | G | +12V Relay switches to one position 1 | 0 || G | + | -12V Relay switches to other position 1 | 1 || G | G | 0v Nothing happens
H: Relay datasheet question In the datasheet, they wrote: Rated frequency of operation with / without load 6 / 1200 min-1 What's the signification of this line ? When they talk about Mechanical endurance cycle, is it open to close or open to close to open AI: They say Max. switching rate at rated- / minimum load - 6 min-1 / 1200 min -1 First establish what "rated load" and "minimum load" mean (1) What does "rated load" mean ? There are 12A and 16A versions. Considering 12A version. Max rated switching current is 12 A Switchable voltage = 250 VAC or 440 VAC . Max switched VA = 3000 SO at 250 VAC max switched i = 3000/250 = 12A as expected. But at 440 VAC max amps = 3000/440 = 6.8A ie it can be used at 12A at 250 VAc but must be derated to 6,8A if 440 VAC is used. So raed load = 12A at 250 VAc or 6.8A ay=t 440 VAC. (2) What does "minimum load" mean? Some relays have a minimum rated switched current for eg contact wetting purposes. I could not see any minimum spec. Assume that "minimum load" = no load. Then - (3) So " - Max. switching rate at rated- / minimum load - 6 min-1 / 1200 min -1" means When loaded at 250 VAC, 12A OR at 440 VAc, 6.8A it may be switched at a maximum rate of "6 min-1" = 6 times per minute = not more than once every 10 seconds. When loaded at zero amps - say perhaps 250 VAC present or 440 VAC present but no load then max switching rate = "1200 min-1"= 1200 times per minute = 20 times per second !!!
H: Higher spec LED near the center of the wafer? Does anyone know if it is true that chip tolerances are tighter towards the center of the wafer? There is a vendor that claims that "we pick our LEDs from the center of the wafer". Because of inherent production variation, LED manufacturers sort the LEDs so you get parts with similar color rank or Vf. But does this have anything to do with where the die is positioned on the wafer? AI: Rubbish. Wafers are sliced from a monocrystalline cylinder (called an ingot). The monocrystalline nature of the ingot ensures that the properties are the same on any point of the wafer. Yield is the same for chips from the center as from near the edges. The Lenser document Russell links to should trigger some warning lights. First, there's more technical talk than the common customer cares about. Then why tell all this? Well, having someone pay 400 bucks for a flashlight needs some convincing, and some people are sensitive to talk that sounds scientific. The 24 carat gold is also very suspicious. 24 carat gold is much more expensive than 22 carat, yet in this application doesn't really performs better. Why do they mention it? Because it sounds good. And you can't check the claims anyway. Only for the gullible?
H: Arduino - interrupt based decoding of serial data, race between ISR and loop() Trying to decode serial data (encoded using proprietary method) from a RF module. Having switched back and forth between the fast-sampling (4x the fastest freq) and of late an interrupt based method, I've reached a dead-end and not sure what all I am doing wrong, because apparently people have been successful in decoding ISM-band RF data (Manchester, NRZ, VirtualWire and HT12E/PT2260-62 encoded), in software. In my case, the RF modules's AGC (which I've no idea how to turn off, since there's no data-sheet, and the co. doesn't respond to emails... a cheap east-asian make) picks up noise and has the fastest level-transitions in durations ~40us, although valid (encoded data) transitions not lesser than 400us. My ISR has an elementary task of measuring the duration of last state to reject the spurious noise, and save only those transitions that could possibly be part of the encoded data. So far, I have not used a circular-queue (which is what I plan as the next step), but before doing that, I did a small experiment. In the ISR I check the state of a flag to see if it is true, and if true I do Serial.print("x"), else I set it true. In the loop(), I check if flag is true, then do Serial.print("-") and set it false. The flag is declared volatile. I find that I get very long continous streams of "x"s and very rare "-". My ISR is triggering on every transition of pin-2 (i.e. external interrupt#0). Now my question is, would adding a queue really solve my problem, because apparently the ISR is running far too frequently and thereby starving my loop() of cycles. Counting the distance between the "x"s and "-", I was hoping to find the ideal queue length, but I can't figure out a pattern. Is there something inherently wrong in my approach ? An outline of the source code is here. AI: You probably want to take the transmission time (and software UART management methods) of the Serial.print() routine into account. If you have access to a scope, toggling I/O pins would be a lot faster. You could toggle one in the ISR and the other in the loop. Or you could increment a counter in the ISR and sample/clear it in the loop (inside an interrupt disable/re-enable) then print it (after re-enabling interrupts). More sophisticated would be to only print the number if it exceeds the previous maximum. However, such tests are fundamentally flawed unless the testing code constitutes a small fraction of the loop operations - just figuring out how many interrupts can occur during a max-check/print routine is meaningless in terms of the ultimate operation which would presumably be doing something else in the loop. Generally, you will want to use circular buffering if you are acquiring data via an interrupt which must be aggregated into a larger assembly (bits into bytes, or bytes into buffers) and then acted upon in a way that is at all time consuming. It shouldn't be too hard to change your buffer size later to optimize memory consumption, especially if you keep them power-of-two sized. You may want to build in overflow alarms, and try running the finished system with an artificially reduced buffer size. Do pay very careful attention to ensuring that the ISR can't jump in the middle of where the loop trying to update the buffer's tracking variables - if you do a read-modify-write, you'll need to protect it.
H: What specification for IR communication to AV equipment? I'd like to task a micro-controller to use it as a universal remote. What is the specification used for IR communication to AV equipment (TV's, etc.) and where can I find it? AI: A worthy task and one which should keep you usefully employed indefinitely ! :-) If you wish to create a truly universal IR remote control then you need to provide a "learning" function that can "listen" to sequences from other devices. You could make your device "learning only" as some are, but if you mix that with a knowledge of existing protocols such as the man that Oli mentioned. That site does have a learning IR remote page (I found this afer I started to talk anout learning cintrollers, honest ! :-).They provide some useful advice. The majority of the material below is copied from links from the above pages BUT it is copied here not so much (if at all) to provide prtocol information but rather to show the sort of thing you are going to have to deal with to make something that is truly universal. "Learning" IRremote controller: This type of universal remote controllers has the ability to learn new codes. Usually you must align it head to head with the original remote controller and then press a special sequence of buttons on both controllers. The universal remote controller sees the patterns transmitted by the original remote controller and stores them in its memory. Later it can play back the learned patterns when you press the keys on the universal remote controller. One of the biggest advantage of this approach is that the universal remote controller can learn codes of brand new remote controllers, which didn't exist yet when the universal remote controller was created. But that doesn't mean that a learning universal remote controller can learn just about every possible protocol. I can imagine for instance that the ITT code will not be recognized because of the very short IR pulses it produces, whilst most universal remote controllers expect to see some sort of carrier in the range of 36 to 40 kHz. An example only of what you are up against if you want to makea truly unversal remote ! :-) ITT Protocol from here Only 14 very short IR pulses per message Pulse distance encoding Long battery life 4 bit address, 6 bit command length Self calibrating timing, allowing only simple RC oscillator in the transmitter Fast communication, a message takes from 1.7ms to 2.7ms to transmit Manufacturer Intermetall, now Micronas Other protocols may not be recognized because of less obvious technical reasons. For instance the NRC17 code may cause some problems on some universal remote controllers. If it does cause problems it is probably because every NRC17 command consists of at least 3 messages (Start, Command and Stop). I can imagine that some learning universal remote controllers can get quite confused by these Start and Stop messages. An IR message is transmitted by sending 14 pulses. Each pulse is 10µs long. Three different time intervals between the pulses are used to get the message across: 100µs for a logic 0, 200µs for a logic 1 and 300µs for the lead-in and lead-out. Then, having "cut your teeth": Nokia NRC17 Protocol The Nokia Remote Control protocol uses 17 bits to transmit the IR commands, which immediately explains the name of this protocol. The protocol was designed for Nokia consumer electronics. It was used during the last few years in which Nokia produced TV sets and VCRs. Also the sister brands like Finlux and Salora used this protocol. Nowadays the protocol is mainly used in Nokia satellite receivers and set-top boxes. Set top boxes?. Bother ! :-) Playing dirty. First the 0 & 1. The protocol uses bi-phase (or so-called NRZ - Non Return to Zero) modulation of a 38kHz IR carrier frequency. All bits are of equal length of 1ms in this protocol, with half of the bit time filled with a burst of the 38kHz carrier and the other half being idle. A logical one is represented by a burst in the first half of the bit time. A logical zero is represented by a burst in the second half of the bit time. The pulse/pause ratio of the 38kHz carrier frequency is 1/4 which helps to reduce power consumption. Sample message: No problem ! :-) But, do note the pre-pulse spaced 3 mS before the message proper. The first pulse is called the pre-pulse, and is made up of a 500µs burst followed by a 2.5ms pause, giving a total of 3 bit times. Then the Start bit is transmitted, which is always a logic "1". This pulse can be used to calibrate the bit time on the receiver side, because the burst time is exactly half a bit time. The next 8 bits represent the IR command, which is sent with LSB first. The command is followed by a 4 bit device address. Finally a 4 bit sub-code is transmitted, which can be seen as an extension to the address bits. A message consists of a 3ms pre-pulse and 17 bits of 1ms each. This adds up to a total of 20ms per message. Impossible is nothing! So, having assimilated that Every time a key is pressed on the remote control a start message is transmitted containing a command of $FE and address/sub-code of $FF. The actual message is sent 40ms later, and is repeated every 100ms for as long as the key on the remote control remains down. When the key is released a stop message will complete the sequence. The stop message also uses the command $FE and address/sub-code $FF. Every sequence can be treated as one single sequence at the receiver's end because of the start and stop messages. Accidental key bounces are effectively eliminated by this procedure. The receiver may decide to honour the repeated messages or not. E.g. cursor movements may repeat for as long as the key is pressed. Numerical inputs better don't allow auto repeat. And more.
H: Need help with designing IR sensor, current to voltage converter I would like to measure accurately (as possible as) using an IR LED and an IR phototransistor. I am using the following parts SFH4550 - IR LED BPV11 - IR Phototransistor Obviously, the transistor gives a current output proportional to light. That current has to be converted to a proportional voltage. What are the pros and cons of active vs passive current to voltage converters? Passive: Something like this where the transistor is the detector which is a current source: versus Active: Something like this where current i is from the phototransistor: Also how can I improve each method to give the best signal...reduce noise, flicker, etc? Thanks, any help is appreciated! AI: The main difference is that the passive circuit has an output impedance roughly equal to the resistor value. The active circuit has very low output impedance. That could mean you can get much more gain from the active circuit before the response time gets to be limited by the capacitance of whatever load is receiving the circuit output. Also, in the passive circuit the photodetector bias will vary as its output current changes. The bias on the photodetector in the active circuit will be constant. This could be important if you care about the capacitance of the detector changing. Both of these effects might mean that you can use a higher resistance value in the active circuit, which will reduce the Johnson noise contribution from that resistor, which gets to your question about accuracy. In either case you'll want to add a capacitor in parallel with the resistor in your circuit to limit the noise bandwidth of your receiver. Op-amp vendors have app notes describing how to optimize the noise in transimpedance amplifier circuits (here's one from National) If you go with the active circuit, you'll also want to pick an amplifier with low thermal drift of the offset current and low flicker noise (assuming your main goal is to measure the dc light power). I'm not much familiar with phototransistors, but I noticed the datasheet you linked shows nearly 2-to-1 change in collector current for temperature varying from 0 to 100 C. This is probably going to be the limiting factor in your sensor accuracy. Using a photodiode instead of the phototransistor, and making up the gain using the transimpedance amplifier circuit, and carefully selecting the op-amp and resistor you use, you ought to be able to achieve much better accuracy (I'm thinking on the order of a few % over 0 - 100 C, but I may be forgetting some critical issue). Edit - One more thing One minor difference (that might be important depending how you use the circuit) is that because its an inverting amplifier the active circuit will require both positive and negative power supplies (or some possibly accuracy-limiting hoop-jumping to avoid them), whereas the passive circuit may be easier to work in a single-supply environment. But even with the passive circuit you'll have to be pretty careful with the next amplifier circuit down the line to keep its accurate when the current is small.
H: General PSpice and 555 timer question regarding precision I have been experimenting with values recorded using a multimeter versus the voltages (RMS) simulated using capture. I simultaneously setup a circuit using a breadboard and drew exactly the same circuit in PSpice. I don't really have a particular circuit in mind. But I am sure I can set something up if it would help explain my problem. Most of my component values have been extremely close to one another, such as resistors and capacitors. However I have hit a sour patch with the 555. It is not within a reasonable range. Not even close. The last test reported an error of about 45%. The breadboard pin 3 output voltage doubled the RMS PSpice voltage. Not good! Is this normal? Is there anything that can be done to tighten up the PSpice component tolerances for ICs? I would like to use the program to its fullest, if it will let me! AI: A circuit diagram of what you are doing is close to obligatory - wise men who at their end know dark is right because their words had forked no lightning still make obvious mistakes - the rest of us the more so. LM555 circuit diagram here There is no reason [tm] that P-S.P.I.C.E.* cannot model a 555 like timer to have a high degree of precision if the SPICE model makers wish it to. SO the fact that it doesn't either suggests that either: They don't wish it to. This would be the case if eg they considered that the 555 IC did not produce overly accurately reproducible results between ICs - you can look at the datasheet to see if this may be so. or There is a bug in your P-SPICE. OR You are using values or parameters that are outside the reasonable range. 1k <= Ra <= 100k What value of external resistors are you using? 555 accuracy will be affected by the internal threshold levels in the ramp up / ramp down window comparators which in turn depend on fabrication issues. IF the maker has chosen to make these accurate they can be so. If not then they probably wont be. The LM555 datasheet suggests that the untrimmed accuracy of a '555 is "not too bad." Timing error monostable mode 1%/3% typical/max Timing error Astable 2.25% tpical no max - suggesting just maybe up to 7% max based om monostable spec. Timing erreor 150 ppm /degree C. (-.015% per C or 1.5% over 100 C range (simplistically). Depending on actual circuit, IF your main power supply has significant noise significant errors could be introduced. The best bet so far is that you are doing something wrong. Next best is broken SPICE. Spice is an acronym so should be, at least, SPICE, if not acyually S.P.I.C.C.E. Simulation program with integrated circuit emphasis, AFAIR.
H: How is the fact that the resistor used to limit the LED current dissipates some of energy addressed in lighting applications? LEDs can't be connected directly to a source of power - only in series with a current limiting resistor. Which means that when the LED is powered some power is dissipated by that LED and some power is dissipated by the resistor. Which means that some energy is wasted. Now suppose I need to construct a powerful light source - a house lighting fixture or a car headlight - that uses LEDs as a light source. I will have to connect all LEDs through resistors. I guess those resistors will waste quite a lot of energy. How is this problem addressed when using LEDs for lighting? AI: LEDs like to be powered with a constant source of current-ie. a fixed current regardless of the voltage it takes to achieve this. In practice for simple applications we assume a fixed forward voltage drop, and use a resistor to achieve the correct current. However, with changes such as process variation, temperature etc. the forward voltage, and hence the current, will change. For simple applications this is not an issue, but for high power application such as you mention, this does become a problem, and so resistors are not used. The solution is to include feedback in the circuit. As part of the driver circuitry, the current will be measured and the voltage across the LED controlled to always keep the current at the desired value; as a useful bonus, this also give you the ability to dim the LED by reducing the current. As you point out, if we turn the excess voltage into heat it ends up being pretty inefficient (this is a form of linear regulator) The solution is use a switching regulator, which turns the voltage either fully on, or fully off. A capacitor is used to "average" this voltage, and by changing the ratio of the time turned on to the time turned off, we control the average voltage. All with an efficiency of 90%+. If you're interested, then a commonly used circuit is a buck converter And if you'd like to get in-depth, then these two videos with Howard Johnson and Bob Pease are extremely good, Driving High Power LEDs Without Getting Burned - Part 1 Driving High Power LEDs Without Getting Burned - Part 2
H: Get multiple individual DC voltage sources from a single line If I connect 2 6V batteries or two individual sources serially the combined voltage should be the sum of the voltage of each battery (i.e. 12V). Is it possible to get 12 volts from a single source or battery of 6 volts? Actually I have to power my DSL router of (12v-700mA) from my laptop's USB port (5volts). Schematic diagram will be highly appreciated. AI: Your laptop's USB port supplies only 500mA. So, that is impossible with the USB port. Because even in the ideal conditions, output power cannot be higher than input power. In your case: Your output power: 12*0.7= 8.4 Watts Your input power: 5*0.5(max) = 2.5 Watts With a 95% efficiency of the converter, you need at least an ~8.9 Watt input power. However, if you have a higher current source with 5V, you can do it. And the way to convert a voltage by increasing it to a higher voltage is done by a "boost converter"*. A boost converter is a switch-mode power supply and it can be fairly easy to build one by using a Simple Switcher from National Semiconductor. Here is a design I selected using WEBENCH. It uses LM2585 at 100KHz. So it will be fairly easy for you to make it work. Because higher the frequency, harder it gets to build it. *Generally, I think. Correct me here if I'm wrong, guys.
H: Why do chargers heat up when operating? From my experience all chargers for Li-Ion batteries notably heat up when charging the battery. Why does that happen? Is the charger acting as a not that efficient power supply or is there any process inside it that is specific to charging that leads to such heating up? AI: Nothing is 100% efficient. And I think your answer is "both". The processes of converting voltages and controlling currents make the charger drop its efficiency and heat up. The heating is the product of power losses, which are I2R losses. That means the losses due to the resistance of the elements. Even a short wire has a resistance. However, most of the drop is in the power converter. Check out power supply efficiency using Google. In an example, let's calculate the power loss in a MOSFET. Let's pick a random MOSFET; IRF540PBF-ND. The properties of this MOSFET are: Rds On (Max) @ Id, Vgs : 77 mOhm @ 17A, 10V That means if you put 17A through this MOSFET, it will act as a resistor (well, at least to simplify) of a value of 77mOhm. That is 0.077 ohms! It may seem low, but let's calculate. Power loss in this MOSFET is approximately: I2R= 17.17.0.077 = 22.253 Watts! That means a lot of heat! Here is a 25W aquarium heater!
H: Applying an oscillation to a DC voltage? I've lost a 555 IC that I had owned, so thought I'd make an relaxation oscillator for practise out of an operational amplifier: The example of the simulator I have been using creates a square wave quite nicely, however there is no battery or current attached to it. Is it possible to apply this, or amplify it with a DC current from a small battery so that it can be more useful in terms of powering something with a current? (i.e. a solenoid) I seem to remember people putting an AC voltage source behind a DC source to have it risen (ride) on the DC voltage. I am unsure weather to use a transistor or what! If I am able to, how would I safely handle the inverse current (- peak of the square wave) if connected to a battery? Would it damage it? Would I have to redirect that portion with a diode or possibly have to lose it if I am using a transistor? Two transistors to handle each direction separately? Edit: Adding a non-inverting op-amp circuit after the output seemed to in simulation jump 5 to 15 volts, and allow a current (150mA), however that current is coming from "nowhere" (ground and out a resistor to ground again) so I am unsure it could provide any real power. AI: It's not clear what you really want. Your circuit looks fine if you want a square wave symmetric about ground. It's not clear if the problem is you always want the voltage zero or positive, or that you want it able to drive more power. To make a 0 to positive square wave: R1 and R4 form a voltage divider to make 1/2 the supply voltage at a impedance of 10 kΩ. This 2.5V and 10 kΩ source forms another voltage divider with R2. Since the opamp output is always either at ground or supply, the + input will be either at 1/4 or 3/4 of the supply. The cap will charge and discharge between these two levels. If you want more current drive from this square wave signal than the opamp can provide, one solution is to add a double emitter follower: In this case the opamp only supplies the base current to the transistors. Most of the emitter (output) current will come from the collectors, which is either from the 5V supply or ground. One drawback of this particular circuit is that a little voltage will be lost at each end. It can only drive to within the B-E drop of the transistor to each supply rail. There are other buffer configurations that have different characteristics, but this illustrates a simple way to get more current capability.
H: Are there reasons *not* to have a copper-pour ground plane on a PCB? I am taking a first stab at designing a PCB from scratch. I am considering using a CNC mill fabrication process, and it seems like with this process I would want to remove as little copper as possible. A copper-pour-style ground plane would seem to be a good way to address this constraint. But I have noticed that relatively few PCB designs have a ground plane, and even those that do often have them only in specific areas of the board. Why is that? Are there reasons not to have a copper-pour ground plane that covers most of a PCB? In case it's relevant, the circuit I am designing is a 6-bit D/A converter plug. A first cut at my PCB layout (which does not include a ground plane) is shown below. AI: Ground planes in general are almost always a good thing, but if used incorrectly can actually hurt the quality of your board. A typical board like you have here would have 1 layer dedicated to be a ground pour only with no traces running on it. However, it sounds like you are wanting to make your top layer have a ground pour so that you don't have to remove all of that extra copper. Doing a ground pour on a layer with a lot of traces is not really a ground plane at all, rather you can think of it as a ground trace with varying sizes running all around your board. It is hard to say if it will actually hurt the signal integrity of the design, but I can say for certain that it will not provide the same benefit that a ground plane will. Typically when I see milled boards like this, the copper will be left unconnected on the unused areas of board. This provides a benefit of knowing that if you accidentally short one line to the unused copper, you don't get a hard short to ground that can kill some ICs. This can also be a negative though as accidentally shorting to a large unused piece of copper can turn into a nice antenna and pick up noise that you may have a hard time hunting the source of. I realize my answer may not be a direct answer to what you are wanting to know, but it is very difficult to predict what configuration will be best for you. But, if it were my design, I would go ahead and just leave the extra copper on the board, but leave it disconnected from everything.
H: Automatic RTS control for RS-232 to RS-485 converters I got my prototype RS-485 circuit working. Now, I've connected it to my PC through RS-232 as I want to make the PC as the master. However, when I connect to the circuit using Hyperterminal, the RTS line, connected to RE and DE, always goes high. The PC can send data to the circuit but not receive, since the RTS never goes low. Changing the handshaking from none to hardware didn't help. I later made mods to the circuit, so that, on the PIC side, the pin that drives the SN75176's RE and DE high when transmitting data will also drive the SN75176's RE and DE on the PC side low to enable receiving. This in effect turns the line from two to three. It's wrong, but I'm just doing it to see how it'll really work if the RTS pin is working properly. How do I go on making the RTS pin working correctly? I know I can just create an app using Visual Studio to connect to the line and have RTS toggled manually, but doing so is too troublesome and I'd rather have a hardware solution if possible. AI: This man RS485 to RS232 converter - seems to be doing what you are doing and achieving success. It sounds like Hyperterminal should be capable of proper RTS control.
H: Circuit to remove noise from digital communication line Carrying on further from my previous post and drilling down to specifics, I am trying to figure out the right way to implement "glitch remover", or "noise remover", using electronics (i.e. not in software). From one of the answers in my previous post, I learnt that one could use a RC-circuit for this purpose, and the principles seem to be same (I think) as used for switch debounce. My key objective is to decode RF data, but noise is triggering my ISR way too fast and starving my main loop() of previous cycles. My device being Arduino (atmega328). Edit: (about the RF module) I am using this ISM band ASK/OOK receiver module. While the spec page or the website doesn't have a photo of the reverse side PCB, I can tell that it has a miniature white (what looks like) a trimpot. If I had a scope, I'd have tried to turn the trimmer to see if affects the AGC. However it might very-well be for trimming L-C parameters, since same module works for 315 and 433MHz, and the trimmer might just be the factory settings for 433MHz. At a very high level, the following diagram describes the purpose of "glitch remover". We have a noisy signal on input, but output is fairly noise-free. Noise is any signal transition that is shorter than a certain duration (say 400us). Edit: Actually the "glitch-free waveform" shown on right is a fake. I quickly drew it up by cleaning the narrower marks in paint. In fact, the waveform on left is actually all noise. In the midst of the high-frequency noise, the real transmitted signal is quite well formed and easy to make out, as it's frequency is much lower, and there is a 'guaranteed' trailing long-space, marking the end of the packet. The real transmitted signal is 12-bits + 1 sync bit. Each bit is represented by 1 Mark, 1 Space, 1 Mark, 1 Space of, where length of Mark/Space vary, e.g. 0: HHHH LLLL LLLL LLLL HHHH LLLL LLLL LLLL 1: HHHH HHHH HHHH LLLL HHHH HHHH HHHH LLLL F: HHHH LLLL LLLL LLLL HHHH HHHH HHHH LLLL (Floating address pin) S: HHHH LLLL LLLL LLLL LLLL LLLL LLLL LLLL where each H/L has a duration of 100us, and each bit thus takes 3200us. Noise spike are typically 30-40us duration, which is what is causing my ISR to overwork. Based on what I understood from the answer from supercat in my previous question, and based on a little research, I think this is the schematic of what I roughly need. Need help to check if the schematic is correct ? And what might be the potential values of R1, R2 and C ? If I understood supercat's response, then to filter out noise signals less than 400us, I can use a 0.22uF capacitor for C, and R2 of 1K, and probably 100R for R1. Is that correct ? Or, should the schematic be this (of course, this is closer to supercat's description). With R=1K and C=0.22uF ? I do not have a scope, so unable to do fine measurements and see waveforms, but do have a logic-analyzer. This probably limits what and how I can test if I experiment. BTW, can I expect that such a "glitch remover" to leave the desirable signals completely intact, or would they suffer some distortion of some kind ? AI: When I have a design problem like this, I first think "how would I decode this by hand" and then I try to implement my thought process through use of electronics. So, when I look at your two diagrams I see only one thing that my brain can use to determine what is data and what is noise, that is the width of the pulse. The problem with passive components in a situation like this is that for one you have a square wave that will have harmonics much higher then the cut off point for your filter. This will result in a not so square wave. The easiest way to do this will probably be in software. You can still use interrupts, but it will take a bit more work. Essentially what you will have to interrupt on an edge, and then count time until the next edge. If the length of time is long enough then you can call it a logic 1 otherwise you can consider it noise on top of a logic 0. If you must go with passive components you might want to consider a low pass filter followed by a comparator. You would have to play with the low pass filter to get it just right, but essentially you would aim to have the capacitor charge just high enough to cause the comparator to switch its output when the bit has been on long enough. What makes this difficult is that your "glitches" are very similar to your data and it is difficult to tune your circuit just right to get your data with no glitches. Even if you are able to perfect it on paper your components wont be very precise either. It is because of this that you should seriously consider doing this digitally.
H: PIC24FJ64GA002 not running at speed I'm trying to get my PIC24FJ64GA002 running at 32 Mhz. I measure the frequency on OSCO pin, and it's only 4 Mhz. Here's my code: config __FOSCSEL, FNOSC_FRCPLL & IESO_OFF config __FOSC, FCKSM_CSECMD & OSCIOFNC_ON mov #0x1182, W0 ; OSCCON mov #0x0000, W1 ; CLKDIV mov #0x0000, W3 ;OSCTUN mov W0, OSCCON mov W3, OSCTUN mov W1, CLKDIV AI: It looks like you are not switching the clock - if it's anything like the dsPIC I recently used, you can only switch to the PLL after the primary oscillator (INTRC or EXT XTAL) is running. To do this you use an unlock sequence that is detailed in the manual. I just had a quick look and it's there for your chip with explanation on page 93. There are macros in the C30 library (just for info if you plan to use C at some point) to unlock and write to the necessary OSC registers and do the same thing, but I can't see them mentioned there (will be in the C30 manual). Anyway, try following the instructions on that page and let us know, if it still doesn't work I'll look again (think I might have one of those PIC24s round here somewhere to test if necessary) EDIT - For reference, below is the code in question. You need to put 0x03 (the code for external crystal with PLL) in W0 just before it executes. You probably want to have a small delay after the switch to allow the new clock to settle, and check OSWEN and the LOCK bit to make sure the switch was successful. ;Place the new oscillator selection in W0 OSCCONH (high byte) Unlock Sequence MOV #OSCCONH, w1 MOV #0x78, w2 MOV #0x9A, w3 MOV.b w2, [w1] MOV.b w3, [w1] ;Set new oscillator selection MOV.b WREG, OSCCONH ;OSCCONL (low byte) unlock sequence MOV #OSCCONL, w1 MOV #0x46, w2 MOV #0x57, w3 MOV.b w2, [w1] MOV.b w3, [w1] ;Start oscillator switch operation BSET OSCCON,#0 EDIT I had another look and I think you should be able to start up with using the FRC with PLL on this chip (on the dsPIC it was only with xtal anyway IIRC) I'll leave the above there for reference about switching anyway. My second guess is that I think you have the config wrong - looking and the .inc file shows that the configurations for the OSC, etc are in config2, not config. Check for yourself in your ASM30 folder - it should be under something like: C:\Program Files\Microchip\MPLAB ASM30 Suite\Support\PIC24F\inc) Also note the notes regarding setting the config bits either with macro or the longer way. Make sure you have these correct. Also, it might be worth putting in a check for the PLL LOCK bit (in the OSCCON register - see this FRM Oscillator document for the most thorough discussion. With the larger PICs you will need the family reference manual anyway, so grab all the parts from microchip if you haven't got them)
H: Effects of changing the frequency of a transformer If the frequency of a transformer is decreased by keeping voltage same, then what will be the new kVA rating, magnetizing current and inductance, the induced voltage and loss of the transformer? AI: I'll assume that your question is meant to apply to power transformers intended for single phase AC mains use. My answer also applies more generally to some extent. Summary: For small changes in frequency - say a 60 Hz transformer run on 50 Hz, kVA up slightly, magnetising current up by MORE than 60/50, inductance down somewhat, induced voltage about the same, losses much higher. Death threatens. E&OE AC mains power transformers are usually designed to make best use of the active material used to construct them - mainly the windings and the magnetic core. Power transfer relies on magnetic flux and the more the better (usually) so the core material (usually a laminated steel specially suited to the purpose) is arranged to have as much flux produced in it by the AC current in the primary winding. The measure of the magnetising force is ampere-turns (H) and this is translated into magnetic flux (B) by the formula B = u.H where u (mu if i had Greek easily to hand and brain) is effectively a conversion factor. If u was constant we could keep on adding H (more amp-turns) and getting more am more and more output from a given core. Alas, there is a limit and above a given H level for a given material and various other conditions we startto get proportionately less B. This is known as saturation. In practical terms we get more magnetic flux with more current up to a certain limit and above this we get less and less and less and ... return as we add more amps. As the extra amps create losses in the copper and in the core and extra heat which tend todo bad things. SO transformer manufacturers usually run their cores on the knee of saturation - at the point where the diminishing returns set in- so that they can get as much output as possible from the transformer. This affects the answers to your questions severely. If frequency of a transformer is decreased The lower frequency will see a lower impedance, there will be more current you will push further onto the non linear knee of the BH curve, the transformer will be less efficient but will handled somewhat more maximum power. If you eg operate a transformer properly designed to run on 60 Hz it will get hot and unhappy on 50Hz even on no load. Ask me how I know ;-). keeping voltage same then what will be the new KVA rating Somewhat higher as somewhat more B for you exrta H BUT for say 20% more current you may get 5% more flux and 5% more kVA out but 20% more kVa in AND 45% more copper losses. magnetising current mc will go up as there is less B per u - effectively the impedance has dropped. and inductance Less inductance. Death is beckoning. induced voltage Voltage is proportional to turns ratios and primary and secondary are linked by same flux so more or less the same voltage out. Secondary effects may change this slightly. and loss of transformer ? Potentially total loss of transformer :-). A 60Hz transformer on 50 Hz runs hot. Make that wider and it would die. An eg 400 Hz aircraft supply power transformer of any appreciable power would die faster than you could run when connected. E&OE This can be a bit complex. Some of the above may be somewhat wrong in any given case - but probably right enough in most.
H: What keeps mains power at 60hz? In a power plant, what keeps the power at a solid 60hz? It seems like turbines can't always be running at the exact same speeds, given that combustion doesn't always give the exact same temperature (my dad works at a waste to energy plant, which is why I say this). Also, just for giggles, what would happen if AC power at a different frequency accidently got released into the lines? AI: "The grid" keeps everything locked, more or less. The AC mains grid is like a very very very big flywheel. Individual alternators attached to the grid are frequency locked to it and cannot noticeably push it faster or slower. If you apply more power to your local alternator it will slip in phase relative to grid frequency. Slip too far and you slide off the edge (90 degrees off phase absolute maximum possible, less in practice) and free run relative to mains. At that point it is a race between the impressive magnetic arc blowout breakers and alternator death. The breakers usually win. Usually. Even a small breaker or fuse "going" - say 100 kVA, can sound like a bomb blast. Ask me how I know ;-). If enough stations push too much or pull too much overall the whole mains frequency will slowly slip. A central control station observes overall frequency and adjusts power in overall relative to load to keep frequency somewhat stable. Mains frequency is compared to a standard long term and nudged as required. NIST is the supplier of the ultimate US reference. I recall that the need to synchronise the whole grid was removed in the last year of few. At half time in the US Superb-Owl when 100 million US-Americans get up out of their seats and go to make a cup of coffee the power station controllers who have been waiting this moment of terror put the grid into 'go around power please' mode to take the hit. [[I'm making that up about the terror, BUT having seen the grid power plot for that occasion it is probably true]]. If you have a moderately small grid and input a significant percentage of extra energy from elsewhere via eg a DC link and then artificially make AC from the DC and pump it into the small grid , you can accidentally wave the grid too and fro in the breeze, as it were. Sicily, fed from Italy, has had this happen.
H: Level Shifting 1.8V to 5V with N-channel FET I am using BeagleBoard-xM GPIO outputs to drive some DC motors with the help of L293D IC. The problem is that there is a difference between voltage levels. The GPIO outputs only supply 1.8V while L293D needs at least 4.5V for logic high. So I need a unidirectional voltage level shifting. I have BS170 N-channel FETs for this purpose. However I am not good at semiconductors. What is the proper configuration for the transistor? Do I have to use any additional components? AI: The BS170 will not work very well here as it's threshold voltage (i.e when it starts to turn on) is typically 2.1V, which is higher than 1.8V. So you could use a FET with a lower threshold voltage, but I'd probably just use an NPN for this. Something like this should do okay: Be aware that the schematic above will invert the logic levels e.t. *0*V@PIN -> +V at the collector. If you can source a better FET then you can use the above circuit but swap the NPN for the N-Channel FET. In this case the base/gate resistor is not necessary, but it won't do any harm providing you don't need to switch at very high speeds (this particular solution is for lowish speeds) Resistor values are not too critical, the R3 is to limit current flow into the base of the transistor, and R2 sets the current through the transistor. If we assume the gain of the transistor is ~100, then if you wanted to reduce current drawn from the pin (e.g. battery powered device that needs to be power conscious) you could go a lot higher than 1k with R3 (probably up to around a maximum of 15k), as the base needs a minimum of only 5mA / 100 = 50uA to work (the 5mA comes from 5V / 1k (R2) ) If higher speed switching is needed you are probably best off with a level shift IC. Here is a Maxim page that mentions a few high speed level shift ICs.
H: Does any current flow through C-E of NPN BJT when the base is floating? UPDATE Have included an image. As you can see, LED is ON when base is floating. This is a 2N222A transistor. Playing with an NPN bipolar transistor. The Collector is connected to the positive terminal of a 9V battery through a 1k Ohm resistor, and the Emitter is connected to the ground through an LED. The Base is not connected to anything. The LED seems to be dim in the above case. When I connect the Base to the positive terminal, the LED is much brighter. That makes sense as current through the base Base amplifies the current. My questions is: should any current flow through the emitter if the base is not connected to anything? I.e. Shouldn't the LED be completely off? I have a similar question for NPN Unijunction transistors (understand that nomenclature changes from CBE to AGC)? AI: Okay, looking at the picture I think you may have the transistor the wrong way round. Try turning it round. See this picture for reference: As you can see the collector is on the right with the flat part facing you, so you have the collector connected to the LED in your circuit (if the 2N2222A part you are using has the same pinout) I got the picture from here. EDIT - It's actually a 2N222A, but the above advice still goes as the pinout appears to be the same from the picture posted. As Russell mentions the more standard way is to connect the LED to the collector, but your circuit should work if set up correctly.
H: Communication between modules over USB using a uC I have a module (say A) which sends data serially to me at 5 Mbps. I want to transfer this data to another module (say B). For B, I have a few choices for links: USB, UART, PCI/E, etc. I am not sure but I think USB would be the best choice at such a high data rate. I already have a uC in addition to modules A and B (used to send some control signals to these modules). Can I use a uC for interfacing between A and B? Note that the output of A is analog data. So, I need to pass it through an ADC before sending it to module B. The uC shall be incorporated somewhere in between (either between A and the ADC or ADC and B). If a uC is not the correct choice, then what should I use? I need to make it as low power as possible as its battery operated. Clarifications (Edit-1): 5 Mbps is the data rate after 10-bit ADC Battery is roughly around 400mAh Data flow: Module A -> Analog Data -> ADC (10-bit) -> uC -> USB cable -> Module B AI: USB is one possible solution, but due to the protocol stack that is needed it would be very complicated to implement compared to other serial interface options. I would suggest SPI as it is very simple to implement. I would consider taking a uC that supports a high-speed SPI interface like the Microchip PIC32. The SPI operates at up to 20Mbps. Additionally, such a uC also has an A/D converter and a DMA module which would simplify the data transfer both into and out of the uC and ensure the speed you are looking for. There are definitely other uC products that are lower power, but you need to make sure that: a) the SPI interface can be operated fast enough for your needs b) the underlying CPU is powerful enough to transfer this amount of data in/out Don't forget that uC clock frequency has a large influence on power consumption and, considering the speeds probably needed to support this amount of data flow, you may need to consider using the uCs low-power or sleep modes when not actively transferring data to save energy. Last point - you should define "low-power" in a question like this. A battery could be a small 1000mAh 1.5V cell, or a 12V lead-acid type. I am assuming that your planned system is: Analog signal->ModuleA->SPI->cable->SPI->ModuleB If not, and ModuleB only supports USB,UART,PCI/E etc. then use the uC on the ModuleB side to convert from SPI to USB thus: Analog signal->ModuleA(uC)->SPI->cable->SPI->(uC)->USB Device->cable->ModuleB Clarification in response to Edit 1 I would then make the following concrete recommendation. Start by looking at the PIC32MX250F128D. This has a 13 channel, 10-bit A/D and a USB-OTG module. This would become the "uC" element in your "Data flow:" description. Microchip also offers a free USB software stack which make USB much easier to use. The USB module on the PIC32MX250F128D can also be used as a 'host' or as a 'device'. Regardless of what ModuleB actually is, the flexibility should be there to interface with it in one or the other modes. Current consumption lies typically at around 14.5mA at 40MHz, 3.3V and 25°C giving you around 27.5 hours of 'active' (i.e. running at full speed) run time. Beyond that you'll have to look at fine tuning the application code to make use of the various energy saving features the device has (i.e. idle and sleep modes etc.). Reducing frequency of operation has a linear effect on power consumption; supply voltage has a power of 2 (V^2) effect, so reducing your applications voltage supply to the minimum allowed will contribute greatly to battery life. Hope this provides more to go on. Best regards, Stuart
H: LM2596 Voltage Regulation Problem I am trying to implement a switching voltage regulator from 7.2V to 5V with LM2596 by HTC Korea. Since I don't need an adjustable regulation, I chose typical application circuit from the datasheet which is for fixed output voltage (seen below). I use 1N5817 (20V, 1A, for testing only) Schottky diode for D1, and different values for L1 including 27uH and 33uH. I also change Cout to 100uF, 270uF, 330uF, 470uF and 1000uF (16V and 25V). No matter what I did I couldn't change output voltage. It's always around 1.25 volts, the value does not change if I remove D1, L1 or both. Changing L1 or Cout also does not affect output voltage. If I remove Cout and measure output voltage without a load, it's around 4V. What am I doing wrong? Is there anything that I am missing here? I also attach the pictures of my test configuration on breadboard below. AI: The fact you always get 1.25V sounds suspicious to me. This is often the Vref voltage for adjustable regulators. Checking the datasheet for the LM2596 says it's 1.25V also. Are you sure you don't have the adjustable version? One way of finding out easily is to set up your circuit as if it was and see if it works. Add the two resistors in the diagram below - R1 should be 1k and R2 3k for 5V. The feedforward capacitor across R2 (Cff) shouldn't be necessary with this setup, but you can check TI's better datasheet for info on selecting one for situation when it is necessary (over 10V out or extra low ESR on output)
H: How to name what this resistor is doing? I have a basic circuit that uses a photoresistor powered by a five volt source. I had made this project to show my son about various sensors and had used a circuit I had found online. It looks something like this: simulate this circuit – Schematic created using CircuitLab The only way I could explain this, is that the resistor would provide a safe path to ground so that current would not flow in to and hurt the analog sensor (leaving just "voltage" to read from the photoresistor). I am not sure its point is to protect it. I've looked at examples of pullup/pulldown resistors, however that seems to be for preventing a logic input from "floating". It appears that it would not do so in this circuit as it is a continuous variable voltage supply. How do I name its purpose? AI: It's not for protection, it's to form a voltage divider with the photocell. For a typical photocell, the resistance may vary between say, 5 kΩ (light) and 50 kΩ (dark) Note that the actual values may be quite different for your sensor (you'll need to check the datasheet for those) If we leave the resistor out, the analog input will see 5 V either way (assuming an analog input of a high enough impedance not to affect things significantly) This is because there is nothing to sink the current and drop voltage. No Resistor Let's assume the sensor is connected to an opamp with an input resistance of 1 MΩ(pretty low as opamps go, can be 100's of MΩ) When there is no light shining on the photocell and it's resistance is at 50 kΩ we get: $$ 5~\mathrm{V} \times \frac{1~\mathrm{M}\Omega}{1~\mathrm{M}\Omega + 50~\mathrm{k}\Omega} = 4.76~\mathrm{V} $$ When there is light shining on the photocell and it's resistance is at 5 kΩ, we get: $$ 5~\mathrm{V} \times \frac{1~\mathrm{M}\Omega}{1~\mathrm{M}\Omega + 5~\mathrm{k}\Omega} = 4.98~\mathrm{V} $$ So you can see it's not much use like this - it only swings ~200 mV between light/dark. If the opamps input resistance was higher as it often will be, you could be talking a few µV. With Resistor Now if we add the other resistor to ground it changes things, say we use a 20 kΩ resistor. We are assuming any load resistance is high enough (and the source resistance low enough) not to make any significant difference so we don't include it in the calculations (if we did it would look like the bottom diagram in Russell's answer) When there is no light shining on the photocell and it's resistance is at 50 kΩ, we get: $$ 5~\mathrm{V} \times \frac{20~\mathrm{k}\Omega}{20~\mathrm{k}\Omega + 50~\mathrm{k}\Omega} = 1.429~\mathrm{V} $$ With there is light shining on the photocell and it's resistance is 5k we get: $$ 5~\mathrm{V} \times \frac{20~\mathrm{k}\Omega}{20~\mathrm{k}\Omega + 5~\mathrm{k}\Omega} = 4.0~\mathrm{V} $$ So you can hopefully see why the resistor is needed in order to translate the change of resistance into a voltage. With load resistance included Just for thoroughness let's say you wanted to include the 1 MΩ load resistance in the calculations from the last example: To make the formula easier to see, lets simplify things. The 20 kΩ resistor will now be in parallel with the load resistance, so we can combine these both into one effective resistance: $$ \frac{20~\mathrm{k}\Omega \times 1000~\mathrm{k}\Omega}{20~\mathrm{k}\Omega + 1000~\mathrm{k}\Omega} \approx 19.6~\mathrm{k}\Omega $$ Now we simply replace the 20 kΩ in the previous example with this value. Without light: $$ 5~\mathrm{V} \times \frac{19.6~\mathrm{k}\Omega}{19.6~\mathrm{k}\Omega + 50~\mathrm{k}\Omega} = 1.408~\mathrm{V} $$ With light: $$ 5~\mathrm{V} \times \frac{19.6~\mathrm{k}\Omega}{19.6~\mathrm{k}\Omega + 5~\mathrm{k}\Omega} = 3.98~\mathrm{V} $$ As expected, not much difference, but you can see how these things may need to be accounted for in certain situations (e.g. with a low load resistance - try running the calculation with a load of 10 kΩ to see a big difference)
H: OPAMP has voltage on its supply when it shouldn't I was trying to design a circuit after seeing this question. I know I used too much components than I should designing a circuit with this purpose. And sorry about the messiness of the schematic. This circuit compares V1 and V2 and if V2>V1 than it outputs V2. If V1>V2, it outputs V1. I am going to combine U2 and U3's outputs later on. However I don't understand why this circuit behaves abnormally. Even if the Q2's base shown to have about 20mV, Vbe of Q2 is negative, and V+ supply pin of U3 is 2.42V. Output of U1 is 8.39V and collector of Q3 is about 20mV. Output of U2 is 5V, where the output of U3 is 1.57V. Why is this odd behavior? Here is the LTspice file. AI: A couple of possibilities spring to mind: One is that since the input is higher than V+, there is leakage through causing V+ to rise. This looks quite possible since V+ appears to be about a diode drop from the input voltage (3V - 0.6V = 2.4V) Most opamps don't like an input voltage higher than the supply. The other thing to bear in mind is that the opamp model may not simulate accurately when used like this. Most are behavioural models rather than transistor models. Some models do funny things when used in non obvious ways, so it may not be doing exactly what it would in real life. I think it looks reasonable though. For interests sake, you could try putting a load on the output (and maybe a series resistor on the input) and see if it drops. Also you could change the input voltage to see if the V+ follows it (minus 0.6V) A better solution to switching the opamp supply would be to do something like use an opamp with an enable input to switch on/off, or put an analogue switch before/after the opamps to cut the signal. A multiplexer like a 4052 would work okay (you can simulate it with the voltage controlled switch component if you can't find a model) An analogue switch can be as simple as a PMOS: This can't handle signals that swing negative though, for that you need something like this: This configuration is used in most analogue switch ICs. The 4052 (or 4053 could be used) suggested is basically just a few of these in one package, with some logic to switch between them. For comparison, here is a diagram of one of the internal switches of a 4053:
H: Difference between busses I think I am confusing the difference between some of the of busses, such as IDE, SATA, USB, and PCI. What is the relationship between all four, how are they connected to each other? From what I read it seems like PCI connects them together as well as to the CPU, but it's not clear. Any help would be greatly appreciated. I am cross referencing this post with another I made about the Linux commands to browse them. https://unix.stackexchange.com/questions/27414/ide-and-pci-bus-commands AI: The interrelationship of the different busses is roughly as follows: / SATA CPU => Northbridge => PCI Bus => Southbridge => IDE \ USB Where the Northbridge and Southbridge are names given to the two main controller chips inside a PC. IDE and SATA both perform the same job but through different physical media - they are for attaching hard drives etc. IDE is "Integrated Device Electronics" - also known as "ATA" or "ATAPI" (ATA Peripheral Interface). SATA is "Serial ATA" - the same ATA protocol but serial instead of parallel. USB is a serial communications bus which can communicate with any number of devices, not just hard drives and other storage devices. It speaks a completely different protocol to the ATA family. PCI (and the derivatives PCIe, etc) are much closer to the CPU and generally provides much more direct access to the CPU. Edit: You can see how everything is connected together in Windows through the Device Manager set to View Devices by Connection:
H: Arduino, problem with displaying RFID ID I have recently gotten a Parallax RFID reader and I was trying to make it work with my Arduino uno. I have gotten all the necessary wires attached and I used a RFID reading program I found from Make (I will put the code at the bottom). When I open serial monitor and move an RFID card near it, it spits a series of x's and ø's(eg. xxxxøxxxxøxxøø). I am expecting to see a combination of letters and numbers. I think its a problem with the code, but I dont know enough about it to know whats wrong. The code can be found at http://cdn.makezine.com/make/28/RFIDread.pde The RFID reader can be found here http://www.parallax.com/Store/Microcontrollers/BASICStampModules/tabid/134/txtSearch/rfid/List/1/ProductID/114/Default.aspx?SortField=ProductName%2cProductName AI: As discussed in comments, serial monitor baud rate must match the 2400 baud used by the sketch.
H: Capacitor self resonance in a buck converter I'm building a 5 V regulator for a PCB, and I was reading through the datasheet and Wikipedia to make sure I was doing it right. What baffles me is that the regulator switches at 150 kHz. Yet most sources I've found online say the self-resonant frequency of your average electrolytic cap is below 100 kHz. In the circuit on page 8 of the datasheet, there's a 220 µF electrolytic capacitor. Assuming 2 nH (low estimate) is a reasonable series inductance (is it?), then the highest possible resonant frequency should be \$ f_c = \Large{\frac{1}{2\pi\sqrt{220e^{-6}\ F\ *\ 2e^{-9}\ H}}} = \small240\ kHz \$ So at 150 kHz the capacitor should barely be working as a capacitor. How does this even work? Why is it OK? I did some simulations of the circuit to figure out what exactly was going on. I modeled the switch/diode as a 12 V square wave with duty cycle 5/12 = 0.417, and with a load of 5 ohm (for a 1 A current). The output capacitor is 220 µF, the inductor is 33 µH. First I made a Bode plot: The bottom circuit is using an ideal capacitor (no ESL/ESR). It's basically a low-pass filter with a resonance at 11k radians (1.8 kHz). The top circuit is with an ESR of 100 mohm, ESL 20 µH. The ESR smooths things out at the resonant frequency. The ESL (self-resonant at about 75 kHz) causes the response to flatten out at around 75 kHz, and reduces the attenuation from -40 dB/decade to -20 db/decade. And then I simulated it with SPICE: The top trace shows the ideal capacitor. Simulated over 3 ms, it rings at the resonant frequency of the filter (1.8 kHz). The second trace shows the capacitor with parasitic effects included. It flattens out after a couple of milliseconds, although in the first millisecond the voltage shoots up to 9 V, and the current (not shown) peaks at 12 A, which might be a good reason to include some overvoltage protections. The third trace shows the output voltage oscillating at around 5 V (also the voltage across the capacitor). The fourth trace is the instantaneous voltage across the series inductance. The fifth trace is the current through the capacitor. So at these frequencies, the capacitor is indeed almost self-resonant. The impedance across it is almost entirely ESR (100 mohm). The impedance of the ideal capacitor part is 5 mohm; the impedance of the series inductance is 2 mohm (both negligible). But it still drinks up all the oscillatory current, because it is 0.1 ohm in parallel with a 5 ohm load. This is exactly what the capacitor is intended to do. The fourth trace illustrates the effect of the series inductance. Across it is a mere 7 mV. The capacitor impedance contributes something similar. Out of 60 mV ripple, this is nothing -- but if the frequency were higher, then the overall impedance of the non-ideal capacitor would be higher due to the parasitic inductance. You're fine until the impedance of the capacitor becomes a significant portion of the load -- when that happens you get a large oscillatory current through the load, and that's bad. This also illustrates the reason why the ESR is such an important parameter. If it's too low, then you don't damp out ringing of the LC circuit and your circuit has stability issues. But the higher it is, the more oscillations you'll get on your steady state voltage. AI: This paper describes the typical inductance and SRF of an electrolytic capacitor. One way to really know what's going on is to hook the capacitor up to an impedance analyzer. The difference in ESR between 100kHz and 150kHz is small (\$22 m\Omega\$ vs. \$25m\Omega\$). The minimum impedance is at around 70kHz. Remember, for most forward-type switching power supply designs (i.e. buck) the size and number of output capacitors is much more influenced by the ESR you need to keep the output ripple within specification, not so much by the capacitance you need to maintain regulation when the power train isn't delivering energy - generally you wind up with much more C than you need need to get the ESR that you want. Also, even when you exceed the SRF and the ESL becomes dominant, the part is still a capacitor - just with some inductance in series. The ESR (caused by ESL) has to become extremely huge before the part ceases functioning altogether as a capacitor, which will happen at extremely high frequencies (where the ESR approaches the load resistance). This article explains the concept very nicely. (It's kind of like thinking about a gyrator circuit - it simulates inductance, but isn't really an inductor as it doesn't store energy in a magnetic field.) Trust me, lots of power supplies operating at or above 100kHz are using electrolytic capacitors as output filters very successfully.
H: Switching Question I am designing a power control panel for the room of many applicants. In the panel there are several micro switches available for the user to turn the appliances ON/OFF. At the end of the micro-switch there I place relay for controlling load of 220V (AC). I am powering the circuit by 12 volts. I want to freeze the state of relays either ON or OFF such that; when user presses the micro-switch once, the relay should turn ON until the user presses the switch again. Which component should I use to maintain the state of relay? AI: You could use a latching relay for this, they are designed to maintain their state (without constant power applied) once switched. You just need a brief pulse (e.g your 12V for a 12V rated relay) to toggle. Here is an example part, rated for 250V/3A. You don't mention what current it needs to handle, but if you search for "12V latching relay" on any of the large suppliers you will get plenty of options from which you can select a suitably rated part. Bear in mind these are a bit of a pain to drive, as you need to reverse the polarity of the pulse to switch on/off (or have another coil connection for the 2 coil version, which if you only want to use one button would be a problem) If the extra power consumption isn't too much of an issue I think I would probably go for Abdullah's suggestion of a T flip flop driving a standard relay. They are also a lot cheaper.
H: How long will laptop run from UPS? The laptop has input: 18.5V, 2.7A The UPS output is: 220V, 6.82A and also something about 1500AP I have no idea how to work out how long I would be able to run the laptop off the UPS when the UPS is disconnected from the mains. AI: Re The laptop has input: 18.5V, 2.7A The UPS output is: 220V, 6.82A and also something about 1500AP These are informative but not directly related. Input is to laptop by charger. This IMPLIES that the cells are < 2.7 Ah each - say probably 2.2 Ah LiIon 18650 cells BUT this is uncertain. 6.82A is notional UPS output max current. They Are REALLY sayin that it is a 1500 VA or Watt inverter and the 6.82 was got by dividing 1500 by 220 . It will be approximate. Question has many factors affecting it. This is the general formula that applies and may be approached in several ways. Time = Available_energy / rate of using energy = (UPS_battery_capacity_in_Wh x UPS_efficiency) / Laptop_Power_use You can get a good measure of (UPS_battery_capacity_in_Wh x UPS_efficiency) by operating a known load on a full charge and seeing how long it ran. BUT you may guesstimate that UPS energy capacity ~~= Battery amp-hour rating x battery voltage x 0.8 or If battery Watt hour capacity is known. UPS energy capacity ~~= Battery Watt-hour rating x 0.8 In both cases the 0.8 is an assumed efficiency of 80% from battery output to end use device. __ The 18.5V, 2.7A is the laptop charger raing. More useful is the battery amp hour (Ah) or Watt-hour(Wh) capacity. ither or both are almost always shown on the battery. Determine N from N x 3.6V ~+ battery voltage. Then laptop battery energy capacity = either energy capacity = Watt.hours shown on battery or energy capacity = N x 3.6 x Battery amp hours capacity Run laptop from fully charged battery using conditions similar to those to be used when UPS is in use. If you do not know thse use conditions then you cannot answer the question. Laptop Run Hours = LRH. Then Laptop_power = energy usage rate = Battery_energy_capadity (from above) / LRH Then **UPS runtime ~~= UPS_battery_capacity_in_Wh x UPS_efficiency / Laptop_power** EXAMPLE: Made up data. UPS Battery = 12V, 30 Ah. UPS available energy = 12 x 30 x 0.8 = 278 Watt.hour Laptop battery = 14.6V. So N = 4 as 3.6 x 4 ~~ 14.6 Laptop battery capacity = 4Ah (on battery). Laptop battery energy capacity = 3.6 x 4 x 4ah = 47.6 Watt.hour - say 48 Laptop is run from this battery and achieves 4.5 hours operation. Laptop power use = Laptop battery energy / hours operaing = 48/4.5 = 10.666 atts = say 11 Watts UPS runtime - UPS energy/Laptop power = 278 Wh/11 W ~= 25 hours This is longer than a UPS will usually opera a computer system. This is due here to goodish battery in UP =30 Ah and rasonably low thirst laptop. NB - note that I have taken UPS and laptop batery capacities as rated. If they are not new this will not be true.
H: Noisy data line clears up on wiring up multiple output pins of uC to Logic Analyzer Some people reading my question might be familiar with a string of questions (latest being this one) where I have been asking about how to decode data from an ISM-band ASK/OOK type RF receiver module. One of the excellent techniques I learnt from one of the answers was to use the pin-toggling to debug my program, using a logic-analyzer. The uC platform of my choice is Arduino (at 20MHz). Now from my previous post it would be clear that I was dealing with the situation where the valid received data (encoded) was to be found from a data stream which seemed very noisy with high frequency signals, and I thought that I'd found a satisfactory rationale to ignore the high frequency signals by discarding them in software if the duration in that state was lesser than that of valid signals expected. This seemed to be going well for a while, and I started making some progress. In debugging some of the problems I was facing, I landed up adding 5 additional lines to the logic-analyzer (in addition to the RF Rx data going from the RF module to uC). These additional lines would toggle in software based on various runtime conditions in the program, s.a. ISR invocation, every 100th main loop() invocation, meeting some conditions etc. To my surprise, I noticed that with this, my "noisy" RF-RX data line had cleared up, or rather instead of the high frequency noise, I was seeing low frequency noise, and the lengths of marks/spaces have become much longer than that of the valid RF data signal. So to validate my observation, I plugged out my debugging pin lines. Lo-and-behold, the noisy chatter was back. I computed the smallest pulse duration, and also the typical pulse-duration in both of these cases, and there is an order of magnitude difference. The observation is highly repeatable. My circuit is on breadboard, and I am using home-made connectors (between 6cm - 15cm), i.e. the stiff single-strand copper wire, you find in Ethernet (CAT-5) cables. My logic-analyzer's unused inputs are all grounded. It is the Openbench Logic Sniffer. My question is, how do I explain this ? Edit: Thanks to many of the tips, clues I received here, I believe that I've managed to isolate the behaviour to usage of Pin# 13 on Arduino, although I can't quite (yet!) nail it, i.e. what exactly is the reason for the behaviour. I have confirmed by several rounds of tests that, if I have my ISR() logic mapped to Pin#13, s.t. whenever a particular external interrupt (#0) is triggered on either rising or falling edge, I use pin#13 to make the waveform accordingly, i.e. to follow the state of pin with external interrupt#0. If instead of Pin#13, I use any other digital I/O pin, I notice that the noise goes back to being high-frequency noise, but if I use pin#13 for the above-stated purpose, then the noise switches back to low-frequency noise. Reading Arduino reference manual, I see this text, but I believe that it is not relevant as in my case the pin is configured for OUTPUT, not INPUT. NOTE: Digital pin 13 is harder to use as a digital input than the other digital pins because it has an LED and resistor attached to it that's soldered to the board on most boards. If you enable its internal 20k pull-up resistor, it will hang at around 1.7 V instead of the expected 5V because the onboard LED and series resistor pull the voltage level down, meaning it always returns LOW. If you must use pin 13 as a digital input, use an external pull down resistor. AI: You need to step back and deal with this noise properly. Trying to cover it up in the firmware is the last resort. Something is making a mess somewhere. Start by turning off everything except the receiver module and look at its output with a scope. Make sure the scope probe is properly grounded right at the receiver module ground. Make sure the logic analyser, the arduino, etc, are all off. Power the receiver from batteries if you have to. Is the noise now present on the receiver output? If so, then all the stuff that's off isn't at fault. Shut off as much other equipment in the vicinity as you can manage. Put a antenna tuned to your frequency (you only said ISM band, which doesn't tell us the frequency) on the receiver. Make a 1/2 wavelength dipole from wire if you need to. Keep poking around to find the source of the noise, which in this case is either bad module hookup or actual RF interference in your band. If the latter, there is little you can do about it. If the signal is clean with just the module, then slowly add back other parts of the circuit one by one. Each time watch the output of the receiver on the scope. At some point you'll get the noise back, but now you'll know the source. The best way to deal with any noise is to eliminate it at the source. Once noise gets added to your signal, there are likely parts of the noise that can't be distinguished from valid signal anymore. No amount of post processing can get rid of such noise.
H: how choose transistor for driver circuit of stepper motor? I need to drive a 1A stepper motor coil from a digital output that can source only 5mA. That would require Hfe of 1A / 5mA = 200, but I can't find a transistor with that much gain. Is there any transistor that would fit, or is there something else I can do? AI: Apparently you are asking how to find a transistor that can be used for switching 1A from a 5mA digital signal? 1A / 5mA = 200, which is the gain required if a single bipolar transistor were used. That's unrealistically high for a transistor that can handle 1A. You don't say what the voltage is, but that would be useful to know. Lower voltage transistors can be made with higher gain. In any case, this is too much for a single BJT. That leaves a few obvious options: Use a FET. Those are switched with voltage instead of current. Again, you don't say what voltage you need to switch, but you can get FETs up to 30V or so that can be switched well enough directly from a 0-5V digital logic output. You have now added that the supply for the stepper drive is 12V. In that case, here is a example circuit: The resistor is only to make sure the FET is off if the digital output should ever go to high impedance. If it's always being solidly driven and startup glitches don't matter, then you can leave off R1. Use more than one transistor to get higher gain. For example: The total gain from the logic signal current to the switched current is roughly the product of the gains of Q1 and Q2. Q2 can be counted on to have a gain of 15 in this case. Since you want to switch 1A, that means it needs 1A/15 = 67mA base current. R1 sees 5V minus the B-E drops of both transistors, which leaves about 3.6V. That divided by 36Ω causes about 100mA base current, which leaves some comfortable margin. R2 makes sure that Q2 is off unless explicitly driven on, and also helps turn it off faster. Assuming 700mV B-E drop, R2 will draw 700µA when Q2 is being driven on. Since we have 100mA available and only need 2/3 of that, that still leaves plenty of base drive for Q2. The current thru Q1 will be about 100mA when on. Such a small signal low voltage transistor can be counted on for a gain of 50 in this case, which means the 0-5V digital output only needs to provide 2mA, which is well within your spec. Added in response to 4 comments: You are switching something with significant inductance. Inductor current can not turn off instantly. Without the diode, when turned off the inductor would raise the voltage on P1 until it's existing current can flow - somehow somewhere. That would probably be by exceeding the maximum collector voltage of Q2 and causing it to break down. That is bad. The diode provides a nice safe path for this current until the stored energy in the inductor is dissipated. It does have a downside in that the stepper coil current will decay slowly after the coil is switched off. This can be dealt with by turning the coil off a bit early, and/or adding a resistor in series with the diode so that the coil sees a higher back voltage, which ramps down the current more quickly. Note that Q2 then must be rated to withstand the supply voltage plus this additional voltage. I would not use a darlington transistor. Yes, those can be found with the necessary overall gain, but they will also have significantly higher on voltage. That will not only take away a little bit of drive voltage from the stepper coil, but it will also cause higher power dissipation in the transistor. The circuit I showed is almost a darlington except that the collector of Q1 is tied to the 5V supply instead of the collector of Q2. That allows Q2 to fully saturate. That will be at less than half the voltage drop of a true darlington.
H: What type of 8-pin ribbon cable connector is this? What type of ribbon cable connector is this in the picture below? I would like to order a compatible male end for a converter plug I am designing. Edit: The pin spacing (as measured with a digital caliper, by averaging the inside and outside measurements of two pins) is approximately 0.1", so I think the Molex KK is correct. For the curious, this is from an OWI robotic arm kit. AI: The connector on the PCB is a MOLEX KK Series HEADER, SQUARE PIN, 0.1", 8WAY and the one on the cable is a MOLEX KK Series CRIMP HOUSING, 0.1", 8WAY. So in order to make a compatible male end, you'll need to get a 8-pin crimp housing (The picture from Farnell isn't accurate, as it shows a connector with only 5 pins) and connect the other end of your cable to it with the help of a 8 x Crimp Contacts. And on the converter's PCB you'll have to solder an 8-pin Molex Header. Here's a video tutorial on how to make a Molex KK crimp connector.
H: 3.3v to 5v Translation I'm in a bit of a pickle here. I need to translate 3.3v to 5v ttl levels. The devices I'm driving (12 total) are not low current devices so I don't want to interface directly, even with a current limiting resistor. This is a reference design that I plan on selling and I want it to be as fault tolerant as possible. My first pass was just to add 100Ohm resistors across each output from the microprocessor (3.3v output). I'm rethinking that however and I was looking at voltage translation. The two techniques that look most promising for me is either a pass through transistor interface using a MOSFET such as bs170 and the other is to use a dedicated chip such as the TXB0108 voltage translator. Here is my conundrum. I really want to keep the cost of these boards down. I've sourced the mosfets at mouser for about .25$ each when buying in lots of 100. The voltage translator ic's are a bit more expensive at about 4 bucks each, when bought in large lots. My biggest issue is I only need 12 pins to be translated so it seems on the second IC I would be wasting 4 pins. The mosfets are going to cost about 3 bucks per board (way less than the IC's) with a couple of resistors it brings up to 3.10 or so. So, that cuts my BOM cost by about 6 bucks, but my issue is the space on the board. Those 12 mosfets (and accompaning resistors) take up WAY more room than the two ICs (which take no external components). TLDR; Does anyone know of another (cheaper and less room) than the two methods I mentioned above? I need to translate 3.3v up to 5v. It will only be output since the signal is unidirectional (always 3.3v -> 5v). AI: Since you are translating from a 3.3 V source to a 5 V destination, and you specified TTL levels, you may in fact not need any translation circuit at all. TTL circuits switch at around 0.8 V, and only expect 2.0 V nominal for a high level input. So if your micro can generate 2.0 V it will be able to fully switch a standard 5 V TTL input. If you need to provide more current than your micro can source, then you should be able to use any 5 V TTL buffer chip. For example, the octal buffer 74LS244, which findchips shows in the USD 0.60 range at qty 100. If you really don't trust your micro to produce 2 V output when high, or if you aren't completely sure the downstream device use true TTL levels, and you don't need an exceptionally fast switching, you can use an open-drain output buffer like 74LVC07A as a translator. The chip can be powered by 3.3 V, but its output high level is controlled by an external pull-up voltage, for which you'd use 5 V. These are 6 channels per chip, and they're less than USD 0.25 each at the quantities your talking about.
H: GND/Vss of 2 circuits with independent power supplies, and usage of scope/logic-analyzer Probably an elementary electronics question. If I would like to trace waveforms from 2 different circuits with independent power supplies, s.a. an RF transmitter which uses a 9V battery and the RF receiver which uses a wallwart (regulated) supply. I want to observe the transmit & receive pins together, but what do I do about GND ? Should I connect the GND probe of my logic-analyzer to one of the 2 circuits or to both -- how ? AI: You need to connect your logic GND probe to the ground of both circuits. This also means that both circuits will have their grounds connected, but in this case it's okay as one is powered by a battery and is completely independent (relative to mains/wall wart) You couldn't do this if one of the circuits had a ground reference higher/lower relative to the other's (or indeed if either of the circuits have a different ground reference to the logic probe GND) Remember that voltage is always relative between two points. This means you can never say something is just e.g. "5V", rather "5V relative to x". In practice we often just say "5V" as we assume that the reference point is known. This means that the reference point (usually the point we call "circuit ground", or "0V") can be different relative to another and still be called "0V". This does not have to be the earth (i.e. the stuff we stand on), or "safety ground" - obviously battery powered circuits have a circuit ground which is (usually) not connected to the earth. I tried to find a decent reference that explains all this better than I can but I couldn't come up with a satisfactory one. I'll maybe add some more later if time permits - the basic answer though is yes, you need the GND probe connected to both circuit grounds (i.e all connected together) EDIT - Here is some more to try and make things a bit clearer: I threw together a simple circuit which roughly corresponds to the setup in the question: V2/Rx_Circuit represents the Rx circuit and output, and V1/Tx_Circuit represent the Tx_circuit and output. V_noise and Cpar/Cap2 represent typical mains coupling from surrounding power leads, etc. Notice the probe ground lead is connected to the Rx circuit ground, but not the Tx circuit ground. So what happens if we try to probe the Tx Circuit output? We can see the probe tip is attached to the output - here are the simulation results: What we can see is the mains noise capacitvely coupled onto the Tx circuit output, along with a bit of the Tx output. The Tx output is 1KHz a square wave set at 3.3V, so obviously this is no good. Out of interest to see how accurate the simulation was, I grabbed a battery powered proto with a 3V square wave output at around 1kHz which (very) conveniently happened to be sitting on my desk, and ran the test for real. All I did was attach the scope tip (set to x1 so it has the same 1 Megaohm impedance as the sim) to the output, but not the ground lead. Here is a picture of the result: For such a rough SPICE simulation which does not allow for many factors, it doesn't seem to be too far off (V/div is 50mV, so the signal is ~200mV pk/pk) The way to fix this is obviously to connect the probe ground lead to the Tx circuit ground so there is a low impedance return path (a circuit always has a current loop) Without it there is only the capacitive coupling which will only let high frequencies through .This is why the 3.3V Tx_signal comes through as strongly as the much higher voltage mains, as the rise time of the square wave is much faster than the slow 60Hz mains. It's worth experimenting in SPICE and real life with things like this till you get the idea of what's really going on. Most schematics don't include things like parasitic capacitances/inductances/resistances which can throw a spanner in the works if you are not prepared for them.
H: Getting 1.2V from USB I have FIIO E3 headphones amplifier which is powered by 1.5V AAA battery. Am I using it just with my PC, so I got an idea: why don't I power it using USB port and stop buying new batteries ? Anyway, I have few questions regarding that: 1) I know that USB port can give 500mA, but somewhere I've read that you can get only 100mA without enumeration. Is that true ? 2) Will 100mA be enough for replacing 1.5V AAA battery ? What is the maximum current that 1.5V AAA battery can give ? 3) Let's say that 100mA is enough. Now I need to build something :) I've thought about using LM317T. In it's datasheet, there's a foruma like this: Vout = 1.25V*(1+R2/R1)+Iajd(R2). If I'm reading the datasheet correctly, Iadj will be really small, so I don't have to worry about that. R1 is fixed at 240 ohms. So I only need to worry about R2. After calculating, it should be around 50 ohms. Or did I do something wrong ? 4) If I get 100mA @ 5V, is it true that I can get about 300mA @ 1.5V ? I don't know why this could be right or not, so I'm sorry if I've said something really stupid :) Thanks for your help !!!! AI: 1) Typically yes, but USB hosts are sometimes very loosely implemented. I've got a cheap Sweex USB hub which doesn't do anything when I short circuit the +5V USB power.. 2) Depends on the headphones and the amplifier. You can probably figure out how much it could take to look at the maximum power, and divide it by the 1.5Volts. It's probably a maximum with maximum decibels. I don't know the exact limits of a AA battery, but if you got a 2200mAh battery, I would say they should be able to deliver 2.2Amps (1C discharge rate). 3&4) A LM317T is a simple solution. It dissipates the 'left over' volts into heat. So if the input to output difference is 3,5V at 100mA, it will dissipate 100mA*3.5V=350mW. Note that if you take 100mA at 1.5V, it will also take about 100mA at 5V. This also means that theoretically you can only power up to 100mA @ 1.5V. If you assume that the enumeration thing is not a problem, it would be 500mA @ 1.5V. So, question 4: no, if you want that you need a switch mode power supply (SMPS). A linear supply (like a LM317) will have Current in = Current out, (leaving quiescent current out for now). The switching power supply will try to be Power in = Power out (without it's efficiency taken into account). So 5V 1A could be 2.5V 2A, 1.2 4.166A, as they all equal 5W. If you take into account an efficiency of 80%, you would probably see something more like 1.2 3A or something. A SMPS is more complex to build up as it needs a inductor and a flyback diode. Also note that it may create a hum in the sound if the switching frequencies would 'leak' into your audio signal. So I think it's best to see if a LM317 is capable of powering your circuit. @xsari3x: A current mirror is not used to deliver power. It's used to bias transistor amplifiers within opamps or other signal amplifiers. Furthermore, those outputs are constant current , where we need a constant voltage output here.