Wednesday 31 January 2018

switches - Toggle Switch to swap the connections of two buttons


I am trying to mod my arcade stick so I can switch two commonly swapped buttons on the controller.


Essentially they are simple 2 terminal momentary switches connected directly to the controller PCB. I would like to switch their responsibilities, so in my case the Back button and the LB button on the XBox pcb I would like to swap so the Back actuates the LB button on the PCB and the LB actuates the Back button.


My assumption is that I would need a switch with 8 terminals, 4 in 4 out.


What type of switch am I looking for?



Answer



If the two existing buttons do not share a common GND connection then you will need a four pole double pole (4PDT) toggle switch. Such switch has twelve terminals.


If the two existing buttons share a common GND then you can get by with a double pole double throw (DPDT) switch. That switch will have six terminals.



Here is how you would connect the button flipper switch when a common GND is in place.


enter image description here


If the two switches do not share a common GND then you would use the 4PDT switch and basically duplicate the above circuit on the switch for the other sides of each button.


voltage regulator - I can't find the values of the currents


The picture below is on page 7 of the datasheet of TL497, it is a switching regulator that I use as an inverting regulator (it has an inverting mode) to generate -24V from 12V in input, in the first designing equation on this page I have 2 unknowns "I(pk)" and "Io max" I don't know how can I find their values ?? In the datasheet it is wrote that I(pk) maximum value is 500mA so if I(pk) in the equation means 500mA why they didn't write 500mA simply unless of I(pk) also I(pk) max value is 500mA it can be lower than that and if 500mA means the "Io max" then I(pk) value will be 3A for VI=12V and |Vo|=24V which is impossible because I(pk) max =500mA. I hope I explained well. datasheet:http://www.mouser.com/ds/2/405/tl497a-405896.pdf enter image description here




capacitor - Calculating signal attenuation for AC?


So we've got this;


schematic



simulate this circuit – Schematic created using CircuitLab


Which I've been told is equivalent to the sum of it's Coutputs to an AC signal;


schematic


simulate this circuit


So then;


$$ {1 \over C} = {1 \over 135} + {1 \over 135} + {1 \over 68} $$


$$ {C} = 33.874 $$


You plug it into the attenuation equation;


$$ f_C = {1 \over 2 \pi X_LC} $$


Where \$ X_L = 2 \pi f L \$ \$ \rightarrow \$ \$ X_L = 2 \pi (130000)(0.025) \$ \$ \rightarrow \$ \$ X_L = 20420.4 \$



$$ f_C = {1 \over 2 \pi (20420.4) (0.000000000033874)} $$


$$ f_C = 230086Hz $$


So anything below that just passes through the MOSFETs, regardless of whether or not they are on, right?


So I'd need something like;


$$ 70000 = {1 \over 2pi (20420.4) C} $$


$$ C = 0.0000000011342 $$


$$ C = 113.42pF $$


Which means my MOSFETs need to be;


$${1\over C} = {{1 \over 113.42} + {1 \over 68}}$$


$$ C = 42.512pF $$



In total. Which seems RIDICULOUSLY low for 600V at 0.4-0.5A.


So what do I do? Bridge rectifier setup? Currently my signal goes right through this SSR setup at 100-130kHz.




ATTEMPT TO SOLVE #1




So I was reading the datasheet for the AOK42S60 - Figure 9 at 5V, \$ C_{SD} \$ is around 8000-10000pF. Which is really, really high. However, if we take a look at \$ X_L \$ and \$ X_C \$ at 120kHz, we get the following values.


$$ X_L = 2 \pi (120000)(0.025) $$


$$ X_L = 18850 $$


Which is good.


$$ X_C = 1 \over {2 \pi (120000)(0.00000001)} $$



$$ X_C = 133 $$


Which is terrible. However, according to common sense, if I increase \$ V_{SD} \$ to 130V (which is the 'knee' in the graph, where it starts to become more flat), \$ C_{SD} \$ decreases to around 100pF.


$$ X_C = 1 \over {2 \pi (120000)(0.0000000001)} $$


$$ X_C = 13263 $$


Which is a hundred times better. Literally. So now the current does not exclusively want to flow through the capacitor as if it's a short. That solves that, math out the rest of the capacitance (the other FET and the cap) and you get around \$ 47367.5 \$


Now look at that! The current is now thinking "there's not a chance in hell I'm going to jump the switch at that frequency, it's gotta be way higher". As evidenced by this;


$$ X_C = 1 \over {2 \pi (350000)(0.000000000028)} $$


$$ X_C = 16240.3 $$


Now the current doesn't care about your puny switch, since \$ X_C \$ is less than \$ X_L \$, and it sure as hell doesn't want to go through a higher impedance inductor, so it jumps the switch and boom, screwed again.


Now on to the final math;



If we take a look at it as it really is, two MOSFETs plus a cap, plus the next two and their cap, etc. etc.; the 'maximum' operational range of capacitances.


One inductor, one default capacitor, three AC switches.


Inductor = 25mH Default = 68pF Switch 1 = 188pF Switch 2 = 120pF Switch 3 = 270pF Each FET = 100pF~ (Two on each switch)


And the resonant frequency ranges from 80-120kHz for use.


NB: I actually did the equivalence circuit for this, but it's on paper, and long and boring, so I guess you'll have to trust me on the values, if someone asks in struggle for the answer, I'll upload it; if not, not.


We get the following (for the highest value frequency, 120kHz, with all switches open (i.e. worst case scenario with biggest parallel capacitance));


$$ X_C = 1 \over {2 \pi (120000)(0.000000000185)} $$


$$ X_C = 7169 $$


And the lowest frequency (best case, biggest capacitance);


$$ X_C = 1 \over {2 \pi (80000)(0.000000000185)} $$



$$ X_C = 10754 $$


A LOT better, according to these calculations. Also, these are ideal, inherent circuit inefficiencies will boost the impedance of the cap.


I'd like to get some criticism for these, cause I'm about two impulsive decisions away from hooking this up and testing for myself, and I want to know if I'm correct.


EDIT: Obviously not going to run a system that resonates at 80kHz at 120kHz. Going to switch the 120kHz caps in, and run it at that, therefore \$ X_L \$ and \$ X_C \$ will be relatively equal. Resonance.




I guess now I just need to know how much impedance is "enough" to block the AC signal from jumping. I'm going to guess it'll be around equal to the impedance of the inductor, so resonance, which means I'm gonna have to calculate new capacitor values for 80, 100, 120kHz in order to get things going. And then I'm going to have to make sure to include the parallel capacitance.


This is kind of easy to solve, but tedious; also I didn't realize \$ C_{SD} \$ was SO large at lower frequencies. But I guess that's obvious if you think about it, even without the data sheet.


Will run calculations, replace caps, then go back and answer these 3 questions for anyone else who might run into the same thing.




Tuesday 30 January 2018

Driving capacitance with a high voltage level shifter


I am having issues with a 'high' voltage level shifter I am creating. I need to drive a 28Vpp waveform with specific timings ( <.1us rise time, 1us pulse width), converting from the 3.3V logic that comes out of my microprocessor. I currently have the circuit below: Base Circuit


Which produces the following waveform: Base circuit waveform


Great! However, I will need to need drive a fairly long cable. When I add 100pf of capacitance to the output: Circuit with capacitance


I get the following waveform: Circuit with capacitance waveform


This waveform doesn't meet my requirements of having a rise time of less than 0.1us. What can I do to overcome this? I have tried replacing the transistor based circuit with an LM139 comparator, but that was still susceptible to capacitance. Are there ICs available that could fix my issue? I can handle about 4us of prop delay if needed. Thanks!




Charging 12v batteries with direct connection to 20v solar panels


I want to charge a 12v Sealed Lead Acid car battery off of a solar panel (20v) and then draw about 10-20W of power from it via an inverter (the load).


I'm wondering if its okay to connect it together like this: Wiring diag


And what downsides, if any, are there and can I avoid them? Is it a problem hooking up the battery to solar panel without a load?


Thanks!




High side current indicator/


schematic


simulate this circuit – Schematic created using CircuitLab Hi! I am in need to make a high-side current monitor for detecting whether load (R1) is present or not. As currents running through my system are in range of few amps, I have tried my best with a small shunt resistor to keep voltage drop below 0.3V and used comparator in hope to get binary output. Unfortunately the output of the system is also high in absence of load.


Could you suggest me some simple solution to this (potentially) trivial problem?




soldering - How do you remove the buzzer from this PCB whose solder side is inaccessible?


Buzzer 1 Buzzer 2 PCB
(Click on an image to see in original size.)


There is this buzzer in this UPS (uninterruptible power source) circuit. I want to remove it from this circuit because it make a lot of unnecessary noisy. Black-outs happen too much in my area. Sometimes they happen in the deep night, when I am sleeping, and this little buzzer wakes me up by freaking me up. I always immediately realize it when there is a black-out, so this buzzer is really not needed.


I am not able to de-solder it. Because the PCB is strongly embedded into the case by some very hard clippers. It just won't move.


How do I remove this buzzer from the circuit, or shut it up without removing? I don't plan to re-use it, so it is OK if it is destroyed in the process. I just don't want to get into risk of damaging any other part of the PCB.



Answer



You could quieten the buzzer by filling the hole in the top of the plastic. If you pour in something rubbery (hot glue could be good) then it would almost certainly muffle the sound.


To remove it, I'd crack the plastic with some pliers removing enough to heat the legs with a soldering iron.


Monday 29 January 2018

compiler - ARM Cortex-M3 development tools?


I am planning to migrate to the NXP Cortex M3 architecture and I'm a little lost between the existant development tools.



Keil is expensive and I don't know if it's worth it. Anyone who has tried some compiler can give any advice?


I found this compiler http://www.code-red-tech.com/red-suite-2.php it seems good and not expensive. Anyone who tried it or know about it can give me more info?




power supply - Open a circuit when voltage exceeds a certain value?


General question


I would like to protect a load against overvoltage by cutting one of its power lines when the voltage exceeds a set value.


All the examples I have seen online present a way to short circuit the supply but not open it. I can't short circuit the supply nor use a Zener for regulation as the current drawn would be too high (and would limit it under normal conditions).



  1. How can I drive a series transistor to cut one of the lines when a control voltage (from a comparator) is driven high (or low)?

  2. How can I make sure that this protection is unengaged (i.e. supply is on) when the protection unpowered?

  3. How can I make sure it can automatically disengage itself when the voltage goes back within allowed range?


Application



In my case, an alternator generates a voltage which is rectified and fed in a big capacitor before supplying a voltage regulator. I am designing the circuit for a certain alternator rate, but I want to protect it in case it goes faster. 2) comes from the fact that the protection circuit will be powered by the regulator past it... Which means, if it's engaged when unpowered the entire system will never power on!



Answer



I've designed one recently. Here is my memory test: -


schematic


simulate this circuit – Schematic created using CircuitLab


I can't remember what the MOSFETs actually were so sorry for this but it isn't rocket science to simulate this circuit in LTSpice (e.g.) and try a few different MOSFETs. Mine turned off M1 when the input voltage got beyond about 30V - it was protecting a 42V (AMR) switcher on the output side for excessive voltages coming in. M1 is normally on when there are a few volts applied to Vin and as Vin rises past 30V (ish) M2 starts to conduct and shuts off M1.


Both transistors were rated in excess of 100 volts because the generator could lose control easily and shove out well over 50V (this would fry my switcher).


Reading your question, mine as a pretty similar application to yours!


EDIT - I've changed the values in the circuit to reflect what I used in my prototype.


Relay's Flyback Diode - Is it necessary?


I have four 6V, ~80mA Relays mounted on a Perfboard which are being controlled by the 2N2222 Transistors.



The basic problem is that after mounting everything the diodes can't fit in easily.


Is the Flyback Diode really necessary?




What is the relation between the power dissipation in resistor and the temperature rise


Which relation we use to calculate the temperature rise in resistor using the power dissipation. If we take P=R*I^2 from resistor, how much the resistor heats in this case ? I know that in transsitor the relation between the power dissipation and the temperature is given by: Pd = (Tj-Ta)/theta(ja), I try to find the relation of the resistor dissipation but i didn't find anything helpful! Thank you for your help.



Answer



The relationship in both cases is Temperature Rise = Power * thermal resistance.



  • Tj-Ta is the temperature rise (from "junction" to "ambient)

  • theta(ja) is the thermal resistance. And the assumption is that the data sheet gives you this value.



This relation works just like E=IR only it's temperature and heat instead of voltage and current. The relationship you gave for the transistor is in a less useful form for this purpose. You want to apply a little algebra and thus come up with:


Tj-Ta = Pd * theta(ja)


This works for resistors as well, assuming the data sheet will give you a theta value from the resistor body to air. That's the equivalent of junction-to-ambient. In all but high-power pulse operation, it's just assumed that the resistor transfers all of the dissipated power to its body, and you only worry about how it transfers to the surrounding air.


Actually, in the real world, both the resistor and the transistor can transfer a considerable amount of heat out through its leads (or pads). Since your stated equation only mentions junction-to-ambient, that's all that's addressed here.


If you can't get a theta value, you'd have to come up with an allowable maximum temperature for the resistor, and use the resistor's stated power rating to arrive at a value for theta.


Sunday 28 January 2018

power electronics - IR2110 max duty cycle


I'm using the high side of an IR2110 driver. If I set the duty cycle to 100% the circuit burns out, I haven't how can I calculate the max duty cycle for the driver in a given circuit?




Why are most RGB LED strips common anode instead of common cathode?


Why are most RGB LED strips common anode instead of common cathode?



Answer



The reason common anode is more common is because its easier to sink current than to source it. With either common anode or common cathode you'll have one terminal connected directly to a supply for all LEDs and the other side having the dropper resistor and a control transistor per pin (or IC outputs that are transistors on the inside) either sinking or sourcing a current.


NMOS / NPN transistors are stronger in general, more common as discrete and are better at sinking current than sourcing. You need PMOS/PNP transistors to source current (pull up) effectively, but they'll still be weaker at sourcing than an equivalent N-transistor would be at sinking. Thus the best solution is to connect a common anode to the positive supply and sink current from each LED using NMOS transistors.


Older ICs used to be designed exclusively using N transistors for speed reasons, and so were much better at sourcing current than sinking it. This was particularly true of the TTL logic used in the 74LS series chips (still widely used as interface chips). A 74LS00 is specced to sink 4-8mA, but source only 0.4mA.


Modern CMOS ICs are much more symmetrical (an ATMEGA328 in an Arduino can source or sink 20mA) since they use bigger PMOS than NMOS to balance the fundamental differences, but the convention of common anode is well established.


EDIT (More info): If on the other hand you're building a matrix, you'll have to have both current source and sink transistors. In this case it can be best to have more devices in common cathode and fewer on a common anode. The idea here is to have a few fat NMOS devices sinking many LEDs currents and many weak sources (I/O pins) driving a few LEDs each. Of course with common anode strips you could use fat PMOS devices too.


Shrinking an input signal for the ADC


I'm looking to sample a 0 to +15 V analog input signal, and it is not sinusoidal, rather it is impulse driven. I don't need to sample at a high rate (< 1kHz), but I need to sample over the full range of the signal. The way I see there are two options:



  1. Buy a more expensive ADC with a +/- 10 V range and try to bias the input to fit into that swing. This would require two voltages supplies though I think. I may be wrong though...

  2. Attenuate the input signal to make the signal swing fit in the range of normal low-cost ADCs


While 2) seems more difficult in the design, it certainly seems to have a better cost benefit based on what I've seen from Analog and Linear's offerings.


By attenuating the signal, do I risk losing anything though? I was thinking that if the ADC has the same sample bit width as that of the larger swing ADCs, the samples could be scaled digitally in software so that it appears the initial signal voltages are sampled.




Answer



Elementary, Watson. You sortof had the idea with #2, except that you don't want a negative gain but rather a gain between 0 and 1. In other words, you want to attenuate the 0-15 V input signal to match the input range of your A/D.


This is easily accomplished with two resistors in a "resistor divider" configuration. If your A/D has a native range of 0-5V, then you want to divide the input voltage by 3. This can be accomplished, for example, with 2K Ohms in series followed by 1K Ohms to ground.


Anything you do to a signal will always change it slightly. In this case, some of the high frequencies will be lost. However, at impedances of 10s of K Ohms, this won't be a problem with a sample rate of 1KHz or less. That implies a upper frequency limit of 500Hz maximum, rather less in practise. Even 100s of K Ohms used in the resistor divider should be able to pass such low frequencies without losing the part you care about.


Saturday 27 January 2018

power supply - First PSU - need help with capacitor size


I am building my first power supply unit (my first project too) and need help in figuring the size of filter capacitor (and type, though I presume Electrolytic) I need to use after the rectifier diodes.


Specs:- 2 channels of 1.5VDC - 9VDC adjustable outputs with max 2.5A over both channels


Components sourced:- 229D12 Transformer - output is 12.6VCT (3.8A) at 60 Hz (65% = 2.5A) .... 4 x 1n5404 rectifier diodes (rated at 3A with Vf=1V) .... LM350 adjustable voltage regulator (rated at 3A with Vf=1.25V)


What I know so far:- 60Hz rectified is 120 cycles/sec so T=0.00833sec .... 12.6V - (2*1V diode drop) = 10.6V rectified - 1.25V (Vf of LM350) = 9.35VDC max .... Max current is going to be 2.5A (limited through LM350 and 3.74 Ohms of resistance)



I have tried sourcing the formula to calculate the size of capacitor needed, and I have seen many formulas regarding capacitors. Each one of them confused the heck outta me with funky symbols and abbreviations that I have yet to learn and each of the formulas was for something other than what I was wanting.


I speak basic English, understand average Mathematics, but still have no idea on most of the symbols and abbreviations used in EE. Please keep your answers simplified for this noob. :D


I appreciate any help ya'll can give.




power engineering - Why don't we use neutral wire for to ground devices and earth wire for closing the circuit?


I know that the neutral point of a distribution transformer is connected to the grounding (earthing) wire, so I think they are the same.



Can I use the neutral wire for protecting metal-cased electric devices by connecting it to the case (cover)?


Can I use the grounding wire to close the circuit? For example, can I connect a light bulb between the live wire and the ground wire?


I think the answer would be, "Yes, but It is bad to do this," but I don't know why it is bad.


Edit:


transistor, Thank you very much for your great answer and your time. I appreciate that. I have one more thing that I still don't understand. I wonder if you would mind answering me and I hope I'm not bothering you by my questions.


If the bulb is connected this way:


schematic


simulate this circuit – Schematic created using CircuitLab


If the customer touches the lamp when it is switched on, I do not think she will notice a slight tingle because the return path is the ground.


If the neutral wire fell off, the metal case is not live. If the ground wire fell off, the bulb will just turn off but there is no danger. Is it correct to wire devices this way?




Answer



schematic


simulate this circuit – Schematic created using CircuitLab


Figure 1 and 2. showing the danger of earthing through neutral.


In the first example the Lunatic 'Lectrician has 'grounded' the lamp case by connecting it to the neutral wire. All appears OK although the customer notices a slight tingle when she touches the lamp when it is switched on. This is because there's a slight voltage drop caused by the current through the return wire. Customer lives this time.


In the second situation one of Lunatic 'Lectrician's wires fell off. Unfortunately it was the return wire and now the metal lamp is live. (The bulb resistance isn't high enough to protect the customer.) Lunatic 'Lectrician may lose this customer.


schematic


simulate this circuit


Figure 3. Phase reversal danger with 'neutral' connected to frame of lamp.


Now not all countries use polarised plugs and unfortunately Lunatic 'Lectrician operates in one of these countries. There's a 50/50 chance of the plug going in the 'safe' way. There's a 50% chance of it going in this way.



Do you need any more convincing?


schematic


simulate this circuit


Figure 4. Properly wired lamp.


Consider what happens in a correctly wired system. If the live wire falls off the bulb and touches the metal case a large current will flow to earth. If the fuse is correctly rated it will quickly blow disconnecting the live supply. If the neutral shorts to the case the fault may not be detected and the current may split between the neutral and earth wires. An RCD / ELCB will protect against this type of fault, but that's another question.




Update after question update.


schematic


simulate this circuit


Figure 5. Break in earth wire.



No. It is never safe to use the earth wire as a neutral. Consider Figure 5: the ground wire has broken and anything else connected to it will become life once S1 is switched on. It's just too dangerous. It will cause potentially fatal confusion to the next person to modify the system. Stick to good practice, local regulations and enjoy a long life.


arduino - How to control a 12V solenoid valve with a mosfet?


I'm trying to control a 12V DC solenoid valve through a MOSFET (BS170), which receives its control signal (5V) from an Arduino microcontroller. This is the basic schematic: enter image description here


When I test the MOSFET, putting a LED with a 1.5k ohm resistor as Load (see picture), it works fine and I can control the 12V current with the 5V signal, without problem.



But then I connect my solenoid valve instead of the LED. It works for a few seconds, then it stops working and the MOSFET ends up permanently conducting current, regardless the state of the 5V control pin.


The MOSFET is permanently damaged, because when I connect the LED again, it doesn't work anymore.


Too much current? But when I add a resistor before the valve, it doesn't operate anymore... Maybe I need a heavier MOSFET/transistor?



Answer



Read my blog entry "Byte and Switch" -- it covers this exact scenario.


The short answer is that you need a freewheeling diode to conduct the current when the MOSFET turns off; the solenoid has inductance that stores energy in the magnetic field, and when you turn the MOSFET off the inductance will generate however much voltage is necessary to continue flow of that current. The resulting voltage pulse will cause breakdown in the MOSFET which causes the damage you are seeing.


You should also add a couple of resistors, one from microcontroller output to ground, to make sure it's off when your microcontroller is in reset, and the other from the microcontroller to the MOSFET gate, to add some resistive isolation between your power switch and your microcontroller.


enter image description here




edit: I just noticed you're using a BS170 MOSFET. Have you looked at the datasheet? This is a poor choice for a MOSFET used as a power switch from a microcontroller.



First of all, the MOSFET is specified at 10V Vgs. You're supplying it from a 5V microcontroller. You need to make sure you use MOSFETs that are "logic level" and have on-resistance specified at 4.5V or 3.3V Vgs. (I suggest you not use ultra-low voltage MOSFETs as there's a possibility of it turning on weakly when you think it is off.)


More importantly, it's a small TO-92 MOSFET specified at 5 ohms max Rdson at 10V Vgs. This MOSFET is fine for very small loads like LEDs drawing a few milliamps. But solenoids generally draw tens or hundreds of milliamps, and you need to calculate I2R loss in your MOSFET for the current load it draws, and make sure that it doesn't cause your transistor to overheat. Look at the thermal resistance R theta J-A on the datasheet and you can estimate how much temperature rise there is in the part.


Use a MOSFET in the 20V-60V range that has a lower on-resistance -- as I said in my comment, we need to know how much current your solenoid draws if we're going to help you.


amperage - How do I correctly estimate heat output for heater wire


This is based on a problem that came up today. During the course of this problem I realized that I wasn't so sure I understood the relationship between wattage and heat produced.


In the past we did a test in the lab using .305 Ω /ft wire. The jacket is rated for 150C. We were able to get about 6.5A (at 3.66V) out of it at 24C ambient, with out exceeding the jacket rating. I want to estimate what the ampacity of 0.027 Ω/ft wire is. So I am wondering if I did it correctly, because this amperage seems a little high for the wire to handle, then again most copper wire is only rated at 90C.


So the math I did on it was this


So you do .305 * 2 = .61 Ω /ft 6A^2 * .61 Ω = 21.62W (I^2*r = W) 21.96W * / 2ft = 10.98 W/ ft


So would it be safe to assume that if I did the same with a 0.027w/ft wire with the same jacked I would arrive at this amperage?


If you start with 11W/ft * 2ft = 22W 0.027 Ω * 2ft = .054 Ω Sqrt(22W/(0.054 Ω)) = 20.18A


ETA: we are planning on testing this tomorrow when we get some wire in. So we shall find out.




Answer



I don't quite follow your calculations. But if you are doing I^2 *R as the power, and assuming the same max power for each wire.. then that's what I would have done.


However I went here and it looks like I*R is about constant. (?)
(I had to plot it.) Still looks linear.


Maybe someone can tell us both why.


Edit: I*R dependence. (Thanks Spehro, it was suddenly obvious on the drive home.) No matter the thermal loss mechanism (convection, radiation..) It will go as the area of the wire. 2 * pi *r * l (r - radius and l - length), so bigger wire will need more heat to get to a given temperature. (more later)


enter image description here


Friday 26 January 2018

fpga - How to make an .sof upload to an Altera Max10 stick




I have a Max10 dev board with a 10m08 chip on it. I made a simple counter to blink the LED's. My counters have asynchronous resets, and my asynchronous reset has a circuit to keep it low for two clock cycles and prevent metastablity. I reset the fpga and it the counters stop (they all go to zero), it only starts counting when I upload a new flash to the dev board. If I power down the FPGA and power it back up I get the same result. This leads me to believe that its not my reset and its more of a flashing problem. Is there some kind of setting to make the flash stick? or should I go back to debugging. How do you make the flash persistent, I don't see an option for that in the programmer, do you have to configure the user flash?



Answer



I answered a question here that details some of the different types of FPGA file formats: FPGA: Bitstream vs. SRAM Object File


Basically, right now, you're flashing just the SRAM with the SOF (SRAM Object File) -- this is volatile, and will be lost at power down or reset. SRAM FPGAs generally load their configuration from a configuration memory on-board, or a microprocessor that configures it (via ISP or similar).


In your case, your MAX10 dev board has a built-in USB Blaster device that should be able to program the on-board configuration memory. See page 4-4 of the user-guide and how to generate and program a POF instead of a SOF. This will keep your configuration on the flash memory device, and it will get loaded at every power-on.


I believe the Quartus II programmer can download a small executive to the FPGA (via JTAG) that then provides access to the SPI memory. It then uses that temporary executive to flash the SPI memory, and then resets.


pcb - OK to connect boards perpendicularly like this?



Are there any disadvantages in using the following method to accomplish a perpendicular board-to-board connection?


(i.e., any disadvantages in terms of



  • board manufacturing capability/cost

  • assembly convenience

  • mechanical stability

  • contact reliability

  • and any other potential issues in long-term use of the boards that I am not seeing)


enter image description here



DETAILS:


Since there are only a few contacts needed and within a limited space, I am trying to do this:



  • Design 1st board with a "pseudo-connector" by shaping copper-pad protrusions directly within the board's dimension

  • Then make complementary-sized vias on the 2nd board

  • Finally, insert the conductive protrusions of the 1st board into the 2nd board, and solder


NOTE 1: Each of the two boards will be mechanically bound using screws to the enclosure's top and side walls, respectively.


NOTE 2: Another related solution for the board-to-board connection might be to have castellated vias at the edges of baords, which can be soldered with the boards at right angles, although this approach might make alignment less convenient during assembly. Perhaps this method has some advantages though?


NOTE 3: I didn't wish to use headers/receptacles/plastic-connectors, because they would bring up additional part costs and assembly steps.





integrated circuit - General "rule of thumb" for unused IC pins


This is somewhat similar to this question about NC pins. In cases where the datasheet doesn't specify what to do with unused IC pins, what is the recommendation to do with these pins? In particular I'm thinking of GPIO pins for the AT32UC3C microcontroller, but also more generally for other IC types (for example multi op-amp IC's).


I can think of a few possible combinations:



  1. Provide a solder pad/hole so the chip is secured but leave pin floating.

  2. Connect the pin to ground (possible through a resistor/capacitor/etc.)

  3. Connect the pin to a supply source


  4. Something I can't possibly think of



Answer





  1. "Provide a solder pad". Of course you will. All the IC's pins should be soldered. Always. Leaving it floating is NOT a good idea. It may change level all the time, which may have undesired effects to the internally connected circuitry. You always want to have predictive behavior. If the input has an internal pull-up resistor this is a good solution, though, as long as you don't forget to enable it.




  2. "Connect the pin to ground". That's a good solution, provided that you can guarantee that the pin will never become an output. Output high and you short-circuit the power supply. A resistor would prevent that, but that's an extra cost. Don't use a capacitor; it would leave the pin floating, and the microcontroller doesn't like the capacitive load in case it would become output.





  3. "Connect the pin to a supply source". Same as above: if the pin should become output low you'll have a short-circuit.




  4. "Leave unconnected, but make the pin output". That's the best solution. Don't use the possible alternate functions, like ADC or serial. A high level is preferred in case you forgot to switch off the internal pull-up resistors, which otherwise would cause a (small) leakage current.




For opamps the output can be left open, and the inputs to a fixed voltage, but not both to the same! I recently saw in a Linear Technology application note how they connected the non-inverting input to V+, the inverting input to V-. Szymon rightly points out that this can't be used if the inputs have clamping diodes.



The best thing to do with a surplus op-amp it is to use it. There are lots of places in an analog circuit where a buffer amplifier may improve performance - and a unity gain buffer uses no extra components. (from this article, linked to by Szymon)




Thursday 25 January 2018

Is it possible to get input from a 10x10 grid of switches using an arduino board? (Uno, Mega, etc.)


I'm more of a software guy but I'm working on a prototype of a game that will use a pressure sensitive 10 by 10 grid. This will require 100 switches just for the grid. The closest I've found to off the shelf is an Arduino Mega 2560 r3 but it still comes up short by 30 pins. What is the best approach to this? Should I look into getting more gpio pins or is there a better, more efficient way of accomplishing the task of receiviving positional data from a 10x10 grid (think a1,b2,c3 and so on)?


While Googling a bit I came across a method using resistors and analog pins to get input from multiple buttons. The tutorials always seem to use 5 buttons, Is this a limitation of the tutorials or the method? Could the same method be used to string together 10 switches? link to multi button example



Answer



You could arrange the buttons in an X-Y layout, like in the figure below (which I extracted from this source). That will allow you to use 20 pins (10 for the rows, 10 for the columns) instead of 100.


X-Y keypad arrangement


The polling algorithm is as follows (from the same source):




Continuous Polling Operations


In this mode of operation, the MicroConverter continuously polls the keypad for a key press. This operation is used where the MicroConverter has completed a task and is now waiting for input before proceeding. In this mode, the keypad is connected to one port of the MicroConverter, Port 2 in this example. Figure 3 shows the connectivity. The output from the MicroConverter, following a key press, is viewed using HyperTerminal running on a PC. The MicroConverter is connected to the PC via the COM1 port. This is the reason for showing the RS-232 connection.


As can be seen in Figure 3, the four columns (X1 to X4) are pulled up to VDD and are also connected to four of the MicroConverter port pins (P2.4 to P2.7). The four ADuC8xx rows (Y1 to Y2) are connected to the other four port pins (P2.0 to P2.3). The MicroConverter outputs 0 or drives low the keypad rows (P2.0 to P2.3) one at a time and checks the columns (P2.4 to P2.7) for a low condition.


For example, the following is the sequence of events up to a switch press detection (Switch 5 in this case). The MicroConverter outputs a low on P2.0 (Y1) and checks for a low on P2.4 to P2.7. In this case, no low is found and so it returns P2.0 (Y1) to high and moves on to P2.1 (Y2). The MicroConverter now drives P2.1 (Y2) low and again checks P2.4 to P2.7 for a low condition. This time it finds that P2.5 (X2) is low, due to Switch 5 being pressed. The MicroConverter now knows that the interconnect of Y2 and X2 has been shorted, therefore, this is 5.



But you don't need to implement the algorithm yourself. Instead you can use the Arduino Keypad lib. The links are below:



See this answer if you need to lay down the buttons yourself. It explains how to layout 4 pin buttons on a single-sided board in a way that you don't need to use jumpers. I'm copying the X-Y layout from that question below:


X-Y keypad layout


How much resistance does the capacitor itself contribute to an RC circuit?


Are the effects of the internal resistance of a capacitor in a non-repetitive RC circuit with an RC time constant of less than a nanosecond significant? I have only been able to find equivalent series resistance ratings for capacitors, which are usually measured at 100 kHz.




arduino - Stepper Motor works at 5v, driver explodes at 12v?


After i salvaged some stepper motors and read alot about them i finally decided to try them out... But before i did i asked: Simple stepper motor circuit safe?


in the above question you can find datasheet and circuits of the motor i used.



I opted for the Mitsumi M55SP-1N from hp printer and the ULN2803A as driver.


After finding the 2 coils and the center tap i tested with 5v using a battery.


As expected everything worked fine.


It was time to solder things together. I used 2 channels per chip To be sure to have enough sink and not overheat the chip. I tested everything again with 5v. Perfect.


Now, as the motor is a 12-24v motor i atached a 12v 1.25Ampere powersupply.


The green Light on the powersupply started to dimm as soon as there was current flowing trough the ULN2803. Anyway the motor just made some random noises and unexpected steps.


Even if the whole setup should consume less than 1.25Ampere i decided to power it with a bigger one. So i took a 12v 5A powersupply and turned the motor on.


After 3 erratically stutters the uln2803 exploded.


The only thing i could think of was wrong is the missing Diode between the powersupply and the common of the ULN2803 wich should be optional as the that chip already has alot of protection diodes.


Please help me to understand what i did wrong. I'm not an electrical engineer, i'm just trying to learn new things and i don't want to give up now. i have more uln2803...



here is the finished circuit http://imgur.com/a/tCdwk (2 images) and shematic


schematic


simulate this circuit – Schematic created using CircuitLab



Answer



While bipolar stepper motors require a quad half bridge driver, your unipolar motor has center tapped coils that can be driven by a simple transistor array such as the uln2803.


schematic


simulate this circuit – Schematic created using CircuitLab


Freewheeling diodes are required to prevent the inductive kickback caused by the coils when the transistors switch off from destroying the transistors, but the transitor array you selected already has integrated freewheeling diodes. Judging from the pictures you posted, the COM pin is connected to the supply voltage: the diodes are properly connected.


Looking at the datasheet, the individual transistors can only sink an absolute maximum of 500 mA each, and the entire chip can sink a total current of only 2.5 A. Placing two transistors in parallel (as you have done) doubles the maximum current in theory, but with bipolar transistors this is not always the case in practise. The transistor that heats up more will have a lower forward voltage and thus tends to gobble up an even greater portion of the total current causing it to heat up even more in a feedback loop.
This is not the case with the ULN2803, however. The transistors share the same die and are actually designed to be paralleled, obviating the problem:



current sharing


The problem


It appears that the collector current is too high at 12V. Currently the only thing limiting the collector current is the winding resistance, and the same resistance at 12 V will pass 2.4 times the current it passed at 5 V. You have three options for correcting this:




  • Use a bipolar stepper with more turns of finer wire




  • Add two current limiting resistors. A resistor should be connected between each center tap and the supply voltage, and should have a value that when combined with the winding resistance limits the current trough each transistor to (preferably much) less than 1A. The COM pin should still be connected to the supply voltage.





  • Pulse-width modulate the coils. By lowering the duty cycle, you can lower the effective motor voltage. This has the advantage of higher efficiency and that you can increase the motor voltage when the motor speed increases, countering the back-EMF generated by the spinning rotor and better maintaining torque at speed. The disadvantages are that switching losses will be generated even when the motor is at rest, the constant pulsing will generate coil whine and the code will necessarily be more complex.




switch mode power supply - SMPS, output ringing?


I built an SMPS (see here for details), and so far it's been working good. But I noticed a strange oscillation (or ringing?) at the output.


Here's what it looks like, with a 4 amps load:


enter image description here


Now, you'll see a HF oscillation when the switch turns on (right at the center of the image, for example). I measured this at 15MHz and figured the MOSFET needed a snubber. I added one (10nF + 10R in series, across D and S), and the 15MHz ringing went away completely.


But I still have that "larger" ringing that can be seen in the picture, around 3.5-4MHz.


What is this ringing?


Is it harmful?


If it is: How can I fix it?


EDIT: Here are some measurements (transient response, voltage across MOSFET and diode, etc). http://imgur.com/a/Qs351





adc - Low current divider for battery voltage monitoring


I’m working on a low power sensor and would like to measure its battery voltage.


The battery voltage is too high my ADC input so I have been dividing it with a pair of 1M resistors and a 100n cap so that the ADC’s input capacitance doesn’t load it too much while sampling and affect the results.


The trouble is that the resistor divider drains a few uA all the time and this is far from ideal. Is there a common solution with a low BOM cost to this problem?



I thought of switching an N channel mosfet to the base of the divider but it would allow the ADC input to float too high. Putting a P channel on the +ve rail would be difficult to drive.


Do special ADCs exist that can measure beyond the +ve supply rail?


Any suggestions welcome.



Answer



Use a simple circuit like this. The P-Channel MOSFET can be some other low current device - The one shown is just the one that showed up in the schematic tool.


schematic


simulate this circuit – Schematic created using CircuitLab


The idea is to connect the GP_OUT signal to your MCU and have the software drive that high at the time an A/D measurement is to be made. I show using 100K resistors for the divider but these may need to be scaled down depending on the input impedance of the A/D input pin. It's been my experience that 1Meg resistors used for this purpose lead to too much measurement error.


Some delay from setting the GP_OUT high will be needed till the A/D conversion is commanded to allow for settling of the A/D input.


Note that when the NPN transistor is off the only load on the battery is leakage current.



book recommendations on FPGA




what book titles would you recommend to get started with FPGAs and VHDL?



edit
I noticed that a few of the recommended books date back from 1996. I can imagine that the devices referred to will be seriously outdated, but has VHDL also much evolved since?



Answer



The Designer's Guide to VHDL, Volume 3, Third Edition by Ashenden is quite good. Others I have found useful are VHDL for Programmable Logic by Skahill and VHDL Made Easy! by Perrilin.


Wednesday 24 January 2018

programmable logic - What are my less expensive options for getting started with CPLDs



I would like to goof around with some CPLD stuff and I see I have a couple options out there. I don't have a particular application in mind; it just seems like there a lot of possibilities, some of which are easier to use than others.


The main manufactures have development boards, some more expensive than others. They also have programmer cables that generally seem... not cheap. Doing some digging, I've come across several options and I'm looking to understand the pros/cons of each.



  1. Is it fair to say that CPLDs with X Macrocells are more or less the same?

  2. Although the JTAG interface is standard, for the purposes of programming the part, there is no standard previous JTAG Question. Is this a matter of the vendor software talking to the programmer? Do things become more standard if I use some other utility to dump a binary file?


  3. Some of the platforms have cheaper alternatives. I'm wondering what the catches are with these in terms of USB/parallel port, Linux/Windows.

  4. Assuming I get comfortable with a development board, how difficult is the transition to just using one of the base parts directly? My impression is that in the major options, it's just a matter of some header pins and a couple diodes/resistors. Am I far off on this?

  5. How would I program the devices in my own designs? If I have a development board or starter kit, will I then have to go back and buy an expensive programmer? Why does a dev board sell for cheap but the programmer runs hundreds of dollars? Presumably the dev board comes with the ability to program.


Here are some of the options that stand out for me. I list the prices only to differentiate them from the multi-hundred-dollar options. All of them are in the ballpark for me. I'm looking for the hiden costs in terms of ease of use, software issues and so on.


Xilinx is a popular path. I could do:



The Digilent cable requires using their software which is currently windows only, so I'd need to go the $48 USB route.


Another Xilinx possibility is




Switching companies to Lattice:



I like the idea of using Lattice parts as Mouser.com carries them (I don't see much Xilinx there). I tend to order more from them. Once I get comfortable with their stuff, I'm guessing that I could hack up a programmer cable based on the schematics of this board. It looks really straight forward. Could I use the eval board as a programmer? The do expose the JTAG header?


The Lattice MachXO2 Pico kit ($29) also looks to be a great value, though the part that it's showcasing is more expensive.


Altera also has good offerings.



  • A programmer can be had from EBay for ($15)

  • A demo board can be had from EBay for ($28)


Alternately, Altera has




  • A starter kit for ($50)


Which of these is the better route for a beginner that is easier to get working (drivers and such), has some staying power, and perhaps offers the most flexibility?




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



enter image description here



My Try:


enter image description here




Now


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


so its becomes


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


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


So for part \$(a)\$


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


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


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


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



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




identification - How do I identify this component? It just says 0 on it



Can anyone help me identify this component? It just says 0 or D on it (I think it's a zero). I tested it for conductivity with a multimeter - doesn't seem to have any (tried both polarities in case it's a diode). Tested for resistance: nothing (i.e. infinite resistance), although I'm not 100% sure I was touching the contact points correctly, so don't take this as an ultimate measurement. Thanks in advance! enter image description here




switches - Current over ethernet?


It seems that the voltage over ethernet ranges from 2 to 3 volts. How much current typically runs through the wires? I tried Googling with no success.


I ask this because I'm looking for components that are able to switch on and off an ethernet connection.




How to drive 3 1/2 digit static TN LCD with ATmega328 in low power mode?


I've built this clock with a 3 1/2 digit static TN LCD (GYTN-0587). I drive the 28 LCD segments with an ATmega328 and four 74HC595N shift registers chained together.


Here are the (simplified) schematics (link to larger image):


LCD clock schematics


And here's a picture of the board:


LCD clock


(The board also have an LT1111 regulator in boost configuration and a DS1307 RTC that are not shown in the schematics for simplicity.)


To save batteries and run the clock for several months on the same cells, I planned to run the ATmega in low power mode, waking it up only once per minute or so just to change the display and putting it back to sleep. However, I later learned that TN static LCDs must be refreshed at 10 to 30kHz (sorry, I couldn't find the document I read that - I couldn't find much information about driving TN LCDs out there).


Well, if I drive the shift registers at 30kHz it will leave me no time for the '328 to sleep. In the end that's what I'm doing, refreshing the LCD at 30kHz and the clock works ok. But the batteries run for only about 40h.



If I ignore the LCD refresh rate and leave the segments on for several seconds, the segments kind of vanish away (as in the picture below).


Vanishing segments when not refreshed


I couldn't find anything about the LCD power consumption and I haven't measured it, but I'm pretty sure the LCD consumes very little current (in the uA range). The '595 also won't use much current either since they are not sourcing much current and consume only 160 uA each. What's wasting all my batteries is the ATmega refreshing the LCD. I just need a different way to drive this LCD that doesn't take as much cycles from the MCU.


My questions are:




  1. Can I drive this LCD in low power with this circuit I've built? If so, how?




  2. If not, what changes should I make to my circuit so I can drive the LCD with minimum power consumption?





  3. What is the Right Way (TM) of driving these LCDs?





Answer



No, you don't need to refresh static LCDs anywhere near that fast. 60Hz should be fine- which will give you a couple years of battery life if it scales (it's normally in the range 30-100Hz).


The main thing is that you need to make sure that the average DC voltage from each segment to backplane is very low (like < 50mV). Easy when you're driving it with CMOS push-pull outputs. You must drive the COM high/low with a 50% duty cycle (very close to exact) and drive the 74HC595 outputs high/low in sync either inverted (on) or not (off). If you want to blank the display make sure no DC voltage appears across the display (the reason for this is that DC voltages cause electrochemical action which can permanently damage the display). It doesn't look like you are doing that.


Here is an application note from Atmel that shows how to do it with a microcontroller, showing the proper waveforms:


enter image description here



So probably the best way would be to wake up, flip the COM and RCK the new data in from the shift registers (perhaps alternate doing COM or RCK first), then calculate the next frame segment data, shift it out to the HC595s via SCK without transferring to the output register and go sleepy-bye. Repeat forever.


capacitor - Why put a resistor in series with signal line?


A lot of times in circuits I see a resistor placed in series in a signal line and sometimes even in series with an MCU's VDD line. Is the intention of this to smooth out noise in the line? How is this different from using a small cap, like a .1µF to do the same thing?




Tuesday 23 January 2018

operational amplifier - voltage current converter by op amp circuit


I am trying to convert 5V to a constant current source


circuit


for op amp I use AD822. for 250 ohm I use 180 ohm, so I should get a current of 28 mA. I verified when Rload = 0, 28 mA across negative terminal to ground.


But when I put Rload to circuit, 680 ohm, my current exceeds 28mA as Vcc increase.


Can anyone please point where might be the error?



Answer




The "operating output current" for an AD822 on a supply voltage of +/-15V is limited to 20mA (see page 9 of the data sheet).


Absolute maximum rating for the device is +/- 18V.


Either lower your expectations for this device or choose a more appropriate op-amp or an op-amp BJT combination.


amplifier - Design help! -- Play a pure tone into a mic and depending on its frequency a specific LED will light up


I'm still new to electronics and am making this in order to learn more about circuit design and filters. I do not want to use microcontrollers. I want a purely analog solution.


I'm trying to make a frequency detector that detects between 5-10 different frequencies. There will be a mic, an amplifier, a set of bandpass filters, and an LED that corresponds to each filter. The goal is to play a relatively pure tone into the mic, and have a certain LED light up which will be telling of the frequency of the tone. I want each filter to have a range of around 100Hz. The ranges will be 100-200,200-300,300-400,400-500,600-700 and maybe some more.


If I play a tone of 250Hz, the LED that correspond to the 200-300Hz range should light up.


The method I thought of is to have comparators after the BP filters so I can cut off the frequencies I don't want. The output of the comparator will be connected to the LED. I would much rather have the filter do the cutting off rather than having to use comparators, but won't I need a very high Q filter so that for frequencies immediately past the cutoff range the LED is completely off rather than being dim? How can I do this without using comparators?



My proposed flowchart of the circuit is mic->band pass filter->amplifier ->rectifier->low pass filter->comparator(maybe)->LED


Regardless of whether I use comparators or not, I will need to know the input voltage so that I can amplify it to the right level to light the LED. How can I do this if when I play a tone in the electret mic, the output voltage will change depending on how loud it is and how close to the mic it is. How can I take this into account when I design the circuit? I looked up automatic gain control schematics, but it looks a little bit too involved for my liking and would add a lot of complexity to the project. Is there any other option?


What kind of band pass filter do you guys recommend? I know there are two main categories, passive and active, but I don't know enough to judge which one will be best suited for this application. I'm leaning towards active because then I won't have to use inductors which are expensive and could possibly cause interference if they aren't shielded properly. From what I've read, active filters are easier to design and are less dependant on the load connected to it, which is a plus for me since I'm a beginner.Also since active filters have a 'built in' amplifier I won't need to make a separate amplifier. Anything I'm missing?




Protected USB connectors?


Do USB connectors come in protected versions suitable for damp, vibration prone environments? If so, what terms should I use when searching for them?


If not, what are my options for meeting the USB wiring and connectors standards without standard USB connectors? Can I use different cables and connectors and "make up" for the electrical differences by terminating the ends differently?



Answer



You mean like this?



Industrial USB


These are really just normal USB connectors, but with a strong, waterproof connector over the top of them. This holds them in place despite vibration, protects them from mechanical abuse, and keeps the water out.


I think the key word you need is 'industrial'. Farnell stock a bunch of them.


Also, take a look at the Bulgin datasheet. From this, you can get the part numbers for the panel mount, and cable mount versions of the connector.


Monday 22 January 2018

batteries - Building a Battery Charger with an LM317


I was told that i could make a simple battery charger from a LM317 and a resistor to charge some Ni-MH Batteries. Can someone just expand on this a little such as how it works as I don't really understand it. Some more information is that there are 12 AAA batteries that hold a charge of 1000mAh and 1.2v per cell.



Answer



This page apparently describes a LM317-based charger with auto-shutoff, though it has a few more parts than a resistor.


At the most crude, you can use an LM317 and resistor to form a regulated current source, which is how NiMH/NiCd's should be charged. See "Precision Current Limiter" (p. 19) on the LM317 datasheet. The regulator functions as a current source by attempting to supply as much current as possible to have Vout - Vadj be 1.25 V.


Note that there is nothing inherent in the LM317 to shut off a charge, so if the batteries are fast-charged (~C/2 or higher), they will fail if you do not terminate the charge at the appropriate time. With a trickle-charge (C/20), you "can" leave them alone with no ill-effect.



So in your specific case, the 2-part charger would be a LM317 and a resistor to charge the pack at C/20.



  • Charge rate: 1000 mA·h @ C/20 => 50 mA

  • Resistor value: 1.25 V / 50 mA = 25 Ω


You need to provide a voltage to Vin at least 2.0 V (dropout voltage) + 1.25 V (reference voltage) = 3.25 V greater than the maximum charging voltage. The resistor would be connected between Vout and Adj, and your load is connected to Adj (not Vout)


When measuring a resistor with a multimeter does polarity matter?


When measuring the resistance of a resistor using a multimeter does it matter if I turned the resistor around and have the probes at opposite leads?


Should I get the same results?




led - 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?





Why is the first band on a resistor never black?


I'm taking an electronic circuit analysis class, and I was asked to give the color of the 3rd band of a 1MΩ resistor. My answer was blue, thinking it could be black-brown-blue (01 * 1MΩ), but the automated quiz said the correct answer was green (brown-black-green).


So I did some research, thinking there were just multiple correct answers, and I read in a few places that the first band on a resistor is never black (0). Why is this? Does a black first band have some other meaning? It would really help me remember it if I knew the history or reasoning behind it.


This question has been answered. For further reading on zero-ohm resistors mentioned in the answers and comments here, I found these questions and answers helpful:



  1. What is the usage of Zero Ohm & MiliOhm Resistor?

  2. Zero ohm resistor tolerance?




Answer



The first band is never black for the same reason that you always write numbers scientific notation with a single nonzero digit in front of the decimal place (e.g. 6.022e23) - convention. Generally the resistor specifications will all have the same number of nonzero significant digits (2 or 3, depending on the tolerance) except for a couple of values, namely even powers of ten (1, 10, 100, etc) and possibly a few others by coincidence.


Sunday 21 January 2018

power electronics - How can I size the DC link capacitor of a 3 phase inverter?


I have come across the Salcone-Bond paper Selecting Film Bus Link Capacitors For High Performance Inverter Applications (PDF), which shows equations for single-phase inverters. But I can't seem to find any guide or paper on how to size DC link capacitors for 3-phase PWM controlled inverters.


How can I size the DC link capacitor of a 3 phase inverter?





Best shunt resistor for power meter application?


Looking for a shunt resistor for measuring power usage and was wondering if anyone had any experience with these.


It should be capable of handling 110V/20A in-home circuit.


EDIT: Energy monitors are the rage these days and I was thinking about putting a simple circuit together to try out. This would be used to measure a typical appliance or electronic device such as stereo or television. Similar to a Kill-a-watt or multimeter. I haven't really thought about accuracy as much as getting something to work well. I haven't thought this all the way through just thought maybe some here may have already "been there done that".



Answer



The key is finding one with low enough resistance that it doesn't have to dissipate much power.


Two of these in parallel would do the job: http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&name=TMC5-.10-ND


With two in parallel, the resistance will be 0.05 ohms, so at 20 A, you'll have to dissipate 20 * 20 * 0.05 = 20 W. They're rated for 5 W continuous, or 10 W for the two of them. As long as you don't have to maintain 20 A, they'd work fine.



I'll see if I can dig up something better.


--


Edit: here's a better solution.


Try one of these: http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&name=MR50.01FTR-ND


The resistance is 0.01 ohms, so at 20 A, you'll dissipate 20 * 20 * 0.01 = 4 W. The part is rated for 5 W continuous, so you're safe.


arduino - How to fix Hitachi HD44780 16x2 LCD garbled display in 4 bit mode?


It often happens that a HD44780 16x2 LCD shows garbled characters during usage. Most help on the web advises for using snubbing techniques to prevent voltage noise such as induction spike. I've done all that but the problem still persists. What can I do ?



Answer



This problem occurs in 4 bit mode, the LCD screen misses a data nibble (a character is made of two 4bits nibbles) and then all subsequent characters are offset by 4bit. You can check that this is your problem by checking that the garbage displayed is always repeated for a known string that is supposed to be shown, for example "Stop" will always show "7FÏ€...".


This can occur for several reasons but the main one in my case was low power on the MCU controlling the display. The MCU can still work on lower voltage but when it sets the "EN" (enable) pin of the LCD to HIGH, if it's below the min value for that LCD (2.2V for example ) then the 4bit nibble wont be recorded when the "EN" is set to low again making the display garbled until this error happens again and the display is restored.



In order to fix this, it's best for the MCU to wait until it's supply voltage returns to a value above the min value of the LCD min input HIGH voltage plus a safety margin. For example on MSP430 energia or arduino before calling lcd.print you'd always call something like this:


setup(){  
analogReference(INTERNAL2V5);
}

void waitVoltage(){
while(true){
// 3v(what we want)/2.5 (reference) x1024/2=614
//we read VSS/2 on port 11, we want more than 2.5v to write on the lcd
if(analogRead(0x1011)>613){

break;
}
delay(50);
}
}

arduino - Circuit Design to Power the ADH8066 GSM Module


I am struggling to find the proper circuit design layout to properly power the ADH8066 GSM module and communicate with my Arduino.


The ADH8066 requires a 4V power supply and can have a brief spike of up to 2A during the start of communication.


I have been able to use an adjustable voltage regulator to provide a clean 4V from my power supply, but I have been informed on a forum that I must also use capacitors to cover the amperage spikes (since the Arduino cannot permit that high of amperage to be pulled, even if the power supply supports that rating).


I am a new entrant into the EE space, so I am trying to determine the ideal capacitors to purchase and where they need to be introduced into my circuit.


If anyone has had experience getting the ADH8066 to operate (even if they have a different circuit design than I'm referencing above), any insight into the proper layout would be immensely helpful.




dc - How Can I connect My Solar Power System?



I brought this 50A Solar Controller now I want to connect an inverter to it and they said to connect the inverter directly to the battery. I also brought a 100W Solar Panel and MC4 Wires, etc



What is these "60A/50A/40A/30A/20A/10A "? I choose the 50A one and wanted to know the Amps are used for DC Load or what's the use of selecting "60A/50A/40A/30A/20A/10A" if it is to be connected to the battery eventually?


The reason for not wanting to connect it to the battery is: The Protections (Load, Over Charging, Deep Charging, etc) go away if I connect the inverter to the battery directly.




Saturday 20 January 2018

opto isolator - Driving a 24VAC solenoid with arduino using a octocopuler and a triac


Following a previous question I have redesigned my schematic:


enter image description here


I'm trying to energize a solenoid used to open and close a 24VAC sprinkler valve


I have the following questions :


1) The GPIO leg can supply up to 500mA, is it enough to drive the optocoupler or should I use a transistor to activate it?


2) I have based my design on others I found on the internet like this one:


enter image description here


But, what are R3 and R5 (R19 and R20 in my case) used for and how should I calculate the proper values for them?


3) I'm using a TVS bidirectional Diode for EMI suppression for inductive AC loads, should I use snubber circuit or with the diode is enough?




Answer



The GPIO is not capable of 500 mA. With the 320 ohm series resistor you are likely to have about 11 mA with a 5 V MCU into the MOC3010 input LED.


With the indicator LED you put in parallel this will increase the current from the MCU to about 20-25 mA depending on your LED choice. This is within scope for a 5 V Arduino.


However, the input current required by the MOC3010 to turn on reliably is about 15 mA, so you may not turn on the MOC3010 at all (especially at cold temperatures).


enter image description here


It would be better to chose the MOC3012 for your application. This reduces the requirement to a maximum of 5 mA, so you have approximately a 2x overdrive.


The triacs always switch off at close to zero current (defined as the holding current) and in this case the holding current of the MOC301x will dominate. The dropout current will be around 100 uA with the current path through the MOC301x and the gate of the BT1308. This means there is very little energy stored in the inductance of your solenoid.


The SMBJ48CA is a good solution, if a little close to the peak voltage from the 24 V drive. Perhaps a 100 V selection would be better ….the SMBJ90CA.


The value of R20 is selected to ensure the BT1308 is not triggered by noise or leakage current through the MOC301x.


The BT1308 datasheet shows that the Vt is a maximum of 1.5 V with a maximum required gate current of 7 mA. With the 180 ohm you have selected the maximum MOC301x current will be about 20 mA required to turn on the BT1308. This should be quite workable.



R19 is only to limit the surge current in the MOC301x. If you were to turn on the solenoid when the 24 V was at peak voltage (depending on the load) you could end up with high surge currents. In most cases where an RC snubber is used, this surge current is mostly from the discharge of the RC snubber capacitor. Since you don't have a snubber and the current will ramp from zero through the solenoid inductance, you really don't need R19. Belt and braces though, you can say that Vpeak/1 A would be the lowest value (the MOC301x has a peak rating of 1 A). This would give a minimum value of 40 ohms, so your 180 ohms limits the peak current to about 230 mA.


This value also alters the lowest turnon voltage slightly too, but the effects are minimal. At the trigger current for the BT1308 there is a small voltage drop across R19, but insignificant for your application.


batteries - How can I power Beagle Bone Black with 3.7V LiPo?


I want to power this board with a 3.7V LiPo battery (due to small form factor) such as this.



Would I need a step-up DC converter or something? And where on the BBB would I connect it?



Answer



The BBB has a specific, unpopulated, header just for a single cell(3.7V) LiPo, charger and all! It sits just behind the 5VDC barrel jack, 4 pins labeled TP5-8. Page 41 of the A5A manual shows the pinout. Keep in mind that powering from a 3.7V Lipo via the battery pins will prevent the USB Host port from providing 5V power.


This guy has a small tutorial on how to wire it up: http://www.element14.com/community/community/knode/single-board_computers/next-gen_beaglebone/blog/2013/08/10/bbb--rechargeable-on-board-battery-system



The BBB has a built-in power management IC (PMIC) based on the TI TPS65217C device. This device contains multiple switch-mode regulators and LDO regulators to provide all voltage levels needed for the entire board.


The IC also contains built-in battery charging capability.


Apart from the USB requirement of 5V, there is no need to run the BBB from 5V; it can happily run from a lower supply. This means that a single 3.7V cell could be used to power the entire board. No need to step-up to 5V or to run dual cells and step-down to 5V, both of which could have been inefficient.


The BBB has four holes that are suitable for connecting up the battery. They are detailed in the BBB system reference manual (SRM) enter image description here




Now I personally was able to power it up omitting the 10k resistor mentioned in lieu of a thermistor, where Batt+ goes to both TP5 & TP6, Batt- to TP8. The thermistor (or 10K resistor bypass) would have been between TP8 and TP7


servo - Computer controlled water valve


I'm working on a computer-controlled indoor waterfall. One of the requirements is to be able to change the water pressure via computer interface. I've googled all day long and can't seem to find a valve that can be controlled via computer. Anybody happen to know of such a device and where I could find one?





wiring - How can I tell the full spec of my step motor just by looking ati it?


I have a retro CNC machine (EMCO F1P) in my garage that I am currently tinkering with. I would like to replace the old motor control but use the existing step motors. Unfortunately the documentation is scarce, and so I decided to pick one motor apart to see if I could learn anything from it.



Turns out it has 10 wires going into it and 10 windings inside. Each winding pack looks like it has only two wires coming out of it. The wiring diagram is the PCB visible in the picture:


enter image description here


So with my limited understanding of step motors I could need some help determining the parameters for this motor. Is it unipolar or bi-polar? How many steps per revolution does it have? How can I find a driver that will work for it, and how would I know which wire goes where?


Thanks!




power supply - Why is the PCB so large on this SMPS?


In a post regarding heat dissipation in a linear regulator, one answer provided this nice little pin-equivalent smps. It was a great reply, and I'll likely order a few myself.


smps


I am wondering though, why is there so much empty space? It doesn't appear to need extra layers - except maybe a ground - and it looks like it could be far more compact.


Is there something going on that is not obvious from its appearance?


edit: to be clear, I was not the OP for the linked post. Just borrowing it for this follow-up question.



Answer




All that copper on the back side (the leftmost of your three pictures) is acting as a heat sink for the switching IC.


If you read the datasheets for this kind of IC, they'll often specify a certain area of copper to be connected to the ground (or possibly the input voltage) pin to give adequate heat dissipation.


Friday 19 January 2018

Why one of my multimeter shows a small voltage when only one probe is connected to AC and the other dont?


I've recently acquired a Minipa ET-997 multimeter. I noticed that when I connected one probe to 127V phase and let the other disconnected, it will show around 12V.


But I have an older and cheaper multimeter which shows 0V in this same situation. Why is that?


Another thing, the older multimeter shows -127V when the black probe is on the phase wire and the red probe is on the neutral wire. And it shows +127 when the red probe is on phase and the black probe is on neutral. Therefore, I can easily tell which is phase and which is neutral. Minipa ET-997 always shows 127V, no matter how the probes are connected. Is there a way to "fix" this?





system - Meaning of causal signal


What exactly does causal signal mean?


Causality,as I see it is a property of a system wherein the output at PRESENT is dependent ONLY on PAST and PRESENT values of input.Here we have a reference of Output signal Time to define PAST & PRESENT for an input.


Since an isolated signal doesn't have a concept of a STATE,how can we define past or present for a signal?


If ideas of Past & Present aren't defined for a signal,how can the idea of causality be defined for signals?


Here the definition is given but I 'm not able to get a feel of Causality of a signal?


I've a follow-up question which I've put up here.




usb - Connectorless MicroUSB or miniUSB on PCB: Feasible?



This question extends upon "Connectorless USB on a PCB". Our requirements are for a smaller connector than standard USB, and also 5 leads instead of USB 1.0's 4. The connector will be used perhaps twice in the lifetime of the board, for ICSP / JTAG programming / firmware updates. The product is a low-cost throwaway device somewhat like the DigiSpark.


Edit: Also, the connector will be inaccessible without breaking open the enclosure, so it is production-access-only. If end-customers break open a $5 toy, well, they have earned the right to destroy or reprogram it!


Cost and added height of adding a connector of some sort, such as a microUSB socket is highly undesirable.


We would like to do our programming / update using a standard USB to MicroUSB cable such as is shipped with many modern smartphones, plugged into a configuration & testing board (not an actual USB port).


Edit: [28-Oct-2012]



  • It turns out that microUSB is not viable, if only because of the thin PCB required.

  • USB 1.1 / 2.0 are not viable due to having only 4 contacts on the USB-A end: Thanks @DaveTweed!

  • Top 5 contacts of USB 3.0 Type B cable (image) appear PCB friendly, so question remains open





The questions:



  1. Has anyone had success using such a connector etched onto a PCB? Could you share a link please?

  2. What thickness of PCB would we have to go into production with, for such a connector to work?

  3. Is there any available reliable footprint we could use for such a connector?

  4. What else would we need to keep in mind - such as board cutting/milling tolerances, stiffness of PCB, rounding of "connector" corners, ...




SOLUTION: Added here for reference.



The solution that worked out best for us was a 3M SOIC narrow test clip, which has 7 contacts to a side, and a conventional IDC 0.1" cable going back to our programming board.


No additional milling is required, half of a standard SOIC pad footprint close to the edge of the board, with solder bumps on the pads, works out perfectly, and the clip grips the board firmly. Varying PCB thicknesses have been tested, they all work fine.


A bit of a convenience hack we added: Positioning two of the nearby components equidistant from either edge of the SOIC "programming pad footprint" ensures that the clip can be attached very quickly and perfectly aligned to the pads.


In laying out the programming pad pins, we ensured that a misalignment of the clip would not cause any problems either due to shorts or problematic signal injection. Needing only 5 of the 7 pads simplified this reshuffle.


Hopefully this solution would help others with similar requirements.


An observation: Pogo pins suitable for 0.05" spacing worked out way too expensive compared to the SOIC test clip approach.



Answer



If this is for production access only, then here's a trick I used once. The PCB (standard 0.062" thickness) was designed with SMT pads along one edge (both sides) so that a 2×7 0.100" JTAG header could be soldered to it, with the pins sticking out from the edge. This was useful for debugging prototypes, which needed more or less constant access to the JTAG (and weren't in cases).


In production, the connector is omitted, and I used a slightly modified DIP clip to access the pads for the connector. I just needed to bend the contacts inward a bit to get adequate friction and contact pressure.


Instead of the DIP clip, you could use a standard card edge connector as well.



parallel - Connecting up to 32 Devices I2C


I'm trying to connect 32 I²C "root of trust" NXP A71CH devices.




  • I'm thinking about a good way that does that, I mean what kind of communication should I use?

  • A digital multiplexer that selects a device? but based on what?

  • switching on the VDD source? but that needs reinitialization of the device and that takes time.



Answer



Really short: I²C with a bus multiplexer; this is a common problem and it's solved with a bus multiplexer.


However, seriously, the point of having a root of trust is having one root of trust, not 32; hence, your project requirements make me suspect you're either building a test rig for these devices, or you're testing a device that is supposed to work with one of these devices, or you've misunderstood your project requirements.


Thursday 18 January 2018

high voltage - How do transposition towers in transmission lines work?



There're such things as transposition towers in power distribution powerlines. The idea is that for example you have three conductors running in parallel at the same height and the leftmost of them is phase A and after transposition the middle one is phase A and the leftmost one in now phase C and phase B which originally was the middle conductor is now the rightmost one. Wikipedia says it's needed because



The transposing is necessary as there is capacitance between conductors, as well as between conductors and ground. This is typically not symmetrical across phases. By transposing, the overall capacitance for the whole line is approximately balanced.



I don't get it. It's three wires in parallel before the transposition and three wires in parallel after the transposition and the distances between the wires are the same before and after the transposition (and the distance between the wires and the ground can hardly even be controlled because ground surface is uneven and changes over time).


How does transposing three parallel wires into three parallel wires help balance the line capacitance?


Edit: Buried in the comments of one answer is a link to a picture highlighting the arrangement of the phases on the transposition tower in the wikipedia article linked above. The picture deserves being shown here...


Transposition tower, with the phases highlighted




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

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