text
stringlengths
83
79.5k
H: How do contact type tachometers work? In case of contact type tachometers we put the tip into a small hole in the rotating body. Sometimes there is a disc in the tachometer shaft that we touch with the surface of the rotating body. What is the science and logic behind this? The picture attached below elaborates it. Type1 Type2 AI: The tachometer measures the rate of rotation of its shaft. Common technologies for doing this are magnetic or optical. Both of these methods produce pulses at a frequency proportional to the rotation rate.In the magnetic type, pole pieces induce pulses in a coil. In the optical type there is a disk with fingers or lines which cause the light received by an opto transistor (or diode) to vary as the disk rotates. If the shaft of the tachometer is held against the end of the rotating shaft, then the tachometer will rotate at the same speed at the shaft being measured. If there is a disk on the tachometer shaft and the outside of this disk is held against the outside of the rotating body then the tachometer will rotate at a speed of V * Cb / Ct, where V is the rotational velocity of the rotating body, Cb is the circumference of the rotating body and Ct is the circumference of the disk on the tachometer, therefore the reading on the tachometer will have to be multiplied by Ct / Cb to obtain the speed of the rotating body.
H: External gate resistor calculation I am trying to find external gate resistance value for my MOSFET. Here are some details: I am using IRFP4468PbF power hexfet mosfet - Datasheet 80V, 500mA, 3-Phase MOSFET Driver - Datasheet I had worked out through some formula and found that I=0.77A (using I= Qg/ Dt), T= 702ns ( using ton + toff = T) so f = 1.4 Mhz Qg = 540nC so Cg = 45nC (using Cg = Qg/V) V= 12V P(power dissipation)= 9.072 watts ( using Cg x Vdd^2 x f) Now when I find the resistance, I got value 15ohms ( which I dont feel its correct) After reading couple of things online. I thought that it should be around 0.15 - 0.45. So I want to know where I am going wrong and what is right. AI: Usually, you don't want much of a gate resistor when you're using a driver IC. Think about it. The resistor limits the current into the gate. The purpose of the gate driver is to push a bunch of current into the gate to turn it on faster. The two work against each other. I would start off with a set of pads populated with a \$ 0 \Omega\$ resistor. If you run into ringing during testing, you can swap out the \$ 0 \Omega\$ for \$ 10-100 \Omega\$ to increase the damping coefficient. It's hard to model and calculate this stuff with all the parasitics involved. There is no substitute for good testing in the application.
H: Extending solder only PCB pins What is the recommended way to make solid connections to the pins below? Can the soldering be avoided, and if not, what component should be used to provide the plug/unplug connection? AI: Thanks all the guys that commented. There seems not to be a solution that doesn't include soldering. There are some suggestions to use PCB edge connectors but those would not be a solution if the pins are located in the middle of the PCB. The component name to use is an "smd pin header". Example
H: Convert TTL levels to RS232 of FTDI USB<->Serial Have this small interface FTDI FT232RL to connect a Serial device to the computer via USB. It has been working well for most of my Serial applications, except today when I tried to use it for a Roboteq controller. While all settings are correct, characters are garbage. The support tells me the FTDI device use TTL levels (0~3.3/5V) instead of RS232 (-9~+9V). Which seems to be unfortunately correct according to the FTDI doc. Question Is there a simple way to have this FTDI device consider RS232 levels, not TTL? (eg like shorting a couple of pins) The Roboteq device doesn't seem to be configurable in this regard. AI: If you want to talk over USB it would be far faster and easier to just buy one of the many USB->RS232 converter cables than to mess around making that into one. I've seen them for as low as $7 USD online. There are even cables with the FTDI chips in them so if you've been using the D2XX library you can continue doing so.
H: What makes E-bomb or Electromagnetic pulse (EMP) destructive? wikipedia says that Electromagnetic pulse As with any electromagnetic signal, EMP energy may be transferred in any of four forms: Electric field Magnetic field Electromagnetic radiation Electrical conduction https://en.wikipedia.org/wiki/Electromagnetic_pulse I know that the four forms of energy are around us and we use them in our daily life, For example: Electrical conduction are used in transformers and we use Electromagnetic radiation to listen to our radio stations and TV shows. They are not destructive for electronic devices. So: What makes an E-bomb destructive? I believe it may affect signals for a short time and then all electronic devices will work properly again. As for my second question: How can it achieve a very wide range (big radios) of damaged electronic devices? How can it damage all the devices of a town or big area? Note: I ask this question because I'm curious and just to learn, I don't want to destroy and thing :) AI: The reason such a pulse is so destructive is because it has a broad frequency range, and can therefore affect things with a wide range of physical dimensions, and the large amplitude of the pulse. Every bit of conducting material acts like a antenna. In normal experience here on earth, ambient RF radiation is so low that the resulting currents and voltages in those conducting materials is so low as to cause no harm. In fact they are so low that radios deliberately intended to pick up these signals have to amplify them to get to useful levels. The resulting voltages and currents are proportional to the strength of the field that causes them. Some level of voltage and current will damage something, so therefore some level of field strength will cause damage. This is a several orders of magnitude more than what we normally experience here, but that's exactly what the right type of nuclear bomb can produce. If a circuit is intended to work with the microamp signals coming from a antenna, it should be no stretch to imagine that amps can damage something. This is not as far fetched as it may seem. Large coronal mass ejections from the sun have taken out sections of the power grid before. In this case, the power lines are really long antennas, and the fields caused by the movement of so many charged particles caused enough excess current to trip breakers in the system.
H: RTD Sensor Datasheet Details I need to read one type of rtd sensor using linked datasheet(page5) but as far as i know there must be a temperature vs resistance table. Am i missing something or given datas are enough to read temperature. I will use 1 ma constant current. Thanks. http://www.jumo.de/attachments/JUMO/attachmentdownload?id=3404&filename=t90.6121en.pdf AI: The resistance is 1000\$\Omega\$ at 0°C. The sensors follow the DIN IEC-751 (European) RTD curve with \$\alpha\$ = 0.385 so at 100°C the resistance is 1385\$\Omega\$. You can either look up the table from various sources*, use the Callendar VanDusen equation to calculate R(T), or use the polynomial as described in the ITS-90 temperature standard. *If the table is given for a Pt100 sensor, just multiply the numbers by 10 for Pt1000. All DIN type platinum RTD sensors should follow the exact same curve, within the specified tolerances- that's a huge advantage of such sensors- they are interchangeable between sensors and between manufacturers of such sensors. Edit: Here is the Callendar VandDusen equation implementation for a DIN RTD: double cvd(double t, double R0) { double A = 3.908E-3; double B = -5.775E-7; double C = -4.183E-12; return R0 * (1 + A *t + B * pow(t,2) + (t - 100)* C* pow(t,3)); } t is the temperature (Kelvin) R0 is the resistance at 0°C That results in the following results from 0..100°C For T = 0.00 R = 1000.00 For T = 10.00 R = 1039.02 For T = 20.00 R = 1077.93 For T = 30.00 R = 1116.73 For T = 40.00 R = 1155.41 For T = 50.00 R = 1193.98 For T = 60.00 R = 1232.44 For T = 70.00 R = 1270.77 For T = 80.00 R = 1308.99 For T = 90.00 R = 1347.07 For T = 100.00 R = 1385.02 By the way, 1mA is a relatively large current for a Pt1000 RTD. You should check that self heating is not an issue.
H: A question on voltage divider resistances used in BJT biasing I'm reading a text on BJT common collector amplifier biasing. Text says: The voltage divider (R1 and R2) is used to give the input signal (after passing through the capacitor) a positive dc level or operating point (known as the quiescent point). The actual sizes of R2 and R1 should be such that their parallel resistance is less than or equal to one-tenth the dc (quiescent) input resistance at the base (this prevents the voltage divider’s output voltage from lowering under loading conditions): What does that mean? I don't understand why R2 and R1 parallel resistance should be less than or equal to one-tenth the dc? What does loading mean here? AI: The voltage divider R1 and R2, disconnected from the transistor, would define a voltage (5V) which you want to use as the base voltage. Loading that voltage divider by connecting another resistor in parallel with R2 will reduce that voltage. In the days when resistors were 10% tolerance, that voltage would only be accurate to within typically 10% anyway, so a 10% error due to the additional load was (and still usually is) considered acceptable. So, what additional resistance, connected across R2, will change the voltage by 10%? (Thevenin circuit, Ohm's law). (You do not add this load explicitly, this is the load added by the transistor's base.) Does the input resistance of the transistor circuit equal or exceed that value? (Re, and the tranistor's current gain)
H: Can superimposed (combined) wireless signals create a health hazard? Not to sound all tin-foil-hat-like but I'm learning about wireless signals and am trying to understand it better. So my question is: When multiple wireless signals are transmitted at the same time on different frequencies, they end up getting superimposed or combined together to create the field that travels through the air. So if I had two signals at different frequencies whose amplitudes varied between 1 and 0, the combined signal in the air could have an amplitude greater than any signal by itself (In this case, the signal in the air could have an amplitude greater than 1). Wouldn't that mean if you had a lot of normally harmless wireless devices (say cell phones or wifi routers) in a given area that you could create a region that is no longer safe since each small harmless signal has combined to create a higher powered dangerous one? Update to add more context: Outside of even standing waves, if I look at an image like the one linked below, I see points where the red, blue, and green waves are all positive and close to their peaks creating a combined amplitude of around 2.5 times that of any wave by itself. While I can certainly see some waves canceling out because they are negative when another is positive, with the hundreds or thousands of wireless devices saturating an area, wouldn't we still have some decent amount summing to create a much higher level of energy transmission? Or is it simply the power transmitted by these devices is just so low that even with say a thousand devices summing together, it's irrelevant? link AI: This is what happens when you have a standing wave combining with itself in a microwave to produce a "hot spot". However, that requires: very powerful transmitter (800W microwave vs 2W cell phone or 0.25W wifi) confined spaces into which all that power goes stationary transmitter and reflectors continuous transmission (both phones and wifi transmit in bursts) So if you take a bunch of low power devices which deliberately try not to transmit at the same time (like cell phones and wifi), and put them in a not-radio-tight space where they're not exactly stationary, then you're never going to get a powerful constructive interference spot. I don't think you could make it happen even deliberately with micro-metre precision positioning of the devices.
H: Minimum design for controlling 2 LEDs to light either one or both? I am an absolute beginner in electronics. So far I have created a circuit with 2 LEDs and 2 SPST pushbuttons, each controlling a different LED. Very simple, you should get the idea without me drawing a circuit. I've been trying to figure out how to add a third pushbutton, which would control both two LEDs at the same time, without altering the functionality of the two existing two pushbuttons. Is it even possible to achieve this with 3 SPST pushbuttons, without adding any other components? If not, I am interested in learning what would be the simplest design to achieve this. Thank you. AI: No. Without adding extra components (Diodes) you can not use SPST buttons. simulate this circuit – Schematic created using CircuitLab If you use a DPST or DPDT switch instead, quite easy to find, you can avoid the diodes. You would ignore the extra pins on the DPDT switch. simulate this circuit
H: Loop current of the loop containing a current source I am currently studying circuit analysis methods and there is one thing regarding the Loop Current Method I do not fully understand. Let us take a look on the loop current sketched below: As far as I understand, in this method we will assign each loop a uniform current and then calculate the overall voltage drop in each of the loops. What I do not understand is: why does the loop current of a loop containing a current source have to be equal to that particular current. In this example, we must say that IL1 = Ig. I understand that the current source will maintain a constant current between the two nodes it was connected to and that the voltage between those nodes does not depend on the current, that is, does not satisfy the equation U = RI, but why couldn't the expression for this loop current be: 0 + IL2*R4 + (R4+R5)IL1 = 0 assuming that the upper loop is IL3 and the bottom left one IL2 (IL1 and IL2 go through the resistor R4 in the same direction). The zero on the left hand side comes from the fact that there are no mutual resistors for loops 1 and 3, and the one on the right side is there because there are no voltage sources in loop 1. EDIT: The first step I did was to create a circuit tree (if that is how it is called), by merging every node in the circuit without making a loop. Also, the branch containing the current source must not be included in the tree. Every loop consisting of the branches that are included in the tree and only one branch that isn't is an independent loop. There are multiple ways of making a circuit tree, this is only one of them. AI: It is true that the voltage between the two nodes does not depend on the current, but that does not mean it is zero. Your equation needs a term for the voltage across the current source: $$V_{23}+I_{L2}*R_4+(R_4+R_5)I_{L1}=0$$ However, you don't know V_23, so all you've done is introduce another variable. Instead you should use the behavior of the current source to say that $$I_{L1}-I_{L3}=I_g=10mA$$ this and two loop equations will let you solve it. Another way to do this is redraw your loops, you can leave L1 and L2 as they are, and draw L3 around the entire circuit. This way only L1 goes through the current source and you immediately know its value, leaving only two to solve for.
H: Why float data type is not accurate on a STM32? I'm using STM32F103C8T6 and my compiler is KEIL 5. I have written a simple program to check something but I found out an interesting point. When I download the program to the MCU, aaa and bbb have to be 12.56 and 62.8, but when I debug the program on the MCU, the initial values of these variables becomes these: aaa=12.5600004 and bbb=62.8000031. the program: #include "stm32f10x.h" float aaa=12.56,bbb; int main(void) { bbb=aaa*5; while(1){} } Also keep in mind if I change float to double, it works without problem. AI: Floating point numbers are represented as a sum of binary fractions times a power of two. In single-precision IEEE-754 floating point numbers, the fractions range from \$1/{2^0}\$ to \$1/2^{23}\$ and the powers of two range from \$2^{-126}\$ to \$2^{127}\$. For example: $$12 = \left(\frac 1 1 + \frac 1 2\right) \cdot 2^3 = 1.5 \cdot 8 = 12$$ $$0.5 = \left(\frac 1 1\right) \cdot 2^{-1} = 1 \cdot \frac 1 2 = 0.5$$ $$12.5 = \left(\frac 1 1 + \frac 1 2 + \frac 1 {16}\right) \cdot 2^3 = 1.5625 \cdot 8 = 12.5$$ $$62 = \left(\frac 1 1 + \frac 1 2 + \frac 1 4 + \frac 1 8 + \frac 1 {16}\right) \cdot 2^5 = 1.9375 \cdot 32 = 62$$ But 0.06 and 0.8 cannot be evenly represented in this way, just as \$1/3\$ cannot be represented as a sum of decimal fractions: $$\frac 1 3 \approx \left(\frac 3 {10} + \frac 3 {100} + \frac 3 {1000} + \frac 3 {10000} + \cdots \right) \approx 0.33333\dots$$ $$0.06 \approx \left(\frac 1 1 + \frac 1 2 + \frac 1 4 + \frac 1 8 + \frac 1 {32} + \frac 1 {128} + \frac 1 {256} + \frac 1 {512} + \frac 1 {16384} + \frac 1 {65536} + \frac 1 {1048576} + \frac 1 {2097152} + \frac 1 {4194304} + \frac 1 {8388608}\right) \cdot 2^{-5} \approx 1.91999995708465576171875 \cdot \frac 1 {32} \approx 0.0599999986588954925537109375$$ The decimal representations may vary from system to system. I'm not going to spend a lot of time writing out more examples, because hopefully you get the idea by now. The important thing is that floating point numbers are binary rational numbers, even though you put decimal rational numbers into your source code! Floating point numbers are intended to be approximate. If you need to represent exact values, use integers or another alternative. If you don't know whether you need floating point, you probably don't. For more information, I've found the Floating Point Guide to be easier to read than Goldberg's essay, but both are valuable.
H: The diode and the relay question Do I need to use a diode with the following setup ? What i want to do is activate a relay which then closes the positive side of a nema 5-15 portable receptacle and allows electricity to flow. When a switch is pressed . My aim is to avoid having to come into contact with the AC and use relay do it . The receptacle I'm using is similar to the leviton Snap-In Single Receptacle Outlet Black 1374-1. My setup consists of using a 12 volt battery to drive an Inverter and then using the Leviton 1374-1 as as the receptacle. I want to use the following wireless relay to act as the AC switch : OrangeTag Wireless relay . This will be used between the Leviton 1374-1 and the inverter . I've read about issues concerning relays damaging connected devices due to voltage spikes when the power source is removed and want to know if I need a diode to protect against this issue ? if so where do I connect the diode on the relay ? The diagrams Ive seen appear to to connect the diode across the pos/ neg points of the relay which in my mind means a short circuit What am I missing ? AI: The damage you are thinking of is due to the voltage spike caused by the inductance of the relay coil when it is turned off (V=L*dI/dt). Since the relays are part of a complete package and the coils are controlled by a wireless receiver, that issue does not apply to you. You can even see one of the protective diodes in the picture of the relay module, it's the little horizontal black cylinder with silver at one end, between the capacitors (big silver-topped cylinders) and relays (blue boxes). However, I don't think that relay module is appropriate for your purposes because it is labelled as "momentary", which means the relay (and therefore your receptacle) will be on only while you hold down the radio button. You could, however, use the momentary relays to turn an additional latching relay on and off. I'll leave you to google up schematics for doing a latching relay.
H: Should I use an LP2953 to power an ATTiny85 with a 12v battery? Like a lot of people I'm building a little transmitter unit with one of those cheap 433mhz transmitters and an ATTiny85, and I am having a problem with the power supply. Actually it is only the power supply, everything else works nicely. But my battery is dead my morning, where 'dead' means under 4v and the circuit no longer works. I initially tried with three AA batteries to power both RF and ATTiny. That worked but the range was not as good as I need. I got about 30m using 17cm whip antennae on both transmitter and receiver. That doesn't reach my letter box :) Moving the voltage on the transmitter up to 12v did wonders for the range, but the ATTiny doesn't like more than 5.5v so I put a 7805 and some caps in there (the caps improved the range too) and ran the transmitter directly from the battery and the ATTiny from the 5v battery. That worked really well. But that sucks the battery, which is my current problem. The battery I'm using is a 23A, about an inch long, alkaline 12v. It keeps the device quite small. What I am looking at next is using an LP2953 pretty much like this (from the data sheet): I would delete the 'out of regulation' but keep the 'low batt' signal if I can, I had that working on the earlier 4.5v AA version of this. I think it means I need to change the voltage divider on the left. What I've read is that the LP2953 ought to be smarter about sucking battery, though I also notice in the data sheet they recommend hooking the designated pins to a copper base on the PCB, so if it is dissipating heat that means it is still sucking my battery isn't it? This guy used a CR2032 but that only gives 3v, not enough range for my application. This guy has a slightly similar question which has an answer (from me!) but not to this question. Given this is my third try at powering this thing any advice is appreciated. The receiver end has another ATTiny85 hooked up to a Beaglebone and that all works nicely. AI: Unfortunately a linear regulator is a linear regulator - it drops the excess voltage and dissipates power as heat ... so just like the 7805 you had, the LP2953 is still a linear regulator. 12V in to 5V out makes it never much more than about 40% efficient, so however much power your ATTiny is using - 1.5x that is being wasted as heat in the regulator. You could improve the regulator efficiency and reduce wastage significantly by using a DC-DC switch-mode regulator instead. They're more complicated to build from scratch, but ready-made modules are available - some are even drop-in replacements for the 3-pin 78xx linear regulators. Chose the right one and you should easily get 80% or better efficiency from it.
H: SPICE Programs worth learning for I was wondering what are the professional SPICE programs for simulating analog circuits in the industry now. For example, where the big companies like Atmel simulate their microcontrollers, or a company like Texas Instruments simulates their op amp design. Also, which programs you would suggest to an electrical and electronics engineering student to learn for analog circuit design bearing transistors that make him ready for professional life. I would be glad if people with experience answer this question. Thank you. AI: Many large semiconductor companies have in-house developed and enhanced versions of SPICE -- e.g. see in-house SPICE. These typically support the more complex needs of high performance and high volume IC designs. Other companies frequently just use the simulator that comes with their EDA tools. Enhancements to SPICE might include support for specialized device models, significantly higher speed and new algorithms for convergence, large circuits or new simulation options.
H: Common way of describing a "double-sided wait" Is there a commonly used name to describe a "double-sided wait" data transfer protocol? This is a uni-directional scheme in which data is transferred on the clock edge if both the sender and the receiver (alternatively called producer and consumer) indicate that they are ready for the transfer by asserting a corresponding ready signal. If only one side is ready for the transmission, it normally must enter a wait state. "A Double-Sided Wait" is the title of a section describing this scheme in the book "Logic Design and Verification Using SystemVerilog" by Donald Thomas, but I don't find that name used elsewhere. I believe that this is a very commonly used transaction protocol, but I don't know where to look for additional descriptive text on the topic -- or how to refer to it when trying to communicate about it. AI: One example of such a bus is the AXI bus, which originated with the ARM processor, but is increasingly being used as a standard interface for FPGA IP in general. The two handshake signals are called TREADY and TVALID, and transfers only occur when both signals are asserted. I don't know if there is a "standard" name for this protocol. On occasion, I have referred to it as "ready-enable" protocol in my own designs. The more generic concept is "flow control", and there are many protocols that are used to implement flow control in various circumstances. The IEEE1284 printer protocol that somebody mentioned is an example of a 2-wire, 4-edge handshake that is often used for asynchronous communication at slower speeds. I have occasionally used such a protocol to transfer low-bandwidth data between clock domains inside an FPGA. For higher-bandwidth transfers among clock domains, an asynchronous FIFO is often used, and its full/empty status signals become the flow control signals to the logic on both sides — and this is a very close fit with the TVALID/TREADY protocol of the AXI bus.
H: Need 300mA current to drive a transducer I am working on a project in which I need to use a preloaded value to vibrate a transducer. So loaded required values into Arduino Uno, converted into analog values using R-2R DAC and buffered values using ua741, all should work in 5 volts. Now the problem comes: I need around 300mA current to drive the transducer (resistance is 10-20 ohms) can you please suggest me a transistor (preferably BJT) which gives particular current in 5 Volts power supply? AI: simulate this circuit – Schematic created using CircuitLab TIP31 seems a good choice, but the 741 is going to need more than 5V for its supply.
H: 60hz Astable 555 timer circuit not oscillating Yet another electronics newbie here :) I have tried to construct a simple 60Hz oscillator using a NE555 timer in astable mode, yet it does not seem to be oscillating. To test it, it has been connected to a speaker as I do not have access to an oscilloscope or any other fancy test equipment. R1 and R2 are 10 and 47 ohms, and C is 220uF. According to my own calculations and to online calculators this should give a frequency of ~63Hz. I have tried the circuit using other resistor values - all of which work - but do not give the desired 60Hz. simulate this circuit – Schematic created using CircuitLab AI: the top end of R1 should connect to 5V, replace c3 with a wire. all the resistors should be 10 times higher. those values are pushing the limits, make the capacitor C1 10 times smaller to compensate for the increased resistors.
H: Why is the Tach output on computer fan referenced to the VCC? I am working on an electronic field mill with a computer fan, and am following the design on this instructable. The arduino needs to know what rate the fan is spinning to know when the shutters are open and closed to measure e-field voltage. We are using the tach output on the motor to do so. When powering up the computer fan, I first tried to probe the device by placing the ground of the oscilloscope to the negative lead on the fan and the voltage probe to the tach output of the fan, but I only saw some spikes, no readable square wave. I only got this square wave when I placed the ground wire of the scope on the VCC wire of the motor and left the voltage probe on the tach output. Why is this output referenced to the input voltage, and will it still work with the arduino? If this is something not unique to only the fan I have, what is the reason for building the fan this way? AI: The tach output of a fan is open collector which means that it either pulls to ground or allow the line to float. The proper way to read it is to connect a pull-up resistor to high (maximum would be the voltage fed to the fan on the red lead), 4.7K or 10K ohms would be good. This way, when the output is floating, the resistor will pull it high. If you don't have some kind of pull-up, the line will never get much above zero volts. I only took a quick look at the instructable, but I'm assuming that they are programming the processor pin to be an input with weak pull-up enabled. Here's a reference on the fan I/Os: http://www.formfactors.org/developer/specs/REV1_2_Public.pdf
H: calculate uptime of LPC1768 i want to calculate the uptime of LPC 1768 from when it begins running. for example a function like millis(); in arduino. AI: I suggest that you setup a hardware timer that increments a counter every milisecond. By reading this value you will know your uptime.
H: Phase Locked Loop: Confusion in Lock Range For Phase locked loop (PLL), we can have two types of Phase Detectors (PD): Type-1 and Type-2. The Type-1 PD has an analogue multiplier (which is simply XOR for digital inputs) whose low pass filtered output is a signal which varies at a frequency equal to the difference between the input and Voltage Controlled Oscillator (VCO) frequency. The voltage v/s phase plot of such a PD looks like this: For this PD, the rising slope provides a negative feedback for the PLL loop but the falling slope provides a positive feedback. Why is that? And, as shown in the figure the PLL locks on the rising slope, so what parameters of PLL decide where on this slope the PLL would lock? Does it depend on the input frequency as well? The Type-2 PD has a digital circuitry of flip-flops whose output depends only on the relative time shift of the input edges and has the average voltage v/s phase characteristics as shown below: Why would a PLL with this type of PD not lock if the phase difference input to the PD is greater than \$2\pi\$? AI: Have you looked at the datasheet of the 4046 PLL ? The 4046 contains both types of PD. The type-1 PD implemented as an XOR outputs 0 when both it's input signals are equal and outputs a 1 when they are not. It cannot distinguish between both signals so it cannot detect if Fvco is too high or too low. It can only detect that it is "not the same" as Fin. At phase = π the signal inverts so at phase = π - delta the PD's output signal is the same as what it is at phase = π + delta. This explains the positive slope changing to a negative slope at phase = π. The input signal inverts but the XOR treats it the same way, it cannot do any better ! "Why would a PLL with this type of PD not lock if the phase difference input to the PD is greater than 2π?" Your assumption is wrong, it does lock. Let me explain: I give you two signals and a 4 channel oscilloscope. At t = 0 I provide you with 3 signals: signal A is a 1 kHz sinewave starting at phase = 0 signal B is a 1 kHz sinewave starting at phase = π signal C is a 1 kHz sinewave starting at phase = 10 π Now tell me which signal is which ! Think about it before reading any further ! The answer is that you can only tell me which is signal B. You cannot distinguish signals A and C because a sinewave repeats itself every 2π of the phase. Like you, a type-2 PD also cannot distinguish signals which are shifted by 2π so it will treat a phase of delta the same as a phase of delta + 2π or delta + 4π. That is why the graph only shows 0 to 2π, the graph repeats itself every 2π just like a sinewave. It can however distinguish a phase of π - delta from a phase of π + delta ! That is it's advantage over a type-1 PD. For a type-2 PD it is not the absolute phase that is locked, it is the modulo(2π) of that phase and that is OK as the signal repeats.
H: What is the general operating principle of an AC Electronic Load? I'm working my way through electromagnetics and in particular power (line) transformers at the moment. I'd like to be able to run tests of various kinds at different AC loads and possibly at different frequencies, say 10Hz-10kHz, to observe frequency response of cores and so on. It would need to emulate a resistive load, so for example 10A when the sine wave was at 10V and 1A when it was at 1V. I'm pretty familiar with DC Electronic loads and designed and built one for myself that performs nicely for my needs. Details in this question for anyone interested in that. I was inclined to do something along the same lines for an AC load. Unfortunately that doesn't seem to be a popular project and I'm finding a dearth as regards circuit ideas, general approaches, etc. The simplistic solutions like rectify to DC and then attach a DC load don't emulate a resistive load, you get current spikes of course at the top and bottom of the sinusoidal waveform and then dead zones in-between. The best I've been able to come up with in the DIY department is to run an incandescent or heater load (hair dryer, iron, etc.) off of a Variac, which would actually probably work fairly well; but I was kind of hoping for an all-electronic solution, dissipating the load in MOSFETs or something like that. I was able to find a commercial solution, this is one example: http://adaptivepower.com/English/Products/AC-DC-Loads/3A-Series.aspx There is no price quoted, nor is there for the others I found, so I'm taking that to mean: "If you have to ask, you can't afford it." :) Which is probably right. I'm not looking to spend thousands here, just get something decent that works, maybe make a nice project out of it. Can anyone explain in broad terms how this sort of thing works? I'm inclined to think it probably tracks the input voltage and somehow does the proportioning to track the right current value to the instantaneous voltage value of the sine wave (or perhaps other waveform too). Then from there perhaps it looks similar to a DC load, perhaps doubled, one for each "polarity" of the cycle. Maybe a peak detector that determines the peak voltage and then a variable amp that modulates the current regulating signal to follow the curve or something like that? AI: Your question and your suggested answer of the last paragraph. Yes, it tracks the input voltage and controls the current it consumes. The model you have shown can select from 'constant resistance' and 'constant current' controls, and IIRC 'constant power' (down to a min voltage) as well. Once there's a microcontroller in there to do fancy stuff like that, then it can simulate current draw into rectifier loads, harmonicy or pulsey loads as well. I have used a mains version of that pictured load at work. It's a fraction of the price of previously available alternatives, yet still much more than 1000 ($/£/Euro), and limited to mains-type frequencies, so obviously of no interest to you. You are nearly there with your rectified DC load. However, the fact that you say it only draws spikes of current at the peaks suggests that your rectifier has the standard big electrolytic capacitors in it. If you remove those, then the current distortion all but disappears, you will be able to draw current at all phases of the waveform for where the voltage is larger than your diode drops. The missing volt or two in the middle may be acceptable. Removing the caps from the 'power' supply means that you will need an additional 'control' power supply to do the voltage sensing and bias the current-drawing components. The frequency range of this method is not limited by transformers, or control laws buried in any PSU control chips. However, to go above a few hundred Hz, you must use appropriate rectifier diodes. The standard 1N540x series (and most 'mains' diode quads) are very slow, they manage mains frequencies and not much more. Buy 'fast' diodes to go much above mains frequencies. I have used the variac+lamp load method on the bench, and it works very well, although due to the variac it is limited to a small band of frequencies from mains to a few times mains. When building your load, use FETs as switches by all means, but don't dissipiate too much power in FETs in the linear mode, stay below 10% of rated power, while heatsinking well. The standard switching FET can only dissipate its rated power when switching between saturation and off. In the linear mode, the bias tempco of the FET's individual cells means they can 'unshare' current and burn out, even at relatively low powers. This concern is not the same as the sharing between multiple FETs, which in saturation share nicely. You can get 'linear rated' FETs (intended for audio amplifier output stages) but they are expensive and hard to find. Stick to using FETs to switch resistors, or <10% of rated dissipation, or BJTs. As a general rule, it is much more scalable if you can switch your power out to lamp loads, or the heater element of a fan heater (with the fan rigged to keep going). Then your dissipation is not limited by how large your box is. The old skool way of making AC loads was to lower some plate electrodes into an electrolyte bath. Under AC, the resistance of such a load will be more or less linear. Choose your electrolyte from 'clean' water to strong salt solution to control the range of conductivities available, and then the insertion depth of the plates for control. Power handling is of course excellent, into a large bath of water. A bit messy and not easy to miniaturise for bench use, and you need to vent off the small amount of hydrogen or chlorine produced to avoid hazards. A modern way of approximating to a resistive load would be to use a simple DC load fed from a power factor corrected PSU. It is only an approximation because while a PFC corrected PSU works to draw a 'resistive load' waveform, it is only designed to meet power quality regulations, not 'instrumentation' quality specifications, so it gives up tracking at relatively high phase voltages, and most controllers would only work at around mains frequencies. It's unlikely that this would work for you. Having given you all these alternatives, what exactly are you going to use the AC load for? If it's testing cores to see how hot they get while delivering power, then OK. If it's using a 'scope to look at their voltage and current waveforms, then you probably shouldn't use anything less perfect for the load than a real resistor, and if necessary, switched by real switches (or relays, or back-to-back saturated FETs). Otherwise, you'll see a wrinkle on the current trace, and then wonder whether that's a characteristic of the core, or your load misbehaving.
H: Angles and measurement - PCB design help I have started doing PCB design from last month and very new to this. I have done tiny bits on eagle cad and Altium cad but still learning things everyday. Now I got a challenging board to do. Though board is not complex but the measurements and angles has to be exact and not sure how to approach it. Please see the pic which got spiral pads. All are circular and has to be with correct measurements as mentioned on it. Also let me know which tool is best for doing these type of custom stuff. Hope some of you guys have experience here and might help me with good advice AI: I use Eagle. When I need to do things like this I write a program that generates a script. The program does the sines, cosines, and other math to determine the coordinates, then writes those into the script. This comes up often enough that I've created a generic host program module that has subroutines for writing coordinates in Eagle format, for writing whole WIRE commands, it's own 2D transforms, etc. This kind of thing is really not hard to do. Keep in mind that efficiency of the program is no issue. No matter what, it will complete instantaneously in human time. Write it for clarity and the ability to make changes to it. Often what you think you want at first will be a little different from what you actually want after looking at results, running DRC checks, and the like. Having a program that writes a script allows you to easily delete the whole mess on the board, re-run the program, and re-run the script to try something a little different. It will also be useful for the next rev of the board. If you did it all manually and things need to be a little different next rev, you have a lot of work to do it over.
H: Driving WS2811 LED strip from microcontroller I'm planning to drive the input of a WS2811 based LED strip (total approx 450 LEDs) from a microcontroller/arduino, as per the diagram below. Do I need a transistor, buffer or anything else between the microcontroller GPIO and the WS2811 DIN? Or can I safely hook it up directly? Also am I correct in reading from the WS2811 datasheet that even though the LED strip takes 12v, the WS2811 itself will run at 5v, and as a result the Din voltage should be at 5v too? AI: An ATmega pin will happily drive the WS2811 DIN pin, it expects 5V and unless you are driving an obscenely long cable between the ATmega and the first WS2811, you are fine with a direct connection. The LED strip power depends on how the strip is constructed, but is typically 12V; see the datasheet for examples of both 12V and 5V situations.
H: When to use a heatsink for a voltage regulator? Sometimes in small projects Im using voltage regulators with outputs 8V or 5V such as LM7805. Power is I*V but Im wondering when really a heatsink is needed. Sometimes the current flow from the regulator output is 1mA but in an other project 20mA or more. Is there a rule of thumb for when to concern about heating and considering to use a heatsink? Consider operating time is 12 hours. AI: My personal rule of thumb is that a TO-220 3-terminal linear regulator does not need a heatsink for less than 600mW (vertical mount). That's based on industrial service and high reliability so it's a conservative number. If it needs to be more than that then I do the calculations, and possibly even tests, and decide what's best. You can do a moderate copper pour and use a (surface mount) TO-252 and get better thermal performance than a TO-220 without a heatsink - often quoted at 65°C/W in air. That costs nothing except a bit of PCB area- no fasteners, assembly labor or heat sink costs to consider, no extra (secondary) operations and extra ways for assembly workers to screw things up. In my opinion, if you're close to needing a heat sink for a linear regulator it's time to at least consider a switching supply unless you have special requirements such as low EMI.
H: Multi-plex 8 BLDC motors using shift registers? I want to drive 8 tiny diskmotors - they look like low current motors. robotshop 2mm vibrating disks I want to drive perhaps 2 or three of them at a time with pulse-width modulation signals and I would like to do it from a single driver since they are uni-directional. This would assume the same pulse width for all activated motors. Assuming the current requirements are met by the driver; Question: Can I drive them all from one circuit with a shift registers or with a multi-plexer. If so, how? Is there a way to drive them with one motor driver that allows for variable pulse width as well? AI: Question: Can I drive them all from one circuit with a shift registers or with a multi-plexer. Yes If so, how? Use MOSFETs to connect individual motors (complete with reverse polarity protection diode) to a "bus" voltage. The "bus" is the PWM switching power source. The 8 mosfets need 8 control signals and if you are low on GPIO then a shift register would work fine. You might even be able to use one of these: - It's got four high side and four low side mosfet drivers and runs from SPI control. I'm also sure you can get a MOSFET equivalent of the ULN2003 octal open-collector driver. There's also the TPIC6C596 from TI: - It's got a serial input line with 8x 250mA rated MOSFETs.
H: Possible calculation error using current divider rule on a non ideal current source circuit I am going through my notes in preparation to an exam, the following was taken straight from the board as my lecturer wrote it. As far as im aware the current divider rule should be $$I1 = It * (Rt/R1)$$ However it is written here as $$I1 = It * (R2/Rt) $$ there must be something I am missing bit I cant figure it out. Any help would be very much appreciated. EDIT: This was the formula that I thought was valid across the board : - However Spehro Pefhany has shown this is not valid for all cases. AI: It's identical to the current divider rule shown in Wikipedia: Rt = 3K here (the resistor in parallel with the current source) Rx = 6K It = 9mA So \$ I_X = I_T \cdot \frac{R_T}{R_X+R_T} = 9ma\cdot \frac{3K}{3K + 6K} = 3mA\$
H: Any downside to using a charge pump for an op-amp negative supply Background: I'm often building audio op-amp circuits for various purposes, and for small projects usually prefer single "wall adapter" supply. So for a ground reference I'll either use a simple resistor pair with a capacitor, or better, a spare OP amp configured as a virtual ground, to make my 1/2V point point. But then there's the external ground referencing issue. Since there is only one supply, all ins and outs need blocking capacitors. If I use the "stronger" op-amp developed virtual ground, I can let that ground be the reference for all I/O, thus eliminating lots of capacitors. The downside there is that since ground is really 1/2V, doing this means I can forget about sharing the power supply with any other connected devices. But recently I've been toying with the idea of using a charge pump to create a V- supply, using a separate op amp package. Typically like this... This would then allow me to use one side of the single supply (negative in this case) as my reference ground again. And so in larger circuit where there are a LOT of ins and outs (perhaps an audio mixer), it would seem using a stand alone charge pump for my negative supply should eliminate the need for a great many capacitors on all the I/O points, and I'd still be able to share the power supply with other small circuits (provided they use a negative ground scheme). So my question is, is there any major downside I'm missing here? It would seem that as long s the circuits don't need to drive significant loads (that would pull at the V- supply), there might be a lot of advantages to this method. I know there is some issue because with the diode based charge pump, -V won't exactly equal +V. But there are ICs like the CMOS based TI LMC7660 which will do the charge pump function for me with a more accurate -V output and a lot fewer parts. Opinions? AI: Creating a negative supply from a positive one is OK but for audio you may want to use a negative linear regulator after it - this will remove any switching artefacts that might be heard on the audio. For an op-amp it's called power supply rejection: - This is for the fairly good OP4177 and what it tells you is that (say at 10kHz) the effect of noise from the negative rail is quite small at about 107 dB. This means that if you have 10 kHz ripple on the negative supply, it will become an interfering noise on your inputs that is about 251,000 times smaller. Clearly, if your circuit is low gain this isn't likely to become a noticeable problem. However, some switching circuits can generate ripple at (say) 1MHz and although this frequency cannot be heard (on the face of it) there could be a signal that is only 560 times lower at the inputs. Because it is at 1 MHz you can find that some op-amps will (due to their input circuits) demodulate this to baseband and you end up with a few back ground howls and whistles. So this is what you should be wary of and there's nothing as good as a real test.
H: question about transistor matching circuit I'm studying this transistor matching circuit provided initially by Bob Moog. I think I mostly understand how it works, the op amp, bjt not under test and resistors form a current source, which stays constant for each transistor Vbe is measured for. What I'm a bit unclear on is the purpose of the 10k between the two transistors in the NPN measuring circuit, and why it's not needed in the PNP measuring circuit. AI: The purpose of the resistor is probably to deal with "stuff happens". It's only dropping 1 volt, so the current sink still has about 4 V to work with. As you say though, it's not really needed, and can just as well be left off, as was done in the bottom schematic. This is one of those personal whims of the designer, and the fact that the same designer used it in one place but not in another shows how he was on the fence about it too. Personally, I would just leave it off.
H: Could a graphene battery / supercapacitor be used to power a railgun? new to this StackExchange, but I have a question about graphene batteries / supercapacitor. From my understanding, graphene batteries / supercapacitors (not sure of the difference?) are superior to regular acid-based batteries because they can hold much more energy and also charge and discharge very quickly. I have read that the one of the biggest roadblocks to creating an effective railgun is the lack of quick discharge capability of normal capacitors. Would using graphene materials potentially solve this issue, allowing a railgun to be built in a much smaller (possibly handheld?) package? Really, I'm just looking for information about how graphene could potentially impact the design and capabilities of railguns. Thanks all! AI: The problem with capacitors is not quick discharge capability, it is energy density, and particularly the energy density of types of capacitor that can discharge very quickly. There are apparently some batteries on the market that use graphene in their design. However, the use of graphene is a research area that some are claiming has great potential, not something that has a huge proven potential. I believe that there are superconductor-based inductive energy storage systems that have been installed, proven and currently offered for sale. However they are of the scale that would be transported on a large truck or rail car, not something that has potential for anything near hand-held. It is very doubtful that a useful hand-held rail-gun is any closer to reality than a nuclear fusion powered automobile. Added information about inductive energy storage The difficulty with small scale superconductor-based inductive energy storage systems is that there is a substantial balance of system (BOS). The BOS is all of the required components and equipment in addition to the basic energy storage component. Refrigeration equipment and insulation is required to get the superconductive material cold and keep it cold. There are also charging and discharging or energy transfer systems.
H: Voltage drop of a non-ideal voltage source I am having a problem with calculating the amount of current flowing through a branch, after deriving potential of its nodes using the Node Voltage Method. I understand how to calculate voltage drop on a resistor and the voltage of an ideal voltage source as well: The branch I am having problems with is sketched below: The current I2 should be equal to $$I_2 = \frac{U_{02}}{R_2} = \frac{(E_2-V_2)}{R_2}$$ but I do not understand why this would be the case. In the expression $$I_2 = \frac{U_{02}}{R_2}$$ I tried to calculate the voltage U02 the way I thought was correct: $$U_{02} = U_{0A} + U_{A2} = -E_2 + I_2R_2$$ substituting in the previous equation: $$I_2 =\frac{(-E_2 + I_2R_2)}{R_2}$$ If we multiply this with R2 we will get: $$I_2R_2 = -E_2 + I_2R_2$$ $$-E_2 = 0$$ ??? and if we don't substitute anything, but rather continue with the expression for U02 we get: $$U_{02} = U_{0A} + U_{A2} = -E_2 + I_2R_2$$ $$I_2 = \frac{U_{02}+E_2}{R_2}$$, which would bring us to the suggested solution if it was true that: $$U_{02} = V_0 - V_2 = -V_2$$ which shouldn't be the case, since the voltage between 0 and 2 isn't determined only by potential difference between the nodes, but also the voltage generator that contributes as well. I do not understand this at all and I feel like everything I've learned so far is not valid anymore. Things are literally making no sense. Where did I go wrong? EDIT: To rephrase and recap: How to calculate the current I2 (second sketch) if values R2, E2 and V2 are known (V0 = 0) ? AI: The current I2 should be equal to I2 = U02/R2 = (E2-V2)/R2, but I do not understand why this would be the case. This is not correct. The current through the resistor is determined by the voltage across the resistor. Since the resistor is not connected to node 0, then the voltage at node 0 has no role in determining the current through the resistor. If I understand your notation, you should have $$I_2 = \frac{V_A-V_2}{R_2} = \frac{U_{A2}}{R_2}$$
H: Disadvantages of Schmitt Trigger Inputs I'm familiar with the utilization of Schmitt Triggers when interfacing with low slew rate signals / sinusoidal waveforms. In a recent design, I've been scrubbing our FPGA I/O configurations and noticed that I left the Schmitt Trigger on for a lot of I/O pins that don't necessarily need it (those pins are fed by MCUs / buffers that have slew rates on the order of nanoseconds, so very fast). I can come up with a reason to use Schmitt Triggers for a slow rising signal, but I cannot answer the question for myself, are their downsides to using a Schmitt Trigger on a fast input? These signals are slow in the sense that they aren't periodic (power enables, etc.) but do have fast edge rates (say 5-10ns rise/fall times). I've turned them off in my design -- this question is more for my own edification than anything else, and to be able to justify why they should be off. FPGA in question is the Actel IGLOO (don't think it has any bearing, but just FYI). AI: So it might slow the signal by several nanoseconds- I guess that could be significant in some cases. I don't think they typically draw significantly more power (and power could be less on slow waveforms). On the plus side, they could prevent glitching if there are reflections on the signal lines. Probably not a big deal in most cases.
H: Help Interpreting "Max light exposure" rating for TSL1406R I've purchased a TSL1406 Linear Sensor Array to read the position of a laser dot. The "Absolute Maximum Ratings" section in the datasheet specifies "Maximum light exposure at 638nm" as 5 mJ/cm^2. Being inexperienced with this sort of sensor, I would have expected a "max light" rating to be given in terms of something like mW/cm^2 and I'm not sure what to make of a mJ/cm^2 rating. Q1: Does this mean that "something bad" will happen if the integration time multiplied by the mW/cm^2 of my laser dot exceeds 5 mJ/cm^2? Q2: What is that "something bad"? Will the integrating capacitors fry? Or will they simply be unable to accumulate anymore, resulting in bad readings for that particular frame? AI: I think it's intended to be for pulsed laser conditions. Probably for pulse times short in comparison to the thermal time constant (which will be more than microseconds but much less than 1 second). I would expect that relatively high energy pulses in excess of the maximum would permanently damage the chip in some way, maybe overvoltage failure of the capacitors or something else 'bad'.
H: What are the options of having multiple I/O pins and a constant duty cycle? For some context, I want to create something like this. For now, until I change my chips (which I know I need to do as a plan to use a lower voltage Vcc2) I'm using the sn754410 h-bridge IC, 74HC595 Shift Register. I find that using two of these ICs (a total of 4 electromagnets) results in almost all of my digital I/O Arduino pins being in use. I'd like to use about 8+ of these h-bridge ICs (that would be 48+ I/O pins for the 8+ h-bridge ICs) but I don't know how I could do so while also maintaining a full duty cycle current (complete on 100%) at times needed. My question would be what can I use to achieve this and still have the option to have a bunch of inputs on HIGH all at the same time (or really close to each other where they seem to have turned on all at the same time to humans)? It seems like shift registers may have a PWM effect on the pins (clock?). Do shift registers have a PWM effect on the pins, therefore reducing the current going into the output of the h-bridge ICs? AI: some serial in,parallel out shift registers eg:74HC595 have a latched output so that during updates there need be no flickering of the output, just load all the registers up and then pulse the latch clock. one the latch pulse comes the outputs will stay the same until the next latch pulse.
H: What is "ripple bandwidth" in filter terminology? I'm told "ripple bandwidth" is different from a "-3dB bandwidth" or corner frequency. How is this commonly defined, and how do I derive it? My application: There seems to be a discrepancy in the way Elsie (a filter design package, mine v2.75, fully registered version) defines corner frequency, \$f_c\$ , at least for an LPF. Normally \$f_c\$ defined as -3dB \$S_{21}\$ point. In Elsie, If I set \$f_c\$ at 30MHz, \$S_{21}\$(30MHz) = -0.5dB, but \$S_{21}\$ = -3dB point at about 38 MHz, VSWR = 1.1 at 30MHz, for a 0.01dB ripple, 5-pole Chebyshev capacitor-input LPF. If I set \$S_{21}\$ = -3dB at 30MHz, I get \$f_c\$ = 23.686MHz, VSWR(30MHz) =4.1 I'm told that Elsie is defining \$f_c\$ in a different way, based on the "ripple bandwidth". AI: For a Butterworth filter, the 'bandwidth' is always the frequency at which the response is -3dB of its maximum value. For a Cheby filter, where you choose the depth of ripple for your application, most filter design packages (I've not used Elsie, but it seems the same as others) define the bandwidth of a lowpass filter as the highest frequency at which the response is the ripple depth below its maximum value. This makes a lot of sense, as if you specify a passband ripple, this definition of bandwidth is the range of frequencies for which the passband response is in specification. You can always find out what the -3dB bandwidth is by analysis of the response.
H: Control DC MOTOR from headphone I would to know if is possible with simply way ( i'm not electronic expert ) to drive one direction a DC MOTOR ( a little ) from headphone, with power supply of course. The difficulty is voltage of headphone, is very low 3mvw-6mw, is suppose is not enough to active logical input of L293. I suppose is possible with transistor with "biais voltage", but how ? I want to that because, I want to recycle my old android phone, into camera IP, rotate 380°, with eyefish. I see it exist the IOIO board, but I think it is possible with cheaper parts. Thanks by advance AI: You want an audio level detector. simulate this circuit – Schematic created using CircuitLab C1 blocks any DC from this circuit getting back to your phone. R2, R3 and C2 hold the '+' input at half-supply. R1 and R4 set the gain of the op-amp circuit to 10. (Actually it's -10 because it's inverted.) C4 blocks the DC from getting through to Q1. R5 slowly bleeds off C4 holding it at 0 V. D1 and C3 form a rectifier. When the audio signal exceeds the forward bias voltage of D1, C3 starts to charge up. If the audio level is high enough the voltage on C3 will rise enough to turn on Q1 pulling the 'on' output towards 0 V. You'll need to choose an op-amp to suit your power supply. Q1 will gradually turn off as when the audio stops. You may need to add a Schmitt trigger after it to provide a clean signal to your motor controller. Make an audio signal that goes from off to full on to full off to switch the motor.
H: Connecting different batteries in parallel - how to calculate the voltage? I have an exercise: I have two ideal battieries connected parallel: simulate this circuit – Schematic created using CircuitLab I calculated a resistance of the whole circut: 0.666 ohm. But how can I calculate a voltage of the whole circut? AI: First of all, these batteries are not ideal! Convert both voltage sources (with thier resistor) to the current current source equivalent. The left one will be a 1A-source with a 1 Ohm resistor in parallel, the right one will be a 1A-soure with a 2 Ohm resistor in parallel. Then you can add both current values to 2A. With the 0.66 Ohm resistor you calculated, the voltage will be 2A * 0.66 Ohm = 1,33 V. Sounds pretty much like homework...
H: Effect of WiFi hotspot usage on mobile phone circuitry Despite the fact that mobile phones come in wide a variaary and form different suppliers and with different software, most mobiles todays have a WiFi hotspot feature that can convert a mobiles' internet connection into a WiFi SSID. Typically, mobiles phones have a WiFi supportable chip that adds WiFi to phones. People ( including myself) use the above said feature ( hotspot) feature to access internet from our laptops using the mobiles internet. For uses who don't download heavily and only do browsing, I would like to know if the said feature can tremendously have an impact on the phones lifetime. Especially on its base-band processor, wifi soc etc. A second question is if I take a video call over Viber, Skype or hangouts I will be using phones camera. Thus the phone is required to process the video at the same time transmit it. Wouldn't it be much better if I use a hotspot and then use my PC to run these software? ( wouldn't that allow mobile to do less processing thus less heat and more lifetime) My questions are applicable to common phones. I do not mean satellite phones. I love my phone and I am a tech geek. I am just wondering if someone can shred some light. AI: Such activities will have an effect on how long the battery charge lasts, which may require more charging cycles in a given period of time. This may reduce the lifetime of the battery somewhat. However, there will be no measurable effect on the lifetime of the other components inside the phone.
H: Does mutual inductance change individual inductances? If I have two inductors, with inductances \$L_1\$ and \$L_2\$. I put them really close to each other to make a transformer. Are their individual inductances still \$L_1\$ and \$L_2\$? Or has the mutual inductance changed their individual inductance? AI: It depends what is connected to the other winding, which is why "mutual inductance" is also called "coupling factor" (They are not identical, but closely related terms). The classic way of characterising a transformer's performance (after establishing n, the turns ratio) is to first measure the inductance of the primary - with the secondary open circuit. This measurement is the "primary inductance" - effectively unaffected by the other winding since no current flows in it. And the primary inductance is an impedance connected across the power source - effectively wasted power, and as it is a low impedance at low frequency it determines the low frequency performance of the transformer. Then re-measure the primary, but with the secondary short circuited. This is the "leakage inductance" (technically it's the parallel combination of primary and leakage inductances, but the primary inductance is usually a large enough impedance that it can be regarded as infinite, and ignored). Anyway the "leakage inductance" is essentially the coupling factor of the transformer into a short circuit - so in a good transformer it will be a very low impedance. (The same pair of measurements can be made on the secondary, with the primary open/short circuit. It should give you the same result, scaled by n^2). So the leakage inductance doesn't change the winding inductances - it couples one winding to the other, allowing the load impedance (scaled by 1/n^2) to appear in parallel with the winding inductance. And the series combination of source impedance and primary inductance determine the LF response, while the series combination of leakage inductance and (load impedance/n^2) determine the HF response.
H: Questions about sound card scope software? This is a popular software for those people who don't have a real oscilloscope or function generator: https://www.zeitnitz.eu/scope_en If anyone tried it before, would you answer my questions, please? 1.What is x-y graph? What does each axis represent? How Can I measure the frequency of a signal that is composed of two frequencies? such as: resonant frequency or harmonics. Thank you very much, AI: What is x-y graph? What does each axis represent? XY mode is used when you have two inputs (channel 1 and channel 2) and you want to represent the phase relationship between them differently: - Typical is when Y lags X by 90 degrees and is the same frequency - it produces a circle as per the top line above. Channel 1 normally drives the Y axis and channel 2 drives the X axis. This function is available on most o-scopes. How Can I measure the frequency of a signal that is composed of two frequencies? such as: resonant frequency or harmonics. It's tricky with a normal scope and I'd tend to use a spectrum analyser for this if accuracy is required. Having said that, if the input is a waveform that is harmonic rich then a scope can be used to fairly accurately determine the fundamental frequency - think of a square wave - it contains an infinite series of harmonics but nobody has much problem determining the fundamental frequency: - The square wave above (black) is running at 1 kHz because the timebase is 1 milliseconds for each cycle. Having said all that it appears that the sound card software in the question has this feature: - Frequency analysis (Fourier spectrum)
H: Details on PCB layout for microcontroller Update: the follow-up question shows my take on the resulting PCB layout. I'm laying out my first board with a uC (I've got a reasonable amount of experience in using and programming embedded systems, but this is the first time I'm doing the PCB layout), an STM32F103, this will be a mixed-signal board using both the internal DACs of the STM and some external DACs via SPI, and I'm a bit confused about the grounding. The answers to these questions: Decoupling caps, PCB layout Competing PCB Crystal layout recommendations Mixed signal PCB layout for PSoC clearly state that I should have a local ground plane for the uC, connected to the global ground at exactly one point, and a local power net, connected to the global power near that same point. So this is what I'm doing. My 4 layer stack is then: local GND plane + signals, uC, it's 100nF decoupling caps, and the crystal global GND, unbroken except for vias. In accordance to sources such as Henry Ott, the ground plane is unsplit, with the digital and analog sections physically separated. power, a 3.3V plane under the IC, thick traces for the 3.3V external DACs, thicker traces for distributing the \$\pm15\$ volts in the analog section. signal + 1uF decoupling caps Further away on the board the analog components and signals are on the top and bottom layers. So the questions: should I break the global ground under the uC, or is it good to have the full ground plane under the local one? Power plane: I'm intending to have a power plane only under the uC and use vias to bring the power to the decoupling caps and therefore the uC on the top layer, as I can't really use one much elsewhere. The external DAC's should be star distributed, so I have separate tracks for them, and the rest of the board is \$\pm15\$ volts. Does this sound ok? I'm using both the ADC and DAC of the uC, and generating a reference voltage in the analog section of the board, which I bring to the Vref+ pin of the uC with a track on the power plane. Where should I connect the Vref- pin: local ground, global ground, or make a separate track on the power plane connecting it to the global ground in the analog section, where the ground should be quiet? Maybe near to where the reference voltage is generated? Note that on the STM32 the Vref- is distinct from the analog ground VSSA pin (which I suppose goes to the local GND plane?). Any other comments on the design here are of course welcome too! AI: You don't necessarily need a local ground plane for the micro. The local ground can be a star with the central point under the micro, which is where this star is connected back to the main ground, for example. If you have at least 4 layers, then it can make sense to dedicate one of the layers in the immediate vicinity of the micro to a local ground. If this makes routing too hard or this is a two layer board, just use the star configuration. The main point is to keep the high frequency power current drawn by the micro off the main ground plane. If you don't do that, you have a center-fed patch antenna instead of a ground plane. The loop from micro power pin, to bypass cap, to micro ground pin should not cross the main ground plane. This is where the high frequency power currents will run. Connect the ground pin to the main ground in one place, but do not connect the ground side of the bypass cap to the main ground separately. The ground side of the bypass cap should have its own connection back to the micro's ground pin. Digital signals going between the micro and other parts of the board will still have small loop area because the micro will be connected to the main ground close to its ground pin.
H: Anti-aliasing filter as notch and lowpass In order to reach a steep attenuation for an analog antialiasing filter, there are issues if a high Q notch filter is followed by a low order lowpass filter (or vice versa)? The notch resonance could make a brickwall filter near the cutoff frequency while the low pass would handle the higher part of the spectrum. AI: This in essence is exactly how an elliptic filter works. Most filter design packages that will design 'normal' Butterworth and Chebychev filters will also design elliptic filters, these have a Cheby passband, with added zeroes in the stopband. If you try to randomly add zeroes to an existing low pass response, you probably won't get the response you want. If you do the proper elliptic design, then you get to choose the passband ripple and the stopband attenuation.
H: Hooking up a variable frequency drive I have a 3-phase blower motor that I am looking to control from a Danfoss VLT 2800 that I purchased on eBay. I have in the shop a receptacle that looks like this: If I put a meter from neutral (horizontal middle) to either hot side (the verticals) I get 120v. Across the hots I get 240v. The table suggests that for single phase I should only be connecting two wires, including a neutral. But with the neutral I have I only get the 120v. Should I just be connecting the two hots? For reference, our building has high-leg delta service. AI: European phase voltage is 230 Vrms (line voltage is therefore 400 Vrms). Here in the US we have to connect the two "hots" to get a comparable voltage, that is 240 Vrms. You are fine connecting one split-phase "hot" to L1 and the other one to L2. Make sure to connect the ground as well. The split-phase neutral should be left disconnected.
H: Minimum number of NAND gates required to realize EXOR function While trying to minimize the number of NAND gates for realizing EXOR function, \$A\overline{B} \ \cup \ \overline{A} B\$, I used De Morgan's & got the expression \$\overline{\overline{\left ( A\overline{B} \right )}\cdot \overline{\left ( \overline{A} B \right )}}\$ and hence ended up with \$5\$ NAND Gates. But my book shows it can be done with \$4\$ Gates only. What should be a good approach towards this minimization problem? Should I avoid using De Morgan's Law here? AI: The 4-gate implementation of the XOR function requires the output of one of the gates to be used twice. As far as I know, there's no direct algorithmic way to come up with such solutions; they must be "discovered". In a sense, you have to "de-optimize" the solution before optimizing it, and knowing what deoptimization step makes sense is a matter of intuition. In this case, it requires the observation* that $$A\cdot\overline{B} = A\cdot\overline{(A\cdot B)}$$ and $$\overline{A}\cdot B = \overline{(A\cdot B)}\cdot B$$ and then realizing that the \$\overline{(A\cdot B)}\$ term for both right-hand expressions can be generated by the same gate. *The details: Since \$A\cdot\overline{A} = 0\$, you can add this term to any expression without changing it: $$A\cdot\overline{B} = A\cdot\overline{A} + A\cdot\overline{B}$$ Now, factor out the A $$\ldots = A\cdot(\overline{A} + \overline{B})$$ and apply DeMorgan's: $$\ldots = A\cdot\overline{(A\cdot B)}$$
H: What does this schematic symbol mean? (triangle with a line crossing it out) I found the following circuit symbol in an MSP430 User's Guide in the section describing the ADC: (I made a red circle around it) What does it represent? AI: The diagram on page 631 of the user guide has it labeled "Temp. Sensor". This is the internal Block Diagram for the SD24_A ADC, but it's almost functionally the same for the other ADC Types
H: 2 Layer Through Hole PCB I am designing my very first PCB for a robotics project I am working on. The project will be using through hole components. I was not able to get all the traces to work on 1 layer, so I added a second layer, the board layout is shown below: Given this board layout, will I have any trouble using through hole components? Will I also need to solder the components to the leads on the top layer (red), as well as to the leads on the bottom layer (blue)? EDIT I've updated my board design below, adding 0.1uF caps to both VSS/VDD pairs on the pic, and increased my trace widths to 30 mils, while also hopefully reducing the trace lengths. The following board also passes the DRC check: I still can't get the ground plane to show up for whatever reason. Any suggestions on how to improve this would be appreciated. AI: No, the holes through the board should be plated, which means that they are lined with metal that makes a good connection from front to back. In my experience, capillary action will suck the solder all the way through the holes anyway. However, it looks like you are planning to control some significant currents so you might want to make the traces that conduct large currents much fatter. I would also suggest adding a ceramic capacitor of 0.1uF or so right at the power pins of the microcontroller, in addition to the 22uF caps.
H: What tolerance do typical components have to wrong-polarity voltages/currents? I've always been a bit hesitant to do continuity tests on populated PCBs, on the basis that if there is no trace connecting the two probes, I will be applying some finite voltage to arbitrary IC pins (quite possibly in the wrong polarity) while leaving others unpowered. Is there a 'safe' voltage/current limit for doing this sort of testing? Another reason for asking this now is that I've noticed that when the output is supposedly switched off on my cheapo bench power supply, it's actually supplying -50mV with an impedance of ~1Kohm. I would guess that this is some way outside the 'safe' limit... AI: Almost all CMOS data sheets I've read for 3.3V and 5.0V logic show a margin of 0.3 as "safe" -- you'll see a "low input" rating of VDD-0.3, and you'll see a "high input" rating of up to VCC+0.3. I think that 0.3 Volt has something to do with the semiconductor process involved, but I don't know the details. Also, the current (source impedance) of your multimeter is likely to be so low that it won't supply enough current to fry anything, even if it were shorted. I've never fried anything by measuring with my regular Radio Shack auto-ranging multimeter on a board. I do have one multimeter, though, bought at Harbor Freight (Chinese import special) that eats batteries when I forget to turn it off, and actually has enough current to light up a red LED when continuity probing it ... I don't use this particular multimeter for anything sensitive :-)
H: Why the output voltage of dsPIC IO ports is not constant? I expect output voltage of dsPIC pin should be 3.3V, and this seems to be true when the output pin is connected to high resistance. However, when I connect to low resistance, the voltage of output pin is pulled low.(The image below shows the voltage is 2.75V). I suspect it is caused by the circuit in the microchip, but I don't know how to analyze it. BTW, here's the datasheet of this chip. AI: The output pins of a micro can only supply so much current. If you try to draw more current then they can provide, the voltage will drop (as you are experiencing). Here is the documentation for the microprocessor you are using: Datasheet page 231, Section 24.0 - "Absolute Maximum Ratings" As you can see, the datasheet only rates the IO lines to supply an absolute maximum of 4 mA each (and you should derate the them as well. Use 2-3 mA as a safe limit). As such, you're actually exceeding the MCUs rated current by an order of magnitude! (\$\frac{V}{R}=I, \frac{3.3V}{100Ω}=33 mA\$). I don't know how the simulator you are using handles this sort of abuse, but with the real micro, you could very well damage the output buffer of the IC. To some extent, you can think of the output of each IO pin as being a perfect output driver in series with a resistor (really, it's more complicated - there is also inductance, capacitance, and some fun non-linearities, but we'll ignore those for now). As such, even if you are not exceeding the absolute maximum ratings, there will be some voltage sag as you load the IO pin. From the datasheet referring to the (1) next to the "Absolute Maximum Ratings" line: Note 1: Stresses above those listed under “Absolute Maximum Ratings” may cause permanent damage to the device. This is a stress rating only, and functional operation of the device at those or any other conditions above those indicated in the operation listings of this specification is not implied. Exposure to maximum rating conditions for extended periods may affect device reliability.
H: Is BJT a Voltage controlled device or Current controlled device? I have searched already for this question, but everywhere I see debate instead of clear answer. Though it is not that important of a matter whether we call it a voltage controlled device or current controlled device. I believe it can be called both voltage controlled or current controlled depending on the situation. Still I believe it requires a little clarification. Which part it really is in view of the core operating principle? AI: The answer depends on your perspective. A physicist might say that the fundamental action in a BJT is that an electric field across the base-emitter junction decreases the width of the depletion zone. It is this electric field, measured in volts, that controls the movement of charge carriers. Therefore the BJT is voltage controlled. An electronic engineer might say that the most useful model for a specific circuit design is the current-amplifier model.
H: Computing Current from known Capacitance and Time to Charge to Known Voltage If I know how long it takes to charge a capacitor of known size to a known voltage (within 10%), how do I find out the average current for that period of time? This only needs to be approximate. Maybe I should ask this from another angle. Assume a capacitor of capacity C is charging to voltage V and discharging to 0v at a rate of 5 times per second. How do I figure out the average current or what you might call RMS current? I don't need this to be exact -- very rough approximation. AI: In general, the average current is equal to the change in charge divided by the time taken. But the change in charge is equal to the capacitance C multiplied by the change in voltage, which you know :- $$I_{AVG}=\frac{C\cdot\Delta V}{t}$$ Your last paragraph is harder to address. The average current is not usually the same as the RMS current which will depend on the how the current varies with time. We would need to know how the charging/discharging takes place, for example constant current or through a constant resistance to a known voltage. If you are cycling the charge/discharge process, the long-term average current will of course be zero but the RMS current will be non-zero.
H: How can I test the amount of power I can draw out of a USB charger? I've got several USB chargers where the labeling has worn off. I'm interested in using some of these with a Raspberry Pi Model B, which needs at least 700 mA, as well as other devices with varying current requirements. Is there any way for me to empirically test exactly how much current I can safely draw from these unlabeled chargers? I've got access to a desktop multimeter, breadboards, components, etc. AI: The simplest way is to give the charger ever increasing loads until it no longer supplies close to 5 V. That won't tell you what it can always do under all combinations of line voltage and temperature, but it should give you some idea. The easiest way to load the charger is with known resistors. A 10 Ω resistor will draw 500 mA when 5 V is applied to it. Note that it will also dissipate 2.5 W in the process, so this would need to be a power resistor. Since 2 W is a common power resitor value, you could get a bunch of 15 Ω 2 W power resistors. Each connected to 5 V will draw 1/3 A. Keep connecting more of them while monitoring the voltage with a voltmeter. Count the number you can put accross the supply before it either shuts down, blows a fuse, or otherwise can't hold the output at 5 V anymore. At 1/3 A for each resistor, you get a good enough idea. You probably want to derate the limit you measured by 1/3 A (one 15 Ω resistor worth of current), maybe more if the charger blows a fuse instead of current limiting or shutting down.
H: How does this blinking circuit with op-amp work? Can somebody explain how this circuit works? The OP tries to make the same voltage at the input cables. At first, the LED is on. Therefore we have a low voltage (maybe 1V) on the negative input The positive input also get this voltage (1V) and then? Why the LED turns off? EDIT: This example comes from the German Book: Kosmos eletronic X3000 (page 15). R1 = 15 kOhm R2 = 100 kOhm R3 = 470 Ohm C1 = 100 µF U_B = 9V AI: Yes - I totally agree with Olin its a messed up circuit - just goes to show you shouldn't believe everything you read. I think the actual circuit should have been -
H: Circuits for two way data transfer from iPhone to Arduino via headphone jack What I'm trying to do: I recently bought an iPhone 3GS (yes iPhone...) and I am going to install Android on it so I can make apps myself for it and incorporate it in a bigger project, using the WiFi and the touchscreen capabilities to interface with my Arduino. The iPhone is soon to be jailbroken and it is not connected to a 3G network. Technology behind it: Like I said earlier, I am going to jailbreak it so I can install Android on it. Then, I'm going to connect this cable that will split the headphone and microphone signal to it and then connect it to my Arduino. This is where I get stuck. I want the Arduino to generate signals to the "iDroid App" and it to also send signals back. What circuits should I implement for the microphone and speaker? I have seen this question, but it doesn't cover microphones, and I can't find out how to actually do anything with the information. I've seen this also, and although it has awesome code samples, it doesn't explain the circuits. These aren't really duplicates, they are related, but I need further explanation and help. AI: Have a look at this project. From what I gather, its an open source project and has some documentation on it (I didn't actually read it) Android Oscilloscope They used the microphone input (similiar to what you are doing) and then displaying it through an app (also open source). If you go over their stuff, you should be able to figure out, how they are reading back values. You can then write your own app so that, if you see a specific voltage, voltage range, or a specific frequency ( fft or other algorithm), you can do something with your app, or send data out through the headphones. To send data to your iphone/android device, you would need to generate an voltage or voltage signal. That can probably be done using PWM and a low pass filter. I don't know what safe voltages are for cell phone microphone inputs, so find that out too. Hopefully, this is a start to aid you in your research. I haven't done any of the things I said, so do your research!
H: DIY : Powering a single LED with a motherboard's internal connectors I'd like to power a bright LED (1W or 3W) connecting it onto a power source of my computer, directly on the motherboard. I think about using either a fan connector or directly the ATX Power supply. But I don't find any information about how to do that well on the net. I will have to use a resistance, a led, some wires and perhaps a power switch, and probably some cooling stiff for the LED and the resistance. But what about what-to-do and what-not-to-do about such a DIY stuff ? I mean, what may I connect onto what, what must I take care about, ... ? examples : the fan connector has 3 pins. My LED has 2 pins... Making such a connection may damage the motherboard ? What may I do to prevent this ? What about the voltages and power ? I was starting this with confidence, but not finding anyone that talks about that on the net makes me a litlle be scared. AI: There is nothing special about a computer when it comes to leds. You can power directly off the ATX supply (Either 12V, 5V, 3.3V) or from the fan connector (12V). Just add an appropriate resistor and you are done. You need to apply the same led calculations as anything else: $$Resistance = \frac{Source\,Voltage - LED\,Forward\,Voltage\,Drop}{Desired\,Current}$$ The Fan connectors have three pins, one for 12v, one for Ground, and one for Tach/Speed Sensing. Since you mentioned cooling, are you talking about 1W or higher LEDs? The same still applies. You could use the fan connector for both a cooling fan, as well as the led power source.
H: Multiple DC Input to Single DC Output I want to connect solar panels in parallel, not sure whether connecting the terminals together will work. If one solar panel produces high voltage, it will block the voltage generated by second solar panel and it never contributes to the total power generation. This is my theoretical assumption. If I have a Multiple DC input which can take range of DC voltages, it can convert variety of voltages to a single constant DC voltage output. Not finding how to achieve. Please help. AI: Connecting them in parallel may be a problem since the lower voltage cell will drain some current from the higher one. I don't know if this will damage the cell, but it doesn't seem healthy anyway. Basically I can think about two options: a DC converter for each cell to equalize their outputs, or an electronic switch (like this one) to select just the higher source (and maybe redirect the lower one to a battery). Even then you'll need to somehow regulate the output (since both batteries and loads will probably have an operating voltage range to be met). But those things would be a bit of reinventing the wheel, since you can purchase a ready-made charge controller to take care of these things.
H: 4-pin Hirose connector to BNC Is there any way to convert n 4-pin Hirose connector to BNC ?? With this camera the the trigger is 4 pin hirose connector. But the trigger from my data generator DG2020A is 2state (0-5V) and a ( BNC output ). AI: Yes, make a custom cable with a 4-pin Hirose at one end and a BNC at the other end. Similar to this: This document specifies the Hirose pinout: This should tell you how to wire it.
H: Measuring small Off state leakage current 10uA or less I have a solid state relay an AQZ207 to be exact. I want to be able to measure the off state leakage current of the FET which in the datasheet seems to around 10uA Max. I had some ideas, but not sure what to do. I know the multimeter I have a fluke has a burden voltage and everything that will affect the results. I remember seeing some kind of resistor placed in parallel with the meter to measure the voltage drop of the resistor that some how scales to current? Anybody know of this method? I'd love to read a white paper or detailed explanation. I'm assuming the resistor acts like a current sensor since if you know the resistance and applied voltage you can calculate current. However, is this to offset the multimeter's high impedance from the measurement also? To actually test if the FET is leaking, I'm not sure how to test that in operation there would be a voltage drop across the resistor if the FET was leaking since its being loss in the gate? AI: Assumed the current you want to measure is indeed about 10uA and you feel OK with a burden voltage of about 1V and your multimeter has a voltage range of about 1V, then all you have to do is put a resistor is series with the FET you want to test. Most multimeters have a voltage range where 1V is somewhat in the middle of the range. In this case: $$R_{series} = \dfrac{U_{burden}}{I_{expected}} = \dfrac{1\text{V}}{10\mu\text{A}}=100\text{k}\Omega$$ and measure the voltage across the resistor. The voltage measured is a pretty good indication of the current through the resistor, but it is important to check your meter's impedance. For good results it should be at least 10 times higher than the resistor. In this case the error will be better than 10% (\$\frac{100\text{k}\cdot 100\%}{1\text{M}}=10\%\$). The leakage current will flow through the resistor and Ohm says: $$I=\dfrac{U}{R}$$ So the voltage across the resistor is proportional with the current through it. R is known, U is measured, so you can calculate current I.
H: Is there a way of conditionally triggering a compile-time error in verilog? I have a parameterised module in verilog, where the parameters are a clock rate and refresh rate, which is used to calculate how many cycles of inactivity are inserted between instances of a repeating operation. However, it is very easy to set parameters that cannot be attained (because the operation takes a non-trivial length of time, so the repeat would have to occur before it had completed), and at the moment the design does not give any feedback on this. I was wondering if there was some way I could trigger an error during synthesis (or compilation prior to simulation) if the conditions cannot be met (i.e. if one localparam is less than another)? Some equivalent of the popular C/C++ compile-time-assert hack, perhaps. AI: I'm sure there is some way to bind in a C/C++ compile time callback. However, as long as your supports generate blocks (introduced in IEEE Std 1364-2001), then you can do something like the following: generate if (CONDITION > MAX_ALLOWED /* your condition check */ ) begin illegal_parameter_condition_triggered_will_instantiate_an non_existing_module(); end endgenerate If the condition is true, then the compiler will give an error because there is a request for something that doesn't exist. If the condition is false, then the operation is skipped. The only requirement is the code for the illegal condition follows legal Verilog syntax and the illegal condition will never accidentally become valid (hence the long and verbose non-existing module name). If your simulator and synthesis tools support IEEE Std 1800-2009 (SystemVerilog revision released in 2009) or newer revision, then you can use $error() and give a more meaningful message to go with the error. I'm not sure if any venders has implemented this feature yet. It should become the preferred method once most venders implemented, therefore I will give an example: generate if (CONDITION > MAX_ALLOWED /* your condition check */ ) begin $error("%m ** Illegal Condition ** CONDITION(%d) > MAX_ALLOWED(%d)", CONDITION, MAX_ALLOWED); end endgenerate
H: How do proceed with larger electronic projects? Recently I have read two books about programming in general: First one being Code Complete and the other being The Pragmatic Programmer that describe how one should think when dealing with large projects. Wonderful books. My weak point is electronics. How shall one start with larger projects? How do the "professionals" do? For example, If we are going to make a vacuum cleaner robot, do they review the requirements first? Start sketching in a computer ECAD software? Or maybe the breadboard? What steps should I follow? AI: The general steps to the engineering design process are: Define the Problem This is typically the customer's or the boss's job. To decide how to fix something, you must first know what needs fixing. Do Background Research Understand the problem. Find out everything about it. Consult experts, literature, and conduct design reviews and generate questions for the client. Specify Requirements Take the customer's problem, and the information gathered, and put quantifiable specifications and constraints on the solution. This isn't a time to define a solutioin, only to determine how to measure the solution's success. Create Alternative Solutions This is where you take the specifications, and generate different ideas to approach the problem. For example can the problem be solved with a few logic gates, or is a microcontroller necessary? Customer input will likely be necessary. Choose the Best Solution Evaluate the pros and cons of each proposed solution. Choose the one that makes the most sense. There are many variables in that decision, such as price, availability, time, etc. Do Development Work This is where you actually implement the chosen solution. Simulate and breadboard until your heart is content. Build a Prototype Take the developed solution, build it, and integrate other aspects of the project (ie. mechanical). Test and Redesign Take the prototype and evaluate it against the specifications. Make any design changes based on information gained, and complete another iteration of this process.
H: How Are Pixels Sent To The Screen? So, today I started to wounder how pixels are stored, then push though the graphical bus. I have not really done much with LCD or touch screens. I do know from my programming background they are buffered, maybe in an array like binary structure. But I'm not sure. Does anyone have a good resource for how pixels are sent to the screen? Or can tell me? AI: Traditional analog video works like this. There is some video memory which represents pixels: black and white dots, or grayscales, or RGB values. The memory is read and written by the host computer to produce graphics. At the same time, it is being scanned by video circuitry, which has its own gateway to the memory: the memory is said to be dual ported. Furthermore, the memory is organized into banks in such a way that the video circuit can read pixels in a highly parallel way: it can read many pixels at a time in one cycle, pulling them from multiple memory chips. Therefore this second memory port achieves a very high bandwidth, allowing the video circuitry to scan the entire frame buffer 60 times per second or more. The circuitry reads groups of pixels and places them into a shift register. From the shift register they are clocked out to digital-to-analog converters which convert the values to voltage levels which make up the video signal. They are clocked out at the frequency of the pixel clock. The resulting signals are amplified by high frequency video amplifiers which drive the lines of the cable that goes out to the monitor. The video circuit also generates synchronization signals for the horizontal and vertical retrace. The monitor locks on to these signals, much like a television. A traditional CRT monitor uses the sync signals to generate ramps for the horizontal and vertical scan. These ramps power the deflection coils to move the beam: basically an X-Y oscilloscope. The video signal then controls the amplitude of the three different beams that correspond to the red, green and blue colors. Since the CRT is a vacuum tube, the intensity of each beam is controlled with a voltage on a grid. The beams hit a metal mask which has openings which, thanks to parallax, allow each beam to only light up the phosphor dots corresponding to its color.
H: Can RFID readers submit scanned data to one location? Let's assume that I have lots of RFID readers, is there a way, either a specific product or peripheral that allows the reader to send data about the tag it scanned over a distance of about 500m - 650m to one central location? I have searched everywhere on the Internet and all the results give me information about readers scanning RFID tags at long range, not the reader being able to communicate long range with a central point. Here is a similar stack overflow question that went unanswered Please ask for clarification if this doesn't make sense. AI: If you have the RFID readers connected to a network, you could do this pretty easily. You need to separate your project into two parts - getting the rfid info into a processor/microprocessor of some sort, and then moving the data to another location. Both are pretty easily solved with off-the-shelf parts. The problem I think is that you're asking/googlinh about transmitting "RFID Information" in particular. Once you scan a tag, you basically get data. Data is pretty generic. People spend a lot of time working on moving data around. Once the tag information is in the computer, it's just a string you need to send over some sort of medium, and if your medium supports data, it probably supports any actual data contents, RFID or not. I'm not too sure how many of these things you want to make; an easy if not cheap solution would be to just slap an RFID reader on an Arduino, together with a GSM module (for cellular communication), or a WiFi module. However, this is a bring-your-own-code solution. If you're hoping for something off-the-shelf, short of using an full-on desktop/laptop computer for each node, I think you're out of luck. If you already have a lot of RFID readers, there are plenty of serial/analog/whatever bus to wireless adapters out there, but they're not going to be labeled RFID-specific. Again, think data, not RFID.
H: Turn S R Latch Using a NOR gates into NAND I can't post a picture so the question will use Boolean Algebra. For me an SR Latch is S NOR Q' = Q R NOR Q = Q' I will represent Q' as P since Q' might be mistaken as NOT(Q). S NOR P = Q R NOR Q = P If I want to turn it into a circuit using only NAND gates it turns into NOT(NOT(S)*NOT(P)) NOT(NOT(R)*NOT(Q)) When I build the circuit it seems that I have way too many NAND Gates. Random pictures online show that I only need 2 NAND gates. This does not make sense to me, specially if it can be built with 2 NORS then with Boolean algebra I should get 8 or 6 NANDS. That is what I came up with, which happens to reduce to 4 NAND gates. Is that correct? AI: S - R (or R S) just means that we use a 'HIGH' or '1' to Set or Reset the outputs. The Set signal should make the Q output high and the Reset signal should make it low. This operation can be done by cross connecting two NOR gates. Another commonly used circuit is the NOT S R flip flop using NAND gates. Here the controlling input is a 'LOW' or '0' i.e. NOT '1' This is constructed with two NAND gates. Now it is possible to construct NOR or NANDS from other gate combinations so that circuit diagrams may look a little different. For example you could add an inverter to the inputs of the NAND version and convert it to an S R type. By connecting the two inputs of a NAND gate you can make an inverter, so a 4 dual input NAND gate (e.g. 4011 or 7400) could be used to produce you S R flip flop.i.e 4 gates, not the 6 or 8 gates you think. A walk through the circuit operation of the NAND S R flip flop (4 gates). When both inputs are low the flip flop will be in one of two states, either the Q output is high or it will be low. In either case the low (0) inputs will have no effect and the outputs remain in their initial state. Putting a '1' on input A ('0' on B) will cause a '0' input at C that will produce a '1' output at E (because any '0' input on a nand gate will produce a '1' output. The E output will place a '1' input onto the bottom gate. The other input is also '1' because the B input is '0'. The output of the bottom gate will then go to '0'. This '0' output (F) will keep the top gate output at '1' when the A input changes back to a '0'. The flip flop is now in the SET condition. (a '1' on the SET input has produced a '1' at the Q output) Similarly if the B input is a '1' (A input '0') this will put a '1' at the F output. ,This will produce a '1 on the input to the top gate that combines with the other '1' at C to produce a '0' at the output. This '0' will keep the bottom gate output at '1' when the B input goes to '0'. The flip flop is now in the RESET condition. (a '1' on the 'REST' input has produced a '0' at the Q output) As with all S R flip flops a problem arises when you try to SET and RESET the outputs at the same time. In this case both outputs will go to '1' and it will depend which input falls to '0' first as to how the state of the outputs will be determined.
H: Powering two 8-Ohm speakers in parallel with a 4-Ohm per channel audio amplifier Are there any possible problems powering two 8-Ohm speakers in parallel with an audio amplifier designed to drive 4-Ohm per channel? (Both the speakers and amplifier are generic, and the speakers are identical). The amplifier's power rating is greater than the sum of the speakers, and would not be pushed beyond the combined power rating of the speakers. I can't think of any reason for there to be any drop in audio quality, or for there to be any other issues, but I just wanted to do a sanity check by asking. Thanks AI: Parallelling identical 8 Ohm speakers to get a 4 Ohm load (and the opposite: putting 4 Ohms speakers in series to get an 8 Ohm load) is normal practice. "The amplifier's power rating is greater than the sum of the speakers" - That can get problematic: at full power the speakers might be damaged. You want the speakers (combined) rated power to be at least the maximum power produced by the amplifier.
H: How to determine infrared protocol using PIC16? I am trying to determine the IR protocol used in a Gree room air conditioner remote control. I connected the output of the original IR receiver to pin RA5 of a PIC16F73 and used the following code to measure the time periods of the high and low pulses. while(1) { while(PORTAbits.RA5 == 1) //Wait for a low edge. { ; } T1CONbits.TMR1ON = 0; //Turn off Timer 1. duration[durationCounter] = TMR1; //Record duration of pulse in array 'duration'. TMR1 = 0; //Reset Timer 1. durationCounter++; T1CONbits.TMR1ON = 1; lowEdges++; while(PORTAbits.RA5 == 0) //Wait for next high edge. { ; } T1CONbits.TMR1ON = 0; //Similarly for low edge. duration[durationCounter] = TMR1; TMR1 = 0; durationCounter++; T1CONbits.TMR1ON = 1; highEdges++; } I've entered the data in this excel file. But the pulse widths seem to vary randomly and make no sense to me. I've checked articles on the NEC, RC-5 etc. protocols but none seems to match this data. Is the program inadequate to capture the data? AI: You have two questions, how to interpret the IR protocol and how to make a logic analyzer to capture samples of the protocol. To guess the protocol, look around on the net. You might find where someone has already figured it out. These things are usually not deliberately obfuscated, but inferring the protocol just from a bunch of samples can be tricky. Most likely each packet starts with a burst of alternating high/low, called the preamble. This is intended to let the data slicer in the receiver settle. Then there will be something with different timing to mark the start of the packet. This is necessary because the assumption is that some of the preamble is not received. After that there are a lot of choices. Some use manchester encoding, and some use 1/3 and 2/3 pulse lengths to signify 1 and 0. I've seen some that use chunks of 4 bits to transmit decimal or hex digits, usualy followed by a checksum digit. Capture a few representative packets with a logic analyzer or even a scope. With a scope you will probably have to capture a whole packet in pieces and glue them back together manually. As for making your own logic analyzer, that's a distraction that should be avoided if possible. If I really had to do this with a PIC, I'd at least use the CCP module in capture mode, then report the time between edges over the UART or something, then save the data in maybe a CSV file so you can use off the shelf tools to look at it in detail later. You can then even test receiving algorithms on your computer by having them process the CSV file.
H: How exactly do USB audio interfaces interface with a computer? (specifically ADC) I have seen the likes of M-Audio fast track and similar devices that somehow covert an analogue voltage audio signal to a digital data stream which you can connect via USB to your computer. If I open something like Garageband it just appears as another input without any special configuration. I am interested in building my own. An example application would be; record guitar onto a computer software e.g. Garageband, Logic Pro etc. I understand that there is a ADC (Analogue to Digital Converter) which will convert the analogue audio levels to digital. What I am trying to figure out is, how does this interface with the computer? All of these devices seem to work without needing specific drivers and such so, there I'm guessing there may be a specific protocol they all follow? I can't seem to find something exact. If there is a protocol that they follow, does anyone have any info or any idea about this? Is this the same universal protocol that is used by the likes of USB audio speakers etc? Is this similar to SPDIF and the like? Is this conversion from output of ADC to USB data stream something which we can do, say, with a microcontroller? I know that its much easier just to build an analogue preamp or the like to connect it to the audio input port on a PC but as I said, I am interested in how they make the USB interface. AI: universal protocol that is used by the likes of USB audio Sounds like the USB Audio Class specification. Is this conversion from output of ADC to USB data stream something which we can do, say, with a microcontroller? Some USB microcontrollers - NXP LPC17xx for example - have example code for USB Audio Class available.
H: Do I need to terminate extremely short traces (< 0.5 inches)? Some background: I have a little hobby project running that basically interfaces a 64 pin ARM mcu (the STM32F405RGT6) to a stereo codec (a TI PCM3010) via I2S interface. I'm deriving the master clock for the I2S bus from the MCU (the stm32f4 series apparently has a PLL for this purpose), which runs at 12.288 MHz (256 times the sampling frequency, which in this case is 48kHz). The bit clock and respective data in/data out lines run at approximately 3MHz. I'm currently looking at routing the design on a 2 layer board, since it doesn't really have a huge amount of I/O. So far I've been able to locate the codec literally right next to the MCU, so that trace lengths to respective pins are 3 to 13mm in length (and as a plus, the analog/digital halves are nicely segmented). The ground plane is unbroken, except where I have to use a via for the data out line. Now for the actual question; is it even required to terminate transmission lines under a certain length? I've seen in some literature that this is case (as in you don't have to terminate anything), but why is this exactly? I know it really depends on the edge rate (and source/destination/trace impedance), but would I gain any benefits by doing it anyway? Due to the layout of the codec chip, it would be possible to series terminate the lines, but really only by moving it further away, and by introducing more vias and broken ground planes into the equation. I realize this is a sort of low speed/edge rate design and I could get away with routing the board with my eyes closed, but I'd actually like to design something properly for once! AI: First, as you mention, the critical parameter is usually the rise and fall times of your edges. You can estimate the effective "frequency knee" of your signal by \$ f = \dfrac{\alpha}{t_r} \$ where \$t_r\$ is the faster of your rise and fall times. The parameter \$\alpha\$ is a kind of fudge factor; it depends on whether you measured the rise time as a 10%-90% or a 20%-80% value, and some authors give numbers between 0.5 and 0.8, but to be safe you could just use 1.0. As Jippie discusses in his answer, if the wavelength associated with this frequency is more than 10x the trace length, you generally don't need to worry about transmission line effects. And in fact this is just how most CMOS and TTL drivers are intended to operate---except for certain specific types, they don't really have the current drive capability to drive a termination resistor of 50 or 75 Ohms. Another complication is that most CMOS and TTL devices won't have a spec for rise and fall time. You'll have to estimate it from the drive current capability and the load capacitance: \$ t_r \approx \dfrac{(V_h-V_l)C}{I}\$ Where I is the short circuit output current for your driver and C is estimated from your track geometry and the input capacitance of the load. If you are using ECL parts, be aware that even if you don't terminate the transmission line, they still need a pull-down resistor to properly bias the output transistor.
H: How to identify orphaned power cords? We are doing a massive purge of "stuff" from home and storage. I am accumulating a large quantity of random, unmarked power cords. Some will have "Nintendo" or "Norelco" on them - so I know to go confer with my boys about their gaming stuff or check my husbands grooming items, etc. But what I am confounded by is several totally generic type cords - with a specifically shaped female pin end and standard oriented plug end(one prong larger than the other). There are numbers imprinted on both ends as well as printed in white ink along the wire. Lots of numbers. I attempted a google search but the results were equally random. "AC power cord for some electronic device." How can I determine what each cord is for? I don't want to store them all "in case" - but I also don't want to throw them out only to discover they were needed for something we still use (or want to sell, give away, donate). AI: Any chance your big box 'o cords contains some "cords" as in cords and some "cords" as in adapters? "Cords" as in cords: These have a plug that goes into the wall and an IEC 60320-compliant plug. With these, it's not critical to use them with the exact same device they came with. The general rule is: If they fit, they're good. Over time, you may end up having lots and lots of them, because many new computers/monitors/whatnots are shipped with one. Keep the nicer dozen of each type, give the rest to a friend hacker of yours or try your community's recycling yard (cable bin for copper recycling!). "Cords" as in adapters: These are sometimes also called wall warts, because the somewhat bigger enclosure (wart) that is plugged into the wall contains a transformer or other type of power supply, and they have a low-voltage output specifically designed for a certain type of equipment. There is no standard to make sure you don't fry a device designed for a 5 V supply with a wrong, higher-voltage adapter, e.g. one that outputs 12 V. Also, even if the voltage is the same between two adapters (say: 5 V DC), the polarity at the small plug to the device may be different... These adapters can only be used interchangeably if all the details match (Voltage, AC vs. DC, polarity, current rating, size of plug - and I may have forgotten something). Sometimes, mostly for laptop adapters, it is even necessary that the laptop receives a datagram from its very own power supply... TLDR: It is wise to have labels on adapters, like some of yours do. No labels: The tiny print or the manuals may provide the information about what matches with what. No tiny print or no manuals: Detective work, and hoping you don't let the magic smoke out if plugging the wrong adapter into a device... Some are probably junk, some may be valuable (C64, vintage musical instruments?), even if you don't need them any more (-> flea market, online classifieds or auction?). Some more hints on power supplies or adapters of unknown origin or purpose: https://electronics.stackexchange.com/a/34746/930
H: Magnetic Field Transmission I have heard from here that if you put 1 turn of wire around your house, you can hear music all around inside your house. It doesen't tell me very much on all of the components etc. to drive but I am assuming that you have to have an amplifier on the receiver and the transmitter. To simulate, before actually performing the experiment, I wrapped 1 turn of wire around a cardboard box. For the transmitter, I found a stereo system, which can produce a very loud sound. The only problem is because it acts as a short, I can only turn it up to a certain volume. For the receiver, I just hooked up a speaker to a coil, and I heard a faint sound. I know with the scale of a large house, I will need some time of amplifier. How would I set up the circuit for amplifying the low signal sound found on the coil. Would this be possible with a TL082CP op-amp and if so, how would I set up the circuit? Also does anybody know of any better way of transmitting the sound through it or is the stereo fine for the setup around my house? Also, I came across a very strange thing when I found a head-set and put one ear-piece in the magnetic field. I heard the audio out of the other. I had nothing connected up to the jack and it seems impossible for this to happen with a stereo head-set. Why is this happening? AI: It is called audio induction loop and is commonly used to aid people that have a suboptimal hearing. Here is a nice example.
H: How to program a BeagleBone board? Until now I used Microchip PIC, to program this microprocessor there is MPLAB. I would like to make a step forward and learn about other microcontrollers. I found the BeagleBone Black quiet promising for my DIY project because there is a 2GB flash and 1GHz clock. I have a few question as a beginner: On the eewiki I found a tutorial where they are describing how to start, but this tutorial is based on SD card. If I want to use only the 2GB flash card than how can I load my software on it without using SD card? I saw on that page that there is a bootloader(UBoot), what is this for? For example I just wan to blink a led, using PIC it is a few line of code which I upload and that's all, If I would like to do the same with a BeagleBone Black what I suppose to do? Do I need UBoot? How can I write this piece of code to the eMMC of the BeagleBone? If I have a board without any preloaded software(including bootloader) how can I start to upload a software? AI: The processor on the BeagleBone is not a microcontroller, but rather a microprocessor (the Sitara AM3359 from Texas Instruments), which doesn't have non-volatile memory on the processor itself, but rather tries to load programs (such as an OS) into RAM via a communications interface (UART, USB, Ethernet) or from an external memory (FLash or memory card). The initialization/booting process for this processor is described in detail starting at page 4667 of the technical reference manual. It seems the latter (booting from a memory device) is the case for the BeagleBone, which means you can "program" the BeagleBoard by changing the content of the on-board Flash (eMMC) or by forcing it to boot from the microSD card. It's not very clear from their documentation how easy or hard it is to create your own memory images (for SD card or the eMMC). I suspect it's not trivial.
H: Running 7V motors with 2x 3.7v batteries We're really enthusiastic to build a homemade quad-copter with almost no knowledge about such things. We will probably use Arduino and Bluetooth to control it, but we have a question about the motor power supply. We're planning to use a phone battery to power the motors. Our motors run at 7-12V, but our batteries are 3.7V, 1450mA. The question is will the motors run smoothly if we connect them like this: and theoretically will they be enough to power 4 motors. If they're not, can you suggest any cheap solution. AI: Battery voltages add in series, so two 3.7V batteries should give you 7.4V, which should work. You are also limited by the current your batteries can supply. With them in series, two doesn't change the current they can supply, so you can get 1450mA. You have four motors that will need to share this current, so each motor can have up to 362.5mA, if the batteries are powering only the motors. The control electronics will also require some current, and running your batteries at the maximum current will discharge them quickly. Is this enough? How heavy is your quadcopter? What does the motor datasheet say? The quadcopter you are describing, with an Arduino, and an Android phone, sounds pretty heavy. Without more information it's impossible to know for sure, but I'm guessing you will need bigger batteries. There are plenty of batteries designed for remote control aeroplanes and helicopters. I'd investigate those.
H: DC 5V to 3.3V DC-DC Step-Down issue TL;DR : The output voltage from my 5V DC to 3.3V DC stepdown seems to output 4.5V DC - why? Background: I'm trying to power an Airport Express from USB rather than a wall outlet. I have discovered that the PSU inside the APE outputs 3.3V DC which powers the device. I figured I could rip the PSU out and replace it with a little board that steps the DC from 5 to 3.3, allowing my to use USB to power the APE. So far I have cut the end off the USB cable and tested the red/black wires with my multimeter and can confirm it is outputting 5V DC. I then connected the red wire (5V) from the USB cable onto the VIN pin of the step down, and then tried testing the output voltage from the VIN by connecting the black lead of the multimeter to the ground wire (out of the USB lead), and the red lead of the multimeter to the OUT pin of the step down, its currently reporting 4.5V. The step down device is one of these: http://www.ebay.com.au/itm/281058278731?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1497.l2649 Am I testing the output voltage incorrectly or is my step down faulty? Where should I be placing the black lead of the multimeter to close the circuit in order to test the voltage correctly? I can provide pictures if anything needs clarification. Thanks! AI: I found the datasheet for the device used on your board here. First, this is not a buck regulator like the E-Bay seller is advertising it as. It is a low-dropout linear regulator. Luckily, for the input-output combination you're using, that probably does not cause too big a loss of efficiency. Your efficiency will be about 66%, where an actual buck regulator could get 80-90% at the expense of more components on the board (higher cost). Second, be aware of one other issue that could cause the behavior you saw. This regulator has a minimum load current of 10 mA. If your load (plus the LED onboard the part you bought) draw less than 10 mA, the output voltage could also drift up above the normal operating point.
H: why and how do I use a capacitor in a switch circuit? I have seen many designs of switch circuit: I know that a capacitor will help anti-shake but I realy do not know how i can anti-shake. Does it work like a decoupling capacitor or a low-pass RC filter? and then I want design another switch circuit but do not know how to add a capacitor: AI: The capacitor works like a RC filter to eliminate high frequency bounce when the switch is flipped. For your other circuit, you should connect the cap from the signal pin to ground.
H: Run a processor through USB I am really new to hardware design but have a fairly good knowledge of analog and digital circuits. I have only built one automated car using an Arduino board for a lab. However, I have really good knowledge of computer science. I am trying to build a device with an operating system in it that will be turned on through a USB port. I want the processor to be ARM based and handle FLASH memory of a minimum of 16GB, have a multi touch display and be a really small device. I don't really know how to find any information about even getting started with it. So, my question is: Can a USB port output enough power to run an ARM Cortex M series? How can I find out how much FLASH memory an ARM Cortex can access? Or does it even matter for microprocessor design? How can I find prices for the microprocessors? I would really want someone to guide me on my work. If you want me to clarify anything please let me know. AI: To stay within USB requirements you are allowed to use 500mA @ 5V power. This is certainly enough for the microcontroller but the display may probably need more. Usually the Cortex-M devices feature a little internal (embedded) flash which is usually in the size of 2MB. If you need more memory, you could attache either an SD-Card or some NAND Flash. I'll just give an example for a evaluation board which has a Cortex-M4, a display and some flash: http://www.atmel.com/tools/SAM4S-EK2.aspx. Yet, there is no support for multi-touch, you would have to implement that by yourself (with a display that supports multitouch of course). Prices for controllers: digikey or farnell will give you a good idea, if you are to produce more than 10k pieces you'll probably be able to find cheaper sources.
H: To get rid of useless redundancy--do I realy need a voltage supervisor? I am using a voltage supervisor from MAXIAM(MAX7634A). It monitors VCC_3V3 and VCC_-3V3(I use LM358 to make it a positive one).Power supply distribution is shown below: VCC_3V3: stm32f103 EMP570T144 some logic gates some daughter board that use VCC_3V3 optocoupler MAX3232 bipolar amplifier VCC_-3V3: bipolar amplifier I use LM317 and LM337 to create VCC_3V3 and VCC_-3V3. LM358 is powered by the source of LM317 and LM337. so my circuit of MAX7634A is shown below: I connect 'SUPERVISOR_RESET' to RST pin of STM32 and 'SUPERVISOR_WDO' 'SUPERVISOR_WDI' to IO of STM32. I jusr wonder whether this design is realy meaningful since STM32 has its own watchdog and brown-out check. Suppose that there is somthing wrong with VCC_-3V3, MAX7634A can only reset STM32! It is realy ridiculous. And what if LM317 and LM337 does not work correctly? MAX7634A still offers no hlep in this case. Is is due to my wrong design using a voltage moniter? Can any experienced designer give me any suggestions to improve the whole reliability? AI: Not having used either of those devices in particular I'll leave this as a bit of a list of some generic reasons I can think of why using a seperate supervisor can still be useful: You may want a trip voltage that is different to those offered by the microcontroller. For example that STM32 has a 2.8V odd minimum threshold, maybe you have other logic that stops operating below 3V for example and need a reset to reinitalize it. Some microcontrollers have power-on reset and brown out detection logic that doesn't work well with very slow rise and fall times. Not sure about the STM32 in particular but that's a common reason for using one. While it sounds like it's not used in this application the watchdog output could be used to physically power cycle the system and/or trigger an external alarm. This may be important to protect against some sort of latch-up condition (although that would normally be a design problem). Some of these functions could be useful while the CPU is asleep, for example the watchdog might be used to signal that an bus no longer has activity and force the CPU to wake up rather than reset. Whether it's worthwhile really depends on the overall design. For example a solar-powered datalogger in a remote location might have to deal with very slow rise and fall times and it might be vital that the system recovers from any situation reliably. A counter-example is a consumer USB product where it's likely to be a waste of time because the first thing most people will do is try to unplug it and plug back in.
H: 12F675: ICSP: /MCLR internally tied to Vdd I'm using the 8-pin 12F675 so have to be conservative with pins. I want to use ICSP while having /MCLR internally tied to Vdd so freeing up GP3. The supply will be 5V. I will be re-programming the chip via ICSP multiple times. Reference documents: ICSP; 12F675. Related question: ICSP Circuit: Pic microcontroller MCLR pin My first (main) concern: if /MCLR is internally tied to Vdd, then when the programmer ties it to a voltage other than Vdd, will a damaging current be produced? Can / how should this be done? (Could I simply put a resistor between /MCLR and the programmer's Vpp?) Also, with the resistor, would the internal tying to Vdd prevent the programmer from pulling the pin to Vpp/Gnd? Second (secondary) concern: how can I then use the /MCLR/Vpp/GP3 pin as an input? I appreciate this is more complicated, it probably needs a question of its own. I presume again just a resistor between the PIC's GP3 pin and the driving circuit would do: high enough value so that the programmer can override it. AI: First, read the manual. "MCLR internally tied to Vdd" doesn't mean that the pin is tied to Vdd, but that internally the MCLR logic is driven as if it were always tied to Vdd. In other words, the voltage on the MCLR pin won't effect whether the processor is reset or not. The processor always starts running when power is applied, after startup timer and brownout detect, if any, are applied. In all cases, the MCLR pin is a input. Second, the MCLR/GP3 pin is always a input and therefore always high impedance. How you deal with contention between a programmer and whatever circuit function you have driving that pin is your business. I usually put 20 kΩ in series with the external circuit in cases like this. That won't get in the way of driving a high impedance CMOS input. The programmer is then directly connected to the MCLR pin, when it is connected at all. Most programmers can overcome 20 kΩ impedance when trying to drive the MCRL pin. For more circuit design considerations relating to ICSP, see my writeup on that topic.
H: What modulation does Short wave broadcast stations use? I have small Short wave receiver for the 7 broadcast bands. (49,41,31,22,19 and 16 meters) What Modulation do they use in this? The radio is a small grundig mini 300 world band reciever. AI: All "short wave" public broadcast I have ever listened to were plain old AM. You will find some SSB (single side band) and OOK (on/off keying) interspersed in various bands between the "short wave" stations. Those require different demodulation techniques to recover the signal. A regenerative receiver can demodulate AM and OOK easily, and SSB sortof if very carefully tuned. For most practical purposes, you need a receiver specifically intended for SSB to properly receive it. In general, something called a "short wave radio" is little different from a AM radio except in the range of frequencies it can be tuned to.
H: Driving LEDs directly from microcontroller pins In the circuit I'm designing, I'm using an at91sam7s128 which is a micro-controller with an ARM7 core. Its PIO0 to PIO31 provide 8mA max which is low to handle direct driving of LEDs like this: simulate this circuit – Schematic created using CircuitLab UPDATED: thanks to jippie and Olin Lathrop for telling me about the resistor in series with the LED. So some designers use a safer method, connecting PIO to the base of a transistor that acts like a switch: simulate this circuit Others just make a simple trick. They connect the anode of the LED to the power supply and the cathode to a PIO: simulate this circuit In the last method the LED will turn on when the PIO goes low - acting like GND - and current will be taken from power supply, not from the PIO like in the first method. So do I have to take care of maximum current of the PIO, although it just acts like GND, not like a power supply (like in the first method). When I set the PIO low, does the pin really get connected to GND or something else? NOTE: In this Atmel evaluation kit they use the last method, but I need to make sure. AI: The first and third methods you show are fine, assuming the resistor is sized so that the 8 mA maximum port pin current is not exceeded. The difference between these two methods is whether the low or high side drive transistor in the processor is in series with the LED. Sometimes the low side transistors are a little more beefy, which is why you see method three more than method 1. However, either method is fine as long as you take care to not exceed the current spec for the pin. Also note that some processors have a total current spec that must not be exceeded. For example, you could have 10 pins each driving a LED at 8 mA, which would be fine individually for each pin. However, if the overall processor spec is that all I/O pins together can't source our sink more than 50 mA, for example, then you're still out of spec. Your method two is wrong as drawn. It will likely damage the LED or transistor. To fix it, add a resistor in series with the LED so that the LED current does not exceed its maximum rated value. For example, let's say the LED is rated for 20 mA max, and it drops 2.1 V in that case. With a 9 V supply, that leaves 6.9 V accross the resistor and the transistor. The saturation voltage of the transistor is probably around 200 mV, but for worst case analisys let's just say it's 0. 6.9 V / 20 mA = 345 Ω, so the next size up common value of 360 Ω would be fine. Working backwards, and this time assuming the 200 mV drop on Q1, the LED current will be 6.7 V / 360 Ω = 18.6 mA. Even in a side by side comparison, it will be difficult for humans to distinguish that from the brightness achieved by 20 mA thru the LED. Here is yet another method, which is useful when there is a external supply available that is a bit more than the processor voltage plus the LED drop: This uses the transistor as a switchable current sink, so the exact power voltage (9 V in your case) doesn't matter over a wide range. When the base is 0, the transistor is off and the LED is off. When the base is driven to 3.3 V by the digital output, the emitter will be about 700 mV less, or 2.6 V in this example. The current thru R1 will therefore be 2.6 V / 150 Ω = 17.3 mA. Since most of this current comes from the collector due to the gain of the transistor, that will be the LED current to a reasonable approximation. Note that the 9 V supply voltage didn't enter into the calculations. As long as it is above a minimum value, the transistor will sink very nearly the same current because the transistor gain changes little with collector voltage. If we give the transistor about 700 mV C-E voltage so that it is nicely in its linear region, then the supply must be at least the digital output level plus the LED drop, which comes to 5.4 V in this case. That means the "9 V" supply can vary down to about 5.4 V without effecting the operation of this circuit. The maximum allowable supply is limited by the power dissipation in the transistor. Let's say we want to keep it to 150 mW or less. 150 mW / 17.3 mA = 8.7 V, which is the maximum C-E voltage for the transistor when it is on. Since R1 will drop 2.6 V and the LED 2.1, that means the supply can't exceed 13.4 V. So this circuit will work nicely and run the LED at the same brightness even if the "9 V" supply ranges from about 5.4 to 13.4 volts.
H: Confusion between Voltage gain & Voltage gain in decibels (dB) The definition of voltage gain is \$V_{\text{out}}/V_{\text{in}}\$. However, I read some articles about the gain in decibels, and I have a confusion now. Here is an article about it: https://en.wikipedia.org/wiki/Gain#Voltage_gain Here, I understand the definition of Power gain in decibels, which is $$ \text{Gain} = 10 \log \left( {P_{\text{out}} \over P_{\text{in}}} \right)\text{ dB} $$ However, I can't understand why Voltage gain in decibels is $$ 20 \log \left( {V_{\text{out}} \over V_{\text{in}}} \right)\text{ dB} $$ If \$ 20 \log \left( {V_{\text{out}} \over V_{\text{in}}} \right)\text{ dB} \$ is derived from $$ 10 \log {\left( {V_{\text{out}}^2 \over R_{\text{out}}}\right) \over \left({V_{\text{in}}^2 \over R_{\text{in}}}\right) }\text{ dB} $$ then this is the power gain, not the voltage gain, isn't it? However, the Wikipedia says it is a formula for the Voltage gain in decibels. I thought the voltage gain in decibels would be \$ 10 \log \left( {V_{\text{out}} \over V_{\text{in}}} \right)\text{ dB} \$. Actually, the example section in that linked page uses voltage gain \$ V_{\text{out}} \over V_{\text{in}} \$. Why did \$V^2/R\$ suddenly come out from the voltage gain in decibels? AI: As you say, the decibel is a unit of power ratio. \$ G\ [\mathrm{dB}] = 10 \log_{10}\left(\dfrac{P_1}{P_2}\right)\$. When the input and output impedances are equal and then we can express the gain in terms of voltage as \$ G\ [\mathrm{dB}] = 20 \log_{10}\left(\dfrac{V_1}{V_2}\right) \$ I wouldn't call this the "voltage gain in decibels." I'd rather say it's the decibel gain, calculated from the voltage gain. Sometimes, you will see a voltage gain expressed in decibel according to this formula even when the input and output impedances are different. There is no technical justification for this --- it's simply a shorthand practice that's become common through usage.
H: Can I estimate remaining battery life by measuring its voltage with the same MCU that it powers? I'd like to estimate the remaining battery life of a battery that powers a microcontroller. Could I accomplish this by simply leading the battery into the MCU's built-in ADC? My idea is that I could plot the voltage over time to figure out how much battery life remains. But would the change in voltage be noticeable? And would it be a problem that the same battery powers the MCU (and ADC)? AI: You can do this (assuming voltage is a predictable function of remaining life, but that's another issue) as long as there is a fixed voltage reference available in the system somewhere. Some micros have a fixed voltage reference built in, which can usually be read by the internal A/D or applied as the A/D scale. If not, you have to supply some external reference. Note that due to power consumption you may want the micro to switch on this reference only for a short time around battery readings, which don't need be very often relative to the time it takes to do a reading.
H: How to find τ in these circuits? I know that \$τ = \frac{L}{R}\$, but what is \$R\$ in this formula? It seems to be the total resistance, but how to find it in the schematics? AI: The arrows on the switches seem to indicate they are opening. I assume (but your problem statement should be more clear about this) that this means the switches are closed for t < 0 and open for t > 0, and you want to solve for the indicated voltages as a function of time for t > 0. For the 1st one, once you open the switch, there's only one resistor in the circuit, so R is given by its resistance. For the 2nd one, after the switch opens, there's no current through the 4 kOhm resistor, so you can ignore it. What's the equivalent resistance of the remaining two resistors?
H: Is there a minimum output current for voltage regulators? I need both 4.5V and 3.3V for a project, and my idea was to power it using a single battery and a voltage regulator. A regulator I found (MCP1700) has an output current of 200 mA, but I'm only going to pull 3-4 mA. Is that large difference a problem in any way? I couldn't find that information in the data sheet. AI: Note this line in your datasheet: There's no minimum load current, but if the load current is below 100 uA, there's no guarantee how well the regulator will be able to maintain the output voltage.
H: What to look for in the datasheet when choosing a MOSFET? I thought that choosing the right MOSFET for my LED strip would be easy until I discovered how many different models there are. Basically I want a MOSFET that allows me to control with PWM a 12V 6A (MAX) led strip, but every time I see the Vgs I get confused because of numbers like +-20V.. (I'm controlling it with an ATtiny13A or ATtiny85 - 5V pin output) I done a lot of searching a came across a lot of different models: IRFZ44N, TIP120, STB36NF06L and a bunch more.. but I not sure if they will do the job What MOSFET should I use and how do I read in the datasheet why this is a good choice? I am new to hobby electronics. AI: The 12V and 6A is a good starting point. This tells me you need a mosfet with a max drain-source voltage capability greater than 12V so 20V would be a minimum criteria for this. You want to switch 6A and you'll want it to do so with minimum volt-drop - just like a relay contact so you are looking for Rds(on) below (say) 0.1 ohms. This means at 6A it will develop a small voltage across the device of 0.6V (ohms law). However, that will produce a power disippation of 6 x 6 x 0.1 W = 3.6W so if you are looking for a surface mount device you would prefer a lower disippation of maybe 0.5W max. This means Rds(on) would be more like 0.014 ohms. So far, your application needs a 20V transistor, capable of switching 6A with an on resistance no more than 0.014 ohms. Vgs is "like" the coil voltage on a relay - it's how much voltage you need to apply to the coil to get it to switch BUT for a FET it's a linear thing and, if you don't apply enough voltage, the mosfet will not turn on properly - its on-resistance will be too high, it'll get warm under load and have a volt or two across it when you want a nice low resistance. You then need to inspect the details of the spec to see how much you need to apply to guarantee the low on-resistance you want. A bit more on this further down. The IRFZ44N has on the front page of the data sheet: - Vdss = 55V, Rds(on) = 17.5 milli ohms and Id = 49A It's not a surface mount device therefore a little more heat generated isn't going to matter too much (with a heatsink) so it'll do what you want it to do but I'd research a device with smaller Vds (say 20V) and you'll probably find one with a lot less than 10 milli ohms on resistance. If you look at the electrical characteristics on page 2 you'll see that the 17.5 milli ohms on resistance requires a 10V drive voltage on the gate (3rd line down in the table). Less than this drive level and the on-resistance rises as would the heat produced. At this point I can't decide for you any more but I think you might be looking for a device that will operate from logic levels. In which case the IRFZ44N won't do. The STB36NF06L is a little higher with the on-resistance but the spec does suggest it will work from a 5V drive on the gate - see electrical characteristics (ON) but i'd still be tempted to find one that is more suitable. I'd be tempted by this. The PH2520U is a 20V, 100A, 2.7 milli ohm device when the gate voltage is 4.5V. If your logic levels are 3V3 check figure 9 to see it will work well at 3V3. One last thought about things - you are wanting to PWM a load and if the frequency is high you'll find that the gate capacitance takes some drive current into the gate to get it moving up and down quickly. Sometimes it better to trade off on-resistance to find a device with lower Vgs capacitance. You're into horse-trading now. Keep as low as you can on switching frequency and it should drive ok from a 5V logic pin.
H: Binary to Gray Code I have built this 3-bit Binary to Gray Code circuit. I would like to know if it is correct. I have used 2 Xor gates. AI: Your circuit is ok but you have inverted the bits order. If you try to make the truth table of your circuit you can see that sometimes changes more than one bit at a time and so that it isn't Gray Code. This is the circuit with the bits in the correct order: simulate this circuit – Schematic created using CircuitLab
H: Sending ADC measurements with UART I want to measure signal with ADC and send measurements to PC to generate plots. My code: ADC_SoftwareStartConv(ADC3); while(1) { ADC3ConvertedVoltage = ADC3ConvertedValue * 3300/0xFFF; ADCresultsTab[i] = ADC3ConvertedVoltage; sprintf(str,"%u",ADC3ConvertedVoltage); USART2_SendText(str); USART2_SendText(";"); } The problem is that I want to sample signal as fast as it is possible. Here I'm using baud rate = 256000 (Windows only). What is the possibility to sample signals faster? What is more optimal code for sample and send measurement? I see that the problem there is UART transmission. And my additional questions are: Is it real time measurement with this code? How it should be made if I want real time measurement? AI: While more elaborate interrupt- or DMA-based code would be necessary to achieve the best performance, relatively minor improvements to your code would improve the situation already. I'd start by transmitting samples in binary instead of in text. This requires slightly more work at the receiving end, but will cut the required UART bandwidth by at least 2-3x (2 bytes per sample vs. up to 6 in text with separator). You can also readily increase the baud rate to, e.g., 921.6kbps, which is standard and should be well supported on the receiving end. Assuming a standard STM32F2 architecture, you could go up to 7.5Mbps but you'd need to check support for that at the receiving end. With 2 bytes per sample and 921.6kbps, you would get a throughput of about 46'000 samples/s. At 7.5Mbps, you'd get 370'000 samples/s. If your application allows it, you could reduce the resolution to 8 bits and thus use a single byte per sample, effectively doubling the throughput in samples/s. While 370ksamples/s is not bad, it's still pretty far from the theoretical 6Msamples/s (assuming STM32F2, 12bit conversion and using the 3 ADC in triple interleaved mode). This translates to 12MB/s of data to transfer from the MCU to the computer, which is no trivial amount. UART will not do. SPI, at a max of 30Mbps (2-3MB/s) wont do it either. Writing to a microSD card via SDIO would come close. USB 2.0 would do it but is much more complicated software-wise and requires external components for the PHY. ETH would do fine as well but would require additional components and a network stack to be implemented on the MCU. This complexity explains why, in most applications, the samples are buffered in memory and transferred asynchronously.
H: How to cut interrupt code to minimum? I have some interrupt let's say from UART to make a real example: void USART2_IRQHandler(void) { int i = 0; if(USART_GetITStatus(USART2, USART_IT_RXNE) != RESET) { static uint8_t cnt = 0; char t = USART_ReceiveData(USART2); if((t!='!')&&(cnt < MAX_STRLEN)) { received_string[cnt] = t; cnt++; } else { cnt = 0; if(strncmp(received_string,"connection",10) == 0) { USART2_SendText("connection ok"); } else if(strncmp(received_string,"sine",4) == 0) { DAC_DeInit(); DAC_Ch2SineWaveConfig(); USART2_SendText("generating sine"); } else { USART2_SendText("unknown commmand: "); USART2_SendText(received_string); } for (i = 0; i <= MAX_STRLEN+1; i++) // flush buffer received_string[i] = '\0'; } } } But interrupt code should run as fast as possible. And here we have some time consuming functions inside. The question is: What is the correct way to implement interrupts which call time consuming functions? One of my ideas is to create flags buffer and flags in interrupt. And process flag buffer in main loop calling appropriate functions. Is it correct? AI: UART is indeed a pretty typical case because many applications require that some processing is done in response to command/date received via the serial port. If the application is architectured around an infinite processing loop, as it is often the case, one good way is to use DMA to transfer received bytes into a small buffer and process this buffer at each loop iteration. The following example code illustrates this: #define BUFFER_SIZE 1000 uint8_t inputBuffer[BUFFER_SIZE]; uint16_t inputBufferPosition = 0; // setup DMA reception USART2 RX => DMA1, Stream 6, Channel 4 RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_DMA1, ENABLE); DMA_InitTypeDef dmaInit; DMA_StructInit(&dmaInit); dmaInit.DMA_Channel = DMA_Channel_4; dmaInit.DMA_PeripheralBaseAddr = ((uint32_t) USART2 + 0x04); dmaInit.DMA_Memory0BaseAddr = (uint32_t) inputBuffer; dmaInit.DMA_DIR = DMA_DIR_PeripheralToMemory; dmaInit.DMA_BufferSize = BUFFER_SIZE; dmaInit.DMA_PeripheralInc = DMA_PeripheralInc_Disable; dmaInit.DMA_MemoryInc = DMA_MemoryInc_Enable; dmaInit.DMA_PeripheralDataSize = DMA_PeripheralDataSize_Byte; dmaInit.DMA_MemoryDataSize = DMA_MemoryDataSize_Byte; dmaInit.DMA_Mode = DMA_Mode_Circular; dmaInit.DMA_Priority = DMA_Priority_Medium; dmaInit.DMA_FIFOMode = DMA_FIFOMode_Disable; dmaInit.DMA_MemoryBurst = DMA_MemoryBurst_Single; dmaInit.DMA_PeripheralBurst = DMA_PeripheralBurst_Single; DMA_Init(DMA1_Stream5, &dmaInit); USART_DMACmd(port, USART_DMAReq_Rx, ENABLE); // loop infinitely while(true) { // read out from the DMA buffer uint16_t dataCounter = DMA_GetCurrDataCounter(DMA1_Stream5); uint16_t bufferPos = BUFFER_SIZE - dataCounter; // if we wrapped, we consume everything to the end of the buffer if (bufferPos < inputBufferPosition) { while (inputBufferPosition < BUFFER_SIZE) processByte(inputBuffer[inputBufferPosition++]); inputBufferPosition = 0; } // consume the beginning of the buffer while (inputBufferPosition < bufferPos) processByte(inputBuffer[inputBufferPosition++]); // do other things... } What this code does it to first setup a DMA channel to read from USART2. The correct DMA controller, stream and channel is dependant on which USART you use (check the STM32 reference manual to figure out which combination is needed for a given USART port). Then the code enters the main infinite loop. At each loop, the code checks whether something has been written (through DMA) in inputBuffer. If so, this data is processed by processByte, which you should implement in a way that is similar to your original IRQ handler. What's nice in this setup is that there is no interrupt code -- everything runs synchronously. Thanks to DMA, received data just "magically" appears in inputBuffer. The size of inputBuffer should be carefully determined though. It should be large enough to contain all the data you can possibly receive during a loop iteration. For example, with a baud rate of 115200 (about 11KB/s) and a maximum loop time of 50 ms, the buffer size should be at least 11KB/s * 50 ms = 550 bytes.
H: Connect micro gearmotor to 5V battery Would 3 motors (like this one http://www.pololu.com/catalog/product/993) connected to a 5V battery (like this one http://www.dx.com/p/59438) work? AI: The motors are rated for 6 V and that battery power supply for 5 V. The motors should definitely spin at 5 V unloaded, but will produce less torque and lower top speed than if they were run at 6 V. Beyond that, it's impossible to say what you think "work" means.
H: Single Bit Error Correction & Double Bit Error Detection Can someone explain, in their own words, what Double Bit Error Detection is and how to derive it? An example of corrupted data and how to detect the double bit would be appreciated. I can do Single Bit Error Correction using parity bits as well as correct the flipped bit. Now when I reach Double Bit Error Detection I understand there is an extra DED bit, which is somehow related to the even or odd parity of the bit sequence. However, I am lost. What I read: http://en.wikipedia.org/wiki/Error_detection_and_correction Video on Hamming Code: http://www.youtube.com/watch?v=JAMLuxdHH8o AI: A Hamming code is a particular kind of error-correcting code (ECC) that allows single-bit errors in code words to be corrected. Such codes are used in data transmission or data storage systems in which it is not feasible to use retry mechanisms to recover the data when errors are detected. This type of error recovery is also known as forward error correction (FEC). Constructing a Hamming code to protect, say, a 4-bit data word Hamming codes are relatively easy to construct because they're based on parity logic. Each check bit is a parity bit for a particular subset of the data bits, and they're arranged so that the pattern of parity errors directly indicates the position of the bit error. It takes three check bits to protect four data bits (the reason for this will become apparent shortly), giving a total of 7 bits in the encoded word. If you number the bit positions of an 8-bit word in binary, you see that there is one position that has no "1"s in its column, three positions that have a single "1" each, and four positions that have two or more "1"s. If the four data bits are called A, B, C and D, and our three check bits are X, Y and Z, we place them in the columns such that the check bits are in the columns with one "1" and the data bits are in the columns with more than one "1". The bit in position 0 is not used. Bit position: 7 6 5 4 3 2 1 0 in binary: 1 1 1 1 0 0 0 0 1 1 0 0 1 1 0 0 1 0 1 0 1 0 1 0 Bit: A B C X D Y Z - The check bit X is set or cleared so that all of the bits with a "1" in the top row — A, B C and X — have even parity. Similarly, the check bit Y is the parity bit for all of the bits with a "1" in the second row (A, B and D), and the check bit Z is the parity bit for all of the bits with a "1" in the third row (A, C and D). Now all seven bits — the codeword — are transmitted (or stored), usually reordered so that the data bits appear in their original sequence: A B C D X Y Z. When they're received (or retrieved) later, the data bits are put through the same encoding process as before, producing three new check bits X', Y' and Z'. If the new check bits are XOR'd with the received check bits, an interesting thing occurs. If there's no error in the received bits, the result of the XOR is all zeros. But if there's a single bit error in any of the seven received bits, the result of the XOR is a nonzero three-bit number called the "syndrome" that directly indicates the position of the bit error as defined in the table above. If the bit in this position is flipped, then the original 7-bit codeword is perfectly reconstructed. A couple of examples will illustrate this. Let's assume that the data bits are all zero, which also means that all of the check bits are zero as well. If bit "B" is set in the received word, then the recomputed check bits X'Y'Z' (and the syndrome) will be 110, which is the bit position for B. If bit "Y" is set in the received word, then the recomputed check bits will be "000", and the syndrome will be "010", which is the bit position for Y. Hamming codes get more efficient with larger codewords. Basically, you need enough check bits to enumerate all of the data bits plus the check bits plus one. Therefore, four check bits can protect up to 11 data bits, five check bits can protect up to 26 data bits, and so on. Eventually you get to the point where if you have 8 bytes of data (64 bits) with a parity bit on each byte, you have enough parity bits to do ECC on the 64 bits of data instead. Different (but equivalent) Hamming codes Given a specific number N of check bits, there are 2N equivalent Hamming codes that can be constructed by arbitrarily choosing each check bit to have either "even" or "odd" parity within its group of data bits. As long as the encoder and the decoder use the same definitions for the check bits, all of the properties of the Hamming code are preserved. Sometimes it's useful to define the check bits so that an encoded word of all-zeros or all-ones is always detected as an error. What happens when multiple bits get flipped in a Hamming codeword Multible bit errors in a Hamming code cause trouble. Two bit errors will always be detected as an error, but the wrong bit will get flipped by the correction logic, resulting in gibberish. If there are more than two bits in error, the received codeword may appear to be a valid one (but different from the original), which means that the error may or may not be detected. In any case, the error-correcting logic can't tell the difference between single bit errors and multiple bit errors, and so the corrected output can't be relied on. Extending a Hamming code to detect double-bit errors Any single-error correcting Hamming code can be extended to reliably detect double bit errors by adding one more parity bit over the entire encoded word. This type of code is called a SECDED (single-error correcting, double-error detecting) code. It can always distinguish a double bit error from a single bit error, and it detects more types of multiple bit errors than a bare Hamming code does. It works like this: All valid code words are (a minimum of) Hamming distance 3 apart. The "Hamming distance" between two words is defined as the number of bits in corresponding positions that are different. Any single-bit error is distance one from a valid word, and the correction algorithm converts the received word to the nearest valid one. If a double error occurs, the parity of the word is not affected, but the correction algorithm still corrects the received word, which is distance two from the original valid word, but distance one from some other valid (but wrong) word. It does this by flipping one bit, which may or may not be one of the erroneous bits. Now the word has either one or three bits flipped, and the original double error is now detected by the parity checker. Note that this works even when the parity bit itself is involved in a single-bit or double-bit error. It isn't hard to work out all the combinations.
H: Constructing an Encoder I understand an Encoder is 2^n input lines and n output lines`. I want to construct an Encoder from scratch so I can understand how it works, so that I can construct any other Encoder in the future. I believe that the Input lines are an address to the output lines. So for a 4 by 2 encoder we would first construct a truth table. My biggest problem is I can't construct the output part of the truth table for an encoder. I don't know how to get the output, if I knew the logic I could build it. Encoder Truth table with what I think the output is. http://www.flickr.com/photos/76226081@N08/8931456484/ Every time the input lines are x x 0 0 I put a 1 for O0. Every time the input lines are x x 0 1 I put a 1 for O1 AI: The solution is found by searching for "encoder" on Wikipedia: Key point, the only valid inputs are when exactly one of the inputs is high. That means there are lots of don't cares in the output columns of the truth table.
H: Voltage form at diode bridge I want to find the output voltage of a circuit like this: and this is my Matlab code to solve it: function find_x t = 0:0.001:10; x0 = 0; R1 = 90000; R2 = 1000; C = 0.001; [t,x]=ode45(@rhs, t , x0); plot(t,x); function dxdt = rhs(t,x) dxdt = -(C/R1 + C/R2)*x + C/R1*abs(sin(100*pi*t)) ; end end but it gives me the wrong answer, because the right answer is nearly a DC voltage. Can anybody help me? AI: It looks like your differential equation is not set up correctly. The basic equation to start with is \$ I = C \dfrac{\mathrm{d}v}{\mathrm{d}t}\$ and for the resistors \$ I = \dfrac{v}{R}\$ That means you should have something like \$ \dfrac{\mathrm{d}v}{\mathrm{d}t} = \dfrac{-v}{R_1 C} + \dfrac{V_s(t) - v}{R_2 C}\$ where I've buried the rectified sinusoid into the \$V_s(t)\$. Notice that C appears in the denominators, not the numerators. Also, the source only charges the capacitor through the 90 kOhm resistor, so with your current values the charge up has a time constant of 90 s. You'll want to run the simulation for 5 or 10x that time constant to see the output settle down around the steady-state value.
H: Is my zener diode labeled wrong, or am i seeing a strange failure mode? I'm experimenting with a power supply circuit to bring 24VAC down to 5VDC. I have an L7805CV, but rectified (a bridge) and smoothed (a 33μF electrolytic), the input is still \$40V_{peak}\$, which is more than the max input voltage the regulator can take. Looking at the regulator's datasheet, it suggests the following "High Input Voltage Circuit", which notes "\$V_{in} = V_i - (V_Z + V_{BE})\$", but doesn't offer any guidance on Q1 or R1: simulate this circuit – Schematic created using CircuitLab I have a 27V (½W) zener (NTE 1N5033A), but either i'm misunderstanding something, my diode is mislabeled, or i've damaged it, because when i orient it as indicated, with the striped cathode end toward \$V_i\$, the voltage at \$V_{in}\$ is the full 40V minus approx. 2 diode-drops and the voltage across the zener is only about 0.7V. (Note that at this point, i have a 33k resistor to ground in place of the 7805 so i don't damage it until i get the limiter right.) My multimeter's diode setting seems to indicate that the markings on the diode are backward. That is, it behaves opposite the way my other diodes do. If i install it the other way around, the voltage at \$V_{in}\$ is only about 12V, which is approximately 40V - 27V - a reasonable \$V_{BE}\$. It is possible that it's really just marked wrong? I made some mistakes wiring it up the first time and something let out a wisp of smoke before i cut the power, but i wasn't able to figure out which component, and everything i've been able to test measures okay. Could overcurrent have somehow magically reversed this diode? I added some bits to make it simulate better: https://www.circuitlab.com/circuit/9b6y3x/weird-zener-limited-7805/ Here's a picture of the diode in situ, along with its packaging: Here's a picture of a 7.5V zener from the same manufacturer with the same diagram on the back of the package: The second Zener's polarity is what you'd expect; only the 27V zener is weird. AI: The behavior you describe reproduces in the simulated circuit exactly. If we configure the Zener to a 25 reverse voltage and have it in the circuit the right way, Q1 drops around 25V. If we reverse the Zener, we get approximately two junction drops, as you found empirically. So it looks like you have the right circuit, and that the Zener is marked wrong. The stripe on the diode should correspond to the cathode bar on the schematic. A long-standing rumor is that NTE buys other manufacturers' semiconductors and stick their own name and their own NTE-specific part numbers on them, possibly after testing the parts to figure out what they are. Maybe your diode came from a batch that ended up as NTE because they were marked backwards.
H: Thoughts on making a hand-held OCR I have an electronic project about a OCR that could be held in hand and used like a Tipp-Ex mouse (image) to scan words. As I am an amateur in electronics, I don't really know what sensor(s) I can use to get a complete image of the word that I could process afterward. I thought of a gyroscope/accelerometer to track movements and an image sensor. My questions are about the later: What kind of image sensor should I use ? (Resolution, focal point, on chip features,... ) Is a LED enough to light the text or should I have some laser ? I think these questions can be (partially) solved using Google but I am more looking for your experience in this field. AI: LED will be more than sufficient for lighting the text. Scanning will be very dependant on getting a good image through optics. If I was doing this I'd consider a "linear" (one-dimensional) CCD as an imaging element; this sort of thing is used in normal 2D flatbed scanners. As an amateur, minturisation will be your main problem.
H: Efficiency of a SMPS I will like to understand the term efficiency in a SMPS design. Is there a way to determine the best efficiency for a particular design? AI: What don't you understand? Efficiency is simply a function of the ratio of power out to power in. A Switch-mode power supply that draws 5W in and supplies 4W of output power has an efficiency of 80% (\$\frac{4}{5} = 0.8\ \$). A linear regulator generally has very poor efficency. Take, for example, a linear regulator that is producing 5V from a 12V source, with 1A of draw: \$P_{in} = 12V * 1A = 12W\$ \$P_{out} = 5V * 1A = 5W\$ \$\text{Efficiency} = \frac{5W}{12W} = 0.4166... = ~41.6\%\$ I'm ignoring the power consumption of the regulator itself here, since it will be small in proportion to the overall power. Yikes! 40% efficiency! That's terrible. It also means the other ~60% of the power (7 watts!) will be dissipated as heat, so you'll need a big heatsink to get rid of the waste-heat. Now, most switchers have efficiencies in the 70-90% range. Lets look at the above 12V-5V converter with a 80% efficient switcher. \$P_{out} = 5V * 1A = 5W\$ \$P_{in} = P_{out} * \frac{1}{0.8} = 6.25W\$ \$I_{in} = \frac{6.25W}{12V} = ~0.52A\$ Well, since the efficiency has gone up, the current drawn on our input is now less then the current out the output! This is possible because, remember, energy is conserved (minus the efficiency losses), not current or voltage. You can also see that the dissipation in the switch-mode converter is only 1.25W (\$P_{in} - P_{out} = \text{dissipation}\$).
H: Help With Paper Calculation for Peak Rectifier Design Problem I am tasked with designing a circuit for the following particulars: A peak rectifier will be used as part of a DC power supply to supply an average DC output voltage of 15V, with maximum +/- 1V ripple. The load is 150 Ohms and the rectifier is fed from a 120 V, 60 Hz source after passing through a transformer. The diodes have 0.7 V drop when conducting. I decided to use a half-wave rectifier, and now I need the voltage seen by the circuit after it passes the transformer. Since the windings of the transformer are not specified, I thought a possible way to do this might be to use the given average load voltage, and solve for the rms value of the source seen by the circuit, since VLavg should = the average of the source - the diode drop integrated over the conduction interval. As such, I obviously needed to find the conduction interval, but I ran into a problem: I need the rms source voltage I'm trying to find to calculate the conduction interval. Would solving for the conduction interval in terms of the source voltage that I want be sufficient, and then integrating as I wanted to, or is there a simpler method based on the specifications that I have ignored? EDIT: Thought I might add my circuit to date for clarity. Note that the diode is assumed to have a constant 0.7V drop. simulate this circuit – Schematic created using CircuitLab AI: You can make some simplifying assumptions. They will add less noise to the result than the fluctuation of line voltage this circuit will encounter, so don't worry about it too much. Assume that the capacitor is charged at the peak of each line cycle, and then discharges thru the resistor the rest of the time. The cap therefore has to not drop more than 2 V during 17 ms. You say your acceptable output voltage is 14 to 16 volts, so assume the cap gets charged to 16 volts. Discharging from 16 to 14 volts would take .134 time constants, since .134 time constants is 17 ms, you know that a full time constant is 125 ms, which is R x C. 125 ms / 150 Ω = 830 µF. Of course in practise you don't want to cut it that tight. At the very least, you want a 1 mF capacitor, but I'd probably use 1.5 mF or 2 mF. That will be electrolytic at this capacitance and voltage level. It should be rated for at least 20 V, although 25 V would provide longer life. Note that the current provided by the transformer will come is large and short spikes, and their level will be directly proportional to the input line voltage. For robustness, you should design this circuit to operate properly from at least 105 V to 125 V AC. This gets tricky. There is a reason we use switchers and regulation nowadays.
H: How DDR2 SDRAM works? I have the Xilinx Spartan-3AN Starter Kit and I need to use the on board DDR2 SDRAM (MT47H32M16CC-XX). Until now I only used Static RAM and this type of memory is new for me. Can someone explain me how this memory works? What are the differences compared with a SRAM? AI: Given the lack of detail in your question, here is a brief generic overview. SDRAM, like SRAM, is a memory. To write to it, you present an address and some data, and to read from it, you present and address and get some data back some time later. However, unlike SRAM, SDRAM requires both initialization/configuration at startup as well as ongoing refresh activity in order to operate correctly. Also, the internal structure imposes a multi-level addressing scheme involving banks, rows and columns. All of this means that you need to have a controller for the SDRAM inside your FPGA that manages all of these activities while working within the timing and sequencing rules imposed by the SDRAM chip. This controller generally takes the form of a fairly complex state machine that runs at the same speed as the SDRAM interface. Xilinx provides a SDRAM controller generator as part of its design toolchain, and in some FPGAs, there is a dedicated, or "hard core" memory controller.
H: How can one mount PCB-mounted TO-247 devices to a large plate heatsink? I want to mount multiple PCB-mounted TO-247 devices to a single large heatsink, something comparable to this: My devices may or may not have mounting holes through them, and their tabs may or may not be isolated. Any approach will have to support the use of mounting clamps and isolation pads. I'm using TO-247 devices for cost reasons; the smallest chassis-mount devices I'm aware of are SOT-227, which cost much more than similar parts in TO-247 packages. What approaches to this problem are used? What difficulties are presented by those approaches? AI: I did this once: - Use a strap of sturdy metal to push the transistors down onto the base of the heatsink. You'll need to drill holes in the sides of the heatsink to hold the strap in place. Legs of transistors point upwards and solder into PCB. Transistors and PCB can be removed from the heatsink by undoing screws holding strap.
H: LED remains off on ATmega16 I wrote this simple program: #include <avr/io.h> int main(void) { DDRA = 0xff; PORTA = 0xff; while(1) { } } When I program it to my brand new ATmega16A-PU, avrdude tells me that everything's fine. But when I connect an LED to port A, it never gets enabled. For compiling the program and flashing it onto the ATmega, I use the following commands: avr-gcc -mmcu=atmega16 -c -o test.o test.c avr-gcc -mmcu=atmega16 -o test.elf test.o avrdude -p m16 -c avrispv2 -P usb -U flash:w:test.elf The following pins of the microcontroller are connected: 40 PA0 ---------> 220 Ω --> green LED --> GND 06 PB5 (MOSI) --> MOSI of the programmer 07 PB6 (MISO) --> MISO of the programmer 08 PB7 (SCK) ---> SCK of the programmer 09 RESET -------> RESET of the programmer 10 VCC ---------> VCC of the programmer 11 GND ---------> GND of the programmer When I connect the left end of the 220 Ω resistor directly to VCC, the LED glows, so the LED is ok. The microcontroller is brand new and I already tried another one (also brand new), so I think they are ok too. EDIT: the fuses are set to 0b10011001 (high) and 0b11100001 (low). Any idea, why the microcontroller does not set port PA0 to VCC? AI: Too much details for a comment, so I chose to write it as answer. Try these commands: cflags="-g -DF_CPU=1000000 -Wall -Os -Werror -Wextra" avrType=m16 avr-gcc ${cflags} -mmcu=${avrType} -Wa,-ahlmns=test.lst -c -o test.o test.cpp avr-gcc ${cflags} -mmcu=${avrType} -o test.elf test.o avr-objcopy -j .text -j .data -O ihex test.elf test.hex avrdude -p ${avrType} -c avrispv2 -P usb -v -U flash:w:test.hex Check http://git.linformatronics.nl/gitweb/?p=makefile;a=summary for a generic Makefile. It'll need some tweaking as I am using a different programmer and controller, but it should be pretty straightforward.
H: Finding Impulse Response for System? I have an LTI system with input and output related as per below: $$ y(t) = \int_{-\infty}^t \! x(T-2)e^{-(t-T)} \, \mathrm{d}T $$ and I need to find \$h(t)\$. I am familiar with two methods of finding \$h(t)\$, namely, comparing the form to the traditional convolution integral and knowing that \$ h(t) = L[\Delta(t)] \$ and relating those forms, but each time, the \$(T-2)\$ bit trips me up. For the first comparison method, if I set \$\lambda = T-2\$, then \$T = \lambda + 2\$. That puts the x function in an expected form, but turns \$ e^{-(t-T)}\$ into \$e^{-(t - \lambda + 2)}\$ and then I'm not sure how to proceed, given that the added \$+2\$ doesn't give the expected form of \$t - \lambda\$ alone. AI: \$h(t) = \int_{-\infty}^t \! \delta(T-2)e^{-(t-T)} \, \mathrm{d}T = e^{-(t-2)}u(t-2)\$ The delta "function" is zero except where the argument is zero, i.e., when T=2, where it has an area of 1. So, if \$ t < 2\$, the integral is zero. If \$ t \ge 2\$, the integral equals the area of the delta function multiplied by the value of the exponential when T = 2.
H: How to power "arduino" from wall? So I have a fake "arduino" that I put together (The main components on a breadboard, i.e. ATmega328, capacitors, ocilator, etc) and I am trying to use it to overide a light switch (When the light switch is off, power is off, when it is on, the microprocessor can shut it off manually, or leave it on.) Anyway, I have everything deesigned and working, but now I want to figure out a way that I can power the ATMega from the electricity flowing through the lightswitch. It will be inside the the wall, so I can't use a tradition wall AC to 5V converter, and I am having trouble finding what I am looking for on google, so does anybody here have a solution? How can I power an ATMega328 from the electricity flowing through a lightswitch? DO I need to set up a power 'limiter' somehow? AI: You should be VERY careful when working with line voltage in close proximity to low voltage electronics. It's easy to make a mistake and fry a circuit, or worse. That being said, the cheapest and most realistic way to do this would be to run the Micro controller from a separate wall wort, and use a large relay to control the flow of AC current. There are plenty of wall converters that you can take apart and miniaturize enough to fit inside a wall, eg. an apple iPhone charger. The relay would then be directly in line with the switch, as in the schematic. When the switch is off, the microcontroller has no effect. When the power is on, the microcontroller will have control of the current the same way the light switch does, without shutting itself off. This is just a very high-level overview, but should serve as a good place to start.
H: How can output voltage and current of a DC-DC converter both be higher than input? I'm working on a TFT LCD Supply and using a step up DC- DC converter from Maxim, the MAX17062. I want to find the input current. The datasheet lists that as 2.5mA. I have a doubt: if the input current is 2.5mA and the input voltage is 5V, how can the output be of higher voltage and higher current? I'd say that that would violate the conservation of energy. AI: The 2.5 mA referred to in the datasheet is the quiescent current, i.e. the current drawn by the device when there is no power being drawn from the output. The operating input power will be found by computing the output power drawn, taking into account efficiency, and with the quiescent current as an overhead.
H: Isolated vs non-isolated triacs Bt136-600 is an example of a non-isolated triac, while BTA08 is an example of an insulated triac. What is the difference between an isolated and non-isolated triac? They seem to have the same symbol which is a bit confusing. Could an isolated triac be substituted for a non-isolated triac plus an optoisolator? I'm guessing not. Is there an equivalent circuit to an isolated triac using a non-isolated triac? AI: Isolation in this context is an entirely physical packaging aspect. In say an unisolated (or normal) TRIAC in a TO22 package the metal tab will usually be the Anode which is used in conjunction with the gate for turn on or what would be the Cathode in an SCR. In an isolated TO22 package TRIAC the metal tab still exists but is completely encased electrically in an insulator (usually a plastic) including the inner surface of the mounting hole. The insulation is designmed to be adequate that the TRIAC can be placed on and secured to a heatsink at any potential difference liable to be encountered in a circuit where it is working within its ratings. Data sheets will give details but I'd expect a 400V rated TRIAC to have say 1000V insulation nad probably more. The same effect is achieved in a normal TRIAC with insulating mounting hardware. More fiddly, needs extra pats, easier to get wrong. Unisolated will usually be cheaper in material costs but may be more costly all up in a production environment. For amateurs isolated TRIACS used at mains voltages make staying alive and keeping your circuit alive appreciably easier.
H: Trying to understand how this op-amp sound module works This is a schematic for the ZX sound module: My understanding is that the first part is a high-pass filter followed by a non-inverting amplifier. But isn't the second op-amp a comparator? It seems to me that it would output a HIGH if V- < 0.01*Vcc, or LOW otherwise. So, I am just wondering how it outputs a "0-5V varying output" as described in the note above the schematic. AI: The 1st stage not only amplifies the mic input but rectifies it - you get half wave rectified audio superimposed on the 0V rail. There are no diodes for the rectification - the 1st stage relies on the op-amp being biased at 0V and it's output cannot go below 0V therefore the output is 0V for no signal and as signal rises, the output develops positive pulses equivalent to the half cycles of the input signal. The 2nd stage is a comparator (like you assumed) with a threshold voltage set at about 72mV (1k and 68k on a 5V rail) BUT I think they have the op-amp drawn the wrong way round so I'm going to look a little further into this one. Aha: - Pin 6 and Pin 5 are incorrectly shown in their diagram. The above picture is the proper pin-out and the guys making the module have slipped-up in their diagram showing pin 6 as +Vin!!