source
stringlengths
620
29.3k
target
stringlengths
12
1.24k
Motor speed control using arduino and quadrature encoders I am trying to get precise control over the speed of rover 5 based robot. It has four PWM controlled motors and 4 Optical Quadrature Encoders. I am using 4-channel motor controller with rover 5 chassis . I am using arduino Nano for control. I am able to read encoder INT output and change PWM based on pulse width to control speed. But, as a result, I am getting heavy oscillations in the control output. That makes, the robot to move in steps, as PWM is changing constantly. I need an algorithm which can minimize this ringing and have a smooth moving robot. Here is my arduino code snippet. void setup() { Serial.begin(9600); init_motors(); init_encoders(); req_speed[0] = 20; req_speed[1] = 20; req_speed[2] = 20; req_speed[3] = 20;}void loop() { update_encoders(); update_motors();}void update_motors() { int i, err; unsigned long req_width; if(micros() - mtime > 2999) { mtime = micros(); for(i=0; i<4; i++) { digitalWrite(pins_dir[i], req_speed[i]>0); if(mtime - change_time[i] > 50000ul && req_speed[i] != 0) { cur_pwm[i] += 5; } if(req_speed[i] > 0) cur_err[i] = req_speed[i]*10 - cur_speed[i]; else cur_err[i] = (-req_speed[i]*10) - cur_speed[i]; if(cur_err[i] > 0 && cur_pwm[i] < 255) { cur_pwm[i]++; } else if(cur_err[i] < 0 && cur_pwm[i] > 0) { cur_pwm[i]--; } analogWrite(pins_pwm[i], cur_pwm[i]); } }}void update_encoders() { int i; unsigned long w; enc_new = PINC & B00001111; unsigned long etime = micros(); for (i=0; i<4; i++) { if((enc_old & (1 << i)) < (enc_new & (1 << i))) { w = (unsigned long)(((etime - change_time[i]))); pulse_width[i] = (w + pulse_width_h1[i] + pulse_width_h2[i])/3; pulse_width_h2[i] = pulse_width_h1[i]; pulse_width_h1[i] = pulse_width[i]; change_time[i]=etime; pulse_count[i]++; cur_speed[i] = (3200000ul / pulse_width[i]); } } enc_old=enc_new;} Here req_speed is between -100 to 100, where sign indicates direction. Please consider all undefined variables as globals. I experimentally measured that, when motor is running at full speed, the pulse width is around 3200us. Encoders' INT outputs (XOR of A and B) are connected to A0 thru A3. Motor PWM is connected to D3, D5, D6, D9. Is the arduino not fast enough to catch up with 4 encoders?Is PinChangeInts better than polling? Please let me suggest any improvements to this code and advice me about what am I missing here. <Q> Your control loop cyclically overshoots the target speed. <S> The canonical solution to this sort of problem is a PID controller . <S> The concept is essentially the same, measure a thing and compare it to a target to calculate an error. <S> Then adjust something (in your case, PWM duty cycle) based on the error. <S> However, a PID controller has three error terms: <S> P: <S> the current error <S> I: the integral of the error D: the derivative of the error <S> For each of these terms, the controller has programmed some gain. <S> It then multiplies each term by the respective gain to calculate how much the control input (PWM duty cycle) should be changed. <S> Properly tuned, this allows you to get a feedback loop that at first ramps up the duty cycle, then as your vehicle approaches the target speed, backs off smoothly <S> so you get a minimum of overshoot. <A> I really think you should look at interrupts rather than polling at the very least. <S> I am also doing a similar encoder project (albeit not for a robot) and I have decided to spend a few $ on a separate chip for doing the counting of pulses which I can then read on the analogue pins through a DAC. <S> This has several benefits: <S> frees up the MCU to do other stuff means that you do not have to worry about the length of your code in the polling loop resulting in missed pulses you can decide to only read the encoder count when you need to <S> The chip that has been recommended to me is here By using i.e. a Arduino analogue pin -> multi/demultiplexer -> <S> DAC -> <S> dedicated encoder interface chip you can free up a LOT of the arduino pins/have a lot more encoders ;) <A> You might need to slow down your PWM response when you have measured that the motor isn't running at the correct speed. <S> I'm guessing that you calculate a target PWM duty cycle given the error. <S> It's called rate control and is what folk traditionally refer to as the differential term in a three term controller. <S> Basically a simple way of achieving this is to decide where you need to head but limit the amount per second that you change the PWM duty cycle. <S> Anyway, that's the view of an analogue engineer and someone only only writes code in emergencies!
It looks to me that your control loop is essentially: if speed is too slow: increase PWM duty cycle one unitif speed is too fast: descreate PWM duty cycle one unit As you have observed, this doesn't work so well.
How to transform 5V into 12V? I would like to transform 5V 500mA (from USB power) into 12V with a few cheap components. Is this possible with the help of some generic parts (and not with the help of some expensive transformer, etc.)? Also, how many milliamps would this provide? <Q> These are called boost convertors . <S> They take a low dc voltage (such as 5V) and convert it to a higher dc voltage such as 12V. <S> They use an inductor to store energy in one half cycle of a clock and in the other half cycle the energy stored in the inductor charges up a capacitor. <S> The capacitor is naturally charged to a higher voltage than the input voltage because of the way the inductor and switching components are placed. <S> Here is another article: <S> - You can actually build this with op-amps/555s/resistors/diodes and a decent MOSFET (n channel) and if you are not that bothered about super high effciency then a NPN can replace the MOSFET. <S> Personally I'd go to TI or linear technology and buy one because it'll outperform anything you are likely to make if you are a beginner. <A> With some generic parts? <S> The MC34063A is a fairly standard part found in most car usb chargers ( <S> And I mean most, even The Dollar Tree $1 car chargers). <S> While it is normally used for buck regulation from 12v to 5v, it can also do inverting and in your specific need, boost regulation by moving the circuit around. <S> The car chargers will have an okay sized capacitor, diode, and typically 220 µh inductor needed, though the timing capacitor would most likely need to be changed. <S> It's a generic chip made by multiple manufacturers, and can see up to 88% efficiency with an internal switch peak of 1.5A, limiting output current to 750mA unless you go to an external switch. <S> Since you are using an unnamed usb source, and could only expect 500mA, the 750mA output limit is not a problem. <A> Anyway, a transformer works with AC current. <S> For such a small power, a simple DC/DC converter will do the trick. <S> Unless you want to build one for the sake of doing it yourself, there no point in making it from scratch. <S> At the end of the day, this will take you more time, it will be bigger, and the overall cost will probably be larger than a ready to use DC/DC converter, for instance: RECOM RI-0512S , 2W , 167 mA ouput ($7.60 at mouser) <S> TracoPower <S> TMH 0512S, 2W , 165 mA ouput ($8.26 at farnell) <S> Depending on what you plan to power with that, you might consider regulation and electrical isolation. <S> regulation to make sure the output stays at 12V as long as the load consumption stays within the specs. <S> isolation if you plan to power a device which is somehow connected to the mains as well. <S> That way you wont fry your computer if your computer and the device are not on the same phase. <S> Beware, you are not supposed to draw more than 100mA from an USB port unless you have some USB logic able to ask for more.
In real life, stealing 500mA from USB will work on most regular computers, but you may have unpleasant surprises on some cheap mini-PC and some laptops.
Using an arduino in below-freezing temperatures I intend to use an Arduino in an environment with highly variable weather. It will be an outdoor project staying outside during the entire year with temperatures ranging from a maximum high of approximately 37C (~100F) to a maximum low of approximately ~35C (-31F). It is unlikely that these temperatures will actually be reached, but it isn't unheard of. The temperature will most likely fluctuate between -15C (5F) and 30C (86F). I have read that the ATmega32u4 and XBee 1mW U.FL (which I also intend to use) datasheets that both of these should operate properly between -40 and 85 degrees Celsius. Does this mean that the Arduino itself should be able to carry on normal operation? (if it runs a bit slow, that is fine, as long as it functions normally) Also, I am concerned about condensation. I intend to use the following enclosure for the project http://www.adafruit.com/products/905 and will need to drill a few holes in it to get wires in and out. Will I get condensation in the enclosure? How big a problem is this? Is there an easy way to prevent it? Also, I'm curious whether the holes I drill for the cables will be problematic? Does anybody have any tips on sealing them? <Q> Take a look at this crazy Arduino experiment with liquid nitrogen http://3.14.by/en/read/arduino-liquid-nitrogen-overclocking <S> Although this is not exactly what you asked for, nevertheless you could take some ideas from the conclusions at the end of the article. <A> Feeding cables For your holes <S> , there are these push-out-holes in your selected box that fit a cable gland to feed a cable that have a rubber seal. <S> You can only feed a single cable per gland, because the seal is round. <S> These glands are usually available at any DIY or hardware store. <S> Temperature and humidity <S> I don't know about the rated temperature for Arduino, but for a Dutch rail road project we used to mount a heating element and thermostat under the equipment that was rated for 5 degrees and higher. <S> That would keep the device just warm enough and dry. <S> I think the biggest issue will be condensation. <S> Are you sure overheating will not be an issue? <A> Assuming a Arduino Leonardo which has the 32u4, you have to keep in mind that every part of the board, from the pcb and SOLDER, to the passives, to the connectors, to the ICs have operating temperature ranges. <S> Most are not designed for subzero operation (-18°C/0°F) <S> A cursory look at datasheets of the Leonardo parts shows that the only IC that won't reach past -45°C is the NCP1117ST50T3G, the 5v Regulator. <S> It has a minimum operating temperature of 0°C to a max of 125°C.If you bypass the 5v regulator by using a dedicated 5v charger <S> , you have to worry about that 5v charger's circuit working at such low temperatures. <S> The PCB itself, at -30°C, should avoid any unneeded shocks. <S> And to quote a comment from What is the minimum temperature for FR-4 PCBs? <S> It's not what you're asking, but... <S> In addition to looking at the operating temperature range of each part, remember to look at how they interact. <S> Different materials have different coefficients of thermal expansion (CTE), and parts with CTE much different from that of FR4 tend to be the ones that fail (either break or pop off the board) due to temperature swings. <S> Large ceramic parts (like some crystal oscillators) are the most common source of problems in my experience. <S> In fact, the crystal used on the Leonardo, a SMD KX-7 16mhz crystal, not knowing the specific manufacturer, seems to show multiple manufacturers citing it at -20°C minimum temperature. <S> And if the parts heat up from use while the board stays colder, it can cause the parts to snap themselves off. <S> I recommend reading that other question for some more details. <S> Common passive capacitors will experience a negative capacitance shift that will make them useless in most circuits. <S> As for the enclosure, you may want to look into ones designed for sub-zero temperatures, with heating. <A> I worked on a submarine project where we had to seal everything. <S> In order to acheive that we used sealed connector, like these ones . <S> This way you could seal the interface with your box and have a closed environement inside with close to no humidity in and none entering. <S> You could then isolate a bit the board to make sure the temperature stays within spec.
I don't know on what kind of budget you are running, but I also think that condensation will be the biggest issue.
Three phase heaters and amps I am a mechanical engineer with basic understanding of electricity. I am programming an app for ordering 3 phase heaters, and I have an argument to resolve with a coworker. Lets say I have a 208V 3-phase heater (delta connection), with a heating element on each leg L1, L2, L3. The total KW of the heater is 15 KW. My calculation for amps in each leg is 15KW*1000/[208V*1.73] = 41.7 amps. On each leg there is a thermal limit switch with 25 amp rating. Since I1 = I2 = I3 = 41.7 amps in each leg, I need to split into two branches to divide the amps into two because of the 25 amp limit switch. A coworker is arguing the following: Each element is producing 15KW/3 = 5 KW per element. Treating each leg separately, one can treat it as a 'single phase' circuit with 208V across the element. So amps per leg is 5 KW *1000/208V = 24 amps. So no need to branch for the thermal limit switch. Obviously one can't come up with two different answers. My thought is that even though on average each element is producing 5 KW of heat, instantaneously it might be producing more than that, as long as all three elements together are producing 15 KW at any given instant. So instantaneous amps would be 24 amps*1.73 = 41.7 amps (to reconcile the two approaches). With a Wye connection my coworker's argument would work because the voltage across each element is 120V. But intuitively I don't know why it works for Wye but not for delta connections. <Q> You co-worker is right in calculating the current per element. <S> Each element is apparently driven with 208 V accross it and is drawing 5 kW of power. <S> 5 kW / <S> 208 V = 24 <S> A, as he said. <S> (By the way, the extra 1000 in your equations is incorrect. <S> 5 <S> kW * 1000 is 5 MW, not 5000 W. <S> Also, the correct units is kW (killo-Watts), not KW (Kelvin-Watts)). <S> You are right in that the instantaneous peak current is higher, but for sine waves it is higher by the square root of 2 from the RMS, not the square root of 3. <S> 24 <S> A RMS therefore has peak currents of 34 A. <S> However, the Amp rating of these thermal limits switches are almost certainly RMS, not peak, check the datasheet. <S> So in theory , these 25 A limit switches can handle your 24 A load. <S> However, in the end I agree with you. <S> Having a switch rated for 25 <S> A regularly carry 24 A loads for sustained periods of time is asking for trouble. <S> This is just bad engineering. <S> What are you going to do, go to the customer when the inevitable failures occur and wave the datasheet saying " <S> But it says here it should have worked"? <S> Use beefier limit switches or split each 5 kW load into two 2.5 kW loads, which will draw only 12 A each and will be fine with the existing limit switches. <A> Is 208V your line voltage or phase to neutral voltage? <S> If it is phase to neutral voltage, then each (5kW) heater has across it 360V RMS (\$208 V\times\sqrt3\$) <S> and this means a current of 13.88A per phase. <S> If 208V is your line voltage, then the current per phase will be 24A. <A> There is no need to reconcile the two approaches. <S> You calculated the line current and your coworker calculated the phase current. <S> (By the term phase current <S> I mean the current in one of the delta-connected elements.) <S> The two phase currents have equal magnitude, but are 120 degrees out of phase. <S> The difference between the two phase currents is the line current, which is √3 times the phase current (and shifted by 30 degrees). <A> I like to think of Delta as sort of parallel <S> and I like to think of wye as sort of series. <S> The correct location for your limit switch in a Delta configuration would be 1 limit switch each in series with only one element. <S> that would require 3 limit switches. <S> As a practicing component-level troubleshooting technician after 40 years I can tell you that you want 15 to 20% over rating for those switch contacts, wire and terminations, Unless you like to sell parts. <S> Many manufacturers thrive on repeat parts sales. <S> Also most manufacturers would put that limit switch in the contactor control circuit where it has little current passing through it and lasts a long time, you only need one and it can be a 1 amp limit switch, that is if you're limiting temperature. <S> If you're limiting current then you would use a current limiting relay to monitor the current in the contactor with 1 contact set used to interrupt the contactor coil. <S> It all depends on the application requirements. <A> Let _L = line and _Ph = phase. <S> For star or delta connections total power = 3 * phase power. <S> For a delta connection line voltage = <S> Phase Voltage. <S> Therefore :Total Power (Pt) = 3*V_L*I_Ph. <S> Rearrange to get:I_Ph = <S> Pt/(3*V_L)I_Ph = <S> 15000W/(3 <S> *208 <S> ) = 24.04A <S> So 25A is spot on.
They are different because each line is connected to two phases.
BNC splitter which separates ground and signal? I'm a student doing research in a physics lab and we often have the need for a certain type of BNC cable splitter. This splitter has a BNC jack which accepts a single coaxial cable as input. It has two jacks for output. It routes the center pin of the input to the center pin of one of the outputs and it routes the shield of the input to the center pin of the other output. To give an example, one thing we use this type of splitter for is to amplify a voltage (center pin) with respect to ground (outer pin) using a purely differential amplifier which takes two BNCs as input. My questions are:1. Is there a name for this type of splitter?2. Is there anywhere that sells nice, high quality splitters of this type? We can homebuild them but it would be better if we can find a place to buy them from. I've tried searching for this, but I haven't turned anything up. I appreciate any and all answers! Edit: I should note that another thing we use this type of splitter for is connecting a two point resistance measurement from a multimeter to our breakout box. The multimeter has banana plugs and we want to connect the positive wire and the negative wire to different jacks on the breakout box (corresponding to different contacts on our sample inside a dilution refrigerator). It seems to me that a splitter like I described is necessary for this. <Q> I haven't seen that particular style of adapter <S> They are fairly widely available in a variety of styles such as the following: <S> Those particular parts are a Pomona 4435175 and Pomona 1894 <S> - I've given links to them on Element 14 but similar adapters are available from a wide range of manufacturers and suppliers. <S> Just try a search on "BNC banana" to find them, I just did a search on Digikey and it looks like they have a good range as well. <A> I don't think anyone really makes a connector like that. <S> It really defeats the purpose of a differential amplification. <S> I think a better solution would be to run the BNC cable straight into the + input of the amplifier and then terminate the - input or short it to GND. <S> Or flip flop that if you want the output inverted. <S> This will do exactly the same thing <S> and you should get better noise performance as you will be bringing in less of the noise that will be coming back up the shield. <S> Edit: <S> As for connecting to a multimeter, there are BNC to banana adapers available that will split out the center contact and shield on separate banana plugs. <S> A couple of these in combination with a couple of banana cables would allow connections between the multimeter and any combination of signal and shield connections. <S> However, this likely will not be very effective for performing sensitive measurements. <A> We have a similar requirement it to take the output of an isolated ground system and plug it into a differential amplifier (so that the ground of the amplifier doesn't create ground loops with the isolated ground system). <S> For now we have just been making our own with a box with two grounded BNCs (which go directly to the inputs of the differential amplifier) and an isolated ground BNC. <S> Inside the box is simple -- two wires. <S> It works, but it would be nicer to just have something that looks like a Y splitter.
but if you don't have any luck tracking one down a solution I use personally is a pair of BNC receptacle to banana plug adapters along with a BNC to banana socket adapter.
Minimizing Ringing in a H-Bridge I am designing a H-Bridge based DC-DC Converter that boosts 24V to 350V DC. I use a HF transformer at the output of the H-Bridge for the actual boost. The circuit works OK for a while and then the IC dies. I suspect this is because I have ringing present at the output of the H-Bridge. The first picture below shows the output without the transformer and the second one shows how the ringing increases with the transformer. My layout currently is on a single layer board and I will move to a 2-layer board to minimize loop areas of signals that drive the gates of the MOSFETS - but wouldn't the inductance of the transformer always cause some ringing? If so, how can I be sure that it won't damage my chip? The half-bridge driver that I'm using is MAX15019 and it can tolerate -5V to 130V at the output pin so I'm mostly concerned about the negative transients. The following schematic shows the circuit. The graphs are measured at nodes A and B with respect to GND (this is also where the transformer's primary is connected). Note that I have tried various values for the gate resistors and using a higher one usually just leads to more power loss in the transistors. As mentioned before, I am concerned with minimizing negative transients - particularly when the transformer is connected. <Q> There are two things you can do (and are probably already doing, although maybe not quite the way your circuit requires): <S> Shunt the spikes to a supply with fast diodes. <S> Even if you did not design this, you are already doing it, at least via the parasitic diodes of the MOSFETs in the half bridge. <S> By using dedicated diodes, e.g. Schottky diodes, you can lower the power dissipation inside the bridge. <S> Limit the slew-rate of your bridge. <S> You could (and probably already do) use a snubber circuit as passive solution, and/or use a small capacitor to provide negative feedback from the half bridge's output to its driver (make sure you provide negative feedback!). <S> As with all HF electronics, the sizing can be tricky because you'll either have to accurately model the parasitics of your circuit or adjust your circuit until it happens to work well enough. <S> Unfortunately, either too much or too little could destroy your circuit. <S> For example: If the parasitics of your circuit, possibly after adding a snubber, resonate, you may have even more ringing, killing your MOSFETs faster. <S> Too little slew-rate-limiting leads to stronger ringing and can kill your MOSFETs. <S> Too much slew-rate-limiting increases the power dissipation while switching and can kill your MOSFETs. <S> EDIT: <S> I didn't see the schematics before. <S> With these, we see that (just as the IC manufacturer in its typical operating circuit ) you did not bother with details such as snubbers. <S> Hence, whilst switching, much of the current flowing through your inductor can only go into parasitic elements in your circuit. <S> The total switching time in your circuit is probably on the order of 50 ns (gate resistance of your circuit is 5 ohm discrete plus 1 to 3 ohm driver IC output resistance, and the gate "input" capacitance is given as typically 7.7 nF in the MOSFET datasheet ). <S> During some of this time, we need an alternative path for the current, a snubber circuit. <S> A diode to a rail is a start; a capacitor parallel to it or across the inductor may help, too, but needs care because you do not wish to create a problematic resonance. <A> One nice thing about using FETs in an H bridge is that the body diode makes an adequate clamping snubber to the supply rail. <S> Current flowing in the transformer leakage inductance will make its way back to the supply through the diode when the switch is turned off. <S> An additional snubber shouldn't be required, although might be desired for EMI when operating at duty cycles less than 50% of the complete switching cycle. <S> Having said that, there are a couple of things that need to be true (and don't seem to be) for proper operation: <S> There needs to be a high quality capacitor (that can handle all the ripple current) located at the H bridge. <S> Bias voltage for the MAX15019 has to be separate from the H bridge source voltage. <S> Having these two voltage with the same source is bad practice. <S> An LDO would be a good way to separate the IC bias from the H bridge source. <S> Here is the scenario. <S> Let's say that at the parasitic resonant frequency, the supply impedance is 3 Ohms and that the current in the transformer leakage inductance is 1 Amp (these numbers are just for illustration, too lazy to do any real work here). <S> The current will be clamp snubbed back to the source voltage, adding 3 Volts to it (1 Amp through 3 Ohms). <S> If Vbatt starts at 13V, then the clamp spike will add 3V to it for a total of 16V. Vbatt also supplies the MAX15019 and 16V is probably enough to kill it. <A> Check the mosfet <S> Coss capacitance <S> and since your ringing is within nanoseconds (measure that) <S> and the spike would be two times the DC voltage. <S> Calculate the winding capacitance using the formuala f <S> = 1/2*Pi <S> * sqrt(L*c) since you know the Coss capacitance calculate L. Connect a RC snubber across the transformer. <S> The spike would go away. <S> Now the problem you would be facing would be gate pulses to the MOSFET for that you need a good gate driver
The H bridge source voltage (Vbatt here) needs to have low impedance at the switching frequency and out to the parasitic resonant frequency (of the transformer leakage inductance and FET output capacitance).
Power factor meaning on induced motor Let say A 440-V 60Hz three-phase star-connected four-pole induction motor developed 10 hp at 1745. The input power is 10kw at 0.85 lagging power factor. the no load input power is 0.6kw My question is that what does the power factor mean in this sentence?What is this power factor value derived from and the meaning of it ? <Q> First things first there is something called Displacement Power Factor <S> This is basically related to the phase difference between the voltage applied and the current drawn$$DPF = \cos( \Theta ) <S> $$ <S> What this means for your case is if 10kW of real power is being consumed then there is 11.76kVA of apparent power (industry are charged based upon their VA consumption as oppose to W consumption hence why PF/DPF is important) For linear loads and an induction machine will appear as a linear load: PowerFactor = <S> = <S> DisplacementPowerFactor <S> For non-linear loads (rectifier-based systems etc) <S> the disctinction between DPF and PF becomes important. <S> PowerFactor takes into account harmonic distortion $$PowerFactor = <S> DisplacementPowerFactor <S> * DistortionPowerFactor$$$$Power Factor <S> = \cos( \Theta <S> ) * \tfrac{1}{\sqrt{1 + THD_{i}^{2}}}$$ <S> So you can see for a linear load <S> the THD = 0 <S> and thus the DistortionPowerFactor = 1 and <S> thus PowerFactor = DisplacementPowerFactor and is the cosine of the phase difference between the voltage and current <A> If you apply a sinewave to an inductor or capacitor, current flows but no power is taken from the sinewave generator because, for inductive components, current leads or lags voltage by 90º. Power factor is cos(phase angle) and so for a resistor (phase angle is zero), power factor = 1. <S> For an inductor PF = 0 <S> because cos(90º)=0. <S> For an induction motor the power factor is somewhere between 0 and 1; the zero end of the scale is due to leakage inductances in the machine and the unity end of the scale is because the motor needs real power to turn the shaft and pump water or turn a wheel. <A> Power Factor is defined as the Real Power divided by the Apparent Power, where $$\mathrm{Real\,Power} = \frac{1}{T} \int_T v(t) i(t) \mathrm{d}t\\\mathrm{Apparent\,Power} = V_{rms} \times I_{rms}$$and T is one period. <S> For sinusoidal voltages and currents, this calculation reduces to the cosine of the phase angle between the voltage and current.
Lagging power factor means the current is lagging the voltage, as would be the case for an inductive load.
Why connect two power supply grounds? I'm reading a tutorial and it is showing how to control a DC motor with Arduino board's micro controller. A DC motor is fed by a 9V battery and a transistor is controlling the PWM as in the figure I uploaded. But the text is also mentioning to connect the grounds of Arduino board and 9V DC together. Why would it be recommended? It seems both Arduino's 5v and 9V battery are floating power supplies. Any ideas why they should be grounded together? Text says it is to obtain a common reference. But what happens if we do not connect them together since both are zero volts (ground)? <Q> Voltage is not an absolute value. <S> It's pointless to say they're grounds and therefore are the same. <S> It's like suggesting that I'm five miles away from New York and you're nine miles, therefore I just need to walk four miles to get to you. <S> Except it's even worse than that, because that's a reference point, it's more like saying I'm five miles from my destination <S> and you're nine miles from your destination. <S> Are we near each other? <S> We don't know unless our destination is the same place. <S> Ground is just a name for your arbitrary point of reference. <S> For your voltages, all you have is a reference to a different point. <S> Ground does not inherently mean 0V with reference to any other thing you want to call ground. <S> Call your left thumb ground, a perfectly valid thing to do, and see if that makes sense to you. <S> So the ground on the battery and the ground on the Arduino could be quite different if referenced to one another or to a different point. <S> The only way you can be sure you have a system with 5V and 9V supplies is if they have a common reference point. <A> A battery technically has a positive and a negative terminal. <S> There actually is no ground terminal. <S> The potential across the battery is the voltage which you will see labeled. <S> A 9V battery can just as easily be used as a ±4.5V battery if the positive(+) lead was connected to a +4.5V rail and the negative(-) <S> lead was connected to a -4.5V lead. <S> I've actually seen this done for an audio amp circuit, though I can't recall exactly where. <S> (Sorry for the lack of sourcing). <S> Semantics aside, let's consider why the grounds should be connected. <S> The main reason I can think of is actually making somewhat more definitive potential differences. <S> That was your 5V will read properly (on a meter) as 5V and your 9V will read as 9V. Otherwise, you have two different points of reference (from each of the two grounds). <S> The additional benefit is avoiding a "ground loop. <S> " When the grounds are not at the same potential level, you clearly have a potential difference. <S> Therefore, you have current flow from one point in your circuit (ground of motor/Arduion) to the other. <S> And it forms a circuit loop between those points. <S> That's just wasteful of power. <A> Voltage is a difference between two points. <S> The Arduino supply is 5 volts higher than the Arduino ground, and the motor supply is 9 volts higher than the motor ground. <S> You can say nothing about their relationship to each other unless you tie them together. <S> Worst case is they happen to be close enough to the same potential for your tests and far enough apart to fail in the field. <S> Consider the ground shown in your schematic. <S> If that happens to be too far above the Arduino ground, the transistor might not be able to turn on, because the relative voltage of the pin to that ground will be too low. <S> If that ground happens to be too far below the Arduino ground, the transistor might pull more current than it can handle or the Arduino <S> I/ <S> O can source. <A> If the potencial of the sources do not have a common reference no current will flow from one circuit to another. <S> It is easy to understand, take a voltimeter and take two bateries of different voltaje and not connected in any way, for instance, one of 1,5V and one of 9 V. Try to measure a voltaje between the positive of battery of 1.5V and the positive of battery of 9V. <S> What your voltimeter shows? <S> 0Volts <S> , no + or - 7,5V. <S> Why this happens? <S> easy to understand, they are circuits with no references between them, so no current can go from one to another, and with no current, no voltage, Ohm's law. <S> So you circuit will not work if you don't make a common reference. <S> I mean, now join the negative part of each battery and take the measurement again. <S> Now you will have + o - 7,5V. <S> Why because there is a circuit closed by the voltimeter <S> so a current can pass since one battery to another because they are tied together in one point and the voltimer closes the circuit so a current can circulate through the circuit. <S> Is quite easy, open circuit no, current, closed circuit current an voltage. <S> So it will not work.
If you don't connect both gound of your batteries together in the arduino circuit, you will not have current between them because you have an open circuit.
Device to detect RF What device can detect RF waves, starting from cell-phones, leaking microwaves, house appliances working at a normal range, wifis, etc. Is there something like that? Something were you can set a range and it will detect the waves around you? <Q> You're looking for an RF spectrum analyzer. <S> Portable ones are available. <S> They have various ranges and sensitivities. <S> Most of them are expensive. <S> I've used a USB one from TI for sub-1Ghz . <S> I was pretty happy with its performance. <S> You could use something similar with a laptop to achieve portability. <S> You might be able to detect the things you've listed with the TI one, but they'll be highly attenuated, so signal strength may be difficult to determine without calibration. <S> Search for the name <S> and you'll also find some DIY versions. <S> Assuming you have a good grasp of RF PCB design and antenna theory, they're not too difficult to build. <A> You can also achieve very simplistic sensing by taking an uncut axial lead diode, even an 1N914, and attaching oscilloscope leads near the diode body. <S> The axial leads behave as a dipole, and the length is an adequate match for 2.4 GHz. <S> This works for me within 30cm of WiFi house appliances. <A> In addition(for Samuel's answer), You can use of RF Explorer! <S> Maybe this like will help you.
Meters, Sensors, Alarms and Detectors for Microwave and RF Radiation I've also used a bench-top one from Tektronix, I don't recall the model number, it was several tens of thousands of dollars and very nice.
Calculating resistance for zener diodes? I am an electronics student, and I was set some homework online. I am not having trouble with the question itself but the theory. It says that the current through the resistor is the same as the maximun current that the diodes can safely handle, but as you can see, there are (\$V_{out}\$) volts being dissipating to the right, and a minimum required current going through the diode to maintain consistent voltage. The thing is, how could the current through the resistor be the same as the current through the diode, as \$Voltage=J/C\$, or, joules per coulomb, so that means there must be some energy carried by the coulombs, and ultimately, some electrons. But then this is contradictory, wouldn't the current going through the resistor be the total current, the current dissipated to the right and current through the zenor? Or... is it that there isn't, then, any current passing at \$V_{out}\$? and it doesn't represent voltage being dissipated? I cant wrap my ahead around it... <Q> If there is no current drawn from \$V_{out}\$, then by Kirchoff's Current Law, the same current must flow in both the resistor and the Zener diode, and you want that current to be not more than the Zener's maximum rated current, to prevent damage to the Zener diode. <S> If some current is taken from \$V_{out}\$, then the current through the resistor will indeed be greater than the current through the Zener diode. <S> If the question didn't say anything about current from \$V_{out}\$, then you have to assume that the current is zero. <S> In Real Life, if you were designing a circuit using a Zener diode, you would probably be aware how much current would be drawn from \$V_{out}\$, and would allow for that in your resistor calculation, typically aiming for a Zener current somewhat less than its rated maximum current. <A> When designing a zener circuit I usually try to meet the following requirements: The zener circuit works without load . <S> This means that the zener diode must be able to dissipate the power that is normally dissipated in the load. <S> Check the datasheet for the zener for maximum dissipated power. <S> A regular small zener diode is often rated for 400mW. <S> At this point you know the zener voltage and its maximum power, therefore you can calculate the maximum current through the diode: <S> \$I_{Z,max}=\dfrac{P_{max}}{V_Z}\$. <S> However a zener needs a minimum current to 'actively' regulate the voltage across it. <S> For an average zener diode this is around 1-5mA, but again you should check the datasheet for this. <S> The known maximum load current Of course <S> if the maximum load current is lower than the maximum zener current (from #1), there is no need to stress the zener to its max. <S> As long as the minimum zener current is guaranteed, because otherwise it stops regulating the voltage across it. <S> Maximum load current <S> From the above it can be determined that \$I_{L,max} = <S> I_{Z,max} - I_{Z, <S> min}\$. <S> Or in words: the sum of load current and zener current must be lower or equal to the maximum zener current. <S> Now if V S is given, you can calculate the series resistor <S> \$R = \dfrac{V_S - V_Z}{I_L+I_{Z,min}}\$ <A> It says that the current through the resistor is the same as the maximun current that the diodes can safely handle <S> The text isn't saying the current through the resistor is equal to the current in the diode. <S> It's saying the current in the resistor is equally to what the diode could theoretically (not necessarily at this time) handle. <S> And yes if the current through the resistor would indeed equal that in the diode, then current wouldn't flow through V out (Kirchhoff's current law). <A> Volts don't get dissipated. <S> Basically, that Vout is hooked across an infinite resistor so all of the current that is going across the resistor must also go through the zener diode because they are in parallel series.
The zener is in its regulating mode when maximum load is attached When a load is attached, the current through the zener is lower as a part of the current flows through the load.
Arduino moisture sensor value decreasing for no reason I'm not sure what happened but all of a suden the moisture sensor I bought is acting strange. When I place it in soil and measure the value once per second, it decreases in value pretty quickly about 3 points downwards every 5 seconds. When I am holding the sensor in the air, it reads 1023. When I put it in water, it reads around 400. When I place it in soil, it starts at about 700 and then starts decreasing, meaning it is getting wetter. How can that be possible if I didn't water the soil? Something is happening with it. EDIT: Upon just jiggling the wires that connect the moisture sensor to the arduino...the values jumped down about 50 points. Jiggling more makes it jump around more. Is that normal? <Q> That active aspect of that sensor looks like plain-old HASL (hot-air solder leveled) <S> FR4 PCB. <S> Basically, that construction is pretty much never going to be that reliable. <S> Aside from the fact that the FR4 material itself will absorb water and change <S> it's internal leakage, you're going to have all sorts of fun electrochemical corrosion issues with the electrode surfaces, particularly if you leave the sensor powered. <S> Basically, that sensor works by measuring the resistance between the two "pins" of the PCB stake. <S> It does this by applying a voltage across the pins, and measuring the current flow. <S> However, this is also going to lead to the metal from one of the pins being eaten away by galvanic action. <S> Basically, that sensor is a toy. <S> It's not useful in any real application. <S> If you want to squeeze as much life out of the thing as possible, there are a few things you can do. <S> When you want to take a reading, power the sensor for maybe a few seconds, and take your readings. <S> Then power it off again. <S> Don't take readings too often. <S> Periodically reverse the pins of the electrical connection between the readout board and the "stake" board. <S> Since only one terminal will be eaten away at a time, this should spread the decay out a bit. <S> Be aware that ANY mechanical disturbance of the "stake" board will probably cause a large shift in readout value. <S> Proper systems for this sort of thing use a AC bias on the sensor, which minimizes galvanic corrosion, but there aren't any easy ways to hack something like that in to this device. <S> Real soil moisture sensors are capacitive, and therefore immune to the corrosion issue, but that much more complex and expensive. <A> A decreasing value doesn't necessarily mean "wetter". <S> It means that the voltage that is measured by the processor is getting lower. <S> I infer from the rest of your question that this is a resistive sensor, so there is a fixed resistance connected to a positive voltage at one end and the other end is connected to one of the probes. <S> The other probe is connected to 0V. <S> The processor measures the voltage at the junction. <S> This is a potential (or voltage) divider. <S> So, the intention is that more water means less resistance, means less voltage, and a fall in the reading of the ADC of the processor. <S> However, there could be other effects happening. <S> For example the voltage that is present between the two probes could be changing something chemically within the soil or on the surface of the probe to make it gradually more conductive. <A> How often are you reading from the sensor?I have had a similar problem before, except with a temperature sensor. <S> What helped me, was adding a bigger delay between reading from the analog pin. <S> This way, the sensor ha more time to update it's reading, and you should start getting much more stable values. <S> Otherwise, Its a long shot, but make sure that your arduino is getting the required voltage. <A> Because it is so cheap, there isn't a guarantee that it will last very long. <S> From reading some of the customer reviews on amazon, one person said that their's oxidized within a week... obviously not ideal. <S> If you are looking for a different sensor, I've used this soil moisture sensor for 3 years and it hasn't corroded yet. <S> Although it was a little more expensive, I have been pretty satisfied with it's reliability. <S> Hope this helps!
The analog value is of course relative to the arduino's ref voltage, so if that is dropping lower then 5 volts, then your reading will also start slowly dropping. Your "jiggling the wires" causing a shift in values probably came from the mechanical force transmitted to the PCB through the wiring. From what I can come up with, one possible reason would be the corrosion of the sensor. DO NOT leave the sensor powered.
Peltier Unit Not Working Recently I ordered a Peltier unit online and received it yesterday. Naturally, I was very excited to play with it. When I first turned it on, One side got hot, an another very cold. I had read that I should attach a heat sink to the hot side of the unit. So straight away, I attached a heat sink and a fan to the hot side (The fan is pulling air out). I also added a heat sink to the cool side. However, both sides started getting very hot. I have tried reversing the polarity, changing the fan to push, and used voltages from 4 to 12. After nothing worked, I removed the heat sink on the cold side, But still, both side remain stubborn and insist on getting painstakingly hot. Anyone got Any Ideas as to what's wrong? Also, If it helps, at 12v the unit is using roughly 2A... <Q> A peltier element is, in this order: 1.) <S> a heater 2.) <S> a thermal shortcut 3.) <S> a thermal transfer unit <S> What happens is this: When you turn it on, the whole unit starts to heat up. <S> But one side is somewhat cooler than the other. <S> At first, one side feels warm, one side feels cold. <S> Then the whole unit becomes hot because it is a heater primarily. <S> The small difference of maybe 10 degrees between sides is not noticeable when one is 60C and the other is 70C.Source: [1]: <S> http://quick-cool.de/peltierelemente/fragen-zu-peltierelementen.htm <S> "FAQ Peltier German" <A> A peltier junction creates a differential in temperature. <S> Within certain limits cool side will be 10°C - 20 <S> ° <S> C lower than the hot side. <S> It's a relative cold, not an absolute one. <S> Discard your anthropomorphic definition of cold and hot. <S> So, calculate accordingly, if you keep the hot side appropriately cooled then the cool side will be whatever your differential is below that. <S> If the hot side is boiling hot the cool side is going to be near boiling hot too. <S> Use thermal paste along with your heatsink for better results. <S> Don't expect magic, you're still increasing the entropy in the universe. <S> You're not going to get free cold. <A> You are not getting the "proper" hot side cold enough. <S> Most units are on the order of 12v @ 6A which is 72W, emitting a huge boatload of heat. <S> Put a massive heatsink on it (repurpose one from an old CPU) and submerge the fins in a bowl of ice water. <S> If this doesn't make your cold side frosty cold, you have ruined the Peltier unit. <A> There are three things that can get the cold side of a Peltier Plate hot:1- <S> The most likely cause is the wrong current feed. <S> When the power is just too high, both sides will warm up. <S> You can even burn it. <S> It's not just voltage. <S> Amperes are also critical on this.2- Heat transfer. <S> If you are using metal pieces to hold the heat-sinks together, they could be transferring heat from the hot to the cold side.3- <S> Hot side not ventilated enough. <S> This is the most unlikely, but still possible. <S> I hope this helps.
You may want to tunnel the air-flow trough the heat-sink. Check the manufacturer's specifications for the correct voltage-amperes.
Change circuit while sketch is running on arduino I've tried to find an answer to my worries but without "definitive" answers. I'm a noob in electronic so excuse me if it sounds obvious. My question is: is it safe to update a circuit while a sketch is running? If I'm creating a new circuit and a previous sketch is still on the chip? I found that normally by disconnecting the ground it should be ok, can you confirm this? <Q> As another general rule: First program your microcontroller, then connect the circuit. <S> Imagine this situation: <S> Your previous sketch had all outputs actively driven high by default; Your new circuit connects various inputs to ground by default; <S> The current drawn due to this situation may easily exceed the absolute maximum ratings of your microcontroller and (by far most) <S> Arduino's have no protection at all. <S> Anything between 5V/20mA=250Ω and 4kΩ7 will be a good start to protect most circuits from bad wiring. <A> If the power isn't connected, it doesn't really matter what you do to the circuit (within reason, you can still mess things up with static shocks etc. <S> but let's ignore that for now). <S> Also, the sketch isn't actually running if the power to the arduino CPU isn't connected. <S> The CPU is just sitting there waiting for power, same thing as the circuit. <S> However, I generally disconnect the Vcc line rather than ground in order to break the circuit power. <S> In any case, it sounds like you are not doing anything potentially harmful to either you or the electronics. <A> As general rule: never work in a circuit if it's powered on. <S> A lot of exception can apply, if you know exactly what are doing. <A> You can prevent this and take precaution by uploading the ' Bare Minimum ' example sketch before changing the circuit to an incompatible one. <S> You might also want to clear (portions of) <S> the EEPROM <S> if that's necessary.
One precaution I usually take when experimenting, is to connect series resistors to all Arduino pins unless absolutely sure that a series resistor will corrupt the signal.
How do I use multiple BCD switches as a single binary input? I'm trying to convert a 4-digit (decimal) number to binary. My input is a BCD switch ( this one ). I've been looking to see if I can find either a logic-based circuit or a specific decoder IC to convert the values off of the switch array into a single binary number. I don't seem to be having much luck though.Is there a good way to do this wither with some sort of converter or with logic? I'd appreciate your thoughts.Thanks! <Q> As you're very unlikely to find an off the shelf chip that solves a specific (but not very common) problem the chances are you will have to build something. <S> You should be able to control everything with no more than 6 i/ <S> o pins on the controller (fix operation mode with a pull up/down resistor) <S> You'll need 14 bits to display the maximum value of the bcd (9999). <S> The uC can just about be anything. <S> Input through 74F676 16-Bit <S> Serial/Parallel <S> -In, Serial-Out Shift Register and output through 74F675A 16-Bit <S> Serial-In, Serial/Parallel-Out Shift Register <S> Expanding the number of BCD switches involves adding extra shift registers and a small change in the program. <A> You can do it with logic chips, but it's not going to be fun. <S> If the digits are A, B, C, and D, you would need to calculate A + 10*B + 100*C <S> + 1000*D. <S> This can be expanded to A + 2*B <S> + 8*B + 4*C + 32*C + 64*C <S> + 8*D <S> + 32*D + 64*D <S> + 128*D <S> + 256*D <S> + 512*D. <S> Power of 2 constant multiples are just bit shifts, so all you need is a whole bunch of adders. <S> Or a CPLD/FPGA/uC/etc. <A> Performing the conversion using off-the-shelf discrete logic would be possible, but would probably require somewhere between 6 and 12 chips. <S> One could also easily use a pair of 32Kx8 ROM chips (or a 32Kx16), observing that the LSB of the input value doesn't participate in the result; the only advantage of that over a microcontroller is that its output would represent the switch values in "real time" with no clocking needed. <S> It would also be possible to use some form of programmable logic, though I think any space-efficient solution would have to be sequential, implying that one might as well use a microcontroller. <S> If one wants to implement a design using off-the-shelf components, it might be easiest to build a circuit based upon a BCD counter, a binary counter, a couple of 8-bit comparators, 8-bit latches, and some glue logic. <S> Basically, count from 0000 to 9999 (BCD) repeatedly; when the count wraps, reset the binary counter, and when the BCD count matches the switch input latch the binary counter value. <S> Other sequential approaches may be faster, but the aforementioned approach should be simple. <S> An alternative would be to some a latches, multiplexers, and ALU so that the circuit iteratively multiples an accumulator by 10 and adds the next switch input. <S> That approach could probably produce a new output every 8 cycles or so, but I don't think there's likely a real need for anything that fast.
The conversion of the BCD to binary is a simple but repetitive task and is suited to a small micro controller but the number of input/output pins required is quite large so converting the code to a serial stream with an external shift register - parallel in/serial out for reading the BCD switches and a serial in/parallel out for the output binary number will help out.
What are the practical reasons to use a voltage-follower? Could you give a particular example why is a voltage follower is used? <Q> Could you give a particular example why is a voltage follower is used? <S> A voltage follower typically has a very high input impedance and a very low output impedance. <S> Why is this important or necessary? <S> Well, it is often the case that a voltage amplifier stage will have a moderately high output impedance. <S> This output impedance will form a voltage divider with the load impedance and reduce the voltage gain of the stage. <S> For example: simulate this circuit – Schematic created using CircuitLab <S> Here, I model a voltage amplifier with an open circuit (unloaded) gain of 100 and an output resistance of \$1k \Omega\$. <S> But, with an \$8 \Omega\$ load connected, the loaded gain drops to $$A_v = 100 \dfrac{8}{8 + 1000} = <S> 0.794$$ <S> The voltage gain of the stage is reduced to less than 1! <S> However, by inserting an (ideal) voltage follower between the amplifier and the load: simulate this circuit <S> The overall loaded voltage gain is now 100, the unloaded voltage gain. <S> This may seem paradoxical since the voltage follower has a voltage gain of 1 but remember, the voltage follower is still an amplifier. <S> That is, it increases the power of the signal. <S> Specifically, by presenting an open (or effectively open) circuit to the preceding voltage amplifier stage, no (or effectively no) signal power is required to drive the voltage follower and thus, no signal power is lost in the output resistance of the voltage amplifier <S> And, by presenting a zero (or effectively zero) output impedance to the load, <S> there is no (or effectively no) power lost in the output resistance of the voltage follower . <S> We say then that the voltage follower is a buffer between the voltage amplifier and the load. <A> Voltage followers are generally used to isolate stages from each other. <S> This means that whatever circuit is supplying the input signal does not have to provide much current, while the output of the voltage follower can supply significantly more current to the next stage. <S> Voltage followers can be used to isolate filter stages from each other when building multistage filters. <S> They can be used to isolate sensors from readout electronics - e.g. separate a thermocouple or thermistor from an ADC. <S> They can be used for driving ADCs as ADCs can draw current in large bursts when they sample their input, and this can be disruptive to whatever circuitry might be sourcing the signal. <A> 2 examples: 1) imagine you have a fixed voltage source of 8V <S> and you need to get a 4 V out of it. <S> A simple voltage divider would not work since the voltage would depend on a load. <S> A voltage divider followed by the voltage follower would work. <S> 2) imagine your microcontroller can supply 1 mA <S> but you need at least 10 or 20 mA to drive something (e.g. LED, relay, etc). <S> Most op-Amps used in voltage followers can supply more current than MC IO pins <A> It does what it says on the can; the emitter follows the voltage on the base but that in itself is not even half the story because a bit of wire could do the same. <S> The point is that an emitter follower gives the same voltage but with much magnified current capacity. <S> The emitter can drive a motor or loudspeaker in circumstances where the signal to the base might not be even powerful enough to turn a led on. <A> Unity voltage gain capability of voltage follower circuit makes it eligible for obtaining desired output voltage that is analog as well as as digital
A voltage follower generally has a high input impedance and a low output impedance.
Combine signals from two rotary incremental encoders to one output There is some device controlled by (optical) rotary incremental encoder (which gives quadrature output - two channels with square shaped pulses and shifted between each other). I want to add another encoder, which will work in "parallel" with first one - thus will be possible to control device with any of them. So I need to combine two rotary encoders to one quadrature output. How I am gonna do that? <Q> What you're going to have to do is decode both of them into step and direction bits, combine those, and then regenerate the quadrature outputs. <S> The first part can be done with a couple of flip flops and a couple of xor gates. <S> See http://www.fpga4fun.com/QuadratureDecoder.html . <S> Then you OR the step bits together and use a mux to select which direction bit to use. <S> Finally, use a simple state machine to generate a quadrature output from the step and direction signals. <A> If you want to use device A rather than device B (or device B rather than device A) then use a multiplexer and have a logic signal that decides which device is to be selected. <A> I do this all the time with my tool changer <S> and I have 5 incremental encoders wired to the one input on my controller card. <S> As the spindle enters the rack, it rotates the encoder nearest to the tool it is selecting. <A> It is possible to combine two rotary encoder inputs if they will never move simultaneously. <S> Conceptually, it's not even terribly difficult <S> : pass one rotary encoder signal through a couple of inverters so its signals are available in true and complement form. <S> Feed the other into the select inputs of a 2x4 multiplexer (e.g. a 74HC153), and drive its data inputs with various combinations of true and complement signals from the first: <S> * <S> If second is 00, mux outputs should be A0 and A1 <S> * <S> If second is 01, mux outputs should be ! <S> A1 and A0 <S> * <S> If second is 11, mux outputs should be ! <S> A0 and ! <S> A1 <S> * <S> If second is 10, mux outputs should be A1 and ! <S> A0 <S> Unfortunately, if one attempts this approach using just a 74HC153 and a couple of inverters, performance may be poor because a single-bit change on the second encoder input may cause both multiplexer outputs to glitch briefly before settling on the correct value. <S> This problem may be solved by adding a 6-input flop which is clocked faster than the encoders are going to change. <S> Two of the flop inputs should latch each encoder, and two should latch the multiplexer output.
Combining two rotary quadrature devices isn't possible - "joining" the outputs together with a mixer or logic is going to produce nonsense for a signal. Yes it IS possible and works perfect as long as one encoder is being read at a time.
I need to lock reading my mega328 flash but be able to write to the eeprom I need to be able to prevent other from copying my program placed in the flash, but want to still be able to write to the EEPROM. I tried the lock bits by setting them to Mode 3 (0x3C). But that will prevent me from writing to the EEPROM. Is there a way of prevent reading the flash while continue to allow writing to the EEPROM? <Q> REF: <S> https://electronics.stackexchange.com/a/53293 and especially: http://web.engr.oregonstate.edu/~traylor/ece473/lectures/fuses.pdf <S> implication:an enterprising individual should be able to use the programming ability implicit by LB1's enabled status to reset LB2 to 1 irregardless, by "clamping" (wire tapping) <S> the flashing data stream, (presumably over a USB cable) <S> the uploaded data can be seen (trivially and literally with an oscilloscope - a person "could read" RS232 data this way for low (<<75) <S> baud rates and is the visual analogue to the aural ability for using Morse code, where senders could even be identified by their "fist") if this uploaded data is therefore NOT decrypted before flashing then the internal boot loader must be modified to decrypt it, ... and if parts of the boot loader must be decrypted by a key encrypted in the flash upload data ... <S> a secret external key, password, starts the process above, so a "cold" chip is useless <S> otherwise this technique does not prevent copying but it does inhibit usability of the copy if nothing else, the obfuscation presents a challenge for not only the interloper but the authentic author too <A> No, there is not. <S> Consider adding an external I 2 C or SPI <S> EEPROM/flash if you need externally-writable space while having the on-board program flash be unreadable. <S> Not only will this solve your immediate problem, it can also give you much more space in which to store your data, either supplied or generated. <A> Here is how I solved it. <S> It might not work for everyone in my situation but that was good enough for my need. <S> Since I'm restricted by mode 3. <S> I decided to use mode3 <S> (prevent reading and writing for flash and eeprom). <S> Therefore I will be providing my program + the data to the customers in an encrypted file that can only be opened by my desktop application, which will decrypt it and deploy both the program and the data and lock them again to the chip. <S> The only draw back with this solution is the time it will take to upload to flash and EEPROM ( <S> ~40-45 seconds) while uploading to the EEPORM alone takes around 10 to 15 seconds. <S> On the other hand, this solution have an extra advantage of allowing the submission of any updates to my program within the same operation. <S> Thanks for everyone's suggestion. <S> I may try them in the future when I have time to experiment.
It may be possible to set a "Mode not 2" aka "Mode 1 xor 2", with LB1 as 1 and LB2 as 0.
What is the most efficient way to power a solar computer (5V) from a 12V lead acid battery? My project: Power a Beaglebone Black (BBB) entirely from solar energy. Obviously energy efficiency is crucial here. My setup so far: PV panel connected to a deep-cycle lead acid battery. Now I need to get from the battery's 12V to 5V (2A) for the BBB. Most similar projects suggest the use of a UBEC (Universal Battery Elimination Circuit), like this one . However, I am not sure if this is the right thing for me. The efficiency curve of a typical UBEC drops pretty badly for low currents. I expect the BBB to spent most of the time idle, i.e. draw around 150 mA, which means that efficiency would be pretty low. Is an UBEC the best solution or are there more efficient ways to supply 5V/2A(max) for my purpose? Since my soldering arts are rather limited, I would prefer a ready-made solution. <Q> In terms of efficiency, this is about as good as it will get. <S> The most efficient method of transforming the voltage from 12V to 5V is to use a buck converter as opposed to a linear regulator. <S> The UBEC is a buck converter. <S> For power levels in this range, an efficiency of over 90% is considered good. <S> An example of such an IC is https://www.fairchildsemi.com/ds/FA/FAN2001.pdf (however note that the input voltage on this IC only goes up to 5.5V) With synchronous rectification <S> , you can still achieve a good efficiency at low current levels (see page 5 in the pdf). <S> For 100mA you can still get well over 90% efficiency. <A> The output voltage is stable when you connect your beaglebone to the normal DC power supplies. <S> While the output of solar output need to be regulated by Maximum Power Point Tracking (MPPT) algorithms to keep stable. <S> Normal buck IC like UBEC <S> or FAN2002 do not provide MPPT capability. <S> As most solar converters aim to generate large power, there are rare ICs designed for portable power level applications. <S> But there does exist some, such as LT3652 from Linear. <S> And due to the same reason, a simplified version of MPPT algos is used here which resulted lower MPPT efficiency compared large power counterparts. <S> It claims: <S> When powered by a solar panel, the LT3652 implements MPPT operation by simply programming the minimum input voltage level to that panel’s peak power voltage, VMP. <S> The desired peak-power volt- age is programmed via a resistor divider. <S> The accurate efficiency hasn't stated, but I guess it should be around 80~90%. <S> This is already the state-of-the-art solution. <A> I don't know if your still looking for an answer, but here is a buck converter claiming up to 96% efficiency: http://dx.com/p/hzdz-adjustable-step-down-buck-module-blue-3a-280240#.UxGbJ_ldWSo <S> It would be a good idea to contact them for a data sheet. <S> Or this one: <S> http://dx.com/p/dc-4-5-35v-to-1-25-30v-adjustable-voltage-step-down-module-red-156808#.UxGblPldWSo <S> Both are only a few dollars!
If you were willing to search around for a custom buck controller IC and do some PCB design, you could potentially eke out up to 96% by selecting an IC that includes a technology called synchronous rectification.
What is voltage gain of a transistor amplifier and how is it affected by frequency? I'm actually concerned about the frequency response of a bipolar transistor. I searched online for an answer to this question but there was not a simple answer for a high school student to understand. So I would like a simple answer. <Q> (Added much later) <S> Zeroth, a bipolar transistor is actually a very complex device, when it comes to the actual device physics. <S> Voltage across the emitter-base junction (base bias) determines the current into the emitter, which all goes into the base region. <S> The device construction determines how much of that current recombines in the base (and becomes base current) and how much continues on into the collector. <S> (The current "splits".) <S> The ratio of collector current to emitter current is called \$\alpha\$ <S> (alpha). <S> \$\alpha\$ <S> generally ranges somewhere between 0.95 and 0.995. <S> Usually, ratio of base current to collector current is more useful, as that's the DC current gain (\$\beta\$) <S> (beta) of the transistor. <S> A bit of algebra will show that \$\beta = \frac{\alpha}{(1 - \alpha)}\$ or, alternatively, \$\alpha= \frac{\beta}{(\beta + 1)}\$ <S> For example, \$\alpha <S> = 0.95\$ gives \$\beta = 19\$, and <S> \$\alpha = 0.99\$ gives \$\beta = 99\$. <S> First, a transistor is usually modeled as a current-controlled current source. <S> Voltage gain is a function of \$\beta\$ and the circuit values. <S> Current gain does vary with operating parameters. <S> The venerable 2N2222A specifies a minimum \$\beta\$ <S> of anywhere between 35 and 100. <S> At Vce = 10V <S> and Ic = 150 mA, the device advertises a minimum \$\beta\$ of 100, and a maximum of 300. <S> Second, to a first approximation, the transistor may be regarded as a fixed-gain device at frequencies from DC up to what might be called the "corner frequency". <S> The corner frequency is the gain-bandwidth product \$f_T\$ divided by transistor's \$\beta\$. <S> The venerable 2N2222A advertises a minimum \$f_T\$ of 300 MHz, measured at Vce = 20V, Ic = 20 mA, and f = 100 MHz. <S> With a minimum DC current gain of 100, the corner frequency will be at least (300 MHz)/100 = 3 MHz. <S> Below 3 MHz (or above, depending on the device and the operating conditions), the device has a fixed current gain. <S> For frequencies above 3 MHz, the gain rolls off. <S> At 30 MHz, you would expect a minimum current gain of 300 MHz / 30 MHz = <S> 10. <S> Your mileage WILL vary. <S> You design conservatively, and you test your circuit, ideally with several transistors. <S> This gets you started. <A> The Hybrid Pi Model might be your best bet at understanding the frequency response of a BJT. <S> But the most significant effect on the response will be the base emitter capacitance(C-pi), which will interact with r-pi to create a low pass filter which will cause the gain to decrease as frequency goes up. <S> Also, there is also other effects to take into account <S> but I think those would be out of the scope for a high school student. <A> From a very general perspective, the bandwidth limitation comes from the fact that any transistor will have a small capacitance between any of its terminals. <S> These capacitances can be either parasitic or intrinsic to the physics of how it works in the first place, so having some capacitance is unavoidable. <S> It turns out that capacitance looks like very small resistors at sufficiently high frequencies. <S> This means that the terminals will be shorted with each other at high frequencies, undermining the amplification properties of any given configuration. <A> As you are a high school student ,Voltage gain of an amplifier is ratio of amplified o/p voltage and given i/p voltage. <S> But there are many other parameters dependent on the voltage gain. <A> The bipolar transistors are current amplifiers. <S> The reason is that the base-emitter act exactly like a diode. <S> No matter if you use a low power transistor such as the 2N2222A or test with a large TO-220, you will find +0.7 volt on the base when the emitter is 0.0 volt (for NPN). <S> The input current flow from the base to the emitter. <S> The output current flow from the collector to the emitter. <S> It is fascinating to use a 1.5 volt battery in serie with a resistor (from 1 ohm to 1 K ohm) connected on the base and be able to dim a 120 Watt light bulb connected on the collector of the transistor (and the other wire of the light bulb connected to a high positive voltage). <S> You can find powerful transistors already mounted on good heat-sink inside any CRT tv - easy to find on garbage collecting day - everybody is replacing these CRT by flat screen tv now. <S> You get also a strong enough high voltage supply (often +30 Volt and +120 Volt) in these same discarded CRT tv. <S> I presume that the battery called "Vbb" in your schematic was representing the equivalent 0.7 volt source that is inside the transistor. <S> It is good engineering to represent a diode like if it was made of a switch (opening or closing depending on the polarity presented at the diode), a resistance (very small... less than 1 ohm) and a voltage source of 0.7 volt. <S> To avoid the nightmare of testing so many transistors until finding one with the correct gain, the standard approach consist in adding a small resistor on the emitter of the transistor to decrease the gain to a known value. <S> For example, suppose the transistor gain range from 35 to 100 like the 2N2222A mentioned above, you may choose the resistance value to get a gain of 10. <S> With that resistor, the gain will always be 10 for every circuit, no matter if the particular 2N2222A is really capable of 100 or only 35. <S> To compensate for the gain decreasing with frequency, the engineers often add a capacitor in parallel with that resistor which is added on the emitter pin of the transistor. <S> This high pass filter effectively acting as a short circuit when the frequency is high enough <A> For a transistor amplifier,the frequency response curve indicates, that the voltage gain is low at high and low frequencies and high in the middle frequency range...
The gain of transistor in datasheets is always given as a ratio of the input/output current.
What's the best shape and material for my Wi-Fi range booster dish? I want my wireless LAN to be available in an apartment that is 459 feet (140 m) across. I'm thinking about putting a router (bridge) that has an omnidirectional antenna on the roof of my apartment, somehow reflecting the signal from the antenna (making it directional) and pointing it (AS ACCURATELY AS POSSIBLE) at a Wi-Fi USB stick put on the roof of the other apartment. The stick would obviously be connected with a computer below with a USB cable and have some sort of means of reflecting the radio signal as well. I'm seriously thinking about using this http://www.garneczki.pl/media/img/products/kpbig_70cd79520389c4303cd639c80bf65f.jpg as a dish (yeah, I know, it's a ghetto project but I want it either cheap or not at all). Is it worth a shot? Is the half-spherical shape a good choice (mind you, I want the beam narrowly focused)? Is my project doomed to a failure? The diameter of the hi tech "dish" I'm planning on using is 7 inches (18 cm) and it's made of "stainless steel". Sorry if this is a stupid idea and I'm wasting your time. Just let me know why. Thank you. <Q> It's cheapiness make it worth the shot. <S> Hours of fun for little money. <S> Also the cantennas seem to work well: http://www.turnpoint.net/wireless/cantennahowto.html <S> Maybe, the stick signal is too weak. <S> There's also the problem of carry the USB signal from the roof to the apartment. <S> The maximum cable length for USB 2.0 <S> it's about 5 meters according the standard. <A> May as well have a look at the 802.11b Homebrew WiFi Antenna Shootout . <S> A waveguide made from a beef stew can was the winner and beat some commercial "range extender" antennas by 6dB! <A> The advantage here is that someone has already figured out all the dimensions making your job a lot easier. <S> To answer your question, the optimal shape of the dish is a parabola, but a sphere is a decent approximation. <S> When constructed properly, these antennas usually perform better than waveguide antennas. <S> However, to design one you either need a very expensive full wave simulator or even more expensive RF test equipment. <S> Also, the dish should be at least 5 wavelength in diameter to work well (which is about 65 cm) <S> By placing a reflector right behind your omni antenna you will change the impedance match on that antenna which may lead to even worse performance than before. <S> As to the options, I would either go with a can antenna from one of those sites or buy a cheap Yagi-Uda antenna on Ebay. <S> These antennas have a small wind cross section and have a relatively high gain (~12 dBi)
As others have pointed out, a waveguide antenna made from a metal or metal-lined can maybe your best bet.
Will this circuit suffer from Shoot-Through? and is there a quick fix? I'm considering a high-side, low-side driver using the DMG1016UDW COMPLEMENTARY PAIR ENHANCEMENT MODE MOSFET from diodes. The datasheet says The ON voltage is about 0.5V and ON the delays+rises is about 12ns, the off delays are around 27ns which might mean shoot-through is possible and could last about about 20ns (ignoring the rise time of the mcu signal). The datasheet indicates solenoid driver as an application. Is this not the right of driving it then? Or is shoot-through not an issue here? simulate this circuit – Schematic created using CircuitLab <Q> You would have to satisfy yourself that the power dissipaton in that 20ns, times the switching rate, is within acceptable limits; so that for instance it does not result in an unacceptable temperature rise in the FETs or exceed their max current ratings. <S> For a solenoid the switching rate is unlikely to be more than a few Hz. <S> If it is, then adding complexity to the design to overcome shoot-through is unnecessary (though it may still be desirable, if it affects battery life for example, or puts unacceptable current spikes on the supply rail). <S> However, anyone taking this power stage and re-using it for a fast switching PWM circuit had better watch out! <A> Shoot through will be an issue unless you use a proper driver to segregate the timings of the gate drives. <S> I would recommend you look at an LTC4444 <S> but this is for driving two N channel FETs not an N and a P - these seem harder to find but I have a feeling Linear tech would source one. <A> One limitation with that design is that while you may not have shoot-through while the pin is high or while it is low, there is no apparent way to set the pin so that both transistors are off. <S> A nicer design if you can afford a 0.7-volt drop is to use an NPN emitter follower on the high side and a PNP emitter follower on the low side. <S> Otherwise, if you have multiple circuits to be controlled via multiple CPU pins, I would suggest that using external logic is often the way to go.
If you are driving a solenoid you would probably only use one of the devices in the package and tie the other end of the solenoid to Vcc or ground, depending on using an N channel or P channel FET. As a solenoid driver, the duty cycle is likely to be so low that while shoot-through will happen, the effects might not be serious enough to worry about,(especially given the 3V supply shown).
What is the need for an inductor coil in a smps-buck converter? Here is the figure: All tutorials have an inductor in smsp-buck. But when I simulate without an inductor I see a similar plot. Why not use only a capacitor? <Q> The LC Combination as in the figure in question is a Low Pass filter. <S> Also, the inductor stores energy, so that once SW1 open up, then Inductor should store enough energy to flow a current through the diode(freewheeling). <S> If you removed the inductor, then the diode will be reverse biased, and nothing will happen. <S> Capacitor will just discharge to output. <A> A buck converter changes a high input voltage to a lower output voltage. <S> It does it with a certain amount of grace and the result is fairly good with medium levels of ripple on the output voltage that are related to the switching frequency. <S> Without an inductor switch SW1 connects the input voltage to the output voltage and pushes a theoretically infinite amount of current into C1. <S> I don't need to say anything else because to do so would be insulting. <S> You also ask, in a comment "Why not to use a capacitor in series instead". <S> The buck convertor passes DC current (with some ripple) through to an output load. <S> A capacitor in series will become charged to the line voltage and any further attempts to push DC through it will fail. <A> How is the current through a capacitor defined? <S> -- <S> > Ic= <S> C dUc/dt. <S> What does that equation tell you? <S> If the voltage across the capacitor changes in a short period of time (dt-->0) such as load changes or first time turning on the power supply, then Ic will be very big (a current spike). <S> The current however cannot change in an inductor rapidly: Ul= L dIl/dt. <S> The inductor prevents the current spike. <S> Now when the switch is closed, a magnetic field is built by inductor. <S> When the switch opens, there is no current flow through the inductor anymore. <S> Magnetic field will collapse. <S> A change in current will create a voltage spike. <S> How do we prevent this? <S> Since the polarity across the inductor changes, the diode will conduct providing a current path for the inductor.
The inductor in addition to the capacitor is needed to filter the high frequency component of the output.
Should I buffer my sensor before feeding it into an op amp or does the op amp buffer it for me I have a sensor which outputs 10mV pk-pk.. I want to amplify this with some non-inverting amplifiers but my question is: Do I need to buffer the signal before I feed it into an op amp with gain, or does the gain op amp do the buffering as well? <Q> Stay close to DC and this is a question of output impedance of your sensor. <S> If you use a simple inverting op-amp configuration like this, you will have R1 as load for your sensor output. <S> Suppose you have R1=1K/R2=10K and 100R output impedance of your sensor. <S> That would not give you 10x gain but more like 10/1.1 ~ 9x. <S> You can have a much higher impedance as "load" to your sensor by using a simple non-inverting configuration. <S> That may be what you want to do in cases where your sensor has a fairly high output impedance. <S> See more in this question: Mic preamp: Inverting or non-inverting op-amp configuration? <A> The answer depends on what your sensor puts out. <S> As indicated in the other answers... <S> If you need a very high input impedance you can look at a non inverting configuration. <S> The input impedance will be very high as its just the OpAmps input impedance. <S> An inverting OpAmp circuit has an input impedance equal to the input resistor. <S> R1 in Rolf's drawing. <S> You can set this value high <S> so it's probably going to work fine. <S> The key is that in normal configurations the negative input pin is a virtual ground, since it's held there by the output though R2. <S> This make the input look like R1 is tied to ground, so it's setting the impedance. <A> Check your sensor's and your opamp's datasheet: <S> The opamp's internal resistance should be much (suppose at least 10 times) higher than the sensor's internal resistance <S> The DC input current drawn by the opamp should not produce an untolerable constant error to your measurement.
I think you can answer the question simply by looking at the sensor output impedance (which may be expressed as some current/voltage at some load in the datasheet, but you get the idea).
How does a domestic appliance "know" how much current to draw? I have a small wall plug which takes 240V 50Hz AC from the mains, and can give me 500mA 5V DC. I suspect there is a transformer stepping the voltage down and a bridge rectifier converting the AC to DC. BUT... the amount of current which flows... how is it controlled? I know that if I plug in a 3KW heater, that the electrical cable gets quite warm from all the current flowing through it, but the cable on a phone charger does not. Is it to do with every mains socket being a parallel load? i.e. if everyone on the national grid unplugged every appliance at the same time, apart from my charger, would my charger explode? <Q> Electrical loads such as appliances have resistance . <S> That, together with Voltage determines the current they draw (see Ohms Law). <S> The current provided by a switch-mode power supply on the other hand is generally limited by its design. <S> Usually if you draw too much current, the voltage starts to sag. <S> Finally, if everyone unplugged their appliances at once, the voltage in the grid would want to go up, but the generation side will back off to keep it stable at the rated voltage. <S> I'm told stories about the 3pm Tea-Kettle hour in England which used to be a stressful time for the power authority as everyone in the country plugged in their kettles, the power authority folks needed to balance the demand by increasing power generation and keeping the voltage at the nominal rate. <A> Electricity is made of an invisible fluid, called charge . <S> There's a force that acts on these charges, called voltage . <S> If you want to understand how this invisible fluid works, simply think of a system where the fluid isn't invisible. <S> Pipes are filled with a fluid, called water . <S> There's a force that acts on this fluid, called pressure . <S> How does the sprinkler know how much water to squirt? <S> If all the sprinklers in the world were suddenly shut off, except yours, would your sprinkler explode? <A> \$ <S> V= <S> IR \$ is a good place to start answering your question, along with \$ P= <S> IV\$. <S> Every device has an impedance which defines the current it will draw when you put a voltage across it. <S> The voltage and current define the power it will use. <S> The appliance "knows" nothing; it's just a physical characteristic. <S> Keep in mind that a rated current or power does not define the current , but is often times the maximum current that the device will use. <S> It might mean the maximum you'd see when turning the device on (e.g. a motor, which is inductive in nature and will have a transient when turned on), or it might be continuous <S> (e.g. an electric blanket is just a resistor in a blanket, and resistors have no transient response). <A> Put simply the voltage(V) provided is fixed at 240V. <S> Your device has a particular resistance(R) <S> due to its design. <S> So the current it draws(I) can be found from Ohm's law: <S> V=IR
Above the rated current, the wires in your wall plug transformer overheat and burn (if a fuse is not present).
Bypassing Transistors with a Switch, problems? While working on a design last night, I had a question pop up. Is there any risk in bypassing a transistor, with a jumper/switch? Or shorting the Collector and Emitter pins with a wire? Is there a difference if the transistor is on or off? For example, the transistor will carry a 166 mA load, driven by a 8 mA base current ( through Appropriate Base Resistor, omitted in the schematic ) to put it into saturation. If I short the collector and emitter pins so the load bypasses the transistor (which means there is no load for the transistor), but still drive the base with that 8mA, Will it overheat or die, or will it simply pass the base current without issue? simulate this circuit – Schematic created using CircuitLab The switch might be momentary, or it could be left on for hours, if that makes a difference. Slightly related, would a Mosfet bypassed the same way also have any issues? <Q> The current into the base is likely to be partly shared by the collector when shorted but this should not cause an issue. <S> Ditto source and drain on a mosfet. <A> If you add base resistors to both transistors, there is no risk in bypassing the transistors in your diagram. <S> You basically turn the transistor in a diode and you have to limit the base current / GPIO-pin current from your microcontroller as the base-emitter voltage will be about 0.7V. <S> You must use base resistors anyway, even without the bypassing circuit. <A> Base current is irrelevant to the collector current (the reverse is false though) <S> Anything entering base will have to exit somewhere, and that's the emitter even when no current is passing through collector (shorted in this case)
Shorting collector to emitter causes no problem in either circuit.
Measuring current drawn on a 12V barrel plug I would like to replace my monitor power supply it's 12V 3A and I doubt it's actually necessary -- old LCDs were pulling that current and this is not CCFL but LED. So I would like to measure the current drawn. The supply and the monitor is using a simple 5.5mm / 2.5mm plug, central positive. I would like to not damage anything in the process :) OK, so presuming I have an extension cord (I do) I am ready to throw away, I guess I need to cut the cable -- does it matter which conductor? Just cut one of the conductors and touch the tips to the cut sections and done? Wrap perhaps the conductor around the tip for better contact. Edit: so it seems my motivation matters and it got lost in the comments. A 3A adapter means it's an adapter with a separate AC cable. That's not particularly helpful for travel, especially not when even my Lenovo laptop 65W charger is now available in a small wall wart format (FSP Twinkle btw). 12V 1-2A very small wall warts are readily available. I have yet to something in a similar small format for 12 3A. I am not sure why but such a thing is unavailable AFAIK. I don't want to haul around AC cables. And yes, hacking a very small 12V 3A adapter with a fixed IEC C7-Nema 1 plug is a possibility but what about not hacking? :) <Q> Yes, your description is correct. <S> cut one conductor of the disposable 12V power cord. <S> NOT THE 110V or 230V CORD! <S> strip the insulation from the cut ends set the multimeter to it's amps range (typically 10A) connect the multimeter's probe leads to the COM and A terminals on the multimeter. <S> plug in the power supply to the wall outlet place the probes on the cut ends, making contact with the copper conductor <S> the multimeter will show the current measure current under a variety of conditions, startup, normal, full brightness, etc. <S> crocodile/alligator clips make this easier From Fluke 77 Series IV User's manual, 2006, Page 8 & 2. <S> - This meter meets CAT III and CAT IV IEC 61010 standards <A> The main trick with current measurements is that they need to made with your meter in series. <S> You've mentioned an extension cable, but I guess you mean an AC one? <S> For safety reasons and because the efficiency of the existing adapter will be unknown what you'll want to measure is the DC current. <S> Regardless of whether you make a DC extension cable for the barrel connectors or cut the positive lead and later rejoin the setup should look like this: simulate this circuit – <S> Schematic created using CircuitLab <S> For the meter you'll want to set it for the maximum current range (10A on most meters) and also be aware that for most taking current measurements it involves inserting the positive test lead into a seperate socket on the meter. <S> Put the negative lead towards the adapter output for a positive reading, although for a digital multimeter it'll just show a negative current and not do any harm regardless of the direction. <S> Also note that as Anindo Ghosh mentioned in a comment a lot of devices have an inrush current when starting. <S> so see if your's supports that. <A> Surely you have a kill-a-watt meter to hand? <S> Measure the Watts drawn on the AC side, first with the monitor unplugged, then with the monitor plugged in. <S> Take a guess at your PSU's efficiency, based on how hot it gets (hopefully at least 75% if made in the last 5-6 years), and then you can take a good guess at how much current the device is consuming. <S> Obviously this isn't 100%, but it will probably be good enough to give you a go/no-go regarding a 1A psu.
That could be challenging to measure with a cheap meter although many better meters are capable of taking a maximum reading, so check your meter's documentation
Looking for test leads for individual PCB header pins or socket pins While recently debugging a device that had a 7-pin male XLR plug, I was trying to connect to two of the pins in the plug, without touching any of the others, and I wondered if there are test leads that can be used for such debugging: essentially just slim metal cylinders that can be slipped over each pin, without touching surrounding pins, and wired to a lead. The same question arose when I was testing a 10-way header on a PCB: how to connect to, say, pins 3 and 7 only, without touching any of the others. In that case I had a 10-way socket, which I used for debugging, but it would have been very useful to have had two, slim cylindrical test leads, to slip over the two pins in question.[Before anyone says so, I have looked on electronics supplier sites (we use oneCall, and I also checked RS): the trouble there is knowing how to phrase the online query correctly... so far I've drawn a blank.] <Q> For experimental purposes, bare crimp type contacts for comparable diameter posts can be used individually, covered in heat shrink tubing rather than inserted into their usual housings, provided that they are the style where the contact surrounds the post sufficiently to grab it, rather than needing the plastic housing to hold the post against a single sided contact. <S> There are now import/discount suppliers selling ribbon cable terminated in plastic molded single male or female .100" spacing .025" post contacts, with the idea that you can manually separate the ribbon as desired, however quality/reliability seems variable, so you'll want to test any setup with those for integrity before assuming your problem is more complicated than a failed connection. <A> For this purpose i soldered my own jumperwire. <S> it's pretty straight forward. <S> This is what you need: 22 to 23 gauge wire (male connectors for breadboards or similar) something similar to an IDE socket (tear apart for female connectors) heat shrink tubing (i used 1mm diameter shrinked) flexible wire for soldering <S> put heat shrink tubing on the solder and debug with them. <S> used them for a bit now and didn't have problems yet <S> Here is the original article that describes the process. <S> it's in german though <A> While there might be a connector specific method, the simplest way is make you own. <S> Get a 7 pin XLR female cable, cut it in half, and add some alligator clips to it.
Depending on the type of jumperwires you need just solder everything together. In a situation where failure or accidental shorts would not have lasting consequences, I've also been able to crudely break out an XLR using small alligator clip leads in order to take some quick measurements.
Output changing electrical currents from a PC I need to send fast-changing electrical current from a computer to electrodes connected to muscle (Not the point). I need to send multiple different currents simultaneously, and that the current could be changed on command from the PC. I don't need something like an Arduino, I need the component IN the Arduino that allows this. The main problem is that I need the change to be fast, less then a second. I don't know many of the technical terms so I might have missed a similar question. <Q> Use a microcontroller to control a current source or sink, and have that communicate to the PC. <S> UART communication will be easiest at the micro. <S> This doesn't sound like a product, so that is probably good enough. <S> The micro can easily respond to commands from the PC and change the output of a current sink or source in well under a second. <S> That is actually quite a lon time. <A> Noting the 1st two comments under your question, and advising you to heed them, I would use the sound card output and a suitable analogue buffer/amplifier circuit if required. <S> Most PC's have 5.1 or 7.1 outputs these days, which is plenty of channels. <S> HOWEVER, you really MUST understand a LOT more about what you're doing before you start electrocuting yourself or anyone else. <A> You can use (If you have it) <S> the parallel port directly to a DAC (digital to analog convertor), and you can access to the parallel port using the port address. <S> The only problem is that the ports are blocked by windows, so you have to download a special program to unlock it. <S> Note: the parallel port is not protectec against shortcuts, so be carefull <S> you don't damage the board. <S> Hope I could help you.
If your PC doesn't have a serial port, you can use a USB to serial adapter.
Interfacing VC0706 with AVR Microcontroller I am having trouble interfacing a VC0706 Camera with only an AVR Microcontroller. I am using simple serial communication but the camera does not respond. I tried connecting it with a computer but still no response from the camera. Moreover I am having difficulty in understanding the following: In What format will my image be stored in the MCU. Will ATMEGA32 be sufficient to store one image taken from the camera. <Q> Usualy, the connetion in serial problems are due to difference in speed communication, CRC, odd or even parity, etc. <S> So check if the configuration are the same. <S> No, I don't think you can store one image in the SRAM of the microcontroler. <S> If the image resolution is 640x480, then you will need at least 640*480=307200=307kb to store a black and white image. <S> It is larger than the SRAM of the microcontroler (2kb). <S> I is also a large memory for a single microcontroler, then you'll need to add an external RAM, as large as the microcontroller's pins allow addressing. <S> Hope I could help you. <A> SPI/UART interfaces are only for controlling VC0706 . <S> The block diagram says it is not having internal image sensor, you should interface an external image sensor to it again through CCIR656 interface or analog input to video decoder like ADV7184 and then digital input video to it's inputs.. <A> The image will be streamed over serial to your MCU as a JPEG image. <S> And an ATmega32 (like the ATmega328p in the Arduino) only has 2K of SRAM, nowhere near enough to hold even a QQVGA (160x120) image. <S> With some savvy coding you might be able to decode the image on the fly if you are looking just for specific pixels, but since JPEGs are stored in "ZigZag" order it will be tricky. <S> Most people just stream the image directly to SD and don't analyze the image. <S> Cameras such as the OV7670 are better suited to direct access by the microcontroller, but the image will still be too large to store in memory. <S> Even an ATmega1284p which has a whopping 16K of SRAM could only hold a QQQVGA (80x60 565RGB) image. <S> If you are looking to process images in memory, I would recommend looking at beefier microcontrollers, like the xmega384 (32K), the pic32 (up to 128K), or ARM microcontrollers (up to 262K IIRC). <S> One option to consider is the Arduino Due which has an ARM Cortex-M3 MCU and 96K of ram which is enough for a 320x240 greyscale (or indexed color) image.
You should read digital video from CCIR656 output channel(8/16 databits, 1/2 frame syncs, pixel clock etc), you can convert to analog video using any video encoder like ADV7171.
Is it possible to add up DC DC converters in series to create 36V output from 5V input? I am trying to step up my voltage from 5 volts to 36 volts. The only way that I am seeing this is to have a DC DC Converter. I am planning to use a DC converter which steps up 5 volts to 12 volts each and by using three of them and then later on connecting them in series assuming the voltage would add up. Would this be possible? DC/DC converter, semi reg, 3W 12V specifications: DC / DC Converter Type: Isolated POL DC / DC Converter Output Type: Fixed Input Voltage DC Max: 5V No. of Outputs: 1 Output Voltage Nom.: 12V Output Current Max: 250mA Output Power Max: 3W Depth: 19.5mm Width: 7.2mm Height: 10mm Isolation Voltage: 1kV Output Current: 250mA Output Voltage: 12V Power Rating: 3W SVHC: No SVHC (19-Dec-2012) Supply Voltage: 5V <Q> In an isolated converter there is no ohmic connection (no d.c. <S> current path) from the output to the input. <S> If you try this with non-isolated converters you will probably destroy them. <S> I can't say whether your plan is the best way to get 36V from 5V. <S> I suspect you would get better efficiency from a single converter <S> but I don't have a particular part to recommend. <A> Here, I found 21 boost regulators that will do what you need . <S> One that looks pretty good is the LT3759 (the output can go much higher than the 12V shown in this example) <A> I've done this on a product before... <S> although that was adding multiple isolated 30V supplies to get 60V. <S> The datasheet of the modules also explicitly shows it to be safe to do so. <S> You can't get 36V more directly? <S> I'm assuming you're talking about powering the supplies all in parallel, and tying the isolated outputs together in series. <S> I would at a minimum do appropriately sized diodes across the outputs of each supply to make sure that if one supply is off or slower to come up than the others then you don't get -24V across <S> it's outputs. <S> A unipolar filter cap wouldn't like that too much. <S> Even with diodes there will be a reverse leakage current that I'm a bit nervous about (although it probably doesn't matter... ?). <S> I'd recommend trying to find a more direct solution, and if that fails to look for isolated supplies that explicitly allow for adding the outputs in series (probably with said diodes). <A> Yes its possible and others have covered that .People ask why would you do this ? <S> on the face of it you wouldnt because the boost ratio is well within the realms of available SMPS technology as sbell has shown. <S> There is in fact a gross EMC advantage of doing what you propose because the peak switching volts inside each convertor is lower ,this means that you will get less RF voltage between input and output terminals .In <S> your example it could mean almost 10dB on a radiated plot .Now <S> do you really need to have a galvanicly isolated output .Isolated <S> DCDC convertors are more expensive and less efficient and larger than thier non isolated counterparts. <A> Look at the datasheet's Absolute Maximum Ratings. <S> I guess it should have input voltage like Vin= VCC+ n% ( which n may be a small number, in your example Vin Max may be around 12 volts). <S> When you convert with first one you are feeding 5v into the converter. <S> for the second one , input is 12v, and for the third one is 24 volts. <S> My guess is the second one gets hot and the third one burns! <S> By all, it was better to mention your part number to check all of these.
This is possible only if the DC/DC converters are of the isolated kind.
Difference between blocking and nonblocking assignment Verilog I was reading this page http://www.asic-world.com/verilog/verilog_one_day3.html when I came across the following: We normally have to reset flip-flops, thus every time the clock makes the transition from 0 to 1 (posedge), we check if reset is asserted (synchronous reset), then we go on with normal logic. If we look closely we see that in the case of combinational logic we had "=" for assignment, and for the sequential block we had the "<=" operator. Well, "=" is blocking assignment and "<=" is nonblocking assignment. "=" executes code sequentially inside a begin / end, whereas nonblocking "<=" executes in parallel. I was fairly sure that nonblocking assignments were sequential while blocking assignments were parallel. After all, you can make blocking assignments with assign statements outside of always blocks, and those all run in parallel. Is this a mistake, or is the behavior different inside an always block? And, if the behavior IS different inside an always block, can nonblocking assignments be made outside an always block? <Q> was fairly sure that nonblocking assignments were sequential while blocking assignments were parallel. <S> Blocking assignment executes "in series" because a blocking assignment blocks execution of the next statement until it completes. <S> Therefore the results of the next statement may depend on the first one being completed. <S> Non-blocking assignment executes in parallel because it describes assignments that all occur at the same time. <S> The result of a statement on the 2nd line will not depend on the results of the statement on the 1st line. <S> Instead, the 2nd line will execute as if the 1st line had not happened yet. <A> Assign statements are neither "blocking" or "nonblocking", they are "continuous". <S> The output of an assign statement is always equal to the specified function of it's inputs. <S> "blocking" and "nonblocking" assignments only exist within always blocks. <S> A nonblocking assignment takes place at the end of processing the current "time delta". <S> always blocks can be used to model either combinatorial or sequential logic (systemverilog has always_comb and always_ff to make this explicit). <S> When modeling combinatorial logic it's usually more efficient to use = <S> but it typically doesn't really matter. <S> When modelling sequential logic (e.g. always @(posedge clk) ) you normally use nonblocking assingments. <S> This allows you to deterime the "state after the clock edge" in terms of "the state before the clock edge". <S> It is sometimes useful to use blocking assignments in sequential always blocks as "variables". <S> If you do this then there are two key rules to bear in mind. <S> Do not access a reg that is set with blocking assignments inside a sequential always block from outside the always block it is assigned in. <S> Do not mix blocking and nonblocking assignments to the same reg. <S> Breaking these rules is likely to result in synthesis failures and/or behaviour differences between simulation and synthesis. <A> The term Blocking assignment confuses people because the word blocking would seem to suggest time-sequential logic. <S> But in synthesized logic it does not mean this , because everything operates in parallel . <S> Perhaps a less confusing term would be immediate assignment , which would still differentiate the intermediate results of combinational logic from the inputs to non-transparent memory elements (for example clocked registers), which can have delayed assignment . <S> From a legalistic standpoint, it all works out very nicely. <S> You can, in fact, consider <S> the = to be a blocking (time-sequential) operation even within always_comb sequences. <S> However, the distinction between time-sequential and parallel makes absolutely no difference in this case because the always_comb block is defined to repeat until the instruction sequence converges on a stable state -- which is exactly what the hardware circuitry will do (if it meets the timing requirements). <S> The synthesizable subset of Verilog (and especially SystemVerilog) is extremely simple and easy to use -- once you know the necessary idioms. <S> You just have to get past the clever use of terminology associated with the so-called behavioral elements in the language.
A blocking assignment takes affect immediately it is processed.
Will a 6 volt LED kill a 9 volt battery quickly? I am building a little circuit and I am adding a little 6 volt LED to tell me when I have power going through. But my power source is a little 9 volt battery, will this LED kill this battery quickly? I want it to last, will I be okay? <Q> The 6-Volt Minature Lamp <S> you've linked from Radio Shack <S> isn't a LED <S> , it's a small incandescent light bulb . <S> It lists the current draw as 25mA and a 9V PP3 alkaline battery normally has a capacity of around 500mAh <S> so I'd expect it to last <S> around 500 / 25 = 20 hours. <S> It will be less for cheaper zinc carbon batteries. <S> The other issue is that it's a 6V bulb so driving it from 9V isn't recommend and ways of dropping voltage (called a voltage regulator) tend to either be inefficient or a bit on the complex side for something like this. <S> You'd probably be better finding a LED and suitable current limit resistor. <S> A LED will probably be bright enough at 5mA <S> so last five times longer. <A> I don't think the part linked is an LED, but it does specify 6V @ 25mA nominal. <S> Looking at some rough 9V battery capacities , let's say the battery has about 565 mAh. <S> Suppose we designed some smart circuitry which magically converted the 9V to 6V and was 100% efficient. <S> The power draw is then 6V*0.025A = 0.15W. <S> Assuming the battery is at 9V until it dies, it has a total energy capacity of 565mAh * 9V = 5.355 W*hr. <S> This is most likely a gross over-estimate, but we're just getting a rough estimate on the upper bound so this is ok. <S> Dividing the battery energy density by the power draw gives us a rough upper-bound on how long the battery will last: 35.7 hrs of continuous use. <S> Depending on your application this may be good enough or way too short. <S> Now suppose we go the opposite direction and use a simple resistor current limiter. <S> That means we only get to divide the current capacity of the battery by the current draw of the lamp: 565 mAh/25mA = 22.6 hrs of continuous use. <S> Again, this may be good enough, or way too short depending on your application. <S> Also, just because the bulb is rated at 25mA nominal doesn't mean you can't run it with a lower current. <S> This will give you increased battery life and a dimmer light. <A> The specs you gave are so unusual, that it must either be a lamp or a led with an integrated current-limiting resistor for 6V. To use it, the easiest option is to add another 120 Ohm resistor to create a 3V drop at the nominal 25 mA. EDIT: <S> Depending on your choice of 9V battery, expect that this light source alone will deplete it on a timescale from several hours (old NiCd rechargeables with maybe 80 to 120 mAh) to possibly nearly ten times that much for the most powerful primary batteries.
If you directly connect the two, it may quickly age (possibly destroy) your led/lamp, and draw slightly more current from your battery than was intended by the light source's designer.
What does common mode voltage stand for in an instrumentation amplifier? I was reading a text about instrumentation amplifiers. I couldn't find any easy explanation what really common mode voltage means and its importance. <Q> An instrumentation amplifier is set up as a difference amplifier, so it measures the difference between these two inputs and so rejects any voltage that is common to the two. <S> In other words, if you have two signals v1(t) and v2(t) on the two inputs: v1(t) = f1(t) + Vcm(t) v2(t) = f2(t) + Vcm(t) <S> what the instrumentation amp will measure is: vo(t) = <S> v1(t) - v2(t) = (f1(t) + Vcm(t)) - <S> (f2(t) + Vcm(t)) <S> = <S> f1(t <S> ) - f2(t) Note that Vcm(t) (the common mode voltage that appears in both input signals) is cancelled out. <S> Also note that this doesn't have to be a DC signal, but can vary with time. <S> Now why do we care about common mode voltage when selecting a difference amplifier? <S> As other folks have said, there are two key characteristics of the amplifier to consider, the common-mode rejection ratio (CMRR) and the common mode range. <S> The CMRR is important because the instrumentation amplifier is not an ideal difference amplifier. <S> An ideal difference amplifier would reject 100% of the common mode voltage in the input signals, and would only measure the difference between the two signals. <S> In a real-world instrument amp, this is not the case, and there is a measurable (although typically very very small) amount of the common-mode voltage on the input that gets into the output. <S> The common-mode range is important, because it limits how far away from ground the measured input signals can be. <S> This is a limit because typically you can't measure signals outside the supply voltages (often referred to as "rails) of the amplifier. <S> There are exceptions to this, but in general the voltage of each input signal must remain within the supply rails of the amplifier. <S> So if you are supplying your amplifier with rails of +/-12V, you may be unable to measure the difference between two signals with a common-mode offset of 15V, even if the difference between the two signals is only 20mV. <S> For example, if your two signals are completely DC and are: V1 = 15 + 0.010 <S> V2 = 15 - 0.010 <S> Vo = <S> V1 - V2 = 0.020 <S> You would not be able to measure these if your instrumentation amplifier had a common-mode range of +/-12V. <A> Say a circuit has two inputs, \$v_1(t)\$ and \$v_2(t)\$, we can mathematically decompose this into a common-mode and differential part , making the two circuits below equivalent: simulate this circuit – <S> Schematic created using CircuitLab <S> For these circuits to be equivalent, we need to have \$V_{cm} <S> = \frac{V_1+V_2}{2}\$ <S> \$V_d = <S> V_1 - V_2\$. <S> And we call \$V_{cm}\$ the common mode voltage , and we call \$V_d\$ the differential voltage. <S> Why is it important? <S> When talking about instrumentation amps we prefer to express the input in terms of common mode and differential because in-amps are designed to have high gain for differential signals and ideally no response to common-mode signals. <S> That is <S> \$V_{o-d} = <S> A V_{i-d}\$ <S> where \$V_{o-d}\$ is the differential signal at the output, \$V_{i-d}\$ is the differential signal at the input, and A is the gain of the amplifier. <S> and \$V_{o-cm} = <S> V\$ <S> where V is some voltage not related to the inputs. <A> common mode voltage is nothing but the offset @ which <S> the diff signal is travelling above a common reference i.e. Ground. <S> So, CM voltage has significance from op amp's operation point of view <S> but it doesn't make any impact on the diff signal being interpreted @ the receiver because receiver just measures the difference between the two signals.
The common mode voltage is a voltage offset that is "common" to both the inverting and noninverting (i.e. "+" and "-") inputs of the instrumentation amp.
Resistor on anode or cathode? Some Arduino starter-kit projects show the resistor placed before the anode of a LED, coming from output, and others show it after the cathode, going to the ground. Is there any difference? Why? <Q> There's no difference. <S> One of the basic principles of electric current is that the same current flows through all elements that are arranged in series. <S> simulate this circuit – <S> Schematic created using CircuitLab <S> The purpose of the resistor is to limit the current, it doesn't matter in which part of the circuit it is located. <S> In the case of throwies , the internal resistance of the coin-cell battery is used as a current limiting resistor. <S> simulate this circuit <A> Usually as RedGrittyBrick said it doesn't matter. <S> However, there are designs for driving <S> LED's using transistors where choosing where you place your resistor does matter. <S> For example, sometimes people will use a BJT transistor to allow for higher current drives through the LED because micro controller pins are limited to low current outputs. <S> By cleverly placing the resistor it can serve multiple functions at the same time, thus allowing you to reduce the part count and save some money/space. <S> simulate this circuit – <S> Schematic created using CircuitLab <S> In the above schematic we are using the resistor R1 to both limit current flowing through the LED as well as limiting the base current (current from MCU output to R1). <S> If we instead moved R1 above Q1 or even above D1, we would have to add an additional resistor between MCU output and Q1 to limit the base current. <S> This is an extra part we would have to have in our design meaning extra cost and space. <S> It's unclear from the original question if the kit/tutorials you're using have this type of LED driving circuit. <S> It's not unreasonable because a typical small LED's current is below the limit of being safe to drive directly from the MCU, but is slightly worry-some if you have a lot of other stuff going on. <S> Just be aware that sometimes the arrangement of parts does matter, and other times it doesn't. <S> Is the cost significant? <S> It really depends. <S> Resistors are really cheap (unless you have super high requirements), and a resistor generally doesn't take up a lot of space. <S> It also gives you better control over the two different currents, but it isn't free. <A> Whether it is connected to anode or to cathode it doesn't make any difference. <S> Resistor is just connected in ' series with the LED '.
No there is not any difference usually a resistor is connected in series with the LED to limit the current. You have non-reactive components (ideally, which is pretty close to reality) thus any current flowing into the diode/resistor must flow out, thus current would be limited equally well by having the resistor on either the anode or cathode side.
What is wrong with this simple SMPS? I've been reading up on power electronics lately and as a challenge (and also a learning exercise), designed my first switching power supply - a buck converter in this case. It is intended to supply 3.5-4.0V (decided by diode reference source) and up to 3A in order to drive some power LEDs with any DC source, ranging from a 5V USB charger up to a 9V PP3 battery. I want an efficient supply, as heating and battery life will be a real issue (otherwise I'd be lazy and use a 7805+diode). NOTE: I already noticed that I've got the switching logic the wrong way round, I need to either swap the connections into the comparator or use !Q to drive the MOSFETs. My choice of MOSFETs instead of BJTs was due to the power losses in a BJT, and the thermal issues arising. Is this decision to use MOSFETs over BJTs/IGBTs due to improved efficiency the right call? Rather than using a PWM chip as many hobbyist forums suggest, I decided to use a comparator/clock/latch combination to rapidly switch between "charging" and "discharging". Is there any particular disadvantage of this approach? The CMOS latch (a D-flip flop) copies data to the outputs on the rising edge of pulses from the clock generator (a CMOS Schmitt inverter + feedback). The choice of time constants / corner frequencies for the clock and the buck lowpass (10-100kHz and 10Hz respectively) is intended to support the small ripple approximation while also allowing the output capacitor to charge in a reasonable amount of time from power-on. Is this the right set of considerations for deciding the values of these components? Additionally, how would I go about calculating the value of the inductor? I would assume that it depends upon the typical output current and the lowpass capacitor's value, but I can't quite figure out how. [edit:] In the past, I've used the shown MOSFET pair (in addition to software PWM) to create H-bridges for bi-directional, variable speed motor control - and as long as I kept the PWM period much larger than the MOSFET switching time, the power waste from shorting during switching was negligible. In this case though, I'm going to replace the N-mosfet with a Schottky diode since I've never used a Schottky diode before and want to see how they behave. I use a simple inverter+RC combo to provide the clock signal as I don't need a particularly consistent or precise frequency as long as it is considerably higher than the high-cut corner frequency of the buck-boost. [edit II:] I built it on a breadboard and to my surprise, it worked straight away without any issues, and at ~92% efficiency (compared to the 94% that I'd calculated from switching/component losses). Note that I omitted the resistor in the output stage, out of laziness - also I can't quite recall why I put it there in the first place. I omitted the reverse diode parallel to the P-MOSFET, and also used a 1N5817 Schottky diode (note: 1A rating) in place of the N-MOSFET. It doesn't heat enough for my fingertips to notice. I've ordered a higher-rated diode though for when I assemble the final unit, which will run with full load. I accidentally blew the LM393 comparator during testing, but an LM358AN took its place straight away without any issues. As I can't find any decent circuit design+layout/routing software that will run on Arch Linux x64 (or even install, in the case of native Linux software), I've manually layed it out so it probably won't work by the time it's soldered... But that just adds to the "fun" I guess! Component values used: Clock gen { 1kR, 100nF }; Buck output { 330uH, 47uF }; Input capacitor [not shown] { 47uF }; P-MOSFET { STP80PF55 }; N-MOSFET { Schottky diode instead, 1N5817 - to be replaced with >=3A version }; ICs { 40106 NXP, 4013 NXP, LM358AN } <Q> As a rule, this moment is short and will not burn the MOSFETs, but the efficiency will be affected and there will be high surges in the power source. <S> Replace the lower MOSFET with Schottky diode in reverse. <S> Yes, using a MOSFET can increase the efficiency, but then the schematic needs special driver that to make dead time between switching transistors ON. <A> Yes, there are stability issues and a brief moment when both FETs are on but the beauty of using a FET on the pull-down part of the circuit (i.e. a synchronous buck converter) <S> instead of a schottky diode is this: - Whatever duty cycle your PWM is the output voltage stays constant as a fraction of input voltage - you are in effect using the L and C on the output as a low pass filter to a square wave input. <S> Whatever load you have connected, providing the FETs are lowish on resistance, within reason you don't need to change the PWM mark-space ratio. <S> It will be more efficient on heavier loads than a non-synchronous buck regulator but the down-side <S> is that on light loads it will be less efficient because you need current to drive the N channel FET because of gate capacitance. <S> I'd also advocate building a 555 timer sawtooth generator as the basis of your system. <S> Something like this: - I'd then feed it into a fast comparator and then the use the comparator output to drive the two FETs. <S> The two FETs can be "time segregated" with a small RC time delay on the output of the comparator - the undelayed output and the delayed output would feed an AND gate for one of the gate drives and the the same for the other gate drive but using a NOR gate. <S> Plan on maybe 50ns time delay introduced. <S> What you get is a half-decent synchronous buck convertor that just needs an input to the other comparator input to get the required duty cycle changes. <S> OK so far? <S> Then you can apply a simple control loop that lowers the 2nd input to the comparator as the input voltage gets bigger. <S> Get this working and then apply another small control loop that actually regulates the PWM with load current changes a tad <S> and this would probably work and <S> no negative feedback involved. <S> Then, as the final touch, and with care and subtlety apply an overall control loop to keep the output better stabilized but remember, with a sync buck you can pretty much get half-decent stable performance without control loops that use negative feedback - if you are wanting to go this approach I can recommend it. <S> However, for me, I'd just call on Linear Technology and get the device that already does the job. <A> I use to calculate smps at http://schmidt-walter.eit.h-da.de/smps_e/smps_e.html <S> I already designed flyback as well as buck converters for LED lighting using this website, and it was every time the best solution. <S> You find there the dimension for the coil you need (core & winding). <A> I think a better approach to generating the PWM signal is to actually build a proper control loop. <S> It's not clear to me that your circuit will actually stabilize where you want it to. <S> What you should do is build a simple P or PI controller. <S> Take your output voltage and your reference voltage and put them through a differential amplifier to get an error voltage. <S> Then run this through a potentiometer so you can adjust the gain. <S> If you want to make it more accurate, run it through another pot, an integrator, and then put both of these into a summing amplifier. <S> This will give you an output that is proportional to the error and to the integral of the error, with adjustable gains. <S> Then you run this to one input of a comparator. <S> The other input of the comparator would be triangle wave from a relaxation oscillator. <S> The output of the comparator would drive the MOSFETS, possibly with a MOSFET driver and perhaps some additional logic to prevent shoot through. <S> You'll have to play around with the potentiometer settings to get the best result.
The main problem with this schematic is that there will be a moment during switching when both MOSFETS will be conducting current and then will short the power source.
Is input impedance of an opamp independent from its input's frequency components? If input impedance of an op-amp is infinite (theoretically), does frequency of an input signal have any effect on input impedance of the op-amp? <Q> The frequency won't affect the capacitance but the amplitude of the voltage may cause this capacitance to change slightly on some devices. <S> See varactor diodes and miller capacitance changes with applied voltages. <A> Theoretically, or more precisely, ideally , the answer is no. <S> If $$Z_{in}(\omega) \rightarrow <S> \infty$$ <S> for an ideal op-amp, then there is zero input current for <S> any input voltage of any frequency. <S> But, this isn't surprising or, for that matter, very interesting. <S> Ideal op-amps are an abstraction <S> that, in the appropriate context, are a good approximation to physically realizable op-amps. <S> In other words, for real op-amps, the input impedance is finite (though relatively large) and varies with frequency. <A> You just said the input impedance is infinite. <S> If it is always infinite, then obviously it it doesn't vary with frequency. <S> This question makes no sense.
If something has an infinite impedance then any frequency cannot affect it however, it's never going to be infinite and as frequency rises the small amount of capacitance associated with the input will start to become significant even if the input resistance stays in the Giga ohm range.
Is RMS value of a pulse wave practically useful? As we know the mean value of a pulse wave (depending on its duty cycle) corresponds to a constant DC. But when it comes to alternating current through a resistor for DC power correspondance we measure the RMS value i.e. RMS of an alternating current becomes such as the current which lights a bulb as the same intensity as if we have a DC value of the same with that RMS. I measure pulse wave voltage with Voltmeter's DC settings. I think it gives the mean value. So my question is if we have a pulse wave does it make sense anymore to talk about its RMS value? <Q> So my question is if we have a pulse wave does it make sense anymore to talk about its RMS value? <S> Recall that the instantaneous power associated with a resistor is $$p_R(t) = <S> \dfrac{v^2_R(t)}{R} <S> $$ <S> The average power, over a period \$T\$, is then $$p_{avg} = <S> \dfrac{1}{T} <S> \int_0^Tp_R(t)\,dt =\dfrac{1}{T} <S> \int_0^T\dfrac{v^2_R(t)}{R}\,dt$$ <S> Thus, the equivalent DC voltage that produces the same average power is $$V_{eq} = <S> \sqrt{p_{avg}\cdot R} = \sqrt{\dfrac{1}{T} \int_0^Tv^2_R(t)\,dt}$$ <S> But, that last term is precisely the root of the mean of the square (rms) value of \$v_R(t)\$ . <S> So, yes, it makes sense to talk about the rms value of a pulse waveform or any other voltage or current waveform for that matter. <A> If we have a pulse wave does it make sense anymore to talk about its rms value? <S> Yes it does. <S> If the voltage is 50% duty and rises to +1V at the top and -1V at the bottom it will measure: - Zero volts on a multimeter measuring DC <S> Theoretically 1V on a multimeter measuring AC <S> You can't rationalize one from the other when they are AC coupled. <S> And what if they aren't AC coupled - say you measured 2.5V for a 5V square wave - sure <S> , you can predict it is 50% duty <S> but you can't say the heating effect it has is the same as 2.5V DC. <S> The RMS of a 5V square wave with 50% duty is not 2.5 volts <S> it is \$\sqrt{\dfrac{5^ <S> 2}{2}}\$ = 3.536 volts: - <A> There are many ways to define "average" when measuring an AC voltage or current. <S> RMS usually makes the most sense, because it is the only way which, for any waveform, preserves equations such as: $$ E = IR $$ <S> $$ P = <S> IE $$ <S> $$ P = <S> I^2 R $$ <S> $$ P = <S> \frac{E^2}{R} <S> $$ RMS voltage or current answers the question: <S> What is the equivalent DC voltage or current with the same power into a resistive load as this AC voltage or current? <S> RMS is the only method that does this for any periodic waveform, be it sinusoidal, square, a pulse train, symmetrical or not, or even totally irregular. <S> You might say that the magic of it is in the square part of root mean square , because power into a resistive load is proportional to the square of current or voltage. <S> Thus, two 50% duty cycle square waves, one from 0V to 5V, and the other from -2.5V to 2.5V, do not carry the same power. <S> Only RMS takes this into account: $$ \sqrt{\frac{(5V)^2 + (0V)^2}{2}}= \sqrt{\frac{25(V^2)}{2}}= <S> \sqrt{12.5(V^2)}\approx 3.5V $$ <S> $$ \sqrt{\frac{(-2.5V)^2 + (2.5V)^2}{2}}= \sqrt{\frac{6.25(V^2) <S> + 6.25(V^2)}{2}}= \sqrt{6.25(V^2)}\approx <S> 2.5V $$ <A> The average power going into a system is a meaningful number (it represents the amount of energy per second). <S> If the voltage and current going into a system are always proportional (meaning voltage varies in phase with current) then the average power going into a system will be proportional to the square of voltage and also proportional to square of current. <S> The RMS voltage is essentially the square root of the amount of power that a would be generated across a unit load by a given voltage or current waveform. <S> In the case of a motor driven by PWM, the voltage and current waveforms are likely to be substantially out of phase, in ways which will vary depending upon various factors including the level of mechanical loading. <S> As such, the power being driven into the motor will be not be proportional to the RMS voltage nor to the RMS current. <S> Within the motor and control system, energy will be shuffled around between places it's put to use (motor's mechanical load), places it's wasted mechanically (bearing friction), places it's wasted electrically (resistance in the motor windings and the control system), and places it's sometimes stored and sometimes harvested (mechanical inertia and electrical inductance). <S> Power dissipation due to winding resistance is proportional to RMS-measured current, pretty much independent of whatever else is going on, but most other kinds of energy transfer will vary in other ways. <S> With regard to other kinds of loads, the usefulness of RMS voltage as a measure will depend upon the nature of the load. <S> In some cases, simple time-averaged voltage will have a more meaningful relationship with behaviors of interest, while in other cases RMS voltage is what's important.
Yes, of course it does; the rms value of the pulse wave is the effective DC voltage across a resistor that gives the same average power.
Are there any types of DC motors that self-lock themselves? I have a small DC gear motor which spools a plastic line. Once I've engaged the motor to tighten the line, I want to lock it in place so that the line doesn't unspool. I would then like it to remain in this position mechanically so that I do not have to apply holding current. When I'm ready to release the line, I'd then like to be able to electrically reverse the process and disengage the lock. Is there a standard design that fits this requirement? <Q> A common way of doing this is with a self-locking worm drive <S> The worm drive has a gear ratio that provides high mechanical advantage and depending on the helix angle of the gear, the output can't backdrive the input, so it is self locking. <S> You can find one here at Servo city or try to DIY with hardware store threaded rod and an off the shelf gear. <S> Note that the rachet can only be driven in one direction. <S> There are other ideas I can think of such as using a solenoid to lock/unlock a catch that holds the belt in place when the motor is stopped, but they are more complex than what I describe above. <S> Please post back here if you do build one of these. <S> I love mechanisms but find that few people are interested in building them. <A> You want a DC motor with a mechanical brake. <S> You can electrically brake (permanent magnet) motors by shorting the contacts together, but the braking force of this isn't very strong for small motors. <S> Especially if it's safety-critical; I can't tell from the description whether this is the sort of cord used for opening curtains or the sort that might have heavy objects or people hanging from it. <A> If you don't mind intermittent motion, you may find a Geneva Drive mechanism to be suitable, although you may want to use the roller kind instead of the usual sort, because they are somewhat smoother. <S> (I can't find an image right now, so I will add it later when I do find it.)
Another suggestion is a ratchet and pawl mechanism that may be easier to DIY than a worm drive and much cheaper than purchasing it. For your cord application, I'd look into some sort of clamp applied to the cord itself with a servo.
Pin IO for a computer running Linux I'd like to control a few input pins (say 5) and a few output pins (at least 2) from a computer. The computer has no parallel port. What is the best way to do this? USB-to-parallel adapter (anybody have one to recommend which works on Linux)? Or perhaps there is some other general purpose USB "control board" where I can use read input from some pins and write output to others? I don't even know what to google for, so any pointers are appreciated! <Q> It will depend what speed you need to read or write data at. <S> However many of the FTDI chips support this sort of USB<->parallel using the D2XX <S> interface <S> ( programmers guide here ). <S> Some chips such as the FT245B <S> ( datasheet here ) are designed for implementing custom parallel interfaces. <S> See the block diagram below. <A> Perhaps overkill for what you want (16 I <S> /O pins) <S> but it works with Linux, and it's programmable from all the major languages. <S> In general, if you search for linux daq usb <S> you will find plenty of options. <A> It is very easy to make your own using a microcontroller like an Arduino or mbed. <S> The microcontroller will appear as a virtual serial port when plugged in with USB, and you can send it commands. <S> On the microcontroller side, write a small program that interprets the commands and changes output of the pins or returns an input. <S> This may not provide timing as good as a "real" DAQ box, but if you don't need that kind of quality, it can be an affordable solution.
If you have US$108 to spare, this "Affordable Multifunction DAQ with USB" ( http://labjack.com/u3 ), by LabJack, may solve your problems .
Affix LED to a case I found a topic related to my problem but I want to consider other options. ( What type of glue do I use on an LED? ) I want to attach LEDs and connectors on the front panel of a box (aluminum). The connectors don't have any holes to affix them. The previous topic talks about gluing. But is it the correct way to attach an LED to a box? The PCB will be something like 10cm away from the hole, would a glued LED with two wires seem to be enough for you? Isn't there some kind of LED mount on which I can solder the LED and affix the mount to the case? <Q> It's not clear whether you want to attach LEDs to the exterior of the enclosure or have them mounted in holes in the aluminum. <S> Typically you would mount them in holes, and to secure them properly, you should consider an LED mount: <S> At left shows how the LED is secured in the housing. <S> At right shows the mount components separately. <S> It's just a plastic holder which is held in place with a ring. <A> One method is to use a bezel LED clip <S> These are push-fit <A> Alternate method - To make LEDs vandal-proof on heavy use timing monitors having 1/8" aluminum front panels the T_1-3/4 LEDs and their panel holes were threaded to 12-24 NC for mounting. <S> This method is suitable for one-off projects with 1/8" panels, is labor intensive and requires ingenuity to thread the LEDs. <S> For threading LEDs the die and LED must be preheated with a hot air gun to reduce the torque necessary for threading and to keep the LED from cracking. <S> You'll have to devise your own method to hold the heated LED during threading. <A> For the neatest finish just use panel mounting LEDs - there are a wide variety of colours and styles available from suppliers. <S> Terminate the leads with a 2 pin connector or use more pins if you have several LEDs and don't want a separate connector for each. <S> Here's just one example:
Look for "LED mounts" at your electronics supplier, there should be a variety to choose from to fit your LED and enclosure thickness.
What is the minimum required voltage for charging a 3.7 V Li-ion battery? I have a cell phone battery that has the following written on one side: 3.7 V 1000mAh Limited charge voltage: 4.2 volts I understand that the first line means, that the battery will always give 3.7V (at least in theory) at its output terminal. Also the battery will last for 1 hour if the mobile circuitry draw 1000mA. The second line means that under no circumstances I should increase the input charging voltage beyond 4.2V, else it might damage the battery. Is my understanding correct? If I am correct I would like to know for this battery what is the minimum required voltage for charging? <Q> Technically the minimum amount of voltage for charging will be anything above the current state of charge. <S> But that's probably not the answer you're looking for, from Lithium-ion battery on Wikipedia: Lithium-ion is charged at approximately 4.2 ± 0.05 V/cell except for "military long life" that uses 3.92 V to extend battery life. <S> Most protection circuits cut off if voltage greater than 4.3 V or temperature greater than 90 °C is reached. <S> Below 2.50 V/cell the battery protection circuit may render the battery unchargeable with regular charging equipment. <S> Most battery circuits stop at 2.7–3.0 V/cell. <S> So to achieve a full state of charge you'd normally want to aim at 4.2V. <S> In practice charging Li-Ion safely and efficiently does involve quite a few steps so you may want to look at a dedicated charger chip. <S> You'd need to check the datasheets for any that look of interest but many will operate properly with a supply voltage only a little above 4.2V. <S> The 3.7V above sounds like the nominal voltage which is the area where the battery will spend most of it's time during the charge to discharge cycle. <S> But they will start out at around 4.2V and drop to a voltage below that. <S> Letting them drop in voltage too far will cause problems, but you'll get some useful life below 3.7V as well. <A> To safely charge a lithium ion battery, you need to follow the correct charging procedure , which involves a constant-current phase followed by a constant-voltage phase. <S> If you just use a constant-voltage source, you'll end up charging the battery faster than it's designed to cope with. <S> For instance, here's a datasheet for one particular model of li-ion battery. <S> To fully charge the battery, you need to eventually get it up to 4.2V. <S> But if you just apply a 4.2V across it when it's completely discharged, you'll be putting 4.2V-2.75V=1.45V across a 130mOhm impedance. <S> That means the charging current will be on the order of 10 amps, which is much higher than the battery is rated for. <S> It's specified with a maximum charging rate of "1C" or enough current to fully charge the battery in one hour, which in this case is 1.1A. <S> You need to actively limit the charging current by reducing the voltage, until the battery is sufficiently charged to self-limit. <S> If you can't find a datasheet for the exact model of battery that you're using, you should err on the side of caution and charge it very slowly. <S> Lithium-ion batteries are prone to catching fire or exploding if abused. <A> This is not an area I have much experience in, but I guess it depends on the internal resistance of the battery. <S> You could try to apply a small charging voltage to the battery, as small as you like, and then measure how much current flows into the battery. <S> If current is flowing into the battery, it should be charging (minus some current which is wasted as heat in the charging process). <S> The current you can charge the battery with will depend on how charged the battery already is. <S> My intuition tells me that you will have to apply at least 3.7V if you want to charge the battery fully. <S> Again I am no expert in this area, so above is just my speculation. :) <A> Taking into consideration the other answers, I will limit my self to just answering the OP questions. <S> 1 <S> - Yes, your understanding is correct. <S> 2 <S> - The minimum voltage required to charge a 3.7v Li-Ion battery (to 3.7v), is 3.7v . <S> A more "realistic" example of the second part of the first sentence would be 10 hours at 100mA. <A> No, the battery does constantly not give 3.7V. <S> This is the voltage value at a way <S> lower capacity.3.7V does not means much. <S> That is the value at which the battery is most stable at, but the actual value when fully charged is 4.2V, so a charger will have to provide higher than this if you want to fully charge it. <S> At 3.3V standard Li-Ion cells are considered discharged because they can no longer provide enough sustained current for the average applications they were designed for. <S> The minimum voltage for charging a standard Li-Ion is 4.201V. But <S> considering impedances of the charger and cell, most chargers have 4.25 or even 4.3V when running blank (not connected to a cell). <S> Although those values have been chosen this way they are not like the 10 commandments. <S> You can discharge a cell under 3.3V but it will provide less current and you can charge it even up to 4.3+V <S> and it will have higher capacity, but both practices will lower its lifetime. <S> So in emergency cases, overcharge them to 4.3V and you'll have some extra capacity to work with and if you want to have a very long time for a cell, <S> let it charge only up to 4V but that will only provide ~80% of the stated capacity. <S> Getting back to chargers, I'd design my charger like this: Option 1: 4.0V - safe mode - for safe charging and long life and overdischarged/bad cell recovery. <S> Option 2: 4.21V - standard - normal charge mode (bad cells with reduced capacity will overheat if charged at standard level) <S> Option 3: 4.32V - overpower - over-charge mode (lower cell life, very high danger for reduced capacity cells)
I.e. if the battery is fully discharged, you can probably charge it with a very small voltage, but if it is almost fully charged, you will need a larger voltage. A more practical voltage would be, 4.0v (3.7 < 4.0 < 4.2).
How to measure headphone impedance for a target cut off frequency? Lets say I have an audio signal with a DC offset and I want to use my earplugs to listen it clearly. Since I'm a human my hearing range is 20Hz to 20kHz. It means I need to filter very low frequency components i.e where f<20Hz. It means the cutoff frequency for the simple high pass filter circuit in my figure must be such that 1/2*pi R C=20Hz. Here I need to know the impedance of the head phone (shown as R in the figure) to choose a proper capacitor. At this point I'm confused: My question is how can I measure this impedance? By simply using an ohmmeter? But what if it has different impedances in different frequencies? Should I apply an ac signal at a particular frequency and measure its impedance? Is headphone impedance pure resistive? <Q> Different kinds of headphones will be significantly different. <S> Even different instances of the same model of headphones can be different. <S> The headphone impedance isn't just resistive but also reactive, and it will take some work to characterize it. <S> Someone might plug your thing into a line input, instead of headphones, and expect it to work. <S> Instead, consider buffering the output. <S> For headphones, an op-amp will do. <S> You can, in fact, find tons of designs online for "headphone amplifiers". <S> Some of them even use very expensive op-amps from Burr-Brown costing $50 or more, and, I'm told, these sound better than unobtanium flux linkages. <S> Personally, I just use whatever op-amps I have in the parts drawer. <S> Anyway: simulate this circuit – Schematic created using CircuitLab <S> Now calculating C1 is easy, because you also get to pick R1. <S> Just make it anything significantly bigger than your source impedance . <S> Make C1 whatever you like to get the desired frequency response. <S> The headphone impedance is largely irrelevant, because the output impedance of OA1 is so small. <A> I would use the nominal impedance of the headphones, and pad generously. <S> You will need a large electrolytic capacitor, well in the hundreds of microfarads or more. <S> If you are after fidelity, then the filter calculations you have in mind might as well be tossed out of the window, because if you're after fidelity, speaker coupling capacitors must be seriously over-sized in order to minimize low frequency distortion. <S> [Source: Audio Power Amplifier Design Handbook , Douglas Self]. <S> (If you're not after fidelity, then why bother trying to achieve excellent low frequency response.) <S> There is an amplifier solution for avoiding the capacitor that doesn't involve obtaining a dual-voltage supply for an op-amp. <S> Namely this: you can use some cheap, easy-to-use, audio amplifier chip. <S> There are such chips which have outputs that consist of bridged amplifier stages, allowing the chip to run on a single-voltage supply, yet drive a speaker with no coupling capacitor. <S> Unlike op-amps, such chips can drive low-impedance speaker loads (what they're designed to do). <A> It will have a varying impedance with different frequencies but this is largely governed by the acoustic properties of the headphones when wearing them. <S> At anything but the really low frequencies the capacitor you choose will be a small impedance and any variation from 200Hz upwards will be laregely unnoticeable. <S> If your headphones are 30 ohm impedance then the capacitor you choose will have 30 ohms impedance at 20 Hz - at 200 Hz the capacitor will be 3 ohms and at 2 kHz the capacitor will be 0.3 ohms. <S> As you can see, as frequency rises this becomes much less of an issue. <S> Regarding the delivery of power, the headphone impedance is largely resistive but there will be a small leakage series inductance that will be about 10uH. <S> If your cap was chosen to be 270 uF <S> (29 ohms at 20Hz), you might expect a little resonance with the coil inductance and this would occur at F = \$\dfrac{1}{2\Pi\sqrt{LC}}\$ = 3063Hz. <S> But this is all very much dampened down by the resistances. <S> For instance, a 30 ohm speaker might have a dc resistance of 25 ohm and this would seriously reduce the damping and again you would not really notice anything acoustically. <S> A 1 ohm resistor would produce a Q factor of significantly less than unity.
Relying on the headphone impedance for filtering is probably a bad idea.
How to get 12V from (automotive) 7V to 42V? I'm trying to design a circuit that is supplied with a voltage between 7V to 30V (12V battery) and needs to output 12V @100mA. How can I implement it?Do I have to use an DC-DC (step-up/boost) converter? <Q> You basically need a switched mode power supply that is capable of both stepping down and stepping up the input voltage to 12V because your input voltage range is greater than and less than the required output voltage. <S> Therefore a boost converter will not suffice; neither will a buck converter. <S> The simplest power electronic converter that could do this is the buck-boost converter: <S> http://en.wikipedia.org/wiki/Buck%E2%80%93boost_converter This converter produces a negative output voltage with respect to the input voltage. <S> However, if the output can be floating, then this is not a problem. <S> Just use the negative output of the converter your ground rail. <S> If you can't work with a buck boost, the next best bet is the flyback. <S> This is similar to a buck boost, but can produce a positive output voltage because it is an isolated converter. <S> Another option is the SEPIC converter. <S> However, this is more complicated to design and control since it uses two inductors. <S> To summarize, I would look at these converters in the following order: <S> Buck-boost Flyback Sepic <A> Here are a couple of buck-boost converter offerings from Linear technology that would fit the bill. <S> The second one is the preferred solution to me: - <S> Here is the LT page where you can enter your own parameters and it provides you with the chip options. <A> (also called DC/DC) <S> Several typologies allow the input voltage to be either lower of higher than the output voltage. <S> Have a look at: Flyback architectures <S> SEPIC architectures <S> And many others <S> If you are not comfortable with them, you can always do a multi-stage approach with the drawback of reducing the efficiency. <S> E.G: <S> The first stage lower the voltage to less than 7V and another stage will transform this 7 to 12V. <S> Thus there is no overlapping problem.
A SMPS (switched mode power supply) is a good choice here.
what is the best method for device location services I am working on a side project at home and need a way to detect when an object is in certain rooms of a house. GPS is not practical because the difference between my living room and bedroom would be too small. I was wondering if bluetooth has measurement capabilities? Or if there is some product that already does this? <Q> You might be intrested in this RFID tracker. <S> Hack-A-Day has a write up on it here: http://hackaday.com/2010/02/20/rfid-tracking-system/ <S> The project site is: http://www.ns-tech.co.uk/blog/2010/02/active-rfid-tracking-system/ Simply put rfid tags on what you want to track, hook up a reciever, and connect it to your computer. <S> It's all open source and on a hobyist budget. <S> I'm sure you could modify the code to use the data for whatever server application you want. <S> I heard of jewelry stores using similar devices to know if merchandise is being stolen. <S> Hope I could point you in the right direction. <A> You could transmit a coded signal in each room that is not visible in other rooms; IR is a good candidate because it won't penetrate walls and transducers are readily available, cheap, and (in your example) built into phones. <S> A device can then use the code to identify its location. <S> There are some challenges, e.g. reflections, open doors allowing leakage, etc, but they should be manageable. <A> I noticed that you want to do this with your smartphone, based off of your comment to user33465. <S> You might want to put this in your original question. <S> Bluetooth would be a good idea. <S> It has a open range of about 30ft, and much less with obstacles. <S> Since smartphones can automatically connect to bluetooth devices when they are within range, you will want to have your bluetooth device in each room. <S> So, whenever you enter a new room you connect to a new device. <S> You can have an app running in the background that will send the bluetooth device a packet to trigger your lights to turn on or off. <S> Sounds like a fun project, good luck! <A> Then use Trilateration based on RSSI (Received Signal Strength Indication) to estimate the distance to each detected Bluetooth LE device to calculate your position relative to them. <S> I understand, from my similar experiments so far, that such Bluetooth LE capable smartphones can generally connect to upto 4 such devices at once. <S> I have yet to determine the effect of different walls and floors etc on RSSI.
If your smartphone is Bluetooth Low Energy capable, then you could possibly consider using low cost Bluetooth LE devices distributed around the rooms of your house, in known positions.
Understanding Batteries and Loads This battery is rated at 12V, and it says it provides 7Ah of power. Does that mean that it can provide 12V at the terminals for 1 hour if 7 amps are being drawn from it? Also, what does it mean when someone say some appliance is X watts. Like a 60 watt bulb or a 200 watt ice crusher? Doesn't the amount of watts depend on the voltage applied and the appliance's internal resistance? <Q> The datasheet is INCORRECT! <S> but your understanding is not so far off... <S> The battery capacity of 7Ah, <S> x its voltage (12V), indicates its stored energy not power. <S> If you need 7A for 1 hour you need to read the fine print, to see if that was the capacity at its "1C" rate (1x its capacity, or drain it in an hour) <S> Oh wait, there is no fine print on that page, unlike a proper datasheet . <S> So if you need that current you take your chances or look elsewhere. <S> The Yuasa datasheet shows 7Ah at the 20hour rate, falling to 6.4Ah at the 10 hour rate. <S> So that battery from a reputable manufacturer is rated to last 20 hours at 350ma, falling to 10 hours at only 640 ma. <S> It also tells you that the endpoint they measured to is 1.75V per cell, or 10.5V. <S> But at least it tells you what you're getting. <S> Lead acid batteries can be tuned for different purposes including high current, so it's possible <S> that the advertised battery will source 7A for 1 hour ... <S> if the vendor is trustworthy. <S> If they are, they may be able to supply a proper datasheet on request. <S> Can't hurt to ask! <A> Yes you understood it correctly, a 12V,7Ah batteries is supposed to provide 7A @12V during one hour. <S> Regarding regarding consumption in Watts, it is the current multiplied by the voltage the device is supposed to run on. <S> If your 60 watt bulb is supposed to work on 250V it will draw 0.24A <S> when powered that way. <S> That's the basic theory. <S> There are some subtleties though: <S> Inductive loads: for some devices powered by AC <S> , consumption is not just amp times volts, it's I * V * cos(phi). <S> Phi being specific to the device itself. <S> Those devices are called inductive loads. <S> Most of them are devices containing coils, such as transformers, motors etc... <S> Batteries capacities: <S> beware, in real life you wont be able to draw your 7A during a whole hour from your 7Ah battery, because: <S> When your battery will be near empty, it won't be able to provide both 12V and 7A Batteries age and tend to loose capacity during their life Batteries manufacturers are often a bit optimistic with their specs <A> 12 volts battery: <S> max voltage is around <S> 13.1V - 13.3V <S> & min voltage is around 11.1V - 11.3V <S> If the battery is fully charged it contains max voltage and 7 AH capacity. <S> As u go on discharging the voltage and capacity go on reducing.
7 AH: Battery can deliver less than 7 Amps for an hour or 1 Amp for 7 Hours.
How does an increase in operating frequency result in decrease in the size of an inverter circuit? I was reading about inverters in a textbook where the author says that The size and cost of the circuit can be reduced to some extent if the operating frequency is increased but then inverter grade thyristors must be used which are costly. How does an increase in frequency have an impact on the size of the inverter circuit(or does it affect the rest of the circuit too?).Is there some physics involved which causes this? <Q> The largest single factor is usually inductor size. <S> If you eg double frequency you can generally halve inductance (as the impedance of a pure inductor is proportional to frequency). <S> In practice a number of factors apply so that it's not a directly linear relationship, but good enough. <S> If you need a peak current of say 1A then the time taken to ramp up from 0 to 1A is related mainly to inductance and applied voltage. <S> If the inductor is say 10 x smaller the current ramps at ~ 10x the rate. <S> The discharge time is also similarly speeded up and the overall cycle is faster so operating frequency is higher. <S> You can look at this as the smaller inductor causing higher frequency operation or of the higher frequency allowing smaller inductors. <S> If the text mentioned thyristors in that context it is probably either an old one or is dealing with extremely high power levels. <S> Nowadays, for most purposes inverters would usually use either MOSFETs or IGBTs. <S> The very largest inverters may still use Thyratron valves - such as the many MegaWatt units used for DC to AC power conversion for DC submarine cables. <S> In typical portable modern applications an inverter which may have been operated at 100 kHz or less 10 <S> + years ago is now liable to operate at 500 kHz to 2 MHz and <S> a few operate at higher again. <S> At 1 MHz+ and power levels of say a few Watts the inductor size may be 10%-20% of the size at 100 kHz and the inductor may still dominate the overall size. <S> Note that current carrying capacity ~ proportional to wire area <S> but inductance is proportional to turns squared. <S> This does not mean though that core size changes only with sqrt of frequency as you have issues of core cross section, core path length, winding window size and more to add to the fun. <A> Capacitive reactance \$X_C = <S> \dfrac{1}{2\pi fC}\$, <S> so for any given reactance desired (filtering etc) a higher frequency <S> f allows a lower capacitance C . <S> Inductive reactance \$X_L = <S> 2 <S> \pi fL\$ so again, for any given reactance, a higher frequency f allows for a smaller inductance L . <S> On the other hand, depending on the purpose intended, a high frequency inverter might not suit the purpose: For domestic power inverters, an output at least approximately close to the mains frequency is required for most equipment. <S> The way some sinewave inverters address this, is by operating at a far higher frequency, kilohertz to megahertz, and generating the sine waveform via PWM. <S> Thus, the bulk of the power transmission occurs at the higher frequency, with a final stage low-pass filter to get rid of the higher harmonics from the PWM signal, and leave behind a smooth sine wave at the desired 50 / 60 Hz. <A> I was having the same problem and here’s <S> what I found: XL = <S> 2πfL <S> Z= <S> (R2 + XL ) <S> 1/2 I= V/Z <S> When f increases XL increases. <S> When XL increases Z increases. <S> I is inversely proportional to Z therefore when Z increases I decreases. <S> Therefore increase in frequency results in decrease in current.
The use of higher frequency requires smaller capacitors, physically smaller inductors / transformers and their cores, and therefore reduces overall size of a design.
Using twisted pair for supply Is using twisted pair for the supply in a long cable a good idea? The cable contains two twisted pairs; one twisted pair for CAN Bus, and the other twisted pair would be used for GND / Supply. What would be the effects of using such a cable? Good / Bad? <Q> A possible negative effect could be the resistance of the wire. <S> That's not caused by the twisted pair, but rather the wire diameter. <S> If they're really signal wires the diameter will be rather small, and have a non-negligible resistance. <S> The resistance will cause a voltage drop, which may become noticeable at longer distances. <S> If the wire is thick enough you won't have any negative effects, but no positive effects either. <S> The power supply has a very low impedance, so it won't pick up from the signal, and at DC it won't inject any disturbances into the signal wires either. <A> Theoretically a cable having a twisted pair for data and two other conductors for power and return is OK - induced currents from the power conductors will tend to equalize on both data wires (because they are twisted) and only produce a small common-mode corrupting signal that can be dealt with by using appropriate components on the CAN bus receivers. <S> If the twists are at different pitches then there will be much less of a problem <S> but it all depends on cable length, number of twists and the bandwidth of the current flowing down the power conductors. <S> This is alleviated by having good decoupling caps at both ends of the power cable to try and ensure current down these wires are only slow moving relative to the data. <S> It's the same problem with phantom powering a CAN bus (or any low power serial) module down the data wires - the power has to not be jumping around too much compared to the magnitude of the data. <A> Power over Ethernet (PoE) can provide up to 15, 25 or 51 W over twisted pair data cables by passing power over unused pairs or by applying a common mode voltage over the signalling pairs. <S> Using more pairs obviously helps allow greater current. <S> PoE tends to use higher voltages (up to 57 V) which may also help overcome resistive losses. <S> So, supplying power over twisted pair signal cables is well-established.
However, if a twisted pair is also used for power, performance can get worse if the twists on the power and twists on the data line up - now you will get a potentially substantial transverse interfering signal on your data.
How are multiple power sources synchronized in a grid that uses a distribution ring? A large distribution grid can work like this. There're several power station each outputting 50 Hz AC. Each power station feeds energy into a substation next to it which raises the voltage and then feeds energy into a powerline and that powerline goes to a substation close to the customers. The deal is customers don't really want to depend on a single station and that single powerline so they've crafted a distribution ring - there's a chain of high voltage substations connected to each other and each power station feeds energy into that ring - each substation in the ring is connected to two of its neighbors and also to the power station. The more advanced design is to have each power station connected to two of those substations via a separate powerline. Now electricity "moves" at the speed of light which is high but still finite and over the distance of dozens and even hundreds of kilometers the phase difference between the different power stations will be notable and because of that phase difference different power stations should partially cancel each other out. If several power stations were connected to a single point they could have been synchronized appropriately but in the described setup there's no single point - there're multiple substations separated by long powerlines forming a closed ring and so it looks like something will always be out of phase with something else. How is synchronization possible in such conditions? <Q> Let's say that your hypothetical ring system is exactly 1/2 wavelength in circumference. <S> Now, let's suppose that you start each generator by synchronising it to the local frequency , which is how it's done in real life. <S> (In really olden days, using three lightbulbs, in olden days, using a synchroscope; these days using a auto-synchroniser.) <S> The clock faces represent phase, as measured against a global reference (say GPS time.) <S> We do, indeed, have a problem. <S> At the open breaker there is a 180 degree phase difference, and closing the last breaker is likely to make something explode. <S> Now you only have a 45 degree phase difference across the open breaker, which is more manageable. <S> In practice, no part of a ring system like this would be a eighth-wavelength long (1000km?) <S> so the phase difference would be less than 45 degrees. <S> In practice, I have never heard of this being an issue. <S> Possibly because real world networks aren't long enough; or GPS phase synchronisation is implemented as above; or possibly because transmission networks are not built as rings, but as rather more densely connected meshes where there are many short interlinks between nodes, which act to equalise frequency within the local "neighbourhood" of substations. <S> For more detail on check sync relays and auto-synchronisers, see §22.8 Power System Measurements - Synchronisers in the Areva/Alstom/Schneider book Network Protection and Automation Guide , 2011 edition (NPAG). <S> Alstom NPAG page. <S> NPAG 2011 on Scribd. <S> Update: While cleaning up my reference files, I found a document Fundamentals and Advancements in Generator Synchronising Systems by Michael J. Thompson of SEL Inc, a well regarded manufacturer of power systems protection and control equipment. <S> The document is very interesting in general and also includes some guidelines regarding the tolerances in voltage, frequency, phase, when synchronising: <A> Firstly, if you're going to have such a ring you need to make sure that it's sized to a whole number of wavelengths. <S> Having done that, fire up a single power station and apply it to the ring. <S> Each distribution point will have a signal at a particular phase. <S> It's then obvious that you don't need to be in phase with the system , just your attachment point to the system. <S> Measure the local phase and start up the generators in phase with that. <S> A smaller version of this applies to grid-tie inverters used with solar panels. <S> They sense the mains phase and apply power additively to it. <S> As a result they usually turn off when disconnected from the mains, to prevent issues when trying to reconnect at a different phase. <A> Power stations do not need to be exactly synchronised with the grid - a small phase angle difference is acceptable, and is in fact required to push power into the grid. <S> The flow of real power depends on the phase difference between the source and destination. <S> See <S> https://en.wikipedia.org/wiki/Quadrature_booster <S> The flow of reactive power depends on the voltage difference between the source and destination. <S> See https://en.wikipedia.org/wiki/Static_VAR_compensator <S> One of the advantages of HVDC transmission systems is that they eliminate any stability issues caused by phase difference between source and destination ends.
The trick is that generators are started in synchronisation with whatever the local frequency is, but once they are running, they are slowly adjusted to be in synchronism with a common phase reference - say GPS time.
How to drive a LED strip from AC power supply? I have a LED strip (5050) and a sine-wave AC power supply of a sufficient wattage and the voltage regulated in a sufficient scale. What would be a good design of driving the LED strip from this supply? I want to keep it simple. My idea was to: setup the voltage of the power supply to the level required by the output luminosity. include a rectifier to keep "no-power" time as short as possible. connect a capacitor parallel to the LED strip to prevent flicker and not to shorten LED strip life (because it's 50 Hz AC power). Is there a way how to calculate the capacity of the capacitor based on the LED strip power consumption? I know it has to withstand the max. voltage it connects to. Is there anything else to make it better or more sustainable? Edit: This is a minor importance, but the final goal is connecting several LED strips in series and the power supply would be 220V AC electrical grid. The circuit will be with circuit breaker and an Earth leakage circuit breaker . <Q> This is the same problem as any "how do I get DC from AC? <S> " question. <S> You rectify it: simulate this circuit – Schematic created using CircuitLab <S> You can perform the rectification with four discrete diodes, as shown here, or you can purchase pre-made bridge rectifiers that are exactly this, in an integrated package. <S> C1 is optional, and serves to reduce the output ripple. <S> Without it, the output bounces between 0V and some positive peak value, close to the peak-to-peak voltage of the AC input but reduced slightly by the forward voltage of the diodes in the rectifier. <S> from hyperphysics <S> If you omit C1, then your LEDs will flicker at 100Hz (twice your AC input frequency), but you probably won't be able to see this. <S> If you want to include C1, to calculate its value, decide how much voltage decrease is permissible between cycles. <S> Say that we decide the output voltage can ripple between 12V and 10V: C1 must then be able to supply the current necessary to run the LEDs between each half-cycle without decreasing the voltage by more than 12V-10V=2V. <S> We can make some simplifying assumptions: that the LEDs are a constant current sink, and that the capacitor will fully recharge at each half cycle, and must supply all the current between cycles. <S> Start with the fundamental behavior of a capacitor: <S> $$ i = <S> C\frac{dv}{dt} <S> $$ <S> Replace the LED current <S> (let's say 20mA) for \$i\$. <S> Our peaks happen 100 times per second (twice the input frequency) <S> so the capacitor must go 0.01s between recharges (\$t_{dis}\$), and we decided the allowable voltage drop in this period was 2V. That gives us a value for \$\frac{dv}{dt}\$: $$ \begin{align}20mA &= <S> C \frac{2V}{0.01s} <S> \\\frac{20mA \cdot 0.01s}{2V} &= <S> C\end{align}$$ <S> We can check that a farad is equal to an ampere-second per volt: $$ F = <S> \frac{A\cdot s}{V} <S> $$ <S> and these are the units we have above, so we can conclude: $$ C = 0.1mF <S> $$ <A> There are more than a few ways to drive LEDs directly from AC mains, among them: <S> In 1 and 2, half of the LEDs will be driven during the mains' positive half-cycle, and the other half during the negative half-cycle. <S> With 50 Hz mains <S> , each string will half-wave rectify the mains and flash at 50Hz (i.e. be on for around half the time), which is visually detectable and annoying, so that approach will be abandoned. <S> In 3 and 4, the mains is full-wave rectified, so the string will flash at 100Hz, which is visually undetectable and, therefore. <S> acceptable. <S> For 24V 5050 strips to be connected across 240V mains, no current limiters will be needed and all that'll be required is to connect 10 of then in series across the 240V mains like this: <S> Likewise, for 12V strips to be connected across the main, 20 will need to be connected in series then connected across the 240V mains. <A> setup the voltage of the power supply to the level required by the output luminosity. <S> From what I can see, the required voltage of commercial strips of 5050 SMD LEDs is generally 12 V. Example . <S> You do not alter luminosity by varying the voltage. <S> include a rectifier to keep "no-power" time as short as possible. <S> DC power supplies generally contain a full-wave rectifier (four diode rectifies in a bridge arrangement). <S> connect a capacitor parallel to the LED strip to prevent flicker <S> You should provide the LED strip with DC. <S> If your question is about designing your own PSU, you'd need to give some more details of the LED strip (or a link to a data sheet for it). <S> You might want a switched-mode or linear PSU with a 240 V AC 50 Hz input and a 12 V DC output of (say) <S> 150 W. <S> I'd just go out and buy one, but if you are experienced and aware of the safety issues, it shouldn't be difficult to design and build one for the purpose.
You need a 12 V DC supply designed for driving LED strips. A DC supply generally contains a smoothing capacitor.
RxD TxD equivalent pins in USB I want to build a USB Programmer currently for AT89C51. I am stuck on how to make it communicate with PC. In RS232, the RxD TxD pins are straight forward, we just need to use Logic Level Converter to interface with MC. What about USB. Are Data+ Data- lines equal to RxD TxD? Can I connect these USB Data lines to MC directly? They don't need any Logic Level Converters. Right? I saw some USB to RS232 converters. Why they exist?I thought USB interfacing was more easy, not really! So how would i send data from PC to my Programmer through USB port?Please Help & Thank you <Q> USB cannot be used as simply as a serial port. <S> There are many layers of software protocol that must be supported. <S> Even so, I suspect that using USB for serial communications is not as simple as you might think. <S> See also USB / Serial converter without FTDI Chip http://www.fourwalledcubicle.com/LUFA.php <A> USB is quite a complex protocol so that's the reason off-the-shelf USB to RS232 adapters exist. <S> If you wanted a chipset solution something like the FTDI FT232H chip might be a good solution. <S> As you want TTL levels you can get products like a FTDI Cable 5V VCC-3.3V <S> I/ <S> O cable that would probably be the easiest although not cheapest solution: Some microcontrollers have USB hardware built-in and software stacks provided by the vendor that can make things a bit easier. <S> But the AT89C51 doesn't have USB support and while implementing it is <S> software might not be technically impossible (it has been done on some controllers) <S> the results are usually somewhat non-compliant and wouldn't leave you with much code space for anything else. <A> If you consider what USB does you will realise it can't be a simple UART like interface. <S> The D+ and D- lines are both bidirectional <S> so there is no equivalent to the RXD and TXD lines of RS232. <S> Instead communications happen in one direction at a time and D+ and D- form a differential signal. <S> There is a complex software protocol involved with all communications being of a call and response type with one device acting as a host (the PC) and others as devices which only talk when asked to. <S> If you would like more details see www.usb.org . <S> The USB to RS232 devices you have seen all contain a microprocessor. <S> In the case of FTDI devices it's all programmed for you, and you can't change it. <S> In the case of other processors you have to write your own code; though there are several examples available for the most popular processors.
Some microcontrollers have some USB support built-in.
Detecting location of infrasound noise in a building I am working in a large office building with a lot of people. Pretty frequently there is a very weak and low frequency noise that is very irritating. Unfortunately, I have found just one other person that can perceive it, so it must be at the utmost borders of what a human can hear. I have started searching for equipment that can detect the origin of this sound, but after some hours worth of effort I have not come up with much except some postings on this site about array microphones. My questions are: is an array microphone the correct way to solve the problem? which types of microphone / sensors can detect weak, low-frequency sounds? I figure that a high amplification will also amplify noise. are there other ways to locate the source of the sound? Maybe I'm overlooking ways to solve the problem. EDIT: A sensor or other electronic part would help me as well. <Q> Another quick and dirty one is your smartphone with accelerometer in it. <S> Run a FFT to the recordings and you will be able to start locating the source. <A> I had a similar problem in a university I worked at. <S> We used a seismic accelerator, a preamplifier, and a laptop. <S> We tracked the noise down to the chillers on the roof, when both compressors were running they sent a 100hz signal with low amplitude straight through the building like a huge tuning fork. <S> Changing the dampening springs and adding other dampening media removed the symptoms in the end <A> A similar infrasound problem happened in my appartment building. <S> I used a stethoscope on the walls to track the source. <S> It was a centifugal fan in a neighbor's ventilation system. <S> It had not been cleaned for years, and dust had accumulated inside in an asymetric pattern, causing an unbalance in the center of gravity of the rotating part. <S> The infrasound corresponded to its rotational speed, and cleaning it solved the problem. <A> Basically, you use it as a microphone with low impedance output. <S> You can amplify such low frequencies with just about any opamp. <S> Low pass filter the signal with a rolloff in the 100-200 Hz range at each step, with the high pass roloff at 1 Hz or a little below. <S> After a gain of probably around 1000 or so, you should be able to push on the speaker cone with a finger and watch a scope trace go up and down. <S> Be sure to shield everything carefully. <S> You won't be able to easily reject the power line hum frequency, so the better strategy is to keep it from getting into your circuit in the first place. <S> Power <S> at least the first stage of the amplifier from a battery, all mounted right at the back of the speaker. <S> After 100x voltage gain or so, you can send the amplified signal elsewhere, like to a scope you carry around or even one that is plugged into the wall.
A good quick and dirty sensor for low frequency sound is a large speaker used in reverse. Put your phone on the floor and start recording accelerometer recordings.
Why does my AVR act weird (resets, data corruption) when receiving a few bytes on the UART? I have an ATmega644 connected to another device using the UART. After receiving a few characters on the UART the device resets and/or acts weird. Some examples of this behavior: Code before the main loop is executed again but MCUSR is 0 (i.e. no "real" reset) Code inside the main loop is executed even though the switches connected to the inputs were not pressed (pullups are configured properly). Sometimes the MCU just hangs Sometimes ports that were not configured as outputs act as outputs (e.g. LEDs connected to them light up even though the DDR for that port is 0). The device is using an external 18.432 MHz crystal and the UART is set to 19200 baud. It is powered with 5V; the RX pin is connected to a 3V3 RPi. <Q> With 18.432 MHz clock speed the device would require at least about 4.2V to function properly. <A> Intermittent behavior is often the result of missing or insufficient power decoupling caps near yourcontroller? <S> As a rule of thumb 100nF for every pin labeled Vcc, as close to the controller's power pins as possible. <S> While you're at it, it is always good to double check your power rails with a voltmeter (and an oscilloscope when available). <A> This is usually caused by incorrect CKSEL fuses. <S> The ATmega644 needs to be configured to drive the crystal in "Full Swing Oscillator" mode for clock rates higher than 16 MHz; for certain other MCUs this option seems to be a separate fuse bit called CKOPT or CLKOPT <S> In my case using CKSEL=0111 fixed it but the best way to find out the proper fuses <S> is by using a fuse calculator and then verifying the results against the data sheet before writing them. <A> Is it possible that you have connected the RS232 port from the computer directly into the UART pins of the ATmega MCU? <S> The + and - voltage swings of RS232 port would wreak havoc with the proper operation of the MCU silicon. <S> That havoc could result in any of the failure symptoms that you have described. <S> Normally a PC computer RS232 port has its lines buffered through a voltage level translator part that converts them to voltage levels compatible with the MCU. <S> If you do not have this in place then a change in your setup is required.
Even if it the problem with this particular setup was something else (as pointed out by another answer), another common reason is that the controller is being operated outside the "safe operating area" with respect to Vcc VS clock speed.
Control two LEDs with two wires and inverter I have a door sensor (magnetic Hall Effect) that I want to use to build a simple indicator: red LED if closed, green LED if open. Here's the tricky part: I want to run only two wires to those LEDs, and I'd like to do it completely in analog circuitry. Here's the approximate outline: I've tried putting something simple together with BJTs (an inverter, a bistable multivibrator etc.), and I feel like this is the right track -- that there's just one small tweak I need to make -- but I'm stumped as to how to get the voltage to flow. I've done extensive Googling and reading up on tutorials and I've found nothing close to what I'm looking for. How do I get voltage to flow one direction if the switch is closed and in the other direction if it's open? <Q> When using a red and green LED, you can utilize the difference in LED forward voltage as in the circuit below. <S> Make sure to use high efficiency LED's. <S> These have a low internal resistance and a nice and sharp bend in the forward voltage/current curve. <S> simulate this circuit – <S> Schematic created using CircuitLab <S> Normally the green LED lights, which has a forward voltage of approximately 2V. <S> Then when the switch closes, the red LED light and due to its lower forward voltage, approx. <S> 1.8V, the green LED will turn off from (voltage) starvation. <S> If the green LED does not entirely turn off, you can add a regular 1N4148 diode in series with it to make the effect stronger, but this is usually only necessary with cheap and relatively low efficiency LED's. <A> To keep it "analog", you could use two op-amps connected in a bridge-tied-load configuration, but configured as comparators. <S> When one comparator swings high, the other swings low and vice versa, i.e: simulate this circuit – Schematic created using CircuitLab <S> This is how you get the voltage to reverse. <S> If the IN voltage is above VREF, then it goes one way. <S> If IN is below VREF, it goes the other way. <S> Achieving the IN movement between two voltages is trivial. <S> For instance, IN can be connected to your positive voltage via a pull-up resistor, and the switch can be wired to ground IN when closed. <S> A possible refinement would be to give the circuit some hysteresis (Schmitt-trigger behavior), so that it swings positive above some higher VREF1, and swings negative below some VREF0 < VREF1. <S> I put in the LM358 part number, which is a good op-amp for this because it supports single supply-operation well: the inputs can go all the way to the negative supply rail, and below. <S> So if the IN voltage goes to ground, that chip won't have a fit. <S> The current sourcing and sinking ability is not that great; if you only need up to around 10 mA through the LEDs, it should be fine. <A> This might be helpful if you are looking for a pure analog solution without logic gates/relays or integrated circuits. <S> simulate this circuit – <S> Schematic created using CircuitLab Disclaimer: This answer is purely from an academic perspective. <S> Consider that it may be wrong and/or not safe for practice. <S> Any harm caused from building and operating this circuit, including but not limited to electric shock, is the responsibility of the circuit assembler. <A> I bet the idea below can be optimized further, but I don't have time right now to improve it. <S> How about this proof of concept : simulate this circuit – Schematic created using CircuitLab <S> Not the most power efficient solution with the resistive divider, but cheap solution and requires only two leads to the LEDs. <A> It's no different to using a chip to reverse a motor. <S> It's called a H bridge. <S> Here's one that should work: - You'd need an inverter to drive one of the inputs but other than that it emulates a DPDT relay. <A> Here is a solution based on a DPDT relay (long version of Ignacio's comment I guess :-)
You could build this with discrete circuits, but op-amps have the gain for a sharp transition.
How to force the shutdown of the PIC18 I made a simple project, a "Hello World" test. The LED's light up, but when I turn the power off for the PIC18 they still stay on for a few seconds. I want to turn off the power to the PIC18 with no delay; is that possible? <Q> You might consider a comparator for VCC, and when it goes low use an interrupt to bring the program to a quick stop before the power goes totally out, instead of taking your chances with a cold power off. <S> Edit: <S> Might be a bit easier said than done, as Vcc for your comparator would also change. <S> You'd need to use a voltage regulator to generate Vcc from a higher voltage, then monitor Vsupply through voltage divider to keep it in range of the comparator. <S> Alternatively, if this is super-important and the above isn't suitable, you could switch to a microcontroller with better power monitoring tools. <A> You can make an alternative way for the current to passa when you turn it off. <S> As already said, probably you have some capacitors in your board (maybe in the power supply) <S> that holds some charge and whenever you turn the power off, it still supplies some current to the circuit. <S> But it depends on how is your circuit... <S> you should give us more info but that is the pretty basic idea. <S> There are switches with multiple ways. <S> So one thing you can do is to use one way to turn off power and other way to close a circuit/path of discharging the capacitor. <S> Another method you can try is using one way of the switch to turn off the power and the other way to interrupt PIC's supply path. <A> Lot of details are missing from your requirements, but seems that you need some way to actively reset the controller when the power supply is switched off. <S> Here is a concept. <S> simulate this circuit – <S> Schematic created using CircuitLab R1, R2 and C1 must be sized in such a way that during voltage zero crossings the base current is sufficient to saturate the transistor; C2 must be sized such that the power supply ripple is sufficiently small for the regulator circuit; You probably need an inverter stage to invert \$RESET \text{ to } \overline{RESET}\$ to connect it to the \$\overline{RESET}\$-pin of your controller.
You could create some mechanism to open an alternative path for your capacitor to discharge not through the circuit whenever you take off the power.
Is there any micro-controller with ADC > 20 MSPS? Is there any micro-controller with ADC more than 20msps (at least 20msps ) ?? Maximum limit I have found is 12.5msps in texsas instruments C2000 f28335 http://www.ti.com/tool/tmdsdock28335#descriptionArea http://www.ti.com/product/tms320f28335 If not , is there any method to mix more than one channel (ADC) to get higher sampling rate ? <Q> As said by pjc50, typical maximum is around 1 MSPS. <S> But there is some MCU that goes a little higher : <S> STM32F302 series : 2 ADC with max 5.14 MSPS @ <S> 12 bits (each) / <S> 9 MSPS @ 6 bits. <S> And it seems to have an interleave mode between the two ADC to have higher MSPS. <S> http://www.st.com/web/en/catalog/mmc/FM141/FM141/SC1169/SS1576/LN1824/PF253739 <S> NXP LPC4370 goes up to 80 MSPS @ <S> 12 bits : <S> http://www.nxp.com/products/microcontrollers/cortex_m4/LPC4370FET100.html <S> Also check the datasheets, I'm more digital than analog EE. <A> Edit: these are rare but other answers have found them. <S> I'm leaving the paragraphs that describe potential reasons to choose the two-chip solution other than availability. <S> At 20MSPS the analog board design becomes more of an issue than usual. <S> You don't want transient noise leaking from the processor into the signal <S> you're sampling via the power and ground rails. <S> It's advantageous to have them in separate packages. <S> You need a substantial high-speed processor to handle the data and more external RAM to put the results in. <S> So the usual solution here is a high-speed DSP chip with an external ADC. <A>
The new PIC32MZ family of microcontrollers has a 28 Msps ADC. It seems that NXP had some high speed ADC so check out NXP site to find others MCU.
PIC - How to skirt around low maximum ADC input impedance? Reading a 9V battery on a PIC is nothing new . The most simple and straightforward way is with a voltage divider. I'd like to keep the divider resistances cranked up into the hundreds of kohms so I'm not killing my battery unnecessarily, however I looked at the datasheet for the PIC18F4550 and the max "recommended" analog input impedance is 2.5kohms. This means I can stick 2 5Ks for my divider, but 900uA is a lot to waste on just checking the battery. What can I do to my design (passively) to minimize battery drain? I've considered active solutions such as a software controlled pfet or a buffer, but board space and budget are a bit of a luxury, so I'll only do it if I have to. I'm also wondering if I'm I being concerned over nothing. <Q> The reason the ADC needs a low source impedance is because it has a switched capacitor input. <S> Basically, whenever the ADC 'samples' the voltage on the pin, a small capacitor is connected, charged up, and then disconnected. <S> If the impedance is too large, charging the capacitor up will draw enough current to create a voltage drop large enough to affect the reading. <S> If you need to read a high speed signal, the best option is to add an amplifier of some sort to provide a low source impedance to the ADC. <S> However, if you are looking at a relatively slow signal there are a couple of other options. <S> One solution to this is to increase the sample time - the length of time the capacitor is connected to the pin. <S> The chip usually has a limit on how long this time can be, though. <S> This will decrease the amount of droop that occurs when the ADC sampling capacitor charges up <S> as most of its charge will be drawn from the capacitor instead of through the resistor. <A> There are about 4 ways of connecting a voltage divider to an A/D and dealing with max input impedance requirement. <S> Use small enough resistor. <S> This is what the O.P. is already doing. <S> Put an OpAmp buffer between the divider and A/D input. <S> OpAmp should have high input impedance and low output impedance. <S> [As already mentioned by Alex.] <S> Use a larger resistor and add a capacitor from the analog input to ground. <S> [As already mentioned by Alex.] <S> The capacitor should be mush larger than the one in sample and hold. <S> You will be inadvertently making an RC filter, but this still works if the signal is slow. <S> A combination of 10kΩ and <S> 0.1μF worked well for me. <S> [last but not least] Switch off the voltage divider with a MOSFET switch, and use relatively small resistors. <S> This was you can eliminate the leakage pretty much completely when you are not measuring. <S> This is a common technique for battery measurement. <S> Replace R1 and R2 with the values you need. <S> The schematic was originally posted in this thread . <A> To turn it "ON" and "OFF" initialize the pin by writing a logic low to it (and leave it there) then turn the pin "ON" and "OFF" by writing to the TRIS latch which will cause the pin to be either a logic low or high z respectively. <S> The pin will switch from 0 to 2.7V which should be enough to drive a low gate threshold MOSFET.
Alternatively, you can add a decent sized capacitor in parallel with the ADC input pin. Bitrex's idea would work if the PIC digital pin was configured as "open drain" then clamped to 2.7V with a zener to protect it from the 9V.
Measure capacitance in softwire using Tina/Multisim/other simulators Is there a way to measure capacitance of a capacitive network as shown below in Tina-TI, Multisim, or other simulators? I tried searching but I couldn't find any way to measure capacitance directly as compared to the DMM in the simulators. Our professor requires Tina-TI, but if it isn't possible, we'll just ask his permission if our group could use other simulators. We are only limited to DC sources since it is the scope of our course. We also considered using frequency generator or oscilloscope but our professor did not allow us. <Q> Step a DC voltage with a fixed output resistance across the terminals. <S> You should be able to do a transient analysis and estimate the time constant of the exponential voltage rise across the network. <S> Time constant = RC, so if you know R, you know C. <S> If you can't do a step function, you're out of luck. <S> You can't measure capacitance unless something is changing. <A> Please take note that for this project, we were only allowed DC sources . <S> We came to a solution in this problem by implementing what we learned about steady-state response of an RC circuit. <S> As such, we included a resistor and a voltage source in our circuit. <S> Here is one of the circuits we've designed: In Tina-TI 9, there is a Steady-State Solver under the Analysis tab. <S> It will generate a graph on the response of the capacitor during charging and until it reaches its steady-state. <S> The x-axis is time, while y-axis is voltage. <S> Knowing that in each time constant τ (tau) <S> there is a corresponding percentage of input voltage stored in the capacitor, we used the cursor tool to locate on the graph its corresponding time τ. <S> We can then compute for the capacitance since \$C = <S> \fracτ{nR}.\$ <S> Here's one of the tables in our data sheet: <S> Here is the graph as simulated in Tina-TI 9. <A> You could add a sine wave source at the input terminals with a known amplitude and frequency. <S> Run the simulation and find the voltages across and the currents flowing through each capacitor. <S> You can then calculate the impedance of each capacitor by dividing the voltage across by the current through. <S> Then the capacitance can be calculated from that impedance since the frequency is known. <S> The total capacitance of the network can be calculated from the impedance found by dividing the generator voltage by the current through the generator.
As far as I know, there is no direct way to measure capacitance in simulators (e.g. capacitance-meter).
Why does a voltmeter show voltage drop Consider this circuit. What would I get if I measure over R1? It should be less than 12v, right? But then what volatage is LAMP1 running at? Is it still 12v, or is it the voltage I measured across R1? If it's 12v, then why didn't the voltmeter show 12v since it's connected to the supply in the same way as the lamp (IE over R1)? I'm confused because the wiki article on parallel and series circuits states that: If the light bulbs are connected in parallel, the currents through the light bulbs combine to form the current in the battery, while the voltage drop is 6.0 V across each bulb and they all glow. (The wiki article uses a 6V supply instead of a 12V for their example) So what is the voltage drop across LAMP1, and if it is different to the measurement across R1, then why? <Q> That means that the voltage across R1 is equal to V1 or 12 volts. <S> Likewise, the voltage across LAMP1 is also equal to V1 or 12 volts. <S> Thus the current through R1 is <S> 12 volts/100 ohms or 120 milliamperes. <S> The current through LAMP1 is <S> 12 volts/100 ohms or also 120 milliamperes. <S> Note that the current through R1 is the same as the current through LAMP1 because their resistance is the same, not because they are connected in parallel. <S> In a practical circuit, the interconnecting wires would have some small resistance (small compared to 100 ohms) so that the voltage across R1 would be slightly less than V1. <S> The voltage across LAMP1 would also be slightly less than R1 due to the voltage drop in the wires between R1 and LAMP1. <A> Evidently, you don't understand the following: parallel connected circuit elements have identical voltages <S> This is an elementary, fundamental result of ideal circuit theory. <S> According to the schematic you've provided, there is just one voltage present, the voltage across the parallel connected circuit elements. <S> Now, if the physical wires connecting the circuit elements have significant resistance, then you will measure a different voltage across each circuit element. <S> It will also be the case that your schematic does not accurately reflect the actual state of affairs . <S> In other words, it will no longer be the case that the circuit elements are connected in parallel as the schematic suggests; the wires should be modelled as resistors with their resistance shown on the schematic. <A> In this question, you'll measure 12 volts across R1, and 12 volts across LAMP1. <S> R1 will have 12/100 = <S> 0.12 <S> amp's through it, and LAMP1 will have the same 0.12 amps through it. <S> The total current from V1 will be 0.12 + 0.12 <S> = 0.24 amps. <S> I'm not sure why you think there would be less than 12 volts across R1. <S> Referring to the wiki article, R1 and LAMP1 are connected in parallel.
V1, R1, and LAMP1 are connected in parallel in your circuit.
Adding indicator LED to optointerruptor circuit? This question relates to my earlier question on how to wire an optointerruptor: Figuring out wiring of optical encoder I was able to get the optointerruptor working using the circuit below. I wanted to add an LED to indicate sensor state. The blue LED in the image below is what I tried initially. However this doesn't work: the result is that with the LED connected, it will light and show state, but the input to the microcontroller (an Arduino) stops showing correct state. This is totally confusing. Why would the LED interfere what the Arduino can read (as a digitalRead)? I've breadboarded the circuit and it seems to work - but in my actual project it doesn't. As a starting point in figuring this out, is the circuit below wrong? <Q> Check the minimum voltage that will be accros the LED for the current you are giving it, then compare that to the minimum guaranteed voltage the arduino requires to interpret the digital signal as high. <S> You will probably find that the former is less than the latter. <S> As always you need to read the datasheets before just hooking stuff up. <S> A better way to do the indicator is to have the micro produce a separate signal just for that purpose. <S> This will be a separate digital signal, so driving the LED is decoupled from the current and voltage requirements of the detecting circuit. <S> The firmware also doesn't have to exactly mirror the detection signal on the LED. <S> It can, for example, stretch short pulses to some minimum value to make them easier to see. <A> Olin is correct - the LED is limiting the voltage at the output. <S> An alternative to using another I/O line to mimic the output would be to add a PNP transistor using the circuit below. <S> R2 and R3 form the load for the optotransistor (roughly equal to the original 1k0 value). <S> When the optotransistor is ON this forms a potential divider circuit giving a 2V drop (approx.) <S> across R2 (470R). <S> This allows Q1 to be turned ON as a small base current (about 0.3mA) will flow through R4 (4k7). <S> With the optotransistor OFF <S> no base current can flow through R4 ( because there is no voltage drop across R2 ) and so Q1 is turned OFF as well. <S> R5 limits the current through LED1. <S> Depending on the colour of the LED used this value produces a current of a couple of mA. Values of resistance are not particularly critical and Q1 can be just about any general purpose PNP transistor. <A> As usual, Olin is correct. <S> If you're looking for a very simple quick test, perhaps you might prefer the following: simulate this circuit – Schematic created using CircuitLab <S> This circuit dimly lights the green LED when the interrupter is "on". <S> The circuit JIm Dearden shows gives a much brighter and easier-to-see indicator, but at the cost of extra complexity. <A> Edited :In the above circuit the current of the led goes through the opto diode <S> so a better alternative is to use a PNP so that the current of the led doesn't go through the opto diode, this way the led can work with a different current than the opto-diode
You can also try to connect the LED to the input side of the opto, the transistor will be biased by the current flowing through the opto-diode resistor and will turn on the led.
External watchdog reset for AVR required I had a circuit with ATmega644PA and use internal watchdog timer to bring the controller from a hang state to known by a reset. but my code still hangs in some loop somewhere, and causes the system to be non-responsive. So I need to use an external reset source that can work to monitor a pin of microcontroller, if the pin status remains constant for more than, suppose, 60 secs it will reset the controller. In my application code I will provide pulse on the pin regularly. Other suggestions welcome. <Q> I normally prefer to determine the underlying cause of the periodic failures, especially if it's purely software related, but external power management and watchdog solutions are available. <S> They can help remove the possibility of some software conditions causing the watchdog timer to become disabled or being 'kicked' falsely. <S> The first manufacturer that comes to my mind is Maxim and they have a Comparison of Internal and External Watchdog Timers <S> application note that is worth reading. <S> The Datasheet that covers the MAX6746-MAX6753 shows some of their parts available. <S> The reset and watchdog delays for those parts may be changed by an external RC network. <S> If you have software problems you might want to consider <S> the MAX6752 / MAX6753 <S> that have a windowed timer. <S> That means the watchdog will reset if the watchdog is trigerred too fast as well as too slow. <S> If those parts don't seem suitable a search for "watchdog" on Digikey shows many results under the "PMIC - Supervisors" category that may be suitable. <A> Heck, there are some 555 timer circuits that act like a watchdog. <S> And you could always whip up your own on a spare microcontroller. <S> From the prices of watchdogs in the 1+ dollar per 1000 range, a 25 cent microcontroller might be cheaper. <A> Are you really sure <S> using an external watchdog is a good idea?If the hang-ups are caused by the software, I strongly suggest fixing the software. <S> I have had hang-ups caused by not resetting the interrupt flag, make sure you are setting Yours correctly. <S> Also check the reset flags with your debugger. <S> And use the Brown-out Fuses to protect against PSU problems.
Most Semiconductor Manufacturers have Watchdog Timers or Supervisors available.
How do I work out what temperature to use when desoldering? I have a temperature controlled soldering station, and know that I need to set the temperature appropriately for soldering based on the solder I use when soldering, but how do I determine what temperature to use when de-soldering components from a commercially manufactured PCB? So far I have just been using 400°C and been careful not to heat for too long, but searches here on electronics and on the wider web have not been able to tell me how to work out what the ideal temperature for de-soldering would be. <Q> Desoldering in theory should utilize the same temperatures as soldering. <S> Flux present during soldering helps reduce the required temperature. <S> The same is true for desoldering, apply some flux to remove contaminants. <S> The melting point ( per Weller ) for various solder compositions is as follows: <S> Tin <S> /Lead Melting Point °C ( <S> °F)-------- <S> ---------------------40/60 <S> 230 (460)50/50 214 (418)60/40 <S> 190 (374)63/37 183 <S> (364)95/5 224 (434) <S> Please note, these temperatures are melting points, not recommended soldering or desoldering iron temperatures. <S> Most guides recommend starting with the lowest temperature that will work in a short amount of time. <S> This is a matter of opinion, but generally no less than 260°C (500°F). <S> The following factors will greatly affect desoldering performance: <S> The type of solder used (lead-free requires higher temperatures) <S> The age of the board and amount of contamination <S> The number of layers in the board Size of ground/power/thermal planes connected to joint being desoldered Mass of component, leads, heatsink, etc. <S> For example, desoldering a small through-hole component with small traces on a 2-layer board is much easier than desoldering the same component on a multi-layer board with large copper pours connected to the component. <S> A larger component with more mass will require more time or more heat. <S> Think of it this way, <S> if you set your temperature to 370°C (700°F) (a starting temperature recommended by Weller), the mass of solder and copper closest to the iron tip will heat quickly, but it will take some time for that heat to spread. <S> If you are desoldering something with a heat sink or a ground plane, the extra mass will conduct heat away from the area of interest, and you must either apply the iron for a longer duration, or increase the temperature. <S> The danger is that you may damage components if you exceed their temperature tolerance. <S> It does a remarkable job for most things, but I've occasionally needed to preheat a board for stubborn components that have a lot of mass or are connected to a heatsink. <S> Your temperature selection of 400°C (750°F) seems good. <S> You could start at a lower temperature since you have the option, depending on the above factors. <A> I generally start at around 650°F (340°C) for desoldering and work my way up. <S> Wipe your tip on the soldering sponge first <S> (makes it easier to melt) and heat the joint as fast as you can, taking care not to hold it there too long. <S> If it's not working well, increase the temperature slightly and try again. <S> Remember if the temp on your iron is too low to melt the solder, then the person who built the board in the first place probably couldn't melt it either. <A> I have always used 380°C-400°C to desolder. <S> If you struggle with it, just add some of your own solder to the mounted components, always works for me. <S> Of course, SMD components with many pins is a bit harder. <S> With them I just heat the board on my stove and remove them after a while.
Using an IR temperature reader should make you able to adjust this method quite precisely. The Hakko 808 desoldering gun (which I use) ranges from 380-480°C (715-895°F).
What do the capacitors on IN and OUT of an LM7805 voltage regulator? Please understand that i am actually a really beginner in electronics. I found a really nice topic on how to create a 5V DC from a 9v power supply. All is ok. But in order to smooth out ripple, the author use two capacitors in order to smooth values before the voltage regulator, and add another after the voltage output pin. What I don't understand is that the capacitor seems to be placed in parallel with the voltage regulator. Not in serial manner like I was expecting to see. So I really don't understand how you can use the smoothed output values, since in the circuit diagram, it seems that the direct output goes to the ground. I know that when capacitors are in series, you add their values. But the input pin of the voltage regulator seems to be on one terminal while the capacitor is on another. How can the voltage regulator benefit of the capacitor? I know that what I say is plenty wrong, and the circuit diagram is correct. But I can figure out how this circuit is working? Here is the schematic. By the way, do you know where can I find tutorial explaining how to read schematics? There is lot of topic explaining electronics but I haven't found any valuable link for electronic circuit explanation. <Q> I'm afraid you need to review capacitors. <S> I know that when capacitors are in serial, you add their values. <S> Loosely speaking, a capacitor has "infinite" impedance at DC. <S> So, if the capacitor were in series with the regulator output, there could only be AC current through. <S> Thus, the load would not have a DC voltage across, only an AC voltage. <S> This is just <S> the opposite of what we want. <S> When the capacitor is placed across (in parallel with) <S> the regulator output and ground, the capacitor presents a (hopefully) low impedance for AC current through the capacitor and ground, "shunting" the ripple current around the load thus reducing the AC voltage across the load. <S> But, for DC, the capacitor is effectively open so the full DC voltage appears across the load. <S> This is just what we want. <A> First of all, these capacitors aren't there for smoothing the ripple, but to maintain stability of the regulator. <S> You say you're a beginner to electronics, so (for now), just take it as a fact, that they need to be there. :-) <S> The 78xx regulator works roughly this way. <S> There is a bipolar transistor placed between IN and OUT pins in the regulator, you can imagine that as a variable resistor. <S> You could just place a fixed resistor there instead (leaving GND pin open) and calculate its resistance as R = <S> (VIn-VOut)/IOut. <S> The pity is that you generally know neither IOut nor VIn, as both may vary as the circuits works. <S> So you need a mechanism that would set the resistance according to changes of these variables. <S> This mechanism is called negative voltage feedback. <S> There is a complex circuitry in the regulator IC that measures output voltage (voltage between OUT and GND pins) and compares it to an internal stable voltage source (again, for now, don't care where this voltage comes from). <S> If the regulator detects a voltage drop on the output (i. e. you connect another LED on the output), it opens the transistor more, lowering its resistance and delivers more current to the load. <S> When you put the additional load away, the voltage would rise and the regulator closes the transistor, cutting the overvoltage away. <S> An ideal regulator wouldn't require any of the capacitors, but there are some properties of the real circuit design that make it unstable (oscillations of voltage would appear on the output). <S> That's why you need to place a correct cap on both input and output; just follow the datasheet and (important!) <S> place the capacitors as close to the IC as you can. <S> Hope this helps. :) <A> Ladislav had it right. <S> There are situations where a regulator may oscillate, and it has less to do with coupled noise (ex. from long wires) and more to do with the control loop stability inside of the regulator. <S> If you use a regulator that uses a NPN pass element (older/classical style) then you can probably get away with alot of things since it is a pretty stable topology. <S> However, low-dropout (LDO) <S> linear regulators are becoming more popular for good reason and these use a PNP pass element. <S> The topology with a PNP or PMOS pass element requires more compensation to make it stable. <S> You will most likely see oscillations with an LDO regulator if you aren't careful. <S> Here is a great application note: http://www.ti.com/general/docs/lit/getliterature.tsp?baseLiteratureNumber=snoa842
When capacitors are in parallel , their values add Not in serial manner like I was expecting to see.
Simplest way to measure 98 to 140 Ohm range with an ADC? I have a thermistor that should vary between 98 and 140 Ohm and am looking for the simplest circuit that will convert this into something meaningful for a 10 bit ADC in the 0-3.3V range. Precision wise, 0.4 Ohm or so on average would be great, and let's just ignore the nonlinearity issue altogether. I'd rather save some circuitry than shoot for optimal results (and there will be a lookup table). I have (only) +3.3V of input voltage, plenty of current, a dual op-amp that is hopefully useful somehow, and a bunch of resistors and some other crap. Suggestions? <Q> 140Ω / 98Ω is a ratio of 1.43. <S> To get the maximum response with this being one of the resistors of a voltage divider, we want to divide that range in half, which means taking the square root of the ratio. <S> Sqrt(1.43) = 1.20. <S> This means the center value of the voltage divider should be when the thermistor is 1.20 times its minimum, which is also its maximum divided by 1.20, which is 117 Ω. <S> The nearest common value of 120 Ω will be close enough to still give you basically the maximum possible output. <S> So now we have: <S> The R2-R1 voltage divider divide ratio will change as a function of temperature as R2 changes. <S> C1 is there only to reduce noise. <S> You know a thermistor just can't change that fast <S> , so it will reduce some of the high frequency content that you know can't be real signal. <S> In this case, it will start attenuating above around 250 Hz, which is well above what any ordinary thermistor can do. <S> The next step is to figure out what voltage range you will get. <S> This is just solving the divider for the two extreme cases, which are 120/(120 + 98) and 120/(120 + 140). <S> Multiplying these by the 3.3V input, we get 1.82 V and 1.52 V, for a total range of 293 mV. <S> If you just run the voltage divider output straight into the A/D input, then you will be using 8.9% of the range, or about 91 counts. <S> If 1 part in 91 is good enough, then you don't need to do anything further. <S> To get better resolution, you can amplify this signal about the midpoint of half the supply voltage. <S> To bring it to a full scale signal, you'd need a gain of 3.3V / 293mV = 11. <S> It's good to leave some headroom and not force the opamp to go completely rail to rail, so a gain of 8 or so would be good. <S> That would give you lots more A/D counts of the temperature range than the accuracy of the parts can support. <A> A simple voltage divider of which your thermistor would be part should work, though you would not be able to take advantage of your adc's range. <S> If R1 = 120 <S> this would give you a 1.48V to 1.78V range (so 460 to 551 at your ADC's output). <S> If you are just looking for a very simple indicator that could do the job, otherwise I would use an op-amp to expand the signal over the whole 0-3.3V range. <S> simulate this circuit – <S> Schematic created using CircuitLab <A> Taking several readings consecutively will give you a decent average because the noise present on the signal will auto-dither the result ( dithering ). <S> So, it comes down to finding a resistor value from the 3V3 that maximizes your range. <S> Using this method also relies on the ADC's reference being also the same supply voltage to give best accuracy. <S> If you used a 140 ohm resistor from 3V3 to power the thermistor you'd get half the supply across the thermistor and half the ADC span <S> i.e. 512 bits - that's in the order of 0.27 ohms resolution BUT self heating <S> might be a problem. <S> Power in the thermistor would be 19mW. <S> If you don't envisage too much of a problem with that then job done. <S> However if self heat is too much, then go for a 1kohm feed resistor. <S> Now, the voltage across the thermistor will be 0.405 volts and self heating will be about 1.2mW. Resolution will be down to about 126 bits or 1.11 ohms <S> but like I said earlier, using multiple measurements and averaging will be fine.
The simplest way is to use a resistor pullup (or pulldown) matched to the thermistor range to achieve the maximum voltage range output.
Charging phone battery with a high current source I am working on a project which the goal is using some android tablets to show pieces of video file to form a multiscreen. One electronic problem that I have faced is: The tablets should be always on. Currently I am using their own wall adapter which is rated at 5V 2A but when the tablets screen is at 100% brightness their battery eventually depletes. I guess they are not designed for this kind of usage (Google nexus 7). The only solution I could find so far is to reduce the brightness to 30% but this kills the whole idea. So do you suggest me to try another power source for example I have some LED drivers rated at 5V 4A. Is using this rating with the tablet is safe(considering USB cable and port, charging circuitry and battery itself)? Or the battery charging circuitry of the tablet is limited at specified 2A. I really need your opinion before I try to do something stupid! <Q> The actual battery charging circuit is inside the tablet. <S> People call the wall adapter "charger", but that's a bit of a misnomer. <S> The actual charge circuit in the tablet accepts constant voltage DC, which is supplied by the wall adapter. <S> If you present the charge circuit with a constant voltage power supply capable of delivering more current, the charge circuit will not pull more current and charge faster than it does normally. <S> It will just charge as usual. <S> in response to the comment: Here's an example to illustrate: Suppose, you have a charge circuit in the tablet. <S> It's designed to charge the battery from a Supply #1, which is a constant voltage 5V 2A DC supply. <S> Supply #1 can not deliver <S> more than 2A. Charge circuit doesn't not use (or pull, or demand) more than 2A, by its design. <S> Replace Supply #1 with Supply #2. <S> The latter is a constant voltage 5V 3A supply. <S> Notice that it can deliver more current. <S> However, the charge circuit inside the tablet will not use more current and charge faster. <S> It will still use only 2A max, because that's set in its design. <S> If you present the charge circuit with a constant current power supply, you are risking to fry (!) <S> the charge circuit in the tablet. <A> I'll assume a single LiIon or LiPo battery - nominally 3.6V, actually <= 4.2V and as low as about 3V. <S> Some devices MAY use eg 2 cells and 7.2V and use a boost converter for charging, but this is rare. <S> If you are willing to access the tablet battery connections and to possibly use an external charger or even an external battery or power supply then you will be able to run it as 100% brightness continually, subject to cooling issues. <S> See "The easy way" below. <S> If not, then: There are two most likely internal circuit arrangements. <S> Also some variants, but the following two should cover most cases. <S> In one case - power input goes to device always and only via the battery, a higher current power supply will not help. <S> This is because the internal charger is limited to 2A and <S> the path to the device is via the battery <S> so 2A is your limit. <S> In the other case - power supply goes to device proper and battery is charged from this point, a higher current supply may help. <S> This is because the battery is "backfed at 2A max by the supply but there is also a direct path from external supply to device. <S> In ether case it is probable that NO damage will be caused by a higher current supply - but this is not 100% certain. <S> The easy way <S> If you can disconnect the battery and feed the battery terminals with a 'virtual battery' with enough current capability then you should be able to operate the device continually at 100% brightness. <S> Say for discussion that Imax is 3A. <S> If you connect a power supply capable of providing >= <S> 3A at anywhere from about 3.2V to 4.0 V to the battery terminals (~ <S> 3.6V best voltage if selectable <S> ) then the device will see this as a battery and operate correctly. <S> The supply should be able to provide any startup or other transient peaks (if any) and MUST NEVER provide voltages outside the usual battery range. <S> The external supply could be a battery plus a charger capable of sourcing >= <S> 3A. <A> I'm not an electrical engineer, and no I didn't stay at a Holiday Inn Express last night, either. <S> The actual charging current may not be limited by your external charger or by circuitry in the tablet. <S> There is more to this than a simple charging IC on the main board that controls charging. <S> It's software, too. <S> Kernel, specifically. <S> On Android devices you can flash different kernels to them which control things such as max battery charging rate. <S> I'd do a Google search for "Nexus 7 fastcharge Kernel" (fastcharge is one word) and you'll see a few options that include that feature. <S> Here is a link to one that includes the ability to fast charge. <S> http://rootzwiki.com/topic/37755-timurs-kernel-usb-rom/ <S> You must make sure the devices are rooted with unlocked bootloaders, install ClockworkMod recovery and then use it to flash the file at the above link. <S> Read all associated documentation. <S> It will show you how to enable fast (higher current) charging while powered on.
As long as you do not connect power to the device charging input it will see the externally connected power source as a discharging battery.
Can't get a precise reading with PT100 temperature sensor I am trying to get more precise temperature value from PT100 ( 2 wire ) sensor with Arduino. Here's how my circuit looks like : When the sensor is about 20 °C I get a value on A5 pin that is 432 and when the sensor is about 30 °C I get a value on A5 pin that is 440. As you can see this is a very small range ( 432 - 440 ). I want a larger analog signal range, like from 100 to 1000. Maybe I can somehow obtain the resistance of PT100 and with some math formula to get the temperature. What can I do with my circuit to get a more precise temperature reading ? <Q> To get more precise readings, you need to put the RTD into a bridge and use an instrumentation amplifier to develop a larger signal. <A> You can use an external IC that takes care of reading the sensor and then get the result digitally, for example <S> MAX31865 <S> Maybe I could somehow obtain the resistance of PT100 and with some math formula get the temperature? <S> You can find resistance tables in internet , you can create a table in flash and use interpolation to calculate the temperature based on the resistance you get. <A> First of all, If you want to get precision from a PT100, you have to use a 4 wires version not 2. <S> In a 4 wires version, one pair is used to "power" the PT100, the second one is used to measure the voltage drop in the PT100. <S> That way the voltage drop in the cable is minimal: since V=RI <S> and I is almost zero in the measuring pair, no voltage drop. <S> That being said, since PT100 don't need specific wire, it is very easy to convert a 2 wires PT100 to a 4 wires PT100. <S> You also have to make sure the resistor used to measure the current going through the PT100 <S> is a very precise one (like 0.01%). <S> I also suspect you will need a better AD <S> that the one you have in your Arduino. <S> Once you are sure you get precise enough data from your AD, then you will have to use PT100 tables to interpolate values. <S> Newton method is easy to program and gives good results. <S> If you think all this is too complex to handle, then you should switch a to more easier temperature sensor. <S> For instance a NTC would probably work directly on your Arduino, but you will get ~1° precision instead of 0.03° <A> This topic might be a answer for you Measure resistance accurately with an arduino? <S> To calculate the temperature you can use this formula: Resistance thermometer elements can be supplied which function up to 1000 °C. <S> The relation between temperature and resistance is given by the Callendar-Van Dusen equation: <S> \$R_T = R_0 \left[ 1 + AT + <S> BT^2 + CT^3 <S> (T-100) \right] \; (-200\;{}^{\circ}\mathrm{C} <S> < T < 0\;{}^{\circ}\mathrm{C}),\$ <S> \$R_T = <S> R_0 \left[ 1 + AT + BT^2 \right <S> ] \; (0\;{}^{\circ}\mathrm{C} <S> \leq T <S> < 850\;{}^{\circ}\mathrm{C}).\$ <S> Here, \$R_T\$ is the resistance at temperature \$T\$, \$R_0\$ is the resistance at \$0 °C\$, and the constants (for an \$\alpha=0.00385\$ platinum RTD) are: \$A = <S> 3.9083 <S> \times 10^{-3} \; {}^{\circ}\mathrm{C}^{-1}\$ <S> \$B = -5.775 <S> \times 10^{-7} \; {}^{\circ}\mathrm{C}^{-2}\$ <S> \$C = <S> -4.183 <S> \times 10^{-12} \; {}^{\circ}\mathrm{C}^{-4}.\$ <S> Source: <S> English Wikipedia ( http://en.wikipedia.org/wiki/Resistance_thermometer ) <S> I hope it was helpful. <A> I think you need to feed between 7 V and 12 V to the VIN pin of your Arduino and use the AREF pin for one side of the PT100 and the other one to analog in. <S> That might help get a consistent reading but you might still have to do a 4 wire measurement to get it precise. <S> 4 wire kelvin resistance measurement tutorial has a good explanation for 4 wire measurement. <S> You probably sussed it already though. <S> EditYou hook the AREF to arduino 5v or 3.3v and the pt100 from the same voltage to a suitable analog input pin on the arduino. <S> The linear voltage regulators on the arduino board are much more stable than your USB power brick and so will give better accuracy. <S> Arduino Basics (Analog Reference)
You can not get more precise readings with an RTD directly connected to the A/D converter of the Arduino.
Relevance of amperage in a voltage divider circuit I'm not very competent on the electrical engineering, so forgive me if this is a dumb question. I'm trying to make a voltage divider circuit to monitor the battery level of a project I'm working on. It utilizes a 12v scooter battery and will be monitored by an Arduino and I'm going to be using the circuit defined here (also attached below) using the table values for the 15v max voltage to do it. I don't want to fry my Arduino because I cant really afford to replace it. This battery is pretty big; does its amp/hour have any effect on whether it'll fry my Arduino? <Q> You only need to worry about the voltage. <S> The ampere-hour capacity of the battery has no effect on the operation of the voltage divider. <A> Amperage in a voltage divider is absolutely relevant , especially in a battery powered situation. <S> While your setup is a large scooter battery, and this is more relevant to small battery powered design, a resistor voltage divider is still a load, of R1+R2, to ground . <S> Too large a resistor value, and you are wasting power through the resistor pair. <S> At 7.5Ω + 7.5Ω, a 15Ω load, you would be wasting 1 AMP of power. <S> At 1k + 1k, a 2k load, you are wasting 7.5 mA. <S> A 2k + 1k pair is 3k load, 5mA wasted. <S> Additionally, the larger values will need a larger Wattage rating. <S> At 1k + 1k and 15V, you are wasting 7.5mA * 15v = 0.1125 Watts. <S> Since this is through two resistors of equal value, they share the power wasted, 0.1125 / 2 = 0.0565 Watts. <S> A typical 1/8 (0.125) <S> Watt resistor will work. <S> At 375Ω + 375Ω, or 20mA load, each resistor will waste 7v * 20mA = 0.140W, so a 1/4 Watt resistor would be needed. <S> Too low wattage <S> a resistor can burn out. <S> Too large a resistor can waste too much power and catch on fire or burn you. <S> You should choose a higher pair with the same ratio (2/1). <S> A 24k R2 and 47k R1 will work the same, while providing only a 0.2mA load (210 microAmps). <S> The Ratio stays the same (1/3 of Battery Voltage). <S> Unless you connect something wrong of course. <S> The only concern is making the voltage divider too small (can't be read correctly) or too big (drains battery quicker). <A> mAh (milli-amp hours) is just the capacity of the battery, or how long it will last. <S> It has no effect on the power passing out of it. <S> However, any power that is not coming from the arduino should be controlled via a MOSFET or other transistor, because it very well could damage the arduino if more than the 5 volts that it uses passes through it. <S> But amps are just a measure of how much stuff can be powered on your 12/15 volts. <S> If you had it at 0.5 amps, it would definitely be unable to power a scooter. <S> but 9 million amps (just a arbitrary huge number) wouldn't break your scooter or make it explode, because that's just it's maximum capacity. <S> The thing that the arduino needs protected from is the voltage. <A> This battery is pretty big; does its amp/hour have any effect on whether it'll fry my arduino? <S> Lets try to clarify what is and what is not important here. <S> Battery capacity <S> Battery capacity is usually given in amp-hours <S> that's amps <S> x hours <S> NOT amps / hours. <S> This is a measure of energy stored in the battery. <S> It tells you how long the battery can provide a specific current at close to its rated voltage. <S> It isn't an especially good indicator of whether it will fry your Arduino, you can fry an Arduino with a 9V battery which has a tiny capacity in amp-hours. <S> Voltage <S> Arduinos come in 5V and 3.3V flavours. <S> You shouldn't connect to any Arduino pin a voltage higher than the normal supply voltage (Vcc) <S> provided to the Arduino's microcontroller chip. <S> Current <S> If you connected a 5V battery across two Arduino pins you could harm the Arduino because the Arduino pins cannot safely source or sink much current (perhaps 40 mA max typically). <S> Therefore you should take measures to limit the possible current flow. <S> Often a current-limiting resistor is used. <S> Note: <S> Current is measured in amps so some people write "ampage" or "amperage" instead of "current". <S> I personally don't like this usage but it happens. <S> Don't confuse AMperage with Amp-hour capacity - they are very different things. <S> Non-Battery issues <S> You also need to be careful about static electricity and about back-EMF from motors - but these are not characteristics of your battery. <S> Voltage dividers If you use resistors with low resistance (e.g. 10Ω) a lot of current will flow through the divider and be converted to heat. <S> This will drain your battery faster (not an issue for a high capacity battery). <S> This is waste. <S> If you use resistors with a very high resistance value (e.g. 1,000,000Ω = 1MΩ) <S> the current flowing through the divider will be small and any current drawn by your ADC will divert a large proportion of the current and this will distort the operation of the voltage divider.
The voltage that you can apply to an Arduino pin is the most critical battery criteria. But no, the amperage is not relevant to the Arduino's Analog input, or the Arduino itself.
How to amplify and offset the voltage in an opamp? I need to amplify a voltage, which comes from a DAC and is 0-2.5V and scale it 0-25V in an operational amplifier. After amplified, I need to offset it -1.25V, so the final voltage is -1.25 to 23.75V. In other words, being an operational amplifier, I want to do the y=ax+b operation. with a=10, and b=-1.25V I thought of 2 different ways of doing this. The first idea I had is to use a second amplifier as a summing amplifier, with a fixed -1.25V voltage. The second idea is to use a 1.2V zener in series with the output, along with a biasing resistor to -V. Why do I want this? I want to set the ADJ pin in an LM338 voltage regulator from an MCU. LM338 out is ADJ+1.25V. If ADJ is -1.25V then the output is 0V. <Q> You can use a differential amplifier As you can see from the shown equation VR is just an offset and doesn't get amplified so set the resistors for a gain of 10 , connect GND to V1 and -1.25 to VR <S> The reply here shows an alternative solution that doesn't need a 1.25v reference but it needs a negative rail voltage to supply the opamp <A> http://en.wikipedia.org/wiki/Operational_amplifier_applications#Differential_amplifier_.28difference_amplifier.29 <S> Connect your DAC to the positive input and connect the negative input to the power rail. <S> Then calculate the resistor values so that the positive input gets a gain of 10 and the negative input gets a gain of whatever you need to scale it to 2.5 volts. <S> The equations to do so are in the Wikipedia page. <S> I would suggest calculating gain and resistor values for the negative input first, then find the resistor values to get a gain of 10 on the positive input. <S> Also, I would recommend putting a current limiting resistor immediately at the output of the op amp, but before any of the feedback resistors are connected. <S> This will not affect the accuracy of the circuit, but it will protect the op amp in case something goes wrong with the regulator. <A> Great answers as for the suggested analog circuits. <S> However, the main point is missed here - the LM338 voltage regulator does not just output ADJ+1.25V , it needs the feedback from Vout, and just connecting an arbitrary voltage to ADJ will kill this feedback. <S> Digital potentiometer is OK and will keep the feedback. <S> The LM338 cannot regulate an output voltage which is less than its internal reference voltage (1.25V).
Easist way to do that would be to build a differential amplifier.
Opamp operation with "unbalanced" power supplies Usually the way to operate an opamp is to feed a +V and a -V of the same magnitude but opposed polarity. Or, just +V and GND. But now, I need an opamp's output to be In a different range. About -1.25V to +28V. The opamp i have is an MC4558 , which has a supply voltage (max) of ±22V. Can I supply this with, say, -3V and +33V? The configuration I'm using is drawing "B" in this answer: Setting LMC6001 offset voltage Some opamps, like the LM324, say supply can be 0-36 or ±18V. This one only mentions ±22V. It doesn't say 0-44V. <Q> Just beware that all other node voltages change with that decision. <A> It's not uncommon to supply the OpAmp with rails that have different magnitude. <S> The operating conditions * in the MC4558 datasheet are ±20V. <S> It's safer to assume that they meant -20V to +20V. <S> I wouldn't read that 0 to +40V. <S> Of course, there are OpAmps that can work off higher voltage rails. <S> You can also consider boosting the output range your OpAmp with an additional stage made with discrete transistors. <S> Some details here . <S> However, I'm not suggesting that in your case this is more convenient than finding an OpAmp for higher supply voltage. <S> * operating conditions is not to be confused with absolute maximum conditions . <S> Operating conditions imply that the device will meet the specs. <S> Absolute maximum conditions imply that the device will not take permanent damage, but not necessarily perform. <A> The only issue you may run in to is input and output swing limitations. <S> Op amps generally do not work as well near the power rails. <S> How near depends primarily on the design of the op amp but also external parameters such as load resistance.
It is up to you to define 0V somewhere in your circuit and you can change it at any moment. The opamp itself won't notice any difference in -10/+30V or -20/+20V power rails as the 0V is not connected to the device, only to the surrounding circuitry.
How to Wire Up Ultrasonic Transducer I want to use the direct time of flight method to measure the distance between a person carrying an arduino and a certain part of the room. I have come across many different boards which can easily be connected to the arduino to measure distance using the reflecting time of flight method, but because of the nature of my project, these boards won't work for me. I have sourced these sensors: Pair Aluminum Housing 40KHz Ultrasonic Transducer Transmitter Receiver . I am considering buying them, but first, I need to be sure that they will work. I have spent hours searching for instructions on how I can connect them to my arduino, but have had no luck. Can someone please give me some simple instructions on how to connect this thing to my arduino? I basically need one of them on one arduino, which will transmit the ultrasonic wave at certain intervals, and another one on a separate arduino, which will listen for the ultrasonic waves. <Q> See Kerry Wong's article <S> You'll need to create something like the following circuits <S> Personally I'd buy one of the pre-built modules that are much easier to use As others have noted, using separate Arduinos for transmit and receive will make the project much more complex and less accurate. <S> I haven't tried any of the above and can't vouch for it. <S> Polarity is given in the datasheets. <S> sometimes the +ve leg is longer. <A> One way to wire it would be to have the "random object" have a transducer that receives and transmits act as an active reflector. <S> It could be done in analog or digital hardware. <S> When a beep is received it would transmit back a beep. <S> The main unit would almost be a standard distance finder but modified to reduce the sensitivity of the receiver so only the signal from the active reflector triggers the end of the timing, not a passive reflection. <A> Why not have the speaker and the microphone trigger after a radio pulse. <S> Radio travels at speed of light so pretty much instantaneous. <S> Then program the difference between the heard radio wave and the heard ultrasonic wave to be calculated by multiplying the time it takes for the second arduino to hear the sound wave by the speed of sound in air. <S> Gives distance. <S> Will be a much much simpler circuit. <A> Since you already proposed using a radio link for synchronization <S> I suspect <S> the easiest solution for the rest of the system would actually be to just get two of the common inexpensive transmitter/receiver modules that integrate the transmit and receive transducers with driver and receiver circuitry. <S> Make one transmit coincident with (or perhaps better a millisecond or so after) <S> a radio reference pulse. <S> You can simply ignore the receiver output of this one. <S> It probably won't do that without modification, so it may be easiest to trigger it to transmit (and thus start receiving) on receipt of the radio pulse. <S> To avoid accidentally registering a reflection of the unnecessary transmission from this one, you would want to disable it from actually transmitting - for example by removing circuitry around the RS232 level shifter used as a voltage boost, or perhaps simply by removing the transmit transducer or cutting one of the traces going to it. <S> Even putting a lot of tape over the transmit transducer might do the job. <S> This should work, because these modules aren't sophisticated enough to tell their own transmissions apart from others occurring within the receive time window - they use a simple burst of several pulses at ultrasonic frequency, and the detector has only a gentle (and allegedly badly mistuned) frequency response, nothing more specific or correlated to the transmission.
Really your only challenge in the ultrasonic part of the system itself would be starting a receive window without transmitting, which faking a transmission should accomplish. The other one effectively needs to receive without transmitting.
Programming and controlling microcontrollers and FPGA using Laptop (USB port) Formerly laptops had serial and parallel port and it was really easy to connect laptop to micro-controllers and FPGAs. But USB has its own protocol and its not as easy as parallel port to implement different connections. There are some ways to convert USB to other protocols using micro-controller. Is there any good way to go to have protocols easy using USB? Do Programmers make specific cable and USB converter to every single protocol? <Q> I use the FT232 chip from FTDI in my embedded systems. <S> FTDI not only provide the chip but also a driver for it. <S> In your computer the chip will be detected as a good old COM port, just as the old ones with all the handshaking etc... <S> In the controller end the chip outputs TTL RS232, SPI or I2C depending on your choice of chip. <S> If you are looking for parallel access, FTDI also have a USB to parallel chip . <S> The driver can be customized if you want too and is free. <S> It works on Windows, MAC, Linux and Windows CE. <S> Now, if you only want to have a traditional 9-Pin COM port, there are several USB to RS232 converters out there . <A> Regarding the programming you are limited by what your vendor or a third party provider offers. <S> When you consider controlling, USB gives you great new possibilities. <S> Just a quick example: Using a AT32UC3B controller and its built-in USB features I can connect that device to any Windows 8.1 device (both X86 and ARM such as the Surface RT) completely driverless. <S> I make use of the HID protocol for which a USB class driver exists and which I can use easily. <S> This offers things such as automatic error correction. <S> Of course, you can also use Linux with its built-in HID class driver. <S> Please understand that Windows Store applications do not support Serial Ports anymore (which I consider to be a good thing). <A> Some ICs from Atmel <S> an Microchip ( PIC18F2550 ) has the USB ports native. <S> So its just plug and play. <S> This site has some good examples to use ATtiny with the V USB that is a software-only implementation of a low-speed USB device for Atmel’s AVR® microcontrollers, making it possible to build USB hardware with almost any AVR® microcontroller, not requiring any additional chip. <S> And this one with PICs, using the HID (Human Interface Device). <A> For programming an FPGA via USB, I would highly recommend buying a knockoff JTAG cable from ebay. <S> You can get a Xilinx compatible one for about $40. <S> I have a couple of them myself, and they work great. <S> You should be able to get Altera compatible cables as well. <S> In terms of communicating with an FPGA or microcontroller, there are a couple of possibilities. <S> If all you need is really low bandwidth communication, a serial to USB chip such as the ones made by FTDI or Exar are quite good. <S> However, you can't go all that fast with a serial port. <S> If you need a higher bandwidth, you should get a microcontroller with a built-in USB controller. <S> For an FPGA, you can get USB PHY chips that take the USB signal and convert it to a parallel bus. <S> With this sort of a setup, you can use all of the bandwidth that USB provides. <S> Another possibility is to use an FTDI FIFO chip. <S> This looks sort of like a serial port, but the chip doesn't contain a UART, it just takes the data out on a parallel bus. <S> This is far more efficient at utilizing the link bandwidth than a UART. <S> This can be used with either an FPGA or a microcontroller.
If you look for a solution to interface your embedded controller to a computer with only USB ports, I can highly recommend an USB to RS232 bridge chip.
How to receive faint AM light I am going to be amplitude modulating a high power LED light from a peak on a mountain. I want to recieve this faint light as far as physically possible before the light fades out too much to recieve. What is a practical way with high gain to recieve this light to be amplified for a speaker? EDIT:I would like the beam to travel about 2 miles or 4Km from nearby bergen peak visible from my house. Here is a Google Earth image: AS a 15yr old experimenter, my budget is mainly limited to 75 dollars due to all my other projects I am working on. <Q> A telescope (large as possible) followed by a photomultiplier. <S> That will give you all the gain you can handle: you will be able to pick up single photons. <S> Now you have a different problem: ambient light. <S> You want to not recieve this. <S> This is what signal/noise ratio of the channel means in your context. <S> Amplitude modulation will very much limit what you can do to improve this. <S> Note that a continuous light seen at a distance will waver slightly in heat haze. <S> If you're trying to do this in the daytime, your range will be greatly limited. <S> You could also improve results with a laser as a transmitter, even a 5mw pointer, although you then have to align both ends rather than just one while avoiding looking down the telescope with the naked eye. <A> I think the proper term (to be able to search for designs and papers about this) is "free space optical" communication. <S> Many people have already given links, but here is a design for an open-hardware point-to-point FSO link: Ronja Project <S> It's probably more complex than you need if you just want to transmit analog voice, but the analog front-end design might be useful to you. <A> I think you need to provide more details (e.g. wavelength, ambient light levels, distance, budget, etc). <S> In general, I would consider using avalanche photo diodes for detection. <S> They are relatively low noise and provide good gain. <S> You also need a pretty narrowband optical filter to filter out ambient noise. <S> Powering APDs is not too easy since you have to provide a relatively large voltage (100-200V). <S> Also, you may need to do some temperature compensation since APDs are very temperature sensitive devices.
At night with a large LED lantern or multiple-watt CREE light and a small astronomical telescope you could probably get decent results with digital audio over several kilometers.
What are the dangers of cutting PCB with Dremel? I'm cutting PCB's with a Dremel. Works really fine at high speed and with the finest cutting wheel. Can get really nice and clean results. There's a lot of project and dust so I place next to my third hand a large PC fan at maximum speed oriented to the opposite of me, wear protection glasses for projection and a 3M dust mask for dusts. But after the cutting there's still a freaking smell in the room and some dust floating in the air. Are these dangerous? Should I quit and ventilate the room for 15 minutes before continuing to work? I don't know the composition of PCB and I'm asthmatic so... <Q> I found a MSDS datasheet for FR-4 material , which is commonly used in PCBs. <S> Highlights: <S> Machining, grinding or sawing this material may generate harmful dusts. <S> Continuous filament glass fiber is not considered flbrogenic; however, it Is woven from E-Glass fibers which are listed by IARC as "special purpose glass fibers" and designated as "possibility of carcinogenic in human.” <S> Inhalation of copper fumes, while not expected to occur under typical conditions of use, may cause metal fume fever. <S> See Section 8 for exposure controls. <S> The cited section 8 says: ENGINEERING CONTROLS: <S> Use local exhaust when machining, grinding or sanding to minimize exposures and maintain airborne dust and fiber concentrations below occupational exposure limits. <S> PERSONAL PROTECTIVE EQUIPMENT: <S> RESPIRATORY PROTECTION: <S> SKIN PROTECTION: <S> Wear gloves during prolonged contact to avoid skin Irritation from dust. <S> EYE PROTECTION: <S> So, by using a mask and fan, you've likely kept yourself reasonably safe. <S> You might want to consider getting an electronics-grade vacuum cleaner that meets N95 to collect and contain dust that otherwise may escape into the air. <A> Try using a tile cutter instead. <S> A tile cutter is cheap, inexpensive and it cuts the board wet <S> so there is nothing flying around to inhale. <S> Wear gloves too when handling the PCB's. <S> Tile cutters have a guide <S> so you get a perfect straight line every time. <A> A paper cutter cuts PCB dry without any dust. <S> I have a flimsy plastic-y dull-bladed second-hand paper guillotine and even that, although not perfect, is much nicer than a Dremel that I have also tried. <S> A sturdier cutter where the blade does not flex is better. <S> A laminate cutter might work even better.
Use safety glasses or a face shield when machining, grinding or sawing this material. In the absence of adequate general or local ventilation, use a NIOSH-or local authority-approved respirator with at least an N95 filter if exposure limits are exceeded.
How is an XOR with more than 2 inputs supposed to work? I've just started studying computer engineering, and I'm having some doubts regarding the behavior of the XOR gate. I've been projecting circuits with Logisim, whose XORs behave differently from what I've learnt. To me, it should behave as a parity gate, giving a high output whenever the inputs receives an odd combination. It doesn't, though, for more than two inputs. How should it behave? I also read in a book that XOR gates are not produced with more than two inputs. Is that correct? Why? <Q> Most often such an XOR gate behaves like a cascade of 2-input gates and performs an odd-parity function. <S> However, some people interpret the meaning of exclusive-OR more literally and say that the output should be a 1 if and only if exactly one of the inputs is a 1. <S> I do seem to recall that Logisim uses the latter interpretation, and somewhere in my rusty memory I have seen it in an ASIC cell library. <S> One of the the international standard symbols for an XOR gate is a rectangle labelled with = <S> 1 <S> which seems to be more consistent with the "1 and only 1" definition. <S> EDIT: <S> The definition of exclusive-OR as "1 and only 1" is uncommon but it can be found. <S> For example, IEEE-Std91a-1991 gives the symbol for the exclusive-OR on p. 62 with the note: "The output stands at its 1-state if one and only one of the two inputs stands at its 1-state." <S> For more than 2 inputs the standard recommends using the "odd parity" symbol instead. <S> Web sites that discuss this confusing situation include XOR: <S> The Interesting Gate and gate demos at TAMS . <S> A google search will also turn up sites that claim that, strictly speaking, there is no such thing as an XOR gate with more than two inputs. <A> On a two gate XOR the output is high when the inputs are different. <S> If the inputs are the same the output is low. <S> Hence this truth table: <S> You can find a XOR gate that have more than two inputs, but they are not actually a 3 input XOR. <S> They XOR input A and B and <S> the result of them "R" is then XOR with input C. <S> And the result of R XOR C is then XOR with input 4 and so on. <S> Here is a truth table for the three input XOR shown: A simple parity algorithm is XORing bits in a received message over for example Ethernet. <S> If the sender and the receiver know that XORing the message bits should be 0 (one bit in the message is provided to be able to add a one so that a message of any length can be 0 when XORed) <S> then the receiver can know if 1 bit has been flipped. <S> This is a bad parity check as it can only find odd number of bit changes, but shows the concept. <A> If you take 4 inputs and feed two to one XOR and two to another then, take the two XOR outputs and feed them to a third XOR, its output does what you believe it should (I think). <A> XOR is not completly a parity gate. <S> If you define the output of XOR as 1 when one and only one of the inputs is 1 then a three input XOR would give you 0 for all-1 input. <S> This is not used very often and so there are few 3-input XOR-gates. <S> What most people mean when they say XOR is modulo 2 addition which is a parity checker exactly. <S> Most gates labeled as 3-input XORs are in fact modulo 2 addition gates. <S> For two inputs, modulo 2 addition is the same thing as XOR but the 0 from the XOR described above is instead a 1 in modulo 2 gates. <S> Modulo 2 gates with an arbitrary number of inputs can be produced from simple two-input XOR gates. <A> i did a bit of search on seeing your question and found an IC which is a 3input XOR gate. <S> 74LVC1G386 from nxp. <S> the link to the nxp site showing search results for this part number in nxp site is http://www.nxp.com/search?q=74lvc1g386&type=keyword&rows=10 <A> So, I went there and tested! <S> I wrote a small verilog file, simulated and looked at the waveform. <S> It turns out the correct interpretation for verilog <S> is: There is an odd amount of 1's in the input <S> AKA Interpretation 2 of <S> this article module top (y1, y2);output y1, y2;reg a, b, c;wire x1, x2;wire t;xor(t, a, b);xor(x2, t, c);assign y2 = x2;assign y1 = <S> x1;xor(x1, <S> a, b, c);initialbegin $dumpfile("test.vcd"); $dumpvars(y1, y2, a, b, c, x1, x2);#20#10 a = 0 <S> ; b = 0; c = 0;#10 <S> a = 0 <S> ; b = 0; <S> c = 1;#10 <S> a = 0 <S> ; b = 1; c = 0;#10 <S> a = 0 <S> ; b = 1; c = 1;#10 <S> a = 1; b = 0; c = 0;#10 <S> a = 1; b = 0; <S> c = 1;#10 <S> a = 1 <S> ; b = 1; c = 0;#10 <S> a = 1 <S> ; b = 1; c = 1;#10 <S> a = 0 <S> ; b = 0; c = 0;endendmodule
There are different points of view regarding how an exclusive-OR gate with more than two inputs should behave.
Make One Full Power XBox One Adapter from Two Underpowered Adapters Unfortunately, as of this time, Microsoft does not sell XBox One AC adapters. XBox One adapters are almost always single voltage. I'm an expat who has bought a US XBox One and would like to use it in Europe. Since no one can source an XBox One EU adapter from Microsoft, the only other source are Chinese knockoffs that are underpowered. Microsoft US Voltage AC Adapter Specifications:Input: AC 100~127V 4.91A 50/60HzOutput: DC 12V 17.9A (215W), 5Vsb 1.0A Chinese Dual Voltage AC Adapter Specifications: Input: AC 100~240V 2A, 47~63HzOutput: DC 12V 10.83A (130W), 5Vsb 1.0A Can I combine two underpowered adapters, wired up in parallel, to create one full powered source? For both 12V and 5V? What are the risks? Any other options? There's some hope a knockoff will work as is. AnandTech has tested the draw from an XBox One and found that it only draws 119W max, and as low as 69W otherwise. http://www.anandtech.com/show/7528/the-xbox-one-mini-review-hardware-analysis/5 Edit - 16-Dec-2013Thanks for the suggestions about using a stock power supply. Looks like any PC ATX power supply will provide the proper volts at more amps than the knockoffs. They are often dual voltage too. For example: http://www.newegg.com/Product/Product.aspx?Item=N82E16817152019 This ATX power supply has +12V@18A on pins 10 and 11 (yellow wires) and +5VSB@2.0A on pins 9 (purple wire). How do I hook up the ATX power supply to the XBox One's two prong connector? http://www.tinydeal.com/eu-plug-ac-adapter-power-supply-for-xbox-one-p-106421.html (1) Should I bundle multiple ATX +12V wires together or can I use just a single wire? (2) I assume that ATX +5VSB amps, being double the XBox One adapter, is ok to use? (3) I'm making an assumption that the XBox's dual prong plug needs +5V and ground on one prong, and +12V and ground on the other. (4) I can probably wire the XBox One plug to an ATX female to mate with the ATX power supply. (5) What are the caveats and am I missing anything? <Q> Putting two voltage sources in parallel is usually a Bad Idea tm , unless they are expressly designed for such. <S> If these supplies are regulated (and they may or may not be), then each might be slightly different voltages, even though they both say "12V". <S> They can't be exactly the same, due to manufacturing variation. <S> Consequently, if you put two in parallel, one may end up providing all the current and overheat. <S> Without knowing specifically what power supplies you have, we can't know for sure if they will start a fire, self-destruct, simply fail to work, damage your XBox, or work fine. <S> But why bother? <S> It is not difficult to find a 12V, 17.9A or 5, 1.0A power supply, if you look outside the "XBox" microcosm. <S> Why not just buy the right power supply and put the right connector on it? <A> I THINK : you've got to follow the guide to connect the ATX power supply of the ATX to x360 SLIM converter. <S> Which can be found here : http://www.youtube.com/watch?v=brIcxSPUF7Q title : "Repairing XBOX 360 - Part <S> #2 - Powering from PC ATX power supply and taking apart the XBOX!" <S> And when I saw that, and read about the 5v and 12v, I Couldn't <S> but notice how similar the X360 Slim connector is to the XBOX ONE. <S> It seems identical! <S> except it's 135Watt and the XBOX ONE is max 215Watt <S> but like anandtech says it doesn't use all the juice. <S> and it should work. <S> http://www.avforums.com/threads/converting-360-fat-power-supply-to-360-slim-safe.1452242/ <S> You can buy these converters cheaply on ebay. <S> The old x360 fat supply is 203Watt which would be more adequate then the Chinese clones of 135Watt which I find to similar to the 135watt X360 slim Chinese clones. <A> I'd just run the Chinese adapter as is, unless I saw reports that they always burned out quickly. <S> Even if it eventually fails, your XBox won't be damaged, just the adapter; get another, they're only a few bucks. <S> If you really wanted to build something, instead of running two XBox adapters in parallel, look for a single power adapter that has the correct rating (maybe something for a laptop), clip the end, and replace it with the plug for the XBox <S> (I'm assuming the XBox has some proprietary plug, but if it's a standard DC plug you won't even have to do that).
But this also opens another simple fact: If the slim connector is the same as the XBOX ONE, then you can also use an old European X360 fat power supply and put a "Fat to slim converter" on it
What is the voltage across the circuit shown This is the basic simple question. When I connect this circuit there is voltage seen in VM2.According to me, no current flows through R5, therefore there should be no voltage across the resistor, and resistor should act as open. Therefore VM2 should be zero. Can anyone help me why it is like this? Well I appreciate your answers. If I use simple resistor divider with the diode whose forward voltage drop is 0.6V, I am reading voltage in voltmeter as 3.88V. Is this because of any other phenomenon, can somebody please explain. It should have read 2.5V. <Q> Therefore there should be no voltage across the resistor, and resistor should act as open. <S> Therefore VM2 should be zero. <S> An open circuit can have any voltage across with zero current through. <S> However, a resistor can only have zero volts across with zero current through <S> so your reasoning is flawed. <S> But, this is actually a very common reasoning error among those learning electrical circuits. <S> To develop correct intuition, you must check it against the most fundamental circuit laws. <S> First, there's KVL. <S> We can write a KVL equation around the rightmost loop: $$V_{R1} = <S> V_{AM1} <S> + <S> V_{R5} + V_{M2}$$ <S> This must hold. <S> If your intuition violates KVL, your intuition is leading you astray. <S> Second, we have Ohm's Law: <S> $$V_{R5} = 0A <S> \cdot 100\Omega = 0V$$ <S> Also, \$V_{AM1} = 0V\$ since it is an ideal ammeter. <S> Thus, regardless of your intuition, it must be the case that $$V_{R1} = V_{M2}$$ <S> The voltmeter reads the voltage across the resistor R1. <S> To help develop your intuition, think about moving the "top" voltmeter lead to the leftmost terminal of R5. <S> I think it is clear that the voltmeter will read the voltage across R1. <S> Now, since there is zero volts across R5, the voltage reading on either side of R5 must be the same . <S> In other words, moving the voltmeter lead back to the rightmost terminal of R5 should not change the voltmeter reading at all. <A> As a resistor it obeys Ohm's law, V=IR. <S> If I (the current through it) is zero, then V (the voltage drop across it) <S> is zero. <S> As no voltage is dropped across R5, the voltage measured by VM2 will be the same as the voltage across R1. <A> According to me, no current flows through R5, therefore there should be no voltage across the resistor (R5) <S> and resistor should act as open. <S> Therefore VM2 should be zero. <S> That is the wrong part, when you have a resistor and you connect a voltage in one side of it then if there is no voltage drop across it <S> (like in your case because no current flows) there is no alternative but to have the same voltage in the other side of the resistor too, the voltage can't disappear. <S> This can be explained mathematically by Ohms law <A> We make the usual simplifying assumptions here a current meter has zero resistance and a volt meter takes no current. <S> R5 therefore has no current through it <S> so there is no volt drop across it. <S> The voltage as measured by VM2 will therefore be the same as if you were to remove AM1 and R5 and measure directly across R1. <S> This is a simple potential divider the voltage is thus: $$V2 \cdot \frac{R1}{R1+R2+R3} = 5 <S> \cdot \frac{100}{300} \approx <S> 1.667 \text{ volts} $$
R5 is a resistor and always behaves as a resistor, not an open circuit. That is correct, the voltage drop across a resistor increases as the current that flows through it increases, when the current through it is 0 then the voltage drop across it will also be 0.
How to identify areas of a FPGA design that use the most resources and area? I am working on a large FPGA design, and I am very close to the resource limits of the FPGA that I am currently using, the Xilinx LX16 in the CSG225 package. The design is also almost complete, however at the moment it will no longer fit in the FPGA. I can turn off parts to get it to fit, however I need to reduce the resource usage in order to complete the design and have it meet timing and size requirements. I would like to know if there are any tools our reports that can help me identify which parts of my design are consuming the most resources. My design is not partitioned, and is split over about a dozen or more VHDL modules. Xilinx timing reports are fantastic, but now I need to know where I can get my best bang-for-buck in terms of space saving. I also have a hard time telling which type of resources I'm running out of, or what effects those resources. Another annoyance is that as the design gets larger, components that used to meet timing are starting to fail because their placement is no longer as ideal. Currently, I use the Post-Place and Route Static timing reports, and I use SmartXplorer. I'm using design strategies to optimize for timing. After turning off part of my design to get it to fit, here are some of the results: slice register utilization: 42%slice LUT utilization: 96%number of fully used LUT-FF pairs: 38%Does this mean I'm light on registers, but heavy on gate usage? Are there tools to help developers optimize for area, or at least give them more insight into their code? Update: After looking at the Module Level Utilization, I found out that I had small glue async fifos all over the place that take up about 30% of the total LUTs. I am using them as cross-clock-domain glue for high speed buses. I should be able eliminate these, since the clocks are tightly related. (120 MHz input, produces 100 MHz and 200 MHz through DCMs) <Q> I cross posted this question on the Xilinx Forum here: <S> http://forums.xilinx.com/t5/Implementation/How-to-determine-what-part-of-the-design-consumes-the-most/td-p/393247 <S> This answer is largely based on the comments there. <S> Thanks to Deepika, Sikta and Gabor. <S> Then, open the Design Summary, and navigate to Module Level Utilization. <S> Here is the complete hierarchy, showing exclusive and inclusive design utilization. <S> Each line will show a number pair like 0/5392. <S> This means that that module contains zero of that specific element, but that module and all of its sub-modules contain a total of 5392 elements. <S> Here is my output (partially expanded) <S> When working on reducing the size, Gabor recommends switching to a larger FPGA in the synth tools so that it can completely map even when it's too large to fit in your current FPGA, and it will make the tools run faster. <A> Looks like you are using up almost all of the logic resources while only using half of the registers. <S> It looks like you need to figure out what is eating up all of your LUTs. <S> There are ways to optimize particular components and make them a bit more space efficient - things like RAMs, shift registers, and state machines. <S> Look at the resulting .log <S> file from the synthesizer. <S> It will tell you what sort of components are being inferred. <S> Make sure that it is inferring components properly. <S> If it isn't, it may not be generating a particularly efficient netlist. <S> You can tell a lot just by looking at the synthesis log files. <S> It's possible a few minor changes to your code will allow the syntheizer to infer various components, so take a look at the synthesizer manual for some template. <S> You may need to switch the synthesizer over to optimize for area instead of speed. <S> Also, check to make sure you don't have any infer settings turned off. <S> I once tried to synthesize a design component that consumed 40% of a Spartan 3E 500 <S> (9,312 4-input LUT/FF pairs, 5.6 KB block RAM) for a Virtex 6 HXT 565 (354,240 6-input LUT/dual FF pairs, 32 MB block RAM). <S> It took 7 hours for Xilinx par to finish and took up about 40% of the chip. <S> ?!?!?!? <S> Turns out <S> infer block RAM was turned off, and the synthesizer turned several KB of RAM into LUTs. <S> Not the most efficient decision ever. <S> After changing the setting, it took up like 1% of the chip. <S> Go figure. <A> It would be worthwhile posting the whole 'resource usage' section from the tool output. <S> Do you use all of the Block RAMs? <S> It's common to be able to replace logic/math functions with equivalent RAM look-up tables if the domain is sufficiently restricted, and they are of sufficient complexity to be worthwhile pre-calculating. <S> As well as the inference of memory, the same applies for Multipliers. <S> Sometimes a tiny deviation from the recommended instantiation template can throw out the multiplier being inferred to DSP48A units. <S> If you are using the PCIe controller, can you reduce the total buffer space reserved for TLP payloads, or the maximum TLP packet size? <S> This can reduce the RAM/logic usage of the IP core at the cost of though-put/total bandwidth. <S> With (Altera) Quartus <S> , you can multi-select items in the design hierarchy view and see there <S> post-p&r area usage colour coded/clustered. <S> This can give a visual idea of the relative usage of your design modules.
First, enable 'Generate Detailed MAP Report' in the map process properties (-detail).
Why isn't my SysTick_Handler() being called in my LPCxpresso C++ Project? I have created a C++ project for an LPC1227 using LPCExpresso 6.1.0. The project, up until now, builds and runs fine. I have not made any changes to cr_startup_lpc12xx.cpp . I would like to add a SysTick_Handler() . In my main.cpp I have added a method: void SysTick_Handler(void){ timerCounter++; // these variables are all declared globally in main.cpp timer_10ms_tick = true; if ((timerCounter % 10) == 0) //every 100ms { timer_100ms_tick = true; } if ((timerCounter % 100) == 0) //every 1000ms { timer_1000ms_tick = true; }} I have also add the following line in my main() method: SysTick_Config(12000000/100); When I run my code via debug, the interrupt is firing, but it is getting stuck in the default SysTick_Handler() that is inside of cr_startup_lpc12xx.cpp (which is just an infinite while loop). If I delete the default SysTick_Handler from cr_startup_lpc12xx.cpp , my program hard faults. I have looked at the Blinky example (which is C, not C++) and it adds a new handler into main.cpp without deleting the handler from the startup file. Can anyone suggest why my overriding handler is not being called? Is this a C++ difference? <Q> From https://rowley.zendesk.com/entries/20986562-LPC1114-IRQ-Handlers-in-C-work-in-C-do-not-work <S> You need to declare your interrupt handler as a C function <S> otherwise the function will not override the default handler. <S> So for example you could do something like the following to make the declaration work in both C or C++: <S> #ifdef __cplusplusextern "C" {#endifvoid irq_handler();#ifdef __cplusplus}#endif <S> I assume changing irq_handler <S> () in the code above to your SysTick_Handler code will then work. <S> e.g. extern "C" { void SysTick_Handler(void) { timerCounter++; // <S> these variables are all declared globally in main.cpp timer_10ms_tick = <S> true; if ((timerCounter % 10) <S> == 0) //every 100ms { timer_100ms_tick = <S> true; } if ((timerCounter % 100) == 0) //every 1000ms { timer_1000ms_tick = true; } }} <A> I don't know if this is true of C++, but in C the default handler must be declared as a weak function in the default declarations. <S> This allows another declaration to override the original one, so your custom handler should not have the weak attribute. <A> I had exactly the same problem once. <S> Looks like the maintainers of LPC support libraries did not care for C++ developers. <S> Full answer is here Bug in Keil ARM compiler with interrupt handlers and C++?
Yes it is C++ vs C difference.
Could 8V of power be safely put onto the 3V3 input of an Arduino Uno? I have permission to access a (borrowed) Arduino Uno, and the documentation says it can be powered with 3.3 Volts from the 3V3 pin: 3V3. A 3.3 volt supply generated by the on-board regulator. Maximum current draw is 50 mA. http://arduino.cc/en/Main/arduinoBoardUno However, I would like to use a 24V DC power source. The safe range is supposed to be 6V-20V. If I could get a transformer in place to change the 24V DC to 8V DC, could I apply that 8V to the 3V3 input (without frying the board)? <Q> The schematic clearly shows the AVR powered from 5 volts. <S> According to that page, the board can be powered by 5 volts from USB, or by an external 6 - 20 volt DC supply. <A> Connecting anything much above 3.3V (as in say 3.6V) to that rail would fry the Arduino. <S> A transformer only operates with AC voltage not DC, so the best way for what you want to achieve is a step-down regulator also known as a buck converter. <S> Variable ones that can accept 24V DC and output 3.3V (be careful to adjust it before connecting) are available on e-bay. <S> Here's the first example I found: DC Adjustable Voltage Buck Converter 4.5-25.5V to 3-24V Step-down Power Module <S> But important: <S> I'd taken at face value that your statement was correct that it was OK to power the board from 3.3V over that line. <S> As Peter Bennet correctly states some parts are actually 5V based and the 3.3V rail is the output of a regulator. <S> Without removing the regulator and knowing the exact consequences that isn't a good idea. <S> Instead you should consider setting the regulator for say 8V and connect it to the 6V-20V input socket on the Arduino where you'd normally apply an external power supply / wall wart etc. <S> That gives you a bit of extra safety if the adjustment on the regulator ever gets changed or drifts a bit. <A> The board has a power supply input named X1 , <S> the voltage that is connected there goes through a NCP1117 regulator to generate the 5v supply that feeds the 5v parts and the 5v supply is then fed to another regulator LP2985-33 that outputs the 3.3v in order to supply the 3.3v parts <S> Apart from that, there is an available input that is intended to supply the board from the a USB cable (5v) <S> According to the board specs for the supply input X1 Input Voltage (recommended) <S> 7-12V <S> Input Voltage (limits) 6-20V <S> The high input voltage limit of 20v is forced by the maximal input voltage of the NCP1117, a higher voltage would damage the regulator. <S> Basically you can only connect voltages to two points, one is the USBVCC which i intended for regulated 5v supply (from USB port or 5v wall supply) and the other one named X1 where you should connect a supply that is between 6v-20v and which is where you should connect the 8v or 12v (referring always to DC voltages) you talk about. <S> There is no 3.3v input.
There is a warning that the on-board regulator may overheat if the external supply is above 12 volts, and may be unstable if the external supply drops below 7 volts (so it should really be spec'd for 7 - 12 volts, not 6 - 20, in my opinion.). According to the Adruino info page, and to the schematic linked there, the 3.3 volt terminal is an output from an internal regulator, and cannot be used as an input to power the board.
Calculate rated power(P) of transformer? I have a transformer-type PT 13/2/6 as the following page (Versions 34 to 37 from 68). Image like this: The voltage between points A and B is V AB (primary)= 230 vac The voltage between points C and D are V CD (secondary 2) = 6 Vac The voltage between points E and F are V EF (secondary 1)= 6 Vac I have 2 loads, first load 5VDC/2.5A put on EF and second load 12VDC/1A put on CF(DE shorted). My question: How much total power do I need? Is power rate 13VA enough? <Q> No - you cannot reasonably expect to do what you are trying to do. <S> You are attempting to draw more power from the transformer than it is designed for and MUCH more power from one winding than it is designed for. <S> I have 2 loads, first load 5VDC/2.5A put on EF and second load 12VDC/1A <S> put on CF(DE shorted) <S> I'll take the VA rating as the same as DC Watts drawn - close enough in this case. <S> 5V <S> x 2.5A = 12.5 Watt 12V x 1 <S> A = 12 Watt. <S> The 5V load is all on winding EF . <S> The 12V load is 50/50 on CD and EF. <S> So CD load = <S> 12W/2 = <S> 6W. <S> The EF load is 6W + <S> 12.5W = 18.5W. <S> A transformer with two identical secondaries is usually designed to allow a maximum of about 50% of total power to each. <S> You can unbalance them slightly but if you take all power from one winding you'll usually get extra losses and possibly transformer failure. <S> Here each winding is rate at about 13 VA/2 = <S> 6.5 VA each. <S> You are trying to draw 6W from one winding <S> (= OK) <S> and 18.5W from the other (about 3 x overload). <S> Overall you are trying to draw 18.5 W from a 13 VA device ~= <S> 40% overload. <S> You need a larger power rated transformer or smaller loads. <A> As I read the datasheets, the total rated power output of the transformer is 13 VA. <A> At points E and F the power for a given load is one quarter of what it will be for the same load placed at C and F. <S> It's one-quarter because the voltage is half and power is proportional to voltage squared. <S> This is a slightly simplified explanation that doesn't consider the transformer's inability to proportionally regulate the output voltage when more power is being taken. <S> So, with this simplified explanation and assuming the same value load is connected to EF and EC, for a transformer that is 13VA (assuming this translates to watts exactly), the power at EF is one-fifth of 13 watts = <S> 2.6 watts whilst <S> the power at CE is four times more at 10.4 watts. <S> Both add to 13 watts.
All transformers in the PT13 series are rated at 13 VA, regardless of the output configuration.
Exact recreation of Xilinx FPGA binaries from source control I'm software developer in a small shop where there's only been one EE guy responsible for a series of FPGA designs spanning a decade, almost all of which target the Spartan line, specifically the XC3S5000. I'm looking for the community's opinion on some of the EE guy's assertions which I find hard to believe: 1.) Many builds must be created and tested (without changing the input files) because a particular binary often fails testing due to "timing issues." (verbatim) Me: Is frequent failure of an FPGA design expected and this incredibly slow process considered normal? I can't imagine repeatedly compiling the same traditional software development language and hoping the output will be right *this time*. The HDL seems underspecified if this is the case. 2.) Because the creation process is subject to "random" algorithms (I assume this is placement and routing) it is "very hard" to recreate the binary from just the input HDL. Me: Surely there is an initial seed provided to this pseudo-random algorithm which can be queried after a successful build? The exact good binary could then be recreated using the seed later. This seed could optionally be checked in to source control. 3.) Because the Xilinx-provided tools may change (be upgraded, etc.) even if an exact recreation is possible from a known good seed and the old tools, a new set of tools may create a binary which fails testing. EE guy doesn't see any use in investigating how to find the random seed used for a build, and how to provide it to a rebuild. Me: How likely is a build to break upon introduction of new tools? 4.) The binary build process disallows any post-build manipulation of the bytes of the binary due to checksumming and the inability to write to a known offset into this binary. Me: You can't embed information into an existing binary? 5.) He insists on checking in both the final product and NGC files. Me: Is there ever a reason to store NGC files? Notes: *FPGA binaries will eventually be stored in a different place, but definitely not in a text-centric version control system. *We use a fragile version scheme to query what FPGA is currently running in our system. It is useful for software to work around hardware bugs by checking if the FPGA is of a certain version.We can read both a monotonically increasing 16-bit number and a build date from the FPGA, but these numbers don't sync directly with the version control system in which the binary is checked in. *I've looked over the following questions already: What files/directories are needed to recreate a Xilinx PlanAhead project? List of Xilinx file suffixes (for ISE) <Q> I used to work in a job that had a contract <S> requirement that we could reconstruct our integrated circuit designs and simulations for twenty years . <S> That was a battle we fought over and over again, so I have had some experience with the painful process of "archiving" a complex design. <S> 1) <S> If the design has tight timing constraints then it may be necessary to synthesize/optimize a number of times before all of the timing issues are uncovered and the timing constraints are "fully and correctly specified" as Dave Tweed puts it. <S> This is particularly true if you incorporate any third-party IP, or if the person doing the synthesis is not the author of the HDL. <S> 2) <S> While the synthesis process is deterministic it is also subject to a vast number of variables. <S> Some of these are hidden from the user. <S> While I would say you should be able to get the same binary if you run exactly the same tools on the same computer on the same HDL with the same constraints on the same day, I would be hesitant to <S> guarantee that any given binary could be reproduced exactly next week. <S> 3) <S> This is most certainly true. <S> New versions of the design tools routinely break existing designs. <S> It's not about some seed for a random number generator, it's about changes in the optimization algorithms and changes in the characterization data of the physical part. <S> Because these changes are proprietary information they are largely hidden from the user and can appear to have a random nature. <S> 4) <S> This is typically true. <S> The binary bitstream is the end result of the entire synthesis and optimization process. <S> Most vendors hide the format of this data and may even encrypt it, which is why you can't find open-source FPGA design tools that go all of the way to the chip. <S> 5) Is there ever any reason to store the NGC? <S> I'll turn that around: can you justify that there is no information whatsoever in the NGC that cannot be obtained from whatever you are calling the "final design"? <A> It sounds like your "EE guy" has inadequately specified the timing constraints for the design tools (in the .UCF file), if some runs meet timing and some do not. <S> All of his assertions that you cite appear to be workarounds for this situation. <S> When the timing constraints are fully and correctly specified, the Xilinx tools will work as hard as necessary to make sure they're met (including margins to account for variations due to process, voltage and temperature ). <S> Yes, successive runs will be different in minor details because of the randomness used in the optimization process, but every run that completes will either meet timing, or the tools will explicitly tell you where there was a problem. <A> Issue #4 may or may not be true, depending on the unspecified precise needs and circumstance. <S> Xilinx provides the Data2MEM tool which can change block ROM contents of a compiled bitstream - something often useful for updating software for a built in processor, or tables/keys. <S> However, it is not compatible with the encryption and compression options. <S> And it isn't of use for anything that is not a block memory. <S> (Last I checked - which was a few years ago <S> - Altera did not have an equivalent, meaning you really did have to rebuild those designs to change block memory contents) <S> For most of the other issues (irreproducibility of precise binary at least across build environments and toolchain version changes, toolchain version compatibility issues), your engineer likely has a valid point. <S> You might find it very informative to try some simple FPGA projects to get an idea of how different this is from developing for a stored-program computer, especially if you are used to open source toolchains.
I would agree issue #1 could be incomplete usage of timing constraints, though perhaps only if your requirements are reasonable for the hardware, vs only met in lucky cases.
Logic level converter for H-bridge and UART for Raspberry Pi Here is my situation: I'm using a raspberry Pi to control a H-Bridge. The H-Bridge is not tolerant of both it's inputs being high logic value, which causes a short through the transistors, bypassing the motor. Because the H-bridge requires a 5V input, I slapped together this disaster: Getting rid of floating input in a logic level converter Now, as i understand, that circuit sinks current to the RPi, which is not only dangerous, but also crashes the Pi. Not only that, but the RPi boots with the output pins floating, which causes the logic level converter to output 5V, shorting the H-bridge as mentioned. At, first I got around the issue with having a manual switch disconnect the H-bridge until I could set the RPi pins as outputs, the current sinking was tolerated. Now, I connected UART also through this converter(TX) and a voltage divider(RX) and it just crashes the Pi-s UART, I think it is because the RPi cannot handle sinking that much current. (UART works fine if motors inputs from the RPi are disconnected) I need a schematic for a 3.3V to 5V logic level converter that acts like this: 1. on floating input, outputs 0V 2. does not sink to input3. uses PNP and NPN transistors4. is relatively easy to build I'm assuming a voltage divider is fine for dropping the RX line from 5 to 3.3 <Q> Uh, I'm not entirely clear on the issue here. <S> You do know you can simply apply a static pull-down directly on the raspberry pi IO pins? <S> The rPi can easily drive a few kilo-ohms load. <S> Just tie the output pin to ground with a ~5-50K resistor. <S> That way, when the pi isn't set as an output, the pin will be pulled to ground, and when you do set the pins as an output, the output driver can just overpower the pull-down, and it'll work as normal. <S> For that matter, what H-Bridge are you using? <A> You probably want a 74HCT125 buffer circuit. <S> It has a separate "enable" from the "data" value. <S> Thus, you can make it so that it doesn't go "enable" until you decide it should do that, with a weak pull-up for example. <S> The HCT version accepts anything over 2V as "high" even when you feed it a 5V VCC. <A> This does not directly answer the question, but you could avoid the dangerous input configuration that shorts the battery contacts through the transistors by using the control logic from this H-Bridge . <S> The trick in this h-brigde is that it cleverly uses 3 control signals to turn on the diagonal transistors (to move the motor forward and in reverse) without ever letting you turn both vertical transistors (both left, <S> both right or all four transistors) at once, preventing you from shorting the battery contacts. <S> The h-bridge I mentioned also uses optocouplers between the logic and bridge circuits, which might also help with the level logic conversion.
The common L298 will work fine with 3.3V logic-level inputs, it's probable that the bridge-driver you're using will probably also be fine.
Input current of linear regulators I have a basic question about the linear regulators (eg.MC7912CT).If the output current of the regulator is 1A, what would be the input current? Is it still 1A or less? <Q> The 7812 is a linear voltage regulator and this usually means that the input current is largely determined by the output current. <S> Input current will be a few mA higher due to the chip using current internally to power its circuits, 4mA from memory. <S> So if the output current is 1.000A the input current might be 1.004A. A switching regulator is more efficient at delivering power and, for a buck regulator, the input current is usually less than the output current. <A> In case a picture helps you understand, here is a simplified schematic for a linear regulator. <S> Notice that the only path for current to the output is directly from the input through the series transistor. <S> The input current will be a bit higher than the output current -- <S> the difference being the current drawn by the internal sense/drive circuitry. <S> simulate this circuit – <S> Schematic created using CircuitLab <S> Even though the input current is only slightly higher than the output current, the input power is significantly higher. <S> The power dissipated in the pass transistor of the linear regulator is equal to \$I\cdot(V_{in} - V_{out})\$. <A> Is it still 1A or less? <S> The output current cannot be more than the input current. <S> To be sure, your question appears focused on series linear regulator ICs. <S> In this case, the input current consists of the sum of the output current and the relatively small current required for the active control circuitry to operate. <S> However, and for completeness, there are shunt linear regulator ICs such as the TL431A <S> where the input current can be considerably and perhaps much larger than the output current. <S> This is due to the fact that regulator works by shunting input current around the load.
So, the input current is generally only slightly larger than the output current.
Controlling DC brushed motor for dummies, please First, let me explain that I know very little of electronics. Thus, please, forgive me if I am asking something very obvious or abstract. I have tried to Google this but I am obviously not using the right words as I find very little. The problem: I have an auto-pilot that is supposed to control a hydraulic pump for a ram which will actuate a rudder. Well, I would like to use an electric 12 vDC brushed motor to control such rudder instead of the ram. The motor has a reduction and is connected directly to the output power for the hydraulic pump, which is 12 vDC, up to 25 amp and reverses the polarity when it needs to actuate in different directions. It works more or less and I would like to get rid of the 'less'. Is it possible to have an interface between the output of the autopilot and the motor? ...so that: It fades the voltage of the output. When the autopilot decides to apply power to the motor, it does it straight away. I would like to have some dumping on it so that the motor starts and stops smoothly. I have put some capacitors attached to the motor but am not sure is doing much; probably just absorbing peaks and filtering noise? It brakes the motor when there is no voltage applied (by shorting it?) So, when the autopilot does think that the rudder is in the right position and does not provide power to the motor, the motor cannot spin freely. In short, the power is 12VDC and reverses on demand of the autopilot. The motor is 12 VDC and there is no need to alter voltage or amp in the power. I have seen many motor drivers but I believe there must be something simpler? This one can do what I want but I would then need to transform the -12/+12 output from the autopilot to 0/2.5/5 in order to use the analogue input of the driver. I am sure it must be simpler than this. I obviously appreciate very much a full solution but I am very much willing to do my homework. Please, any advice or heading so that I can research further in the right direction? Edit:It seems I didn't explain well.The autopilot is a controller and is fed by many sensors -heading, rate of turn, wind, rudder angle, GPS. It basically can follow a track or maintain a heading compensating for any forces. The problem is that it controls the rudder with a +/- 12 VDC, which is actually activating a DC motor is both directions. What I would like is to improve that signal and brake the motor when there is no current out of the autopilot, by shorting the motor I guess, and to apply those +/- 12VDC progressively, let's say with a period of 1/4 of a second, so that the motor starts and stops smoothly. Added: For a soft start. Could I use a simple circuit with a resistor, a capacitor and a MOSFET? Initially, the MOSFET is off and the current goes through the resistor, once the capacitor is charged, the MOSFET turns on and the resistor is bypassed. And for braking it. Could I use a high power resistor in parallel with the motor controlled by a MOSFET? <Q> You first have to decide what signal exactly the autopilot is producing. <S> Is it something that says go <S> more right or go more left , or is it saying go to this rudder position ? <S> Note that one is the derivative of the other. <S> In either case, it sounds like you need a real control system, not just something that applies power to the motor sometimes. <S> You should probably implement a rudder position controller, then either use the signal from the autopilot directly or integrate it, depending on what it actually is. <S> The position controller will apply whatever current to the motor to maintain the required position. <S> If it doesn't take much torque, then little current will be applied. <S> If the rudder is at one end of travel and there is a lot of back force on it, then the system will automatically apply more torque. <S> The point is, what you really care about ultimately is rudder position. <S> So control that, then use whatever signal you get to adjust the desired rudder position. <S> On a separate topic, someone who "knows very little about electronics" shouldn't be messing with a flight control system. <S> You have no business being in there. <S> If you want to kill youself, that's your business. <S> But it's my business if you want to do it in a airplane because I might be underneath when it comes crashing down. <A> I would then need to transform the -12/+12 output from the autopilot to 0/2.5/5 <S> in order to use the analogue input of the driver. <S> I am sure it must be simpler than this. <S> Nope, that's what it appears you'll have to do. <S> You'll need a small circuit interfacing the +/-12V signal and producing an output that is 2.5V+/-2.5V. <S> This is probably best not done with resistors alone - use a rail-to-rail op-amp (possibly AD8605) powered from the auxiliary 5V supplied by the proposed motor controller and devise a circuit that takes the +/-12V from the autopilot and produces the required output. <S> Alternatively you can use a couple of small 12V relays - one driven by the positive 12V and one driven when it goes negative to do the business. <S> This might be easier if you are not confident about using op-amps. <A> What you seem to be describing is a servomotor . <S> You need a goal (rudder at 5 degrees) and a way to measure the current state (rudder at 2 degrees) <S> so you can calculate the error (3 degrees). <S> Then through some algorithm, frequently a PID controller , generates control inputs (motor voltage) based on the error. <S> Or, you can buy motors with the sensors and feedback mechanism included. <S> Another option without feedback is a stepper motor . <S> These are motors that move in predictable, discrete steps. <S> You know where the rudder is based on knowing where it was in the past, and how many steps you have commanded it to move sense them.
You can make a servomotor yourself with an ordinary motor and a microcontroller or discrete electronics.
Why there is reduction in voltage after diode? I have used simple resistor divider with the diode whose forward voltage drop is 0.617V as shown in figure. I am reading voltage in voltmeter as seen figure. Can anyone explain me why it is like this? I am expecting no drop across diode. <Q> What The voltage drop is a fundamental characteristic of forward-biased doped-silicon semiconductor junctions. <S> There are diodes with a smaller voltage drop but all diodes will have a voltage drop. <S> You can look at a graph of diode characteristics but all this tells you <S> is that Vd exists, not why Why To understand this in detail, you need to read about semiconductor physics. <S> See PN junction voltage drop <S> The way I think of it is as follows: <S> Because of the doping of the silicon, "free" electrons diffuse from the n-type region adjacent to the junction. <S> These electrons combine with holes in the p-type region. <S> This leaves a "depletion-zone" that lacks carriers and is therefore insulating. <S> To drive current through that region you have to apply an electric field to create a force that moves carriers into the depletion region. <S> This electric field across the junction is what we measure as a voltage across the junction. <S> From Wikipedia <A> Can anyone explain me why it is like this? <S> In your right side image there is no voltage output because the diode is connected in the reverse direction so there is no current through it (except from a negligible leakage current) <A> You can read the datasheet, or understand the physics, but here's the intuitive explanation: a diode provides a barrier to charge flow in one direction. <S> The diode must somehow "know" that the flow is going in the right direction, so it must somehow observe that flow. <S> The only way the diode can observe the flow is to let the flow do some work on the diode to see that the flow is pushing the right way. <S> Since work was done, some of the energy is converted to heat in the diode, and this manifests as reduced voltage at the output. <S> An analogy: you can measure the direction of air flow past a car by putting your hand out the window. <S> However, doing so necessarily means you will introduce some additional drag, either slowing the car or burning more gas. <S> Another analogy: <S> check valves perform a similar function to diodes for fluid flows. <S> A simple design is a ball pushed against a gasket by a spring: A flow in the "wrong" direction merely pushes the ball against the gasket more strongly, but a flow in the "right" direction opposes the spring and pushes the ball away from the gasket, allowing fluid to flow: <S> However, holding the ball open against the force of the spring requires constant energy input, and this is manifest as reduced pressure on the output side of the check valve, represented here as a lighter blue color. <S> Although the physics of a diode are different, the concept is the same: there's a barrier, pushing it in the wrong direction <S> holds it shut, pushing it sufficiently hard in the other direction opens it, and some energy is used in the process. <S> If you introduce active electronics, it's possible to arbitrarily reduce the voltage drop of a diode. <S> This is called a precision rectifier , and is commonly realized with an op-amp: <A> To understand this properly, you have to include your multimeter in the schematic. <S> Let us say that your multimeter has a resistance of 10 million ohms. <S> (The exact figure doesn't matter, but it's usually very large). <S> simulate this circuit – <S> Schematic created using CircuitLab <S> So we have a complete circuit consisting of the voltage source, the diode and the internal resistance of the multimeter. <S> (We will assume that the actual meter VM1 has a near infinite resistance, and so R1 determines the meter's resistance.) <S> Anyway, when the diode is forward-based, then current flows through D1 and R1. <S> In accordance with diode behavior, D1 has a forward drop, which for a silicon diode may be in the neighborhood of around 0.6V. <S> And so the measurement registered by the meter VM1 is about 5V minus that. <S> If we reverse-bias the diode, then almost no current flows. <S> The diode looks almost like an open circuit, except for leakage through the diode which is measured in nanoamperes (or less). <S> In other words, only a tiny trickle of current flows through D1 and R1; next to nothing. <S> The voltage measured at the top of R1 comes from Ohm's Law: <S> V = IR: the current through R1 times the resistance of R1. <S> If the current through R1 is 1 nA (nano-Ampere), the voltage is: $$\left(1\times 10^{-9}\text{A}\right)\times\left(1\times10^{7}\Omega\right) = 1\times 10^{-2}\text{V} = <S> 10\text{mV}$$ <S> With these assumptions (that I pulled out of thin air), there is a tiny voltage. <S> When you have the diode reverse-biased, try using the smaller voltage scales available in your meter: get the voltage with fraction of a millivolt precision. <S> You may find that it's not exactly zero, due to the tiny leakage current trickling through your meter's internal resistance.
That is how a diode behaves in forward direction, the forward voltage drop depends on the current through the diode and can be seen in the following graph in the datasheet
Mosfet Driver not driving mosfet I have the following circuit: The MCP1402 MOSFET driver should be driving the BUK7Y13 N-channel MOSFET at 12V, but I'm seeing a much weaker signal which oscillates around 0.7V, preventing the gate from turning on the MOSFET. The load being driving is just 3 LEDs and a resistor in series, as described here . I've tried both a full strip, and a short section with just 3 LEDs. I have tried adding an additional 4.7uF polarized capacitor between 12V and GND, to no effect. I have three of these circuits and they all exhibit the same symptoms, so it's not faulty components. Even with no load (no LEDs) the MCP1402 gets hot to the touch, but I don't think anywhere near it's max temperature. I had previously tried the same circuit but with a FAN3229 driver and no R2, but got similar results. The FET has a gate charge of 5nC and the driver can put out 500mA - this seems fine to me, but the circuit is not working and I'm at a loss. I presume there's something I haven't understood about the use of a MOSFET driver but I can't see what. Edit : Here's an excerpt from the layout - there is a plane to the right of the right blue line which which is "SG" in both diagrams, connected to the low side of the LEDs. And the plane on the left of the left blue line is GND. The other two connects, PWM to control and the connection to the driver are clear. Pin 4 is the gate as you can see, pins 1-3 are the source to GND and the tab/base is the drain to SG. "With no load" means with no LEDS being driven by the circuit, and yes I have confirmed with a scope a nice 5V square wave coming in from my MCU, so the signal is correct. I should also add I do see a very, very faint flicker on occasion from the LEDs, as I would expect with the gate switching partially on. Edit 2: Having ruled out the obvious, here's the full circuit and layout which I didn't post before for the sake of clarity. Polygons SG1, SG2 and SG3 are red(top)/blue(bottom) to right of board, connected with many (thermal) vias. 12V polygon is blue(bottom) on lower half of board, GND is blue(bottom) on upper half and red(top) on most of the board. Power supply is large desktop supply and MCU is functioning as programmed at 5V, LED1 is working, PWM to drivers is working, it's just signal from the drivers. Components were all recently purchased from Farnell. <Q> What is wrong with your circuit is irrelevant from the point of view of getting a working unit. <S> There is no need for a MOSFET driver in this case. <S> Use the IRLML2502 MOSFET and drive its gate directly from the digital output of the microcontroller. <S> Check the IRLML2502 datasheet and you will see that it has a maximum guaranteed on resistance of only 45 mΩ with 4.5 V on the gate. <S> You also don't need a resistor in series with the gate: <S> Yes, it really is that simple. <A> My hunch is that you may have misinterpreted the pinout of the MOSFET. <S> Instead of connecting the gate, you are driving source with a gate driver, while drain is connected to ground. <S> The 0.7V, which you see is the forward drop across the body diode of the MOSFET. <S> In the fourth bullet in the O.P., you're saying " with no load [...] ". <S> Do you mean that: (a) the LEDs are disconnected or (b) the MOSFET gate is disconnected from the gate driver? <S> If you haven't done it already, you should do an experiment, where you disconnect the gate and observe the open circuit output of the gate driver. <A> Always split the problem into smaller pieces. <S> You need to figure out if you have a driver issue or a MOSFET issue. <S> Your MOSFET has \$C_{iss}\$ of around 1nF, so use a cap close to that value. <S> The driver should easily be able to swing that capacitor up and down. <S> and you can focus your troubleshooting there. <A> Looking at your PCB, it's obvious that you don't understand the role of C5/C6, and what constraint that role puts to the way you may run their traces. <S> It seems that you believe that the GND connection of those capacitors and the GND pin of the MOSFET driver can have a long-long trace between them. <S> Well, that's not the case. <S> They have to be as close as possible. <S> Like, 1 or 2mm. <S> Check the turquoise trace. <S> The same is true for the other drivers as well. <A> The second ground connection is missing from your schematic, have you connected pin 4 to the ground? <S> Here is what the datasheet says <A> You mentioned above that you see a 0.7v Average signal from the driver with the FET removed? " <S> it looks like a clean square wave oscillating between about 0.5V and 1V". <S> The Mosfet VGS(on) <S> threshold is stated as 3V. <S> The output pin of the driver should be approaching the rail voltage 0.25V <S> (datasheet) <S> so the Vo(h) of pin 5 should be about 11.75V. <S> If you are indeed injecting a 1KHz 50% duty square wave then the average voltage should be read at about 5.5V. <S> Does the oscilloscope indicate that the signal is acheiving VGS(on)? <S> I have come across the situation where an entire board run had damaged IC's. <S> Li-Ion fuel gauges were fried to crisps during reflow and the damage could not be seen with the naked eye. <S> None of them worked in the prototype batch and it left me scratching my head to no end. <S> No design changes and the second run worked perfectly. <S> Have you tried replacing the driver IC's? <S> IOf they are not providing the 0-11.75V drive <S> then they could be suspect as the layout and design appear to be good. <A> Here is my suggestion : Remove R2 and Q1 and replace DR1 with a fresh IC but lift pin 5 <S> so it doesn't touch the trace on the board. <S> Probe the lifted pin and see if it has the appropriate signal swing (0 to 12V). <S> If it does, solder the pin down and check again. <S> (if it doesn't there's something wrong with the driver IC). <S> After soldering pin 5 down, if the swing is still ok, then put in the R2 resistor. <S> (if the swing is not ok at that point, then the trace from pin 5 to R2 has a resistive short to somewhere which you have to ohm out.) <S> After inserting R2, if the swing is ok, then there is probably something wrong with the MOSFET, although it seems you have already ruled that out. <S> If the swing is not ok, then there is something shorted with the trace from R2 to the MOSFET and you'll have to ohm that out with adjacent traces. <S> The fact that it appears to go from 0.5V to 1.0V even with the MOSFET removed, implies that it may be shorted to a node with a voltage a little above 0.5V. <S> It could also mean that something is being misinterpreted on the scope. <S> My suggestion on that end is to do this debugging with the IN pin forced low and then with the pin forced high by either cutting the PWM3 trace or lifting pin 3 and soldering a wire to it.
If it can drive the capacitor properly, either your MOSFET is damaged or misconnected (as others here have speculated). To debug the driver, remove the MOSFET from your circuit board and connect a small capacitor between the MOSFET gate and source connections. If the driver isn't able to drive the capacitor properly, you have a driver issue (damaged part, layout misconnection, etc.)
Pull up circuit current flows? Im trying to understand how pull up/down circuits works . Let's consider this schematic : I understand that there are two possible current flows : When the button is not pressed, the current flows from VCC through the input pin . When the button is pressed , the current flows from Vcc through the button , to the GND . I cant understand the second flow . Why the the current goes directlly through the button ? After the R1 resistor there is a "crossroad" . So , why the current flow is not divided to both paths (left to the button , and right to the input) ? How it knows to flow only to the left path i.e. to the button, and not right to the input ? Thanks <Q> Because when the current gets to the "crossroad", it has two options to go to GND. <S> One is through R2 and the other is direclty to GND. <S> In other words this is like putting R2 in paralell with a resistor whose value is zero ohms. <S> This lead us to a zero ohms equivalent, which is like a short circuit (left path). <S> In a intuitive way, it finds no resistance to go to the left while there is R2 if it goes to the right. <S> The current division in a "crossroad" is a proportional division calculated by the resistance ratio of each path. <S> Since one path is free, all current goes to there. <A> Logic circuits are operated by voltage much more than by current - in fact, in CMOS logic, inputs are essentially open circuits, so no current flows in or out of a CMOS input pin, execept during signal transitions. <S> Therefore, in your example circuit, with the switch open, no current flows through the resistor, so there is no voltage drop across it, and the input pin is high (at or very near Vcc). <S> With the switch closed, there will be currrent flowing from Vcc through the resistor and switch to ground, so the input pin will be held at ground. <A> If you visualize the button as being connected in the right side between the input pin and the ground pin of the mcu it will help you understand better why the current flows through the button that represents a 0 ohm resistance rather than the resistor that wants to resist the current flow. <A> Think of it like this: <S> The current is divided. <S> If the button resistance is smaller than R2, more of the total current in the branch will flow through it. <S> If the button resistance is much larger than R2, less of the total current in the branch will flow through it. <S> Now imagine the resistance of the button approaching zero. <S> As it gets smaller and smaller, it takes more and more of the total branch current, until there's essentially none flowing through R2. <S> Now imagine the resistance of the button approaching infinity. <S> As it gets larger and larger, it takes less and less of the total branch current, until there's none flowing through the switch. <S> When you understand that a closed switch is close to zero ohms (but never zero, unless we're talking about superconductors) and an open switch is essentially an infinite resistor, you'll understand why most of the branch current flows through the switch when it is closed, why no current flows through it when it's open, and why there's always a tiny trickle of current through R2. <S> An ideal switch can be approximated as a zero ohm resistor, but in practice there's always some small resistance with a closed switch. <S> An open switch is easier to envision as a infinite resistor, so no current flows through it <S> when open (air is a pretty efficient insulator, unless the voltage gets too high...)
Imagine the button as a small resistance when it's pressed, and a large resistance when it's not.
Why don't typical digital multimeters measure inductance? Even with predominantly digital circuits, I am using inductors much more often than I used to, generally because of all the buck or boost converters (a recent board I was involved in has 12 different voltage rails -- six of them needed just by the TFT LCD). I've never seen a standard digital multimeter (DMM) with an inductance range. So I ended up buying a separate meter that does LC measurements. However a lot of DMMs have a capacitance scale. Since capacitors and inductors can be thought of as mirror images of each other with voltage and current flipped, why don't DMMs include an inductance scale also? What's so difficult about measuring inductance that it is left off of DMMs and relegated to specialty meters? Since inductance meters are usually LC meters (even LCR), do they measure capacitance in a different way than DMMs? Are they more accurate than the capacitance scale of a DMM? <Q> The only reason DMMs can't measure inductances is that it is more difficult to measure inductance than resistance or capacitance: this task requires special circuitry, which is not cheap. <S> Since there are relatively few occasions when inductance measurements are required, standard DMMs do not have this functionality, which allows for lower cost. <S> Simple DMMs can measure capacitance by just charging the capacitor with a constant current and measuring the rate of voltage build-up. <S> This simple technique provides surprisingly good accuracy and wide dynamic range, therefore it can be implemented in almost any DMM, without significant cost penalties. <S> There are other techniques as well. <S> Theoretically, one could measure inductance by applying a constant voltage across an inductor and measuring the current build-up; however, in practice this technique is much more complicated to implement, and the accuracy is not that good as for capacitors due to the following reasons: <S> Inductors may have relatively high parasitic resistance and capacitance Core losses (in cored inductors) <S> EMI (incl. <S> stray inductance and capacitance) <S> Frequency dependent effects in inductors <S> More <S> There are few techniques for measuring inductances (some of them are described here ). <S> LCRs are special meters designed for inductance measurements and containing the required circuitry. <S> These are costly tools. <S> Since the hardware for measuring the inductance may also be used for accurate measurement of R and C, LCRs also employ this circuitry in order to improve the accuracy of capacitance and resistance measurements (for example: AC resistance, AC capacitance, ESR etc.). <S> I believe that the difference between measuring inductance and capacitance with LCR is just a matter of different firmware algorithms, though it is just a guess. <S> Therefore, the general answer to your question is "yes, LCRs are usually more accurate in RC measurements than DMMs, and they can measure a wider range of measurable quantities". <S> However, this is just a rule of thumb - there are many superb DMMs and lousy LCRs out there... <S> Read specs. <A> Resistors are very pure compared to an inductor in that a typical commonplace resistor has a very small amount of leakage inductance and capacitance. <S> The resistance in 99.9% of the time, dominates the reading. <S> Capacitors are reasonably pure too when it gets to surface mount devices typically. <S> Self inductance is quite low and ditto leakage resistance and ESR. <S> Again, capacitive reactance across a vast swathe of values dominates a measurement and gives decent results with simple testing methods. <S> Inductors are a different story. <S> It can be hard to seperate ESR from reactive value at low frequencies unless a dc resistance measurement is also taken. <S> ESR also gets bigger with frequency due to skin and proximity effects too. <S> Added to this is the problem that a wound component has relatively high leakage capacitance and this capacitance can throw a reading off as you approach and rise through and above the self-resonant-frequency making inductors difficult to pin-point in value with relatively simple tests. <A> True that inductors can be more complicated components than resistors or capacitors. <S> But the reason common DMMs do not have L measurement is probably more because of market forces. <S> I actually once had a cheap DMM with L measurement, but my current collection of DMMs cannot measure L. <S> You can measure all aspects of a magnetic component like a simple inductor or a multi-winding transformer with complicated devices like in Vasili's link, or buy a simple LCR for just the inductance measurement like this 60 euro thing. <S> According to the online user manual, it applies a sine of 250 Hz to the inductor under investigation, in series with a resistor. <S> The series resistor can be selected with the scale knob. <S> For a more detailed explanation, look e.g. here. <S> As for OP's second question, I do not believe that inductance meters are "LC" meters. <S> That would suggest that these measure using a resonance circuit. <S> The simplest method to measure L or C is with a series resistor and a low frequency oscillator. <S> A cheap DMM and a cheap LCR will both use this method. <S> The accuracy with DMM or LCR will therefore be similar.
However, because inductors have more parasitic effects than capacitors, like resistance, leakage flux, saturation, non-linearity, hysteresis, eddy currents, frequency depending mu, the simple measurement of the inductivity may not be sufficient for you.
What measures should I take to protect the USB ports of my PC during development of a USB device? I'm going to start developing a USB 1.1 device using a PIC microcontroller. I'm going to keep one of the USB ports of my PC connected to a bread board during this process. I don't want to destroy my PC's USB port by a short circuit or connecting \$\pm\$Data lines to each other or a power line accidentally. How can I protect the USB ports? Does a standard USB port has built-in short circuit protection? Should I connect diodes, resistors, fuses on/through/across some pins? <Q> This is to expand on Leon's suggestion to use a hub. <S> The USB hubs are not all created equal. <S> Unofficially, there are several "grades": <S> Cheap hubs. <S> These are cost optimized to the point where they don't adhere to the USB spec any more. <S> Often, the +5V lines of the downstream ports are wired directly to the computer. <S> No protection switches. <S> Maybe a polyfuse, if lucky. <S> edit: <S> Here's a thread where the O.P. is complaninig that an improperly designed USB hub is back-feeding his PC. <S> Decent hubs. <S> The downstream +5V is connected through a switch with over-current protection. <S> Industrial hubs. <S> There's usually respectable overvoltage protection in the form of TVS and resettable fuses. <S> Isolated hubs. <S> There's actual galvanic isolation between upstream port and downstream ports. <S> Isolation rating tends to be 2kV to 5kV. Isolated hubs are used when a really high voltage can come from a downstream port (e.g. mains AC, defibrillator, back EMF from a large motor). <S> Isolated hubs are also used for breaking ground loops in vanilla conditions. <S> What to use depends on the type of threat you're expecting. <S> If you're concerned with shorts between power and data lines, you could use a decent hub. <S> In the worst case, the hub controller will get sacrificed, but it will save the port on the laptop. <S> If you're concerned that a voltage higher than +5V can get to the PC, you can fortify the hub with overvoltage protection consisting of TVS & polyfuse. <S> However, I'm still talking about relatively low voltages on the order of +24V. <S> If you're concerned with really high voltages, consider isolated hub, gas discharge tubes. <S> Consider using a computer which you can afford to lose. <A> Use a hub. <S> They are quite inexpensive, and your USB ports will be perfectly safe no matter what your device does. <A> As someone who does this for a living, any cheap hub in-line should give you 100% protection if your motherboard provides reasonable short-circuit protection. <S> We use them all the time, even when doing ESD testing on our parts <S> (15KV zaps are pretty entertaining), and have never blown one up or taken out a host port. <S> The Data lines from a cheap hub simply can't physically be connected to the PC - there must be a hub chip in between to separate the communications for the 4 or 7 ports that the hub provides. <S> USB is not a bus like Ethernet - connecting multiple ports with wire simply doesn't work as too much of the signalling is based on DC levels. <S> This hub chip will provide nearly foolproof protection between your device and the host port on the Data lines. <S> Power is a different issue. <S> I had one motherboard that current limited the USB port with a fuse on the USB 5V line - not a resettable polyfuse but a melting wire fuse. <S> An unintended short required major motherboard surgery. <S> Power is the area that's most likely to cause problems. <S> Buy a good powered hub (say, $25 worth), use the supplied adapter, and you're good to go. <S> If you're really paranoid, USB permits up to 4 hubs between the host and the device. <S> Buy 4 different cheap powered hubs, hook them in line, and go for it. <S> Good Luck <A> Analog devices makes a two chip solution for your problem, it provides full power and data isolation for the USB bus up to 12mbps, which should be fine for your needs: http://www.ubasics.com/usb_isolator Power <S> - ADuM5000 Data - ADuM4160 <S> There are a number of evaluation kits and breakout boards which make these easier to use for those not handy with a soldering iron. <A> Use a wireless hub. <S> I'd like to see someone create a USB device that can fry a motherboard through the wireless USB hub... <A> Using a (self-powered) hub is a good idea. <S> Also, you could use a USB add-on card in your PC instead of your system's built-in USB ports, which would offer further protection. <A> If the device makes use of an external powersupply use isolation. <S> I speak of this by experiance. <S> One of my usb ports of my macbook pro is fried because of a groundloop with an externally powered arduino board. <S> One of the other anwsers has a good solution for low cost usb isolation.
If the device you are making runs of the power of the usb port a simple hub will do. ESD protection is usually present.
Accurately measuring temperature with Arduino I'm trying to build thermostat with Arduino. I want to power it using mobile phone battery/charger which makes system voltage quite variable. Right now I use Arduino Uno, but once it is complete I will port it to Lilypad. First I tried to use TMP36 temperature sensor. So far it was complete failure. While the sensor itself appears to be very stable, I can't figure a way to accurately measure its voltage. Using built-in 5v reference for analog sensors isn't working at all -- even powered from USB arduino's +5V are actually +4.8V (which shifts measured temperature by few degrees). When the board is powered from the battery, voltage drops to about 4V and measured temperature sky-rockets. I also tried to use +3.3V from the board as a reference. It seems to be more stable when the board is powered from USB, but its voltage drops when running off the battery. Is there any other way to reliably measure sensor output voltage? For the second stage I'm planning to use thermistors. Just ordered a couple of these 20K thermistors . From what I understand, these should be easier to measure accurately if I build voltage divider and use V_in as reference voltage for ADC. A couple of questions about them: Does it make sense to use few voltage dividers with different fixed resistor to increase accuracy? I can use programmable pin as V_in, and measure temperature using few different voltage levels. Though its not clear to me whether this will actually increase accuracy. <Q> I think you should consider using a digital temperature sensor like DS18B20/ DS18S20 because it does not depend on the accuracy of your ATmega ADC to measure an anaolg signal, it uses 1-wire digital protocol to report temperature. <S> Refer to the following tutorials <S> http://playground.arduino.cc/Learning/OneWire <S> http://www.hobbytronics.co.uk/ds18b20-arduino <A> Your measurement will be as good as reference voltage for ADC is good. <S> You have to get a special chip called "Voltage reference" and connect it to Aref pin, then set ADC to use the external reference in Arduino code ( analogReference(EXTERNAL) ) <S> The voltage of the reference has to be selected so that the full swing of your temperature sensor will fit into referece voltage. <S> TMP36 will output ~1.5V @ 100C, so you would have to use reference above 1.5V for measuring temperature up to 100C. <S> You want your reference as close to the maximum voltage measured as possible to get as much resolution as possible. <S> Atmega328p has two internal references that can be used without any external components. <S> One is 1.1V, another 2.56V. <S> They usually are a bit worse accuracy than what you would get by using external dedicated component. <S> Check Arduino documentation for analogReference and Atmega328p datasheet for internal reference accuracy. <S> If you really want to get nuts with different ranges, you can use several external references and switch them by using an analog switch like 74hc4051. <S> Or you can switch between two internal references. <S> With thermistors you will have better results if you set up a constant current source instead using a dumb resistor. <S> On another hand - a dumb resistor powered from a stable voltage reference would work ok. <S> When choosing an external reference, make sure you have enough voltage to accomodate for it's drop out voltage when powering from batteries and the batteries are flat. <S> Vref+Vdropout < Vbat-min. <A> It seems you are aware of the problem with the reference voltage changing and if you use a device like the TMP36 (fixed 10mV/ <S> degC) <S> there is nothing you can do other than use a voltage reference from a chip to stabilize things. <S> However, if you are using an RTD or a thermistor then the problem won't arise. <S> You ADC is making a ratiometric measurement - it compares the ADC input to its reference voltage <S> BUT, if you power the RTD or thermistor (via a suitable resistor) from the same ref voltage it won't affect readings. <S> If the ref goes up 10% then so does the voltage into the ADC. <A> Not having a stable ADC reference is actually a symptom of a another problem in your circuit: you are not supplying a high enough voltage to the board. <S> This is indicated by the 5V supply dropping to 4V and the 3.3V dropping as well. <S> The voltage regulator (MC33269D-5.0 IIRC) on the Arduino board has a dropout voltage of ~1.0V, therefore you need to supply it with at least 6V to get a stable 5V output. <S> AA batteries start off at 1.5-1.6V and are almost dead at 1.1V so you must power the board with at least 6 AA batteries for a stable output over the entire battery life. <S> Powered correctly, you may either use the internal ADC reference or either the 5V or 3.3V lines. <S> Since the temperature sensor varies by around 10mV per degree Celcius, you could use a voltage divider to set the reference voltage equivalent to the maximum expected sensor output voltage (e.g. for 50 degree C). <S> This will give a more precise measurement. <S> If you want to use fewer than 6 AA batteries, try a DC-DC boost converter, e.g. https://www.sparkfun.com/products/10968 . <S> The linked example takes 1V - 4V and makes 5V. <S> The output would be fed directly into the 5V pin of the Arduino, bypassing its regulator. <S> To get the board to run longer on batteries, put the MCU to sleep between sensor reads. <S> The rocketscream low power library is great for this purpose. <S> But it is only really useful when using an efficient regulator / DC-DC converter as the standard Arduino regulator uses 10mA just by itself! <A> Answer for the question Is there any other way to reliably measure sensor output voltage? <S> ADC uses the reference voltage for the conversion from analog to digital. <S> So if there is a change in the reference voltage, the converted values(i.e digital value) will change. <S> The digital value will be different for the same analog input if the reference voltage changes. <S> One easy option is to use the internal reference voltage inside the Arduino(i.e Atmega controller). <S> See the below link where a sample code is provided to use the internal ADC (Arduino function name - analogReference(DEFAULT) ) <S> http://tronixstuff.com/2013/12/12/arduino-tutorials-chapter-22-aref-pin/ <S> I think this will solve your issue and there no need to switch towards thermistors.
Arduino by default uses supply voltage as reference voltage, but in your case the right way to do it would be to use Aref pin of arduino.
Can a DC regulator reduce/step down DC voltage? I have studied that regulators like 7805 are used to remove the ripples present in the DC power supplies. But while searching for information about 7805, I came across the circuit below. The circuit shows an LM7805 converting 9V supply to 5V. This is something like stepping down the voltage. can a DC regulator really step down a DC voltage (because I've studied only about their ripple removal function)? <Q> Yes they can. <S> They sort-of put themselves between the IN and OUT pins as a resistor. <S> They watch the out pin. <S> If the voltage is > 5V they make the resistor value higher, if the output voltage is < 5V they lower the resistor value. <S> Thus they maintain the 5V at the output. <S> Like a real resistor, the difference between input and output voltage (multiplied by the current supplied by the OUT pin) is dissipated as heat. <S> Hence such a linear regulator is not very power-efficient (a switched mode regulator is more complex, but much more power efficient). <A> <A> A simple voltage divider can "step-down" a voltage. <S> For example: simulate this circuit – Schematic created using CircuitLab <S> However, the 5V output of the circuit above is unregulated . <S> This means that (1) the output voltage will vary in proportion to the input voltage <S> (2) the output voltage will vary with output current <S> Now, imagine that R1 in the schematic above were variable and controlled in such a way that, within a certain range of input voltage and output current, the output would be 5V regardless . <S> A simple implementation of such an idea is: The transistor and base bias circuit form a dynamic voltage divider with the load resistance, "dropping" the input voltage down to the desired output voltage and maintaining that voltage relatively constant with respect to variations in input voltage and output current.
I would say that the primary purpose of linear regulators like the 7805 is to reduce an unregulated power supply output to a fixed voltage - removing the ripple comes as a byproduct of the voltage regulation.
How to identify an ordinary coil? Can I use some tools do identify its value? I did a big mistake and damage an electronic coil in my PCB. The only information I did have is the coil itself! There are two identical coil in it. This is my PCB. It is the UCD-210M . This is the broke coil And this is the another good one in PCB. Click this link to see more images. So, what you can see is the three colors (clockwise): Red Violet Yellow This page show how to identify this colors. But it don't show the value of every color, maybe for every series, it change the value. I don't know what is the 1st or 2nd color dots, so I have this: 1st (Yellow) - 2nd (Violet) - 3rd (red) Luckily it has this exact configuration, so it give 4700 nH 1st (Violet) - 2nd (Yellow) - 3rd (red) It don't show the values… Edit… The manufacture finally answer the mail. It is a coil of 4.7 µH. He don't give any other detail. Everyone was correct. But… The second problem: can any 4.7 µH coil work for it? The size of my coil is: 2.63mm x 2.35mm (I measure it with a digital calipers ). So, with this size, I get this list . I am really afraid about it because all other electronic details. No model look like visually equal to mine. The best option in this list is the 0603PS-472KLB because it size. But if I buy it, will be a trial and error… So the question is still the same: Because I have a good one, I can use some tool to measure its value and electric details. What tools is it? And how can I identify the exactly manufacture of this piece? If I use a generic one, can it cause problem? Maybe I can get this piece from another device, what kind of device use the same coil? <Q> I do not think that coil is a coilcraft. <S> But don't worry too much, these kind of coils are used for power conversion. <S> Initial specs are at best +/-10% precise. <S> When we design it we have to keep in mind it can be used at low/high temp, max load and a whole lot of extra's. <S> But in practice chances that it will be running at its absolute max <S> are very low <S> , that would give too much warranty issues. <S> If the parameters are a little bit different it will cost you a few percentage of efficiency so it could heat up a little extra. <S> Considering margins for ambient and load it will not be a problem for you. <S> So what I propose, let's focus on the important parameters, get the best coil possible <S> no matter what the price is (we won't mass produce:) and try to overrate a little bit to make it sturdy. <S> Good, you measured 2.65 x 2.35mm, on the picture I can see the footprint is a bit bigger so we will increase the size by 20% to give some slag on parameters. <S> The size I worked with is 3.2 x 2.5mm, made for a footprint of 3.8 x 3mm which I think is what's on your pcb. <S> Please check this. <S> Now, let's keep it simple <S> , we want saturation current to be high because it should not saturate. <S> We want dc-impedance to be low, lower is better. <S> And we want a high self resonance frequency so it can work at any frequency the switcher could possibly be running at. <S> The coil from the picture is not fully shielded and we do not care too much about EMC for a single board, so to get the best parameters I selected an unshielded type. <S> Good, I came up with: ME3220-472MLB <S> which you could buy here or try to get a sample at Coilcraft. <S> You can find a datasheet here Put this on and the switcher will be running smoothly. <S> That is, if the switcher chip itself has not been damaged, but that you will know once you put the coil on. <S> Good luck! <A> Looks like a Coilcraft 1008, 1206, 1812 or Midi Spring 4.7uH inductor. <S> The third color is number of 0s added to the other two in nH <S> and not the EIA multiplier, making this 47 <S> * 100nH. <A> Determining the voltage drop and phase shift, one can obtain the inductive reactance, and knowing the applied frequency, the inductance value. <A> There are many parameters of a coil, and some of those parameters might be highly irrelevant or might be crucial, depending on your particular circuit and the particular role the coil plays in it. <S> Just a short list: <S> inductance value: this is usually not that important, in many power electronics cases, there is usually only a minimum value, and for example you can easily substitute a 10 or 22uH inductor in place of a 4.7uH without any problems, copper wire resistance: it is closely related to the average load current <S> the inductor has to bear, as the wire resistance generates heat, and there is a practical limit to the heat that can be dissipated by the inductor without getting too hot, magnetic material: completely different kinds of material <S> are in use for inductors; depending on the frequency used, some may be totally unusable, magnetic saturation current: in contrast to the wire resistance, where the average current matters, there is another limit, to the peak current, because the magnetic material gets saturated at some point, and there the inductor ceases to operate like an inductor - in power electronics, this is to be avoided; in some other uses of an inductor, saturation might even the purpose of the circuit. <S> So when choosing a substitute, it might be a rather difficult job unless you know a few things about your circuit, like the role of the inductor, the frequencies used, the current flowing through, etc. <S> Inductance value can be measured from a good piece, but for other parameters (like the magnetic material used) this might be difficult. <S> However, you can make guesses, then on a trial-and-error basis you might succeed.
One could make a measurement using a sinusoidal signal generator of known amplitude and frequency, connecting a resistor in series with the coil.
How to measure the temperature of a thin wire using a infrared (IR) thermometer? I got a laser thermometer to measure the temperature of a wire for my science fair. However, when I attempted to measure the wire, it was too thin and I just measured whatever was behind it. How can I measure the temperature of only the wire? <Q> Judging from the other post, you are designing an experiment, where you want to demonstrate the resistivity at different temperatures. <S> To do that, you need to know the temperature of the wire. <S> You don't necessarily need to self-heat the wire with electricity. <S> You've chosen a comfortable range of temperatures: between +10°C and +40°C. <S> You can touch this kind of temperature and it shouldn't hurt. <S> However, the room temperature is usually +18 <S> °C to +25 <S> °C, so you would need some method of chilling to get +10°C. <S> I would suspend the wire in a container filled with non-conductive liquid <S> **. <S> The container can be large enough to measure with an IR thermometer. <S> You can also have a thermometer immersed in the liquid. <S> Have another container with warm liquid, and another one with chilled liquid. <S> The temperature of the wire will equilibrate with the temperature of the liquid very quickly. <S> It could make sense to wind the wire on a plastic spool, being careful that the wire doesn't cross itself. <S> Perhaps, you could lay the wire into the thread of a large plastic screw. <S> ** Silicone oil from the drug store, perhaps. <S> You could add some coloring to the liquid to make it look unusual. <S> Deionized water could work too, it has high resistivity. <A> The only way you would be able to measure that with an infrared (the laser just shows where you are pointing it) <S> thermometer would be to attach a copper plate to the wire and measure the temperature of that. <S> Because copper is such a great conductor of heat, that would give you near real-time results. <S> Why do you have to use that thermometer, by the way? <S> Couldn't you just attach a temperature sensor to it and save the bother? <S> That would be cheaper and easier. <A> There are things called pyrometers and at the heart of the device is a photodiode. <S> They can measure the spot temperature of anything they are pointed at but they rely on optical lenses to give a spot focus point. <S> Maybe, if you got a photodiode with known sensitivity (amps per incident light power) you could work it out by taking a couple of measurements at slightly different short distances. <S> Other than that I'd be tempted to solder a thermocouple to the wire, minimizing the heat taken by the thermocouple. <S> I've soldered them to electronic components in the past and got reasonable results. <A> Polished copper should work well as it reflects IR nicely <S> but if you can’t get a suitable piece some household alumina foil might work. <S> If this is not enough, add some shielding that will shield of other potential heat radiating bodies, like humans, from your reflector.
Add a reflector behind the wire, preferably bent to a curve to focus the IR light emitted from your wire. You can move the wire from one container to another and measure the effect.
Getting ADXL345 accelerometer to work over SPI with Arduino Uno I'm using this cheap ADXL chip with Arduino Uno. When I read the sensor with I2C - it works fine. However I have some servo motors as well which generate a lot of noise and when I turn the motors on, the sensor readings become pretty much useless. I read that SPI is much more immune to noise, so I decided to go this way. However I just cannot get it to work with SPI. I'm using this code, which seems to work for other people: https://www.sparkfun.com/tutorials/240 I triple checked the wirings, they seems ok to me, tried with and without level shifter, tried hooking up various pull-up resistors... and still I get just zeroes. Yet I2C works just fine (without any pull-ups). I'm wondering since the Sparkfun code uses a different breakout board for the ADXL chip - could it be that mine needs some specific pull-ups, that are not mentioned in that tutorial? How can I know what pull-ups need to be placed? And any other suggestions will be much appreciated! <Q> You should read the datasheet for the part to double check your connections. <S> You should not be having any pullups for SPI communication. <S> Regarding being unable to communicate via I2C when motors are on - how long are your I2C wires? <S> Trying to lower the resistance of I2C pullups might help. <S> In general you can try to remedy this situation by adding bigger caps near microcontroller/accelerometer power supply or even adding a small (~10 ohm or less) series resistor and a cap on Vcc that goes to noise sensitive part. <S> Read up on star grounding and powering techniques, it is possible you could solve your problem by just reconnecting wires in "star" manner. <A> UPDATE: <S> eventually it turned out the "noise" in the readings was due to the mechanical vibrations that the motors cause. <S> It's not because of i2c or spi or other wirings. <S> That's why you need to combine accelerometer with a gyroscope - the gyro doesn't get messed due to vibrations, however it accumulates an error over time. <S> So both devices have one problem and by combining them together - each device fixes the other device's problem and you get an accurate reading :) <A> Be aware that there a two different kind of ADXL345 (like described in http://wei48221.blogspot.de/2015/06/how-to-use-adxl345-triple-axis.html )... one from sparkfun and the other one you get from ebay(etc.) <S> They both look more or less the same but only that one from sparkfun works with i2c and spi... <S> that one from ebay only works with i2c
The accelerometers goes completely crazy when put to mechanical vibrations and this seems to be how all of them work.
Do real and reactive energy exist? Are there any such things as real and reactive energies just like real and reactive power? if so, how is reactive energy dissipated? <Q> Energy is just power integrated over time, so real and reactive energy exists or not just like real and reactive power, respectively. <S> As for power, real power exists and reactive power is a mathematical convenience to simplify expressing certain things. <S> By using the mental shortcut of imagining imaginary power, we can simplify calculations and explain real observed parameters more easily than without. <S> Imaginary power doesn't exist, but the effects of it projected back to real power are real. <S> Large scale power grid producers and consumers are often rated in both the instantaneous real and imaginary power they are producing or consuming. <S> However, the same real observable characteristics can be explained other ways. <S> Explaining them in terms of imaginary power is merely a mental and mathematical convenience. <A> First of all, remember that in the context of AC (phasor) analysis, real and reactive power, unlike voltage and current, are not phasors , i.e., they do not represent the amplitude and phase of a sinusoid in the time domain. <S> Thus, we cannot "tack on" the time dependence and take the real and imaginary parts to calculate the associated energies in time domain. <S> Sometimes it is helpful to "go back to basics" to gain insight into a problem. <S> This is such a case. <S> Reactive power is a useful concept in AC analysis but what it represents physically is best seen in the time domain. <S> First, consider a sinusoidal voltage source \$v_s(t) = <S> V\cos\omega <S> t\$ <S> driving a resistor R. <S> The power delivered to the resistor is: $$p_R = \dfrac{v^2_s(t)}{R} = <S> \dfrac{V^2\cos^2\omega t}{R} = <S> \dfrac{V^2}{2R}(1 + <S> \cos2\omega t)$$ <S> The key observation here is that the power is never negative, i.e., the flow of energy is from the source to the resistor always . <S> Thus, the energy supplied by the source increases over time. <S> The energy supplied by the source over a period \$\dfrac{\pi}{\omega}\$ is: $$W_R = <S> \dfrac{\pi <S> V^2}{2\omega <S> R}$$ <S> Now, replace the resistor with a capacitor. <S> The power delivered to the capacitor is: $$ <S> p_C = v_s(t) <S> \cdot i_C = <S> V\cos\omega t <S> \cdot <S> (-\omega C)V\sin\omega t = -\dfrac{CV^2}{2}\sin2\omega <S> t$$ <S> The energy supplied by the source over a period \$\dfrac{\pi}{\omega}\$ is: $$W_C = 0 <S> $$ <S> The key observation here is that the power is alternately and equally positive and negative, i.e., the flow of energy is back and forth between the source and the capacitor. <S> Thus, the energy supplied by the source over a period is zero . <S> But, as we know, the power associated with a capacitor is reactive power in phasor analysis, and now we can answer your question: <S> Are there any such things as real and reactive energies <S> We have shown that reactive power is associated with an alternating energy flow between the source and load that is <S> zero over a period. <S> In other words, it is associated with the energy that "sloshes" back and forth between the source and load without any dissipation. <A> how is reactive energy dissipated? <S> but, it could be taken to mean the energy interactions between a power source and a reactive component. <S> If that power source is a sinusoidal AC voltage and an inductor is connected to that source, energy flows into the inductor then out from the inductor as the AC waveform alternates. <S> The average energy is zero i.e. the same flows "in" that flows "out" <S> but, if a small resistor were inserted in series with the inductor both forward energy (into the inductor) and reverse energy (back from the inductor) would cause some of that energy to be dissipated as heat in the resistor. <A> Is there something more to Reactive Power than a mathematical convenience? <S> Reactive Power in the News <S> (New York Times, Sept. 26, 2003): <S> “Experts now think that on Aug. 14, northern Ohio had a severe shortage of reactive power, which ultimately caused the power plant and transmission line failures <S> that set the blackout in motion. <S> Demand for reactive power was unusually high because of a large volume of long-distance transmissions streaming through Ohio to areas, including Canada, than needed to import power to meet local demand. <S> But the supply of reactive power was low because some plants were out of service and, possibly, because other plants were not producing enough of it.” <S> Resources: Reactive Power Overview (PDF) <S> Google search: How does reactive power support voltage
Reactive energy has no definition that I'm aware of
How safe is this? I'm wondering how safe this is to make and to build into my setup. :PA bit afraid of it exploding. http://www.apartmenttherapy.com/make-your-own-batterypowered-u-100359 <Q> There is no danger in the circuit apart from mis-wiring it or creating a short that can feed the 9v of the battery to a 5v USB device and destroy it. <S> The circuit is just a simple linear regulator (seems like a LM7805 ) connected to the battery, if the input is >= <S> 7v <S> then the output will be 5v. <S> Possible improvements include the addition of a capacitor to the output, refer to the datasheet. <S> Note that the output of the regulator has short circuit protection. <S> If you intend to charge a cell phone you will not get much of a charge becasue <S> the 9v battery has very low capacity . <A> Mechanically there is a risk of shorting. <S> If it gets hot under discharge as hot-melt glue, which they use, may soften and allow movement. <S> Explosion is very unlikely. <S> If you short 9VDC or even > <S> > 5VDC <S> to a USB port <S> it MAY kill the device being charged. <S> Electrically it is marginal as there are no capacitors used with the regulator <S> but it will probably work in some cases. <S> See the circuit here that robomon cites. <S> Regulator is IC2 at top left. <S> Note the added caps. <S> A 0.1 uF on input will probably be enough. <S> Much larger is useful when battery is low. <S> The regulator type is not specified (that I could see) but is probably a '7805' / LM340. <S> This will stop working when the battery reaches about 7V. Other regulators with the same pinout are available that will operate down to Vbattery < 6V, when the battery will be fully exhausted if an Alkaline battery is used. <S> Use with a NiCd or NimH battery will not allow all the battery energy to be used in many cses as Vbattery falls too low while there is still energy left in it. <S> The energy capacity of a 9V PP3 battery is low. <S> This would act as an emergency supply for eg a cellphone but would not fully charge even a very small cellphone battery. <S> Maximum current will not be enough for some larger battery-capacity devices. <S> As they say, some (or many) USB charged devices require additional resistor dividers that provide selected voltages to the USB data lines to signal charger capability to the charged device. <S> Many Apple devices need these. <S> Search for "MintyBoost" as a possibly superior DIY alternative. <S> One example of many here and commercially From Sparkfun and from Adafruit . <S> Also many many other versions via here <A> There won't be any issues of explosion. <S> Similar circuits is being used in many places. <S> For example: Arduino development board has a 5V regulator which can be fed using a DC barrel jack. <S> This setup is used to run Arduino in battery mode. <S> Project link - http://arduino.cc/en/Main/ArduinoBoardSerialSingleSided3
Shorting the battery terminals will probably not cause a fire, but may. The source connected to this DC barrel jack can be a 9V battery similar as yours. There is no issue in building this circuit.
For how long ICs can be exposed to overvoltage without being damaged? (protection circuit evaluation) I'm asking this because i'm trying to develop an active overvoltage protection circuit and unsure about how quickly it should react to overvoltage condition. Maybe someone can give me advice on that? Thanks to everyone. I learned important things. <Q> There can not be a general rule. <S> Some components increase the current exponentially in case of over-voltage and some increase the current just proportionality. <S> In addition some may have over voltage mechanism (like a clamping diode) and some may not so there is not a single answer that can cover every single component/circuit. <A> An active over voltage protection scheme will be slower than such things as zeners. <S> In any case you should ensure that any overvoltage condition is prohibited in rising to critical levels on what you are trying to protect more quickly than the protection device can respond. <S> This can be achieved with passive components such as resistors, inductors and capacitors. <A> It all depends on the mechanism of failure. <S> and it's dead. <S> If the over-voltage causes extra current to flow in a resistor, and heating is the problem, then you may get mS to minutes, depending on the thermal time constant of the circuit. <S> If the supplier doesn't specify an \$I^2t\$ for the component, then it's down to you to do experiments, and make a suitable allowance for not all components being the same as the several you test.
If the over-voltage damages the component by insulator breakdown, then no excess is allowed, no time is safe, pop!
How do sound cards cope with negative voltage? I feel this is a basic question but I found no answer for it so far. Let's take a random sound card that lives within a PC. From the connections at the end of the datasheet I assume that it is powered by 5 V and uses the computer's ground. Maybe it is a faulty assumption, but by some small experiments with my laptop it seems that the audio input and output ground is connected to the overall ground of the computer. So the sound card does not have any fixed negative voltage to refer to. The waveform of the input and audio should have negative and positive regions. How do the ADC and DAC handle that? If there is any external circuitry that shifts the voltage it doesn't seem so. <Q> Computer power supplies do have multiple voltages, including negative ones, so if some amplifier needs dual rails, these are available. <S> A single-supply pre-amp input is biased to some positive middle-of-the-range voltage, and the input signal is applied to that node via a coupling capacitor which passes AC, while blocking the DC component, preventing that input's bias voltage from driving DC through the source. <S> (Additionally, a DC return resistor is often provided on the outside of that capacitor in case the output stage of the previous device needs its load to be a complete DC circuit.) <S> If the input line goes right to some op-amp chip without a coupling capacitor, that chip must be handling the negative voltage somehow. <S> If there is no negative power rail, then the circuit topology is doing it. <S> The Texas Instruments document Single-supply <S> Op-amp Design has a lot of information about this. <S> Look at the Boundary Conditions <S> paragraph right on the first page: <S> Use of a single-supply limits the output voltage range to the positive supply voltage. <S> This limitation precludes negative output voltages when the circuit has a positive supply voltage, <S> but it does not preclude negative input voltages. <S> As long as the voltage on the op amp input leads does not become negative, the circuit can handle negative input voltages . <S> [Emphasis mine] <S> The obvious example are JFET transistors (and, similarly, depletion mode MOSFETS). <S> The pinchoff gate voltage of a n-channel JFET is below the source voltage. <S> You can bias a JFET input at zero, and it will nevertheless handle negative swings without clipping them off. <S> Look this very simple pre-amp for a passive pickup in an electric guitar. <S> Note how there is only a single voltage supply, and yet the pickup, which generates both positive and negative voltages, is coupled directly to the gate of the JFET. <S> Only the output is capacitively coupled. <A> Audio inputs are usually capacitively coupled . <S> This means low frequencies are attenuated and DC, the lowest frequency of all, is blocked entirely. <S> Usually audio circuits are designed such that low means something around the lower limit of human hearing, about 20 Hz. <S> A typical audio input stage might look like this: simulate this circuit – <S> Schematic created using CircuitLab C1 serves to block any DC. <S> The parallel combination of R1 and R2 set the input impedance. <S> You can also view this arrangement as a simple low-pass RC filter , with the RC time constant , and thus the cutoff frequency of the filter, defined by R1||R2 and C1. <S> R1 and R2 meanwhile create a voltage divider that set the DC level as seen by the ADC or whatever follows. <S> Usually R1 and R2 will be equal so that the DC level is midway between the supply rails, to allow for maximum voltage swing in either direction. <A> The soundcard audio input and output stages that I have seen are AC-coupled (capacitor in the line). <S> This is in fact a major problem when you try to use PC + a soundcard as oscilloscope, because the is no easy way to measure the DC level of the input. <S> The AC-coupling means that the input (and output) stages can have their no-signal (DC) level at any point they choose.
It is possible to design a very simple input stage with a single discrete component that handles voltages more negative than the negative supply to the device.
Multiple sensors off one pin I have multiple piezo sensors acting as vibration sensors. I am using a PIC microcontroller that only has 2 ADC. I want the circuit to function in such a way that if any of the sensors are hit and generate a response above a certain threshold then the PIC will flash a LED. I don't want to use a multiplexor for timing reasons and want to use just one ADC. Is there a component that will help me? <Q> The output from the op-amp will be the algebraic sum of all the sensors so if any generate a signal, this will be seen on the op-amp's output. <S> Following the op-amp, a comparator can be used or just feed the input into one of the ADC inputs. <S> What you have to ask yourself is this: could two sensors receive an impulse in such a way that the combined output signal of both sensors is zero? <S> If this can happen then you should use a precision rectifier circuit (also based around an op-amp) on each sensor output - then sum them as above. <S> This should mitigate against cancellations as only one half of the impulse-producing waveform will be amplified and no cancellations can occur. <A> How about external ADCs connected to your micro by SPI? <S> MPC3008 has 8 ADC inputs in a single chip. <A> Probably the simplest, but not the most accurate solution. <S> If the level of the signal is high enough, you can use a diode based circuit to find the highest level from all inputs and to transmit it to the ADC. <S> simulate this circuit – <S> Schematic created using CircuitLab <S> To keep the voltage drop low, you should use low power Schottky diodes. <S> In case of piezo sensors, which can generate relatively high voltages I'd also use the overvoltage protection. <S> By the way, does your PIC have an analog comparator, which can detect a voltage peak and generate interrupts? <S> Otherwise you may overlook the voltage "spike" <S> generated your sensor, if the sampling frequency is too low. <S> In my circuit the C1 capacitor is used to extend the pulse, for more reliable sensing by ADC. <S> Update <S> If you want to connect the piezo sensor directly to the above circuit, you should ensure, that the charge does not accumulate (as diode lets the current flow only in one direction). <S> For such a purpose I use circuit shown below: simulate this circuit <S> The last version is the slightly modified circuit which I have used for the drum trigger. <S> simulate this circuit <S> Diode D7 should be a low power Zener diode with Zener voltage near to the VCC. <S> It limits the voltage (however you can omit it, and then the excessive voltage will be shunted to the VCC by the BC junction of Q1). <S> The R5 ensures stability of the voltage follower.
Finally you can use a voltage follower to decrease the load of the sensor and to improve sensitivity to short pulses. Use an analogue mixer circuit based around an inverting op-amp configuration.
Connecting a DC barrel jack to a PCB board I am wondering how I can include a DC jack such as below in my PCB circuit: There are no such PCB packages in my library, so the first step, I presume, is to make a prototype with the exact dimensions as in the datasheet (correct me if I'm wrong). What I am really confused about however is how to drill the holes in the PCB, given that I need a rectangular section instead of a circular one, for the three pins. <Q> You didn't mention which PCB layout program you are using, but if it is Eagle, the part is available in the SparkFun library . <S> See images below. <S> I drill the holes with the 3.2mm drill bit. <S> I then place the connector on the PCB, touch both the connector terminal and the PCB pad with the soldering iron (hot) and push the solder in until it makes a little blob, nice and round. <S> It takes quite a bit of solder, like in the image below. <S> Watch out not to push the solder directly into the hole or it will go into the connector and destroy it. <S> Bear in mind that I make my boards at home <S> , so I have no idea how that is done with production quality, but mine gets firm and steady. <A> <A> Yes, you will have to make your own footprint if you can't find one in the existing libraries. <A> There is a suggestion (here) on how to go about specifying how you would like the through holes to be milled. <S> They suggest creating a separate layer with the instructions/specifications. <S> Although as has been suggested it might be easier to just go with a round hole.
To complement Ricardo's answer for Eagle, for Kicad this is available in Walter's excellent collection of libraries and footprints (including 3D models), dc_jack in the lib_w_connectors library and dc_socket in the mod_conn_misc library. I would make round holes for the pins - few board shops would have rectangular drills :-)
Why is this switched power inlet fused on both load and neutral sides? I've purchased a Schurter 4304.6090 power inlet for a project and am a bit confused by the fuse configuration. The inlet requires two fuses: one on the load side and another on the neutral side of the circuit. Is this just for redundancy, or am I missing something here? I plan to use this for 120VAC (USA). Here's a picture of the inlet, along with a crude wiring diagram: <Q> This device is rated for 250V. Assuming that you are in the USA/Canada, your 240V is actually two 120V lines, 180 degrees out of phase. <S> If your application is 120V hot/neutral/ground, you can simply wire in only one fuse holder, on the hot Sorry, I misread the datasheet. <S> I see now that the 6090 variant has the fuse holders already wired in. <A> Double pole fusing has pros and cons. <S> A fuse in the neutral can leave the appliance in an "unpowered but live" state after clearing a live to neutral fault which is not especially desirable. <S> It's particually hazardous in situations where people working downstream of the protection point may regard working on wiring after performing single pole isolation as safe (UK electricians are certainly in the habbit of doing this, I suspect US ones are too). <S> On the other hand in a portable appliance placed on the worldwide market or even the european market you really don't know for sure which wire will be the neutral (think of a german or italian mains plug) or indeed if EITHER wire will be a neutral (think of a US 240V supply or a UK building site 110V supply). <S> I'm not sure about commercial equipment standards <S> but I know that EN60601 (the medical electrical equipment standard) requires that live-neutral reversal be treated as "normal condition" which means if (part of) <S> the purpose of the fusing is to protect against live-earth faults then double pole fusing would be needed. <S> Personally if it's going to be used on a portable enclosure to supply only equipment inside the enclosure I would just fit the two fuses and not worry about it. <S> In other circumstances I might make a different judgement call and try to get it replaced with a model that only has single pole fusing. <A> If this type of fuse carrier isn't available for this switched-inlet then this bullet answer doesn't apply. <S> North American 208V two (from 3) phase system (both lines hot) and will probably need 2 fuses. <S> I'm not ruling out any other good reasons! <A> You don't see this every day!. <S> The UL file <S> http://www.schurter.ch/en/Documents-References/Approvals/%28id%29/6765+AND+FIELD+CertificationInstitute=UL <S> (it's only an excerpt) <S> States Conditions of Acceptability - snip . <S> These devices have been only considered for use as supplementary (not in lieu of branch circuit) <S> overcurrent protection within appliances. <S> The Part Nos. 1062, 1062X, 1064, 1064 B1, 1067, and 6766, which accommodate a European type fuse, have the capability of fusing in both grounded and ungrounded leads. <S> Cat. <S> No. <S> 1064 B2 accommodates only one European type fuse. <S> The acceptability of this construction should be determined in the end-use product . <S> The emphasis is mine and means that rules and regulation that apply to the final whole assembly will determine if and when you can use single or double fuses. <S> Also the "not in lieu of branch circuit" means testing under fault conditions may require the fuses to substituted for nails/copper bar during UL testing ..... <S> it's fun to watch the smoke (from both the device and the previously smug design engineers ears....)
This switch is rated at 250V and conceivably it could be used on: - European 230VAC single phase systems (phase and neutral) where only one fuse is required and there are likely available inserts that bypass one fuse and just leave the single fuse in the hot (live) wire.