Saturday 31 May 2014

What's the difference between a potentiometer and a rheostat?


I've seen that a number of schematics will connect the center (common) pin of a potentiometer to one or the other leg, and it then functions more like a rheostat. Is that how a rheostat is wired internally? What's the difference between a potentiometer and a rheostat? Finally, why connect the common to a leg at all on a potentiometer, instead of just ignoring the unused leg?



Answer



The correct term for the common terminal of a potentiometer is the slider.


A rheostat is simply a variable resistance used to control power to a load and you are correct about the wiring. Only the slider and one other terminal are used.


A potentiometer uses all three terminals, enabling a variable voltage or signal to be tapped off from the slider.


Potentiometers and rheostats are made the same way, but rheostats are usually much "beefier", as they are generally used in high-power situations.


The slider is often connected to one or other terminal for safety reasons, in case it loses contact with the track.


PNP transistor circuit


enter image description here


When switch \$S\$ is at position \$1\$:


$$V_B = R_2 \mathbin{/} (R_1 + R_2)*V_{CC} = 30 \mathbin{/} 130*-20=-4.62\mathrm{V}$$ $$R_{TH}=100*30 \mathbin{/} 100+30=23.1\mathrm{kOhm}$$ $$V_{TH}-I_ER_E-V_{BE}-I_BR_{TH}=0$$


where \$I_B= I_E \mathbin{/} \beta\$ and \$V_{BE} =0.7\mathrm{V}\$.


So,


\$I_E= V_{TH}-V_{BE}\mathbin{/} (R_E + R_{TH} \mathbin{/} \beta)\$


\$I_E= (-4.62-0.7) \mathbin{/} (500+23100 \mathbin{/} 110)\$



\$I_E=-7.49\mathrm{mA}\$


$$V_E = V_B + 0.7 = -4.62+0.7 = -3.92\mathrm{V}$$


\$V_C = -V_{CC} + I_CR_C\$


\$V_C = -20 + 7.49*2000 \mathbin{/} 1000\$


$$V_C = -5.02\mathrm{V}$$


$$V_{CE} = V_E -V_C = -5.02 - (-3.92) = -1.1\mathrm{V}$$


$$P = IV = -1.1 * -7.49 \mathbin{/} 1000 = 8.24\mathrm{mW}$$


Am I right?




power engineering - What is the effect of heavy loads on the electrical grid?


When our neighbors turns on a motor, a bulb in our home turns off for a very very short time and then it turns on again. It is something like a quick flash but a man eye can notice it. Would you tell me why that happens, please? What could be the reasons? Is that because of the coils inside the motor? or the motor needs much power to start?



At larger scale, If a factory turns on a lot of large motors at the morning, Does that affect the nearest city or district?



Answer



Firstly, common types of motors take a lot of current when they're stationary, as they are when you first turn them on. This isn't really 'because of the coils' particularly - in fact, a pure inductance, which is what one tends to think of as a coil has exactly the opposite behaviour. It's because they're frantically drawing current to try to get themselves up to speed.


So, your neighbours draw a lot of current when they turn on a motor, and because you and they clearly share a cable back to some more major part of the mains system, this high current creates a voltage drop across that cable which you can see on your lights.


You're right to think that a similar effect happens at all levels of the supply network, but two things lessen the visible effect:



  • Even big industrial loads tend to be a small proportion of the total load averaged over lots of properties

  • The supply for a big area has an incredibly low impedance, so that normal loads don't cause much effect on voltage.


Electricity suppliers do have other tricks to regulate the voltage they supply - they change tappings on transformers, and they manipulate the flow of reactive power through the system, both of which affect the voltage at their customers. But mostly the reason you don't see flicker at the level of a whole town is just that the supply is very stiff relative to the individual loads.



Really, really massive single point loads do have to liaise with the network before switching, but those don't tend to be at the level of a few motors in factories.


ltspice - Should I connect the analog common ground the earth in this configuration?


Below is a floating signal source is connected to an instrumentation amplifier. The floating signal source stays in a metallic enclosure.


enter image description here


To make best out of it for this connection in terms of noise, the circuit should be balanced. Here is what I understand so far:


1-) The source impedance Rs1 must be found empirically so that we should add Rs2 in series to the negative terminal of the source. So I have to measure all source's output impedances and add proper resistors. Rs1 must be equal to Rs2.



2-) We should use twisted shielded pair. This will ensure that magnetic coupling to pairs be L1=L2 because of twisting. And the shield will protect the capacitive coupling of electric fields.


3-) The shield should be connected at one end to the earth. In this case at the receiver since the source is floating.


I'm planning to follow the above procedure. But what I don't know about the following:


1-) Should the point A be connected to the Metallic case?


2-) Should the AI GND be connected to the earth?


3-) Is 10Meg recommended value? I read it from just one document.




Friday 30 May 2014

A question about negative dB in LTspice


enter image description here


Above is a screen-shot from an LTSpice simulation. It is a freq. response of an LC tank circuit with a 5V sinusoidal AC source.


When I plot it, the y-axis is in dB.


When I look at the voltage it is 13.979dB which corresponds to 5V from the formula 20*log(V1/1).(1 is the reference voltage?)


But the current is plotted in negative dB. Why is that so? What does -dB mean here for the current? is that something to do with reference current in 20*log(I1/Iref)?



Answer





What does -dB mean here for the current?



0 dBI is exactly 1 amp (not to be confused with dBi which is the gain of an antenna compared to the benchmark (i)sotropic antenna)


A current of 100 mA is -20 dBI etc..


So when you have decibels for current as the Y axis then it is implicit that they the Y axis is dB relative to 1 amp (or dBI).


One further thing to consider is that the graph may be plotting peak current and peak current is \$\sqrt2\$ times bigger (for a sinewave). Read the LTSpice help advice to know exactly.


I've just checked on google about usage of the term "dBI" as representing current and nothing comes up. You can find dBuA for dB relative to 1 uA but nothing seems to mention dBI - I'm interested if anyone can provide some evidence to substantiate the usage of the term "dBI".


Sure, dBV are used and this is quite common and one website I visited compared decibels for current and voltage by calling them dB(volts) and dB(amps) - maybe "dBI" just isn't used so as not to confuse folk with dBi?


transistors - Operation of tuned collector feedback oscillator


I am trying to understand the following tuned collector feedback oscillator extracted from here using LTSpice. I understand that L1 and C1 creates the resonance at the oscillation frequency and L2 provides the feedback.



enter image description here


However, The voltage at the output (V(C3)) is not sinusoidal as expected. Please refer to the following waveform.


enter image description here


If I understand it correctly, transistor goes to saturation (edit: because of high gain). When capacitors C2 and C4 are removed (as suggested in comment), output become close to sinusoidal (refer the following). enter image description here


I am not sure why the circuit behave this way, and what is the need of C2 and C4?



Answer



The type of oscillator you are simulating needs careful consideration to get anywhere near decent sinusoidal performance. In its simple form you will never get a great sinewave purity because the output waveform has nothing other than the power rails to control amplitude. Yes you have feedback to make it "sing" but there is no active control element that can make the amplitude stable AND keep its output sinusoidal.


So currently, the output "hits" the power rails (one or the other or both) and this controls the output amplitude by limiting/clipping.


However, your simplified circuit has too much positive feedback for "adequate" performance. Look what I've done below; L2 has reduced to 0.01 uH and I've added 10 ohm in series with the main collector inductor (for realism): -


enter image description here



But still, the output is "hitting" the bottom limit and clipping because.... it needs something that can stabilize the output amplitude.


This can be achieved with a JFET in series with the feedback to the base. The standard way is to rectify the output level to get a "measure" of the output amplitude then use this "measure" to control the JFET so that it starts to lower gain as amplitude rises above a certain threshold.


It can also be done with diodes and here is my attempt: -


enter image description here


Now you have about 10 volts peak to peak and much better sine wave purity: -


enter image description here


Diodes used were 1N4148 but any fast recovery signal diode should be OK.


Wednesday 28 May 2014

analog - Which CMOS logic families can safely be used to construct linear circuits?


I've just learned that digital CMOS inverters can be configured to perform analog functions (most notably oscillators and amplifiers). However, many of the examples tend to favor old CD4000-series devices. In addition, this application note mentions in Section 3 that the use of buffered inverters can cause stability issues.



  1. Which logic families can be reliably configured to perform linear operations? Which families should be avoided?

  2. Will "special" protection circuitry such as the 5V-tolerant I/O for AHC and LVC cause additional stability issues or prevent linear operation?

  3. What would happen if I tried to build a linear circuit using a TTL-compatible device (HCT, ACT, AHCT)?


  4. Is it considered bad practice to use digital ICs in their linear region?



Answer



All logic families like to use buffered inverters, because those are more reliable and use less power in digital applications. However, unbuffered inverters are useful to build crystal oscillators, so they exist in many families; search for 74xx1GU04.


A 5 V-tolerant I/O has no ESD protection diode to VCC, so it tends to have less capacitance, and distorts the signal less if it exceeds VCC.


TTL-compatible inputs have a lower switching threshold, so they are no longer symmetric between VCC and ground.


Unbuffered gates are meant to be used in linear circuits; buffered gates are unlikely to work at all.


Another useful application note: Understanding (un)buffered CD4xxx characteristics.


led - looking for a sensor that activates when hit by a certain frequency burst


I have a question that may seem silly, but I am only new at this type of thing: 



Is there a sensor that I could connect to an LED (via an integrated circuit of some description, I assume) that would allow the LED to light up when the sensor came into range of a certain frequency?


I would like to run this setup from a 9v battery, if possible.


If this is possible, could I get a parts listing for what I would need for this setup?


Added:


What i was trying to achieve was a small device that incorporated an led that lit up when it detected a certain frequency/radio wave from another device (possibly a vehicle). Maybe an antenna instead of a sensor might be the go? Not sure yet and I am still very green with this. It was just an idea I had that may be useful for my work environment.




What does a black band at the end of a resistor mean?


I have a burned out big blueish gray resistor (probably a 1/2 or 1 watt) that I'm trying to find the value of but there is a mysterious black band at the end of the resistor where the tolerance band would be but obviously the tolerance/failure rate/temperature band cannot be black. What does it mean?


4.6mm x 15.5mm


I have confirmed colors:


Brown Black Gold Gold Black


So I think it's safe to say it's a 1 ohm, 5% tolerance. But what is that last black band!? It's driving me insane.


enter image description here



Answer



revised




  • brown =1

  • black =0

  • gold = x 0.1

  • gold = 5%

  • black = non-inductive (bifilar wound WW)


is a 10x0.01= 1.0 Ohm 5% WW resistor.


enter image description here


If 0.9mm body length then 1W , if more then 2 or more.



The tempco is used by some non-wirewound types and black would be 300 ppm or the highest for non WW. rated tempco. If yours is non wire wound bet this.


otherwise...


enter image description here


While I’m at this again, get flame-proof if you like.


You can decide best on the colours that make sense from this example chart.


transistors - Calculation of base current and what decides the current through collector-emitter branch



I have the below circuit. Its not a homework material. I am understanding how to analyze the transistor circuits.


Below are my questions while trying to analyze :



  1. If I am given the below circuit, how to determine whether the transistor is operating in active/saturation/cut off region?

  2. How is the base current determined in the below circuit when there is not base resistor given? The voltage at the base is calculated to be 1.4V. But how is base current calculated?

  3. What determines the current through the collector-emitter branch? Is is the emitter resistor or collector resistor?


To determine the current through the collector-emitter branch, we need to find the region of operation of the transistor, right? How to find Ib and Ic?


Can someone help.





Answer




If I am given the below circuit, how to determine whether the transistor is operating in active/saturation/cut off region?



We can, for example, assume that the BJT is working in an active region. And do the calculations based on this assumption. Because if our assumption is wrong we get "unreal" results.



How is the base current determined in the below circuit when there is not base resistor given? The voltage at the base is calculated to be 1.4V. But how is base current calculated?



We can do it in multiple ways.


The first way is to write a KCL equation and solve it.



enter image description here


\$I_1 = I_B + I2 \$ (1)


And the II Kirchhoff's law we can write:


\$V_{CC} = I_1R_1 + I_2 R_2\$ (2)


\$ I_2 R_2 = V_{BE} + I_E R_E\$ (3)


Additional base on this:


enter image description here


We can write


\$ \large I_B = \frac{I_E}{\beta + 1}\$ (4)


We can solve this for \$I_B\$ current



$$I_B = \frac{R_2V_{CC} - V_{BE}(R_1+R_2)}{(\beta + 1)R_E(R_1+R_2) +(R_1R_2) }$$


But there is also a simpler way to solve this circuit by using Thevenin's theorem.


enter image description here


We can replace the voltage divider (this gray rectangle) with his Thevenin's equivalent circuit:


$$V_{TH} = V_{CC} \times \frac{R_2}{R_1+R_2} = 1.4V$$


$$R_{TH} = R_1||R_2 =\frac{R_1 \times R_2}{R_1 + R_2} \approx 2.8k\Omega$$


So, we end up with this circuit:


enter image description here


And base on KVL we can write:


\$V_{TH} = I_B R_{TH} + V_{BE}+I_E R_E\$



And we also know that \$I_E = (\beta +1)I_B\$


so we end up with


\$V_{TH} = I_B R_{TH} + V_{BE}+ (\beta +1)I_B R_E\$


and the base current:


$$I_B = \frac{V_{TH} - V_{BE}}{R_{TH} + (\beta +1)R_E } = \frac{1.4V - 0.7V}{2.8k\Omega + 201*180\Omega} \approx 18 \mu A$$


$$I_C = \beta I_B = 200 \times 18 \mu A = 3.6mA$$


$$I_E = (\beta+1) I_B = 201 \times 18 \mu A = 3.618mA$$


$$V_E = I_E R_E = 0.651V$$


$$V_C = V_{CC} - I_C R_C = 2.552V$$




What determines the current through the collector-emitter branch? Is is the emitter resistor or collector resistor?



If the BJT is on the active region (\$V_C > V_E\$) the truth is that the \$V_{BE}\$ voltage determines the current through the collector-emitter. Or the base current if we prefer the "current control" point of view. How is possible that with same Ibase there is more than one Vce?


Tuesday 27 May 2014

vhdl - std_logic or std_ulogic?


It seems that the world has decided that std_logic (and std_logic_vector) are the default way of representing bits in VHDL. The alternative would be std_ulogic, which is not resolved.


This surprises me because usually, you're not describing a bus, so you do you don't want multiple drivers and you don't need to resolve a signal. The advantage of std_ulogic would be that the compiler warns you early on if you have multiple drivers.



Question: is this just a cultural / historical thing, or are there still technical reasons to use std_logic?



Answer



Std_logic is a subtype of std_ulogic and has exactly one extra property: it's resolved if there are multiple drivers.


Regardless of common practice, std_ulogic is the correct type to use for non-resolved signals that need 9-valued logic. (Often, using "bit" is even more correct -- for instance, on some FPGA architectures that do not have any such thing as an 'X' or a 'U').


Basically, the best thing to do is use the correct type for the job. Often bad practices get propagated by people just parroting the style that they see others use, do without understanding why.


Implementing my own ESC (electronic speed controller)?


I have a project that uses an ESC to run a brushless motor (Hobbyist RC plane sized, 24 gram, 1300-1500 KV).


I would like to experiment with eliminating the ESC and driving the motor with my own circuitry and control software. Are there any good tutorials or other starting points?


(I realize it's more practical to just keep using my $8 ESC, but I'm interested in this as a learning exercise.)



Answer



Here is an introduction to electronic speed control systems: http://www.stefanv.com/electronics/escprimer.html


Actual design depends on the type of motor you want to drive. A 300A high-torque gear motor is much different from those tiny featherweight propeller motors. At the heavy-duty end of the scale (300A) is something like this: Open Source Motor Control. All designs are online and there are a few articles explaining what the heck is going on. At the other end of the scale are small prop motors, like those in the MikroKopter.


buck - freechargecontroller.org. The blocking diode of the MOSFETS


I am looking at a schematic for a solar charge controller: http://freechargecontroller.org/images/a/ab/Charge_controller_4_04b.pdf


My question is about the MOSFETS M1 and M2. The data sheet for the MOSFETS I am attaching: http://www.jameco.com/Jameco/Products/ProdDS/669943IR.pdf


I think I understand that there is a blocking diode inside each MOSFET that allows for the flow of electrons from the source to the drain but not in the reverse direction and that diode is called a body diode. It is shown in the data sheet for the MOSFET. I am looking at the way the source pin of M2 is connected and it appears to me that what is connected to the source pin of M2 is a conduit that runs between that positive terminal of the battery and the source pin of M2. There is an inductor coil on that conduit. Hopefully I will be corrected if this is not exactly the case. It appears that J2-2 also ties into the same conduit and there is a blocking diode D3 in place there.


If the source pin of M2 then has a positive charge and there is a blocking diode inside M2 then wouldn't that blocking diode in M2 prevent the flow of electrons from traveling from the drain of M2 onto the VS line when M1 and M2 are activated?


Also I think I understand that diode D2 and capacitor C2 are providing a bootstrap voltage but I'm not really sure yet how that bootstrap voltage is generated exactly or what it is exactly used for. Could someone explain?


Thank You



Answer



This is basically a buck regulator. M2 is the high side Nmos and M3 is the low side Nmos. The IR2104 is a driver chip, which takes care of the sequencing of the Fets. C2 is a boostrap cap that the IR chip uses to overdrive the gate of M2 so that it can enable.


M2 will only turn on when C6/C9 are below the regulator setpoint voltage. When the output voltage exceeds that threshold, M2 will disable and M3 will be enabled. M2 and M3 cannot be enabled simultaneously as they will short circuit.



The body diodes are a useful property as they provide some level of spike suppression.


You can read up on buck regulator basics, like the link below.


http://www.maximintegrated.com/en/app-notes/index.mvp/id/2031&cd=5&ved=0CDQQFjAE&usg=AFQjCNFbTR_bj95JJUncX1N_xluLYCedSw


Monday 26 May 2014

pwm - current control via microcontroller


I have a micro-controller which calculates and decides about the current each minute. Then for one minute the circuit must hold that current constant. Then it should control the current via a buck circuit including MOSFET and a hall-effect current sensor. How to do it with AVR? it seems I need a control design(control theory). If there is an IC doing that automatically, it is very appreciated (I mean that I give it the required current in analogue or digital and it generates appropriate PWM).




Glass fuse identification - Siran No. F 13 4A


We have a glass fuse for a 12v lighting circuit that has "Siran No. F 13 4A" written on paper inside it. The circuit takes 5.5A at the moment with all the lights switched on without the fuse blowing. Can someone tell me what this is rated at? It seems to be a fast blow (F) so can it really be a 4A?


I figure my options are



13A (so what does the 4 mean?)


13.4A


4A (why is it still working at 5.5A?)


Thanks for reading, Steve


Edit: Images added as requested. Fuse shown with left side in holder Fuse with writing fuse wire



Answer



It might be a 4A fuse allowing 5.5A at the moment. To understand why/how this can happen, you need to know the working of a fuse. The fuse will have some finite resistance R and a current I through it will start adding heat to the fuse as per the equation - IxIxRxt where t is the time. This heat energy will raise the temperature of the fuse and at one point, it will melt. However this isn't the only thing going on in there. The fuse is also losing some of the heat to its surroundings and hence the surroundings also play a role in deciding the current at which the fuse will blow and the time it will take to blow. Here is an excerpt from a fuse sizing guide:


Fuse selection guide


Fast fuse


In your case, one of the following might be the case:



1) Lack of quality control - Maybe the fuse company didn't control the tolerance very well.


2) Fuse is losing too much heat to its surroundings.


3) Fuse is not a fast one and it might blow given enough time.


4) It's not a 4A fuse.


Are too high capacitance capacitors "bad" for the circuit?


I am trying to learn basic circuitry and I've been looking into capacitors and their uses in different areas.


When looking at capacitance several different sources say that circuits might malfunction or burn with higher capacity capacitors than designed with. Unfortunately, but none of those sources go into detail.


How can a capacitor cause malfunction if capacitance increases? Wouldn't the capacitor simply take longer to fully charge? Can high capacitance capacitor really cause any sort of "burn"? I mean it cannot store or produce higher current than what is given by power supply, right?



Am I missing some important detail?



Answer




How can a capacitor cause malfunction if capacitance increases? Wouldn't the capacitor simply take longer to fully charge?



Capacitor is a charge reservoir. Switched-mode power supplies need to charge it first. Too large capacitors might make the internal power supply loop go unstable, which would create large voltage deviations across the capacitor and potentially burn it due to too large capacitor heating caused by its non-zero parasitic resistance called "ESR".



Can high capacitance capacitor really cause any sort of "burn"? I mean it cannot store or produce higher current than what is given by power supply, right?



Capacitor do burn quite often. Actually, the aluminum capacitor failure is the most common failure mechanism in large motor drives! Motor drives and other power electronics (solar inverter, wind inverter, car battery charger, ...) exhibit very large current ripples at various frequencies. These ripple currents cause capacitor heating (ESR), which degrades the capacitor capacitance and further increases ESR. It's like a positive feedback. Aluminum caps have limited lifetime measured in thousands of hours. Their lifetime also decreases with elevated temperatures.



The typical way to mitigate this issue is to use multiple parallel caps (splitting the ripple currents) or using higher quality capacitors. These methods, however, tend to increase cost of the final product. The electronics industry is very cutthroat nowadays, which gives rise to designing for full functionality and reasonable failure rate but not a bit more.


Other answers also list good examples of how not only the capacitor can burn but how the large capacitor can cause other components to burn.


Sunday 25 May 2014

microcontroller - What is SOC in embedded System


I am new to Embedded domain and wanted to know what exactly is SOC(system on chip) means?


Is it like we different hardware component on CPU chip(like RAM on CPU chip) or on the same embedded board we have cpu chip manufactured by one company and rest of the component are manufactured some other company.


For example I have heard of TI soc's and Brodcom soc's both share the same cpu chip .




avr - Java and Serial Port


I am able to control the speed and direction of 2 DC motors using an AVR-based microcontroller board (see here for details) currently through hyperterminal (Flash Magic).


Is it possible to do the same through a Java-based GUI program instead?


I mean the speed entered in the textfield of the GUI being sent to the COMPort instead of the one entered in hyperterminal. If so, how?





rf - Why is channel capacity a factor of bandwidth instead of frequency?


I'm trying to understand the concept of capacity for a wireless channel. Some help would be appreciated.


For a AWGN channel capacity is calculated as:


$$C=B \cdot log_2(1 + S/N)\text{ bits/sec}$$


B = bandwidth. This is what I don't understand. Why isn't it a factor of frequency? To me considering bandwidth only makes sense in cases where the system changes frequency.




  1. Bandwidth is the difference between an upper and lower frequency range. Well, what if I'm using a fixed-frequency signal? Fupper and Flower would be the same value, right? So does that mean B=0? So a fixed frequency signal can't carry any data? We know that's not true, AM radio does it. So what am I missing?





  2. According to this formula, a fixed-frequency signal would have the same performance regardless of whether it's at high or low frequency. This makes no sense to me. For example say my bandwidth is 1Hz at a fixed frequency of 1Hz. Compare this with a bandwidth of 1Hz at a frequency of 2.4GHz. It's plainly obvious that I can cram way more bits into 2.4 x 109 cycles/second than I can with just 1/sec. But according to this formula I can't. Please help.




  3. What about fractional differences? Waveforms are analog in nature, so we could have a 1Hz signal and a 1.5Hz signal. Likewise at the high frequency range. Say 2.4GHz minus 0.5Hz. There is an infinite amount of space between 1 and 1.5. Could not 1Hz and 1.001Hz serve as two separate channels? In terms of practicality I realize this would be difficult, nearly impossible to measure this difference with modern electronics, especially with noise added, but in pure theory you could have two channels. So in that sense, shouldn't there be an infinite amount of bandwidth between two frequencies? Or do we only count in 1Hz whole number increments?





Answer



I doubt if I can cover all your questions, but I'll give it a try:




Well, what if I'm using a fixed-frequency signal? Fupper and Flower would be the same value, right? So does that mean B=0? So a fixed frequency signal can't carry any data? So what am I missing?



A single frequency signal would be a continuous tone. It's amplitude would never change. It would just continue on repetitively forever. As such, it would not convey any information.


When you start modulating your carrier, the spectrum of your signal is no longer a single frequency. According to the amplitude modulation formula, the spectrum of the modulated signal is the convolution of the carrier (a single frequency) and the modulating signal (typically, containing energy in some band about 0 Hz).


Therefore the modulated output signal contains energy in a band around the carrier, not just at the single (carrier) frequency.



We know that's not true, AM radio does it.



Each AM station delivers energy not just at the carrier frequency, but in a band around that frequency. An AM radio broadcast is not an example of a single-frequency signal.




It's plainly obvious that I can cram way more bits into 2.4*10^9 cycles/second than I can with just 1/sec.



Certainly you could. However, if you simply modulated your 2.4 GHz carrier with an information signal spanning 2.4 GHz, the bandwidth of the resulting signal would be nearly 2.4 GHz. The energy in the signal would be spread from 1.2 to 3.6 GHz.


There is a way to get around this though...



What about fractional differences? Waveforms are analog in nature, so we could have a 1Hz signal and a 1.5Hz signal. Likewise at the high frequency range. Say 2.4GHz minus 0.5Hz. There is an infinite amount of space between 1 and 1.5. Could not 1Hz and 1.001Hz serve as two separate channels?



They can, but only by trading off the SNR term in the Shannon-Hartley formula for the bandwidth term. That is, the formula shows there's two ways to increase the capacity of the signal: Increase the bandwidth or increase the signal to noise ratio.


So if you had an infinitely high signal to noise ratio, you could use 0.001 Hz of bandwidth to carry as much information as you like.



But in practice, the log function around the SNR means that there are diminishing returns for increasing SNR. Beyond a certain point, large increases in SNR provide little improvement in channel capacity.


Two typical ways this is used:




  • In multilevel AM coding, instead of just sending the carrier or not sending it in a bit interval, you might have 4 different amplitude levels that can be sent. This allows two bits of information to be encoded in each bit interval and increases the bits per Hz by a factor of two. But it requires a higher SNR to be able to consistently distinguish between the different levels.




  • In FM radio broadcasting, the broadcast signal bandwidth is broader than the audio signal being carried. This allows the signal to be received accurately even in low SNR conditions.






Could not 1Hz and 1.001Hz serve as two separate channels? In terms of practicality I realize this would be difficult, nearly impossible to measure this difference with modern electronics



In fact it's quite easy to distinguish 1 Hz from 1.001 Hz with modern electronics. You simply need to measure the signal for a few thousand seconds and count the number of cycles.



So in that sense, shouldn't there be an infinite amount of bandwidth between two frequencies?



No. Between 1.00 Hz and 1.01 Hz there is exactly 0.01 Hz of bandwidth. It doesn't need to be counted in whole numbers of Hertz, but there's only as much bandwidth between two frequencies as the difference between those frequencies.


Edit




From what you're saying, the B in the Shannon equation has nothing to do with carrier frequency? This is modulation bandwidth only?



Essentially yes. B is the bandwidth, or the range of frequencies over which the signal spectrum has energy.


You could use a 1 MHz band around 10 MHz, or a 1 MHz band around 30 GHz, and the channel capacity would be the same (given the same SNR).


However in the simplest cases, like dual-sideband AM, the carrier tends to sit in the middle of the signal band. So if you have a 1 kHz carrier, with dual-sideband AM, you can only hope to use the bandwidth from 0 to 2 kHz.


Single-sideband obviously doesn't follow this rule.



An information signal spanning 2.4GHz, what does this mean?



I mean that the spectrum contains energy over a 2.4 GHz band.



If you had a narrow band filter and an RF power detector, you could detect energy in the signal at any frequency within the band.



are you taking about the carrier wave now?



No. The carrier is a single frequency. The complete signal contains energy over a band of frequencies around the carrier. (Again, single-sideband pushes all the signal to one side of the carrier; also, suppressed-carrier AM eliminates most of the energy at the carrier frequency)



As N->0, C will approach infinity. So in theory an infinite amount of data can be encoded into a single wave?



In principle, yes, by (for example) varying the amplitude in infinitely small steps and infinitely slowly.


In practice, the SNR term has that log function around it, so there are diminishing returns for increasing SNR, and also there are fundamental physical reasons that the noise never goes to 0.



wiring - Splitting wires for newbies


I'm in the process of getting ready to build a car PC running Linux. One of the features I'd really like to incorporate is the ability to record car statistics from the sensors live using ODB2.


Due to the location of where the ODB2 port is on my car (in the dash where the door opens), it'll be pretty difficult to close the door while the cable is plugged in. Therefore, I'd like to split the line further back a bit and route an ODB2 cable to the back of my car to the machine.



I've never done stuff like this before, but I have done a bit of electrical work (ie: switching out switches, plugs, rewiring things). I'm assuming that what I'd need to do would be to cut the existing cable and basically solder all of the internal wires together to both plugs, the one available in the door for mechanics, and the one running to the back for my computer.


Is this what I need to do? How can I put the wires back together again in a nice, insulated fashion?



Answer



I would recommend using inline wire splices. They are available at any auto parts store. Alternatively you can go the inexpensive and more compact (but more difficult) route. To be absolutely pedantic, NASA has a splicing guide, too. Some pictures follow.


Inline splices (option 1):


splicer


Manual wire joining (option 2):


inlineT


nasasplice


Will cutting the data lines of USB still let the power to go through?


I am trying to Charge a USB connected device through a computer without transferring data.


An USB 2.0 cable should have 4 wires: Vcc, Data+, Data- and Ground. If I only cut the Data wires and let the Vcc and Ground wires connected, will it still be able to transfer power or will the power cables be shut off because of the disconnected Data wires?



Answer



It depends on the device. And on the source.


Usb spec states that a device should only use 1 block of power until it enumerates with the host. Then it can request up to 5 blocks. Each block is 100 mA. It should not pull more than 5 blocks.


In practice, very few, if any hosts limit a usb port to 100 mA at all. Some do limit ports to 500 mA (Apple computers for one, though they do allow iDevices to request more in a Apple only standard, so they are physically capable just not normally allowed). Some USB ports have very little power protection and may be hooked up straight to the 5V power source.



Now usb peripherals also have requirements for power. Dumb devices may power directly from any power source, 5V or different. These dumb devices don't even have the data lines connected. Older cell phones also allowed dumb charging. As time passed, more and more restrictions come into play. Some devices monitor the power pins for regulation, and won't work on anything outside of usb spec power (4.75 to 5.25 volts).


Some devices won't work unless a resistor pairing setup is on the data pins. Apple started this, and others followed, and there are competing standards. You can't plug a dumb 5V power supply into an iPhone and get it to charge. It will state unauthorized charger. Some devices require enumeration before charging, but this is rare. The PS4 Six axis controller does this.


And some devices will treat a dumb charger as unsafe, and limit charging to 500 mA or less. Most modern cell phones do this. If the data lines do not have a resistor indicating it is a high power charger.


In short, a usb cable plugged into a computer without the data lines will either not work, work slowly, or work fine, depending on your computer and your device.


As a side note, there are commercial usb cables that have a data or charging switch, allowing you to disconnect the data lines to prevent data communication. They typically switch in the resistor setup, but it varies.


enter image description here


microcontroller - Hyper terminal equivalent in windows 8



I need to do some communication between 8051 micro-controller and PC . There used to be a hyper terminal for this purpose in windows XP. I m using windows 8 now. So can anyone suggest me some equivalent of hyper terminal in windows 8 for the purpose of serial comm. between micro-controller and PC.




pmos - P-Channel MOSFET Inrush Current Limiting


I have been searching EESE and Google for several weeks now for a solution to this problem, and while I found some proposals that seemed promising, the real-world implementation fell short of expectations.


I have a voltage regulator on a board with 10uF input capacitance, to help protect against brownout conditions. I have a fuse in series with the power supply sized to 125mA for various reasons, and just to be clear, I have not found any slow-blow versions that meet my requirements. The power supply can be anything from 5 volts to 15 volts DC, most likely a lead-acid battery. When the battery is first connected I see an inrush current with a peak of approximately 8 amps over 8us, which very quickly blows the 125mA fuse. Okay, so I need to limit the inrush current. No big deal, right?


I tried a number of different options, but this is the one that seemed most promising:


enter image description here


R1 and R2 form a voltage divider that limits the Vgs to prevent damage to the MOSFET, and along with the capacitor form an RC delay that allows the FET Vgs to increase more slowly, keeping the FET in its ohmic region for a longer amount of time. Makes perfect sense. Higher capacitance = slower turn-on = less inrush current.


Well that's all fine and dandy, except that after increasing the capacitor from 1uF to 4.7uF to 10uF, I realized I bottomed out at an inrush current of around 1.5Apk over 2us. After reaching that point, no matter what capacitance I added for C1 (I tried up to 47uF) the inrush current wouldn't drop any lower than 1.5Apk. Obviously this current was still much too high and would blow my fuse in an instant. I can't increase the current rating of the fuse, so I need to find a way to make this work.



My current hypothesis is this:


enter image description here


Cgs and Cgd are the intrinsic gate-source and gate-drain capacitances of the MOSFET, and while they are relatively very small (50pF-700pF), my theory is that they are acting as a pass-through when Vin is first applied. Since these capacitances cannot be reduced, they (especially Cgd) are the limiting factors that prevent me from lowering the inrush current below 1.5Apk.


What other options are there for limiting inrush current? I have found various one-chip solutions for hot-swap applications, but they have a similar topology to the above circuit and I imagine they would have similar drawbacks.


Vin can be as low as 5 volts, so if I take into account reverse polarity protection provided by a Schottky diode, the voltage drop across the fuse, the drop across the MOSFET on-resistance, and drops due to the cable (can be fairly long) connecting this board to the supply, my voltage drop is becoming fairly significant (the voltage regulator this is feeding into requires roughly 4.1V in order to regulate properly). A series current limiting resistor is unfortunately not going to be an option.


The other restriction I have is space. I have approximately 4.5 x 4.5 square millimeters to work with. The above circuit was just barely going to fit, so adding even more components is not really an option. Otherwise this would have been a slightly easier problem to solve.




circuit protection - How can I protect my MOSFET?


I'm using this depletion-mode MOSFET in a high-voltage power-management circuit. My 500V DC supply isn't high grade, and now that I've blown two of these MOSFETs (gate shorts to drain) I'm wondering if I can put any components on either side to protect it? I was getting weird results with the first one before realizing it was blown. I might have blown the second one (not sure at which point in my testing it failed) simply by turning the high-voltage supply on with it wired like this:



schematic


simulate this circuit – Schematic created using CircuitLab


For protection purposes: If it simplifies things I never want to see more than 200mA through the circuit. If no better ideas I guess I could put a fast-blow fuse in front of V+? But I'm not sure if that's the only thing that can blow this MOSFET. E.g., I'm beginning to wonder if having no load on the drain can cause problems.



Answer



This datasheet provides detailed recommendations on employing TVS diodes to protect both the more sensitive gate and the entire MOSFET against transients, by connecting the diodes like this:


MOSFET Protection circuit


stm32 - CAN bus TX failing in a strange way


I have been trying to pass CAN frames between two different CAN busses using two different CAN channels on a STM32F746 MCU. The system always fails and freezes up in TX when it is supposed to be passing through CAN messages between the busses. The firmware shows the transmit messages are never clearing the CAN mailbox, which first pointed me to investigate TX. I have encountered some strange looking behavior on TX that I need help understanding.


Below is a basic schematic of the CAN bus system:



schematic


simulate this circuit – Schematic created using CircuitLab


The bus operates at 125kHz (8us bit time) Bit timing is as follows:




  • Internal MCU clock of 216MhZ, prescaled down 54MHz for the CAN module




  • Time quanta Tq = 500ns





  • SEG1 = 13




  • SEG2 = 2




  • SJW = 1





In the following picture of TX and RX during operation, the system is not working as intended. RX looks healthy, but TX is supposed to be transmitting messages from the other bus. It is not. It appears to be ACKing however. enter image description here


Next is a different capture from the same probing session. It gets weird! TX seems to jump in and fail in a way I don't understand. enter image description here Zooming in... enter image description here


TX appears to be jumping in, maybe to ACK, but ends up truncating the end of the frame to shorten that last bit by over half of the normal 8us it should be. The last bit on RX is truncated to only 3.2us. TX then goes dominant for 4 or so bits inexplicably.


Finally, here is a zoomed in image of the 'normal' looking ACK from earlier. It also appears to be shortened to about 6.6us. enter image description here


What could be causing this behavior?


I cannot figure out any mechanism which would lead to this type of error. Is it failing acknowledgments, arbitration, bit timing, something else, or a mix of all?


I have debugged the following:




  • The transceivers are good





  • The CAN bus signals all look healthy and square




  • I have tried different termination configurations and resistor values




I would greatly appreciate any insight or guidance on how to proceed with debugging from here.


Thank you!




Answer



I have finally found a solution that works. After exhausting every possible hardware debug possibility, I recreated the system using STM Nucleo boards. After 30% of nucleo boards worked and the rest failed, with identical hardware setup, I was lead to investigate the only remaining variable I could think of, which was the variance on the MCU internal resonator. After activating my external high accuracy resonator, and lowering the entire application master clock speed, I was able to get something working. What I learned is clock integrity is VERY important in this type of application.


Resources I used to solve this:


For clock speed calculations: NXP CAN bit timing application notes


Link to another related post about this issue


Saturday 24 May 2014

mechanical - Is it possible to control and reverse the direction of a dc motor through a headphone socket?


Yesterday, I found that it was possible to control a servo using a headphone socket with a fairly simple circuit. I've got a project where I need to to control a dc motor via a headphone socket. Is such a thing possible? I basically need it to rotate at various speeds as well as change direction quickly. Apparently it is possible to modify servos to rotate continuously but none of them seem to have the speed I require for my project


Here's some context as to why I need this. Yesterday, I had an idea on how to automate the black card technique in landscape photography where you move a black card up and down in front of the camera during a long exposure. I want to build it on the cheap so this is my design:


enter image description here


Animated and annotated versions


The DC motor is stuck to the bolt, which is rotated. The nut is stuck to the plastic cylinder so when the bolt rotates, the cylinder travels up. If you reverse the current, the cylinder travels down. The DC motor therefore needs to work in both directions with the headphone socket circuit. As this is already quite a bulky setup, I'd rather not build a whole arduino into it so if I could get it working via the headphone socket of my phone or music player, that would be ideal!



I've never really done much electronic engineering before so go easy on me please ;)


Any help is much appreciated!



Answer



Within reason, it is possible to drive almost anything from a headphone socket if you have some 'smarts' on the other side decoding the signal. As you have said, you'd prefer not to use the Arduino, but there are of course much smaller microcontroller systems if physical size is a problem.


For bidirectional control of a DC motor, you need at least a power supply and an H-Bridge. It would actually be possible (with perhaps some risk to your phone) to drive the 'A' channel on the H-bridge with your left audio output and the 'B' channel with your right audio output. This makes some assumptions which may or may not be true depending on your phone, for example, that your audio output is DC coupled (that is, it will pass a very low frequency signal). Of course, you would likely have to use a transistor on each input to shift the levels from ~1V P2P to ~5V P2P (if you are using a common H-bridge chip such as the L298). So you are looking at probably about half a dozen parts anyway including passives.


Probably the best thing is to invest in doing it the 'right way' by devising some simple digital protocol which may be transmitted by your software and using a simple microcontroller on the device. It would be fairly straightforward to do with even the simplest 6-pin microcontroller.


optoelectronics - Is it possible to use an optointerrupter as a optoisolator?


I currently can't buy an optoisolator, so I was wondering if I could wrap a optointerrupter in tape to shield it from light and use that as an optoisolator. Is this possible?



Answer



Don't have an opto-isolator? Make one.


All transistors are photo-electric until put in a can or some opaque plastic. If you have a small signal metal can transistor you can cut or file the top off and super-glue it to an LED.


LED superglued to transistor.


LED superglued to 'photo-transistor'.


Heatshrink cover.



The finished article with heatshrink sleeving.


The transistor is a 35-year old BC108. LED is a generic red - probably same vintage.


Watch out for light getting in the back of the LED. Current transfer may not be very good so you may need to 'Darlington' the output.


Sensing AC high voltage to microcontroller


I'd like to sense if I have AC 220V 50HZ available, and convert it to some logical level.


I made such circuit, will it work?


I use C1 as a resistor.


Original circuit Any recommendations what can be improved?



Thanks for the great help.



I choose Russel's answer because he was first and the note about 1N4001 was very useful, calculations show that D1 will be stressed to up to 70 volts while C1 charging, so Turpie head will be kept in place. I will hold 4001 for lower voltage applications.


Olin's answer was like the same C: Olin 0.1 uF, Rusl 0.068 (or 0.05). Rseries Olin 1k. Russell 10k, but also helped me alot.


Here is the updated circuit with simulation.


Final circuit


As keen beginner sorry for noobish questions. I will add more details with datasheets next time.



Answer



Note: Below, where you see "=" read "~=" or "~~~="as appropriate.


You are providing FAR more current than you need and it will cause you problems.


Spehro notes the peak current that you might see.


Note that the optocoupler doe NOT NEED up to 50 mA -it can ACCEPT UP TO 50 mA continuous. If you can run it at less or much less than that it will be more pleased with you.



Impedance of the capacitor is 1/(2 xpi x f x c) At 50 Hz that's ~~ 4500 Ohms.
Current will vary ~= sinusoidally.
Peak 220 VAC voltage is 220 x sqrt(2) ~= 310V.
I = V/Xc = 310/4500 ~= 70 mA.


Specs at end.
Ifmax = 50 mA so even in ordinary use you have it at the top end of it's range. Or above. BUT your 2 x 100R will reduce it to less than 50% through the LEDs BUT makes you need a 2x+ sized cap.


As this is just (you said) for AC mains presence sensing then you can accept something that gives a pulse for part of each half cycle.


They say CTR min = 50% at I_LED = 5 mA. So a 10 k output resistor will give up to V = IR = 5 mA x 50% x 10K = 25 V swing. ie it will be easy to swing rail-rail on a lower voltage supply with 5 mA input.


So you could tolerate even less than 5mA mean current, so lets start with ~~~= 5mA at peak Vin of about 310V. So Cnew = Cold x Inew/I old
= 0.68 uF x 5/70 = 0.05 uF,

Xc 0.05 uF ~= 60,000 Ohms.


AT 300V continuous DC (which we have not got) power in a resistive load of 60K would be V^2/R = 300^2 / 60k = 1.5 Watt
So if you used a 10k resistor in series with C1 it would dissipate 10k/60k x 1.5 = 0.25W.
That is peak dissipation at 300V so mean will be less.
So a series 10k x 1/2 W resistor will probably survive, a 1W is better and more may be wise.


Now, remove R1, R2 is now set to 10K as above, C = say 0.068 uF.
C1 MUST be an X or Y rated mains cap. MUST. R2 (which you can rename R1) would very very ideally be peak mains rated too. (Resistors can fail under applied voltage even if dissipation is far below the rated value).


Try 10K in series with optocoupler output at whatever your secret-so-far Vdd_out is. You should get a series of close to square pulses on half of every mains cycle. Width of pulse will vary with opto CTR which varies by a factor of 12 (50% to 600%).


NOW: Check my figures, remove some of the broad assumptions I have made and/or simulate the circuit.





1N4001 - no no


Take your 1N4001 collection and give it to a keen beginner. Point out their shortcomings.


Find somebody selling 1N4007s at about the same prices as 1N4004s (or less) and make these your standard part for <= 1A 50 Hz work.


1N4001, which you may not really be using, are 50V rated if I recall correctly.
There are too many times when this will be too low and too many times when you see 1N40.... around the body of a rectifier and assume it is a real one OR see 1N4001 and assume it reads 1N4007. Any of these mistakes can cost you so much on the few occasions they happen that changing now is already too late.


Even in this application, if you hit a mains peak when you plug this in and D1 is reverse biased it may give D1 'a bit of exercise' (and may pull down its hemp stalks*) if it was a 1N4001 - you'd have to do the calculations. If it was a 1N4007 it would toss ever so slightly in its sleep and mutter about doing something about little dog Turpie* in the morning.


Get rid of the 1N4001's (if they exist)





Crummy spec from crummy spec sheet:



Low quality spec list here


Current - DC Forward (If) (Max):50mA
Current Transfer Ratio (Max):600% @ 5mA
Current Transfer Ratio (Min):50% @ 5mA
Input Type:DC


Operating Temperature:-55°C ~ 100°C
Output Type:Transistor
Rise / Fall Time (Typ):2µs, 3µs
Turn On / Turn Off Time (Typ):3µs, 3µs
Vce Saturation (Max):400mV

Voltage - Forward (Vf) (Typ):1.15V
Voltage - Isolation:5300Vrms
Voltage - Output (Max):55V


mosfet - Help learning from a mistake connecting an oscilloscope




I have built this circuit to dim a lamp with a PWM signal. It had an issue where the MOSFET was getting really hot. So I wanted to know what was happening on the gate of the MOSFET.


I turned the PWM signal off and with my multimeter I measured \$V_{GS}\$ as 12V. Now confident that I can look at the waveform with my little USB-oscilloscope (rated to 20V) I connected it. Bammm, the lights go out and I'm left with a bricked oscilloscope and PC that was connected to it.


I'm quite sad about breaking my PC. However I have to know what went wrong so I'm here.




About the problem with the hot MOSFET: It turns out there was a bug in the code making the PWM frequency very high. Making sure it was 200Hz fixed the overheating and the dimmer appears to be working as intended now.




edit:


MOSFET: IXTQ40N50L2


Opto-coupler: ILQ2



Answer




The circuit shown is AC mains connected without any kind of isolation. Measuring Vgs using a multimeter is safe because the multimeter is 'floating' with respect to the mains supply.


But a PC is not floating. The PC is normally has the grounded case, meaning the metallic shield on the USB connector is also grounded to the mains power point through the PC case.


As such, connecting the USB oscilloscope to the mains connected circuit is inevitably disastrous. When this is done, mains voltage will push current into the PC case (or into the USB data lines, depends which probe is linked) to be returned to the ground.


All mains linked circuit must be instrumented by floating equipment. You might be at safe side if you used a laptop instead of PC, but its not so safe either unless you really insulated everything around the laptop and ensured your laptop is really floating with respect to the ground.


analog - De2 Board reading sensor reading


I wish to operate a LVMAX Sonar EZ1 sonar rangefinder.


They say




With 2.5V - 5.5V power the LV-MaxSonar EZ1 provides very short to long-range detection and ranging, in an incredibly small package. The LV-MaxSonar-EZ1 detects objects from 0-inches to 254-inches (6.45-meters) and provides sonar range information from 6-inches out to 254-inches with 1-inch resolution. Objects from 0-inches to 6-inches range as 6-inches. The interface output formats included are pulse width output, analog voltage output, and serial digital output.



enter image description here


I wish to control this using an Altera DE2 Education and development board, User manual, Getting started guide


They say:



The Altera® DE2 Development and Education board is an ideal vehicle for learning about digital logic, computer organization, and FPGAs. Featuring an Altera Cyclone® II 2C35 FPGA, the DE2 board is suitable for a wide range of exercises in courses on digital logic and computer organization, from simple tasks that illustrate fundamental concepts to advanced designs.



I am not sure how I can do this. The two possibilities I see are the expansion headers and the rs232. But i have never used them and am not able to find any links on how to do analog read using the expansion headers. The rs232 serial interface just looks a lot more challenging.




Answer



RS232 looks like a straightforward way to interface the two devices.


You have to get the baud rate the same at each end, connect appropriate pins and deal with th eincoming data - s "simple matter of programming " :-).


Data output:


It sounds like the EZ1 can be persuaded to output RS232 data continually


enter image description here




Data input:


Page 42 of the DE2 users manual and
pages 26 & 27 of the DE2 Getting Started Guide

show how to configure an RS232 interface using the onboard PS/2 socket.


They advise that:




  • The DE2 Board uses the standard 9-pin D-SUB connector for RS-232 communications between PC and the board.
    The transceiver chip used is MAX232.


    For detailed information on how to use the chip, users can refer to the spec under C:\DE2\Datasheet\RS232. <- Probably on the supplied CD ROM Figure 3.11 shows the related schematics.
    The pin assignment of the associated interface is shown in Table 3.9.





As long as you do NOT have a "brown dot part" then the EZ1 Sonar can be easily configured to calculate range repeatedly and to output the results as a continual sequence of R232 strings. ie




  • TX – , When the *BW is open or held low, the TX output delivers asynchronous serial with an RS232 format, except voltages are 0- Vcc.


    The output is
    -an ASCII capital “R”,
    -followed by three ASCII character digits representing
    -the range in inches up to a maximum of 255,
    -followed by a carriage return (ASCII 13).


    The baud rate is 9600, 8 bits, no parity, with one stop bit.

    Although the voltage of 0- Vcc is outside the RS232 standard, most RS232 devices have sufficient margin to read 0-Vcc serial data.
    If standard voltage level RS232 is desired, invert, and connect an RS232 converter such as a MAX232.




enter image description here


*Brown dot parts: When BW pin is held high the TX output sends a single pulse, suitable for low noise chaining (no serial data)


microcontroller - Pull-up and Pull-down Resistor Usage on Input or Output MCU Pins


Are pull-up/down resistors (whether internal or external) only needed for MCU INPUT pins? In contrast, an MCU pin configured as an OUTPUT "knows what level it's at" because it does the driving - a "floating" MCU OUTPUT pin tied to some input of another circuit doesn't make sense, because the state of the MCU pin can only be high or low... do I have this right? Now, upon MCU bootup or failure, it may be beneficial to have a pull-up/down tied to this "MCU output to IC input" line to ensure that the input to some IC is never floating.


Maybe I just answered my own question here... pull-up/down resistors can be used on both input and output pins, depending on application?



Answer



Pull-up and Pull-downs are normally used to ensure a line has a defined state while not actively driven. They are used on inputs to prevent floating lines, rapidly switching between high and low and a middle "undefined" region. Outputs normally do not need them.


But most mcu pins are GPIO, and sometimes on startup are defined as inputs instead of outputs. As you said, sometimes you don't want an IC pin input floating on startup, especially like a reset pin that you would normally drive with your microcontroller's GPIO.


This is when you use a Weak Pull-up or Pull-down on the line. Because they are weak, and you choose the default state, they provide no interference with your circuit (If the input is supposed to be low at all times, then pulled high, you choose a weak pull-down, and vis versa), but they do consume a bit of current. This is why you choose a resistor weak (Higher the value, the weaker) enough for the job.



Another normal output setup that uses pull-ups (or pull-downs, rarer) is Open Drain or Open Collector connections. These only drive a connection low, or release the line, leaving it floating. The pull-ups are used to bring the line to a high logic state.


Friday 23 May 2014

voltage regulator - Hand crank DC generator - a simple dummy load that won't burn out?


I'm working on a project that allows a user to crank a hand generator while current and voltage sensors measure the output. After the user finishes cranking, software displays information about how much power was output.


This is the generator we're using: http://windstreampower.com/Human_Power_Generator.php


It seems like it should be a simple problem. However, in the current setup, I've been using the provided 12V voltage regulator and feeding power into 12V incandescent bulbs, and once the rig gets under heavy use, the voltage regulator burns out, and the bulbs blow.


The setup is like this:


Hand Crank => 12V Voltage Regulator => 12V Incandescent Light Bulb (50W)


So, I'm wondering if there is an alternative approach to this configuration (we don't need light bulbs or anything visible). Maybe feeding the crank directly into a 12V battery with some type of charge regulator and a constant drain? Maybe connecting the generator to several bulbs in series?



What is the simplest, most inexpensive dummy load we can attach to the generator, just so we can get current and voltage readings of the user's output while they crank?



Answer



You need power resistors (e.g. from Ohmite). Simple, not that expensive (~$5 US).


I wouldn't mess around with the regulator.


EDIT: As @Alan Christopher Thomas pointed out, this will get hot. For extended use (more than a few seconds) consider an additional heat sink.


Value is a duplicate in Altium Designer BOM


I'm using ActiveBOM in Altium Designer 19. My design has 100k 5% resistors and also has 100k 1% resistors. ActiveBOM gives an informational warning (an "i" with a white circle around it) that the value 100k is a duplicate. I'd like to clear this error.


I'd guess there's a way to suppress this error in Project Options, but I don't want to do that because finding duplicate parts is a good feature.


I could also change the 'Value' field of one of the parts, but that doesn't seem right because they both actually are 100k.


I guess I could change my use of the resistor value field to include the tolerance, but that seems like it might mess up simulation (which I haven't started using yet).


What's the best way?




Thursday 22 May 2014

How is the power factor part involved in wattmeter reading?


In a wattmeter, the current coil helps in measuring current and the potential coil is used for measuring voltage... but the real power that the wattmeter measures is \$V \times I \times \cos(\phi)\$.


How is the power factor involved in the measurement made by a wattmeter?




pullup - Why is there a pull-up torque during the starting of an induction asynchronous motor



taking into account the definition of pull-up torque:



Pull-up Torque: The Pull-up Torque is the minimum torque developed by the electrical motor when it runs from zero to full-load speed (before it reaches the break-down torque point)


When the motor starts and begins to accelerate the torque in general decrease until it reach a low point at a certain speed - the pull-up torque - before the torque increases until it reach the highest torque at a higher speed - the break-down torque - point.


The pull-up torque may be critical for applications that needs power to go through some temporary barriers achieving the working conditions.



I can't find anywhere in this text( and in other articles on the subject) WHY the torque lowers a bit(inflexion point) and then it raises again. What is the mechanical explanation for this?



Answer



This is what Allen Bradley say about pull-up torque: -


enter image description here



Please click on picture to help but in words, the specific sentence is: -



Pull-up Torque is caused by harmonics that result from the stator windings being concentrated in slots. If the windings are uniformly distributed around the stator periphery, Pull-up Torque is greatly reduced. Some motor design curves show no actual Pull-up Torque and follow the dashed line between points A and C.



Info taken from this document entitled



Drive Fundamentals, Drive/Motor Basics, Revision 1.0



Wednesday 21 May 2014

what type of energy electrical current have



I'm interested in what kind of energy has electric current ?. For everything I taught in school should have kinetic energy because electrons are on a certain potential within the electric field when the switch is closed then the electrons move and the electric current is "generated" which then should have the kinetic energy. And so I was thinking all the time until I came across this article http://amasci.com/miscon/energ1.html which actually tells me that everything I know about the electric current is wrong On the other hand, I wonder if so many books from college ,schools, are spoken in the wrong way It's just a little weird that a huge number of scientists and engineers are actually talking nonsense all the time and so I hope that you can help me clarify my dilemma.


thanks in advance.




Why is a BJT considered "current-controlled"?



With BJTs, we can control base current using Vin (from diagram). Why do textbooks state that BJTs are current controlled when it's obvious that changing the voltage controls the current through the collector? enter image description here





Was Benjamin Franklin wrong (about conventional current)?


I am starting to see a lot of people claiming that convential current is 'wrong' because Franklin made an error when he first started investigating electrostatics, and that later scientists didn't bother correcting the mistake, but preferred to keep the 'convention' (here is a classic example: http://www.allaboutcircuits.com/vol_1/chpt_1/7.html)


I always thought he didn't get it wrong. He said that current is positive in the direction that positive charge flows, and vice-versa. He of course had no way to know which side of two sticks behind rubbed actually gained or lost mass. So he wasn't wrong. What were you taught?


P.S. I can't help but feel we are lucky that he got it 'backwards', because clearly many people are confused about electrostastics (including the author of that text book!) and believe electricity has to involve electrons (an unfortunate name... why couldn't they have been named negatrons...)



Answer



Electric current, A.K.A, "conventional current", is an abstract current, the flow of electric charge. From a previous answer I gave here:




Electric current is an abstract current, the flow of electric charge, not a physical current like, say, electron current, the flow of electrons.


But electric charge is a property of things, not a thing, i.e., electric charge is always "carried" by a thing.


So, while an electron current is necessarily an electric current (due the negative electric charge carried by the electron), an electric current is not necessarily an electron current.


For example, in a salt solution, we have two species of electrically charged ions present, the positively charged sodium ion and the negatively charged clorine ion. Imagine that the sodium ions are moving to the right and the chlorine ions are moving to the left.


Obviously, we have two ion currents in opposite directions but there is just one electric current and it must have a direction. The direction of electric current is, by convention, the direction of the flow of positive charge.


So, in this case, both ion currents contribute to an electric current to the right. The first term is due to the positive ions to the right. The second term is due to the negative ions to the left where the negative sign numerically "flips" the contribution to the electric current.


Think about it this way, if I told you that I was travelling at -60mph west, you'd know that I was actually going 60mph east. Similarly, a negative charge current leftward is an electric current rightward.



Using NPN-Transistor as switch not working


I have following schematic:


schematic


simulate this circuit – Schematic created using CircuitLab


But the motor is not working, the NPN-Transistor does not seem to let any current through. What am I doing wrong? the transistor does work, I checked, but there may be something very basic wrong, electronics is not really my strong suit.



Answer



You're very close. instead of having the NPN in its present location, it need to be between the motor and GND. So disconnect the NPN's emitter from the motor, its collector from the 9 V supply, and connect: Emitter -> GND Collector -> Motor Base -> 1k & 5 V as you have it.



The motor will go between the 9 V supply and the NPN's collector.


Whether or not 1k will work depends on the motor current. 5 V and 1k will give about 4.3 mA of base current -- probably about 100 mA of collector current. This sounds low for even a small motor.


schematic


simulate this circuit – Schematic created using CircuitLab


Also, it is possibly you have (partly) damaged your NPN -- the way you have the circuit now, the base-emitter junction is reverse biased. These usually break down around 6 V, and when they do, the beta (gain) of the transistor gets degraded.


On-Board connection of ethernet transceivers



Is it possible to connect two 1000-BaseT transceivers with each other? I have two transceivers, each of them has 4 twisted pairs that actually are meant to be connected to an RJ45 connector including magnetics. Is there anything wrong with making on-board connections between ethernet transceivers?



Answer



You may have some trouble if you don't provide a resistive padding network between the two ports when you cross tie them, to simulate the damping you'd normally get with a length of cable / transmission line, and provide enough attenuation to avoid saturating the magnetics. I have not done this with 1000 speeds but I can tell you of several occasions where I've cross connected two 100-Base-T ports, and found that anything less than about 1/2 meter of cable produced unreliable results. 1000-Base-T will surely be even more problematic. To cross connect them "on-board", you will likely have to have "T" pads pon each leg of each differential pair, and at that speed will have to be mindful of the transmission line characteristics of your PC traces. Now all this is worst case! Depending on the magnetics and filtering already on board to interface to the outside world, you may get lucky, or you may find that one resistor on each leg will do (though you'll still need to be careful of your trace layout!). Finally, if you are scratch laying out a board here, you will likely find that the manufacturer of the transceiver has guidelines for simpler direct coupling, when done before the "outside world" interface. There's a little black magic here sometimes, so I'll end by wishing you luck.


oscillator - increasing metal detector range



I am working on my senior project. As part of my project I need to use a metal detector. I am using the following circuit schematic.


The principle is based on the properties of inductor coil:


$$L=N^2\mu \left(\frac{A}{l}\right)$$


Where \$N\$ is number of turns, \$\mu\$ magnetic permeability, \$A\$ is area of the coil, and \$l\$ is the length of the coil (if you think of coil as cylinder, l is its height).


Once a metal object is placed near the coil, it behaves as a core for the inductor, and the \$L\$ changes, it becomes:


$$L = L_{air}\times\mu$$


Hence RLC circuit frequency and the following sound produced by the speaker changes as well. When I set up the circuit, I have used a small inductor about \$1\space\mathrm{cm}\$ in size which was \$10\space\mathrm{mH}\$, as it was specified in circuit (there are different variations of the same circuit with small differences), it was detecting the metal, but the range was very small, at most \$1\space\mathrm{cm}\$.


I researched how I can improve the range (not in academic articles, because I could not find anything specific, would be happy to hear suggestions from you) and read that area of the coil is very important, so I calculated and came up with \$100\space\mathrm{m}\$, \$150\space\mathrm{turns}\$, \$10\space\mathrm{cm}\$ in radius, and \$2\space\mathrm{cm}\$ in length coil.


I bought the wire, and wanted some appropriate round shaped object for that. I went to a place which cuts figures from acrylic, and got this:


coil1 coil1



Now when I connect it to the circuit, sensitivity is even less. I can't get the reason, possibly because of the magnetic properties of acrylic, I tried to look in internet, but the datasheet provides just the electric properties.


Now I am stuck, I have heard that people got \$40\space\mathrm{cm}\$ range, which is more than ok for me. I don't have time to build a different detector. My questions are:



  1. Should I remove acrylic layer?

  2. How can I increase the range? (I have different resistors and capacitors, and a potentiometer, which I can use, but I doubt that they will help with sensitivity, any offers for increasing range are ok)

  3. I am using 9V batteries and they discharge very fast, how do you think what might stand behind it? Sometimes I use potentiometer instead of resistor, and try all values. May it be due to very low resistance?



Answer






  1. No, removing the layer of plastic will not do anything as gravity does not have any particles or anything that must move around to make it work




  2. Increase the amount of energy going to the coil, for example using lower value resistors or potentiometers or increasing the voltage slightly




  3. Try using D cell batteries as they have a higher current capacity then 9V cell batteries




Isolating motor control signals from microcontroller from high voltage/current lines


We need to design an integrated DC motor controller/driver, which will be under microprocessor control. Due to space requirements, either the digital and analog circuitry will be on a single PCB (think of PC104 size), or they will be stacked on top of each other (again, similar to how pc104 boards are stacked). The load requirements are about 10A at 30V. Stall current can go up to 25A.


In order to protect the controller from the motor, we want to isolate the control signals. In fact, even the power supply and the grounds for the digital and analog sides are different. (Note that this means the the ground of the analog side can be at an entirely different voltage than the ground of the digital side)



My questions are: What is a good way to isolate these two domains (optocouplers, maybe?). The signaling rate between the two domains need to be around 1Mhz.


Also, I'm a bit worried about the noise from the motor affecting the digital circuitry, even with proper isolation of the control signal lines. Just being physically close to a motor sometimes even causes problems, let alone being physically connected. I would like to hear about your experiences in building motor controllers/drives to we don't make the same mistakes.



Answer



Optocouplers can be used in many applications but be aware that the switching speeds are limited. Digital isolators (Analog devices, et al.) using magnetic or capacitive coupling are much faster, but slightly more expensive. We have had good luck with all these approaches. Generally, optocouplers (ordinary with external drivers or drivers like Avego HCPL-3120) will do since the switching speeds are rarely over 100kHz on motors. Use gate drivers that have fast enough and powerful enough outputs to keep switching losses under control. For analog feedback consider isolation amplifiers (TI, Analog Devices) LEM's or optoamps (Avego) We will often mace the control circuitry hot and only couple in and out the control information. As far as noise goes, avoid running power through the ground of any control or measurement circuitry. Use ground planed control PCB's with a single connection of their ground to power ground if possible. I have successfully used a small 2 layer SMT (one side grounded) control board on a power system with 83 amps peak at 385 volts and 62.5 kHz and had not even a tiny bit of trouble with noise so far. The SMT is mounted directly on the power devices with short standoffs and gets its control signals through an 8 pin header.


voltage - How does autoranging work in a multimeter? What is the circuit?


I was curious how this is done. It seems you would have to vary the voltage and current to measure resistance from 1ohm to 10Mohm.



Answer



The multimeter does exactly the same as what you would do manually with a non-autoranging meter. Suppose you have a 3 1/2 digit meter, so 1999 is your maximum reading.


The multimeter starts at the highest(*) range, and if the reading is less than the 199.9 threshold it switches to 1 decade lower, and repeats this until the reading is between 200 and 1999. That goes very fast because it doesn't have to display anything during this procedure, so it appears that it gets the right range first time.


Or, if it includes enough logic, it can take the first measurement on the highest range, and then directly select the lower range that is most appropriate for that voltage level.



For example:
1st reading, at 1.999 MΩ range: < 199.9
2nd reading, at 199.9 kΩ range: < 199.9
3rd reading, at 19.99 kΩ range: > 199.9
So this is the range we want.


Do actual measurement: 472


That value is between 200 and 1999, so that's the best resolution possible. If it would go another decade lower it would overflow. So the resistance is 4.72 kΩ.


Note that during the first readings it doesn't really measure the actual resistance, it just checks if it's higher or lower than 199.9.


Alternatively the multimeter may have a set of comparators that can all work simultaneously, each checking a next higher range. You get the result faster, but this requires more hardware and will probably only be done in more expensive meters.




(*) Not the lowest, as "Mary" aka TS suggested. Those as old as I am have worked with analog multimeters. If you would start measuring at the most sensitive range the needle would hit the right stop hard. You could hear it say "Ouch". Switch to the next position, again "bang!". If you care for your multimeter as a good housefather ("bonus pater familias") you start at the least sensitive range.


Tuesday 20 May 2014

How would I use this 12 key keyboard?


I'm trying to make this simple code lock circuit, and I ordered this keyboard for it.


Keyboard


However, there isn't any kind of manual for it, and I simply don't understand how it works.


Here's a larger picture of it (sorry for the horrible soldering, I've a bad solder, and I probably do it wrong also.)


enter image description here


So there's 7 wires on it currently, but how do I actually use this thing?



Answer




There are four rows and three columns which make a matrix of 12 possible connections. Each switch is located at one of the cross-points of the columns and rows: -


enter image description here


If you "read" the value of the voltages on a single column and activate each row with a positive voltage (not together but in turn) you can deduce which of the four switches is pressed in that column.


Read the voltage for each of the three columns and you can deduce which button is pressed of the 12. Two buttons being pressed can confuse things so be aware of that.


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

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