text
stringlengths
83
79.5k
H: Combining resistors connected solely at one node, and also a question about parallel/series I'm learning how to combine resistors for Thévenin equivalency circuits, but I am really puzzled as to how I would calculate the Thévenin resistance for this circuit. In my mind, none of the resistances are either parallel or in series with one another, does this mean they can't be combined? Originally, this circuit had a current source connected to the left of \$R_{5\Omega}\$, which I zeroed out. My second question involves a different circuit. To find the Thévenin resistance for this circuit, I started out by zeroing the sources. So the \$10\,V\$ source is replaced by a closed circuit, and the \$1\,A\$ source is replaced by a open circuit. Following this, I see that \$R_{20\Omega}\parallel R_{5\Omega}\$. This yields the combined resistance \$4\,\Omega\$, taking the old \$R_{5\Omega}\$'s place. The second step is to add the new resistance \$R_{4\Omega}\$ to the resistance in series, \$R_{6\Omega}\$. This combined resistance is in parallel with our last resistance \$R_{10\Omega}\$ and together that's a Thévenin resistance of \$5\,\Omega\$. What makes me wonder though is if we in the second step notice that \$R_{6\Omega}\$ is also in series with \$R_{10\Omega}\$, and add those together, we get the resistance \$R_{16\Omega}\$ in old \$R_{10\Omega}\$'s place. Combining this, with it's parallel resistance \$R_{4\Omega}\$ yields us \$3.2\,\Omega\$, not \$5\,\Omega\$ as the earlier steps. Why does it only work in one direction? And how am I to know which direction is the right one? Am I not correct in the statement that \$R_{6\Omega}\$ is in series with both \$R_{4\Omega}\$ and \$R_{10\Omega}\$? And if not, why? AI: You correctly zero'd out the current source while calculating the equivalent resistance. Remember we are trying to create a two terminal model for the network looking at it from the right side. Since the 5 ohm resistor is disconnected on 1 terminal, no current can flow through this resistor and we can discard it. The equivalent resistance is then the series resistance of the 10 ohm + 20 ohm resistors. In summary, if you have a resistor that is not connected on 1 terminal, you can ignore it. Be careful of how you are combining resistors. Remember that when finding Thevenin resistance we are calculating an equivalent resistance with respect to the output terminal (the two open circles). When you combine the 6 ohm and 10 ohm resistors in your second step, you've destroyed the top output node and you are no longer calculating an equivalent resistance with respect to the output terminals. When combining resistors for Thevenin / Nortin equivalents, you can't touch the output terminals, those have to be present in both the original and equivalent models. Your first method is correct because it finds the equivalent resistance with respect to the the output terminal. Note when I say "with respect to X" I mean that the final equivalent resistance / circuit has X has it's two terminals. This comes into play later in electronics, for example with amplifiers, when you might take the Thevenin equivalent with respect to the input and that will give you 1 model, and then take it with respect to the output which will give a different model.
H: RP-SMA and SMA conversion Firstly apologies for any stupidity here. I am needing to purchase two 9dbi antennas for use with a router. I found someone online, bought them, then started noticing SMA and RP-SMA. Unbelievably I simply paid no attention before and long story short I bought the wrong thing. In my brief reading I can see the differences between the connections, which is confusing to say the least and I see that RP means reverse polarity. I have also come across some converters for RP-SMA female to SMA male coax. Presumably these will be sufficient for my purpose? Will there be any issues, loss. Am I better off purchasing another set of antennas with the correct connectors. AI: The only issue with the adapters could be a mechanical one. They are usually pretty short, so if you don't have good access to the connector it might be difficult to screw it in. Also, you could run in to an issue where the antenna is screwed on to the adapter and then the adapter gets loose, but you can't unscrew the antenna because the adapter rotates and you can't access the adapter to either tighten it or loosen it. So if you can access the connector easily even with the antenna installed, the adapter is probably a good option since you already bought the antennas. Otherwise, it might be a better idea to buy the correct antennas.
H: Interfacing I2C OLED display with pic18f2550 I've been trying to interface SSD1306 I2C oled monochrome display module with PIC18F2550 micro-controller without any success. the datasheet of ssd1306 controller shows the following data format so can anyone explain the format on how can we implement this in I2C code.I'm using MikroC pro for PIC. AI: Definitely have the datasheets for both your MCU and LED Display open as you do this. I'm answering this question based on the datasheets for the MCU and LED here. Make sure both the MCU and LED Display are properly configured in hardware / software. Look at section 8.1 in the LED datasheet, specific pins must be driven appropriately to configure the chip for I2C. See the MCU datasheet on how to configure the the I2C registers. You should set the clock frequency lower than 400 kHz as this is the maximum the LED supports (Table 13-6 in LED datasheet). Configure your MCU as the I2C Master. Actual protocol. If you have the I2C library, this should be fairly straight forward. Otherwise, dig through the MCU datasheet / examples on how to do I2C communication. That's too expansive to cover in this post. If you are using the library, the commands are found here http://www.mikroe.com/mikroc/pic/libraries/ *I2C1_Init *I2C1_Start *I2C1_Wr *I2C1_Rd *I2C1_Stop Looking at the diagram this is how we would procede Issue a start command (This is the S at the beginning). Write the slave address of the LED. The slave address is the "name" of the device on the I2C network. Note that there can potentially be many devices on a I2C line, which is why we need this "name". The name is formed of the upper 7 bits of the first byte. The slave address of the LED is “0111100” or 0x78 in hex. The lowest bit is a R/W or read/write bit. This tells the LED if we want to read or write to the device. In this case, we want to send a command so we want to write. Write is indicated by a 1. Thus the first byte that you should send is a 0x79. All I2C transfers have a acknowledge bit, this will be returned by the I2C1_Wr function. It should be 0 to represent no errors. Next we have a command byte. Send a repeated start over I2C using the library function to do so. The OLED has a set of commands that it exposes to the MCU. You can see these in section 9 of the LED datasheet. Pay close attention to section 8.9 of the datasheet, which describes how to turn on the LED. Notably you should send the command 0xAF to turn on the LED. To write data to the device, look at the diagram labeled Control Byte in your figure. The top bit is labeled D/C indicating data or control byte. By setting this bit appropriate, the byte is processed as a data byte for display or a command byte.
H: Why use RAM IC over EEPROM IC? I have been looking at various different external storage ICs that would work with an arduino. When I looked at the specs of some EEPROM chips and compared it to the specs of other RAM chips, I noticed that they had relatively similar specs in terms of Read/ Write frequency and storage capacity. So if they have such similar characteristics, why would you use a RAM chip over an EEPROM chip? Wouldn't an EEPROM chip be much more useful as it is nonvolatile? AI: The two are intended for different purposes. EEPROM (Electrically Erasable Programmed Read Only Memory) is non-volatile and used for long-term storage just as configuration parameters which might be changed by the user; results of a calculation to be read out later; and something downloaded from the Internet such as an MP3 song or e-book. You can now get a 256MB (not bit) EEPROM now for $3. EEPROM is not suitable as a substitute (or extension of) a computer's internal RAM, since as another answer pointed out, it takes much longer to write than to read, and you can eventually wear it out. External RAM (Random Access Memory) is like the RAM inside your computer chip, except that it is harder to access. RAM is volatile; it will lose its consent when the power goes off. This sometimes is not a problem in embedded systems, since some are designed to never be completely turned off -- the external RAM may be left powered up even if the power to the microcontroller is turned off. This is called battery-backed up RAM. External RAM is harder to access than the RAM is you CPU because it is connected over a serial link, either SPI or I2C, since all but the highest-end microcontrollers do not have an external address or data bus. So the external RAM does not appear in the address map of you microcontroller; rather you have to access it via a subroutine to first send the address to be accessed and then the data either to be written or read back. This is way way slower than accessing the RAM inside you microcontroller. This limitation is also inherent in accessing EEPROMs. External RAM can be used to hold large intermediate results of a calculation, data that is being logged (here you want to use battery-backed up RAM), and material temporarily downloaded from the Internet (such as a web page, or an MP3 song you don't need to keep around). Static RAM is at least an order of magnitude more expensive than EEPROMs of the same size. You can't used dynamic RAM (which is cheaper) without special refresh circuitry.
H: Need advice on ATmega32u4 routing VCC I have attached my current state of VCC routing of ATmega32u4. I think I am seeking for some general advice on how to tie the VCC pins together. Is this an acceptable way to route the pins? Sorry for such a vague question. Routing was done with little background. I am sure there is room for improvement. AI: Make a VCC Polygon Pour; The Routing is amateurish to my opinion. Polygon Pour will have much more current capacity (though you don't need it). If it is a 4-layer board, make sure you have an Internal Ground layer and tie all the grounds through a via.
H: How to program ATmega with fuses set to 32.768kHz clock? I've been programming my ATmega328P's using USBasp programmer for a while. For my new project, I wanted to use 32.768kHz oscillator as an external clock, so I programmed the ATmega to appropriate fuses. Unfortunately, from this point on, I cannot communicate with the chip at all - avrdude tells me that target doesn't answer (rc=-1 error). After some research, I found some tips telling me to connect the oscillator (and capacitors) to chip's XTAL inputs, and then program the chip. I tried that, to no avail. Note that I also used avrdude's -B 2000 switch, that slows down the programming as much as possible - to 500Hz, so programming speed shouldn't be an issue. In a desperate attempt to rescue chip, I tried Arduino as ISP, but the results were pretty much the same. Questions: How to rescue this particular ATmega? Is high voltage programmer the only way out of this? I don't have one, so other options are welcome. For the future: how should I program slow clock fuses so that I avoid this problem? It doesn't make sense for me - if programmer doesn't work with such fuses, why is there such a fuse setting in the first place? AI: OK, I got this. It was much more stupid than I thought - I'm using a self-made programming board. Since I'm quite cheap, the same one is used for 28-pin ATmega's and 8-pin ATtiny's - they have MISO, MOSI and SCK in the same place (if I shift the chip two pins upwards), and the other pins (RESET, GND and VCC) don't conflict with each other. The thing is, I had modified my board to suit ATtiny's only recently, and this is the first time, I programmed an ATmega since then. It turns out, in my board, ATtiny's RESET does conflict with ATmega's oscillator input - so my oscillator, even if connected, was shorted to RESET, so it was unable to produce meaningful signal. After desoldering that connection, everything works fine. I guess I'll just add a jumper for ATtiny programming and that's it.
H: VHDL generate statement increment by 2 I'm trying to use a generate statement to make a custom bit width version of my circuit. However, I need to increment N by 2 instead of 1. Is there a way to do this? ... adders: for N in 1 to bits-1 generate mapping: RBNS port map( a => a(N downto N-1), b => b(N downto N-1), sum => result(N downto N-1), cout => carry(N), cin => carry(N-1) ); end generate; carry(0) <= '1' ... AI: You can multiply the iterator : adders: for N in 1 to bits/2-1 generate mapping: RBNS port map( a => a(N*2 downto N*2-1), b => b(N*2 downto N*2-1), sum => result(N*2 downto N*2-1), cout => carry(N*2), cin => carry(N*2-1) ); end generate; carry(0) <= '1' ... etc
H: Are regular fuses temperature sensitive? Are common fuses, like AT car fuses, temperature sensitive? Say a 12v 5A fast blow fuse, would it have any significant change in its reaction at 0ºF than it would at 100ºF? In either time to blow or current required to blow? AI: Yes, they are and there are usually curves to explain what the effect is. The current at which they open is probably affected a lot more than the reaction time to a short, which is I^2t related. For example, here is the derating of the ATOF series of automotive fuses: The time curves do not show any temperature effect, but you can estimate the effect by scaling the current to the equivalent at the new temperature. For example a 10A fuse at 120°C may behave similarly to an 8.5A fuse at room temperature. So a 30A overload might take ~0.1 seconds to open rather than ~0.15. That's just a rough guess though.
H: Teensy 3.1 PWM, TIP31C, and LED strips So I have been having some trouble with my Teensy and I think I have an idea of what it is but I need some help understanding it . So I have four 12v RGB led strips. Each color pulls close to an amp so I used 12 TIP31C NPN transistors I had. This works but after a minute or so, or less if all the lights are on full, the Teensy will stop responding and even reboot. I noticed it gets very warm as well. As soon as I turn the lights on another LED I have on a digital pin seems to half in brightness. The way it's wired is that each transistor's emitter is wired to ground, base straight to a PWM pin on a Teensy, and collector to the individual color of the strand. I believe what's happening is that I am drawing too much current from my Teensy and causing it to overheat and also using too much power to drive the transistors so that the Teensy cant properly run anymore, which causes it to shutdown. My problem is that I don't know if I need to use MOSFETs instead of the TIP31Cs or if I can use a base resistor between each transistor and the Teensy. I have no idea what value resistor I'd need or any idea what MOSFET I would need if I use that instead. I spent several hours trying to understand the idea behind both calculating a base resistor and also selecting a proper logic level MOSFET but the concepts escape me for both. The Teensy outputs at 3.3v and each pin is rated for I think a maximum of 20ma. Something that complicates is slightly is that the length of the LED strips will vary a little. AI: ... emitter is wired to ground, base straight to a PWM pin ... VBE(sat) of the TIP31C is 1.8V. Every time the output goes high, the MCU has to burn up the voltage difference between the supply voltage and VBE internally. This is not good for the chip. Put a resistor on the base so that there is an additional external component to drop this voltage over instead.
H: Resistor power ratings Fuses, circuit breakers, transistors, ect... are all rated in amps. Why are resistors rated in watts instead of amps? Does their breakdown/failure include more than just heat? AI: Resistors are rated by power because all of a given series of resistor (same length, diameter, material) will have the same power rating (same maximum temperature and thermal resistance to the surrounding air). So, a given series of resistors will have dozens of different resistance values, but all will have the same power rating. If resistors were rated by current, then every single resistor part number would have a different rating, and the current ratings would be all over the map. For instance, this resistor kit has 20 different resistance values, all with the same power rating (1/4 watt): If resistors were rated by current then each resistance value would have its own current rating. Much more confusing.
H: Leach circuit to power microcontroller Like many, I'm trying to design small circuits to do things. One objective is a device to report home power use. Such a device is relatively easy. Powering such a device for the very long term is hard. Batteries die, solar panels advertise that there's something in the meter box worth stealing, etc. On the other hand, why can't I just connect a current clamp (http://dlnmh9ip6v2uc.cloudfront.net/datasheets/Sensors/Current/ECS1030-L72-SPEC.pdf) to the mains supply and run the monitor from the leached power? Use a blocking diode and a fairly large(?) capacitor across the terminals of the clamp and add a 3.3V voltage regulator, with ground and supply to the respective sides of the capacitor. The capacitor won't be "perfect" and should add enough resistance to limit the voltage, I'd have thought. Anyone tried anything like this? Would it work? Suggestions, comments and crazy to add? (Note that I wouldn't take it amiss if you said "Go home, you're drunk". This would, right now, be good advice!) Thanks Edit to add: I can't plug in an adapter. I have the mains cables, but this is at the meter box outside. No sockets are present. Edit 2: Target power "generation" would be ~1ma at >5V, feeding a 3.3V LDO regulator. Power use to be ~0.1mA, with a <1s pulse at ~40ma every ~2 minutes. Capacitor to support pulse. AI: It's a valid plan and I've seen others implement it before. Here's a link to a evaluation board that does AC lines monitoring and powers itself off of the AC Mains. Look at the schematic on page 10. The regulator is U2 and the rectification diode is Z1. You might be interested in the board anyways, it already does the voltage and current measurements and outputs the value over UART/I2C/SPI. Back to your idea though. I would suggest the following modifications. We'll talk about the clamp in the next paragraph. Instead of a shunt capacitor make it a series capacitor. This provides AC coupling and blocks any DC current from forcing the diode on. The diode is a cheap form of rectification. Half wave rectification is probably good enough for your purposes. See the wiki page for some details on rectification. Make sure that the regulator can support the output voltage of the rectifier. If you bring in the voltage directly from the line, the rectified voltage will be very large. This is one of the reasons I would use a transformer to step down the voltage. Additionally, placing a shunt zener diode can help decrease the rectifier output voltage. You might want this if the rectifier output is too larger for your regulator. See what they do in the schematic linked above. U7 is the shunt zener. Make sure that you add appropriate resistance to prevent excessive current flow if the zener conducts. One issue I see with the plan is the current transformer that you are planning to use. Current transformers are typically used for current measurements. If you look at the I-V curve in the datasheet that you've linked, it provides mV of output voltage for tens of Amps on the primary side. This cannot supply the rectifier and regulator. Alternatives would be to use a transformer to reduce the AC voltage to something manageable and use the same rectification scheme. Another method would be to attach directly to the AC line as in the board I linked to. Be very sure that all of your parts are rated for the expected voltage or current.
H: Reverberation equation I am trying to understand the physical significance of \$\alpha % MathType!MTEF!2!1!+- % feaagKart1ev2aqatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLn % hiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYbItLDharqqtubsr % 4rNCHbGeaGqiVu0Je9sqqrpepC0xbbL8F4rqqrFfpeea0xe9Lq-Jc9 % vqaqpepm0xbba9pwe9Q8fs0-yqaqpepae9pg0FirpepeKkFr0xfr-x % fr-xb9adbaqaaeGaciGaaiaabeqaamaabaabaaGcbaGaeqySdegaaa!3796! \$ and \$D % MathType!MTEF!2!1!+- % feaagKart1ev2aqatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLn % hiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYbItLDharqqtubsr % 4rNCHbGeaGqiVu0Je9sqqrpepC0xbbL8F4rqqrFfpeea0xe9Lq-Jc9 % vqaqpepm0xbba9pwe9Q8fs0-yqaqpepae9pg0FirpepeKkFr0xfr-x % fr-xb9adbaqaaeGaciGaaiaabeqaamaabaabaaGcbaGaamiraaaa!36C0! \$ in the following equation: \$y\left( n \right) = x\left( n \right) + \alpha y\left( {n - D} \right) % MathType!MTEF!2!1!+- % feaagKart1ev2aqatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLn % hiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYbItLDharqqtubsr % 4rNCHbGeaGqiVu0Je9sqqrpepC0xbbL8F4rqqrFfpeea0xe9Lq-Jc9 % vqaqpepm0xbba9pwe9Q8fs0-yqaqpepae9pg0FirpepeKkFr0xfr-x % fr-xb9adbaqaaeGaciGaaiaabeqaamaabaabaaGcbaGaamyEamaabm % aabaGaamOBaaGaayjkaiaawMcaaiabg2da9iaadIhadaqadaqaaiaa % d6gaaiaawIcacaGLPaaacqGHRaWkcqaHXoqycaWG5bWaaeWaaeaaca % WGUbGaeyOeI0IaamiraaGaayjkaiaawMcaaaaa!45A1! \$ where \$x\left( n \right) % MathType!MTEF!2!1!+- % feaagKart1ev2aqatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLn % hiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYbItLDharqqtubsr % 4rNCHbGeaGqiVu0Je9sqqrpepC0xbbL8F4rqqrFfpeea0xe9Lq-Jc9 % vqaqpepm0xbba9pwe9Q8fs0-yqaqpepae9pg0FirpepeKkFr0xfr-x % fr-xb9adbaqaaeGaciGaaiaabeqaamaabaabaaGcbaGaamiEamaabm % aabaGaamOBaaGaayjkaiaawMcaaaaa!3970! \$ is the input audio,\$y\left( n \right) % MathType!MTEF!2!1!+- % feaagKart1ev2aqatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLn % hiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYbItLDharqqtubsr % 4rNCHbGeaGqiVu0Je9sqqrpepC0xbbL8F4rqqrFfpeea0xe9Lq-Jc9 % vqaqpepm0xbba9pwe9Q8fs0-yqaqpepae9pg0FirpepeKkFr0xfr-x % fr-xb9adbaqaaeGaciGaaiaabeqaamaabaabaaGcbaGaamyEamaabm % aabaGaamOBaaGaayjkaiaawMcaaaaa!3971! \$ is the output (echoed) audio, D is the echo delay (in samples), and \$\alpha % MathType!MTEF!2!1!+- % feaagKart1ev2aqatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLn % hiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYbItLDharqqtubsr % 4rNCHbGeaGqiVu0Je9sqqrpepC0xbbL8F4rqqrFfpeea0xe9Lq-Jc9 % vqaqpepm0xbba9pwe9Q8fs0-yqaqpepae9pg0FirpepeKkFr0xfr-x % fr-xb9adbaqaaeGaciGaaiaabeqaamaabaabaaGcbaGaeqySdegaaa!3796! \$ governs the amount of echo fed back. I have simulated above equation in MATLAB, recorded 2 sec. of audio data, quantized it and passed it to above equation and played back output signal. They clearly 'differ' to each other but I don't how to describe it. Can anyone assist on this please? AI: As far as I can tell, what you're asking is: How do α and D affect the output sound? You stated it in your question D is the echo delay (in samples) and α governs the amount of echo fed back. This does exactly what it sounds like. If you imagine the input being "HEY!", the output would be an echo "HEY! ... hey!", with D being the amount of time between the first "HEY!" and the second "hey!" and α being the intensity of the "hey!" with respect to the "HEY!". If this isn't what you're asking, please clarify the question.
H: In Transient Analysis, what happens when free electrons are applied to a matrix of resistors that don't have a ground? I'm trying to figure out what happens to a 30 Volt supply when it is attached to a circuit of resistors which are not grounded. I know that eventually (steady state) the voltage of the circuit should equal the voltage of the supply, but at that point there would be zero free electrons traveling through the resistor net since there is nowhere for them to travel out of the network. The only place for them to escape would be back into the supply which supplied them in the first place. Assuming the resistor net was truly at 'zero' with respect to the supply ground at the beginning. My best bet is that the free electrons would charge into the resistor net and upon finding zero escape path, would return through the original supply by artificially increasing their voltage until the supply allowed them to escape to ground (or however it chooses to deal with the situation). At this point the resistor net is now 'at rest' but at a relative steady state potential of 30 Volts. Let's assume we're using a series of 3 metal oxide resistors with 10k resistance and 50 nH of parasitic inductance. (http://www.resistorguide.com/inductance/ ) What I can't figure out, is what happens to free electrons when they 'hit the end' of the circuit and somehow return upstream back into the supply for their steady state condition to occur. I understand that inductors have the ability to artificially increase voltage above their supplied current in order to try and preserve their 'current momentum'. Does that increased voltage eventually cause a reverse flow of electrons backwards through the circuit and cause the supply to be the lowest potential point in the circuit to create an outflow of free electrons? Or do the electrons just return backwards through the inductive field despite the field trying to keep them on the 'floating' side of the resistor? I think I'm just not sure what the mechanism would be for reduction of the parasitic inductance of un-grounded resistors and for dealing with the free electrons which charged the inductors in the first place. If you can help me with the theory, can you also help me with the math behind it? I'd like to understand and be able to model these behaviors. Thank you! AI: Consider that there is a (probably tiny) parasitic capacitance between each node of the "floating" circuit and the ground terminal of the power supply and whatever it is connected to. Now you can analyze this circuit using the usual concepts of conventional current, charge, and voltage. There's no need to worry about electrons. When the supply is first connected, current flows in to the circuit and returns to the supply's anode through the parasitic capacitors. Once sufficient current has flowed, the capacitors will be charged up to 30 V. No further current will flow and the various nodes of the resistor network will remain at 30 V as you expected.
H: Termination of unused PoE pairs How important are the specific termination values used for PoE pairs (pins 4&5, 7&8)? Below is the recommended Ethernet front end for Micrel’s KSZ8841/42. http://www.micrel.com/_PDF/Ethernet/app-notes/an-139.pdf Would it be acceptable to use 49.9 ohm resistors in place of the 51ohm resistors? Why did they specify 49.9 on one side, and 51 ohms on the other? I’d like to make them the same in order to reduce the number of component types. This would not only help drive down the price of the 49.9 resistors but also mean there is one less component type to manage in inventory and load into the pick n place machine. There must be a good reason for specifying slightly different resistor. I'm sure they didn't do it just for fun. How critical are the terminations of the PoE pairs? In my mind they are not critical because there is no data being transmitted over them, but I’m not sure how much their termination influences the characteristics of the cable for the other conductors. AI: Yes it would be totally acceptable to use 49.9 ohms instead of 51. Theoretically the value should be 50 ohms I think so 49.9 is even closer to that. The terminations are there to terminate the transmission line which in this case is the ethernet cable. By terminating it properly you make sure any signals that are on the line (cable) dissipate in the resistor instead of reflecting back into the cable and distorting the signal. For unused ethernet pairs it is probably not that critical but it can be that due to capacitive coupling there could be some signals on the unused pairs. By aso terminating these properly also these signals cannot reflect and disturb the other signals. Also it's just good practice.
H: opamp power supply I have a 24-48V power supply and opamp that i want to use is lmp8601 which takes +5V-GND power supply and can take common mode voltage upto 60V. Problem here is that I do not want to use two separate power supplies. I wanted to know if the opamp will work until the difference between postive and negative rails is 5V i.e if I give let's say 40V to +Vs and 35V to -Vs, will the opamp still work or is there any limitation for that? AI: The maximum supply voltage of the LMP8601 is 6V so indeed you cannot use the 24-48 V supply. As long as you make sure the opamp's supply voltage does not exceed 6V it will work. So yes you can feed it with 40 - 35 V = 5V as long as you make sure that the input voltage remains within spec. The input voltage range is -22 - + 60 V but that is relative to the -Vs pin of the opamp ! So if you feed it with 35 V and 40 V then the lowest input voltage allowed is 35 V - 22 V = 13 V ! Also note that the output voltage of the opamp will then also be relative to 35 V since this will be the "ground" from the opamp's view. So the opamp's output voltage will always be between 35 V and 40 V. But why not feed the opamp with +5 V and ground ? Just make a local supply voltage using a regulator or a resistor and a zener diode ?
H: How do ALU flags communicate with the rest of the computer? How are ALU flags connected to various parts of a computer? I've just finished building an 8 bit computer in Logisim that can add subtract and compare... and am wondering how I can make it multiply (in software) using ALU flags. AI: There are two common ways for flags to influence instructions: influence on the control flow, in the form of a condition skip (eg. skip the next instruction if the carry flag is set), or conditional jmp/goto (conditional call and condtional return are more rare but do exist) influence on the data, which is most common in shifts (shift in from the carry bit, and/or shift out to the carry bit), an add-with-carry instruction (and likewise subtract-with-carry) which are both very usefull in implementing shits, add, and substract on data that is larger than the natural size of the CPU The ARM achitecture took the first idea to the extreme: every instruction had a condition field that specified under which flag settings the instruction was executed. If the flag settings were different, the instruction had no effect (executed as a NOP). This avoided a lot of branches (both conditional and non-conditional) in the control flow, which is important for a pipelined CPU.
H: NO CD pin in SD card module by LC Studio? I have a SD card module by LC Studio. I am interfacing it with PIC32. This module consist of 6 pins: CS MOSI MISO CLK 3v3 GND I am following Lucio De jasio book to interface SD card. He has described to connect CD pin which is a Card Detect pin to detect the card but in my case I don't have cd pin. How can I detect for card detect state or is there any other option.? AI: I'd say that the pin description given by LC Studio is for the SPI access mode. In that mode you don't use the Card Detect as it is used as chip select of the SPI bus. If you want to use the SDIO interface the CS pin turns into the CD pin. MOSI is command/response and so on. Have a look at the Wikipedia page, it shows the pin mapping for the different modes. Based on the schematic I found on the forum of element14, you can also see, that pin 1 is directly connected to the CS pin of the header, I don't know all the details, but that might work for SDIO as well.
H: Do registers on a chip wipe when disconnected from the power? I'm making a project with Arduino, and I have a question about a chip I'm using, the MPU9150, a 9-axis accelerometer+gyroscope+magnetometer. I wanted to know if its registers are wiped when the power is off. I'll explain: In the Arduino sketch, I'll try to change some of them (the measuring range, configuring interrupts and such) and I don't know if they all reset to a default state when disconnected from the power, or if I have so specifically reset them, to their orgiinal values (through the use of a reset register, I believe it has one). Thank you! AI: From the register map of the MPU9150: The reset value is 0x00 for all registers other than the registers below. Register 107: 0x40. Register 117: 0x68. So yes, the chip will also reset the registers to some default value after a power up. Most of the chips I encountered have a reset of the registers to some default value but not for RAM, which can contain some random values at times. Sometimes there is also a bug on the chip which will prevent it from resetting to the default register values, but such information should be available in the errata (if available).
H: What is the best USB transfer type (bulk, interrupt, Isochronous Transfers) to be used for implementing a USB oscilloscope? I want to build a USB oscilloscope. I was reading about different USB transfer types. Which transfer type is best to transfer the collected ADC samples from a USB oscilloscope to a PC? Below are a few of my findings. Please correct me and also it would be good if anyone could suggest a good transfer type. Isochronous transfer - Possible loss of data. Not good for an oscilloscope since each data item is valuable. How much data could be lost? Interrupt mode - I have no idea if it would flood the USB connection Bulk mode - Seems the best to me since no loss of data Control transfer - not suitable since it is not meant for transfering data AI: Bulk transfers do not lose data, but they have no guaranteed minimum bandwidth. (On the other hand, they can reach higher speeds, because they are able to use all the bandwidth not actually used by any other transfers.) What happens when your oscilloscope's data transfers are delayed (either because of errors, or because of other devices), and new data is piling up? Do you stop the device until the old data is transmitted, or do you throw away the old data to be able to transmit the current data? Isochronous transfers are designed for 'real-time' data. You get no choice about the error handling, but your bandwidth is reserved on the bus. If you want to display the recorded data in real time, you should use isochronous transfers. If you want to transfer the recorded data to the PC after the measurements have finished, you should use bulk transfers.
H: Control one circuit from a separate circuit What I am trying to do today is control one circuit using another, with no common ground or voltage between the two circuits. Basically what I am looking for is some way to have my Arduino, powered off of its own battery, control a 24V led circuit without using a voltage regulator. It seems like I am looking for somewhat of a hybrid between a relay and a transistor, the relay providing the ability to control current in a circuit from a separate setup, and the transistor providing a solid-state variable current setup (in this case, hopefully also with signal amplification. If need be, though, I could always just use BJTs) I apologize if there is something like this already on the forum but I could not think of what I should search for, and my searches turned up nothing. Thanks in advance, Trevor AI: First, if the controller is running from its own battery, then you can connect its ground and the 24 V ground together (or any one point on each one, but the grounds is usually what you'd connect). Second, you don't need this device to have amplification on its own. You need to get the signal from one circuit to the other, but the receiving circuit can amplify that as it needs to. If you really need isolation, then a mechanical relay, solid state relay, or opto-coupler is what you want. If you don't actually need isolation, and it sounds like this is the case, then have a digital signal control a transistor as usual.
H: Pastemask. Manufacturing PCBs after finishing some designs, it is time to manufacture and assemble them. For making these designs I have to create all padstacks, footprints, etc from scratch, so I took PCB Editor examples as guide for doing mine. Now, when I send the gerbers (etch layers, soldermask, silkscreen, drill) to our manufacturing house, they requested me the pastemask ones. Although they can generate them from gerbers, they are enquiring me to generate the pastemask gerbers with our own requirements. So, I need a little help to get the proper guidelines to avoid any possible error. Then, I wonder if you can provide some guidelines about how to define and create the proper pastemask layers. From PCB Editor examples, most of passive components have no pastemask defined (SMT and THR), and from IC pads the relation between pads size and solder paste are 1:1 in most cases. I have in mind next possible requirements: THR components: 1:1 SMT components with padstack larger than 1mm: 1:1 SMT components with padstack shorter than 1mm: 1:0.9 IC perimeter pads: 1:1 QFN perimeter pads: 1:0.9 QFN thermpad: <1:0.7 BGA pads: 1:0.9 Any other pads: suggestions accepted Are these requirements right? And finally, Which is the best option, provide pastemask layer to manufacturers? Or should I let him create them? In the case, I have to create the pastemask layers, which are the best guidelines to follow them? Kind Regards. AI: I believe that the IPC recommendation is to make the stencil apertures the same size as the pads. Altium, for example, allows you to set the paste expansion via rules or individually, but the default is 0.0mm. You don't generally want solder paste on through-hole pads. Usually paste with stencil apertures the same as the pads is also recommended for BGA, but it's said to be possible to just use flux.
H: Why is the CMRR of an op-amp defined in such a way? Why is the CMRR of an op-amp defined as \$20\log(A_d/A_c)\$? I know that the value of \$A_d\$ is far greater than \$A_c\$, so we take the log, but why are we multiplying 20 with it? AI: The \$20\log_{10}(X/Y)\$ is how we change ratios into decibels or dB. Original, dB was used to compare ratios of power. Energy and power are often related to the square of some variable. \$1/2 mv^2\$ for kinetic energy or \$P=I^2 R\$ for power through a resistor. In this original usage, we would use \$10\log_{10}(X/Y)\$. Thus if \$X = 10 Y\$, it would be 10 dB and if \$X = 100 Y\$, it would be 20 dB. This was nice as we didn't have to deal with a bunch of decimal places to get decent comparisons. Now, eventually we started using dB for signals such as voltage. Voltage is related to the square root of power. \$P = V^2 / R\$. Now, convert voltage to power and place it in the dB equation: $$10\log_{10}\left(\frac{V_1^2 / R}{V_2^2 / R}\right)$$ By the rules of logarithms, we can remove the power of 2 from the inside of the \$\log_{10}\$ to a multiplier of 2 in front of the \$\log_{10}\$. This is how we get \$20\log_{10}(X/Y)\$. Many contributions to signal processing came from electrical engineering and thus the \$20\log_{10}\$ stuck. Here are a few more links for reading.
H: Finding a current by superposition theorem and a current-divider I'd like to find \$i_s\$ for the following circuit, using the superposition theorem. First I zero the current source, which leaves me with a circuit whose resistances can be reduced, giving us $$R_t = (5+10)\,\parallel\,5 = 3.75\,\Omega$$ This, in accordance with Ohm's law, yields us the current \$i_1 = \frac{10}{R_t} \approx 2.67\,\text{A}\$ My first question here is about passive configuration regarding current and voltage. The passive configuration is when the current reference direction enters the positive reference of the voltage (as in our image). In this case, we have Ohm's law as \$v = iR\$. But when the current reference direction enters the negative reference of the voltage, Ohm's law becomes \$v = -iR\$. So that means if \$i_1\$ goes in the same direction as \$i_s\$ in the figure, \$i_1\$ is positive (as per my calculations). However, the textbook writes \$i_1 = -2.67\,\Omega\$. For the rule I explained above, is there an exception to sources, or have I misunderstood the passive configuration's consequence on Ohm's law? The next step to solve for \$i_s\$ is to zero the voltage source, which gives us a circuit that looks like the figure below. Why is it that the current through the \$5\Omega\$ resistor will be \$0\,\text{A}\$? Textbook gives us \$i_2 = -0.67\,\text{A}\$, which can be calculated using the current-division principle on the \$10\Omega\$ and \$5\Omega\$ resistors, which are apparently parallel (I don't see it, considering the \$5\Omega\$ resistor). AI: I'm not sure what is meant by "passive configuration", but the current supplied by the voltage source is opposite the direction of \$i_s\$. This is because In a single source circuit, the direction of positive current flows out of positive terminal of a voltage source. However, in a multiple source circuit, this condition may not be valid. You are using superposition, so for the analysis of \$i_1\$ you have a single source circuit. Since the current from the voltage source is in the opposite direction of \$i_s\$, \$i_s\$ is negative. As for the case where the voltage source is turned off, the current through the (upper) \$5\Omega\$ resistor is zero because it is short-circuited by the voltage source (\$v_1\$ and \$v_2\$ are the same node). You can view these two paths as a current divider with the short-circuited path as a \$0\Omega\$ resistor -- if the current entering the two paths is \$i\$, then the current through the short-circuited path is $$\frac{5\Omega}{5\Omega + 0\Omega}i = i$$ Alternatively, the current through the \$5\Omega\$ path is $$\frac{0\Omega}{5\Omega + 0\Omega}i = 0$$ In other words, all the current flows through the short circuited path and none of it through the \$5\Omega\$ resistor. This means you can ignore the upper \$5\Omega\$ resistor as it has no effect on the circuit (no current passes through it, nor is there any voltage across it). Without this \$5\Omega\$ resistor, you should see that there are only two resistors and the desired current is easily solved with a current divider as you have stated.
H: ADC chip signalling - ADS4245 I am designing a system with the ADS4245. My requirement being a 14bit,dual channel I/P and a max of 125MSPS. I understand that going higher without the capabilty to program or select an output sampling rate would be a disaster. Hence-forth I went with the ADS4245. With the requisite parameters are entered, the TI website recommends the ADS4245 But, the data sheet shows the output as LVDS. How can then this serve my purpose please ? I am attaching the image of that chip (and the LVDS info). Wouldnt LVDS be useless as in effect it is a 7bit differential output where as I am needing 14 bit output. What is the difference between a normal 14bit ADC output and an LVDS output ? I merely wanted to confirm that this would be of no use to me due to its LVDS capability. AI: The AD4225 is 14 bits but only 7 output lines are provided with (say) D0 and D1 being multiplexed for the LSB line. Just because it is LVDS doesn't mean there is something "odd" about the outputs. Read page 13 of the data sheet. The AD4245 is set for CMOS mode and you get all 14 bits (for both channels) outputted simultaneously. Read page 15.
H: Voltage of a complex pararell circuit I'm trying to figure out the voltage of DDR_VREF below? I know it should be the half of 1.5V i.e. 0.75V but how? Can someone in detail explain each step to the arrival of the result of DDR_VREF? I just know the basic calculation of electronic schemas. But I haven't seen a schema as below before. Thus, I don't know how to get the result of DDR_VREF AI: The capacitors don't conduct when the supply is pure DC so ignore them. Next use ohms law to calculate current through R11 and R12. Hint Rtotal = R11+R12. Next calculate the voltage across R12 given that current you just calculated. Or, you can just simply look at it and notice that R11 and R12 are the same value hence the voltage at their midpoint is half of 1.5V
H: Hacking an AC power unit with a transformer I have some mini speakers whose power pack has died. I can't find any suitable looking replacement power unit as the spec is unusual - 12V AC output 2.9A. Nothing on Amazon or eBay looks suitable. Sounds like it's essentially a step-down transformer I need. Lots of these available - e.g. this 220-12V 30W example. But would such a unit be theoretically sound or would it need any additional elements to be safe, other than a 3A fuse? AI: Creative make one: - And here is the amazon link. It was top of the search engine list so I don't know what you are doing to have missed it.
H: Measuring impedance frequency response on Low Power Board I have a low power board (2.1V DC). It runs a micro, some sensors, etc. I am interested in plotting out the impedance frequency response of the overall board so I can tell where the impedance dips. This will let me know any problem areas in my bulk capacitors or layout. I am curious how to go about this, and yes I know I can do a simulation, but would like real data. AI: Correct me if I'm wrong, I think what you are trying to do is verify that you have appropriate bypassing and that the layout is not susceptible to some coupling. Getting the impedance frequency response sounds trickier unless you already have equipment to do that. What I would do is first check the frequency response of the bypass caps. You might be able to get away with using a signal generator as a power source. Put in the required DC offset and add an additional sine wave. Ensure that the peaks / lows are within spec and don't trip a UVLO or something like that. Get a nice probe & scope and stick it on the node of interest (MCU VDD for example). Measure the amplitude of the signal at the node and you can calculate how much attenuation is occurring. From this you can calculate your power supply rejection ripple (PSRR) or whatever value you want. Alternatively, inject some white noise into the system, and grab a spectrometer of the node of interest. Once again, you'll be able to see how the board is rejecting unwanted signals.
H: Can you identify this video plug? An analog video camera has this connector. 9.4mm, sting hole much thinner than in RCA (but still too thick for a copper core); has 2 bumps (or whatever they're called) on its sides (turning lock?). No screw thread. AI: It's a female BNC connector. They're normally found on the front and back panels of devices like oscilloscopes that need a coaxial connection for good high-frequency response.
H: Use GPIO pin of PIC on a general way and also with a led What should be the best way to connect a led on GPIO pin to work as an indicator but also as GPIO for use in other things. Should I connect it in a serial way? but I think Ill have a voltage divider, or in parallel way? AI: Because the microcontroller output is a voltage source, you should connect the other item in parallel with the LED: simulate this circuit – Schematic created using CircuitLab Notes: The above presumes that you want the LED on when the other load is high. If you want the opposite behavior, flip the diode and connect the anode to the supply voltage. Be careful to not exceed the maximum current rating for the pin. The pin cannot simultaneously be an input and an output.
H: Why are FPGAs used so often for HDMI video projects? If you look through hdmi projects on a site like hackaday, you'll find that just about every one of them involves an FPGA. I don't think I have seen any DIY project with HDMI output that hasn't used an FPGA. But why? As far as I can tell, FPGAs are expensive, around $70-$100. Compare that to a Raspberry Pi for $35, that can do way more complex things, and output HDMI. Why isn't an ARM used? Or an even cheaper microcontroller? In the case of upgrading the video on old game systems, the logic shouldn't be any more complicated a cheap microcontroller can handle, but I keep seeing HDMI as an impossible hurdle only tackled by FPGAs. AI: Basically, no microcontroller, even the raspberry pi, is fast enough. The raspberry pi has an onboard GPU that generates the HDMI output. And other than that, the I/O capability of the raspberry pi is incredibly limited - the highest bandwidth interface aside from HDMI is USB. Many of the HDMI conversion projects involve taking another video stream in a strange format and reworking that into something that can be sent to a standard HDTV over HDMI. This requires some custom interfacing logic to read in the video signal, signal procesing logic to reformat it, HDMI TMDS encoding logic, and then high speed serializers to actually drive the HDMI port. Working with streaming, uncompressed, high definition video requires processing a huge amount of data, something which is not feasible on a general purpose CPU. A 1080p video signal at 30 frames per second has about 62 million pixels per second. The raspberry pi runs at 700 MHz, so you have, oh, 11 instructions per pixel. And that's 11 instructions to read in the oddball video format in real time, rescale it, etc., etc. Not possible. Period. On an FPGA, it is possible to generate a long processing pipeline that can process one or more pixels per clock cycle and do so in a highly deterministic manner (no interrupts or task switching!) so that the pixel data is ready for transmission over HDMI at exactly the right time. If you have worked extensively with general purpose CPUs running any sort of operating system, you will know that getting accurate timing on a milisecond level is more or less doable, but on a microsecond level is pretty much impossible. For HDMI, you need nanosecond scale precision. Not doable on a general purpose CPU. Also, take a look at the HDMI audio/video project for the neo geo. This one not only has to rescale the video, it also has to resample the audio and insert it into the HDMI video stream. This requires some extremely precise orchestration to get working correctly. And this still isn't considering the custom logic required to read in whatever input data format you have. You'll need custom hardware to interpret this. Software is not fast enough or deterministic enough. You might be able to, say, reformat it into some sort of USB based stream, but this will require custom digital logic anyway, so you might as well just output HDMI directly. To implement all of this, digital logic is really the only feasible solution. And if you are doing digital logic, FPGAs are the only feasible solution, as it is too fast and too complex for discrete 7400 logic and ASICs are, well, several orders of magnitude more expensive. Another required component are the actual high speed serializers and differential drivers to generate the parallel serial data streams that get sent down the cable. It's not possible to bit-bang serial data on the order of a gigabit per second from a general purpose CPU, this requires specialized hardware. The raspberry pi has an onboard GPU that does this, but it is limited in terms of what the GPU is capable of, not to mention what is documented. Most FPGAs contain at least the necessary differential drivers and DDR flip flops that are enough to support low-resolution video and there are quite a few FPGAs that also contain the necessary serializers (i.e. Xilinx OSERDES blocks) to generate full HD streams. Don't forget that the serial stream is not 'baseband' like a normal serial port where the actual data is sent verbatim with some framing information, but the data is actually encoded with TMDS (transition-minimized differential signalling) to give the signal certain electrical characteristics. A bit of logic is required to implement this in addition to the actual high speed serializers. All of this is relatively simple to do in pure digital logic (well, the encoding anyway - serialzers are arguably analog, or at least mixed signal) on either an ASIC or an FPGA. It's actually a very important part of the overall digital/embedded system design process to figure out what parts of a system can be implemented in software and which ones require hardware, either in the form of off-the-shelf specialized chips, FPGAs, custom ASICs, hard or soft IP (HDL, netlists, GDSII), etc. In this case it is clear-cut: video signal generation requires specialized hardware, be it a GPU paired with a general purpose CPU, an FPGA with an integral hard or soft CPU core or paired with an external CPU, or something more specialized. Edit: I just realized that the fpga4fun site and the neo geo video project both run at 640x480 instead of the full HD. However, this doesn't really make this while operation much simpler. The minimum pixel clock is 25 MHz, with a bit clock of 250 MHz. This means that the FPGA actually does not require serializers to transmit HDMI, only DDR flip flops. This still does not alleviate the issue of reading on the video data, though. If you want to do that on the raspberry pi with no hardware assistance, you would have to read from GPIO continuously at 25 MHz. Which is one read every 175 instructions. Entering the realm of possibility, but the only way you would make that work is on bare metal (no Linux) with hand-coded assembly.
H: Firmware vs. Software In computing, firmware is a computer program that is "embedded" in a hardware device, that is, an essential part of the hardware. It is sometimes called embedded software. I got this definition from Wikipedia and I am getting confused of the terms firmware and software. Can you give me clarification about these. AI: A computer program which is stored on a hard drive and loaded into a PC to be executed is often referred to as software. It is not permanently loaded into the memory chips connected to the CPU. A new copy of the program can be loaded onto the hard drive, and the next time the program is run the new version will be loaded and run. Embedded computers are the ones that control a lot of the electronics that run our daily lives, but which we never see. They are in microwave ovens, cruise controls, TVs, and of course smartphones. A modern car has more than a hundred embedded computers (called microcontrollers). A microcontroller can cost as little as a quarter in production quantities. Embedded computers almost never have a hard drive (some have SD cards, which are used like hard drives, but not for loading programs). Instead, the software is programmed, or burned into the microcontroller chip. So there is no loading of the program, it just runs from where it is. Programs for embedded CPU's like this are called firmware, rather than software, because historically it was much harder to change the program. That is not so much the case now, but the name stuck. So you have the progression Hardware -> Firmware -> Software. Hardware is the circuitry and PCB board etc., that cannot be changed after it reaches the consumer's hands. Software is dynamic, and can be instantly updated and loaded into memory and run. Firmware is somewhere in-between, it acts like software, and can be updated albeit not as easy; but once it is, in a way it becomes part of the hardware. Historically, firmware has been located in one of several kinds of memories described below. All of these are non-volatile (they retain their content when power is removed). ROM (Read-Only Memory), 1956 (original patent date). Can only be programmed by the chip maker; so developers had to develop their programs on separate (and expensive) emulators; and when done, turn them over to be burned into ROMs. If a mistake slipped by, lots of chips had to be thrown out. PROM (Programmable ROM), 1956. Now developers could program their own chips, but only once. Each time they made a mistake, into the trash. EPROM (Erasable PROM), 1971. Now the chip could be erased, by shining UV light through a little window on the top of the chip. So it could be used over and over. But erasing took around 20 minutes. Lots of coffee breaks. A variation of the EPROM was the OTP (One Time Programmable), which was an EPROM without any window, so it couldn't be erased. Functionally, same as a PROM. EEPROM (Electrically EPROM), 1978. Now the chip could be erased and then re-programmed in seconds. Developer productivity soars! Flash, 1984. Another type of EEPROM, which is faster to write but slower to erase than conventional EEPROMs. Most commonly used memory to hold firmware today. All of the above except for PROMs are still in use today. ROMs are used for program storage where the volume is high, and costs must be kept as low as possible -- an example is singing greeting cards. ROMs are the cheapest of any memory type used on computers. Way back "then" (1970's), chips were programmed by taking them out of a socket on the PCB, putting the chip into a stand-alone programmer, burning the new firmware onto the chip, and replacing it on the board. Then turning power on to the board, and seeing if the program ran correctly. There was no mechanism for setting breakpoints etc. A lot of debugging was done by sending debug output to a terminal. If you had to fix a mistake, if it was a small change sometimes it was easier to just patch the binary rather than go through the whole compile-link cycle (which could take 10 minutes or more -- these were often floppy-based development systems). ICSP (In Circuit Serial Programming) was a huge improvement. It meant it was no longer necessary to remove the CPU chip from the board to program it. This was a necessary change, since the newer microcontrollers were coming out in SMD (Surface Mount Device) packages which cannot easily be socketed. The processor chip is connected to a header on the board, which is in turn connected to a programmer via a cable, which is connected to a PC over a USB cable. Besides being able to update the chip over this interface, ICSP also provides a full debugging interface for the developer, for setting breakpoints, single-stepping, etc. In addition to ICSP, a lot of microcontroller chips today can update themselves in situ. They do this by putting a small program in a protected area of program memory (so they won't accidentally overwrite themselves), then a new program is downloaded to the chip, and it updates the main program by writing to the flash. After the update is complete, the CPU is reset and the new version of the program is executed. This feature is sometimes called FOTA -- Firmware Over the Air). Apple uses it, for example, to upgrade the version of iOS on their iPhones and iPads. In addition to referring to the programs that are actually executed by the CPU, software and firmware can refer to the code that the programmer writes, e.g. he wrote the software or she wrote the firmware. The terms can also be used as adjectives, as in software listing or firmware programmer. In relation to firmware, you will also encounter the term assembler code. This is when the programmer writes code that matches the actual machine instructions executed by the CPU. The code is still considered to be part of the firmware. When microprocessors first came out, this was very common (usually because high level compilers weren't available or they weren't very good, or the processor's memory was too small), and often the entire program would be in assembly. Now assembly code is seldom used, and the entire firmware program is usually written in C or occasionally C++ or some other higher level language.
H: Alternative to lead-acid battery on power wheel toy This might be a silly question, but here I go. My son’s power wheels car battery (12v 9.5Ah lead acid) is gone and, here in Venezuela, they are pretty difficult to find, not to mention the high prices. So looking for an alternative I found that a local computer store have those laptop battery packs on sale (10.8Vdc 2600mAh/28.08Wh Li-Ion) they also sell external chargers for this battery pack, and I started to wonder if I can build a battery pack that works properly on the power wheels. I been reading about, it takes more than basic knowledge on batteries to do that, so I decided to post this question. Is it possible to make an arrangement of these batteries to power this type of car? I know that these type of batteries needs circuitry to prevent overcharge (over 4,2v), prevent over discharge (below 2,5v), charge balancing, and prevent over current (more amps than they support during discharge). What my limited knowledge (mixed craziness) tell me to do is, buy 4 battery packs, 4 chargers (that will solve over charge and charge balancing problems), and use them in parallel to power the car (10.8Vdc 10400mAh 112.32Wh), I suppose I’ll need some circuitry to prevent over discharge, and I don’t know if I need something to limit current since 10.4Ah are over original battery 9.5Ah. And yes, crazy as it sounds, I can buy 4 laptop batteries plus chargers by half the price of original power wheels battery. Thanks in advance for your help, and sorry for my English. AI: Having an amp rating HIGHER than the original battery is ideal. It will only try to deliver the car the current it needs. If the toy asks for more than the battery can offer, then you have a problem. However, you need to design the battery bank to safely fail when a cell dies, otherwise you can cause a cascade failure of venting and possibly igniting cells. A very bad thing. Here is an example of what I would do: If we are using Panasonic 18650 3200mAh Li-ion batteries, then we know their specs are 3.6 nominal voltage and 10A max continuous current draw. First, calculate the bank characteristics. 10.8 / 3.6v ~= 3. We will need to use 3 batteries in series to pull the voltage up to spec. Max charge should be around 12.6v, likely nearly identical to the original battery. Assuming the old battery had a 30 amp fuse, we would need a minimum of 3 rows of 3 batteries to get the bank to the minimum requirements at nominal voltages. However, I would add 2 extra row for overhead. This would total 15 18650 batteries, 5 sets(in parrellel) of 3 batteries(stacked/in series). When charging the cells, you should charge them in parrellel. What I would do is make a separate set of terminals on the battery that connect to all of the batteries in parrellel. from these terminals, charge the battery at no more than 1 amp per cell at no more than 4.2 volts(for 18650 batteries, you need to find the nominal charge rate of the batteries you plan to use if you go another route). Charging batteries in parrellel will naturally balance, as long as those batteries are new batteries married to each other at birth. I have never trusted series charging because of all that can go wrong. This would give you a total of 5*3200 mAh for a total of 16000mAh and 173 Wh. This is simply an example to get you familiar with the calculations. A battery bank such as this would easily set you back USD $100. It is important to ensure each cell has overcurrent protection of an amperage lower than the battery is rated for(roughly 2 times the C rating). Without this, when a cell dies, it can cause an overcurrent cascade, and this is a very very bad thing.
H: BLE connectable but not scannable Is is possible to connect to a BLE device without thesaid device being discoverable? I don't seem to have to search for a device to be able to connect to it (just knowing it's address), but I don't seem to be able to connect unless I first put the device in discoverable mode first. I want to be able to connect to a device just knowing it's address, but that device should not appear if you scan for it. AI: My understanding is that the peripheral needs to be advertising before you are able to connect to it. You can set up a white list for scan requests and connection requests, but that's about it. Depending on your specific application however, you could set up the peripheral to only broadcast its data. Alternatively, you could maintain a connection and make the peripheral enter a sleep mode until it has data to transmit.
H: Comparison of wireless communication technologies: bluetooth vs wifi I would like to build a simple battery-powered board with temperature and humidity sensors. It should be able to be placed in different rooms of an appartment, and I want to be able to read the values remotely. Eventually I would like to equip all rooms with such board. I haven't chosen any hardware yet, but I was thinking to connect the sensor(s) with a low-powered microcontroller, and some wireless interface. But considering the somewhat low distance (not more than 10m), the likely presence of wall, I am hesitating on the technology I should use for the wireless communication. I considered the following technologies WiFi, Bluetooth. Could anyone summarise the pros and cons of those three technologies? Or point me to a good review, which would help me choose the best for my needs? Of course, if I am missing a very crucial technology, do not hesitate to point it out. Radio RF? PS. I know that there are commercially available products for exactly such needs, but I would like to do it myself, for the experience it would bring me, and also because of possible extensions I could implement. AI: Wi-Fi is a IEEE 802.11 standard: Pros: it is IP based communication you don't need build a gateway (I don't mean the router gateway) to transfer the information to the Internet. years of proven stack Strong security algorithms (AES-256, WPA2, etc.) Allows secure tunnels like TLS Cons: Higher power consumption: It is probably not a good choice for a battery powered application unless you put your devices to sleep mode and wake up time to time to do measurements. WiFi stack is a heavy stack, it requires a better processor power to handle it (again cost and power) Higher cost WiFi uses beacon based communication, it constantly radiates (power consideration) It is majorly designed for an infrastructured mode, the nodes needs to be in the range of the AP in order to transfer your data. Ad-hoc mode is not well supported Bluetooth: I am not much experienced on Bluetooth, the blueetooth's advantage would be that you can develop an application that you can use connect your phone directly to the devices to control. As I know, bluetooth is for peer to peer communication. I would go for another standard under the same family of IEEE 802.15.4 ZigBee. Pros: Low power Light stack Application layer compatibility (home automation stack should include what you are looking for) Beamless communication (no periodic signals) low cost¨ well supported ad-hoc multi-hop toplogy Small packets, less overhead Security (AES-128) Cons: You need a gateway to translate internet packets to ZigBee You can use SoC solution that has ZigBee stack (RF core) + MCU, or you can use a MCU and attack a ZigBee module to run your application All wireless standards are based on Radio Frequency (RF) waves, I don't know what standard you meant with the RF.
H: Does A20 line only disable 20th it or all bits from 20th and above? According to this picture: Only the 20th bit is disabled until we enable it with keyboard controller (or BIOS). Based on the diagram, I think that the wrap around feature is retained for old programs by always set A20 to 0, effectively prevent carry bit from bit 19th and achieve a wrap around after a calculation. However, when we set bits 21th and above, those bits can still be used as normal for calculation, since they are not masked out. But some resources state that A20 line disables 20th and above bits. Which is correct?: AI: It is only the A20 line; the origin of this hack was a bug in the 80286 processors that failed to set that line to 0 in real mode. It also failed to set the others, but real mode programs did not care, so only that line got the gate.
H: The best use of battery power My project involves a number of components. Some are 3.3v and some are 5v The project must be powered by 8 AA batteries. Most of the time the components will be in a low power state. But they will all turn on at the same time and then off again at the same time. With the exception of 2 servos. One 5v and 1 3v. They will be on almost all the time. My plan is to combine the batteries to make a reliable 6v supply. 4 x 1.5 x 2. Then use a 5v regulator to get a 5v rail and use a 3.3v regulator from the 5v to get a 3.3v rail. I know there is not much detail about the circuit here but my question is really about the battery formation. Should I instead create two seperate power sources to match my reails. Should I create a separate power source for my servos and have 4 rails (2 of each) Should I group the batteries to get a heigher voltage like 7.5 or 9 Ideally I would want all batteries to drain at the same rate so it's easy to replace them as they will all be dead at the same time The number and size of batteries is fixed but most other things are up for grabs. I can provide more detail on anything if needed. AI: I would put the batteries in series to ensure they all drain at the same rate. In parallel, variations in the batteries used might cause one branch to try to charge the other. The other advantage is you can then feed the whole lot into a buck converter to generate a 5V output which will be able to drain the batteries down completely. If cost is not an issue I would just use a high performance buck IC, such as those made by Linear Technologies. These have very low standby current and are extremely efficient. However a complete implementation would cost upwards of $4-5. A cheaper option would be to power your micro with a cheap linear regulator, and have it turn on a cheap buck converter whenever the servos are required. Whether you need to put another buck converter to go from 5V to 3.3V depends on how much efficiency you're trying to squeeze out of the thing and, of course, how much you can afford to spend.
H: high amplitude pulse for short time followed by long pulse of low amplitude I am looking to get output pulse as shown in image with green color. As of now, I am using a trigger pulse, as shown in blue color, as a trigger input to 555 Timer IC in monostable (one shot) mode. Now, I desire to get the same output pulse but the input should be a pulse itself instead of a trigger as shown in other image. The input pulse should be 1s in duration and so as the output, but for 25ms the output pulse should be of high voltage and for remaining time (i.e 1000ms-25ms=975ms) it should be of low voltage. Any kind of help is highly appreciated. Many Thanks! AI: I would use two 555 chips (or one 556). One would generate the 25ms pulse and the other would generate 1000ms pulse. Both would be triggered at the same time on the rising edge of the input pulse. I'd use an opamp in an non-inverting adder configuration while selecting the resistors to scale the first output to 4V and the second one to 1V. Here's an example: How to design a non inverting op amp adder for my circuit? EDIT: Here is a block diagram of the circuit I was talking about
H: Isolating batteries from charger I have an interesting project and I don't know whats the best solution. Basically I have a charger (charges one battery at a time) and 2 batteries. What I want to do is to have the charger charging battery 1 (while battery 2 is feeding clean power to an audio system) With a voltage sensor (when battery is low) , I want to switch the charger to battery 2 and have battery 1 power the audio system. (the voltage sensor its not the question) My question is : The battery that feeds the audio system must be completely isolated from the charger and ground (so no power noise is present). Is there a way (except SSR) to do that ? PCB is quite small and space is at a premium. Also take in consideration and charger is 3A 5.5v and batteries are 5.4v AI: A relay would really be the only way to completely isolate the the charging battery subsystem from the consuming battery system. Using solid state components to switch the battery connections would probably be good enough, even with a shared ground, for most applications and users. But technically this still leaves a connection. On the other hand for some audio purists, and it seems that you fall into that category because you are even talking about using batteries to power your audio system, you would have to use a multi-pole relay to connect both the + and - sides of the battery to one system or the other. Such system could very likely provide your intention of "clean battery power" to the audio system. There are some short comings though - During the switch over from one battery to the other there would be an annoying loss of operational mode of the audio subsystem for a moment. Some audio equipment may give loud pops when the power source is suddenly connected or disconnected. If the charger is not capable of charging one battery faster than than the consumption rate off the other battery then you maximum listening time, with one annoying battery switch over event, would be the time afforded by two charged batteries.
H: Designing voltage summer without op-amp The above circuit is from Operational Amplifier Adder. Now remove feedback resistor and op-amp, and get the output. From the answer of the question, I know how the end result for Vout would be, assuming load resistance exists. But now suppose that there are N inputs, and there is some load resistance RL. Can anyone show me a simple way or equation of quantifying how load resistance makes the sum result diverge from the ideal value? (The question comes from the fact that adding parallel resistances involve ||, which when expressed into final output takes a lot of time to expand and I still do not know whether there exists a general formula for any N inputs.) AI: The output voltage is $$\begin{split} V_{\text{OUT}} &= R_1||R_2||..||R_n||R_L \cdot \sum{(V_i/R_i)} \\ &= \biggl(R_1||R_2||..||R_n\biggr)||R_L \cdot \sum{(V_i/R_i)} \\ &= \frac {R_K R_L}{R_K+R_L}\cdot \sum{(V_i/R_i)} \end{split}$$ where \$R_K = R_1||R_2||..||R_n\$ If you consider the ideal output voltage is when \$R_L = \infty \$, then $$ \frac {V_{\text{OUT}}}{V_{\text{IDEAL}}} = \frac {R_L}{R_K + R_L}$$ To look at it intuitively, \$R_K\$ is simply the Thévenin equivalent source resistance of the divider without the load resistor.
H: By what factor would gate geometry have to be enlarged when VDD increases by some factor? For integrated circuits, let us say that one wishes to increase (contrary to current interests in trying to lower) operating voltage/VDD of integrated circuit. If one increases VDD by some factor k, by what factor approximately would gate geometry need to enlarge? AI: Just increasing gate geometry does not allow for a higher VDD. In CMOS integrated circuits Gate oxide breakthrough is usually the parameter which places a limit on the VDD that can be used. What happens with smaller processing nodes (for example 40 nm vs 22 nm) is that not only the smallest gate length is decreased but also the gate oxide becomes thinner resulting in lowering the value of VDD at which breakdown occurs.
H: For analog summing and multiplying, what would be the disadvantages of scaling down voltages of input? let us say that we have an analog summer based on op-amps. For the reason related to maximum output voltage of op-amps, one wants to scale down the input voltages by constant factor. Would this cause significant problems for sum? Would there be an internal problem other than noise problems? Would frequencies of an output signal be significantly biased toward some frequency range? AI: There is no particular serious problem with this approach. The inputs don't need to stay within the supply voltage range if the series resistors are high enough (though you do need to worry about what may happen if the input is connected to an external voltage and there is no supply voltage- the summing junction will no longer be at virtual ground and current will flow somewhere). You can calculate the voltage and current noise as usual, high value resistors will have greater Johnson-Nyquist noise, and the noise current of the amplifier will have more influence, but neither is normally much of an issue. It may be necessary to add some capacitors in the resistor ratio if you have very high value resistors (to get flatter AC response, increase stability and decrease noise).
H: Wiring for Logic Level Converter to 1.8V SPI Flash with a 3.3V programmer I have a 3.3V SPI flash programmer that I would like to use to flash a 1.8V SPI flash chip. I have read that I could use a logic level converter to do this but I can't find wiring diagrams. There is a good article here "How do I write to SPI flash memory?" on how to flash SPI but I can't seem to find any good article on how to wire a Logic Level Converter like "https://www.sparkfun.com/products/12009" to convert 3.3V to 1.8V to flash a 1.8V SPI chip with a 3.3V programmer. AI: Well my understanding of the logic level converter was wrong. I had thought it could also convert voltage but that is not correct. I need to supply 2 different voltages. A 3.3V on one side and a 1.8V on the other side. Anyway, I found a link that contained the wiring I needed. Here is a pic from the link. http://fs2.directupload.net/images/150517/eqkfw8e9.png
H: If my product uses a certified RF transmitter, is it treated specially by the FCC? So I have a product. It uses the Particle P1 as the microcontroller and WiFi RF setup (with onboard antenna), which is pre-FCC certified; it has a ("Contains Transmitter") FCC ID that you put on the case of the final product. When I go to certify the entire product, do I still to get it tested as an intentional radiator? Does the fact that the "Intentional Radiator" portion is pre-certified make the device an unintentional radiator from a certification perspective? AI: Really the best way to get an answer to questions like these is to call your test house and just ask them, even if you are a first time customer they'll tell you things like this for free. That said I wouldn't say you are treated as a unintentional radiator per se. You just no longer have to do the intentional radiator testing as long as you are using the same antenna the module vendor used and following their integration guidelines. This should save you plenty of cash on its own.
H: LTSpice IV: How to vary input Voltage and measure the frequency? I am getting started with LTSpice IV and I have a couple of beginner questions: In the following circuit, I want to do the following (separately for each simulation): Vary the amplitude of V1 from 20 volts to 200 volts in steps of 10. Vary the frequency of V1 from 60 Hz to 300 Hz in steps of 10. In both cases, I want to measure the frequency of the voltage across R2. Please suggest me how to do this. simulate this circuit – Schematic created using CircuitLab Thanks. AI: In a circuit like yours the frequency of any voltage or current will be that of the source signal, hence there is no need to retrieve it from the simulation result. If your situation is much more complex, e.g. you want to measure the frequency of some resonant ringing or the like, you will have to do this graphically from the output plot of a transient simulation. Now to your question: If you want to vary several parameters and execute a simulation with every possible combination of these you need to make a parametric simulation. To do so, add the relevant parameters with arbitrary values to your netlist. You can do this by adding the following SPICE directive: .PARAM + pAmplitude = 20 + pFrequency = 60 Also add the following directive to make you transient simulation a parametric one: .STEP PARAM pAmplitude 20 200 10 Change pAmplitude from 20 to 200 in steps of 10 .STEP PARAM pFrequency 60 300 10 Change pFrequency from 60 to 300 in steps of 10 To include the parameters into your schematic simply replace the amplitude value of V1 by {pAmplitude} and the frequency by {pFrequency}.
H: HDLCompiler:251 - Cannot access memory directly Error I'm giving a 2d array to a VHDL module.This 2d array is valued in a verilog module. The error that ISE is giving is that the 2d array is assumed a memory and can not be accessed. I've googled the error but there were no answers to this specific case. Please help me on this. Here's the definition of the 2d array. wire [IN_FIFO_DEPTH_BIT:0] depth_of_fifo[NUM_QUEUES-1:0];//storing the depth of all FIFOs wire [IN_FIFO_DEPTH_BIT - 1:0] packet_size_temp[NUM_QUEUES-1:0]; Here's the part of my verilog code that is the source of the error. Deficit_Round_Robbin_algorithem #( .Quantom(), .Num_queues(NUM_QUEUES), .IN_FIFO_DEPTH_BIT(IN_FIFO_DEPTH_BIT) ) algorithem_module( .clk(axi_aclk), .axi_resetn(axi_resetn), .m_axis_tready(m_axis_tready), .packet_size(packet_size_temp), //Line 247 .fifo_out_tlast(fifo_out_tlast), .empty(empty), .rd_en(rd_en), .pkt_fwd(pkt_fwd) ); And here is the error message ERROR:HDLCompiler:251 - "K:/final project/codes/v3/input_arbiter.v" Line 247: Cannot access memory packet_size_temp directly ERROR:HDLCompiler:598 - "K:/final project/codes/v3/input_arbiter.v" Line 46: Module <input_arbiter> ignored due to previous errors. AI: Verilog does not support two dimensional arrays or unpacked arrays as ports; SystemVerilog does. Verilog does support a packed array (also referred to as a vector) as a port. For verilog, you need to pass the index. Examples: .packet_size(packet_size_temp[0]), or .packet_size(packet_size_temp[reg_or_wire_of_index]),. If you need to pass the whole array, then you will need to flatten it to one big vector and slice it on the other side: ... reg [NUM_QUEUES*IN_FIFO_DEPTH_BIT - 1:0] packet_size_temp__packed; always @* begin for(idx=0; idx<NUM_QUEUES; idx=idx+1) begin packet_size_temp__packed[idx*IN_FIFO_DEPTH_BIT +: IN_FIFO_DEPTH_BIT] = packet_size_temp[idx]; end end ... Deficit_Round_Robbin_algorithem #( ... ) algorithem_module( ... .packet_size(packet_size_temp_packed), ... ); ... Review on +: stackoverflow: Indexing vectors and arrays with +: and What is +: and -:? Enabling SystemVerilog is alternative, it does support arrayed ports. To do so, it is recommend the change the file extension from .v to .sv. Most simulators and synthesizers will properly parse the file with only the correct extinction. Another approach is to set a compiler flag which is tool dependent (usually -sv or -sverilog), but this will typically force all Verilog files to be treated as SystemVerilog which may have naming conflicts with SystemVerilog keywords.
H: How can a signal backfeed and create a crosstalk in a passive summation circuit? ...a passive summation circuit can be a simple way to combine signals but one disadvantage is that the summed signal will backfeed into each of the sources. This could be an issue if you wanted to use the source unmixed as well as combined - you would get crosstalk. The amount of crosstalk will depend upon the impedance of the source and a low enough output impedance this wouldn't be noticed. (from Designing voltage summer without op-amp) Can anyone explain this further? How can a signal backfeed? AI: In an active summer the voltage at the summing node is extremely close to zero but in the passive summer the voltage at the summation point is your output voltage and is non-zero. This voltage will cause a current to flow though the summation resistors and into the source. If the source has a non-zero output resistance there will be a voltage generated at the output of the source that is caused by the other inputs.
H: Switching two optocouplers based on different voltages I want to build a (I think) simple circuit where I want to transmit the state of two switches across two wires (ground and live). Let's say I have a circuit with which I can set three output voltages between these two wires from the two switches (switch A pressed, switch B pressed, both pressed): 1V, 2V and 3V. How would I go about driving two optocouplers so that when the 'input' voltage is 1V, optocoupler 1 is 'closed' (if that's the right word); when the input is 2V, optocoupler 2 is closed; and when the voltage is 3V, both are closed? Thanks. AI: A slightly different way to solve your problem is to use AC and handle the two halves differently, as in the circuit below: simulate this circuit – Schematic created using CircuitLab
H: How can we have high voltage and low current (in transformers), if V = I * Impedance? I have researched a lot on this topic (including this site) and found this link somewhat helpful : How is it possible to have high voltage and low current? ...     But still it seems to fall somewhat short. People have explained that since power must remain constant(no losses in ideal case) then power in = power out, i.e. $$V_{in} \cdot I_{in} = V_{out} \cdot I_{out}$$ and $$\dfrac{V_{in}}{V_{out}} = \text{Ratio of number of turns in primary to that in secondary coil}$$ But how is this possible? Let's say the plant can supply power of 1000 W, @1000 V and 1 Amp. The voltage is determined by the generator but the current is determined by the impedance of the circuit having the primary coil. Lets say the transformer is step down and the voltage induced (RMS) is 200V. According to previous logic, the current must be 5 Amps. But shouldn't it depend on the resistance(or impedance) of the appliance we have connected to the secondary coil? EDIT 1 Why does the primary impedance depend on Np/Ns Ratio? Is it due to mutual induction? And why does actual load impedance in secondary depend on that ratio and not what appliances we have connected across the secondary coil? If I connect different number of appliances will the voltage induced across the secondary change? Edit 2 If the primary impedance is changed by connecting /disconnecting "appliances" then will the apparent power to be supplied by generator change? What about actual power? (Although power in = out, I'm talking about the value) If so, how does the generator manage to change the power supply? AI: You're right, the current does depend on the impedance connected to the secondary coil. I think you're getting confused about what rules to follow when. Here are the rules that always apply to ideal transformers: $$\frac {V_P}{V_S} = \frac {N_P}{N_S}$$ $$\frac {I_P}{I_S} = \frac {N_S}{N_P}$$ $$\frac {Z_P}{Z_S} = \left( \frac {N_P}{N_S} \right)^2$$ $$P_P = P_S$$ Just because your power source can supply 1000 volts at 1 amp doesn't mean it will under all circumstances. What we can say is that if the source is supplying 1000 V and 1 A into the primary side of an ideal transformer, then: The current on the secondary side is \$1\cdot\frac {N_P}{N_S}\$ amps. The voltage on the secondary side is \$1000 \cdot\frac {N_S}{N_P}\$ volts. The apparent input impedance on the primary side has a magnitude of 1000 ohms. The actual load impedance on the secondary side has a magnitude of \$1000\left(\frac {N_S}{N_P}\right)^2\$ ohms. The input power on the primary side and the output power on the secondary side are both 1000 watts. If you change the turns ratio \$\frac{N_P}{N_S}\$, the apparent impedance of the primary side will change, just as if you had changed the actual load impedance. The voltages and currents on both sides will change accordingly. EDIT: Yes, the primary impedance (also known as the reflected impedance) depends on the turns ratio due to mutual inductance. The actual load impedance on the secondary does not -- it's the physical impedance connected across the wires, what you're calling "appliances". But just as with Ohm's Law, if you know the voltage and current on the primary side and the turns ratio, you can calculate the impedance on the secondary side. That's what I'm doing above. To put it another way: the voltage applied to the primary side determines the voltage seen on the secondary side. The secondary voltage and the load impedance determine the secondary current. The secondary current determines the primary current. The primary voltage and primary current give you the reflected (primary) impedance. Think of the reflected impedance as a Thevenin equivalent. If you connect a 22k resistor to the secondary side of a transformer where \$\frac {N_P}{N_S} = 10\$, then the primary side of the transformer acts just like a 220 ohm resistor. See also this question. EDIT 2: I'm not an expert on generators, but I'll try to answer your question anyway. :-) As a rule of thumb, the voltage of a generator depends on its speed. Turning the generator at a constant speed produces a constant voltage (an AC voltage, in this case). When applied to a load, this voltage causes current to flow. The current acts as an electromagnet and puts a torque on the generator, opposing its motion. Overcoming that torque consumes mechanical energy. The mechanical energy consumed is equal to the electrical energy produced. (I'm ignoring friction and inertia, and only talking about the steady state.) If you feed a constant amount of mechanical power into the generator, its voltage will vary based on the load resistance, keeping the electrical power equal to the mechanical power. But in practice, we normally want a generator to produce a constant voltage. So the mechanical power is varied to maintain the voltage.
H: Computer Power Adapter Proper Volts No Amps I have a 4 month old laptop. The other day it stopped charging. When I meter it shows 19.94 volts and 0.0 amps. Specs call for 19.5 volts and 2.31 amps. So the manufacturer (HP) is sending me a new power supply. However what I wanted to do was see if I can repair the old one and have a spare. Ideally leave on at the office for those frequent occurrences when I take off in a hurry and forget it. I'm not really sure what to check first. Should I check the output just past the rectifier bridge...or perhaps trace the circuit backward from the output and see if a resistor etc. has blown? Thought, advice, suggestions greatly appreciated. AI: What do you mean by "meter it" what load did it have? 0.0 A makes no sense. Did you just take a DMM plug it in to the supply and put it in current mode and voltage mode because that would have either shorted the supply when in current mode, or more likely been meaningless because you needed to change terminals on the DMM for the current meter to work. It sounds like you did because you got no current and a slightly high voltage. Be warned in current mode a DMM looks like a short so you need to have some other load, like a 8.441558441558442 ohm, 45.045 Watt resistor to do a real test. It's a SMPS so its' going to be pretty complex, there probably isn't a blown resistor it's more likely a capacitor or IC.
H: Question about fly-back diode I read an article from wikipedia about freewheeling (flyback) diode which is used to drive a relay. I understand it but I have four questions. Would you give me a hand, please ? 1- Why does the coil change its polarity ? In figure 1 the positive terminal of the coil is the upper terminal (at node 1), but in figure 3 the positive terminal of the coil is the lower terminal ( at node 2). that means it discharge in the opposite direction. If it was a capacitor the polarity would not change. 2- If I apply AC to a coil, Does the voltage spike happen each period when the voltage is zero ? I read that the coil makes a voltage spike when we turn off the supply. does that mean the coil make spikes at the arrows of the following figure? 3- Why don't we put a diode for each inductive load such as motors in children toys .. etc. ? 4- Can I put an LED rather than a diode ? Thank you very much, AI: 1) An inductor's current remains flowing in the same direction when open circuited and the only way this can be achieved is by reversing its polaity so you can't have both. 2) When the voltage is zero the current flow is at a maximum but this energy feeds back into the voltage source hence no spike - the spike only happens with non zero-ohm voltage sources with discontinuous signals. 3) Generally there are diodes but they are probably on the circuit that drives the motor and might easily be inside some chips. 4) No an LED won't withstand much in the way of reverse voltage (maybe 5V) so any motor supply greater than 5V might destroy it but ostensibly it will work.
H: Why active analog summer (adder) over passive summer exactly? Background: Designing voltage summer without op-amp and Operational Amplifier Adder I know that op-amp can provide virtual ground for the circuit, and can have benefits in eliminating crosstalk. But the latter part confuses me. Suppose that voltage sources are modeled as independent voltage source plus resistor. In such a case, resistor can be added to existing resistors to provide total resistance value, and voltage laws to calculate voltage works, so crosstalk does not affect the sum value, as long as resistance value of each source is quite different. Is the whole concern regarding crosstalk related to different sources having different output impedance? Or am I understanding something completely wrong? To summarize, I do understand that adding voltage makes the output voltage higher than input voltages, and current flows from high voltage to low voltage. But Kirchoff's voltage laws are still there unless we are talking about distributed circuits, and the calculation using same output impedance for different voltage sources results in an accurate-enough sum. So why active summer over passive summer? AI: The concern about backfeeding/crosstalk only matters if: The source(s) in question have enough output impedance to detect the unwanted signal The signal splits off from the source(s) and goes somewhere else in addition to the summer If either of those is false, then you don't care about backfeeding/crosstalk. If you don't care as defined above, and you want an average voltage, then the passive adder is usually the better solution. If you do care, or if you actually want to add and not average, then you need active. The reason you need active to actually add signals is because the result could easily be higher than all of the inputs individually. Since you can't get that signal swing from the inputs, it has to come from somewhere else, like a power supply. That's pretty much active by definition. You could feed a passive averager into an amplifier, but that's two separate modules that retain all of their own properties, both good and bad. You might know this, but it's not clear from your question: The output from an active adder is negative, or inverted. A positive sum is presented as a negative voltage and vice-versa. This is how KCL and KVL still work. If you really want a non-inverting summer, then you need to invert all the inputs (sometimes easier) or invert the output as a separate inverting amplifier/summer with one input. It often helps my understanding of a particular concept to think of something I already know as a special case of what I'm trying to understand. In this case, a voltage divider can be thought of as a passive averager between the signal and ground. Adjusting the divider ratio and translating that back into a passive summer should show you how to make a weighted average.
H: How does this transistor dual LED flasher circuit work? I am a beginner in electronics and have been playing around with simple LED circuits and using Ohm's law to determine what size of resistor to use to limit the current to the LED. I have also been studying how resistors and capacitors work in series and parallel. I think I have at least a fundamental grasp of these theories. I have since moved on to diodes and now transistors and how they are used in simple circuits, again using LEDS. I found the following circuit which uses two transistors, capacitors and resistors to alternately flash two LED’s but I am struggling to understand how it works. Dual LED Flasher Circuit (CircuitLab) How I think it works is this: Voltage is applied to the base of Q1 from capacitor C2 thus switching it “on” which allows charge to flow through to LED1 which lights it. At the same time, capacitor C1 is charged. When C1 is charged it begins to discharge into the base of Q2 thus switching it “on” which allows charge to flow through to LED2 which lights it. At the same time, C2 is fully discharged which switches Q1 “off” causing LED1 to go off. Eventually, C2 is again fully charged and the cycle repeats. But I have a few questions which I cannot seem to answer. I believe that the resistors R1 and R2 are the current limiting resistors for the LEDs, but what are resistors R3 and R4? Do they control the rate at which the capacitors charge and discharge? Or do they have some other purpose that I am not grasping? There seems to be a “chicken and egg” situation here. When the circuit is unpowered and both capacitors are discharged, what causes either of the transistors to be “switched on”? Where does the voltage for the base of either of them come from? And a more general question: What "triggers" the capacitors to discharge? I have read articles about how a transistor works at this link: http://amasci.com/amateur/transis.html and it has helped some, but the simple circuit above is still fuzzy to me. Can someone help me to understand this so it “clicks” in my head? I have also looked at the question below but it has not cleared it up for me. How does this 2 LED flasher circuit work AI: I specialize in the clicking of brains. I remember trying to figure this circuit out when I was around eleven. (The one in my old book used light bulbs, put in Halloween-mask eyes.) Here's my version below. The main trick to these is to re-draw the schematic so it reveals familiar patterns. With yours, first turn it rightside up, and you'll see that it's actually two amplifier stages connected by capacitors. And, the signals are connected in a loop. . Below is the rightside-up circuit without that looped capacitor connection: Each transistor is wired as a common-emitter amplifier stage. Each amp will both invert the signal and also make it larger. If we apply a pulse to point A above, a large upside-down pulse will appear at point B. And this inverted pulse goes through a coupling capacitor C1 to point C, which is the input of the next stage Q1. Q1 inverts it again, and the twice-amplified signal appears at the output at point D. All together it's a 2-stage amplifier. Probably you could hook up a microphone and loudspeaker, and use it that way. So, what happens if we connect the output directly to the input? Positive feedback. Then any small pulse will go through the loop from point A to point D, getting bigger each time. Or in other words, it will break into oscillation. With C2 restored, we'd expect to see high-frequency sine waves, where their frequency is caused by the time-delay through the whole loop of amplification. It's similar to when you hold a microphone a bit too close to an auditorium loudspeaker. But in reality, this whole system has way too much gain, so it gets overloaded and goes nonlinear. It won't make a high-frequency sine-wave oscillation, instead it clips into big slow square waves. (I guess it's more like holding your auditorium-microphone directly against the loudspeaker cone.) In that case the output slams all the way to 9V and to zero, and the speed of the oscillation is determined by charging and discharging of the two capacitors, which mostly happens through the 100K resistors. Once you know how it works, you can sit down and plot out the various events. Start out with one capacitor zero volts, and the other charged to 9V, then figure out what happens next, then next after that. You might have to go through several cycles to see how it settles into constant blinks. All the components are symmetrical, so it blinks equally back and forth like a logic flip-flop. Its official name comes from that: non-stable or "a-stable" flip-flop blinker circuit. That's just one tack on an explanation. Paraphrasing Feynman: if you don't have three or four separate approaches to explain something, you don't really understand it. This circuit can use very, very low DC voltage yet still keep running. Besides LED blinkers, I've seen it used as various beepers, signal injectors, even analog-synthe instruments (with tiny capacitor values, like 0.01uF etc.) A similar circuit with a big iron transformer can generate 120VAC 60Hz, for an electric shocker or as an automotive "Power Inverter" for low-power appliances. Or use coils wrapped on a CRT ferrite HV flyback transformer and make a mini Tesla Coil or a 20KV power supply. The exact same circuit is in a solar-powered pendulum toy, where the LEDs are replaced by electromagnet coils, with a tiny ceramic magnet on a little pendulum getting kicked back and forth when light shines on the solar cells (with four 1cm solar cells in series, for about 2V power supply in sunlight, far less w/indoor fluorescents.) Or, use very large resistors on the base connection, small capacitor values, and add a few-inches pickup wire to one transistor base, to create the world's cheapest Theremin or touch-sensitive audio generator.
H: Which mosfet description (pictures provided) is more accurate? I was reading my physics book and found a description of mosfets that was different than the one I'm used to. Here is the picture from the physics book: In summary the physics book describes it's operation as this: Gate = OFF = No potential difference applied to gate. This allows electrons to drift through the n channel (which is already there at the beginning). Current is maintained because of applied potential difference between source and drain. Gate = ON = Potential difference is applied to the gate, in such away that repels the electrons in the n channel into the p substrate. This reverse bias causes the depletion zone between the p-n junction to increase, causing the n-channel to decrease, and the current to stop due to a low amount of charge carriers. mosfet that I'm used to (taken from a digital design book) Gate = OFF = No current due to no conduction path. Gate = ON = Electrons attracted to the gate, forming a n channel path for electrons to drift through, so current flows. AI: Your physics book example is that of a depletion-mode MOSFET, as evidenced by the phrase "This reverse bias causes the depletion zone...". Your digital logic example uses the more familiar enhancement-mode MOSFET. For a very quick discussion of the differences, see https://en.wikipedia.org/wiki/Depletion_and_enhancement_modes
H: USART RX interrupt racing condition I am designing an RS-485 interface with STM32F0xx series MCU. The scheme uses USART RX interrupt. I am wondering, if I set up the baud rate as certain value(for example, 9600), is there possibility that the interrupt fire more often than every one character time due to noise or some other disturbance in the RS-485 interface? I am worried that if above happen, it might lock up the MCU and prevent it from doing other tasks. AI: The timing for the interrupt comes from the local clock so although interference could cause the data to be garbled it can't cause an interrupt more frequently than once for every 9 or 10 bits (depending upon whether you have it set for 1 or 2 stop bits - assuming 8 bit characters). The start bit triggers the beginning of the counter that will end with an interrupt.
H: Diodes question (I Got the answer but I just need more clarification) Problem : finding I2 and V at the end of solving I got I2 = 0 by making D1 open and D2 is short circuit. I just don't understand how the answer for V at the end is -1.7 I tried open D1 and therefore I2 = 0 then I thought it is all together now so I1 = I3 =( 5 - (-5))/15 = 0.666666666mA then I got lost on how to find V, since I read the solution to be V = -1.7 I tried doing the .6666 * 5 or .66666 * 10 which didn't get me toward the answer Any explanation that can walk me through would be much appreciated AI: R1, D2, and R3 are dropping a total of 10V. Since D2 is ideal, it drops 0V. This means that the current flowing must be: \${10\text{V} \over {10\text{k}\Omega + 5\text{k}\Omega}} \approx 667\mu\text{A}\$ The voltage dropped by R3 must therefore be: \$667\mu\text{A} \cdot 5\text{k}\Omega \approx 3.34\text{V}\$ The voltage at V must then be: \$3.34\text{V} + - 5\text{V} = -1.66\text{V}\$
H: Where should I add ground pour? I am finishing off my Atmega32u4 development board. Essentially a Teensy 2.0 clone. I have little background knowledge, but I see boards with pours all the time. Here I have made a GND and VCC pour underneath the MCU. Is there anywhere else I should also pour? AI: Your board is extremely compact and since most of your components, if not all, are on the top layer, putting another pour on the top layer may do more harm than good. As Ignacio noted, your crystal positioning is a little concerning. Give this document from Atmel a good read. It explains how to position a crystal on a PCB. With that said, it looks like you don't have many traces that would block out the possibility of copper pours on the bottom layer. Now you have quite a few traces running in parallel for a bit with each other, if those traces are being switched quite rapidly, you may see some crosstalk between them. Putting a ground pour on the bottom layer would mitigate this. Be sure to mind the crystal and don't put the ground plane underneath it. One thing, to make the bottom layer ground plane more whole, keep the trace connecting to the third drill from the right on the top row on the top layer. There really isn't any reason to move it to the bottom layer as there is clearly enough space to keep it on top. Putting it through a via will just induce unnecessary noise.
H: How much space should be left between a PCB's edge and traces and holes I am designing a PCB for use with an Arduino mega and I am wondering if there is a good rule for how much space I should leave between the edge of the PCB and various items like: traces (ground, 5v supply, 9v supply, and 5v digital signals) surface mounts small through holes (capacitors) mounting holes (for screws) large through holes (power supplies) I currently have 0.1" around everything except of a through hole for a DC jack, which comes .05" from the edge. Can I remove some of this space and not hurt my design? AI: traces (ground, 5v supply, 9v supply, and 5v digital signals) surface mounts small through holes (capacitors) Collectively, all these are covered by the minimum copper to board edge clearance parameter. The value is driven by the precision with which the PCB fab can register the board before it's routed. Typical value is 0.020". Narrower clearance is possible, but the fab may charge extra for additional precision. So, check with the fab, the clearance should be on their "capabilities" page (like this one). mounting holes (for screws) Distance of mounting holes for screws is driven by a mechanical considerations. My rule of thumb is to keep the distance between the edge of the hole and edge of the board at least as big as the diameter of the hole. But this can vary greatly depending on how much vibration your assembly will see, and how heavy are the components on the board. [hint: Separate question.]
H: What do they mean in ADC datasheet? I have an analog signal in the range of -12v to +12v and I want to read it by a high resolution ADC. In other words, I do not want to use a resistance divider or other scaling methods such as op-amp circuits. I searched on google a lot and found the AD7732. Now I have several related questions to the part: Does anyone know other alternative ADC to choose? I need high resolution and ±12v range and speed is not important for me. Does the AD7732 provide a direct reading of an analog input in the range of ±12V or only ±10V? What do these sentences mean in the datasheet? a. Overvoltage tolerant b. Up to ±16.5 V not affecting adjacent channel c. Up to ±50 V absolute maximum d. The AD7732 is a high precision, high throughput analog front end. AI: The AD7732 is a high precision, high throughput analog front end. An analog front-end is basically a term relating to modern digital systems. Modern digital systems typically use low voltages, anywhere from 5V and below. Well analog voltages are typically higher than that, but they still need to be interfaced with digital systems. The solution is a separate integrated circuit that will handle the measurement of analog voltages and signals and then interface with the lower voltage digital system to relay that information. Overvoltage tolerant Up to ±50 V absolute maximum What they mean by overvoltage tolerant is basically if your signal somehow jumps up to a higher voltage, the ADC shouldn't be damaged past the point of no return, but that doesn't mean it can't still get damaged. Its just that they are willing to sign off that the device should still respond to commands and requests should any voltage up to ±50V occur. Up to ±16.5 V not affecting adjacent channel If your input signal goes up/down to ±16.5V, it won't affect the readings that take place on the adjacent channel. If it goes beyond that though, your readings on the other channels will start to be less accurate. Does AD7732 provide for me directly reading analog input in the range of ±12 or only ±10? The device is only marked as reading between ±10V but that doesn't mean that it can't do better than that. This value is just what the company feels comfortable marketing as. Although the value isn't to be taken lightly. If the fabricator says the chip can only handle ±10v, only use it in that situation or bad things can happen. After doing some digging, turns out, looking at page 27, you will achieve up to ±11.6V readings without more rapidly degrading your ADCs performance. Once you go over the ±10V range, the OVR bit in the channel status register will be set and your data value will be clipped to the lower 16 bits. Take a look at Table 16 and 17 on that page and it should be pretty clear. With all of that said, I wouldn't recommend using this IC for your application. Even though the chip won't explode at much larger voltages, it simply wasn't designed to accurately measure up those voltages.
H: Using FreeRTOS in Atmel Studio 6.2 I have been trying to create an atmel project that uses FreeRTOS on an ATmega328 but I cannot seem to get it to work. I have read several article on how to do this, especially this and this one (which is in french but google translate should do the trick). Basically, what I did was to: Download the FreeRTOS source code Create a new Atmel Studio (C executable) targeting the atmega328 Add the FreeRTOS source code to the project (respecting the folder structure as suggested in the tutorials) Then compile it. However, I get this error "FreeRTOS.h: No such file or directory" I have made sure to add all the source file in my compiler's directories (again as suggested by the tutorials) but I always get the same nasty error. Heck, I have even downloaded the attached templates (from the tutorial sites) but I get the same compile error. Does anyone knows how to solve this? PS- I am using Atmel studio 6.2 sp2 on windows 8. My compile is the default avr gcc. My directory list looks like this My defined symbols looks like as follows The completed Atmel Studio 6.2 solution is shared to google drive if someone would like to take a look at it Google drive link of the complete solution AI: This usually happens if you omit this step from the instructions: And in Directories you will need to include all directories containing .h files in your project(I only managed to get working only with absolute paths). Add GCC_MEGA_AVR in Defined Symbols to tell core that we are going to use GCC for AVR microcontroller. If you think you did that, show us a screenshot of your Directories Settings.
H: 18v AC output from 20-24V AC input I have an electric gate opener that takes a 15-18v AC input. Around 100m from the gate I have a 240v outdoor circuit that I'd like to use to power the gate and some garden lighting. I can't find any specifications on exactly what current the gate will draw, however the readily available transformer for it is rated at 16v, 3.75A. It's only supposed to be located approx 20m from the gate though and I'm concerned that even with expensive 6mm cable, the voltage drop will be too great using this transformer. Overseas they use an 18v transformer and locate it up to 100m from the gate, however I'm struggling to find a suitable one in Australia. There are, however, plenty of outdoor rated (IP67) 24v AC transformers. So I'm wondering is there any relatively cheap and reliable way to take this 24V AC which, when the gate and lights are operating, might drop to as low as 20V AC at the end of the cable run and get a voltage that stays in the 15-18V AC range from it to power the gate? AI: A suitable transformer should be available online for shipping to you. What you propose is a bit risky as under light load the voltage may rise higher than you hope. However depending on the gate circuitry it may be tolerant of 24V at some increase in operating speed and decrease in motor and/or gearbox lifetime. Gate circuitry might possibly accept DC in which case you can add in a diode bridge, smoothing capacitor and a regulator to your transformer to get the ideal voltage. An alternative might be to find a suitable size (bigger than what you think you need) transformer with multiple taps and use it as an autotransformer to adjust your voltage to suit. You can use taps designed for higher voltages as long as the current rating is adequate. Say 48V and 36V taps would work to bring 24V to 18V as well.
H: Learning the principles of op-amps - Why are there so many? I started learning the theory of opamps, I want to try to do a small circuit, but the problem is that there are so many. Is there something special about each opamp, or it just the brand? Do they work differently? AI: There are so many different amplifiers because there are so many different applications, each requiring different attributes. A perfect voltage amplifier, for example, has infinite input impedance and zero output impedance. Neither of these exist in a real amplifier, of course, but there are devices with Gigohms of input resistance (look for a JFET input stage device, for example). A perfect differential amplifier (within which opamps exist) has zero offset between the inputs, but once more, no such device exists. This Vos term is always stated in datasheets. In a high gain situation this input offset appears as an output offset voltage given by Vos * gain. Where tiny signals must be amplified (as in a strain gauge for instance - there are numerous applications here) we would use what is known as an Instrumentation Amplifier which is a device optimised for high gain, low offsets and high CMRR amongst other things. Perhaps you are in a battery operated system and need a low quiescent power amplifier. The trade-off here is usually Gain Bandwidth Product although advances are still being made in this area (as it is in all areas, but with the Internet of things appearing, this is becoming a key driver). Perhaps you need a really fast Video Amplifier for clean amplification of video signals. There are High Speed amplifiers, optimised for GBW. Then there are Zero Drift amplifiers. By now, you may be getting the idea that so many different types of device exist for the very good reason that each type has been optimised for a particular task: which one I choose depends on the specific requirements of the application. I have barely scratched the surface here, but I suggest looking through the tables for these devices at Linear Technology, Analog Devices and Texas Instruments for starters. Maxim Integrated also has an excellent series of tutorials ans application notes. All these manufacturers have excellent tutorials and application guides that are a wonderful resource for anyone wishing to learn about these devices. As noted by Adam Haun, there are amplifiers that are designed to have a minimum gain well above unity; the advantage here is better transient response as the Dominant Pole (scroll down in page) can be at a higher frequency, maintaining more bandwidth at lower frequencies. These devices are not unity-gain stable, and therefore may not be used at lower gains. Edit. Added current feedback amp: Thanks for the reminder, LvW A typical current feedback amplifier has incredible slew rate. This one is listed at 1600V/us which while available in many devices, is still truly astounding in an 'ordinary' amplifier. Although these devices can be a little more difficult to understand at first, they have significant advantages when used appropriately. Read this application note for a good example. Another update As can be seen from the comments, amplifiers come in many different flavours, such as differing output drive current, rail to rail outputs (many can only go to within 1.5V of the power rails), rail to rail inputs (usually requires a dual input stage which can have its own very peculiar effects), yet others optimised for high side sensing (the common mode range can exceed the power rail) to name but some possibilities. There are others designed for ADC interfacing that can have an external common mode reference so that the output is always centred in the middle of the ADC range, truly fully differential devices and more. The range of amplifiers available is truly enormous. What was a 'general purpose' amplifier 20 years ago is now 'low end' although as noted many older amplifiers are still available, for a number of reasons. The key to choosing an amplifier is deciding which features of the perfect op-amp you need to most closely get. One way to become familiar with amplifiers without actually making the circuit (at first) is to use a simulator. There are a number of these around, such as LTSpice and there is a free version of Simetrix (node limited) amongst others. When using simulators, you will need to understand the limitations of the models used. There is an excellent application note at Linear Technology that shows what the models really contain (and it is not the actual circuit in the amplifier). HTH
H: What kinds of capacitors are they? Does anyone knows what kinds of capacitors are they? I searched everywhere, but I couldn't find anything. Why there are these three "strings" on the top? Why the capacitor value is not reported on the side as a "standard" capacitor? AI: As I mentioned in the comment box " I hope they are inductors not capacitor, Even on the PC board Ref des is mentioned as L018 and L019 which represents an Inductor" The specific name for these inductors are Wide Band Chokes and bead some of them can be find Here Below are the PIC for these kind of inductors Datasheet for the above part can be find Here
H: What do you call servo connectors? What do you call the outlets/plugs/connectors that you plug servos into on a board? These things circled in the photo... I'm trying to purchase these and have no idea how to find them. AI: These are known as "HEADERS & RECEPTACLES" TE calls it as a AMPMODU MTE series. can be found below at Digikey 3- Pin :- Header:- 5-147278-2 Plug:-5-103960-2 4- Pin :- Header:- 5-147278-3 Plug:- 5-103970-3 If you need the header with more pin, just play with the last digit of the above header part numbers for example if you need 5 Pin header connector change the last digit of 4- Pin of header part number from 5-147278-3 to 5-147278-4
H: length matching impact in ADC chips I am using the ADC4245-EP (enhanced product) adc chip. It has a normal version as well of it.There are 2 options of interfacing thiis ADC to an FPGA. They are CMOS or LVDS. The advantage of the LVDS being a better immunity to noise. Now, the idea of LVDS is that we have signals that are complementary and hence the noise immunity is enhanced. But, suppose I go for a simple CMOS voltage level, I must make some provisions for noise immunity. The 1st thing that I will do is designing the bus with length matched tracks. This will help make the signals arrive at the FPGA at the same time (more or less) and hence make the design robust. Is there any other aspects that I need to take into consideration when doing this layout ? Suppose if the tracks are not length matched, what is the impact ? How is the signal delayed or the extent of delay with increase in length (say even a few mils) . Can anyone direct me to any application note for such designs please ? AI: From your previous question, you are using a sampling rate of 125 MSps i.e. data is presented at the output every 8 ns. If the data were oscillating between 1 and 0 it represents a square wave of frequency of 62.5 MHz. For a reasonable rule of thumb I'd be interested in making sure that the 7th harmonic of that square wave (437.5 MHz) were passed to the FPGA reasonably unadulterated. This means that the total track length should be no more than (here comes another rule of thumb) one-tenth the wavelength of 437.5 MHz. Wavelength of 437.5 MHz is 0.685m so max track length (without needing terminations) is about 70mm. Now to your real question; can you see from the above rule of thumbs that providing you clock the data into the FPGA at somewhere near the middle of each symbol you are going to get a decent result. This means that track length variations of up to a few millimetres are not going to affect things very much at all. Clearly you do your best to equalize lengths but to no-better than (say) 5mm. If you are using a much higher data rate then do the calculations based on above.
H: Why can the effective number of bits be a non-integer? What does this physically represent? The effective number of bits (ENOB) describes the "real" resolution of an ADC. I paid no attention to it when I was first taking the class but now when I think about it I cant really make sense of it that the result can be something like 6.8 bits. I can't really make sense of what 6.8 bits physically represent. I would appreciate it if someone could expain why the ENOB isn't rounded down. For instance why isn't ENOB = 6.8 = 6 bits? How would you interpret a rational ENOB in a real scnerio? AI: It is a result of calculating the number of bits after the imperfections such as noise and distortion are taken into account. An ENOB of 6.8 basically tells you that for example an 8-bit ADC has real world performance that is better than an ideal 6-bit ADC but worse than an ideal 7-bit ADC. You can also think of it as not having 2^6=64 or 2^7=128 discrete steps in the signal like on ideal 6 or 7 bit ADC, but 2^6.8 or about 111 discrete steps.
H: How can I be sure my replacement SPI flash chip will work? I am currently using the Cypress CX3 MIPI-USB bridge chip which needs an attached SPI FLASH chip. The datasheet recommends the W25Q32FW part, which is now obsolete. I would like to choose a replacement device e.g. AT25SL321, but it must obviously be compatible. What features of the SPI chips must be checked to ensure the replacement is compatible? Is it enough to go through the SPI protocol waveforms and check they all match, or is there anything in the layout of the memory which might be a gotcha? Or are they generally all compatible, and this is nothing to worry about? AI: You could compare the datasheets. Or limit to checking the parameters the chip actually needs. Fortunately Cypress has published a knowledge base article KBA221833 which instructs how to select a compatible SPI flash. So if used voltage, clock speed and used commands match, the size just needs to be withing some limits to have the right amount of address bytes in the protocol.
H: STM32 Input Pin not working i try to implement an input which is reacting on an high impedance 3.3V on PC14. My Configuration looks like this. main.h #define I_Pin GPIO_PIN_14 #define I_GPIO_Port GPIOC #define O_LED_Pin GPIO_PIN_5 #define O_LED_GPIO_Port GPIOA static void MX_GPIO_Init(void) { GPIO_InitTypeDef GPIO_InitStruct = {0}; /* GPIO Ports Clock Enable */ __HAL_RCC_GPIOA_CLK_ENABLE(); __HAL_RCC_GPIOB_CLK_ENABLE(); __HAL_RCC_GPIOC_CLK_ENABLE(); /*Configure GPIO pins : O_LED_Pin O_state_Pin */ GPIO_InitStruct.Pin = O_LED_Pin|O_state_Pin; GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); /*Configure GPIO pin : I_Pin */ GPIO_InitStruct.Pin = I_Pin; GPIO_InitStruct.Mode = GPIO_MODE_INPUT; GPIO_InitStruct.Pull = GPIO_PULLDOWN; HAL_GPIO_Init(I_GPIO_Port, &GPIO_InitStruct); } And in my main function i try to read the input like this. if(HAL_GPIO_ReadPin(I_GPIO_Port, I_Pin)== GPIO_PIN_SET) { HAL_GPIO_WritePin(O_LED_GPIO_Port,O_LED_Pin, GPIO_PIN_SET); } Then i connect the PIN PC14 to the 3.3V of my Nucleo board but nothing happens. But it should detect the Pin as set and enter the if statement... Anyone knows what to do? AI: PC14 of the connector is not by default connected to the MCU. By default the MCU pin PC14 is used as the LSE oscillator pins and connected to the 32768Hz tuning fork crystal. There is a solder bridge SB49 to configure the connection, it is left open at the factory.
H: Why is silicon used as PCBs? I know why silicon is used for ICs and transistors in general due to its doping features. But I don't know why we use silicon as a PCBs, all we need is to isolate pins from each other in a PCB, right? So, will any insulating material work? Such as wood? AI: PCB's are NOT made of silicon! PCBs are made from coated paper (coated to make it somewhat fire resistant), this is the cheap option. Better PCBs are made from epoxy coated fiberglass, a common material is FR4. Reasons not to use silicon for PCBs: Silicon is only a good isolator when it is very pure (no contaminants). For making semiconductors extremely pure Silicon manufactured. This is expensive to make but not much of it is needed per transistor / IC so the total material cost per device is quite low. Silicon is very brittle it is simply unsuitable to make a strong PCB that can withstand some mechanical force. Reasons not to use wood for PCBs: Wood is flammable Wood is not strong when it is thin. Wood can bend over time due to aging and moisture. Coated paper and FR4 do not have the disadvantages mentioned above. Also, it is easy to coat them with copper to make the connections. It is easy to drill holes in the material. These materials are cheap.
H: TL494 duty cycle adjustment I'm building a simple pulse generator with a TL494 in single ended configuration. My plan is to set the frequency between 20Hz to 1kHz and duty cycle between 0% to 45%. I will adjust that with a potentiometer. How can I adjust the duty cycle? I've tried by adjusting PWM input, comparator or dtc. I test it with frequency below 100Hz and an LED at the output. I can see the blinking LED as a result, but I can't get a duty cycle between 0% to 45%. I just get about 0% to 100% and random duty cycle. Please help me or show a circuit. Edit: Heres's the schematics I've tried: At first (err amp sett) and second (comp sett), I got unstable up to 50% duty cycle. With last schematic (dtc sett), I got a stable duty cycle, but it give zero to 100 percent not 50 percent, and also the LED stops blinking or stays on at left or right edge of pot. I also try to replace the IC, but still same. When I replace it with a KA7500, I got the expected result. Sorry for my poor hand drawn schematic, I'm far from my home and computer at this moment. AI: When in doubt, resort to the datasheet, specifically page 8: As you can see, they tied all the inputs of the error amplifiers to ground, and then used the DTC and the FEEDBACK pins for testing, which is shown below, in the datasheet, as waveforms. However, as mentioned in the comments, it's a rather convoluted way of getting a PWM, unless you already had the chip at hand (or want to go further with the design) -- otherwise the classic comparator with ramp input would make a better choice.
H: Measuring voltage with dynamic voltage divider and Arduino with ADS1115 Is a “dynamic voltage divider” even a thing? I am using an ADC ADS1115 to measure voltage on batteries. Now these batteries are sometimes 12 volts, 24 volts or a bank of 48 volts or even 72 volts. To get 5 volts at the output of a voltage divider with 72 volts input, I need R1 to be 20 kΩ and R2 to be 1.5 kΩ. Like this I can have 0 to 72 volts measured. However if now the input voltage is 12 volts… using the same voltage divider, I get 0.833 volts output and with 24 volts battery input, I get 1.667 volts output. Is there a way I can measure these voltages without doing any hardware or source code modification and re-upload to code to Arduino? AI: Additional hardware is needed to MUX ANALOG switches to a string of REsistors to selected sources for choosing an output with the necessary protection for OVP and ESD. One additional input must be higher R to detect all inputs scaled low to determine which one to select with Reed Relays. So the other way is to scale down all inputs to 5V max and then amplify all inputs too low back to 3V then scan all the sources to see which has overvoltage (5V max) then choose the next lower one. There may be a smarter way. But this is more than the Arduino can do on its own without a fancy MUX shield. (IDK) I did this in the late '70's for a rocket payload full of different batteries using a Rack of cards on a remote computer to two umbilical. I did this using mercury wetted relays bundled on a card and after configuration scanned 96 every second.
H: Autodesk EAGLE Routing of STM32WLE with tiny UFBGA73 package I would like to do the routing of the stm32wle5jbi6 chip that comes in a tiny UFBGA73 package. Please see the datasheet here: https://www.mouser.de/datasheet/2/389/dm00648230-1799409.pdf The dimensions are provided on p128 and p129. I'd like to send the PCB for manufacturing to pcbway.com and they have a minimum trace width and spacing of 4mil: https://www.pcbway.com/capabilities.html But they recommend 6mil for both trace width and spacing. Looking at my board file: I see that the size of the solder mask (tstop layer) might be the problem. I cannot do any routing in the chip. What do you think about just reducing the size of the soldermask, what is the minimum distance it should have to the cream layer? Can I eventually not use it at all? EDIT: Please see more details on the dimensions (in mm) here: Thank you! AI: Not being able to use a package due to manufacturing constraints is a real and frequent thing. Solder mask expansion has a real role to play - it gives tolerance against offsets in manufacturing: So obviously you don't wan to shrink the opening too much... This is really something that's driven both by the device datasheet (less) AND manufacturer requirements (more). PcbWay has a blog post which seems relevant and they tell you that you can go down to 50 microns of expansion. Also note that ST says 330 microns typical, depends on solder mask registration tolerance, by which they mean to stick with what your manufacturer can deal with:
H: LDO - DC Accuracy Error Calculation (Datasheet vs Theoretical question) I'm looking at calculating the DC Accuracy of a couple LDOs and came across some good resources - but I'm having trouble linking their example calculations to the "real world." [TI LDO] https://www.ti.com/lit/an/slva072/slva072.pdf [Analog LDO] https://www.analog.com/en/analog-dialogue/articles/understand-ldo-concepts.html The example (interestingly, the exact same example in both articles) uses the parameters: 3.3V LDO over 0 to 125C temperature span ±100 ppm/°C resistor temperature coefficient ±0.25% sampling resistor tolerance ±10 mV output voltage change due to load regulation ±5 mV output voltage change due to line regulation 1% reference accuracy I get that the sampling resistor parameters come right from the resistor datasheet. The Line/Load regulation errors (I imagine) come from my system? If I'm supplying voltage with a USB port it would be the variation in the USB port voltage supplied, and if my load is a couple LEDs the amount of voltage variation over those LEDs? The reference accuracy - I figured that comes from the LDO datasheet, but I'm not sure exactly which parameter it refers to. Is it just the "Fixed Output Voltage Accuracy" or is there another parameter I haven't connected? [ADM7172] https://www.analog.com/media/en/technical-documentation/data-sheets/ADM7172.pdf Thanks so much for any guidance, and/or additional resources. AI: The Line/Load regulation errors (I imagine) come from my system? The line and load variations come from your system. The errors come from how the power supply responds to them. The reference accuracy - I figured that comes from the LDO datasheet, but I'm not sure exactly which parameter it refers to. Is it just the "Fixed Output Voltage Accuracy" Yes. At least that's the best stand-in you have in this case. The app note was probably originally written for an adjustable regulator, and someone didn't go back and edit it, or they just figured you're just supposed to know. There's going to be details different in every chip, but you can take the action of a fixed-output regulator as having an internal voltage divider down to whatever the chip's reference voltage is -- pretty much exactly like you'd do with an adjustable regulator outside the chip, only pulled inside. At any rate, "Fixed Output Voltage Accuracy" rolls up the reference inaccuracy and any inaccuracies in the internal divider (or other mechanism for changing the feedback/reference relationship) into that one number.
H: Eeschema, least painful way of changing pin order per symbol instance I'm considering using Eeschema to create block diagrams. More or less just lots of abstract rectangles with ins and outs, interconnected. It will look like xcos/Simulink. For better readability, I'd like to be able to disentangle the wiring by adjusting symbol's order of pins ad hoc. Strictly speaking, symbol instance's order of pins. Example: swapping spontaneously VDD and GP3 of U6 on the snippet below, and maybe pushing GP5 up and GP4 down, but only of U6 and not all PIC_8_PINS; connected wires should remain connected (I'll have to move them around for a better appearance, of course). Question: Cloning a symbol for every variant of appearance sounds like a hassle. Does anybody know a better way? I'm currently using MS Visio where I can freely move pins around, but I want "something electrical" with nets and buses and smart highlighting instead of, well, just lines. This is a specific question about eeschema, though, thus here and not on softwarerecs. AI: In KiCad version 5, cloning each symbol that you want to modify is the only way to go. Otherwise, changing a library symbol will change all instances of that symbol on your schematic. This is changed in KiCad version 6 (not released yet, currently nightly beta builds are available as v5.99). You can modify each instance of your symbol independently. You might want to try out KiCad version 6 to see if it works for your needs.
H: How does the 4th satellite in GPS know the time offset? Going through the working of GPS technology, I came to know that at least 4 satellites must be visible to solve for the location with considerable accuracy. Going through most of the resources, I can visualize how three coordinates of the location are determined. But there is an error in this calculated location due to the timing offset. So this calculation is invalid. In order to make the calculation valid, the timing offset must be considered. And this is the propose of the 4th satellite. How exactly does the 4th satellite know the timing offset? If we talk about the differential GPS, the actual base station's location is compared against the GPS determined location and the timing offset is calculated and transmitted to the receiver within certain coverage area. But if we talk about direct communication between the satellite and my mobile phone, the actual position is to be determined unlike the base station where it is already known. Hoping for a clear and more visual answer (rather than mathematical) from this community as always. Thank you!! AI: The satellite doesn't know your timing offset. GPS is a one-way street: the satellites basically only transmit their own time. Your receiver needs to do the rest, as the satellites can't know you even exist. So, you really need to re-visit what you've learned about GPS so far! Regarding the timing offset estimation: Don't consider the timing as a separate thing from the position. Instead, consider the 3 dimensions of your location and the time as one estimation problem with 4 unknowns. All you get from your satellites is the time it was when they transmitted a signal. Your receiver hence only sees a time difference of arrival between these four. Only after solving the equations that gives all four unknowns by inserting all four time differences can you answer any of the questions of "how far North am I? How far west am I? How high am I? What is the time?", and you can answer all of them. So, it's either "all" or "none", not "location separately from time".
H: Identify polarity of 1970's-era dipped tantalum capacitor Having found the shorted component, now I need to replace it. I'm familiar with dipped tantalum capacitors with painted stripes along one side but these have a dot or stripe up the middle and my Web search didn't help much. I've identified the part as 10uF 25V but I can't figure out which leg should be positive AI: According to this website: https://www.westfloridacomponents.com/RT001/1uF+35V+Radial+Dipped+Tantalum+Dip+Capacitor+Color+Coded.html The polarity is indicated by a dot. Positive lead is the lead on the right when the side with the dot is facing you.
H: Voltage and current sensing hardware on chip I have an external R C circuit excited by a step voltage source ( to be present inside a chip) to find the values of components R and C through transient analysis. Since we need to know voltage and current across the network to achieve this purpose, I am wondering how can we design a hardware using MOSFET and other passive components (may be through a differential or instrumentation amplifier), which will be present inside the same integrated chip, to measure voltage and current across the network at different instants of time. Is this done before to have the voltage and current measuring hardware in an integrated circuit? Any help would be appreciated. Thanks! AI: I would use a Howland current source with all R vale’s scaled up for safe current limiting such that the Op Amp saturates and its output reflects your impedance ratio. Inputs for Vref and ground may be swapped for single supply if you wish.
H: magnetic rotary encoder 0.3V output voltage I have a 24V DC motor with a magnetic rotary encoder. The encoder has a 5V supply voltage. The datasheet states that it has an output voltage of 300-700mV. I have also measured it, and it gives around 0.5V. I want to interface this encoder with an STM32 microcontroller, so I want to convert it (reliably) to 3.3V. But I don't really know how. Since the datasheet states a 300mV minimum voltage, I want to build a circuit, that "turns on" at 0.25V, it is "off" below and "on" above, and gives me a clean square signal. My first though was a transistor operated as a switch, but 0.3V is not enough for a BJT transistor's operation. Then I was thinking about a MOSFET circuit like this one, with an N-channel enhancement MOSFET: But I have no experience with such circuits. Could this work with just 0.25V threshold? Or do I have to amplify it? What MOSFET and resistor values do I choose? Or what other solution would be better in this situation? Thanks for the answers! Datasheet: https://www.power-tronic.com/wp-content/uploads/2019/11/Type-Magnetic-Incremental-2019-01-08.pdf MCU: STM32F101R8T6 (GPIO PC8, PC9) AI: You need to add what's called a pull-up resistor to the encoder's output pin [from OP's data sheet]: The pull-up resistor should go to the processor's +3.6V Vdd. Your processor may have GPIO pins that are 5V-tolerant. If so, you can pull-up to +5v DC. What value? The transistor pulls down to GND, but the spec is ambiguous...suggesting that when the transistor is ON (pulling 20 mA current down to GND), you'll have 0.3V -to- 0.7V at the output pin. If you use a large-value pull-up resistor to the processor's 3.3V Vdd, this "low" voltage will likely be closer to GND than 0.3V. You might try a 10k pull-up resistor to start. With such a large value, when the motor turns quickly, pulses may disappear because switching time is too slow. If so, try a smaller value pull-up resistor.
H: Question about powering ADC to LED board My bench power supply died today & I thought I'd salvage the LED displays. Turns out they are on a board which has 2 x ICL7107 3 1/2 digit A/D converters. The datasheet says that the max supply V +6v but also mentions -9V. Does this mean the chips need a dual supply? I noticed that the board has a L7805CV positive voltage regulator which according to the data sheet gives a 5V output. Prior to this there is a 2w10 bridge rectifier. So my assumption here is that I can power this from a +5V supply if take out the regulator & the bridge? AI: Page 9: the PDF is a scanned image here's a paste of a screenshot as I can't copy text: so to run off a single supply you can use figure 18: I'm guessing they're done something like that, perhaps using a resistor only reference as I don't see any diodes on that board.
H: battery low voltage cut off breaker (manually reset) First off, I am aware that premade devices like this exist however I have been unable to find any that fit my exact needs which are as follows. 0 power draw when in the off state Minimal voltage drop when in the on state Being able to set it to trigger at 10.5V Simple design Manually reset When I attempted to design a circuit to fit those needs myself I came up with the following. (R1 just represents the load) The idea is that when I connect a battery with a voltage above 10.5V and S1 is pushed to jump start the circuit the normally open relay will then start keeping it's self closed. I would then have R2 tuned so that it had just enough resistance so that when the voltage on the main circuit dropped to 10.5V the voltage to the relay coil would become too low to keep the contacts closed. The contacts would then come open and cut power to the whole circuit. In theory this is a nice simple elegant solution to the problem for a layman like me. The issue that I'm running into is that there isn't an "exact" voltage where a relay shuts off so it would be nearly impossible to get it to shut off when the main circuit is at exactly 10.5V. I can't use a transistor or similar device because even a small voltage drop on a 12V nominal circuit like this makes a huge difference. I need 10.5V reaching the end device when the battery is at 10.5V. I am hoping to keep this circuit as simple as possible so that I can have it packed up nicely as a single rugged unit. Currently the only application I have for it draws a constant 5 amps but I would like to be able to modify the circuit to accommodate larger loads if needed in the future so an electromechanical component seems ideal for switching the main circuit. My question is, is there a component or simple circuit that I could put in the place of R2 that would only allow voltages over 10.5V through and completely cut off below that? If I can just get that relatively low amperage (under 200mA) circuit to completely cut off at a designated voltage then I can switch the main circuit with whatever relay or contactor I want with minimal modification. AI: You identified the problem very precisely: a relay hardly has a specific "turn-off voltage". Your idea with the transistor is great: You can build circuits with a very precisely defined voltage-dependent behaviour from semiconductor components like that. Things get even better: one of the very big downsides of your relay approach is that keeping the relay closed will inevitably consume quite a bit of current (to keep the coil energized), which will drain your battery (and hence work against the purpose of the battery). A MOSFET (Metal-Oxide-Semiconductor Field-Effect Transistor) is cool in that it changes the resistance of its junction (the connection between the contacts called "drain" and "source") purely based on the voltage applied to its gate contact – and potentially, quite drastically so! Even a single P-channel MOSFET in place where your relay's switch used to be, together with a voltage divider made from very large resistor values (to avoid draining the battery) could solve this. Better, yet, there's voltage reference-comparators like TL431LI that are meant for exactly these kinds of things, switching a transistor at exactly the right input voltage on or off. I'd frankly look up "high-side switch MOSFET" circuits, and marry one to a "TL431 undervoltage" detector. However, the solution gets even easier: there's undervoltage protection circuits against over-discharging batteries. Sounds like exactly the job you have. Look up TI's BQ296100 and chips in the same category if this spikes your interest.
H: H bridge working with led but not with electric motor Noob here. I am trying to make a car which i can control remotely from the internet (ie. lan). I have a H-bridge circuit which has all NPN transistors (bc 547B and datasheet here: https://www.farnell.com/datasheets/410427.pdf). Here is the schematic for my circuit: https://content.instructables.com/ORIG/FDG/I6CS/HXVI3O2P/FDGI6CSHXVI3O2P.jpg?auto=webp&frame=1&fit=bounds (original tutorial here: https://www.instructables.com/BUILD-YOUR-OWN-H-BRIDGE-CIRCUIT-USING-NPN-TRANSIST/) except replace the tip transistors with the one i mentioned and for the resistor i used 1k ohm resistors and also i wasn't able to get the transistors working with a shared supply thiny (i had to put a resistor before each transistor because for some whatever reason it won't work if i share the base voltage from one resistor which may hint at what i am doing wrong). The circuit works as expected with 15 volt input voltage for the led (9v battery and 4 x 1.5 AA battery pack in series), but when i connect the electric motor, the motor wont spin. (the motor is this: http://www.mootio-components.com/motor-current-dc-voltage-150v-rpm-9000rpm-fa-130-ra-2270_refe_003836-1.5.html) Thanks in advance for the help! AI: Oh man, everything is wrong. Sorry. The Transistors The TIP122 is an old-school, power, Darlington transistor. The power part means it won't fry trying to conduct the current the motor "wants" (it's rated up to one amp, your BC547 parts are rated at 0.1A continuously). The Darlington part means that it doesn't take much base current -- and you need that if you're going to drive the thing from a microcontroller. The Schematic If you look at the picture, it's easy to count three base resistors, and there's another one hiding behind the left transistor in the foreground. With the two resistors shown in the schematic, the transistor connected to ground "shorts out" the signal to the transistor connected to power -- so your upper transistor will never come on, or will only come on weakly. The Supply Voltage The motor is designed for 1.5V, so there's no point in using a voltage that's much greater than 1.5V plus the drop in your circuit. If you modify your circuit to match what's pictured, the high-side transistors will act as emitter-followers, and will run at your microcontroller's output voltage minus their base-emitter drop. For the TIP122 that's 1.5V (because they're Darlingtons). For a "plain old" silicon NPN that's more like 0.7V -- except such transistors need more base drive for the same collector (and emitter) current; you don't have that much drive available. So -- find yourself some Darlington transistors that are capable of driving 1A collector current, use about 5V for VCC, use this schematic, and you should at least be able to turn the motor. simulate this circuit – Schematic created using CircuitLab
H: MOSFET as a switch failed after 200k cycles - root cause? The following is a schematic for a solenoid that failed after ~200k cycles. I found that the MOSFET drain to source failed short. I am getting~ 26 ohms resistance. The way this circuit works is as follow: SW1 is a microswitch that gets cycled mechanically (one cycle is when the switch moves from NC to NO then to NC) when that happens, the solenoid turns off after ~45 ms delay it then turns on again. I have removed the dead MOSFET and simulated a ground removal (MOSFET turning off). The scope screen shot is captured below. You could see a very fast pulse of almost 84 V with a 54 ns rise time. The MOSFET drain-source max rating is 100 V. What could have caused the MOSFET failure specially after so many cycles and how I could make this circuit more robust? Mosfet datasheet link: https://www.diodes.com/assets/Datasheets/DMT10H009LK3.pdf Looking forward to your feedback. Thank you in advance. TVS1 Datasheet TVS2 Datasheet link: Updating the MOSFET Turn off time scope shot It takes about 7ms to turn off the mosfet. SOA The Solenoid initial draw is ~ 1.5A AI: What I think killed the MOSFET: slow on/off switching resulting in too much power dissipation in the MOSFET, you're using it outside the MOSFET's SOA region. Learn about SOA here. voltage spikes because you used a TVS (in parallel with the solenoid), I would recommend using a Schottky diode instead. I agree that maybe a TVS is good enough, however, it is uncommon to use a TVS in this situation. I would go for the tried-and-tested fast Schottky diode. I'd select one that can handle at least 2 A of forward current and at least 50 V reverse voltage. To solve 1) I would try this: simulate this circuit – Schematic created using CircuitLab I added another N-channel MOSFET (I suggest a 2N7000 or similar) to act as a "poor man's comparator" to switch the large MOSFET on/off quickly. R1, R2 and C1 with the switch form a delay circuit. It's "upside down" from what you had since I added M2, M1 is on when M2 is off so I flipped delay part. Tweak the values of R1, R2 and C1 to suit your needs. If you're familiar with a circuit simulator, simulate this thing! Oops, I forgot that the 2N7000 has a Vgs,max of 20 V so I added R5 to limit the M2's Vgs to 14 V. To fix 2) speaks for itself :-)
H: Simulating Photodiode sensor in LTspice I am designing a current source that is going to control LED. With help of the DAC and microcontroller, I generate a voltage that goes to OP-amplifier, and afterward, I am opening my NMOS transistor. I have attached my schematic of the simulation below. I want to add a photodiode power sensor for the better accuracy of my circuit. Now my question is how could I simulate the photodiode relating to the luminosity power that my LED is emitting. Is it possible that I could connect these two in LTspice? I am new at LTspice and I would need it for my university project. I thought I could use an arbitrary behavior current source, using it as I would simulate temperature. My photodiode power sensor is S130C from Thorlabs. I would be thankful for any advice on how could I realize my problem. Thanks Current source schematic and LDO Response graph of my photodiode power sensor AI: Now my question is how could I simulate the photodiode relating to the luminosity power that my LED is emitting. Is it possible that I could connect these two in LTspice? You can use nodes to carry information other than voltage or current, but LT spice still thinks that they are voltage or current. The way to do this is with b-sources which can handle different functions. Source (modified by me): https://datasheet.octopart.com/NSCW100-Nichia-datasheet-22171761.pdf First model the diode (a first order polynomial fit with 35, if you want to get more accurate digitize the graph and fit it with a second order poly) You can then use the luminosity with another model to model the photodiode, you would need to use V(LUM) in the second bsource for the photodiode. I would finish this but those equations would take a bit of solving and a lot of time. (and actually there is a bunch of luminosity to responsitvity equations that involve radiometry, so you need to know the distance between the sensors, and how much power is moving from source to detector which is the subject of chapters in books) But that being said if you can come up with a function for the photodiode, you can use the signal from V(LUM) in the photodiode equation with a b source to come up with the photodiode voltage.
H: Exciting an RC Circuit at its TRUE Pole on the Sigma (Real) Axis in the Left-Half Plane Yeah, you probably are reading this question and thinking I'm one of those engineers who hasn't learned about the s-plane. I can assure you I'm not! I know that the transfer function of an RC circuit (Vout/Vin) has a REAL pole, with no imaginary component at s= -1/RC + j0. I am curious what happens when we excite an RC circuit at its TRUE pole, which is a decaying exponential with the expression e^(-t/RC). Of course, the output of an RC Low-pass filter will never blow up to infinity. But what about the ratio of the output to the input, which after all, is the transfer function I originally defined? Well, let's take this to LTSpice. Below is what I've simulated: I would expect Vout/Vin to be infinity everywhere, however what I see is a ramp. I suspect I'm missing something about how to properly interpret the magnitude response of my transfer function with its true pole as an input. A time-domain view such as what I have should explain something, but I can't understand why it's a ramp. If anyone has any intuition behind this question, please let me know. AI: Good question, here's my attempt. You still have to convert your input signal from the time domain to s domain, then do the math, then convert the result back to the time domain. That pole just tells you where the resonance is, the behavior of the resonance is usually "growing infinitely forever" - but the exact behavior needs to be found from doing the math. Using transforms from: https://en.wikipedia.org/wiki/Laplace_transform $$ \frac{1}{1+sRC}V_i(s)=V_o(s)\\ V_i(t) = V_{i0}e^{-t/(RC)}=V_{i0}e^{-t/\tau}\\ V_i(s) = \frac{V_{i0}}{1/\tau+s}\\ V_o(s) = \frac{1/\tau}{1/\tau+s}\frac{V_{i0}}{1/\tau+s}\\ V_o(s) = \frac{ V_{i0}/\tau}{(1/\tau+s)^2}\\ V_o(t) = (V_{i0}/\tau)\times t e^{-t/\tau} $$ Which gives us: $$ V_o(t)/V_i(t) = \frac{(V_{i0}/\tau)\times t e^{-t/\tau}}{V_{i0}e^{-t/\tau}}\\ V_o(t)/V_i(t) = t\times 1/\tau $$ Predicting that, in the time domain, the ratio of output to input voltage increases linearly with t. In the s-domain, the ratio is infinity. EDIT: This actually perfectly matches your result, even the correct slope - except there is an offset of 1 unit on the y axis. My guess is that the simulation found the DC point using \$V_{i}=1 \text{ V}\$ at \$t<0\$, so changes the math. The above assumes \$V_{i}=0 \text{ V}\$ at \$t<0\$. So it's pretty much the same, just a little difference because of the initial condition. If the initial condition was V=1, you can use the superposition principle and add the solution we found (for V=0 until t=0, then decaying) to the solution if V=1 when t was negative and V=0 when t is positive $$ V_o(t) = (V_{i0}/\tau)\times t e^{-t/\tau}+V_{i0}e^{-t/\tau}\\ V_o(t)/V_i(t) = \frac{(V_{i0}/\tau)\times t e^{-t/\tau}+V_{i0}e^{-t/\tau}}{V_{i0}e^{-t/\tau}}\\ V_o(t)/V_i(t) = t\times 1/\tau+1 $$ Now it exactly matches what you have! So the simulation does use V=1 for when t is negative, and this should clearly show what's happening. Just because something is infinity in the s domain doesn't mean it is in time.
H: ESP chips vs AVR I recently got an Esp32 module and I was wondering how does Esp chips differ from AVR chips in general. What I know is there is a huge difference in specs and peripheral of the two, as the chip's silicon itself, but what I cannot understand is how does programming Esp chips differ from programming AVR chips. I know that Esp has arduino core and is supported by micro python, but in case of, AVR (in a nutshell) I just have to set or clear different bits in different registers to configure peripheral and so on. Can Esp chips be programmed that way? I am just looking for general understanding of the differnece in programming Esp and AVR chips. Like the concept in general. AI: All microcontrollers (AVR, PIC, ARM cortex M, ESP, 8051) work the same way: registers control peripherals and read/write peripherals, commands/programs are stored and executed moving around data between peripherals. There's are just different levels of abstraction to do that. For all microcontrollers, you can always write in assembly code. Every microcontroller will have different instructions you can use. Next level up, microcontrollers typically have some kind of standard C library for compiling C into useful machine code. For ESP, see https://docs.espressif.com/projects/esp-idf/en/latest/esp32/. For AVRs, see avr-libc https://www.nongnu.org/avr-libc/user-manual/pages.html or Atmel's toolchain https://www.microchip.com/en-us/development-tools-tools-and-software/gcc-compilers-avr-and-arm, and for ARM see CMSIS https://developer.arm.com/tools-and-software/embedded/cmsis. There are even higher levels, for example Arduino which is a bunch of additional libraries built on top of avr-libc that provides the same code interface (API) for AVR, ESP, and ARM for the most part. But they aren't the only one that does that. Some vendors try to do that as well too. For example, start.atmel.com tries to make s consistent high level API for all their devices, kind of like arduino does, in a way. The lower level you go, you will generally be more powerful and efficient at the cost of difficulty reading and understanding code, and code being extremely device specific. Higher level abstractions (arduino) are easy to read, can likely work on other chips, but can be slower and bloated. The short answer to your question: yes you can do low level coding on an ESP chip just like an AVR chip. But there are different layers, and you get to choose where you want to work!
H: Design a relay driver from TTL input with common parts I would like to drive a pneumatic relay from a TTL GPIO source, the TTL may be 0-3.3v or 0-5v I would like supply and cut 12v to the relay to control the air. I have a concept of what i'm trying to do in the circuit but my electronic design skills have not been used i a long time. I'm happy for other suggestions e.g. MOSFET etc. I would like use common parts available from Jaycar to solder on to veroboard The datasheet for the relay says 16W (27VA) but I think its actually much less because I have driven 2 relays with a single 15W power supply with no problems. Can someone provide me with a layout that can do such a thing and can work even if the load is much smaller e.g. 0.1W for example. AI: It seems you want to drive a solenoid valve using common parts and control it with TTL input such Arduino device? The common approach for DIY level, is to use NPN transistor (BD681G On Semi could work) to drive relay that then switches on the solenoid valve. Note fly-back diodes are required across inductive loads when switching to avoid device failure (i.e. relay coil and solenoid coil). Example in link below: https://web.cecs.pdx.edu/~eas199/B/howto/fishtank/wiring/solenoid_wiring.html The power rating for model SC-N14 DC12V version indicates holding power. When first powered on the in-rush current for relay can be about 2-3 times, select components accordingly. For DC solenoid valves there's no large in-rush current but for AC there is (edited). https://www.ia.omron.com/support/faq/answer/36/faq02165/index.html EDIT: An example circuit would be using mosfet with low Rds resistance. Flyback diode selected to withstand max current from solenoid. Pull-down resistor at gate of fet to have default state. The NPN BD681G cannot be used reliably in this configuration as the on resistance would cause voltage to be about 1.5volts less than 12V (large Ron resistance), voltage divider would also be needed to avoid exceeding Vbe_max.
H: Simple (probably) question about ADC sampling frequency I want to sample a signal at 44kHz. I've tried to set up the ADC with DMA and calculated the conversion time so that I get that 44kHz sampling frequency. My thinking is that with continuous mode ADC, after each ADC conversion immediately the next one starts, so by choosing the conversion time I get my 44kHz = (1/conv_time). Turns out this didn't work, I got much fewer samples than expected. Only when I set up the ADC triggered by a timer I got my correct 44kHz frequency. Can anyone explain to me where is my thinking wrong with the first attempt (without timer)? (I'm using STM32L432KC MCU) Straight from the reference manual: The total conversion time is calculated as follows: TCONV = Sampling time + 12.5 ADC clock cycles Example: With FADC_CLK = 80 MHz and a sampling time of 2.5 ADC clock cycles: TCONV = (2.5 + 12.5) ADC clock cycles = 15 ADC clock cycles = 187.5 ns (for fast channels) So sampling freq = 1/Tconv if I understand it correctly (https://www.st.com/resource/en/reference_manual/dm00151940-stm32l41xxx42xxx43xxx44xxx45xxx46xxx-advanced-armbased-32bit-mcus-stmicroelectronics.pdf page 389) My code since you asked for it: float32_t FFT_buffer_in[2048]; uint32_t analogInput; . . . void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef* hadc) { if (i<2048) { FFT_buffer_in[i] = (3.3*analogInput)/4095; i++; } else { i = 0; doFFT(); } } . . . int main(void) { . . . HAL_Init(); SystemClock_Config(); MX_GPIO_Init(); MX_DMA_Init(); MX_ADC1_Init(); MX_DAC1_Init(); MX_TIM2_Init(); MX_TIM1_Init(); MX_USART2_UART_Init(); arm_rfft_fast_init_f32(&fft_handler, 2048); HAL_ADC_Start_DMA(&hadc1, &analogInput, 1); . . . } //ADC SETUP: static void MX_ADC1_Init(void) { /* USER CODE BEGIN ADC1_Init 0 */ /* USER CODE END ADC1_Init 0 */ ADC_ChannelConfTypeDef sConfig = {0}; /* USER CODE BEGIN ADC1_Init 1 */ /* USER CODE END ADC1_Init 1 */ /** Common config */ hadc1.Instance = ADC1; hadc1.Init.ClockPrescaler = ADC_CLOCK_ASYNC_DIV8; hadc1.Init.Resolution = ADC_RESOLUTION_12B; hadc1.Init.DataAlign = ADC_DATAALIGN_RIGHT; hadc1.Init.ScanConvMode = ADC_SCAN_DISABLE; hadc1.Init.EOCSelection = ADC_EOC_SINGLE_CONV; hadc1.Init.LowPowerAutoWait = DISABLE; hadc1.Init.ContinuousConvMode = ENABLE; hadc1.Init.NbrOfConversion = 1; hadc1.Init.DiscontinuousConvMode = DISABLE; hadc1.Init.ExternalTrigConv = ADC_SOFTWARE_START; hadc1.Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_NONE; hadc1.Init.DMAContinuousRequests = ENABLE; hadc1.Init.Overrun = ADC_OVR_DATA_PRESERVED; hadc1.Init.OversamplingMode = DISABLE; if (HAL_ADC_Init(&hadc1) != HAL_OK) { Error_Handler(); } /** Configure Regular Channel */ sConfig.Channel = ADC_CHANNEL_6; sConfig.Rank = ADC_REGULAR_RANK_1; sConfig.SamplingTime = ADC_SAMPLETIME_12CYCLES_5; sConfig.SingleDiff = ADC_SINGLE_ENDED; sConfig.OffsetNumber = ADC_OFFSET_NONE; sConfig.Offset = 0; if (HAL_ADC_ConfigChannel(&hadc1, &sConfig) != HAL_OK) { Error_Handler(); } /* USER CODE BEGIN ADC1_Init 2 */ /* USER CODE END ADC1_Init 2 */ } These are just fragments from the code, If more is needed - let me know AI: You really mustn't do something as complex as an fft in a callback-that breaks basically all timing constraints. Your callback is probably still doing the fft while the next conversion is complete. This alone suffices to break things. Other than that, on chips like the stm32, interrupts can (and do) have variable latency, and also other interrupts can preempt yours or still be running with a higher priority. The timer is an actual deterministic element meant for exactly this, triggering things at deterministic intervals. Using it is not only convenient, but the only way to guarantee constant rate of anything in your MCU.
H: Limit pneumatic cylinder stroke I have a solenoid operating pneumatic cylinder which is controlled by a timer. timer is fixed on a certain value (25s working followed by 60s rest) and as it starts to count stoke opens fully for 25s then retreats back. I want my cylinder to stop half way through its stroke so added a limit switch to cut the power of solenoid valve when triggered. The problem is that as soon as limit switch is released to normal position solenoid push the stroke to hit LS again till 25s is over. I need a circuit that breaks as soon as LS is triggered and remains that way until the timer restarts its counting again. Timing diagram for OP to edit. <-- 25 s--> _________ ________ Solenoid _____| |__________________| |_________ _ _ switch(desired) _____| |__________________________| |________ AI: simulate this circuit – Schematic created using CircuitLab
H: MAX3485 pull-up pull-down resistors I want to use the following MAX3485 chip: https://datasheet.lcsc.com/szlcsc/2006181334_UMW-Youtai-Semiconductor-Co-Ltd-MAX3485ESA_C668204.pdf I do not speak any chinese, but my question is more in a general sense: does an MAX3485 chip need additional pull-up and pull-down resistors for lines A and B? This and some other datasheets have figures about the topology where there are no pull-up and pull-down resistors. But at the end of this datasheet, and I have also seen that on the internet when I was searching for this, line A is pulled to VCC with a 10k resistor and B is pulled to ground with a 10k resistor (the 10k I have seen in the internet not in the datasheet). What is the purpose of those resistors and when are they necessary? AI: The pull up/down on A/B lines are used for fail-safe bias, to passively set an idle voltage on a bus where all devices are listening and no transmitter is active. So no, the MAX3485 itself should not need them, but the fail-safe bias can be used with any tranceiver chip if the system benefits from them.
H: Local fiducial placement I'm working on a prototype that has a few fine pitch (0.5mm) components. I'm thinking about adding local fiducial marks for these components as an afterthought. My idea was to place them close to the components where there is space for them. However, I have read here that local fiducials should be part of the component landmark. Do local fiducials really have to be placed directly at the component to be useful for the pick and place machine? Are they usually part of the footprint? An example for my naive approach looks like this: AI: Best thing to do is to call (or email) your board assembly house and ask what they prefer. All assembly houses do something differently depending on the machines and set up that they do. They may prefer certain types of fiducials, placement, size, etc.
H: What do dotted outlines of components mean on circuit schematics? Can anyone tell me what the blue dotted outlines of components represent in this schematic? There are 4 diodes on the LOAD, AND, OR and XOR lines and a not gate on the STORE line. Are these components that were present in an earlier revision but have been removed? Complete schematic: https://cdn.hackaday.io/files/20781889094304/Schematics%202020-03-20.pdf AI: Starting off, because the diodes are made on the blue "artwork" layer of the schematic, there are no real diodes there. The blue dashed diodes are merely "comments" or "suggested intent". So it looks like this is some part of a processor, where the inputs IR5, IR6, and IR7 are being used to decode into a "one hot" signal using the 74HCT138. Following that, there is a "diode ROM" that takes the current decoded instruction and probably converts it to 5 control lines in the processor. When the decoder receives an input, it pulls one of the output lines low. Pulling one of the output rows low will pull the columns low that have a diode attached. For example, if the inputs A0-A2 are "111", then O0-06 will be high, and O7 will be low. O7 will pull the first, second, and fourth columns low through D34, D35, and D36. That brings us full circle to D21 - it's not connected to any of the outputs but to the input A2. When A2 is low, O0-O3 will be selected. D21 is functionally equivalent to placing four diodes between column 1 and O0-O3. However, since this looks like a TTL-style computer, it's probably done to save 3 diodes over being easier to read.
H: Control single-light LED strip with Raspberry pi and MOSFET I'm trying to make my LED strip fade-in and fade-out by using Raspberry-pi 4, unfortunately for me, I am not an electronic expert. Every tutorial I saw so far was for RGB LED strips and I have a single-color (3000 K) LED strip with just 2 pins (+ & -). I have: LRS-50-24 datasheet 30N06L datasheet 4m LED strip single color (3000K) 24V Raspberry Pi 4 My question is how to connect the MOSFET and the LRS-50-24 to the PI in order to control the fade-in/out by GPIO python code? Appreciate any help AI: I take it that you'd be using the GPIOs PWM function to generate pulses to toggle the LEDs quickly on and off to control the light level. You can connect the gate (G) of the FET to a GPIO. The source (S) to the negative output of the power supply and the led strip between the positive and the drain (D). Of course you'll have to connect the negative terminal of the power supply also to the GND of the Raspberry Pi. simulate this circuit – Schematic created using CircuitLab I've added an optional resistor (R1) in the schmatic that will discharge the gate if the GPIO is in high-impedance state or disconnected. This prevents the FET from staying "switched on". Another optional resistor (R2) limits the momentary current when switching the FET on or off. (See comments). Also worth mentioning is that the FET you've chosen (FQP30N06L) has low enough gate threshold voltage (VGS(th)) that it probably will work ok with the Pi for this application. Certain other FETs with higher VGS(th) might not work at all. For example this 30N06L from Unisonic possibly won't.
H: Blink Code ATmega2560 not working in Proteus I am running a simple blink program in an ATmega2560 with external 8MHz crystal. When I run it in Proteus, the LEDs do not blink. Refer to my files below. This is the simple blink code. I just add prescaler bits to verify its functionality. void setup() { noInterrupts(); CLKPR = 0x80; /*Enabling the clock prescaler function*/ CLKPR = 0x00; /*Setting the prescaler to div by 1*/ interrupts(); pinMode(13, OUTPUT); } void loop() { digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level) delay(500); // wait for a second digitalWrite(13, LOW); // turn the LED off by making the voltage LOW delay(500); // wait for a second } I correctly choose the ATmega2560 with external 8MHz. And this is my circuit in Proteus: (Removing the VDD in reset, AVCC, AREF doesn't help.) And I set the fuse bits to work with external crystal: I don't know where I went wrong. Please help. AI: You have your LED connected to the wrong pin. The Arduino mapping does not follow physical pin numbers. Either change your code to use Digital Pin 16 (which is where you are currently connected), or move your LED over to physical pin 26 (which is Digital Pin 13). I also don't see Pin 99 (GND) connected anywhere on your schematic... And it is also missing a number of VCC connections and GND pins. I'm not familiar with Proteus so I'm not sure why these pins are missing, but it seems like that would be an important part to have.
H: Why don't volts and amps necessarily increase together in Watts = Volts*Amps? Don't more volts = more amps and vice versa? I'm trying to understand modern American housing circuitry, which have 15 and 20 amp breakers and work on 120v circuits. They're described using the simple formula Watts = Volts*Amps. I'm using physics logic I've read online to understand this. I understand volts as electrons in a high state of energy ready to move to a lower state of energy (because they constantly repel each other) and the higher the voltage the faster they travel through a circuit once released (120v vs 240v for example). I understand amperes as the amount of a fixed quantity of electricity (electrons), called a coulomb, that can travel through a circuit in a second, so 1 amp = 1 coulomb/sec Just from these definitions, I don't understand how more amps don't automatically increase voltage given that voltage is the actual force that is pushing the coulombs through the circuit? What allows more coulombs to travel through a circuit per second is literally the voltage isn't it? Therefore, as one increases, the other should also increase. However, this is not the case, and it makes housing circuits confusing for me. For example, with 15 and 20 amp American housing circuits: 120v15amps = 1800 watts and 120v20amps = 2400 watts How exactly can amps increase (amount of coloumbs traveling through circuit per second) without increasing the voltage and how can voltage increase without inadvertently increasing the amps? Btw, I'm assuming higher voltage with even lower amps than 120v*15amps is also possible. I'm also assuming that somehow resistance and AC vs DC is related to this somehow. I apologize if this is a dumb question, but I'm genuinely confused. Edit: I'm not confusing the total amount of energy from a housing circuit with energy required for a specific load. I was using the differences in the max loads of 15 and 20 amp circuits to describe how amps can be different with a fixed voltage. I shouldn't have said "breaker," and I should have used a more specific example. The meat of my question is really how amps can be different for a load with a fixed voltage, i.e an iPhone vs a toaster connected to 120v circuit have different amps. How can amps increase or decrease without also increasing or decreasing the voltage? Voltage dictate the speed the coulombs are moving aka amps. They seem to literally mean the same thing or are directly proportional somehow. How can more or less energy (different amps) be traveling through a 120v circuit if the 120v's traveling is intrinsically that energy? Another way to say this, what does it mean in a physical sense for 15amps to travel through a circuit vs 20 amps to travel through a circuit? AI: You have to make a distinction between two different things that you are blurring together. First, there is a rating for a circuit. 120V at 20 Amps. That is how much it can deliver if it is connected to the right load. 2400 Watts is the maximum capacity of the circuit. Then there is the details of real loads. How do they work and how will they behave if you change something? It is best to be a bit more specific even when considering hypotheticals. Let's say you measure the voltage at a home in north america, it will be approximately 120V. But it might be 124V. That is perfectly normal. Let's say we hook up an old-fashioned light bulb to our 124V house power. Now we can measure the current, too. Let's say it is 0.5A. So our lamp is consuming about 60.2 Watts. So this is an operating point. 124V and 0.5A which gives us 60.2 Watts. If we could INCREASE the VOLTAGE, then the current and power would increase, too. So you are right that they increase together. But the way household circuitry is designed is that the voltage is held constant. The mains power from the utility company is supplied to your house as a FIXED voltage. We don't get to change it, and the utility company does not let it change by much either. So you can't increase the voltage, really. There is no knob to turn it up with. Likewise, you don't have a way to increase the load current (in this scenario). When you connect a fixed load to fixed household voltage, the load decides how much current it will take at the voltage which is offered. It doesn't matter whether the capacity of the circuit is 1800 watts or 2400 watts. Our load only needs 60.2 Watts and that is all it will take. But you could add another lamp in parallel and get more current that way. Maybe some variable loads (like a fan with low, medium and high setting) can be adjusted. But anyway, in all cases, the utility company holds voltage fixed, and the load takes the current it needs to do its job. After reading your edit, I guess I would add one more thing. Voltage and current are not the same. Voltage tells you how bad the electrons (or other charges) want to move. Current tells you how many electrons (or other charges) are actually moving past a given point each second. For some loads, such as heating elements, by their nature they will always enforce Ohm's law (V = I * R). The designer of a heating element can make the resistance higher by making the element longer or skinnier, or choosing a different material. Smart loads may use transistors to vary the current. Transistors are capable of switching really fast or just kind of acting like a variable resistor so they can create a choke point that limits current flow as needed. The electrons may REALLY want to move (high voltage) but the transistor meters the flow, only allowing a certain number per second to flow. So this is one reason why loads can vary. Ultimately, the utility company PRESENTS a voltage. Dumb loads enforce Ohm's law. Smart loads use transistors to control the current flow. The power consumed is voltage * current. I hope this makes things more clear to you.
H: Is an (n+1/4) wavelength transmission line impedance transformer comparable to a 1/4 wavelength line of the same composition? I use coaxial transmission line transformers for simple power splitting and combining networks. This is for connecting multiple resonant antennas in array configurations. It's a standard technique that uses a 1/4 wavelength section of coax to match end loads/sources of different impedance. It's become really common in the ham radio designs I'm looking at. Here's a brief note on that: physics behind the impedance matching performed in this case Here is a practical example of one implementation: https://www.qsl.net/dk7zb/PVC-Yagis/2x25_ohm.htm, using 5/4 wavelength cables. It's so well known and understood (although my theoretical understanding of it is limited), that I wouldn't have a question, except - many designs suggest that odd multiples of 1/4 wavelength should also work, e.g. 3/4, 5/4, 7/4, etc. I find that intuitively hard to accept for the following reasons. I am somewhat confused and want to know the correct way to implement this. It seems logical to me, that at the end of a 1/4 wavelength transformer, the transformed impedance appears, and so it should be connected only to a coax of the target impedance, not the transformer impedance. For example, to transform 25 ohm to 100 ohm, I can use 1/4 wavelength of sqrt(25*100) = 50 ohms cable. Call 25 ohms the source, if I want to continue the cable run, I should attach any length of 100 ohms cable to the transformer. That makes perfect sense to me, although I don't fully understand the principle of operation of the transformer itself and just accept that it is true. But now I'm being told that I could just as well use for example, a 3/4 wavelength of 50 ohms (matching) cable. My conceptual problem is this: I could view that broken down into a series connection of 1/4 wavelength 50 ohms and 1/2 wavelength of 50 ohms. In the first case, there can be a 1/2 wavelength of 100 ohms cable plus any length in addition at the end of the transformer. In the second, there is an actual 1/2 wavelength of 50 ohms cable plus any length of 100 ohms after that. Questions: How can both cases be valid, or is the theory of odd quarter wavelengths just wrong? If I use lengths like 7/4 wavelengths transformer, what are the consequences? Apparently people are using this without experiencing return losses, but what about signal loss due to the mis-match? AI: A transmission line terminated in a mismatched load of a given impedance will repeat that impedance every λ/2 (electrical length) back from the termination (e.g. here). You can think of your odd multiples of λ/4 transformer as consisting of a single λ/4 impedance transformer (using the calculations you've already described) plus an arbitrary number of λ/2 sections which repeat the mismatched impedance back to the λ/4 section. You can use this to make a longer matching section. So your example of DK7ZB's stacked Yagi array is using a 5λ/4 transformer to allow larger vertical spacing of the individual Yagi antennas. There are trade-offs of course. A longer transformer means higher losses. Multiple sections magnify variations in wavelength so a longer transformer will have a narrower bandwidth. You may be able to achieve operation on harmonically related bands - a λ/4 transformer on 2 m might be usable as a 3λ/4 transformer on 70 cm, if you're lucky.
H: ESP32 DAC can't output zero volts I made a circuit to use with my ESP32 to test 18650 battery capacity. During tests I didn't notice that when I do dacWrite(dacpin, 0); the output on DAC pin becomes 0.1 V instead of zero Those tiny voltages are a problem, because the LM358 op-amp is connected to the DAC pin in unity gain configuration which instead of shutting down keeps draining battery by 0.1 V which at 2.8 V (cutoff voltage) is 0.1A (or 100 mA). Things I tried: Connecting a 1 kΩ resistor from the DAC pin to ground, doesn't work Disabling DAC by dac_output_disable(DAC_CHANNEL_1);; the output goes to 0 but things get complicated, the op-amp starts outputting randomly turning on the MOSFET. Schematics: Other than this problem, it works great paired with an ESP32 touch pin to start/reset, and has very good accuracy. What can I do to make the DAC output zero? I thought of connecting an NPN transistor from the LM358 output to ground that will be turned on/off by microcontroller but my previous failed attempts at designing circuits and my love for my ESP32 don't allow me to do this experiment. If someone needs to view the code or build this project: Code AI: Do you have the pull-up enabled for the DAC output? The DAC output pins on the ESP32 can be used either as a normal digital input/output with programmable pull-ups or pull-downs. If the pull-up is enabled it will put a small current into the output that will raise the minimum voltage slightly. The DAC uses a resistor network and a activated pull-up will result in a small positive if it is enabled. Also, even if the DAC outputs zero volts you cannot guarantee that the discharge current will be zero because of op-amp offset voltage. The LM358 opamp has the possibility of having an offset voltage of up to 3mV depending upon the grade and manufacturer. It could be that you provide it with 0V but it interprets the voltage as being positive or negative up to 3mV. One way to avoid this issue is to intentionally provide an offset of a few mV in the opposite direction that is larger than the possible offsets of the DAC and opamp. You can compensate for that offset in software although the amount of offset required will be only about 1 LSB of the DAC so will probably not be significant. You can introduce this by adding a resistor of say 1kohm between the current sense resistor and the amplifier inverting input pin then add a resistor from the input pin to the +5V supply. 470k would inject about 10uA that would result in 10mV across the 1k resistor. Then any input voltage less than 10mV from the DAC would give zero discharge current. I would also put an attenuator on the DAC output (maybe after an opamp buffer) so the working voltage across the current sense resistor is say 0-1V rather than 0-3.3V as you have it. There would be less power in the sense resistor and it would work down to lower battery voltages and would provide better resolution at low currents.
H: Ideal transformer paradox It is true that an ideal transformer can not exist (but we can approach it as closely as want by improving the engineering behind it), but I think they may be mathematically inconsistent. To illustrate, consider these two circuits: In case-1, I have a \$V\$ volt battery attached to a resistor, then the power drawn is given as \$P=VI\$, this is pretty standard and one of the first things any one who has done introductory circuit theory will learn. Now, in case-2, we have a transformer consisting of two inductors and metal rod interior (the thing you use to keep their fluxs linked), so the coil in second circuit acts as a battery for the resistor R. Now, for an ideal transformer, the power in the input circuit is the same power in the output circuit. Hence, the voltage and current are predetermined by the power conservation equation. If we say \$I_1\$ is the current in circuit on left in case-2, and \$I_2\$ as current with \$V_2\$ as voltage for circuit on right, then we have the equation: $$ I_1 V_1 = V_2 I_2$$ For the resistor in the second circuit, it must be that the current is determined by voltage through it (ohms law ) but we already have a predetermined current by transformer power conservation. Now, this leads to two possible current values! Which is right?[ we can isolate equation for current by relating ratio of voltage with number of turns of coil] And, what was the mistake in my logic which lead to this contradiction? It seems like even if we account for power losses of the transformer, that is introduce a multiplicative factor \$\kappa \$ in to the power conservation equation as so: $$I_1 V_1 = \kappa I_2 V_2$$ We still have the same contradiction. Related question An explicit calculation: Suppose that we have by turn ratio: $$ \frac{V_1}{V_2} = \nu$$ Then by the power loss accounted transformer equation: $$ I_1 \frac{\nu}{\kappa}=I_2$$ Now, for he is the 'strange' part, by Ohm's law , for the resistor: $$ V_2 = I_2 R$$ Hence, we get: $$ \frac{V_1}{\nu} = I_1 \frac{\nu}{\kappa} R$$ Or, $$ R = \frac{\kappa }{\nu^2 I_1} V_1$$ This equation we can isolate for \$R\$, now as V and I changes it seems that R must take multiple value but it is that R is only one single value! AI: For any given AC input voltage, the current an ideal transformer draws from the power supply is related to the load on the secondary. It's zero for no load. If the primary voltage is Vin, then the secondary voltage is Vin*(n2/n1) ...where n2 is the secondary turns and n1 is the primary turns. So the power at the secondary is Vin*(n2/n1)^2/RLoad And the power at the primary is the same. We say that the load resistance (or impedance) is reflected through the transformer by the square of the turns ratio \$(n_2/n_1)^2\$. So a load of 100 ohms on the secondary of a 1:2 ideal transformer acts the same as 25 ohms directly on the primary voltage. Apply 10V and the power is 100/25 = 4W in either case. There will be 20V on the secondary of the transformer since it's stepping up the voltage 2:1. simulate this circuit – Schematic created using CircuitLab There is no contradiction. Once you fix the voltage the circuit determines the current drawn.
H: Efficiently turning electric to kinetic energy What are the most efficient electric mechanisms for creating kinetic energy? Purely from a coulomb-volt to foot-pound perspective. AI: I don't think anything beats an electromagnetic motor. Here's a link to the first result when I googled "Highest efficiency motor". It's 99% efficient. Note that you almost always need a set of gears to convert rotational force into the force you actually need, and a quick search seems to indicate a maximum efficiency of 98% per gear junction. Note that for some specific types of motion, different methods will be most efficient. For a high frequency vibration a piezo or quartz crystal might be more efficient. For bulk power transfer though, motor wins. Just a side note, volts to footpound is an apples to aardvarks comparison. You need to compare input power to output power to analyze efficiency. You can produce the same power level motor in a variety of voltages.
H: How to prevent a function from overwriting memory? I'm writing a program that basically aquires samples from a signal and does FFT on it (I'm using STM32L432KC MCU). I'm trying to send results from the FFT calculations through UART but there is a problem. I've done some debugging myself and found some information: The arm_rfft_fast_f32() functions (fft function from cmsis dsp) overwrites important memory that contains UART State data among others. How can I prevent it? Images of the problem: This is one instruction BEFORE memory is overwritten (before FFT function executes), data in red circle is the UART State data (0x20 is UART_READY or whatever) This is one instruction AFTER the FFT function executed - look at the memory and see that my UART State got overwritten Code: #include "main.h" #include <arm_math.h> #include <stdio.h> #define NS 128 uint32_t Wave_LUT[NS] = { 2048, 2149, 2250, 2350, 2450, 2549, 2646, 2742, 2837, 2929, 3020, 3108, 3193, 3275, 3355, 3431, 3504, 3574, 3639, 3701, 3759, 3812, 3861, 3906, 3946, 3982, 4013, 4039, 4060, 4076, 4087, 4094, 4095, 4091, 4082, 4069, 4050, 4026, 3998, 3965, 3927, 3884, 3837, 3786, 3730, 3671, 3607, 3539, 3468, 3394, 3316, 3235, 3151, 3064, 2975, 2883, 2790, 2695, 2598, 2500, 2400, 2300, 2199, 2098, 1997, 1896, 1795, 1695, 1595, 1497, 1400, 1305, 1212, 1120, 1031, 944, 860, 779, 701, 627, 556, 488, 424, 365, 309, 258, 211, 168, 130, 97, 69, 45, 26, 13, 4, 0, 1, 8, 19, 35, 56, 82, 113, 149, 189, 234, 283, 336, 394, 456, 521, 591, 664, 740, 820, 902, 987, 1075, 1166, 1258, 1353, 1449, 1546, 1645, 1745, 1845, 1946, 2047 }; //sine wave lookup table ADC_HandleTypeDef hadc1; DMA_HandleTypeDef hdma_adc1; DAC_HandleTypeDef hdac1; DMA_HandleTypeDef hdma_dac_ch1; TIM_HandleTypeDef htim1; TIM_HandleTypeDef htim2; UART_HandleTypeDef huart2; DMA_HandleTypeDef hdma_usart2_tx; int addressState = 0x2000350c; arm_rfft_fast_instance_f32 fft_handler; float32_t FFT_buffer_in[2048]; float32_t FFT_buffer_out[1024]; uint32_t analogInput; uint16_t i = 0; uint16_t dominatingFreqency = 0; void SystemClock_Config(void); static void MX_GPIO_Init(void); static void MX_DMA_Init(void); static void MX_ADC1_Init(void); static void MX_DAC1_Init(void); static void MX_TIM2_Init(void); static void MX_TIM1_Init(void); static void MX_USART2_UART_Init(void); static void doFFT(void); float complexABS(float real, float imag); uint8_t findBiggestValue(uint8_t* array, uint16_t size); void HAL_UART_TxCpltCallback(UART_HandleTypeDef *huart) { } void HAL_UART_TxHalfCpltCallback(UART_HandleTypeDef *huart) { } void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef* hadc) { if (i<2048) { FFT_buffer_in[i] = (3.3*analogInput)/4095; i++; } else { i = 0; } } int main(void) { HAL_Init(); SystemClock_Config(); MX_GPIO_Init(); MX_DMA_Init(); MX_ADC1_Init(); MX_DAC1_Init(); MX_TIM2_Init(); MX_TIM1_Init(); MX_USART2_UART_Init(); arm_rfft_fast_init_f32(&fft_handler, 2048); HAL_ADC_Start_DMA(&hadc1, &analogInput, 1); HAL_DAC_Start_DMA(&hdac1, DAC_CHANNEL_1, (uint32_t*)Wave_LUT, 128, DAC_ALIGN_12B_R); HAL_TIM_Base_Start(&htim2); HAL_TIM_Base_Start(&htim1); while (1) { if(i == 2048) { doFFT(); } if(dominatingFreqency != 0) { uint8_t MSG[] = "test "; HAL_UART_Transmit_DMA(&huart2,MSG, sizeof(MSG)); dominatingFreqency = 0; } } } float complexABS(float real, float imag) { return sqrtf((real*real+imag*imag)); } uint8_t findBiggestValue(uint8_t* array, uint16_t size) { uint8_t max = array[1]; uint16_t max_i; for(uint16_t i = 2; i<size; i++) { if((array[i] > max) && (array[i] < (uint8_t)200)) { max = array[i]; max_i = i; } } return max_i; } void doFFT() { //(pointer to arm_rfft_fast_instance_f32 structure, pointer to input data, pointer to output data, inverse fft =1 or regular fft =0) arm_rfft_fast_f32(&fft_handler, FFT_buffer_in, FFT_buffer_out, 0); //np. f_sample 45ks/s, 1/45k = 1sample_time = 22.22us, 1024 samples = 1024*22.22u = 0.02275sec in full window (1024 samples) //wynik *2 bo zbieramy 2048 probek a przedstawiamy jako 1024? wiec okres okna = 0.0455s, f_okna = 22Hz //1bin = 1 okres w tym oknie = 22Hz, 2bin = 44Hz, 10bin = 220Hz, 91bin = 2kHz ... 512bin = 11.25kHz uint8_t spectrum[1024]; uint16_t spectrumPoint = 0; //calculate ABS values and do linear to dB conversion: for (int i=0; i<2048; i=i+2) { int to_dB = (int)(20*log10f(complexABS(FFT_buffer_out[i], FFT_buffer_in[i+1]))); uint8_t to_8bit = (uint8_t)to_dB; spectrum[spectrumPoint] = to_8bit; if (spectrum[spectrumPoint]<0) { spectrum[spectrumPoint] = 0; } spectrumPoint++; } dominatingFreqency = (findBiggestValue(spectrum, (sizeof(spectrum)))) * 22; //uint8_t MSG[30] = {'\0'}; //sprintf(MSG,"freq: %u", dominatingFreqency); } /** * @brief System Clock Configuration * @retval None */ void SystemClock_Config(void) { RCC_OscInitTypeDef RCC_OscInitStruct = {0}; RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; RCC_PeriphCLKInitTypeDef PeriphClkInit = {0}; /** Initializes the RCC Oscillators according to the specified parameters * in the RCC_OscInitTypeDef structure. */ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_MSI; RCC_OscInitStruct.MSIState = RCC_MSI_ON; RCC_OscInitStruct.MSICalibrationValue = 0; RCC_OscInitStruct.MSIClockRange = RCC_MSIRANGE_6; RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_MSI; RCC_OscInitStruct.PLL.PLLM = 1; RCC_OscInitStruct.PLL.PLLN = 40; RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV7; RCC_OscInitStruct.PLL.PLLQ = RCC_PLLQ_DIV2; RCC_OscInitStruct.PLL.PLLR = RCC_PLLR_DIV2; if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) { Error_Handler(); } /** Initializes the CPU, AHB and APB buses clocks */ RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2; RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1; RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1; if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_4) != HAL_OK) { Error_Handler(); } PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_USART2|RCC_PERIPHCLK_ADC; PeriphClkInit.Usart2ClockSelection = RCC_USART2CLKSOURCE_PCLK1; PeriphClkInit.AdcClockSelection = RCC_ADCCLKSOURCE_PLLSAI1; PeriphClkInit.PLLSAI1.PLLSAI1Source = RCC_PLLSOURCE_MSI; PeriphClkInit.PLLSAI1.PLLSAI1M = 1; PeriphClkInit.PLLSAI1.PLLSAI1N = 32; PeriphClkInit.PLLSAI1.PLLSAI1P = RCC_PLLP_DIV7; PeriphClkInit.PLLSAI1.PLLSAI1Q = RCC_PLLQ_DIV2; PeriphClkInit.PLLSAI1.PLLSAI1R = RCC_PLLR_DIV8; PeriphClkInit.PLLSAI1.PLLSAI1ClockOut = RCC_PLLSAI1_ADC1CLK; if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK) { Error_Handler(); } /** Configure the main internal regulator output voltage */ if (HAL_PWREx_ControlVoltageScaling(PWR_REGULATOR_VOLTAGE_SCALE1) != HAL_OK) { Error_Handler(); } } /** * @brief ADC1 Initialization Function * @param None * @retval None */ static void MX_ADC1_Init(void) { /* USER CODE BEGIN ADC1_Init 0 */ /* USER CODE END ADC1_Init 0 */ ADC_ChannelConfTypeDef sConfig = {0}; /* USER CODE BEGIN ADC1_Init 1 */ /* USER CODE END ADC1_Init 1 */ /** Common config */ hadc1.Instance = ADC1; hadc1.Init.ClockPrescaler = ADC_CLOCK_ASYNC_DIV8; hadc1.Init.Resolution = ADC_RESOLUTION_12B; hadc1.Init.DataAlign = ADC_DATAALIGN_RIGHT; hadc1.Init.ScanConvMode = ADC_SCAN_DISABLE; hadc1.Init.EOCSelection = ADC_EOC_SINGLE_CONV; hadc1.Init.LowPowerAutoWait = DISABLE; hadc1.Init.ContinuousConvMode = DISABLE; hadc1.Init.NbrOfConversion = 1; hadc1.Init.DiscontinuousConvMode = DISABLE; hadc1.Init.ExternalTrigConv = ADC_EXTERNALTRIG_T1_TRGO; hadc1.Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_RISING; hadc1.Init.DMAContinuousRequests = ENABLE; hadc1.Init.Overrun = ADC_OVR_DATA_PRESERVED; hadc1.Init.OversamplingMode = DISABLE; if (HAL_ADC_Init(&hadc1) != HAL_OK) { Error_Handler(); } /** Configure Regular Channel */ sConfig.Channel = ADC_CHANNEL_6; sConfig.Rank = ADC_REGULAR_RANK_1; sConfig.SamplingTime = ADC_SAMPLETIME_12CYCLES_5; sConfig.SingleDiff = ADC_SINGLE_ENDED; sConfig.OffsetNumber = ADC_OFFSET_NONE; sConfig.Offset = 0; if (HAL_ADC_ConfigChannel(&hadc1, &sConfig) != HAL_OK) { Error_Handler(); } /* USER CODE BEGIN ADC1_Init 2 */ /* USER CODE END ADC1_Init 2 */ } /** * @brief DAC1 Initialization Function * @param None * @retval None */ static void MX_DAC1_Init(void) { /* USER CODE BEGIN DAC1_Init 0 */ /* USER CODE END DAC1_Init 0 */ DAC_ChannelConfTypeDef sConfig = {0}; /* USER CODE BEGIN DAC1_Init 1 */ /* USER CODE END DAC1_Init 1 */ /** DAC Initialization */ hdac1.Instance = DAC1; if (HAL_DAC_Init(&hdac1) != HAL_OK) { Error_Handler(); } /** DAC channel OUT1 config */ sConfig.DAC_SampleAndHold = DAC_SAMPLEANDHOLD_DISABLE; sConfig.DAC_Trigger = DAC_TRIGGER_T2_TRGO; sConfig.DAC_OutputBuffer = DAC_OUTPUTBUFFER_ENABLE; sConfig.DAC_ConnectOnChipPeripheral = DAC_CHIPCONNECT_DISABLE; sConfig.DAC_UserTrimming = DAC_TRIMMING_FACTORY; if (HAL_DAC_ConfigChannel(&hdac1, &sConfig, DAC_CHANNEL_1) != HAL_OK) { Error_Handler(); } /* USER CODE BEGIN DAC1_Init 2 */ /* USER CODE END DAC1_Init 2 */ } /** * @brief TIM1 Initialization Function * @param None * @retval None */ static void MX_TIM1_Init(void) { /* USER CODE BEGIN TIM1_Init 0 */ /* USER CODE END TIM1_Init 0 */ TIM_ClockConfigTypeDef sClockSourceConfig = {0}; TIM_MasterConfigTypeDef sMasterConfig = {0}; /* USER CODE BEGIN TIM1_Init 1 */ /* USER CODE END TIM1_Init 1 */ htim1.Instance = TIM1; htim1.Init.Prescaler = 80; htim1.Init.CounterMode = TIM_COUNTERMODE_UP; htim1.Init.Period = 22; htim1.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1; htim1.Init.RepetitionCounter = 0; htim1.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE; if (HAL_TIM_Base_Init(&htim1) != HAL_OK) { Error_Handler(); } sClockSourceConfig.ClockSource = TIM_CLOCKSOURCE_INTERNAL; if (HAL_TIM_ConfigClockSource(&htim1, &sClockSourceConfig) != HAL_OK) { Error_Handler(); } sMasterConfig.MasterOutputTrigger = TIM_TRGO_UPDATE; sMasterConfig.MasterOutputTrigger2 = TIM_TRGO2_RESET; sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE; if (HAL_TIMEx_MasterConfigSynchronization(&htim1, &sMasterConfig) != HAL_OK) { Error_Handler(); } /* USER CODE BEGIN TIM1_Init 2 */ /* USER CODE END TIM1_Init 2 */ } /** * @brief TIM2 Initialization Function * @param None * @retval None */ static void MX_TIM2_Init(void) { /* USER CODE BEGIN TIM2_Init 0 */ /* USER CODE END TIM2_Init 0 */ TIM_ClockConfigTypeDef sClockSourceConfig = {0}; TIM_MasterConfigTypeDef sMasterConfig = {0}; /* USER CODE BEGIN TIM2_Init 1 */ /* USER CODE END TIM2_Init 1 */ htim2.Instance = TIM2; htim2.Init.Prescaler = 0; htim2.Init.CounterMode = TIM_COUNTERMODE_UP; htim2.Init.Period = 625; //freqency of the generated sin (in the case of prescaler = 0): // for example: 1 cycle = 1/f_clock = 1/80MHz = 12.5ns //period = ile zliczamy cykli (ile odliczamy czasu) => period*1cycle = odliczany czas //np. 314*12.5ns = 3925ns (co tyle czasu timer sie przepelnia i dostajemy interrupt ktory generuje probke przez DAC) //zeby wygenerowac 1 okres sinusoidy w naszym przypadku potrzebujemy 128 probek, wiec mamy 3.925us na probke //to 1 okres sin = 128*3.925u = 502.4us, f_sin = 1/502.4us = 2kHz (zegar sie waha i wgl wiec to idealnie tyle nigdy ni bedzie?) //ostateczny wzor na f_sin (w tym przypadku) = 1/(period*12.5ns*128) //wzor na period dla chcianego f_sin (bo to period zmieniamy): period = 1/(f_sin*12.5ns*128) //########### period = 1/(f_sin*1.6u) ########## htim2.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1; htim2.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE; if (HAL_TIM_Base_Init(&htim2) != HAL_OK) { Error_Handler(); } sClockSourceConfig.ClockSource = TIM_CLOCKSOURCE_INTERNAL; if (HAL_TIM_ConfigClockSource(&htim2, &sClockSourceConfig) != HAL_OK) { Error_Handler(); } sMasterConfig.MasterOutputTrigger = TIM_TRGO_UPDATE; sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE; if (HAL_TIMEx_MasterConfigSynchronization(&htim2, &sMasterConfig) != HAL_OK) { Error_Handler(); } /* USER CODE BEGIN TIM2_Init 2 */ /* USER CODE END TIM2_Init 2 */ } /** * @brief USART2 Initialization Function * @param None * @retval None */ static void MX_USART2_UART_Init(void) { /* USER CODE BEGIN USART2_Init 0 */ /* USER CODE END USART2_Init 0 */ /* USER CODE BEGIN USART2_Init 1 */ /* USER CODE END USART2_Init 1 */ huart2.Instance = USART2; huart2.Init.BaudRate = 115200; huart2.Init.WordLength = UART_WORDLENGTH_8B; huart2.Init.StopBits = UART_STOPBITS_1; huart2.Init.Parity = UART_PARITY_NONE; huart2.Init.Mode = UART_MODE_TX; huart2.Init.HwFlowCtl = UART_HWCONTROL_NONE; huart2.Init.OverSampling = UART_OVERSAMPLING_16; huart2.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE; huart2.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT; if (HAL_UART_Init(&huart2) != HAL_OK) { Error_Handler(); } /* USER CODE BEGIN USART2_Init 2 */ /* USER CODE END USART2_Init 2 */ } /** * Enable DMA controller clock */ static void MX_DMA_Init(void) { /* DMA controller clock enable */ __HAL_RCC_DMA1_CLK_ENABLE(); /* DMA interrupt init */ /* DMA1_Channel1_IRQn interrupt configuration */ HAL_NVIC_SetPriority(DMA1_Channel1_IRQn, 0, 0); HAL_NVIC_EnableIRQ(DMA1_Channel1_IRQn); /* DMA1_Channel3_IRQn interrupt configuration */ HAL_NVIC_SetPriority(DMA1_Channel3_IRQn, 0, 0); HAL_NVIC_EnableIRQ(DMA1_Channel3_IRQn); /* DMA1_Channel7_IRQn interrupt configuration */ HAL_NVIC_SetPriority(DMA1_Channel7_IRQn, 0, 0); HAL_NVIC_EnableIRQ(DMA1_Channel7_IRQn); } /** * @brief GPIO Initialization Function * @param None * @retval None */ static void MX_GPIO_Init(void) { /* GPIO Ports Clock Enable */ __HAL_RCC_GPIOA_CLK_ENABLE(); } /* USER CODE BEGIN 4 */ /* USER CODE END 4 */ /** * @brief This function is executed in case of error occurrence. * @retval None */ void Error_Handler(void) { /* USER CODE BEGIN Error_Handler_Debug */ /* User can add his own implementation to report the HAL error return state */ __disable_irq(); while (1) { } /* USER CODE END Error_Handler_Debug */ } #ifdef USE_FULL_ASSERT /** * @brief Reports the name of the source file and the source line number * where the assert_param error has occurred. * @param file: pointer to the source file name * @param line: assert_param error line source number * @retval None */ void assert_failed(uint8_t *file, uint32_t line) { /* USER CODE BEGIN 6 */ /* User can add his own implementation to report the file name and line number, ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */ /* USER CODE END 6 */ } #endif /* USE_FULL_ASSERT */ ``` AI: You don't tell it to overwrite memory. Read the documentation carefully. The function takes in N real-valued data points, and returns N/2 complex-valued data points. Each complex-valued data point contains two real values. So both input and output vectors need to be the same size. Note that this illustrates something about the FFT: it preserves all the information in the input vector, it just shuffles it around. You can, in fact, express the discrete Fourier transform (which is just the general form of the fast Fourier transform) as a matrix multiply. So -- if you give it 2048 real numbers going in, then you need 2048 real numbers (where one complex number contains two reals) going out, or information is lost. Thus, you can reason out from first principles that your output vector is too small. arm_rfft_fast_init_f32(&fft_handler, 2048); <- 2048-point FFT float32_t FFT_buffer_in[2048]; <- Enough space for 2048 32-bit floats float32_t FFT_buffer_out[1024]; <- Enough space for only 1024 32-bit floats, not 2048. Or enough space for only 512 complex numbers based on 32-bit floats, not 1024.
H: What would it take to make a PS/2 keyboard interface hot-swap? A long time ago, I had to service some of the early Compaq Desktop PCs. They used to have fuses on the motherboard that blew when a customer hot-plugged a keyboard. I found this when googling on the topic: The keyboard or mouse should not draw more than 275 mA from the host and care must be taken to avoid transient surges. Such surges can be caused by "hot-plugging" a keyboard/mouse (ie, connect/disconnect the device while the computer's power is on.) Somehow, un-plugging or plugging in a keyboard can cause a surge. I don't recall having these issues with serial ports (RS-232, Appletalk, etc), parallel ports, VGA, etc. I've always wondered. Why is there a surge risk here? What would have to change to make a PS/2 keyboard interface capable of hot-swap? AI: Somehow, un-plugging or plugging in a keyboard can cause a surge. I don't recall having these issues with serial ports (RS-232, Appletalk, etc), parallel ports, VGA, etc. These don't power the equipment on the other end. What would have to change to make a PS/2 keyboard interface capable of hot-swap? There has to be a way to limit current to prevent a faulty device from shorting the power supply and frying the motherboard or simply crashing the PC due to a shorted +5V rail. Even if the device is not faulty, if it has a big enough capacitor, connecting it could cause inrush current and a dip on the +5V rail which could cause a crash. A fuse is a crude way to do this. USB was designed as hotplug, so it uses active current limiting. There is a whole family of chips to handle this. Here is an example. Texas Instruments TPS2001D USB Power Distribution Switch is intended for applications where heavy capacitive loads and short circuits are likely to be encountered, such as USB. The TPS2001D limits the output current to a safe level by operating in a constant-current mode when the output load exceeds the current limit threshold. This feature provides a predictable fault current under all conditions. The fast overload response time eases the burden on the main 5V supply to provide regulated power when the output is shorted. It also provides a FAULT signal to the computer so it knows what's happening. To make PS/2 hotplug, that wouldn't be enough though. You'd need a connector that makes contacts in a specific order: ground, then power, then signals. USB does this by making the pins that should make contact first longer. Without this type of connector, power and/or signal can make contact before ground, which means the device will receive IO signals before it has power, ESD protection diodes in the device and/or host will conduct current and it will power itself through its digital IOs, which can lead to fried ESD diodes, or worse latch-up. This requires special mitigation measures. Also, you'd need the software in the PC to handle hotplug and register that a device has been plugged. With USB this is easy, the chipset does it automatically and raises an interrupt when a device is detected. EDIT: Also an important part of the USB connector is the shield makes contact first, so any ESD event happens between shields and signal pins are not involved. This is probably the case with PS2 too, since the shield protrudes quite a bit. The absolute worst case hotplug connectors are RCA audio (signal connects before ground), and of course the audio Jack (signal connects first AND all pins short together during insertion).
H: Is this BJT reverse \$\beta\$ believable? Looking at the manufacturer's spice model for the Rohm 2SC4713 BJT, I was struck by the high reverse \$\beta\$: BR=123.13 Is a value this high believable or an obvious misprint? Typically BJTs have a reverse \$\beta\$ value somewhere in the range 1 to 10. Possibly the best way to find out is buy a device and test it! AI: Heterojunction bipolar transistors (HBTs) feature high reverse current gains. The HBT are devices that have in their base region the semiconductor with a different bandgap than in the other regions. For example, Infineon's BFP840FESD (citing the product datasheet: The BFP840FESD is a discrete RF heterojunction bipolar transistor (HBT) with an integrated ESD protection suitable for 5 GHz band applications ), well, Infineon's BFP840FESD can have a BR=108 with BF=946.1, as one can see in the BFP840FESD model: GBJT 22 11 33 44 ID="Q1" TNOM=25 IS=2.009e-016 BF=946.1 & NF=1 VAF=300 IKF=0.1993 ISE=6.26e-015 NE=2 BR=108 & NR=1 VAR=1.288 IKR=0.0007328 ISC=8.126e-016 NC=2 & RB=17 IRB=0 RBM=1 RE=0.05 RC=4.145 XTB=-2.276 & EG=1.11 XTI=0 CJE=1.3e-013 VJE=0.6 MJE=0.5 TF=7.494e-013 & XTF=17.49 VTF=0.5295 ITF=1.025 PTF=4.667 CJC=1.1e-014 & VJC=0.67 MJC=0.88 XCJC=0.4894 TR=1.793e-009 CJS=3e-013 & MJS=0.5 VJS=0.7 FC=0.352 KF=6.4e-012 AF=1.44 Of all the HBT flavors with this feature (abrupt junction, graded junction, graded base, double HBT), this feature is most pronounced in the double heterojunction bipolar transistor: BR ~ BF. The double HBT is a symmetrical device like unipolar transistors, although the HBT is definitely bipolar using both majority and minority carriers for the device operation. See the slides of the Purdue University course ECE606, Solid State Devices, Heterojunction Bipolar Transistor, pages 20 and 24. Disclaimer: I have not found any evidence in the documentation indicating that the 2SC4713K is an HBT device.