text
stringlengths
83
79.5k
H: Would inductor energy reduce to zero in this case? I would like to ask about this example. Initially switch at position a and then when current reaches some constant value then it's switched to b. I'm interested in what happen in real life. Someone said that when you switch from a to b, there is a time when the switch is open/floating (R is infinity) so the current is reduced to zero before the switch touch b. Do you agree with this? For what condition the ideal model (no loss in inductor energy when switch switch from a to b) is valid? AI: When switch goes from a to b with open circuit inductor voltage goes towards infinity until the switch arcs. This means the energy stored in the inductor is transferred into an arc energy unless switched very fast. V=Ldi/dt and dI/dt is infinite for dry contacts if you ignore switch capacitance. (_ pF) If switch moves instantly then it might look like this with T=R/L [s] Real-world simulation of 5V logic with RL load at 100 kHz since 5V logic is about 50 ohms +/-50% using 10 load gives different results and exceeds rated current but is closer to ideal switch and demonstrates T=R/L time constant.
H: How does temperature compensation work for pellistors in Wheatstone bridge? Pellistors are used to detect combustible gases. Basically, the gas is burned inside the pellistor and the heat released will change the resistance of the detection element. The concentration of the gas is therefore transduced into the variation of the resistance. Several datasheets/articles (eg. VQ548MP Datasheet, Understanding catalytic LEL combustible gas sensor performance) mention a compensator (a compensator in this case is simply an inert detection element) should be used to eliminate the effects of ambient temperature changes, since the variation of ambient temperature would also change the resistance. The article says: Because the two beads are strung on opposite arms of the Wheatstone Bridge circuit, the difference in temperature between the beads is registered by the instrument as a change in electrical resistance. However, I can't see how it measures the difference in temperature. According to the circuit below (suppose \$ R_1 = R_2 \$, and \$\Delta R\$ is the resistance change caused by gas combustion, \$ R_D = R_C + \Delta R\$): $$ V_{out} = V_{DC} \cdot (\frac{1}{2} - \frac{R_C}{2R_C+\Delta R})$$ \$R_C\$ can be affected by the ambient temperature and is not known. So the compensation is not working in this case. Or was the circuit drawn wrong? Because it says the two beads are strung on opposite arms of the Wheatstone Bridge circuit. If we put the compensator in the place of \$ R_2\$: $$V_{out} = V_{DC} \cdot (\frac{R_C}{R_C+R_1}-\frac{R_1}{R_1+R_C+\Delta R})$$ I still can't see how it compensates. AI: \$R_C\$ can be affected by the ambient temperature and is not known. It is known: its purpose is to be at the same ambient temperature, and thus have the same resistance. The idea is that you have two identical sensors. Both are exposed to the same ambient temperature, and installed so they have same thermal conductance to ambient. But only one of them is reacts to gas (e.g. is exposed to gas, or is coated with the catalyst, etc.). The ambient temperature changes will not destabilize the bridge, since both beads will change their resistance the same due to ambient changes. Only the temperature difference between the two beads will be measured, and that temperature difference will be due to additional heat provided by the oxidation of the combustible gas on one arm of the bridge. And that's what you want to measure :)
H: Signal Dimensions in Simulink I'm using R2022a, in Simulink I can not find the Display tab to access Signals & Ports>Signal Dimensions. Could someone point me in the right direction please?. Also, in the figure below the dimensions are 5x1. The signals are () = 5 sin(210), how was the 5x1 dimension determined by the program? What are the parameters that affect the signal dimension? Thanks in advance. AI: The signals are () = 5 sin(210), how was the 5x1 dimension determined by the program? In MATLAB everything is a vector. If you try to write the following code x = cos(2*pi*t); MATLAB will complain, because it doesn't know what t is. You need to first define t as a vector (or a number) if you want to use it. fs = 20; %Define sampling frequency t = 0:1/fs:2-1/fs; %Create time vector with 1/fs increment x = cos(2*pi*t); %Create function vector from t plot(t,x) x and t have the same dimensions. You can find the dimensions of a vector using the size command. In my case, I get >> size(t) ans = 1 40 because my t vector has 1 row and 40 columns. This is what a signal dimension in MATLAB is. I can not find the Display tab to access Signals & Ports>Signal Dimensions. Could someone point me in the right direction please?
H: Measure capacitors in parallel and series to increase precision? I measure a capacitor \$C_1\$ with an instrument that has a tolerance of measurement \$\pm 5\%.\$ I do the same with another cap \$C_2\$. Then I put \$C_1\$ and \$C_2\$ in parallel (values add up) and measure both of them with the same instrument. Did I just dropped the tolerance to \$\pm 2.5\%\$? Can I compute (manually calculate) this way a new value of both \$C_1\$ and \$C_2\$ with a higher precision? (\$2.5\%\$) I've just done some math and it seems unlikely. It's counterintuitive! (sad face). So here's the thing. When I ADD on paper the values of \$C_1\$ and \$C_2\$, their tolerances don't add up, contrary to what I thought. It still remains \$5\%\$. Then when I MEASURE the same capacitors in parallel, I get the MEASURED value of the sum, with the same tolerance \$5\%\$ as the one CALCULATED by hand on paper. So I win nothing. I get nothing. However, my intuition tells me that all this is wrong. My intuition tells me that I CAN INCREASE THE PRECISION OF MEASUREMENT by multiple configurations of same two capacitors. Hear me out. All the theory books tells us, that in order to increase the precision of a measured thing, you measure it repeatedly and average out the results. The more measurements, the higher the precision, the closer you get to the REAL VALUE OF THAT THING. That is in theory. However, in practice, as usual, things are slightly different. I want to increase the precision of measurement of 2 capacitors with a digital \$LC\$ meter model LC100-S which has a tolerance of every measurement within \$5\%\$ of the REAL VALUE (\$+\$ or \$-5\%\$). If I measure the same capacitor 10 times, I get the same value each and every time. So you can throw the theory books out the window on this one. Contrary to what the math tells us, my intuition tells me I CAN INCREASE THE PRECISION OF MEASUREMENT and decrease the tolerance from \$5\%\$ to a much lower value. If I measure the two capacitors \$C_1\$ and \$C_2\$ in parallel and in series, I can determine their values and average those values with the values measured individually. Thus I get a much closer value to the TRUE REAL value. WILL IT WORK? How do I do it? AI: Further edit: in order to answer the observations of Antonio51 and the one of the Asker, I've added some notes on the real structure of the reading precision of instruments (which is independent from the instrument being analog or digital) and on the LC100-S LC meter. The answer The calculations are formally impeccable: however the conclusions are flawed by a (quite common) misconception related to the meaning of the (so called) percentage error. Percentage error is only a means to express the absolute error in a more compact way: precisely, when I say that an instrument as an error of \$\pm 5\%\$ I mean it has an absolute error of \$\pm 5\%\$ of its full scale value(s). Thus, if your \$LC\$ meter is set to measure a full scale maximum value of say \$10\text{nF}\$ and you measure a capacity \$C_1=7\text{nF}\$, it is not correct to say that the value of \$C_2\$ lies in the interval \$(7\pm 0.35)\text{nF}\$. The \$\pm 5\%\$ error really means $$ C_1 \in (7\pm5\% \mathbf{fs})\text{nF}=(7\pm0.5)\text{nF}\label{1}\tag{1} $$ where \$\pm5\%=0.5\text{nF}\$ is the absolute error of the given instrument for that full scale value. In sum, the increase of precision of the measured value in your reasoning is due to the fact that a constant \$\pm 5\%\$ error on the measured value(s) is assumed, which is not true. Notes The complete structure of reading precision, for an analog or digital mesuring instrument. The above formula comes from the following, exact one $$ v_\text{true} \in \big(v_\text{read}\pm e_\% \mathbf{fs}\pm 1\text{lsf}\big), \label{2}\tag{1'} $$ where \$v_\text{true}\$ is the "true" value of the quantity to be measured. \$v_\text{read}\$ is the value given by the instrument, \$e_\% \mathbf{fs}\$ is the absolute error, or the precision of the instrument, \$1\text{lsf}\equiv 1\$ unit on the least significant figure is the reading error i.e. the one done when you read the value on the display of the instrument. It can be the single graduation in the graded index of an analog instrument, or a "\$1\$" one on the least significant digit of your digital instrument. In any case, the reading error is never a constant percent of the read value: values near to the low side of the range are measured with a significantly worser precision than values near to the high side. The applicability of formulas \eqref{1} and \eqref{2} to a digital instrument. Answering to Niculae's comment, let's see why these formulas are respectively nearly exact and exact by analyzing their application to the LC100-S, which thus is no exception to the rule defined by formula \eqref{2}. This nice instrument offers a reading with four significant digits and an autorange function. This means that, for the case of a capacitance measurement, you have for example the following ranges automatically switched $$ \begin{array}{|c|c|} \style{font-family:inherit}{\text{Reading}} & \style{font-family:inherit}{\text{Full scale }(\mathbf{fs})\text{ range}} \\\hline 5.00\mu\text{F} & 10.00\mu\text{F} \\\hline 7.00\text{pF}. & 10.00\text{pF} \end{array} $$ In the first case we have $$ C_\text{true} \in \big(5.00\pm 0.1\pm 0.01\big)\mu\text{F}= \big(5.00\pm 0.11\big)\mu\text{F}\simeq \big(5.00\pm 0.1)\mu\text{F}, $$ while in the second case we have $$ C_\text{true} \in \big(7.00\pm 0.1\pm 0.01\big)\text{pF}= \big(7.00\pm 0.11\big)\text{pF}\simeq \big(7.00\pm 0.1)\text{pF}, $$ Thus, equation \eqref{1} and \eqref{2} are respectively nearly exact and exact also for digital instruments, in particular for the LC100-S: therefore the objection contained in my answer remains valid.
H: What determines the current flow in a load? If we apply a load of 100KVA to a 100 volts source, we will get 1000 amperes of current through it. If we apply the same load of 100KVA to a 1000 volts source we will get 100 amperes of current in the load. If voltage is high load will draw less current and if the voltage is low load will draw more current. How does the load do that? What is in the load that draws the current according to the voltage? The load itself is not a living being so how does the load have that sense to draw current according to voltage? AI: You can buy a programmable load. Most are intelligently controlled, and work by measuring the applied voltage, then switching load elements in or out to draw an appropriate current. I used one that had 'constant resistance', 'constant current' and 'constant power' settings. It was even fast enough to work with a mains AC waveform, and program the current to mimic a limited range of non-unity power factors. Such a load would be able to draw constant power, if it had been designed to work over the required range of voltage and current. Most loads that you meet are not like this however. Constant resistance loads will tend to draw power as the square of the applied voltage. Loads with a positive temperature coefficient, metal filament lamps for instance, will tend to draw a more-nearly constant current, as their resistance goes up with the temperature. Some loads like electric arcs actually have a negative voltage coefficient, so must be stablised by an external impedance or controller.
H: What is the new constructor's argument rule in UVM? I'm wondering why some new constructor has been implemented with argument and some new constructor has been implemented with no argument in UVM as the below example. class mem_monitor extends uvm_monitor; uvm_analysis_port #(mem_seq_item) item_collected_port; // Placeholder to capture transaction information. mem_seq_item trans_collected; `uvm_component_utils(mem_monitor) // new - constructor function new (string name, uvm_component parent); super.new(name, parent); trans_collected = new(); item_collected_port = new("item_collected_port", this); endfunction : new As you can see in the above, trans_collected = new(); has been implemented with no argument, and item_collected_port = new("item_collected_port", this); has arguments. Is there any special rule for implementing new constructor? AI: The number (and type) of arguments passed to the new constructor depend on how the class was declared. You need to refer to the IEEE 1800.2 UVM documentation. trans_collected is of type mem_seq_item. Since you did not show the class declaration of mem_seq_item, let's assume it was extended from uvm_sequence_item. From this online UVM document, we see that the constructor method for uvm_sequence_item is: function new (string name = "uvm_sequence_item") This shows that there is one argument which has a default value defined. This means that it is not necessary to pass an argument to new. Note that it is a good practice to construct a sequence item using create instead of new. Refer to the documentation. item_collected_port is declared as a uvm_analysis_port, and from the documentation, we see: uvm_analysis_port#(trans) ap; ap = new("ap", this); We can infer that the 1st argument is a name string and the 2nd is a class handle (similar to uvm_component).
H: Why do UTP pairs need different pitches? Why do unshielded twisted pair cables need a different pitch/twist rate for every pair of wires in a cable? Most of my reading on UTP says that the pairs in a cable must have different pitch or else the benefits of UTP will be lost which is the noise cancelling. From what I understood, twisting the cables essentially ensures that both wires will be near to the noise which will be cancelled since it has differential output. I don't understand why each pairs must have different pitch, too. AI: But I don't understand why each pairs must have different pitch, too. The different twist pitches are to avoid one pair cross-talking with another pair. If they were the same pitch, they would produce cross-talk. It's got nothing to do with susceptibility to external local noise sources. Two closely coupled twisted pairs are shown above. The upper pair has 4 twists per unit length and, The lower pair has 5 twists per unit length. For the lower pair, its blue wire is initially closest to red (at the far left) Then, moving right, the blue wire becomes closest to neither Then it's closest to blue, Then blue again and, Finally it's closest to red. The net effect is that neither pair receives an accumulation of cross-talk from its neighbour.
H: Why does STM32CubeIDE debugger always stop on HAL_Init() I've noticed that while debugging an STM32 project using the STM32CubeIDE debugger, the debugger always stops on the HAL_Init() function call even when I don't have a breakpoint listed. This even occurs when I create a brand new project, which makes me think it's not something I'm accidentally doing in my project. Is there a way to disable this? AI: It always stops on the first line of main() so that you can manually kick it off. You can try to declare some variable above it and you'll see it stops there instead. It feels annoying at first, but it allows you to click "debug" in IDE, start debugging, and while it's on the first line, you can always set up some testing stuff, after what you're literally one click away from running the code without any waiting. Especially handy if your hands are both full and you need to click "debugging" with nose (true story). Quick controlled start of the program.
H: How Sleeve Balun works? How does sleeve balun (Balance to Unbalance) works? In the setup below, the ground and signal of the coaxial cable is connected directly to the antenna which is wrong since coaxial is unbalanced while the antenna is balanced. But I don't understand the reason why adding the quarterlength copper sleeve essentially acts as the Balun for the coaxial and the antenna? AI: The sleeve balun acts as an RF choke, preventing RF current from flowing on the outside surface of the coaxial cable shield. It helps to think of the sleeve and the outer surface of the coaxial cable shield as the outer and inner conductors of a coaxial line. Because it's shorted at the lower end and is one-quarter wavelength long, it presents a high impedance at the upper end. It's not nearly as broadband as a true balanced-to-unbalanced transformer constructed with coils wound on a ferrite core, but for single-frequency use, the sleeve is simpler to build, lower in loss, and can handle higher power, than the transformer-based balun.
H: Is ESP32's GPIO25 Pin adc1 or adc2? I am trying to design a PCB with ESP32 and a Lora module I want to use serial1 for Lora RX/TX communications. I saw a board which is using GPI35 to Lora RX and GPIO25 to Lora TX. But in same time generally I am appearing that note also: Note: ADC2 pins cannot be used when Wi-Fi is used. So, if you’re using Wi-Fi and you’re having trouble getting the value from an ADC2 GPIO, you may consider using an ADC1 GPIO instead. That should solve your problem. well if I check GPIO25 is adc1 or adc2 there two different pinout. pinout1 wrover it says 25 is adc1 pinout2 Wroom and it says 25 is adc2 So I am not sure GPIO25 is ADC1 or ADC2? who can tell the true story of GPIO25? More importantly, if I use GPIO25 as tx, will it be a problem when wifi is on, referring to the above note? and this is my ESP32 AI: Those two boards are different: one is built using the ESP32-WROVER module, the other one using the ESP32-WROOM module. The datasheets are: ESP32-WROVER ESP32-WROOM In both cases, however, GPIO25 is connected to channel 8 of ADC2. So the first pinout chart is likely wrong. While ADC2 cannot be used concurrently with Wi-Fi, the pins can still be used for other purposes such as digital input or output. And that's likely all you need for your case.
H: HDMI connector power port I am designing an HDMI switch with two inputs and one output. I found a multiplexer that can be used specifically for this purpose (HD3SS215) but it needs a 3.3 V power supply. Can I use the 5 V power port from the HDMI alongside a simple regulator as a power supply or not? MUX draws at most 3.2 mA so that part isn't a problem. I don't really understand the purpose of that power port so I am not sure if it can be shared. AI: HDMI cables typically source +5V. You could diode 'or' the +5 from each port if you like then add a small cap as dictated and your regulator. Use that 3.3V to power the chip. Do not forget to connect grounds. The reason for the diodes is to prevent any system back feeding another unit especially if its power is off.You could use MOSFETs for the 5V isolation and then use the 'or' output to power your regulator.
H: USB to 2.4v receiver power reducer I am trying to power a small receiver with a USB pack it shows 5v coming from the USB and it says max 3.5v coming into the receiver. I know somewhere there is an inline reducer to step down as not to damage the receiver. Plugs are USB to 2.1mm plug. I think I just need to find a small reducer and solder it inline. Does anyone have any feedback on it? Note: I have been using two D cells to power the receiver for a long time, but they drain too fast. AI: Not knowing your resources or skill set I will take a SWAG: You state a small battery operated receiver, so I am assuming it is not a big power user. There are many ways you can go. You can search Aliexpress, azon, and others for step down module. Also searching for "3V from USB" will yield a lot of results. They also make wall warts with the 3v3 output voltage or 5V USB power. They also make USB to TTL cables that have a 3.3V output, maybe that would work. Let us know how it works for you.
H: Half-wave rectifier with filter and clipped input signal in oscilloscope When building a half-wave rectifier with a capacitor filter for my electronics lab, there was significant clipping at the peaks of the input signal. When looking at the .csv file pulled from the oscilloscope, these "clippings" are filled with #'s. I interpret this as the oscilloscope isn't getting any data at these peaks and is just attempting to fill in the blanks on the trace. What is the reason for this? The setup is a simple half-wave rectifier using a 1N4148 diode, a load resistance of 2.2kΩ, and 500Ω. The input signal is a 5V peak-to-peak sine wave with a frequency of 60Hz. The goal is to adjust the capacitance from 100μF to obtain a ripple factor of less than 5%. I have noticed the most significant clipping when using a 500Ω paired with a 669μF capacitor. I attached an image below of the traces and LTSPICE schematic as well as probe locations. As you can see, the clipping is around ~0.75 volts at the peaks. Is there any decent explanation for this? The oscilloscope is a 4-channel Keysight DSOX variant (I don't have access to the exact model right now but it is similar to the DSOX2024a). The function generator is a Siglent technologies waveform generator (likewise, don't have access to the exact model). AI: The clipping is a result of the output resistance of the function generator. The majority of function generators have 50 ohm output resistance. So there is effectively a 50 ohm resistor in series with a perfect voltage generator. When the diode conducts the current flowing will cause a significant voltage drop across that output resistance resulting in the the clipping that you are seeing.
H: Trouble reading a variable inductor (tunable RF coil) datasheet I have a trouble reading this datasheet for the Coilcraft 7mm Tunable RF Coils – 146, 150 Series. I see there are two main types of such inductor: with shield can and without it. I'm going to buy one without it. This picture is what bothers me. On the upper right picture you see those small circles with 'start' and 'finish' notes, which present the pins. First question is a very basic one. When you look at Recommended Board Layout, why are these pins mirrored? My assumption is that's because this board layout is meant to present the footprint of an opposite side of the PCB, so one side of it is where elements are, the other side is where connections most of the times are, and so when planning connections I should use this mirrored layout, and that's why it's here. Am I correct? The second question is about those larger holes on the board layout. It says that the left one is "for shield can tabs", but for the second one it doesn't say anything. So when using unshielded styles, can both of those large holes be ignored, or only the left one? AI: Usually these days we lay out boards as if we were looking down through the board from the component side. Many years ago, with single-sided boards, it was not uncommon to lay out boards using sticky donuts and tape looking at the copper side, but that's not really the way it's done today. As far as the the shield tab holes go- it's not uncommon to only label one feature on a mechanical drawing when there are obvious symmetrical features that are the same size. Sometimes the number is specified (eg. 2pl), sometimes not. So you don't need either of the holes if there is no shield. Note the description is plural. Of course if you like to avoid issues, it's always best to have a sample of the part in your hand as a double check.
H: Write to flash in STM32 - Works only one time, second time gives error I have two functions and I begin to call the function STM32_PLC_Flash_Set_ADC_Gains_For_Configuration_Index_0(uint8_t gain) first. It gives status == HAL_OK. But after that when I call STM32_PLC_Flash_Set_ADC_Gains_For_Configuration_Index_1(uint8_t gain). It gives status == HAL_ERROR. Why does this happen? #define ADDR_FLASH_PAGE_127 ((uint32_t)0x0803F800) /* Base address of Page 127, 2 Kbytes */ void STM32_PLC_Flash_Set_ADC_Gains_For_Configuration_Index_0(uint8_t gain){ HAL_FLASH_Unlock(); HAL_StatusTypeDef status = HAL_FLASH_Program(FLASH_TYPEPROGRAM_HALFWORD, ADDR_FLASH_PAGE_127 + 4, gain); if(status != HAL_OK) Error_Handler(); HAL_FLASH_Lock(); } void STM32_PLC_Flash_Set_ADC_Gains_For_Configuration_Index_1(uint8_t gain){ HAL_FLASH_Unlock(); HAL_StatusTypeDef status = HAL_FLASH_Program(FLASH_TYPEPROGRAM_HALFWORD, ADDR_FLASH_PAGE_127 + 6, gain); if(status != HAL_OK) Error_Handler(); HAL_FLASH_Lock(); } I have tried to call STM32_PLC_Flash_Set_ADC_Gains_For_Configuration_Index_1(uint8_t gain) first, then I get status == HAL_OK. After that I call the same function again (STM32_PLC_Flash_Set_ADC_Gains_For_Configuration_Index_1(uint8_t gain)), then I get status == HAL_ERROR. So why can I only call HAL_FLASH_Program once? Update: Here I get the HAL_ERROR value. See the arrow. HAL_StatusTypeDef HAL_FLASH_Program(uint32_t TypeProgram, uint32_t Address, uint64_t Data) { HAL_StatusTypeDef status = HAL_ERROR; uint8_t index = 0U; uint8_t nbiterations = 0U; /* Process Locked */ __HAL_LOCK(&pFlash); /* Check the parameters */ assert_param(IS_FLASH_TYPEPROGRAM(TypeProgram)); assert_param(IS_FLASH_PROGRAM_ADDRESS(Address)); /* Wait for last operation to be completed */ status = FLASH_WaitForLastOperation(FLASH_TIMEOUT_VALUE); if(status == HAL_OK) { if(TypeProgram == FLASH_TYPEPROGRAM_HALFWORD) { /* Program halfword (16-bit) at a specified address. */ nbiterations = 1U; } else if(TypeProgram == FLASH_TYPEPROGRAM_WORD) { /* Program word (32-bit = 2*16-bit) at a specified address. */ nbiterations = 2U; } else { /* Program double word (64-bit = 4*16-bit) at a specified address. */ nbiterations = 4U; } for (index = 0U; index < nbiterations; index++) { FLASH_Program_HalfWord((Address + (2U*index)), (uint16_t)(Data >> (16U*index))); /* Wait for last operation to be completed */ status = FLASH_WaitForLastOperation(FLASH_TIMEOUT_VALUE); <--- HERE! /* If the program operation is completed, disable the PG Bit */ CLEAR_BIT(FLASH->CR, FLASH_CR_PG); /* In case of error, stop programming procedure */ if (status != HAL_OK) { break; } } } /* Process Unlocked */ __HAL_UNLOCK(&pFlash); return status; } Update 2: I get the error here. Error code is: 1. See the arrow. HAL_StatusTypeDef FLASH_WaitForLastOperation(uint32_t Timeout) { /* Wait for the FLASH operation to complete by polling on BUSY flag to be reset. Even if the FLASH operation fails, the BUSY flag will be reset and an error flag will be set */ uint32_t tickstart = HAL_GetTick(); while(__HAL_FLASH_GET_FLAG(FLASH_FLAG_BSY)) { if (Timeout != HAL_MAX_DELAY) { if((Timeout == 0U) || ((HAL_GetTick()-tickstart) > Timeout)) { return HAL_TIMEOUT; } } } /* Check FLASH End of Operation flag */ if (__HAL_FLASH_GET_FLAG(FLASH_FLAG_EOP)) { /* Clear FLASH End of Operation pending bit */ __HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_EOP); } if(__HAL_FLASH_GET_FLAG(FLASH_FLAG_WRPERR) || __HAL_FLASH_GET_FLAG(FLASH_FLAG_PGERR)) { /*Save the error code*/ FLASH_SetErrorCode(); return HAL_ERROR; <--- HERE! } /* There is no error flag set */ return HAL_OK; } Error codes: #define HAL_FLASH_ERROR_NONE 0x00U /*!< No error */ #define HAL_FLASH_ERROR_PROG 0x01U /*!< Programming error */ #define HAL_FLASH_ERROR_WRP 0x02U /*!< Write protection error */ Minimal working example: When I call this, at the startup (before while(1) in main.c) then I get the error. HAL_StatusTypeDef status = HAL_FLASH_Unlock(); if(status != HAL_OK) Error_Handler(); uint16_t prescaler1 = 100; status = HAL_FLASH_Program(FLASH_TYPEPROGRAM_HALFWORD, ADDR_FLASH_PAGE_127, prescaler1); if(status != HAL_OK) Error_Handler(); <--- HERE! status = HAL_FLASH_Lock(); if(status != HAL_OK) Error_Handler(); Same error code 1 == HAL_FLASH_ERROR_PROG AI: In flash memory, you can only write bit "0" over "1". Therefore, you can only write something to the memory cell if and only it's 0xFFFF (16-bit half-word), otherwise you get an error flag PGERR in the flash status register that's Set by hardware when an address to be programmed contains a value different from '0xFFFF' before programming This explains why you could write it the first time, but not the second time. While memory address was erased - it had 0xFFFF - you could write to it once. But once it's written, you can't simply overwrite it, you need to erase it first. You can only erase flash in pages or entirely, there is no mechanism to erase a memory under a single address. Therefore, you need to erase the page that contains the memory address that you want to write to. Obviously, everything on the page will be erased, so if you want to change only some data on the page, you'll have to read it out before erasing and write it back there. As you can see, Flash is not exactly well-suited to hold small changing values, it's much better for more static chunks of data, such as your very program. Make sure you check Flash life expectancy - how many write/erase cycles it can take. No need to worry about it while you're just practicing, but it's not something you can safely forget.
H: Find output current for a non-ideal op-amp This is a past paper question. I can find a expression for output current (\$I_O\$) if the op-amps are ideal but I cannot understand how to solve it if the op-amps are non-ideal. AI: EE&O, but I cannot understand how to solve it if the op-amps are non-ideal. For example, here is a Maple sheet ("brute force") for this case. One can also take the "limit" for all functions when Ao -> infinity, for the ideal case.
H: Deep discharge protection of LiFePo4 cell with a single MOSFET with the right threshold voltage Is it possible to build a deep-discharge protection circuit for lithium based rechargeable batteries by putting a simple enhancement mode MOSFET with a threshold voltage that is equal to the discharge voltage (e.g. 2.5 volts for LiFePo4 cells) in line with the load? The circuit need not carry more than 1A I guess. A first simulation (with the first reasonably suitable MOSFET I have found in the library) in LTSPICE seems to work. R1 is the load. If that is so easy, why doesn't everybody do it that way? Am I missing something? To the background of my question: because I have long been sick of constantly juggling throw-away alkaline batteries for my WiiMote controllers, I have ordered myself 14500-type LiFePo4 batteries (Nickel based rechargeables are not an option because they have lower average voltage 1.2 V, which the WiiMote doesn't seem to like). Since they have a nominal voltage of 3.2 volts, one such cell is able to replace two alkaline batteries at 1.5 volts (I assume the WiiMote has a margin of safety for overvoltage). And it supplies more constant voltage than the alkalines, allowing to use more of the capacity until the WiiMotes refuse to work. But then I have to protect the LiFePo4's against deep discharging below 2.5 volts. There are some small BMS boards from China, but they are more expensive than the batteries themselves and take a month to deliver (and maybe a few years more in times of Chinese Corona). Moreover, I don't need protection against overcharging or overcurrent, let alone cell balancing. Just plain and simple deep discharge protection. I know there are dedicated IC's for that out there, but I would prefer a true minimalist solution. AI: I can see several points to take into account (some of them seem quite near a red flag for a commercial application, but it might be OK for a one time project). Lets look at the datasheet of the Si7336ADP you use in your simulation : p2 : Gate Threshold Voltage (Tj=25°C, VDS = VGS , ID = 250 μA) : min=1V, max=3V : the threshold voltage is very badly defined (even when fixing 3 parameters) : if it happens to be 1.0V, you destroy your mosfet. If it happens to be 3.0V, you loose a lot of capacity of your battery. NB : it is not specified on what this value depends: it might be part-to-part variability (then you can test your part and use it if you are happy with it), or it can be changing with some parameters (aging, magnetic field, or whatever else) in which case, you might test it succesfully one day, and it might have a totally different value the next day. p2 : figure "Transfer Characteristics" : as you see, there is no "strong" trheshold : so you have a whole range of voltages where you will still drain some current, but probably no longer enough to power properly your device p4, figure "Threshold Voltage": as you can see, you can get some change in threshold voltage due to temperature change : nb : it is junction temperature, so it might rise far above room temperature, specially near the voltage threshold, where the "resistance" of the mosfet increases a lot current leakage : I haven't found parameters really relevant for your situation (maybe because that mosfet is intended for digital use), but it might also be an issue. So, with the mosfet you used for your simulation, the datasheet does NOT garantee that it will work properly. It might, or it might not. For commercial applications, this is a no-go (it might work on one production batch, and fail on the next one, or after aging, ...). For a hobby application, you might give it a try if you wish, knowing that it might work or not. And accepting the fact that it migt stop to work/fail randomly (NB : this includes making sure to recharge your battery with a charger that won't charge it if in deep discharge, otherwise it might catch fire if you damaged it by deep discharge)
H: Relay delay LTSpice I want to delay the time a relay turns off. I have made a simulation on LTSpice that simulates "how long" it takes for the relay to turn off. The relay is simulated using R2. I simulated the resistor R1 to vary from 100 ohms to 600 ohms in steps of 100. So for an R1 of 600 ohms, we expect the cap to discharge to 95% in 3 seconds. However, the simulation does not show this. In fact, the discharge time for all R1 values seems to be the same. Can someone help to determine what is wrong with my simulation? Edit 1: AI: It seems you a are shorting the capacitor to GND via the switch resistance (which has the default parameters). Example to set them explicitly: .model SW SW(Ron=1 Roff=1Meg Vt=.5 Vh=-.4) Check if the default threshold is not 0V. If it is, the control voltage shown is never negative. You can find more details here and here.
H: I have a valve power supply with two outputs and want to switch a built in ammeter between the two without supply interruption A valve power supply has two outputs, V1 is 700Vdc and V2 is 450Vdc. I want to switch a 300mA ammeter between the two without interrupting either supply. I attempted to use relays to switch the ammeter in and out of either circuit, but the switching action causes a supply interruption. I now want to put a low value resistor, say 1ohm, in series with each supply and then use the 300mA meter as a voltmeter to measure the voltage across the resistor. This way I can switch the meter between the two supplies without interrupting either. The voltmeter should have its own supply (say 12V which is available) for the 300mA meter. The reason for wanting to use the 300mA meter (and complicating the issue) is because its what I have on hand (old style antique) and I have already cut the hole in the chassis for it. Oh dear. AI: simulate this circuit – Schematic created using CircuitLab All 300 mA meters are simply 50 uA or 100 uA with internal shunts. I expect these are 100 uA full scale (FS) with internal shunts to any desired scale. But to convert to voltmeter with a 1 Ohm external shunt requires replacing the internal shunt after you take it apart and confirm the resistance or full scale current without the shunt.
H: How to attach ground on a breadboard from a schematic? I'm trying to build a circuit on a breadboard based on a given schematic, but I'm not sure how to "ground" components on it like how it is shown at node B: What I have done so far: What connections do I make and where do I have to make them so as to have a "ground" on the breadboard just like the schematic? (I'm a beginner at electronics so my non-ground connections may seem off, but I truly have no idea how to work with "ground" connections. I do get the concept of "ground" in theory but I'm having a hard time grasping it practically. Appreciate any help! :)) AI: Ground is usually just a convention. In some circuits it might actually be an Earth connection, but that's usually when working with mains (which is dangerous when begining in electronics,) so you won't have to wory about Earth for now. So basically, the symbol is used for just 2 things : To say "this is what I define as my reference (0V) potential", so you can say "at A, I have 10V" (for exemple) instead of havig to say "at A, I have 10V more than at B" (or "I have 10V between A and B). Usually, when we have a single DC supply, we use its "minus" as ground. In addition, if you have several ground symbols (not your case,) you know that they all need to be connected together. It is very useful on bigger circuits where you can have dozens or even hundreds of connections to ground so you don't have to draw all those lines. In your case, everything that is connected to "ground" is simply to be connected to the "minus" of your power supply. The only thing you are missing is a wire from the negative power supply to the switch. I can't say where it has to be connected to the switch.because I can't tell how the switch works just from the image. NB: The small white wire looks quite suspicious to me. Are you sure you need it? It is basically shorting the switch. Is it just the arrow in the switch you tried to implement (that arrow is just supposed to show the position of the switch, not to be an external wire.) If I'm guessing right, with that white wire when you connect the missing wire to the switch, then if the swich is on position 2, you create a short circuit! Check that carefully before powering on your circuit. If needed, ask a new question about if if you still have doubts.
H: Large capacitor at the output of high-side switch I am looking at using DIODES' AP2411 high-side switch. Their typical app circuit shows a 120 μF capacitor at the output. Is that value too high? I am going to power on and off an ESP8622 IC that can sink up to 300 mA. AI: The chip is designed for switching USB power and that requires 120uF capacitance. So it is not too high, the chip can handle it, as shown in the manufacturer datasheet.
H: Questions about relays specifications I want to use a relay to switch high power LEDs ON and OFF. Nothing out of the ordinary yet. My problem comes from the fact that my control voltage is not stable (it varies from 5V to 12V for example). Is there a way to find a relay that will safely and reliably switch ON with any input voltage in the desired range? How will this be demonstrated in the datasheets? I picked a random relay datasheet to try to understand better the concept. From my understanding and looking at page 2 for the 1 form C configuration, the 12V version of this relay would switch on as long as 9V is provided to the inductor and would turn off at less than 0.6V. It would also be safe to use this relay at 20°C as long as I don't go above 18V on the inductor side. Thank you for helping me understanding relays better. I haven't found any videos talking about these specifications. It seems like most of them only explain how to use a relay in basic Arduino circuits or something similar. If you got any good video on the subject, I would gladly watch it. Edit: Bonus question: What should the specifications for a flyback diode be? Should it's max voltage be the voltage at which the relay operates, the maximum of the voltage spike that occurs when the inductor is disconnected or something in between? AI: Mechanical relays are not designed to operate with a wide range of voltages like 2.5:1. Once you include temperature variations, they are probably reliable with +/-20% from nominal. At high temperatures (ambient + temperature rise from operation), the copper coil resistance increases and they will not pull in with a low voltage, and even if they do pull in you'll reduce the life because they are not pulling in smartly. Even nominal voltage may not be guaranteed to be sufficient if you have a special Class H high-temperature insulation relay operated near the limits! Anything more would result in an expensive and inefficient product, and relays are a very competitive cost-sensitive market. So, unless you intend to design your own relay you should modify your control voltage to fit the commercial offerings. For example, you could use a 5V relay and an LDO regulator that can withstand 12V at the input. With 12V in you'll be wasting the majority of power in the regulator, but at least it's an off-the-shelf parts. Or, if you have a stable supply somewhere (or can make one with a switching or linear regulator), use the 5-12V input in conjunction with a transistor to switch the relay.
H: Unclocked NOR gate SR latch not latching I am starting to learn computer architecture and decided to try building an SR latch using NOR gates and without a clock (basically copying this video) on a breadboard. My circuit is pictured, it is using an SN74LS02N IC for the NOR gates and I am powering it using a micro USB wire connected to a 5 V wall plug. I have confirmed that the IC is receiving 5.07 V, so it is within the operating range. However, when I press the set button (bottom button), the top light initially turns on, but then it turns off, either when I release the button or a few seconds after I release it, with the bottom light turning back on. I've tested around with the voltmeter and the main issue I have found is that, with the bottom button open, there is still some current flowing across it. With all buttons released, the voltage across the bottom button reads about 4.6-4.7 V instead of the full 5.07 V, with an additional voltage across the bottom pull-down resistor (220 Ω) of about 300-400 mV. The top button and resistor work as expected, with the full voltage dropped across the button when the button is released. I assume this is the source of the problem, but its solution seems to exceed my abilities right now. I have tried using different buttons, resistor values, ICs, and even breadboards, so I don't think it is a problem with the components. Does anyone see any problems with what I have done or have suggestions for what I can try next? AI: The LEDs are connected to output directly without series resistors. The high output of an LS TTL gate is very weak so it does not do much damage to the LED or the chip. But note that the outout goes to a LED and another input pin. The red LED will limit the voltage to about 1.6V, which is below the minimum voltage of 2.0V that the input needs to reliably work.
H: What's wrong with my wire connections? (LED strips only getting ~1 V) I'm trying to make an LED strip work, with these parts: A WS2812B LED strip (60 LEDs/m), 5V An Alitov 5V 15A power supply An Arduino Nano My issue is that the strip isn't getting the 5v it requires. The arduino is just running simple code to show all white LEDs. See below pictures for my wiring: As you can see, it's measuring around 1 volt across the 5v and GND terminals at the start of the strip. This seems... very wrong. When I rotate the barrel plug adapter, the LEDs flicker red a bit, and I've measured up to 1.6V in brief moments. I don't know if it's my barrel adapter, or the power supply, or even the way I'm inserting the wires into the barrel adapter? The weird part is this used to (mostly) work fine. edit: as per comments, I measured the voltage on the barrel adapter and it's 5.19V so that seems fine. However, when the wires are inserted, it drops to ~1V. Here's how I'm putting the wires into the adapter: I fold them back so there's no exposed wire hanging out of the adapter. I screw down the adapter's screws and it's plenty tight; the wires won't come out, but still not enough voltage. I've also tried un-folding the wires and sticking them in straight, same result. AI: You either have a bad connection, high resistance, or a short/faulty component. Or a bad power supply. Replace the wires and or try with a different part. That's essentially the only troubleshooting. Longer explanation, check solder joints, make sure the wire is the right guage for the adapter or it won't connect/squish down correctly.
H: How can I calculate the max. allowable load for my reference voltage? I have a 2.5V reference voltage set up like so: I want to determine how many ohms in load this 2.5V can bear before the TL431 is unable to hold the voltage. I know that this IC requires 500uA to 1mA in order to regulate the voltage. How would I go by calculating this? AI: You need to make sure that the IC gets 1mA for it to be guaranteed to work. That means that a load between 2V5 and ground must not draw more than the current through R minus 1mA, which you can easily calculate. Then convert that to a resistance. If this is a homework problem you are (probably) done. If you are doing a worst-case design for high reliability you would also consider the tolerance and temperature coefficients of R, the maximum voltage of the TL431 and the minimum voltage of the nominal 5V supply. If the reference is called upon to sink current (which is not as typical), then refer to the datasheet current limit and thermal properties.
H: Where should I place the ammeter to measure current flow between A0 and GND of the Arduino here I was trying to build a circuit in tinkercad that plots the voltage/current across A0 and GND pins of Ardunio. To confirm that the plots displayed on the screen are correct, I decided to also add voltmeter/ammeter to the circuit. The circuit that came into my mind for it is: simulate this circuit – Schematic created using CircuitLab My tinkercad implementation of it is shown below (I used a 3V battery and a potentiometer together, for obtaining variable voltage): Double click on the image to zoom, if it's not clear It seems to be working well while plotting the voltmeter readings, but I am not able to make the ammeter measure currents at all. Its readings are always coming out zero, for all voltage values. As far as I can see, it is connected in series like it should be. What is the problem here? The schematic diagram generated for the above circuit is: Edit: made modifications as suggested by @Javier Gonzalez Cuervos AI: Where should I place the ammeter to measure current flow between A0 and GND of the Arduino here You placed it correctly, and this current is zero. If, instead you and to measure the current flowing in the circuit, see below: The wires with blue Xs have practically zero current. The current circulating is fixed: \$\frac{3}{50+501} = 5.4 mA\$ The voltage you measure at A0 varies from 0V to: \$ \frac{3\times500}{500+51} = 2.72 V\$ which is the output of the voltage divider. Note that if you measure the current where there is one, tinkercad shows this (two potentiometer settings): But no current in this wire:
H: Why do we use low frequency with copper wires and high frequency with air and optical fibers? The bandwidth of twisted pair copper wire is low. Why can low frequencies propagate longer distances through copper wires than high frequencies? On the other hand, high frequencies can propagate long distances through air and optical fibers. Is the bandwidth distance product formula applicable to air, or just to wired transmission such as copper wire and optical fiber? How is the bandwidth distance constant calculated for each medium? If the bandwidth is regulated across the different systems, then what distance is used to calculate the bandwidth-distance constant? AI: A twisted pair (or a coax cable for that matter) can be viewed either as a wire, or as a two-conductor waveguide supporting the TEM mode, and ideally only the TEM mode. When the frequency reaches the cutoff frequency \$f_c\$ of the first spurious mode, then the cable begins experiencing severe dispersion since multiple modes of different group velocities are now propagating down the waveguide. Likewise, the manufacturing tolerances of twisted pair cable play a role; the kinds of mechanical imperfections that we expect on a typical twisted pair due to manufacturing, bending, etc become fairly severe for high frequencies. If the wavelength of the signal (as guided on the twisted pair) comes close to the mechanical pitch of the twist, then the twisted pair also loses a lot of its benefits w.r.t. rejection of external fields. The bandwidth distance product relates to dispersion, i.e. frequency-dependent group delay. To the best of my knowledge, un-ionized air does not encounter much of this issue, although signals passing through the ionosphere may encounter ionospheric dispersion. The bandwidth-distance product is a figure of merit for optical communication systems, and is highly dependent on the actual physical properties of the fiber and the choice of modulation scheme. It is very likely an empirical measurement taken from experimentation on a fiber system (or simulation, if the precise dispersive properties are known).
H: Buck converter with interleave yields wrong output voltage in simulation It isn't obvious to me how to solve this by hand (if anyone knows I am very interested), so I thought of simulating it instead. We need to know some values, though: Duty cycle of switch A \$D_A = \frac{V_{in}}{V_{out}} = \frac{30\text{V}}{130\text{V}} = \frac{3}{13}\$ Duty cycle of switch B \$D_B = 1-D_A = \frac{10}{13} \$ Switching period \$T=\frac{1}{f_{sw}} = \frac{1}{350\text{kHz}} = 2.857\text{us} \$ Inductor values \$L_1 = L\cdot 1.2 = 18\text{uH}\$, \$L_2 = L \cdot 0.8 = 12\text{uH} \$ SW_A and SW_B must not conduct simultaneously, so SW_B has to be delayed by \$\tau = D_AT \$. Using these values in a simulation should give me what I'm looking for - but it is not. For some reason, the voltage in the simulation is oscillating and is not 30V. Why do I not get the desired 30V at the output? Note that I have chosen generic values for \$C_1 \$ and \$R_{\text{load}} \$ and have used switches as ideal MOSFETS in the LTspice simulation. AI: The \$T_{ON}\$ time is \$\frac{1}{350kHz} \times \frac{30}{130} = 0.6593µs\$. The current ramp will be equal: \$ΔI_L = \frac{V_L}{L} \times T_{ON} = \frac{100V}{15µH}*0.6593µs = 4.395A\$. Thus the load current should be large than 4.395A (because we have two phases), thus RL_min = 6.8Ω to stay in CCM. And your simulation does not work because you are wrongly controlled the switches. The duty cycle should be the same in both switches (A and B). Try to set the same duty cycle in both switches. And add to switch B Tdelay = 0.7µs. Also do not forget to add a freewheeling diode across your switches. The synchronous switch version LTspcie file (.asc) Version 4 SHEET 1 1004 760 WIRE -240 32 -304 32 WIRE 32 32 -240 32 WIRE 288 32 32 32 WIRE 32 64 32 32 WIRE 288 64 288 32 WIRE -64 80 -80 80 WIRE -16 80 -64 80 WIRE 208 80 192 80 WIRE 240 80 208 80 WIRE -304 96 -304 32 WIRE 32 192 32 144 WIRE 96 192 32 192 WIRE 416 192 96 192 WIRE 672 192 496 192 WIRE -64 224 -64 80 WIRE -304 240 -304 176 WIRE 208 240 208 80 WIRE 288 272 288 144 WIRE 320 272 288 272 WIRE 416 272 320 272 WIRE 672 272 672 192 WIRE 672 272 496 272 WIRE 752 272 672 272 WIRE 784 272 752 272 WIRE 784 288 784 272 WIRE 32 304 32 192 WIRE 288 304 288 272 WIRE -64 320 -64 288 WIRE -16 320 -64 320 WIRE 208 320 208 304 WIRE 240 320 208 320 WIRE 672 320 672 272 WIRE -352 368 -352 336 WIRE -224 368 -224 352 WIRE 784 416 784 368 WIRE 32 432 32 384 WIRE 288 432 288 384 WIRE 672 432 672 384 WIRE -352 480 -352 448 WIRE -224 480 -224 448 FLAG 784 416 0 FLAG 672 432 0 FLAG 32 432 0 FLAG 288 432 0 FLAG -304 240 0 FLAG 240 368 0 FLAG -16 368 0 FLAG -16 128 0 FLAG 240 128 0 FLAG -80 80 Vs1 FLAG 192 80 Vs2 FLAG -224 480 0 FLAG -352 480 0 FLAG -352 336 Vs1 FLAG -224 352 Vs2 FLAG 752 272 out FLAG -240 32 Vin FLAG 96 192 Ph1 FLAG 320 272 Ph2 SYMBOL Lt\\sw 32 160 M180 SYMATTR InstName S1 SYMBOL Lt\\sw 288 160 M180 SYMATTR InstName S2 SYMBOL Lt\\sw 32 400 M180 SYMATTR InstName S3 SYMBOL Lt\\sw 288 400 M180 SYMATTR InstName S4 SYMBOL ind 400 208 R270 WINDOW 0 32 56 VTop 2 WINDOW 3 5 56 VBottom 2 SYMATTR InstName L1 SYMATTR Value 15uH SYMBOL ind 400 288 R270 WINDOW 0 32 56 VTop 2 WINDOW 3 5 56 VBottom 2 SYMATTR InstName L2 SYMATTR Value 15uH SYMBOL res 768 272 R0 SYMATTR InstName R1 SYMATTR Value 6 SYMBOL cap 656 320 R0 SYMATTR InstName C1 SYMATTR Value 5uF SYMBOL Lt\\voltage -304 80 R0 WINDOW 123 0 0 Left 2 WINDOW 39 0 0 Left 2 SYMATTR InstName V1 SYMATTR Value 100 SYMBOL Lt\\voltage -352 352 R0 WINDOW 3 -298 183 Left 2 WINDOW 123 0 0 Left 2 WINDOW 39 0 0 Left 2 SYMATTR Value PULSE(0 1 0 1n 1n {D*1/F} {1/F}) SYMATTR InstName V2 SYMBOL Lt\\voltage -224 352 R0 WINDOW 3 -27 182 Left 2 WINDOW 123 0 0 Left 2 WINDOW 39 0 0 Left 2 SYMATTR Value PULSE(0 1 {(1/F)/Phase} 1n 1n {D * 1/F} {1/F}) SYMATTR InstName V3 SYMBOL Digital\\inv 0 224 R90 WINDOW 3 8 60 Left 2 SYMATTR InstName A1 SYMBOL Digital\\inv 272 240 R90 WINDOW 3 8 60 Left 2 SYMATTR InstName A2 TEXT 312 552 Left 2 !.model sw sw(Ron =1m, Roff=10Meg, Vt=0.5, Vh=-0.5) TEXT -472 608 Left 2 !.param D 0.3 TEXT -472 648 Left 2 !.param F 350k TEXT -472 720 Left 2 !.tran 1m TEXT 320 520 Left 2 !.model Did D(Vfwd =1m, Ron=1m) TEXT -472 680 Left 2 !.param Phase 2
H: 36VDC to +/-15V linear regulator setup - will this design work? I designed a +/-15V power supply setup and trying to find/fix problems before running another PCB production run. It will accept 36VDC (800mA) from an off the shelf part via a barrel connector. I cannot change that part of the equation so I'm trying to desing something around that thing. My current layout looks like the following picture: I plan to use a buffered voltage divider which in turn controls a pair of n-channel and p-channel MOSFET's to provide enough power for the following linear regulators. I'm aware of possible oscillations due to the capacitive load on the op amp, I ran some SPICE simulations and found the values in the schematic for sufficient. Here are some screenshots of the measurements with and without the compensation: I selected these parts here: p-Channel Mosfet n-Channel Mosfet I ran a (quite simple) simulation in circuit.js if anyone wants to follow my train of thought and how I even got here. My question after this huge preamble is the following: Am I completely on the wrong path with my idea here or is there a chance of this thing working? EDIT: If there is any large power imbalance in loads, then the driver transistor will dissipate the difference in Watts. i.e. for audio it would be < 50% efficient. If so, the design would be better with differential output driver from single supply. This answer by Tony Stewart EE75 brought me to the conclusion, that trying to supply power that way isn't feasible in my case and instead I'll go down the road of modifiyng the main circuitry to work with a single-rail supply rather then force that concept of having a positive and negative supply. AI: 1st problem is lack of design specs. for Min/max load impedance and imbalance range. ripple and step load error. FETs have too much nonlinear gain and C3 causes oscillations. If there is any large power imbalance in loads, then the driver transistor will dissipate the difference in Watts. i.e. for audio it would be < 50% efficient. If so, the design would be better with differential output driver from single supply. BJT's would offer lower gain and better transient load stability. Other than above, I might suggest either a Class AB design or this
H: RGB LED simulation with Arduino code In this Arduino code, I want to when press numbers from 0 to 8, my LED s respond to it. Everything is working fine from 1 to 6 and 8. But when I select 7 and my code doesn't run well and Red and Green breathing interferes with each other. I don't understand why my 7th function doesn't work properly and it mixes to green ?!. I would appreciate you if you could help me to find out my code issue. int brightness = 0; // how bright the 9 is char data = 0; //Variable for storing received data int fadeAmount = 5; // how many points to fade the 9 by int pinSelector; void setup() { Serial.begin(9600); //Sets the baud for serial data transmission pinMode(10, OUTPUT); //Sets digital pin 3 as output pin pinMode(9, OUTPUT); pinMode(5, OUTPUT); pinMode(3, OUTPUT); } void loop() { if(Serial.available()>0 ) // Send data only when you receive data: { data = Serial.read(); //Read the incoming data send via serial monitor & store into data Serial.print(data); //Print Value inside data in Serial monitor //Serial.print("\n"); Serial.println(); // print an empty line if(data == '1') //Do looping so that when '1' send via serial monitor, the 9 can blink { digitalWrite(5, HIGH); Serial.print("9 is On"); Serial.println(); } if(data == '2') { digitalWrite(5, LOW); //If value is 0 then 9 turns OFF Serial.print("9 is Off"); Serial.println(); } if (data == '3') { analogWrite(9, 1); analogWrite(3, 1); analogWrite(10, 254); //If value is 0 then 9 turns OFF Serial.print("Green"); Serial.println(); } if (data == '4') { analogWrite(3, 1); analogWrite(10, 1); analogWrite(9, 254); //If value is 0 then 9 turns OFF Serial.print("Red"); Serial.println(); } if (data == '5') { analogWrite(10, 1); analogWrite(9, 1); analogWrite(3, 254); //If value is 0 then 9 turns OFF Serial.print("Blue"); Serial.println(); } if (data == '6') { analogWrite(3, 254); analogWrite(10, 254); analogWrite(9, 254); //If value is 0 then 9 turns OFF Serial.print("White"); Serial.println(); } } switch(data) //Do looping so that when '1' send via serial monitor, the 9 can blink { case '7' : analogWrite(3, 1); analogWrite(10, 1); analogWrite(9, 1); pinSelector = 9; fade(); case '8' : analogWrite(3, 1); analogWrite(10, 1); analogWrite(9, 1); pinSelector = 10; fade(); } } void fade() { analogWrite(pinSelector, brightness); // change the brightness for next time through the loop: brightness = brightness + fadeAmount; // reverse the direction of the fading at the ends of the fade: if (brightness <= 0 || brightness >= 255) { fadeAmount = -fadeAmount; } // wait for 30 milliseconds to see the dimming effect delay(30); } AI: The code of '8' is executed after code of '7' due to missing break statement in the switch-case construct.
H: Can I remove the power wires of USB 3.0 and still use data wires? So I have this SATA to USB converter for 2.5 inch HDD I want to cut away the power port (5v) and use the remaining data port with an separately powered (12v) 3.5 inch HDD. I was wondering if this will work or not (and possible risks for the HDD). AI: In order to communicate with the other device, you need 3 things: Data lines are connected. Grounds are connected together so that all voltages are referenced to the same ground level (you don't want things to float relatively to one another) Both devices need to be powered. There is no need for the device to be specifically powered by your USB's power line. The slave device has no idea what's powering it. It's receiving its 5V or 12V or whatever it needs, and it has no way to tell what's supplying it. If it's powered, it can talk. All you need to do is to supply the 12V to the device's supply pins (and connect grounds, of course). These SATA to USB usually have these 12V pins simply unconnected as they're intended for 2.5" drives. Similarly, USB host doesn't really care what happens to its power line - as long as it's not shorted/pulling too much current. At least, it has nothing to do with the data. You may have seen some external USB-powered CD/DVD drives, that have 2 USB-A connectors - cable splits in two - one USB-A is for power/data, another just for power, and it takes 2 USB ports on your computer to be able to pull enough power. Whatever gives the necessary amps. Your main issue could be the quality of the supply, you need to make sure grounds are well connected and that you don't introduce too much noise into the system. All in all, it should work. Your biggest problem is actually to find a way to connect your external supply to 12V pins. Addendum: there are USB to SATA converters, that look exactly like yours, but also have a barrel jack for 12V external supply specifically for this situation: If you need 12V, you connect it, if you work with 2.5" drive, you simply don't connect it and it draws 5V power from the USB.
H: How does this circuit work? (24 V lead-acid charger) How should this circuit be controlled to ensure that the backup battery is properly charged? The battery is a 24 V lead-acid battery. This is a circuit diagram of a UPS device. A PWM signal is connected to the R15 resistor (I checked with an oscilloscope) that monitors the battery charge. As I understand it, the battery is charged to about 26 V and then the PWM signal is turned on and off every 100 ms. The duty cycle is about 23%. Is this method correct? The battery is used less than 10 times during the day, up to 30 seconds, up to 15 A. I do not understand the constant voltage charging step in this circuit. I think in this circuit the battery is constantly charging. Is this true? AI: You can simulate the circuit below to get a feel for how it works :) D31 protects Q11 from reverse breakdown. Q11 is a PWM driver with current limiting (about 1A) established by Q10+R8. MCU_ADC samples battery voltage scaled-down by R14+R17 divider. When Q12 is turned on, Q11 can conduct, otherwise it's cut off. R12 drains the base charge from Q11 on turn-off. simulate this circuit – Schematic created using CircuitLab As you can easily observe, this circuit will not develop full current control via Q10 unless Q11 is a Darlington type. In the circuit you're copying, hopefully Q11 is a Darlington, or else someone snafu-ed the design a bit. Supposed that Q11 is not a Darlington, but just a medium-power PNP device with beta of, let's say 30 at IC=1A, the base would need to be driven with 33mA. Yet, 44V/10kOhm(R13)=4.4mA. That won't be enough to turn most non-Darlington devices on. Thus, R13 is likely too large. I'd decrease R13 to 1kOhm, and configure Q12 as a constant current sink turned on/off by the MCU. The newly added R100 would set the base current of Q11, large enough to ensure that Q11 can deliver the full charge current of about 1.4A even if it has minimum beta (per datasheet). In this case, R15 and R16 have to be changed as well. R15 needs to be 4k7, and R16 is a 100kOhm pull-down to keep Q12 off when the MCU is initializing and its PWM pin is open-circuit. simulate this circuit When the battery is discharged to, say 20V, Q11 will be dissipating about 20-35W at the beginning of charge. It needs to be rated to dissipate 50W-75W at least, and must have a suitable heatsink. The extra factor of safety is needed not to exceed Q11's safe operating area (SOA): after all, it's running with a rather large collector-emitter voltage of 20-25V, depending on the state of charge of the battery. To protect Q11 from damage when the battery is discharged too deeply, the MCU should do roughly as follows: When the battery voltage is between 0-20V, run the PWM at 1%-100%, proportionally. This will limit dissipation on Q11. When the battery voltage is between 20-26V, keep PWM at 100% (constant on). When the battery voltage reaches 26V for the first time, switch to the stand-by charging mode - below. Check the battery voltage every 100ms, and if it's below 26V, issue a single 100ms pulse, turn PWM off, wait 100ms, go to 4.
H: What Stops the Windings on an Electric motor From Shorting with Each Other? What stops the windings from shorting with each other? Are the windings insulated when the copper is still not bent, then the insulated copper is bent into the winding shape? AI: The wire used for winding electric motors (i.e. brushless motors), called "magnet wire" or "enameled copper wire" is covered in a non-conductive substance before being wound into coils. According to this datasheet from Remington Industries, this insulating material is polyurethane, with an optional polyamide coating for extra protection.
H: Input impedance for a difference amplifier OpAmp circuit For the above circuit, I would like to find the input impedance for the input \$v_1\$. Assuming that \$R_1 = R_2\$ and \$ R_3 = R_4\$, then: $$v_0 = \frac{R_3}{R_1} (v_2 - v_1)$$ As far as I know, the input impedance will be defined separately for each input (i.e. \$v_1\$ will have an input impedance, and \$v_2\$ will have a separate input impedance, since they are different inputs). I believe that the input impedance of \$v_2\$ is simply \$R_2\$ + \$R_4\$, because the current flowing in through the input labelled \$v_2\$ passes through those two resistors in series on its way to ground. However, I don't know how to find the input impedance for \$v_1\$? If there was a virtual earth at the inverting input, then the input impedance would simply be \$R_1\$, but that isn't the case here. Could someone tell me how to solve this problem? AI: An assumption made for an "ideal" op-amp is that the inputs do not source or sink any current. Thus, the impedance seen at the non-inverting input of the differential amp is just the sum of R2 and R4. Another assumption made for an "ideal" op-amp configured with negative feedback, and not in saturation, is that the voltage on the inverting input is equal to that of the non-inverting input. Because that voltage is common to both inputs, let's call it \$v_c\$. Note that \$v_c\$ is determined by \$v_2\$ and the voltage divider consisting of R2 and R4. Changes in \$v_1\$ do not cause changes in \$v_c\$. The current through \$R1\$ is $$I_1=\frac{v_1-v_c}{R1}$$ If \$v_1\$ is increased to \$v_1 + \Delta v\$, the current will increase to $$I_1 + \Delta I = \frac{v_1 + \Delta v -v_c}{R1}$$ so $$\Delta I = \frac{v_1 + \Delta v - v_c}{R1}-\frac{v_1 - v_c}{R1} = \frac{\Delta v}{R1}$$ So, the impedance at the inverting input of the differential amp is just $$Z_1 = \frac {\Delta v}{\Delta I} = R1$$ What is seen at the inverting input is equivalent to the following circuit. simulate this circuit – Schematic created using CircuitLab
H: Two seemingly analogous cases of using Kirchhoff's current law to calculate current through a node I'm currently studying the textbook Fundamentals of Electric Circuits, 7th edition, by Charles Alexander and Matthew Sadiku. Chapter 2.4 Kirchhoff's Laws has the following practice problems: Find current \$i_o\$ and voltage \$v_o\$ in the circuit shown in Fig. 2.25. Solution: Applying KCL to node \$a\$, we obtain $$3 + 0.5 i_o = i_o \ \Rightarrow i_o = 6 \ \text{A}$$ For the \$4 \ \Omega\$ resistor, Ohm's law gives $$v_o = 4 i_o = 24 \ \text{V}$$ Find \$v_o\$ and \$i_o\$ in the circuit of Fig. 2.26. Answer: \$12 \ \text{V}, 6 \ \text{A}\$. For Figure 2.26, it seems to me that \$i_o\$ is the current through the node above the \$2 \ \Omega\$ resistor. This node has a \$9 \ \text{A}\$ current flowing into it and a \$0.25i_o\$ current flowing out of it. Therefore, by Kirchhoff's current law, we have that \$9 \ \text{A} - 0.25i_o = i_o \ \Rightarrow i_o = 7.2 \ \text{A}\$. But this is incorrect. So what am I doing wrong here? This problem seems to be analogous to the previous one, so I don't understand what's different (besides the additional branch). AI: The major issue in your attempted solution is that you are in no way taking into account the current through the 8 Ohm resistor. Remember that current into a node must equal the current out of a node. Summing currents at the top node, we have: $$9 = \frac{v_o}{2} + 0.25 \cdot \frac{v_o}{2} + \frac{v_o}{8}$$ where $$i_o = \frac{v_o}{2}$$ This quickly simplifies to: $$9 = \frac{3 \cdot v_o}{4}$$ At which point solving for current and voltage becomes trivial. Hopefully this clarifies things
H: Ethernet PHY - Buffer Type I'm going through the datasheet of this PHY Transceiver LAN8701A On Page 14, table 2.2, it is mentioned as buffer types. This is the first time I'm coming across the table called buffer types. Can someone explain what are the buffer types and why are they used? Why can't we see this table in other types of datasheets? AI: The "buffer types" table you are seeing on page 14 is the legend for the "buffer type" column in the pin function description tables 2.1 to 2.7. These refer to the type of internal drivers/receivers that exist inside the integrated circuit for each pin. The word "buffer" is used because these drivers/receivers act to isolate the outside world from the integrated circuit inside the device package. You see, not every pin on an integrated circuit can perform any task. Some pins are used as digital inputs, digital outputs, analog inputs, analog outputs, etc. Each pin type has a different circuit on the inside of the chip. I have seen other datasheets that contain this kind of information. This STM32H723 datasheet has something similar on page 56, although not as detailed. Often times the buffer type of a pin can be inferred from its functionality. (For example, pins labeled as XIN and XOUT are often understood to be the crystal input and inverter output pins respectively, without having to be labeled as ICLK and OCLK buffer types) In other chips, some pins can have multiple functions, in which case multiple sets of circuits exist inside the package and the inputs/outputs are multiplexed to allow you to select which kind you want to use. In this case however, the datasheet is just telling you what kind of I/O each pin is. To summarize, this table describes the input/output capability of each pin on the device. IS/VIS seem to be pretty general digital inputs O12/VO8 seem to be standard push-pull outputs VOD seems to be a standard open-drain output PU and PD are used to describe the digital outputs The rest are pretty self explanatory Hopefully that makes sense!
H: Need help to make a portable LED light based on the LM3421 I am trying to make a portable LED light based on the LM3421. I would like to use it in buck boost mode. Input voltage from 4s battery-- 12 to 16.8 LED voltage - 14.4 LED current - 3A PWM frequency of 20kHz Is the LM3421 good for this task? My main doubt is whether the LM3421 will deliver the same voltage when the battery voltage varies between 12V and 16.8V. AI: It's a current regulator so it should deliver the same current for that range of input voltages. That will be about the same voltage, but it will change a bit depending on LED die temperature etc. The topology shown in example 9.2.2 LM3421 Buck-Boost Application should work for you, but you'll have to work through the detailed design for your higher LED current and narrower input voltage range. You'll likely also want to add battery protection to shut the circuit down before the battery voltage falls so low that the battery is damaged.
H: Is there a convention for documenting a schematic with notes? I want to add an explanation as to why I’ve done something a certain way (mostly for my future self) on my schematic. Yesterday when reviewing a circuit from last year, I asked myself “why the heck did I do that?!” And after changing the design to what I thought it should be (which didn't work), the memory of my original decision came flooding back, and I had to revert the design. I’d like to start adding notes and comments to my schematic, but I want to do it in a conventional way that will make sense to other electrical engineers. I’m also concerned that adding comments around the schematic might make the it a bit less tidy, and so less easy to read. I suppose I could write a separate document, but somehow it feels like it’d be easier to understand if the comment was next to the components I’m talking about. Is there a convention or widely known good practice for this? I don’t think I have seen many (if any) notes or comments on any schematics I’ve read so far (though I need to read more schematics). Datasheets, in my experience, tend to be a good source of explanation. AI: I add three kinds of notes. DESIGN NOTE: or FIRMWARE NOTE: or LAYOUT NOTE: FIRMWARE NOTE: is for something like sequencing requirements for IO pins or documenting forbidden states (GPIO G5 and G6 must never be high simultaneously). I may also include an IO table to clearly indicate how the IO pins should be configured (as far as alternate functions). For example GPIOA4 should be configured as ADC1_IN3 or something like that. For design notes, I typically include voltage divide ratios for voltage dividers. For regulators I would add a design note showing the calculation for the output voltage and the feedback voltage of the regulator. Sometimes I might add a brief explanation of how a circuit is supposed to work or a quick tolerance analysis. If I have a sensor (e.g., a temperature sensor) I will add a note with the equation to convert voltage to temperature. Here is one small snippet that I guess is OK to share (I am the creator of the image): I don't think there is any convention. But it is definitely a good idea to put notes in the schematic. In the past FW engineers have asked me to put them in there and I try to remember to put in the kind of stuff they would want to know. For the design notes, the goal is to spare a subsequent EE (or me 6 months later) from having to go look up a bunch of stuff in datasheets or guess at motivations. For the FW notes the goal is to save the FW engineer time, especially if the functionality of some part of the circuit is contingent on other IO pins. If you have to drive an IO pin high to enable a sensor. I would rather just put that note in the schematic (like in the example) than have the FW engineer come to me later and say "I don't think the current sensor is working.. I have been trying to get a reading for a whole day and it is always zero" or whatever. Likewise, if there is a sensor connected to an ADC input I want to put enough information in the schematic so that the FW engineer can write the code without pulling up the datasheet for the sensor. If the sensor is programmable or elaborate and complicated, then that would be different, I guess. But for simple sensors I would try to explain it in the schematic.
H: Will layer-to-layer leakage happen in a PCB? I have a four-layer PCB that contains a circuit that measures voltage from a very high impedance node. This voltage is a DC voltage value ranges from 33 V to 36 V. The voltage measurement circuitry is present in the top layer. I have provided guarding only on top layer since all my components are SMT. My board contains only analog circuitry. Below is my stack up. The stack-up is SIG-GND-Power-Signal. The PCB material is ISOLA Tg 180. Will the leakage current flow from the other layers to layer 1? From my stack, you can see that the dielectric thickness is on the order of 4.3307 mil which is 0.1 mm. The volume resistivity for the 185HR material is 300 tera-ohm·cm. Since our dielectric thickness is 0.1 mm, the volume resistivity will come to 0.3 tera-ohm·cm. With a VBIAS voltage of 36 V, we can expect the leakage to be 36 V/0.3 tera-ohm·cm. The leakage will be on the order of 120 pA. This can be a problem to us. AI: The distance \$d\$ between your two layers is 0.1mm. The resistivity \$\rho\$ you provided is 300 TOhm cm. To calculate the resistance you still need to know the area \$A\$ of overlap between your high impedance node on top layer and your GND layer: $$R = \frac{\rho d}{A}$$ Since I don't know the area, this is an example assuming \$A = 1 \mathrm{cm}^2\$: $$R = \frac{\rho d}{A} = \frac{300\;\mathrm{TOhm}\;\mathrm{cm}\cdot 0.01\; \mathrm{cm}}{1\; \mathrm{cm}^2} = 3\; \mathrm{TOhm}$$ If you sensitive high impedance node is smaller, the resistance can obviously be significantly larger.
H: How to tell what serial protocol is used on a DB9 connector? I'm trying to reverse engineer communication between a host and client device that uses a DB9 connector. I'm able to measure voltage between the devices with a breakout board and multimeter. The pin-outs for RS232 and RS485 protocols, for example, are very different with RS232 COM being pin 5, and RS485/RS222 being pin 1. Some clues is pins 7/8 on the male end are missing. What measurements can I take with a multimeter that will reveal what I'm dealing with? What voltages should I expect to see? I tried wiring up a spy cable using this diagram and so far I'm not getting anything on an RS232 device: I know the spy cable works because I did a loop back on my RS232 to USB adapter. (I also tried the non handshake version with just Tx Rx and COM wired). I suspect RS485/RS222 but I would like a way to confirm with voltage readings. And I'm not sure what values I should be seeing for either protocol. Measurements I took assuming pin 5 is COM (addition: pin 5 is not COM, pin 2 is, see below): Disconnected (treadmil only): 1 and 5: 10.49V 2 and 5: -4.98V 3 and 5: 0V 4 and 5: 0V 6 and 5: -4.25V 7 and 5: -4.23V Connected to console: 1 and 5: 7.07V to 7.11V 2 and 5: -4.96V 3 and 5: 0V to -0.38V 4 and 5: 0V to -0.54V 6 and 5: 6.45V to 6.50V 7 and 5: -4.91V Additional Information: The device itself is a Lifespan treadmil. I'm trying to read health data from the device for personal use. I originally left it out because I thought perhaps I could discover the protocol with some voltage checks, and I wanted the question to be more helpful to other applications. The console has a USB port used for charging devices like mobile phones. I took it apart and found continuity between USB ground (black wire) and pin 2. With this information I took new measurements: Disconnected (treadmil only): 1 and 2: 15.43V to 15.53V 3 and 2: 4.97V 4 and 2: 4.21V 5 and 2: 4.97V 6 and 2: -0.47V 7 and 2: -0.25V Connected to console: 1 and 2: 12.05V to 12.10V 3 and 2: 4.68V to 4.96V 4 and 2: 3.83V to 4.17V 5 and 2: 4.96V 6 and 2: 11.42V to 11.47V 7 and 2: 0.001V to 0.01V I found a couple of Gists where users have successfully read data. But I do not know if they wired their own cable, or what serial protocol was used. My assumption is besides some pin shuffling, an off-the-shelf USB adapter was used. One author did tell me what model they were using (TR800), which is different from mine (TR5000, got second hand), but it's within the same family. It's also possible Lifespan changed the pin-out on their Glowup refresh. The gists are here: https://gist.github.com/daeken/a3d3c4da11ca1c2d2b84 https://gist.github.com/lostmsu/1b0d4a33e5ca2418c2b52797eb720ec7 With the Python version this line stands out: self.port = serial.Serial('/dev/tty.IHP-Serialport', 19200, timeout=1) I have the retro console without bluetooth. Even so, people complain about the syncing. As a software engineer I thought I would try to get at the data and sync it to my health fitness app. And it (seemed) like a fun project. Discovery: Both scripts I linked to are serval over Bluetooth. So it can literally be anything. I would probably have a better chance tapping into the empty Bluetooth slot on the console board. Either way without a oscilloscope, that’s going to be impossible. Cheaper to try and get my hands on a Bluetooth console. AI: The RS-232 DB9 is well standardized. You'll have Rx on pin 2, Tx on pin 3 and GND on pin 5. Optional handshaking signals on the rest of the pins. This assumes that the device is a terminal at the end of the bus. Otherwise Tx/Rx may switch places in case the device is to be regarded as a "modem", a middle man between terminals. As seen on for example Wikipedia, RS-232 logic levels are 3V to 15V for binary value 0 and -3V to -15V for 1.That is, the logic voltage levels look inverted compared to UART. RS422/RS485 however use 5V logic levels just like UART. Since it's a differential signal, Tx+ idles 5V high and goes to 5V for binary 1 (exactly like UART), while Tx- does the opposite, idles 0V and goes to 0V for binary 1. DB9 for RS422/RS485 is unfortunately not well standardized and all manner of strange pin-outs exist. A common one is this (ignoring handshaking signals): 1. Tx- (A) 2. Tx+ (B) 3. Rx+ (B) 4. Rx- (A) 5. GND A and B being common terms when using RS485 semiduplex. Another one, which could be the one you are seeing: 1. GND 4. Rx+ (B) 5. Rx- (A) 8. Tx+ (B) 9. Tx- (A) Some clues is pins 7/8 on the male end are missing. In case of RS-232, pin 7 and 8 would be the most common handshaking signals RTS/CTS, so that's perhaps the case - to ensure there's no handshaking. In case of RS-485, you could be looking at yet another pin-out other than those above. What measurements can I take with a multimeter You don't, you use an oscilloscope. It is a mandatory tool for electrical engineering in general and serial bus trouble-shooting in particular. Also pretty much every modern digital oscilloscope comes with a decoding feature for RS-232 or RS-485. At idle voltages you could use a multimeter between pin 2 (red probe) and 5 (black probe) to see if you have a negative voltage. If so it's definitely RS-232. But when there's data being transmitted, the multimeter is unreliable and might show pretty much anything between -15V to +15V depending on bus load.
H: PCIe End-Point configuration for communication with Root Complex I have an ambiguity regarding the PCIe initial configuration which is performed by the root complex (RC) on the end-points (EP). Both devices have their own base address registers (BARs). The RC configures an address on the EP BAR. What does that address represent? Also, how does the EP know the value of the RC BARs to initiate some read or write transactions with the RC as only RC can send configuration read/write requests? I have read the specification document but still don't fully understand the mechanism. Clarity on the above would be greatly appreciated. AI: When an endpoint has some memory - be that physical RAM, control/status registers, Flash, etc. - the system needs some way of knowing how to address that memory. Remember that software running in the system uses memory addresses to access data. By assigning a physical address to the device, the memory can be accessed by software just like any other memory. The address programmed into the BAR on an endpoint represents the physical memory address in the system that software can use to communicate with the corresponding memory in the endpoint. An EP can have up to 6 of these regions. The lower N bits of the BAR will always be 0, where N is the width of the memory. For example if you had a 64kWord memory on your EP, that would be a 16b wide word address, so the lower 16b of the BAR will be hardwired to 0's. The EP doesn't necessarily know the address values of the RC. It doesn't initially need to. EPs start as being passive devices - only responding to requests from the RC. If they need to send their own write and read requests, the OS must configure them to be capable of performing bus mastering. Once capable of bus mastering, software on the system (typically device driver) will configure the device to initiate requests - for example if you wanted to DMA a chunk of data from say system RAM to your device or vice versa, the driver would work out the physical memory address it is required to communicate with and send that information to the EP as part of setting up an operation. If you have two PCIe devices that are intended to talk directly to each other (P2P), again it would be up to the device driver or other such software to read the BAR addresses for the two EPs and pass that information to both devices so that they know how to address each other.
H: Using electrical equipment made in the US, in Japan A lot of (good) US stuff is available in Japan through international online sales (Amazon). However, most equipment purchased in Japan from the US are shipped as-is, without any change, while the voltage is 120 V in the US and only 100 V in Japan. I'm struggling to assess the impact, if any, of such a difference depending on the type of equipment. The question here is to help me make the right purchase (target being, if possible, no noticeable loss of power). There are some subtle electrical concepts that I'm not familiar with. To begin with what I (think I) know: \$V = RI\$ and \$P=VI\$ (\$P\$ for Power), that gives the famous $$P=\dfrac{V^2}R$$ My question is, what between A and B below is correct (or something else)? A) \$R\$ is constant, Power decreases? In this case, if \$V\$ decreases but \$R\$ is constant, obviously the Power should decrease also, proportionally to the square of the difference, for instance in Japan that would be $$P_{jp} = \dfrac{100^2}{120^2}P_{us} \approx 0.69\text{ }P_{us} $$ So for instance an US 1440 W @ 12A electric kettle would only be 1000 W in Japan (same 12A). B) \$P\$ is constant, Intensity increases? (\$R\$ varies) In this case, \$P\$ being constant and \$V\$ being lower in Japan, the device would suck more Amperes to reach the same Power. The ratio is $$I_{jp} = \dfrac{V_{us}}{V_{jp}}I_{us} = 1.2\text{ }I_{us}$$ The US kettle example @ 12A would consume 14.4A in Japan, which is worryingly close to the 15A "limit" of many outlets here. My question: for instance, are my A or B assumptions below correct depending on these kinds of equipment: (please add any other equipment that make sense) Electric kettle (resistor => A?) Oven / toaster (resistor => A?) Food processor (motor => B?) Tank water pump (motor? => B?) AI: If the product is not rated for 100Vac e.g. 100~140 or 100~240 Vac, it is not guaranteed, Resistive loads like kettles and ovens will draw less power not more because R is relatively constant ( except for the PTC effects) \$P=V^2/R\$ Motors will have a no load RPM proportional to f and torque limited by Vac/Z. where Z(f) is also raised by back EMF proportional to RPM and eddy current losses. Many appliances may use BLDC motors but label specs must be adhered to, or ignored with great caution for effects on performance or reliability. You must use a specific example with datasheet if you expect an accurate answer. This is too vague.
H: How is frequency measured in a power grid? I know that voltage and current are measured with voltmeter and ammeter, but how is the frequenc measured in power grid applications? I know that a phase locked loop (PLL) can be used, but is this method also used for power grid applications? What is the most used instrument to measure it? AI: There are many ways to measure frequency, the choice usually being made on what technology is available. In the bad old days, they used a wonderful mechanical resonant reed meter. This picture is from wikipedia. All the reeds are driven by the waveform, but only one or two at or near the resonant frequency show a large vibration. Nowadays, one of the easiest ways to get a high resolution frequency reading in a short time is to digitise the waveform, and demodulate it to frequency. That can be done with the soundcard on a PC and a trivial program. Before the advent of cheap ADCs, they would use a standard frequency counter, perhaps using a PLL in front of it to multiply the frequency by 100 or 1000 to get decent resolution in a short time. An alternative way to get a fast reading with a standard counter is to do TIC, Time Interval Conversion, where you count your high speed reference for one cycle of the low speed input waveform. This is very easy to implement with any cheap MCU like PIC or Arduino, with its internal hardware counters and fast clocks. There was yet another way to measure frequency finely, quickly, but its opportunity to shine was squeezed out by the arrival of those cheap ADCs, which made waveform digitisation much more convenient.
H: Resistor voltage sharply drops Why does the voltage across R1 sharply drops, then slowly go to the ground in the simulations? However, when I probe VC1 the cap does discharge in an exponential manner, as expected. Should the voltage across R1, have a similar exponential from 12V to 0V? AI: Why does the voltage across R1 sharply drops, then slowly go to the ground in the simulations? R1 never sees 12 volts when the switch opens because of the potential division caused by R5. Because R5 is 3 kΩ and R1 is 470 Ω the voltage across R1 is only 0.1354 of the capacitor voltage and that is just about what you see in the image in your question. So, R1 immediately drops from 12 volts to 1.625 volts when the switch opens.
H: How does the current mirror stabilize tail current in an op amp? Op amps often use the "slave" side of a current mirror to provide the tail current for the input transistor pair, such as in this simple op amp voltage follower schematic: The "gates" node in the current mirror is constant. Therefore, the gate-source voltage of the two PMOS transistors is constant as shown in the first plot. This should result in a constant channel resistance of both M1 and M2. Now the second graphic shows how the drain-source voltage over M2 varies by a tremendous amount when sweeping the common-mode voltage point. But still, the current through M2 is constant (third plot). This demands that M2's resistance strongly varies, which seems to contradict its constant gate-source voltage. Question 1: How is the current through M2 constant, despite a strongly varying drain-source voltage and constant gate-source bias? Questions 2: When I replace the mirror transistors with PNPs, the current mirror performance becomes abysmal (see plot below). Why are BJTs so much worse in this regard? AI: But still, the current through M2 is constant (third plot). This demands that M2's resistance strongly varies, which seems to contradict its constant gate-source voltage. It does not contradict anything, except possibly a false assumption that the mosfet is in triode. It is in fact not in triode, but rather in saturation where the drain current is well described by: $$I_D = k ( V_{gs} - V_{th})^2 $$ and is fairly close to constant over a wide range of Vds voltages. There's a small variation from channel-length modulation which arises as a consequence of device semiconductor physics. When I replace the mirror transistors with PNPs, the current mirror performance becomes abysmal (see plot below). Why are BJTs so much worse in this regard ? Not clear from screenshot alone without also seeing the device models. In principle, BJT current mirrors are fine. You may want to double check whether the transistor is in forward active mode and whether it is getting enough base current since -592 mV might mean insufficient gate drive (remember that MOS devices don't have gate current). Also try using a constant current source instead of a resistor on the input.
H: Maximum bit rate over a communication channel Shannon formula C= B log (1+S/N) Is this formula applied for baseband transmission only? or for both baseband and passband modulation? Can we apply it without any changes to any modulated signal? What about QAM, CDMA and OFDM, can this formula be applied with these techniques without any changes? AI: The formula is an upper bound, indicating the best performance that any modulation scheme could hope to achieve in a given bandwidth at a given SNR. QAM on its own will likely not achieve this theoretical limit, but a suitable modulation scheme with a suitable FEC code can approach the theoretical limit. In an example of this, Turbo codes are described as the first practical codes that approached the Shannon limit (note that this is a property of the FEC, without referencing any particular modulation scheme). The actual formula does not care whether communication is done at baseband or at passband. As a thought experiment, insert an ideal, noise-free I-Q mixer driven by an ideal local oscillator into the signal path to shift the signal between the baseband and a passband. The SNR is unchanged, the bandwidth is unchanged, and the information content is also unchanged.
H: 3 phase low voltage signal generator I want to create my own 3 phase signal. However, instead of it peaking at 230V AC it must peak at 5V AC. This generator will be used to feed a secondary unit that uses this signal to perform its own set of operations. This secondary unit is off the shelf so I cannot give much info on this. I hook-up a scope on the three input pins of the secondary device and found out that it is been feed by a 3 phase 5V peak AC signal. One pin for each of the phases. I want to know feed in my own 3 phase 5V phase signal to trick the system. How do I go about making a 5V peak 3 phase signal? Either through a micro or analogue components. AI: The obvious approach with a micro or FPGA is to have a one quadrant lookup table and 3 DACs. You can set up a periodic interrupt or use double buffer DMA to calculate and send the data to the DACs. You may need some level shifting and gain adjustment to get your required output level. Maybe a bit of filtering depending on your requirements. TBD: How many bits you need, (related) how fast to update the DACs, accuracy of clock, voltage, zero balance.
H: How does electromagnetic shielding work? How does electromagnetic shielding work in cables? I learned from school that foils are used as shields in coaxial cables to "shield" them from external electric and magnetic fields. It also keeps the magnetic field inside the cable to go outside (radiation loss.) How can a shield like foil do that in the first place? I don't understand why magnetic fields and electric fields cannot penetrate the cable when there is a grounded shield covering the cable. Likewise, I cannot also understand why the magnetic field from the core of the cable cannot go outside when a shield exists. AI: I don't understand why magnetic fields and electric fields cannot penetrate the cable when there is grounded shield covering the cable. A magnetic field can certainly penetrate the shield but, we design cables so that they have symmetry and whatever influence the magnetic field has on the inner wire (e.g. a coaxial cable) also influences the other wire (or shield). We then used balanced receivers that are more than capable of looking at the wanted differential signal on a cable and ignoring (within reason) the common-mode electrical disturbance caused by the external magnetic field. An electric field is much less likely to penetrate the shield but, it will act to "wobble" that shield voltage around. However, due to the nature of cables, the inner wire will also "wobble" around in sympathy because it's likely that the capacitance from inner wire to outer shield is much, much higher than the capacitance from the interfering electric field source to the cable. Again, a balanced differential receiver will do the hard work of ignoring the common-mode "wobble" whilst receiving the wanted differential signal correctly. For unshielded twisted pairs (again, a properly designed cable type), the electric and magnetic fields equally influence both wires and thus do not produce a significant differential interference at the receiver. Likewise, I cannot also understand why magnetic field from the core of the cable cannot go outside when a shield exists. It can if you don't drive the cable properly; driven properly, the magnetic field from the inner (i.e. coaxial cable) and the magnetic field from the outer shield will cancel at any distance beyond the cable. But, you have to drive the cable correctly and terminate the cable correctly. Clearly, twisted pairs also produce an externally cancelling magnetic field if driven correctly.
H: How can I read an RFID tag at the back of a phone FROM THE FRONT? I'm discovering RFID applications and I would like to be able to read an RFID card I strapped to the back of my phone (the most convenient location for me) by just putting the phone face down on the reader. At the moment the reader (MFRC522) reads the card at 10cm distance without anything in between, but can't read the card this way even when the phone is placed on top of the reader. I don't know if that's because it's attenuating the signal too much (in which case perhaps I could boost the reader's signal, somehow) or even completely (Faraday? Is that you?), or if the phone's NFC chip interferes with the card (I've got a Pixel 4, which should have one) - and I don't know how to find out which it is. Note: I'd like to avoid reading the NFC chip inside the phone itself because I read it's got a much smaller range, and I don't even know how to read it from this reader. Any ideas? AI: Use this phone instead... Otherwise, the metal of your phone is going to block the chip from being read. The card is powered by coupling to the reader, so it won't be "boosted" like a far-field signal. You can use NFC chips that are meant to be placed on metal surfaces; but this wont let you read the chip from the opposite side of a phone with a metal body. The chip is outside the phone so it's not acting as a Faraday cage. The oversimplified answer is that the phone is reflecting the signal.
H: Offsetting an ultrasonic receiver's signal for an amplifier with a floating ground I have an ultrasonic receiver that I'm putting through an amplifier. I've created a floating ground for the amplifier (because I want to pretend having a negative voltage supply). However, to achieve this I will need to offset my receiver signal by the floating ground voltage. Does anyone know how to achieve this? Grounding the receiver to the floating ground has not biased the receiver to the floating ground voltage. The receiver I am using is the 328SR160, and the input I am expecting is around 32kHz at 50mV. My current circuit, assuming I manage to get the receiver bias working. AI: Bias the input of the opamp with resistors to the correct level then couple the input signal with a capacitor. The capacitor in conjunction forms a high-pass filter. The cutoff frequency needs to be lower than the signal frequency. The time constant will affect how quickly the circuit becomes usable at power-on and may limit how low the cutoff frequency can be. The input capacitor (C1) prevents the bias voltage being affected by the DC voltage at the output of the transducer. (Since a piezo-electric ultrasonic sensor is non-conductive the capacitor is not really necessary in this particular case although the simulation requires it as the voltage source is DC conductive) Image credit: https://www.electronics-notes.com
H: Bandwidth distance product A fundamental principle of communications states that for any given transmission medium, bandwidth-length product is constant. I know that optical fibers, for example, are used for high data rate transmission over long distances. High data rates means high bandwidth and high carrier frequency. According to the constant bandwidth distance constant principle, we can decrease the carrier frequencies used with optical fibers, and thus increase the transmission distance. My question is: can we use very low frequencies (in the range of kilohertz) with optical fibers to transmit data over very large distances? Of course the bit rate will be very low, but I am asking about the possibility to transmit very low frequencies over optical fibers. AI: can we use very low frequencies (in the range of kilohertz) with optical fibers to transmit data over very large distances? Can we launch a 100 kHz electromagnetic wave into an optical fiber? No, 100 kHz is below the cut-off frequency of the fiber, and won't be guided by the fiber structure. Can we modulate the optical (100-200 THz) carrier with a 100 kHz data signal and achieve a very long link distance? Yes. As the modulation bandwidth around the carrier is reduced, the achievable link distance is increased, maintaining a (nearly) constant bandwidth-distance product. At very low modulation frequencies, unfortunately, the link distance will be limited by loss effects rather than the dispersion effects that determine the bandwidth-distance product at normal data rates. So you can't extend the link distance to infinity just by reducing the data rate to nearly 0.
H: Is it ok to have a PCB track cross another on a different layer? PCB tracks carry electric signals and these produce magnetic and electrical fields around them. Due to these fields, the PCB tracks have inductive and capacative cross talk with nearby PCB tracks. I sometimes see design where signal tracks are crossing others on an immediately higher or lower layer. In my understanding, if a ground plan is not sandwiched between the two tracks, when a signal travels on one track, it will induce a signal on the other track due to cross talk. When is it acceptable to have signal tracks crossing each other in the way I have described? AI: When is it acceptable to have signal tracks crossing each other in the way I have described? Signal tracks are just pieces of metal, when you have two bits of metal with distance between them they function as capacitors. When you bring them closer together or have more area between them, it creates more capacitance. If creating more capacitance between different signal traces is acceptable then do it. High frequency signals/currents will pass through this capacitance, a designer designing for low noise or high frequency might not want to create cross capacitance between two signals.
H: How to invert a NAND gate IC and have it work like an AND gate IC? I have created this circuit design using tinkercad. I thought I had two 74HC08 IC:s. Turns out I only have one. Can I replace the second 74HC08 with an inverted 74HC00 and if so how do I do this? If it is not possible what other IC can I use from my parts list and still get the same output as in my truth table? Can anyone show how this would be done on the breadboard using tinkercad or any other virtual breadboard? Truth Table: Available parts list. Note, only one of each IC type available: Logisim design: Circuit design built on tinkercad (slightly changed from the Logisim design above but output is the same as truth table): AI: To convert a NAND gate to an AND gate, add an inverter to the output. Think of it as the bubble on the NAND gate and the bubble on the inverter cancelling out each other. This will add 1 gate delay to signals going through it, not an issue in your case.
H: Issue converting push switch to toggle action using a D-Type flip-flop I'd like to convert a momentary switch in a toggle switch using a D-Type flip flop from an SN74HC74AN. For this reason I've created and simulated a circuit like this: All works fine on the Multisim Simulation. Then I've created a real prototype on a breadboard like this: But, in this case, when I press the momentary switch button nothing happens and the LED remains ON. I know that the CLK input must be triggered but, on the sn74hc74an datasheet I read: "Dual D-type positive-edge-triggered flip-flops with clear and preset" I've also added a 3.9 nF capacitor on the input side but got the same results. Where am I wrong? Update. Eventually I found the right solution. The issue was related to non triggered signal sent to the 74HC74 inputs pin. Using Schmitt-Trigger Inverters like CD40106B CMOS all works as expeted. The builded circuit is this and works like a charm. AI: The device is triggered on the rising edge so I wouold flip your input circuit where the switch pulls the input high. Your preset and clear both need to be tied to +. Then tie the inputs of the other gate to ground or + it doesn't matter. At that point it should work. Your capacitor not shown value may have to be adjusted. TonyM also is giving you a good circuit but remember to terminate the unused flip-flop.
H: Solar cell outputting voltage but 0 current I recently acquired some small solar cells. When I go to measure the voltage, I get a clear reading, between 190 - 300 mV but hen I try measure the amperage, I get 0 amps, even with the multimeter set to 20 microamps sensitivity. Is the same method done to measure the voltage as it is the amperage on a solar cell (negative lead on the top conducting track and positive on the back). I got the solar cells from a professor, they should be in working order. The multimeter is set to read dc amps. Pic is the cells AI: The way I would measure them as they are photovoltaic devices is connect them to a resistor. Start with maybe 1K, I have no idea how big they are. Then connect your voltmeter across the resistor and measure the voltage. You can experiment with a few different resistors until you get there rated voltage. Then using ohm's law you can easily calculate the current.
H: I am having trouble measuring the amplitude of a 97 MHz signal with an oscilloscope with a bandwidth of 100 MHz First, I designed a Colpitts oscillator with a frequency of around 94-97 MHz. I added a common emitter amplifier to the design to increase the output amplitude of the oscillator, then I connected the probe of the oscilloscope to the output and measured the amplitude of the signal with the oscilloscope. When the probe is at 1x, the amplitude of the signal is 633 mV. Here is the screenshot of the signal while the probe is at 1x: When the probe is at 10x, the amplitude of the signal is around 380 mV. Here is the screenshot of the signal while the probe is at 10x: I'm not sure if the signal is measured correctly since the bandwidth of the oscilloscope and probes is 100MHz. What is the actual amplitude of the signal? If the measurement is correct when the probe is 10x, the amplitude of the signal should be 380mVx10=3.8V. I am attaching the circuit diagram. I recorded the operation of the circuit on video.I am testing the modulation in the video via a radio. There are also FFT and oscilloscope measurements of the modulation in the video.Please warn me if I have done something wrong.link is here https://drive.google.com/file/d/1YryFCI-n6-iACd4vVtxXLwiRebVg5j8W/view?usp=sharing AI: These are a few observations with assumptions due to lack of design details. 3dB DSO @ 100 MHz = 70.7% of signal or 30% attenuation 1:1 Probes can never be use >20 MHz due to cable capacitance 100 pF /m and ground inductance <10 nH/cm A 10: 1 probe calibrated, is always your best bet for RF for signals >= 20 MHz BUT the ground clip must be very short (<1") or never used and only with spring coil differential sig/gnd. on tip/ring output impedance = Rc is unknown but assumed low enough Most likely your signal is 3.8V/0.7 ~ 5.3Vpp with a 10V supply @ 30mA implies Rc < = 330 ohms Although my design is simple, by changing your design specs, for Vpp, Zo, Imax and THD, you can get a decent square or sine wave by changing R ratios and bias for symmetry. This one is > 9V square wave. with the right transistor and probe methods.
H: How can I limit input current to a raspberry Pi to 2 amps from a high current battery? The circuit I currently have consists of a motor circuit and a raspberry pi circuit connected to the same battery. (2 series circuits from the same battery). The problem is that during idle motor, a very small current flows through the circuit and when the motor is running, it could draw up to 30 amps of current. If this happens, how can I always maintain a constant 2 amps current as input to the Raspberry Pi? The make and model of the current limiting resistor would help. AI: The Raspberry Pi will draw whatever current it requires, regardless of the current drawn by the motor (assuming the battery can supply all the current required by both the Pi and motor).
H: Fixed pulse width with 555 Timer new here. I have a question regarding sending a PWM signal to a brushless motor ESC using a 555 timer. I'm using an Arduino Uno to control it currently, but I'd like to simplify my setup. I have an underwater thruster that I only care to run on/off at a constant set speed, and I'm currently accomplishing thus using the Arduino servo library to send a 2ms fixed pulse width @ 50hz (10% duty cycle). I've seen schematics on other posts here using a 555, an assortment of parts, and a potentiometer to modulate pulse width. Does anyone know how a schematic would look to accomplish what I'm currently doing, but with a 555 timer? Any and all help is greatly appreciated. AI: If all you need is a 2 mS pulse every 20 mS you could use the standard 555 astable multivibrator circuit and calculate the timing capacitor and resistor values to do that. With a 0.1uF capacitor R1 works out to 230880 ohms and R2 is 28860. The formula for the pulse with is Tpulse / (0.693 * C1) R2 = 0.002 / (0.693 * 0.1E-6) = 28860 For the total cycle time it's (Tcycle / (0.693 * C1)) - (2 * R2) R1 = (0.02 / (0.693 * 0.1E-6)) - 57720 = 230880 You can use standard resistors that are close to those values with something like a 10 turn pot in series with each one to trim the values to what you need. This will give you an output where the 2 mS pulses are negative going, so you will need to invert the output if you want positive going pulses. I have added a transistor inverter on the output of the 555 as a basic example, but you would need to design something that would give you the correct polarity and signal level necessary to drive your ESC. Circuit in LTspice with inverted output:
H: Convention or IC for dynamically switching multiple paths on a PCB? I'm trying to create programmable circuit paths (controlled via mcu), where my program can arbitrarily connect N pins on one side of the circuit/pcb to N pins on the other side. Ideally, this would work as a "pass-through" (minimal resistance) and have a minimum rating of -30V/+30V and 10A of current. Physically, the pins on an external connector would connect to specific parts of the pcb. Ground pin to ground rail. Power pin to power management, and so on. I'd like to be able to configure/control this via an mcu. Does an IC for this already exist, or a convention for doing this? I've thought about using an N2 transistor/switch array, but that seems like it might cause cross-talk/interference and be generally inefficient. I was also suggested multiplexers but I couldn't find any that can handle my specific voltage and amperage. Also, this "programmable path circuit" would have power, grounds, and data paths running through it. I usually see to keep power and data separate. Assuming this can be done, would there be any significant issues in routing power and data paths so close together? AI: You're looking for analog crosspoint switches. But you'll have a hard time finding something that fulfills everything you want. If you want something monolythic you'll have to reduce your power requirements (10A is a lot of current) or switch to a discrete solution. For a crosspoint fabric where you can switch every input to every output you need a fabric of number of inputs multiplied by number of outputs. If you want minimum resistance and high current capability you won't get around using relais (keep in mind the low switching speed and limited cycles relays have). If you want 8 inputs and 8 outputs you need 64 relais. That's a lot of space and quite expensive. If you're ok with 1-2V of voltage drop you can use electronic switches (thyristors for example) but with 10 Amps you'll have 10-20W of waste heat per channel. Getting rid of that much power takes a beefy cooling solution which is not small nor cheap. But you get relatively high switching speeds and basically unlimited switching cycles. If you can further reduce your requirements and can live with 150 Ohms of resitance in on case (and therefore very limited current because otherwise the stuff gets too hot) you can look into analog crosspoint switches. Keep in mind, that with all the discreete solutions you still need a way to control it which takes energy as well... There is a nice one for 24V with 16 inputs and 16 outputs. for example the AD75019 by Analog Devices.
H: LIthium 18650 discharge voltage I am capacity testing 18650 batteries from old laptops using constant current, previously I used 2.8V as discharge/cutoff voltage but now raised the value to 3.0V Discharge current is 1Amp. I know discharge voltages depends on battery specifications but my use case is broad and I can't check datasheets of each and every battery, jumping from 2.8V to 3.0V makes a huge difference in total measured capacity but I think I might be destroying batteries discharging them too low. What should be generally safe discharge voltage as people have their own opinion on internet, some go as low as 2.5 while others suggest anything below 3.0 is a disaster. AI: As you have figured out yourself, it depends on specifik make and model of the battery. If you want to find a universally safe cutoff voltage, I'd say 3.0 V is probably what you'll want to use. I don't think I've ever seen a lithium-ion battery specifying a higher cut off voltage than that. But as there are many batteries that specify 3.0 V as minimum cut off, you don't want to go lower than that. If you check the datasheet of every battery you will test, you could possibly go lower on some of them, but discharging below 3.0 V will most likely not be universally safe. The voltage of pretty much all lithium-ion cells will start dropping pretty quickly below 3.0 V with a moderate discharge current, so it really shouldn't make that much of a difference.
H: My PCB works only when I spray isopropyl alcohol on it. Why is that? I'm observing a strange behaviour in some of my PCBs: they start working only when I spray isopropyl alcohol on them (or, to be more specific, the boost converter starts doing his job only after I spray it with alcohol, while connected to a power supply). Let me explain this further: given this schematic, if I apply 3.8 volts (with a bench power supply at the moment, but I tried with a lithium polymer battery, too) to the "BATT" connectors, I expect get 3.3 V out of the TPS61201, but I get 0 V. At this point, if I spray some isopropyl alcohol (IPA) over the general area where the TPS61201 sits, I get 3.3 V out of it, and it will keep on supplying 3.3 V until I shut the bench supply off (let it run for more than 5 hours). I'm observing this behavior in the last two PCBs I've soldered, but the three I soldered before these worked flawlessly, so I'm inclined to think that the flaw lies with my handywork (I am currently using a hot air station to solder the components in question), but I can't explain the strange behavior with the alcohol. Any idea why this might happen? Here is a photo of the soldered TPS61201: If it may help, here is a screen of the board's layout. . I've done some probing around the converter, as suggested, and here are my findings: When the converter "doesn't work": Vin: 3.9 V EN: 3.9 V PS: 3.9 V FB: 0 V Vout: 0 V UVLO: ~272 mV After a quick spray: Vin: 3.9 V EN: 3.9 V PS: 3.9 V FB: 3.35 V Vout: 3.35 V UVLO: ~272 mV I've ordered a can of freeze spray for further testing and I'm thinking of a way to measure my board temperature around the converter, to rule out a thermal protection problem. I'm trying to "digest" all the suggestions, but it may take me some time, for my background is lacking in the field, so bear with me. Ok, maybe I find the issue, thanks to @TonyStewartEE75 and @BruceAbbott answer and comment. I didn't understand the UVLO hysteresis at all: according to the datasheet the rising UVLO voltage (that is, if I get this correctly, the minimum voltage needed to turn the converter on) is 350 mV. Back to the UVLO threshold formula I went (datasheet par 11.2.2.2) and this is what I got: $$ 2700000 = 249000 *(x/0.35 - 1) \\ x = 4.14 $$ So I cranked up my Vin from 3.9 V to 4.2 V and the converter works as intended. It seems that I have to switch my R9 resistor with another with more "sane" values, for I doubt my single cell lithium polymer battery would ever reach the full 4.2 V, preventing my board from ever switching on. AI: The isopropyl alcohol will increase surface capacitance by 18 times or more depending on thickness and then reduces as it evaporates. I am inclined to believe the design is marginal for bias resistors for UVLO, yet follows the datasheet. "The typical current into the UVLO pin is 0.01 μA, and the voltage across R4 is equal to the UVLO voltage threshold that is generated on-chip, which has a value of 250 mV. Therefore, the recommended value for R4 is in the range of 250 kΩ" You can measure UVLO or raise it to confirm it is OK. Then report all pin conditions of OK and not OK with a DSO. But only use the needle coil on the tip/ring of a 10:1 probe.
H: I'm looking for a very sensitive photodiode I'm working with a custom board that has a simple input to detect a closed switch, and I'm hoping to use it as a light sensor. I was thinking of just attaching a simple photodiode (Like this one: https://www.digikey.com/en/products/detail/excelitas-technologies/VTP9812FH/5885875), and that works, but it requires a pretty high level of light to switch. I'm hoping there's an option with a much higher sensitivity, so the circuit would be open when in pitch blackness, but closed when there's almost any amount of ambient light. Any recommendations on an alternate component, or a more complicated circuit that I could rig up to accomplish that? AI: The maximum quantum efficiency of a photodiode is 1 electron per incident photon. This sets a limit on the maximum responsivity of a photodiode at any given wavelength (because the energy per photon depends on the wavelength). To get a stronger response in your system, you can use a transimpedance amplifier or TIA with your photodiode. Or, if the signals you're receiving are fairly slow you can use a phototransistor instead of a photodiode. Or, for faster signals you can use an avalanche photodiode or APD. APD's use the avalanche effect to produce internal gain and produce an effective quantum efficiency greater than 1. But they require adding a precision high voltage (20-400 V) bias source to your system. Note: In optoelectronics, responsivity refers to the amplitude of the response of a receiver, measured in amps per watt of input optical power. Sensitivity refers to the minimum input power required to be detectable compared to the receiver noise. The sensitivity of your receiver likely depends more on the noise performance of your transimpedance amplifier or sampling circuit than on the photodiode itself (although the photodiode capacitance affects the receiving circuit noise bandwidth).
H: Op-Amp inverter not working at high frequencies I set up an inverting Op-Amp with the following schematic, inputting a 32.8 kHz signal. Two identical resistors on each side of the inverting input. Bias voltage is 7.5 V, Supply voltage is 15 V and 0 V respectively. I expected an output like this, where the input is near-identical, but 180 degrees out of phase to the output. (This is done with the LTSpice's own near-perfect Op-Amp) Instead, I got this. I don't know how to describe it with words. Green is the output. I'm aware that the inadequacies of the LT1490 Op-Amp is a cause in it, but I'm not sure why as the datasheet gives a gain bandwidth product of 200 kHz, which suggests that this Op-Amp should be able to handle operations much less high-speed as 32.8 kHz. I'd like to solve this problem without getting another type of Op-Amp if possible as my budget is low though I'm open to using other high current, rail to rail op-amps (preferably low-cost with recommendations) if needed. AI: The op-amp will never hack a signal that big due to slew rate limiting: - The op-amp data sheet suggests that it will produce a maximum output voltage change of 60 mV per μs (or, 6 volts in 100 μs). I've drawn that in red on part of your display to show that the op-amp is doing exactly what can be expected of it in a typical situation. Regarding the jumping around 110 μs, I expect that is an artefact of the model you used (given that the op-amp cannot be expected to change its output anything like that quickly). You need to choose a proper op-amp that is suitable for a much faster slew rate. Requests for product recommendations are off-topic (site rules). Read the rules.
H: Op-Amp Voltage Follower not working at "extreme" voltages I was testing the AD712 on LTSpice with a simple voltage follower. In a perfect world, I'd get this. Instead, I'm getting this. Now, I am aware that op-amps do not reach their V+ and V- voltage and usually fall a bit before that limit. However, according to the AD712 Datasheet (p.4) the output characteristics for V+ and V- = +-15V should be +13.9 and -13.3 respectively, a reduction of 1.1 and 1.7 volts. While for my use case of V+ and V- = +15V and 0V, I am getting reductions of 2 and 3 volts. Is there something in the datasheet that I missed? Or perhaps, some method of circumventing this issue? AI: Is there something in the datasheet that I missed? The input voltage range (but the device is fully characterized for +- 15V only): And this note is also important: Typically exceeding −14.1 V negative common-mode voltage on either input results in an output phase reversal. So, you can't power it with +15V and 0V and input a signal which reaches these two values. Within the limits it looks fine:
H: Connecting different voltage sensor I have a very basic question. I have a esp8266 device that needs to read from an analog device. the device runs at 24V, and the ESP at 3.3V. Should I connect both grounds? This is the schema: AI: Current from the sensor must run back to ground, in addition the 3.3v from the sensor will be 3.3v above the ground of the sensor. Because of this is important to make sure the voltage of both grounds is the same, do this by making sure the cables are large enough to support the current flowing though them (the resistance in the cable will create voltage when current flows though the wire, V= I*R to minimize the voltage make sure the cables resistance is low)
H: What is this strange black rubbery component? A capacitor? I'm trying to figure out how a PCB works (that I took out of something). I'm going through and looking at the different components, and I've identified a handful of parts, but I'm totally stuck on this one. It is near a few capacitors, but it has no uF written on the side, and the packaging doesn't look like a capacitor, although the general shape is the same, so I don't think it is a capacitor, though it could be. The outside has a rubbery texture to it. In the photo above, it says "E487" (the seven is on the corner - I'm pretty sure it is a seven, but perhaps not) The underside of the PCB. I've outlined in red where I think the component is connected (not totally sure, though) Sadly, searching for "e487 datasheet" didn't yield anything helpful. What is this strange component? AI: It's an unshielded (drum type) inductor with shrink-wrap tubing around it to protect the winding. Hence the designator "L2". Part of a switching regulator. Edit: The PN8016 switching regulator chip here is a non-isolated DC-DC converter, so the output is not galvanically isolated from the mains. It is potentially lethal if you come into contact with the low voltage output or "GND" (or pretty much any other part of the circuit). In this case, the DC input is several hundred volts.
H: 2nd order RC lowpass filter cut-off frequency and Transfer Function I'm stuck trying to calculate the cut-off frequency and transfer function of the filter below. I'm not sure how to handle the mirrored resistors on the bottom (R9, R11) or the extra resistors (R12, R13). New to electronics so any advice would be helpful. [Edit] I've tried remodelling the circuit like this to run through a 2 pole Rc filter calculator but not sure if it is correct Thanks! AI: You can certainly use a simulator to find the equivalent circuit when removing the differential configuration: Once you have a working equivalent schematic (same ac and dc responses), then you can start the analysis of this second-order filter. I will neglect the 6-pF contribution which comes across the 2.2-nF capacitor: The easiest and fastest path here is to apply the fast analytical circuits techniques or FACTs as described in my book. Without writing a single line of algebra, just by determining time constants by inspection, you can determine the transfer function of this circuit easily. The maths details are given below:
H: Isolation voltage to distance conversion Introduction: I am designing a board with a standard IEEE 802.3 1000Base-T ethernet interface. The board is a standard 4-layer FR4 board with all components on top and GND on Layer 2. The IEEE 802.3 standard basically requires 1500Vrms isolation from the MDI to the MII part of the interface. IEEE 802.3 references IEC60950-1/IEC62368-1 for test method and compliance criteria. The part of the interface that is relevant here is the magnetics and the connector. Chosing any ethernet transformer will provide the nescessary isolation between the MII and MDI sides. But typically a Bob-Smith termination is included in the MDI side (for common-mode noise supporesion). The capacitor must be a high-voltage capacitor, in order to maintain the 1500Vrms isolation. My question pertains to the layout of the Bob-Smith termination components: Real estate is expensive on my board so I am forced to place the capacitor in parallel and quite close to one of the 75 Ohm termination resistors. So now I am faced with the question: How far do the capacitor (that has signal GND on one terminal, which is the MII interface) need to be from the neighbouring resistor (which is placed in the MDI part) in order to maintain the 1500Vrms isolation? What I need is basically a Voltage isolation to clearance/creepage distance calculator. Looking online I found http://creepage.com/. Typing in 1500Vrms under creepage gives me the following result: So the min. spacing should be 4.1 mm, right? Does anyone know if this is the correct approach to figuring out the required isolation distance? AI: I think most pros will use IPC-2221 as their reference for circuit boards. You can find the "A" version as a pdf on-line and here's an extract I sometimes use: - Here's the "A" version pdf link: https://www.ipc.org/TOC/IPC-2221A.pdf If I were to plug-in 1500 volts AC I would choose a peak voltage that is \$\sqrt2\$ higher or 2121 volts. So, for an assembly (A5 column) with a conformal coating, the electrical conductor spacing is 2121-500 volts x 0.00305 mm plus 0.8 mm = 5.74 mm. This is also the same distance as a bare PCB with bare conductors under a solder mask (polymer coating) i.e. column B4. If you have tracks that are on internal layers (B1) then 2121 volts requires a distance of 0.25 mm plus 2121-500 volts x 0.0025 mm = 4.3 mm.
H: Dimmable LED strip from 3.3V I want to control a 5A maximum 12V LED strip from a 3.3V ESP32. I want do all of this with THT components ideally. I've been struggling to find the best way to drive the N FET so settled with an NPN as all of the IC drivers require 5V input. Does the below schematic look like it should work or could anything be changed such as resistor values, possibly a gate drain resistor? AI: No. The problem is that when the MOSFET switches on, the voltage across it will fall down towards zero and that will reduce the supply to the resistor that drives the gate and turns it on. Instead of turning fully on it'll settle in a state where the drain-source voltage is somewhere around the Vgs threshold voltage for the device, dissipating a load of power and overheating. Connect the pullup resistor directly to the 12V supply instead:
H: Switching ATX PSU with a NPN transistor controlled by a 12V signal I searched everywhere but I can't find a circuit to turn on a PSU with a 12V signal. I know that PS_ON has an internal pullup but its value may change by vendor. So I don't know if I can use this circuit: switch 5V with 12V because a user wrote that the base resistor must be calculated with the pullup value. Thanks AI: Not quite… since you are doing pure switching you don't really need to set a 'proper' quiescent point. The 2N2222 can handle a lot of current for this application, in fact. At 150mA collector has a minimum guaranteed hFE of 100 so with only 1.5mA base drive you'll drive it without issues. I really doubt it takes 150mA to turn on the PSU, probably 10-20mA would do the trick anyway. By the way, the specs for the pin are there: https://www.intel.com/content/dam/www/public/us/en/documents/guides/power-supply-design-guide-june.pdf at page 23 it says that 1.5mA must turn on the supply. It's really easy to drive.
H: Weak edges over SPI data lines I am developing a driver for an SPI temperature sensor, and having some trouble with poor quality edges near the end of packet on the data lines. While I am not experiencing any data loss, I am worried this is evidence of a larger issue; any suggestions on potential simple causes of this problem would be welcome. Temperature Sensor Data Sheet https://datasheets.maximintegrated.com/en/ds/DS1722.pdf AI: As you can see in this table from the datasheet, as soon as the Chip Enable signal goes low, the output of the slave goes into High-Z state until a read operation is initiated. Then the output is essentially floating, so the voltage on the line is then determined by some pull up/down if present, or simply by any leakage current on the in/output. Either way, the voltage on the MISO/MOSI lines really does not matter between the packages sent. So this behavior is both expected, and not an issue.
H: How does STM32CubeIDE locate the header file in such case? I created a C/C++ project in STM32CubeIDE as follows: In the main.c I had to write the include as follows: #include "..\Inc\myRandom.h" otherwise if I only write #include "myRandom.h", then I get the following error: error: myRandom.h: No such file or directory But if the project were created as a STM32 project for an embedded device the above problem does not exist. For instance: Above in main.c #include "myRandom.h" did not give any error. How come I don't need to write #include "..\Inc\myRandom.h" in this case? AI: If you check Project Properties -> C/C++ Build -> Settings -> Tool Settings -> MCU GCC Compiler -> Include Paths, you can find every path that the IDE includes. If your path does not exist there, you can simply add it.
H: How to design RF Matching circuit for Transmitter MCU (BC66F2245)? I am designing a PCB where i use the Holtek BC66F2245 Transmitter MCU to send data using RF at 433MHz. I'm currently drawing the schematic in Altium and now i've come to the point of designing the matching circuit. I am sending my data at 433MHz with a 50Ohm antenna, that is all i know. I've watched many videos about matching circuits so I know exactly what it's used for and why it's needed, but I have no idea how to design one for my MCU since the data sheet provides me with no more information than the image below. How do I start with designing a matching circuit for this MCU? AI: How do I start with designing a matching circuit for this MCU? Start by breaking things down and giving them names: - Z1 (in green) matches the complex output impedance of the RFout port to a resistive value at your operating frequency. Basically it can be as simple as a series tuned LC that is terminated in the naturally resistive impedance of the Pi filter. Z2 (in blue) matches the complex impedance of an antenna to a resistive value (usually 50 Ω) at your operating frequency. If your antenna is 50 Ω then no need for the inductor. Pi network (in red) matches the resistive impedance coming from Z1 to the resistive impedance presented by the antenna and Z2 at your operating frequency The one to concentrate on is usually the Pi filter. Here's an extract from my website on how to design one: - So, plug the numbers into the on-line calculator I linked and see what you come up with. There is more information on the link BTW.
H: Voltage divider formula? Actually I am not able to understand how the author arrived at this equation using voltage divider formula ? what I tried is , I combined the two 2R resistor connected to ground in series and wrote 4R then, it is in parallel with the single R resistor . I am confused where I made the mistake, and also I request you to please provide any general rule for this method . AI: Here's a hint. Using Thevenin's theorem, you can simplify the circuit like this: - It should be a walk in the park for the next step.
H: Active filter for low capacitance AC coupled input I need to interface an AC coupled sensor with rest of my system. The sensor I am working with produces approx. 10V peak with 10V of DC offset but it has a very small series resistance about 50fento. Sensor operates at about 35KHz. My initial thought is to use an op-amp in inverting configuration for ease of bias setting (reference voltage at +IN). I also want this circuit to work as low pass filter. The problem I face are reasonable component values. I do not want to use feedback resistor value larger than 10Meg ideally I would like to reduce it while maintaining -3dB at 35KHz. This however means that I would need to reduce C(feed) to maintain fc at 35KHz which leads to lower output amplitude in pass band. Is there any other topology I could use? My goal is to keep SNR in my system as high as possible and noise as low as possible. AI: You will want a very low input capacitance load CMOS Op Amp to work as a Charge Amplifier or TransImpedance Amp. (TIA) This research shows how your BW and Cs can be loaded without the usual pF load attenuation. Rin values of 1000 Gohm are possible in commercial packages but I have not looked for the lowest Cin specs except for one which is 100 fF. The research design shows Cin < 100 fF.
H: Analysis circuit using Thevenin theorem in the book "Engineering Circuit Analysis", example 5.9, i don't understand few things, hope someone can clear up for me: Why does the dependent current can't flow through resistor 3k? If it's because of we assume 2 terminals of vx is open circuit then isn't we can't use KVL for the outer loop as it's not a loop? And also i don't understand why vx = 8V = Voc AI: Just look at the voltages and currents that can only be when there is no load: - Hence: - $$V_x = 4 + V_x\left(\dfrac{2000}{4000}\right)\text{ or,}\hspace{1cm} V_x = 8$$
H: Which manufacturer's logo is this? I'm trying to identify the manufacturer (and hopefully part number) for these capacitors. My guess is they're standard aluminium electrolytics, rather than something fancy like alupoly, but I can't say for certain. Anyone recognise the logo? AI: Which manufacturer's logo is this? Nichicon (or fakes): - Here is the actual part (UCM series marked as CM): -
H: Is there a standard for specifying the direction of a right angle wired connector? When using connectors on wires (e.g. USB cables), there are four potential directions the wire can face relative to the connector: (image snipped from https://www.newnex.com/usb-right-angle-cables.php). Is there a standard for referring to the directions of these connectors? "Up" and "Down" are fairly obvious, but "left" and "right" are ambiguous depending on if you are looking from the perspective of the cable or the connector. I'm curious as writing specifications for these cables would be easier if there was a standard. AI: They are knows as right angle connectors, the orientation would be manufacturer specific. Lcom defines the cables listed in the picture of OP above as follows: Down angle, right angle, Up angle , Left angle Source: https://www.l-com.com/usb-right-angle-usb-cable-assemblies
H: Sliding window protocol In the sliding window protocol when the receiver sends RRn to the sender the receiver's window is shifted to the right now starting at the n position correct? Suppose this is the window of the receiver(third from top to bottom): When the receiver sends RR11 to the sender the window then becomes 11 10 9 8 , correct? AI: As jonk explained in the comments, there is not a unique sliding window protocol. I've found this slide here that may clear up the concept, in general terms: So RR4 would mean that all frames up to 3 were received and the receiver is ready for the 4th one. This controls the transmitting window size accordingly, even if this frame has already been sent.
H: PQ Theory: Imaginary power from \$\alpha\beta\$ to \$abc\$ coordinates In "Instantaneous Power Theory and Applications to Power Conditioning" By Akagi, it states the following with regards to PQ Power Theory: Is that \$\frac{1}{\sqrt3}\$ coefficient actually correct? Or is my approach incorrect? I tried to derive by taking plugging in expressions from the Clarke matrix into the \$q(\alpha, \beta)\$ to find \$q(a,b,c)\$. And I've run through the calculation a few times now and I get a coefficient of \$\frac{1}{\sqrt2}\$. Essentially, what happens is that both terms contain the last row of each matrix as a multiplicand thereby imparting a coefficient of the \$\frac{\sqrt{3}}{2}\$ to the entire term and that coefficient immediately interacts the \$\sqrt{\frac{2}{3}}\$ coefficient in front of the matrix so there's nowhere for a \$\frac{1}{\sqrt3}\$ to come from. EDIT: Hmmmmm...it looks like later (*actually, earlier if you look at the equation labels) the book justifies that: by doing: where: Adding that coefficient would make the result of my work match up with the initial statement but that doesn't really explain why what I did was invalid. Here is the section as it is written: AI: As far as I know, the Clarke matrix has two versions: one that preserves the amplitude, \$C_a\$, and one that preserves power, \$C_p\$: $$\begin{align} \pmb{C_p}=\sqrt{\dfrac23} &\begin{bmatrix} \dfrac{1}{\sqrt2} & \dfrac{1}{\sqrt2} & \dfrac{1}{\sqrt2} \\ 1 & -\dfrac12 & -\dfrac12 \\ 0 & \dfrac{\sqrt3}{2} & -\dfrac{\sqrt3}{2} \end{bmatrix} \tag{1} \\ \pmb{C_a}=\dfrac23 &\begin{bmatrix} \dfrac12 & \dfrac12 & \dfrac12 \\ 1 & -\dfrac12 & -\dfrac12 \\ 0 & \dfrac{\sqrt3}{2} & -\dfrac{\sqrt3}{2} \end{bmatrix} \tag{2} \end{align}$$ Now, if you consider his example further, you get these two results: $$\begin{align} \pmb{v}&= \begin{cases} v_a(t)&=\sqrt2\sin(\omega t) \\ v_b(t)&=\sqrt2\sin(\omega t-\dfrac23\pi) \\ v_c(t)&=\sqrt2\sin(\omega t+\dfrac23\pi) \end{cases} \\ \pmb{C_p}\times\pmb{v}&= \begin{bmatrix} 0 \\ \sqrt3\sin(\omega t) \\ -\sqrt3\cos(\omega t) \end{bmatrix} \tag{3} \\ \pmb{C_a}\times\pmb{v}&= \begin{bmatrix} 0 \\ \sqrt2\sin(\omega t) \\ -\sqrt2\cos(\omega t) \end{bmatrix} \tag{4} \end{align}$$ So you can see that (3) adds the \$\sqrt3\$ factor which satisfies the equation (3.10), while (4) maintains the \$\sqrt2\$ as amplitude invariant. Now I see that the Wikipedia page also has the explanation, while Akagi's book (IIRC) does mention but only that the matrix used is power invariant. Therefore it makes sense to keep it since this is about powers. I'm not sure if it was enough, so I'll add another example. Let's say that the voltages and the currents are defined in a generic way: $$\begin{align} \pmb{v}&=[v_a,\;v_b,\;v_c]^T \tag{5a} \\ \pmb{i}&=[i_a,\;i_b,\;i_c]^T \tag{5b} \end{align}$$ Applying the power invariant transform gives the \$\alpha\beta\$ components (ignore the zero component): $$\begin{align} \pmb{v_{\alpha\beta}}=\pmb{C_p}\times\pmb{v}&= \begin{bmatrix} \dfrac{2v_a-v_b-v_c}{\sqrt6} \\ \dfrac{v_b-v_c}{\sqrt2} \end{bmatrix} \tag{6a} \\ \pmb{i_{\alpha\beta}}=\pmb{C_p}\times\pmb{i}&= \begin{bmatrix} \dfrac{2i_a-i_b-i_c}{\sqrt6} \\ \dfrac{i_b-i_c}{\sqrt2} \end{bmatrix} \tag{6b} \end{align}$$ Now the power is calculated as \$q=v_{\beta}i_{\alpha}-v_{\alpha}i_{\beta}\$ and if you look at the denominators you'll see that you have \$\sqrt6\$ and \$\sqrt2\$, coupled with a \$2\$ in the numerator (one from \$v_a\$ and one that will come to be from \$\pm v_b\pm v_c\$). If you'll do the math (I'm tired of typing...), you'll end up with \$2/(2\sqrt3)=1/\sqrt3\$, as in (3.35). For the sake of completeness, I'll expand on the previous example. I'll use \$i\cdot v\$ instead of \$v\cdot i\$ to make the factoring more clear and closer to equation (3.35) in the OP: $$\begin{align}\require{cancel} q&=i_{\alpha}v_{\beta}-i_{\beta}v_{\alpha} \\ {}&=\dfrac{2i_a-i_b-i_c}{\sqrt6}\dfrac{v_b-v_c}{\sqrt2}-\dfrac{i_b-i_c}{\sqrt2}\dfrac{2v_a-v_b-v_c}{\sqrt6} \\ {}&=\dfrac{1}{2\sqrt3}(2i_av_b-2i_av_c-i_bv_b+i_bv_c-i_cv_b+i_cv_c-2i_bv_a+i_bv_b+i_bv_c+2i_cv_a-i_cv_b-i_cv_c) \\ {}&=\dfrac{1}{2\sqrt3}(2i_av_b-2i_av_c-\cancel{i_bv_b}+\cancel{i_bv_b}-\underline{2i_bv_a+i_bv_c+i_bv_c}+\overline{2i_cv_a-i_cv_b-i_cv_b}+\xcancel{i_cv_c}-\xcancel{i_cv_c}) \\ {}&=\dfrac{1}{2\sqrt3}\big[2i_a(v_b-v_c)-2i_b(v_a-v_c)+2i_c(v_a-v_b)\big] \\ {}&=\dfrac{2}{2\sqrt3}\big[i_a(v_b-v_c)-i_b(v_a-v_c)+ic(v(a-v_b)\big] \\ \Rightarrow \\ q&=\dfrac{1}{\sqrt3}\big[i_a(v_b-v_c)+i_b(v_c-v_a)+i_c(v_a-v_b)\big] \tag{7} \end{align}$$
H: Same behavior, different synthesis outputs, state machine coding style in VHDL In an old course book on VHDL I've been revising, the author discussed the effect of coding style on the actual synthesis output of state machines. The example discussed in the book is a classic Mealy machine with synchronous outputs. process(clk, resetn) begin if resetn = '0' then state <= s0; q <= (others => '0'); elsif rising_edge(clk) then case state is when s0 => if a = '1' then state <= s1; q <= "1001"; end if; when s1 => if a = '0' then state <= s2; q <= "1100"; end if; when s2 => if a = '1' then state <= s3; q <= "1111"; end if; when s3 => if a = '0' then state <= s0; q <= "0000"; end if; end case; end if; end process; In the above code, the output q is not assigned a definite value in every state/input combination. There will be instances where the old value of q is kept. The author emphases the importance of assigning a definite value to a state-machine's output at every clock cycle. From a functional perspective, the code in the first example is nevertheless correct. In the second example, the code is almost the same, but the output q is assigned a value in every state/input combination. process (clk, resetn) begin if resetn = '0' then state <= s0; q <= (others => '0'); elsif rising_edge(clk) then case state is when s0 => if a = '1' then state <= s1; q <= "1001"; else q <= "0000"; end if; when s1 => if a = '0' then state <= s2; q <= "1100"; else q <= "1001"; end if; when s2 => if a = '1' then state <= s3; q <= "1111"; else q <= "1100"; end if; when s3 => if a = '0' then state <= s0; q <= "0000"; else q <= "1111"; end if; end case; end if; end process; The author states that, although both designs maintain the same behavior, the synthesis result is not identical. The first design is 12 gates larger! The second design optimizes away 3 gates per output pin. I synthesized both descriptions in Quartus and observed that the first design seemed to contain a couple of more Muxes. However my question is: is it a completely straightforward task to guess the difference, in exact number of gates, between the two designs or does it require a pen and paper and doing some of the optimizations the synthesis tool normally does (Karnaugh, etc) by hand. I can't see where the 3 gates / output come from. AI: What is width of the state register? Assuming its 2 bits, the second example is different in that the output of q is defined for every combination of inputs, so it's only combinational logic. In the 1st example q needs to be kept in a register from previous cycle since it's not defined for every combination of inputs (I think the synthesizer will not go that far as to determine the value of q is dependent on state). In System Verilog, the constructs always_ff and always_comb help flag these kinds of differences at synthesis. Edit: screenshot of Xilinx Vivado RTL schematic added Each block of logic highlighted is combinational, with some truth table N input bits by M output bits. There is no way of predicting the number of gates this mux will synthesize down to without doing the optimisations yourself with K-maps and whatnot (it might also be using logic common to other combinational logic circuits, e.g. CE signal for state and q are identical). What this actually compiles down to is dependent on the target architecture (how many inputs your FPGA lookup table blocks have or what library cells are available when laying out an ASIC). Case 1: CE logic: takes inputs a (1bit), state (2b), outputs CE (1b). Truth table is 3b wide input by 1b wide output Next q logic: same set of inputs as above, 3b input, 4b output Case 2: Next q logic: 3b input, 4b output Another thing, even though the "Next q logic" table has the same size, the CE logic makes it so the output doesn't matter for most of the combinations so can be optimised much further. Implementation: 1st case needs 6 LUTs, 4 D-flipflops with CE. 2nd case: 5 LUTs, 6 D-flipflops with CE. It has separate registers for state and q Maybe someone else can explain what's going on.
H: Can extra long pads cause problems? I am a hobbyist and I find it very difficult to solder and work with SMD components which have very small underneath pads. I can't see when the solder flows, I can't touch the pads with the multimeter, and therefore I have no confidence in the board. I want to make extra long pads so I can touch / see the connections and be more confident. Will extra long pads as below cause problems for me? (Normal pads left, extra long pads on right). Photo of the 9mm wide module I will be soldering onto my board for reference (I will also be using a ST LPS22HB pressure sensor which has much smaller pads). Thanks, I know this is a bit stupid but I have had a couple failures on this design and have to wait weeks for new revisions, so best to ask. I use solder paste applied by syringe and either a hot plate or a heat gun. Update a few months later: The extra long pads saved me so many times, was able to see and fix many failed solder joints which I had no way of knowing were failing in the past. AI: No, In fact there are different suggested footprints for hand soldering and for stencil applied paste soldering. https://forum.kicad.info/t/why-different-pcbnew-footprints-for-hand-soldering-smd-603-resistors/3857
H: Battery specifications open or closed condition Are battery specifications for open circuit or closed circuit conditions? I understand that a battery connected to a load will have a multimeter reading of low voltage, due to the voltage dropped on the internal resistance of the battery. Thus, if I have an open circuit voltage Vbat = 3.6v and connected a load, I could measure a lower voltage. I also read that the current draw and temperature affects this. I am particularly interested in Lithium ion cells. Most datasheets I read specify: Nominal voltage: 3.6v Max charging voltage: 4.2v Cut-off voltage: 3.0v Are these voltages in open circuit (and *rested) condition or loaded condition? *I read that loaded batteries, when removing load will have their voltages rebound and stabilize after a few hours or so. Say I have a loaded battery with Vloaded = 3.0v. When I remove the load, the open circuit voltage becomes higher (3.3v) and will continue rising and stabilize only after a few hours. Background/Reason for asking: I want to test a certain charging circuit to see if it can charge healthy fully discharged batteries. By healthy, I mean batteries that were discharged up to their cut-off voltage only (not to 0v). In order to this, I am going to discharge the battery cell (taking into account the max discharge current from datasheet) up to their cut-off voltage by monitoring the loaded voltage. Once I see that the loaded voltage ~3v (cut-off), I am going to remove the load. But when I remove the load, I see that the open circuit voltage becomes higher and continues to go higher until it stabilizes after a few hours. I need to know if the specified cutoff = 3v is the open circuit rested or the loaded voltage. If its the former, then it means I would need to keep discharging/removing/resting the batteries until I finally get a rested open circuit voltage of 3.0v. AI: The max and nominal voltages are open-circuit voltages. Note that lithium ion batteries have smaller series resistance for their capacity when compared to lead acid batteries (all variations of lead acid). So the difference between open and closed circuit condition is usually less pronounced unless it is a heavy load. The cut-off voltage of 3.0 is pretty low. Also, typically when you cut-off, there is a load attached. So in practice, you can just use the closed circuit condition for the cut-off. Lithium ion batteries "rebound" faster than lead acid when the load is removed. I think it may take a few minutes or 20 minutes or something like that. Rather than several hours. It would be a good thing for you to measure, if you feel like it. Just take a volt meter reading every 30 seconds for a while, then every minute, then every 5 minutes and graph it all out.
H: D/C Decoupling Capacitor for Microphone Bias I have the circuit below which provides a bias voltage to a microphone: C10 is listed as a 47uF (bipolar) capacitor Is there any reason I can't use something like a 100nF bipolar ceramic instead? AI: First of all, C10 is not a decoupling cap. It's coupling cap. The following is the AC equivalent of the circuit above (including the input impedance of the next stage): simulate this circuit – Schematic created using CircuitLab As you can see, C10 and the parallel of Rin and R9 form an HPF and bring a low-cut at: $$ \mathrm{f_{cx}=\frac{1}{2\pi\ (R9\ || \ R_{in}) \ C10}} $$ With C10 = 47uF, the low cut will be around 25 Hz. But with C10 = 100nF, the low cut will be around 12 kHz. The low cut at input should be as low as possible. Generally, selecting one third to one tenth of the minimum target frequency will be enough for most applications (e.g. for audible frequency range, 20-20000Hz, 2 Hz is enough). Assuming this mic will be used for human speech (which falls in range of 300-3400 Hz), a low cut at 25 Hz is a well enough choice.
H: Is there a way to measure potential power output of photovoltaic panels? Is there a way to measure the current power output of solar panels? I know how to measure voltage and current with an Arduino. What I don't know is how to measure the "unused potential power" of a solar panel at the moment. Let me explain using an example: I have a 120 W 12 V photovoltaic array which is connected to a 12 W LED (1 A). If I measure the current, it will show 1 A. What I want to know what is the current maximum output of the solar panel, which at 100% direct sunlight could be as much as 10 A (120 W) or less. Is it possible? AI: First things first: the current power output of solar pannels IS the one currently "consumed" (I include heat losses and storage in battery if existant.) So if you connect a 12 W LED that consumes 1 A at 12 V, and if your solar pannel's voltage-curent curve passes exactly at (12 V, 1 A) for the current amount of light, then your solar pannel will produce only 12 W. If (in the same conditions) you decide to plug in a second (identical) LED, you will know have twice the load. If the solar panel were an ideal voltage source, you would now draw 2 A at 12 V (=24 V.) In practice, however, the voltage will be slightly lower (maybe 11.8 V), and at a lower voltage, the LEDs will also draw less current (maybe 0.9 A each), so you harvest 11.8*0.9=21.24 W. If you continue adding load, you will reach the maximum power point (that is, have the load that gives the "best" trade-off between current and voltage, harwesting maximum power.) If you add yet more load, you will continue to increase the current, but the voltage will now decrease "too fast," making the output power decrease. Good solar battery chargers will make sure to always work at the maximum power point. Measuring the current power output is simple (measure current and voltage at time t.) This is useful if you want to know what you are currently producing (for example if you store or sell the produced electricity.) Measuring the "potential" power (i.e. the power at the maximal power point) is not possible directly (you cannot "just" add a sensor and know it.) There are however a few indirect solutions: Add a variable load commanded by the Arduino, and from time to time, make it "sweep" through the range of possible values, while measuring voltage and current: the maximum voltage you measure is a good approximation of the maximal possible power (it is equal if you vary your load continuously.) In practice, you might use a few power-resistors switched on/off by relays commanded by the Arduino. If you choose the values of the resistors wisely, you can get many values by activating several values at once. If you already know approximatively the resistance you need to reach the maximum power-point in a low light condition, you can have one resistor for this value, and others to add to fill the "range" of possible values. Add a battery and a MPPT (maximum power-point tracking) charger: as long as the battery is not full, you will always get the maximum power (so current current = maximal power), so you can just measure current power. Measure maximum power "by hand" and calibrate. NB: this works only if your load is constant. So for example, on a bright day, with your LED connected, you have 12.2 V. When you measure "by hand" the maximal power, you get 120 W. On an average day, you get 12.0 V, and a maximal power of 80 W. On a slightly cloudy day, you get 11.8 V and 40 W. So you might approximate max power as 120 - 40*(12.2-voltage)/0.2. Of course, in reality, it will probably not be linear, so you will need some more points
H: How to Calculate Ripple Current? How do I calculate the ripple current a capacitor will experience for a given circuit? For example, let's say I have a smoothing capacitor on the output of a full-wave bridge rectifier (120VAC, 60Hz) which leads into the primary winding of a flyback transformer (peak primary current is 0.775A). How do I calculate what this capacitor's ripple current rating should be? AI: The determination of the bulk capacitor value in a full-wave rectification circuit depends on several parameters: the amount of voltage ripple the downstream load - usually a high-voltage dc-dc converter - can accept in worst-case (minimum input voltage and maximum load). It means that if the ripple brings the valley voltage down to let's say 50 V, then the dc-dc converter must be designed to deliver full power at 50 V with margin. A good starting point for ac-dc converters is to adopt a 30% ripple value meaning that when fed by a 100-V rms input voltage, the rectified voltage will have a valley down to \$\approx100\sqrt{2}\times0.7=99\;V\$ the hold-up time is also a parameter to be considered: if the input mains loses half a cycle or more, how long can the rectified voltage stay afloat so that the downstream electronics safely signs off in shutdown mode? Usually, this parameter tends to beef up the initial capacitance calculation. the rms current, finally, is the real selection factor for the capacitor type. You may have determined what capacitance is needed to fulfill the voltage ripple needs but, in the end, what matters is how much rms current the capacitor can handle safely to guaranty the longest operating lifetime. There are are tables and derating factors based on the operating temperature that manufacturers provide. Read and understand these numbers carefully as operating temperature is a key parameter for these electrolytic caps. Good quality capacitors from renowned brands are costly but can last very long when adequately selected. Determining the capacitance value requires a single equation which is given below. It an excerpt from a formula derived in my book on switching converters but you can also find it in a white paper I uploaded on my webpage in 2009. Once you have your capacitance value, I recommend running a quick simulation using either a load resistance or a constant-power source if your downstream load is a dc-dc converter. You can then check your calculation and then update the capacitor value to the normalized value you will finally adopt. As a final word, stay away from ready-made recipes like "3 µF per watt". In my opinion, it is much better to work the maths behind selecting a component as it teaches where the potential issues could be when writing equations and later when operating the component. I remember that I was taught the O.H. Schade's curves long time ago in university but I never used them and always derived the value I needed. You can also have a look at this article I published some years ago on the subject.
H: What is an integrated circuit equivalent for this circuit? I am trying to design a so called signal switch in which I can direct the signal to either go to NODE1 while NODE2 remains HIGH, or the signal goes to NODE2 and NODE1 remains HIGH. The following circuit with transistors seems to do its job in the simulation in Proteus, but I would like to implement it with some kind of integrated circuit. What IC could I use for this? EDIT: for clarification, the signal is digital, coming from node R13(1), the arrow-ish thing in the emitter of the transistors is a Power Rail in Proteus - the software that I have used for this circuit AI: What IC could I use for this? I would tend to choose analogue switches for replacing the BJTs and series resistors. I would use a normally closed analogue switch for the resistor and a normally open analogue switch for its associated BJT. Then, toggle the control line and the output becomes grounded (mimicking the BJT). Something like these would work OK: - Image from here. Each analogue switch shown above has a normally closed and normally open contact hence, one analogue switch element replaces the resistor and its associated BJT. The devil will be in some of the detail and your question is rather lacking in detail so, choosing the "right" device may not be as simple as a walk in the park. Information lacking: - Power supply rails Signal levels Signal frequency range Is DC integrity important? Current (amps) throughput Leakage currents (maximums) Terminal capacitance "on" resistance "off" resistance Logic levels
H: Nodal analysis in circuit contain voltage controlled voltage source I have a circuit below and I need to determine the potential at \$v_1\$ and \$v_2\$. I have 3 questions: simulate this circuit – Schematic created using CircuitLab How do I use nodal analysis at \$v_2\$, or how do I solve this without nodal analysis? I have tried to do this: At node \$v_1\$: \$-1+\frac{v_1-v_2}{10}+\frac{v_1}{5}+\frac{v_1-v_2}{15}=0\$ At node \$v_2\$: \$v_2 = 2v_x = 2\frac{v_2-v_1}{10} = \frac{v_2-v_1}{5}\$ $$=> \frac{11}{30}v_1-\frac{1}{6}v_2=1; \frac{1}{5}v_1+\frac{4}{5}v_2=0$$ $$=> v_1=\frac{120}{49}V; v_2=-\frac{30}{49}V$$ This is wrong, but when I ran a simulator and I accidentally set the function in VCVS is \$0.2(v_a-v_b)\$, then I have the same result. Why does this happen? (This question is unrelate to 2 questions above, but just for curious) When I tried to substitute the \$I_2\$ source with a voltage source in a simulator, the simulation stop immediately, but this does not happen with \$I_1\$ source. Why does this happen? Any help would be appreciated. AI: You said that \$v_x = \frac{v_2 - v_1}{10}\$ The left-hand side is a voltage, the right-hand side is a current.
H: What are some ways to improve on a voltage divider without a voltage regulator IC? We all know the basic voltage divider. It looks something like this. Two identical resistors and the voltage in the middle. I am, however, running into uses where this voltage divider is inadequately accurate. For context, I am using this voltage divider to create a bias voltage for several Op-Amps forming a bridge-tied load as well as a gain amplifier. Firstly, I have other voltage sources that are coming from the other side of the voltage divider. Many of these voltages are high frequency signals from Op-Amps or an ultrasonic receiver. I don't know how relevant this will be but I'm just putting this out there in case it is. Secondly, I have significant loads on the other sides. The math I did suggests the smaller the resistors, the more accurate the voltage will remain. However, I can only set the resistors to be low to an extent before they catch fire. The math. Any suggestions are welcome, even uses that don't entirely fit my use case since I'm (and I'm sure a lot of others) are curious to other use cases in general. I'd like to avoid voltage regulator ICs if possible since I don't have any half-decent ones available to me. AI: You can use one Channel on one op amp. Not a voltage regulator but it does use an "IC" so I don't know where that falls into your requirements. You can add capacitors in parallel with the resistors to further stabilize the voltage divider that gets reproduced on the op amp output. You can also use a zener in the voltage divider to further stabilize and then use the op amp to make that voltage "stiffer" as we used to say.
H: Common source amplifier analysis method? When I make a DC analysis for the following circuit the capacitors are open circuit. But what if C1 does not exist, what is the effect in DC analysis? Does the signal generator still exist or should I short it? AI: When C1 is present, you replace it with an open-circuit for DC analysis, meaning that the gate is driven by the R1/R2 voltage divider. If C1 were absent and the signal generator were connected directly to the input, you would need to use the generator's steady-state DC voltage when solving for the operating point of the circuit.
H: What microcontroller speed can work with lidar? I'm making a lidar module as a project at my university. The deliverable should be a module like YDLIDAR X4 Lidar or tf-mini lidar. I watched a video from GreatScott in which he disassembled a YLIDAR X4 lidar. The microcontroller was a STM32F302x6. I went through the datasheet and found it has a maximum of 72 MHz clock. Through a simple calculation light travels at 3*10^8 m/s that means to measure time of flight of 0.5 meter between the object meaning 1 meter round trip it needs to be at least 300 MHz, but it can measure 30 cm. How is that possible or what did I get wrong and what microcontroller clock do I need as a minimum so I can at least match these specifications? Edit 1: It seems that the Microcontroller doesn't do the measuring of the time of flight, a specialaized ic is used that then interfaces with the Microcontroller. In addition I didn't want to use FPGA becuase I know Nothing About it and it will take a lot of time to learn and use for a project like this. AI: The microcontroller is not directly used to time the laser transmissions and returns, but rather is used for digital processing of data obtained from faster dedicated circuitry. The key building block of time-of-flight detection is a so-called "Time-to-digital converter" (or TDC); an example is TI's TDC7200. A TDC can measure times much more precisely than your microcontroller will be able to (either in pure software or using one of its timer peripherals) - in fact, the example TDC I linked offers picosecond-level precision when properly powered, configured, and integrated into a design. To achieve these specs with such a chip, one must carefully implement precise reference clocks, good power supplies, good PCB layout best practices, etc. With the proper set of TDCs and laser drivers connected to the optics of your LIDAR, your microcontroller can initiate pulses, digitally read the return times, and perform any digital signal processing required. This TI application note describes an example application of TDCs and other parts to LIDAR, and is much more useful/precise than a teardown video on Youtube. Note that time-of-flight is not the only approach; it's possible to use mixers and self-mix between outgoing and incoming modulated signals to detect reflection phase for various modulating frequencies, and there are approaches using optical inteferometry, as a comment points out.
H: Higher voltage from comparator to lower voltage at the output... how? I am stuck on how to produce a lower voltage from an opamp used as a comparator that swings from +15V to -15V to +5V at the output, and 0V (when it swings to -15V) as well. I attached the circuit, but for the life of me, it seems so simple, yet I can't work it out. AI: The simple solution is to reduce the problem to a transfer function with Gain and Offset. Input = -15 to + 15 V , Diff=30V, mean = 0 Output = 0 to 5 V , Diff = 5 V, mean = 2.5V Thus the gain is 5 /30 and offset is + 2.5 V 30k//15k= 10k thus satisfies the offset of 2.5V Then the divider load is 10k//15k = 6k so 6/(30+6) = 1/6 which = 5/30 But you can use KVL. I just did it in my head.
H: Most accurate way to measure universal (AC) motor current? I'm designing a control circuit for a universal (AC) motor (single phase, brushed). I've simulated the control circuit and it works as expected. Circuit below is controlled by a STM32G4 series microcontroller. I'm in the process of adding the current measuring capability to the circuit and I need some help in choosing the best method for my use case. It is my first time designing a circuit to measure AC current so I'm not sure what the best way in this scenario is. Requirements and info: Maximum RMS current: 10 A (everything above is considered as an overcurrent condition) Accurate current measurement is required over the whole current span (from 0 A - 10 A) Solution doesn't have to be the cheapest possible (still has to be reasonable) Measurement circuit doesn't have to be isolated since the circuit isn't either (but it can be) Phase control is used RMS current is calculated in software for each period (50 Hz) and can then be averaged over multiple periods if needed ICs with serial interface for reading current need to be avoided Note: I'm not really sure what kind of accuracy is even possible but let's say that I'd like +/- 20 mA from 0 A - 3 A and +/- 100 mA from 3 A to 10 A. What I've looked at so far: My first idea was to use a simple shunt resistor and an integrated (STM32G4) operational amplifier. However, high-side sensing isn't suitable due to the very high common-mode voltage (230 VRMS). Low-side sensing could work but this would introduce a variable voltage drop in the triac's gate loop which would in turn affect triac triggering I guess. Next idea was a hall-effect based current sensor such as TMCS1101 from Texas Instruments. Everything was fine until I've seen the RSS error graph which shows that for measuring currents lower than 2.5 A, error grows significantly. Next idea is a SMT current sense transformer such as this one here. I've never worked with them before. What kind of accuracy is expected over a large span that I need (0 A - 10 A)? What would be my best bet and what should I be cautious of? Triac triggering circuit: AI: RMS current is calculated in software for each period (50 Hz) and can then be averaged over multiple periods if needed That means you need to be sampling much faster than 50Hz, of course. ICs with serial interface for reading current need to be avoided Almost any external ADC you'd be using would have an SPI or I2C interface, and it's never really a problem. The interface is transparent. Your code just deals with the bytes that were transmitted. How they arrived at the MCU is irrelevant once you've set up the data transmission interface. Low-side sensing could work but this would introduce a variable voltage drop in the triac's gate loop which would in turn affect triac triggering I guess. You already have a large trigger sensitivity variation between the two half-cycles, since you only use a unipolar gate current. Typically the gate trigger currents differ by 50% between the two quadrants you'll be operating in. Whatever variation would be added by a small shunt resistor will be irrelevant anyway since you're using a fairly high compliance voltage of 12V. If you want the gate current to be independent of A1 potential, use a current source instead of converting voltage to current using a resistor as you're doing now. Say three transistors + a resistor using VBE as a reference, or call it a day and use an LM334. If you'll want to have a constant trigger sensitivity, then you'll either need to have two gate current setpoints and switch between them based on the polarity of the line voltage, or have a bipolar gate current that follows the polarity of the line voltage. I.e. A2-to-G polarity should be the same then as A2-A1. This also gives you the highest gate sensitivity. The gate trigger setpoint may not be as big of a problem as it appears, since you can have a fairly fast gate current slew rate. It won't present an EMC problem if you keep the loop area small. You can also use two back-to-back mosfets instead of a Triac, but those are a bigger hassle. Triacs are fairly robust. I'd use a fairly small shunt resistor - with full-scale current voltage of 0.1V or even 0.01V. Then apply gain to it. The zero offset calibration can be performed on each line half cycle. The gain can be stabilized by thermally coupling one half of the gain ratio resistance to the shunt resistance. You can then do zero-current switching, essentially getting rid of inductive kick-back, and diminishing commutator arcing as well.
H: Problem with inductance meter I'm trying to simulate a design I found for an inductance meter based on an LC tank and Arduino. To simulate this circuit, I put an amplitude for the current pulse of 40 mA, approximately the current that an Arduino pin gives to 5V. The values ​​for the rise and fall times of the pulse are also set according to those of Arduino, as I read, about 10 ns. The diode would be to protect the output pin of the Arduino from high voltages that could occur at the output of the RLC circuit. For L and C I have chosen suitable values ​​so that the underdamped circuit condition is fulfilled (R>2*sqr(L/C). The resistor connected to the comparator output is a pull-up resistor so that it does not is "floating", since the output is open collector. With all this, the output of the LM339 comparator should be a pulse signal with a cycle of 50% duty and same frequency as the resonant frequency.However it switches in the middle of the negative half cycles of the RLC circuit oscillation when it should be held at zero. Does anyone know why this might be happening? Attached the results of the simulation AI: The specification sheet on page 12, paragraph 9.2.2.1, Input Voltage Range, states that the input must be between Vcc-2V to zero volts (assuming power ground pin is connected to ground). "Operation outside of this range can yield incorrect comparisons." The input voltage is going below zero volts. Try connecting the power ground pin to a negative power supply (e.g., -5V) and see if this corrects your issue.
H: How to get 12V 2A power through an extension cable? I have an AC to DC (12V, 2A) converter (/transformer) plug which I am using to power a wireless router. The connector has "center positive" polarity and the size of the connector is the ubiquitous 2.1mm x 5.5mm. The nearest electrical outlet from the router is ~6m (20ft). The distance is ~3m (10ft) vertically and ~3m (10ft) horizontally as the router is placed high up on the wall to broadcast the best Wi-fi signal. Unfortunately, the wire that comes with the supplied AC to DC power source is only 2m (10ft) long. While I do have a mains rated (230V) extension cord, I would prefer not to run this extension cord up the wall. I bought online a 10m (32ft) 12V extension cord online, with male-female 2.1mm x 5.5mm (see picture). When I use this cable to extend the existing wire, the router does not work correctly. The LEDs on the unit do light up, but I cannot seem to connect to the internet. Unfortunately I do not own a multimeter. I have just ordered one. When I tested the 12V extension cable with some strip LED lights, it seems the LED lights are slightly less bright with the 12V extension cable. Do you have any suggestions on what I might be able to check to make this work? Would it be possible to get a higher voltage or amperage converter if the long extension is causing too much resistance? AI: Unfortunately while it's very easy to extend mains cables, it's very hard to extend low voltage cables. The resistance of copper bites not as the voltage ratio, but as the square of the voltage ratio. Your low voltage extension lead is not 20x worse, but 400x worse than the mains one. You should experiment with putting the router less than 2m from your socket, you might find that the range is adequate in this 'less favourable' position. A meter is not really going to help you, as you already know that whatever the voltage the cable is delivering, it's not enough to run your router. If you measured 10 V, or 11 V, what would that tell you? As a destructive experiment, you could try shortening your cable, it seems to be over-long. Maybe you'd get lucky and find that your router would work with only half the voltage drop. Another possibility is to build your own low voltage extension cable with much heavier wire. But note that a low voltage extension needs to be thicker than a mains extension to power equivalent loads. You could replace your wall power supply with a higher voltage one, say 24 or 48 V, and then use a buck converter to drop it to 12 V at the router. This would permit your low voltage extension to be much lighter gauge than before - remember the voltage squared ratio. But now you're introducing much more equipment. It's maybe possible your router would accept a slightly higher voltage without damage, and tweaking up the voltage of the sending end could be tolerated. But if the router doesn't specify that on its labels, do you want to risk it? Try moving the router near your supply first. What will definitely work is providing a mains extension lead. If the ones you can buy use flex that's too thick, and you're competent to make connections to plugs and sockets, you could buy a length of the lightest gauge 3-core you can find, and make an extension lead with that. Be sure to fuse the conductor correctly, for instance if you use 0.5mm2 wires, use a 3 A fuse in the lead, so that if it ever gets used for a fan heater, it's not going to be a fire risk.
H: sensitivity and frequency-stability of capacitor-based oscillator circuit I am constructing a capacitive transducer which changes capacitance as a function of changes in other physical properties. The capacitance is about 0.1~0.5 nF range, and I want to detect about 0.05% change in its value. Due to some other constraints, I need to detect this change by shift in its resonant frequency such as an LC resonator. Another constraint is that there is only one unknown capacitor, so any circuit that depends on closely-matched capacitors would not work. My question is of the different tunable oscillator circuits that utilitizes capacitors to select oscillation frequency, which configuration(s) have the best frequency stability when the unknown capacitance does not change, and what limits their frequency stabilities? And which circuit has the best sensitivity to capacitance change, i.e. largest df/dC (assuming other components do not change)? Thanks in advance! AI: An LC oscillator is inherently less sensitive than an RC oscillator, due to the square root term. However this difference may be completely reversed by the difference in noise or drift performance between the two types. The easiest way to make an LC oscillator that's insensitive to capacitor ratios is to make one with only one capacitor, a Hartley oscillator. Here's one I was playing with in LTSpice. I can post the .asc file if you don't want the work of re-entering it. C1 is the transducer capacitor, all other capacitors are just 'large'. D1 is for clamping the amplitude to be very small, though there are other methods. This is obviously not a finished circuit, but it does oscillate and will give you a leg up if you want to investigate how a Hartley performs. RC oscillators come in two types, relaxation and sine-wave. The former have more or less linear variation of frequency with capacitance, but are very noisy, due to voltage noise on the wideband input of the comparator. This can be mitigated with a clamped low bandwidth low noise amplifier before the comparator, in a method advocated by Oliver Collins. Sine wave RC oscillators like Wein or state variable go back to lower capacitance to voltage sensitivity due to needing multiple timing capacitors. They are quieter than relaxation oscillators. All of these oscillators will show a voltage and a temperature dependence. This can be mitigated by making the detector capacitance switchable between a low tempco reference capacitor (plastic film or NP0), and measuring the difference between calibration and detector capacitance. Obviously the switch to do this must have a very stable stray capacitance, which is ideally somewhat lower than the capacitors being measured.
H: USB 1 to 2 switch wiring I have 1 USB hub with mouse and keyboard connected and I'd like to build a switch to be able to switch this hub between 2 PCs. I have a 3-position toggle switch with only 2 contact pairs, so I can switch only 2 wires at a time. Ok I can connect all GND contacts of all three USBs together, but what about +5 VCC contacts? Can I safely connect all of them together just like GND or should I buy a switch for 3 pairs? Maybe is it possible to connect VCC contacts using diodes or some guard circuit? Are other combinations for switching possible? (VCC + D-, VCC + D+) Switch AI: Making DIY keyboard/mouse USB switch between two PCs is not worth the risk of damaging the PCs, as products designed for this exist and don't cost much more that parts if you try to make your own. At least a 3-pole switch would be required so that the devices are powered from same PC where the data connections go to. But a three pole switch will not guarantee a safe USB disconnection and connection sequence, because data pins are first to disconnect and last to reconnect.
H: In I2C communication, slave not able to pull down properly during 9th clock pulse (not giving proper ack) I am trying to communicate from master to slave using I2C communication. But during the 9th clock cycle, the slave is trying to pull high to low but it can only pull it down to half the voltage (3.3 V to 1.3 V). I changed the pull-up from 10 kΩ to 33 kΩ then 4.7 kΩ but without getting an improvement in the result. I also changed the slave IC but no improvement. Is there any way to solve the problem? My pull-up voltage was 3.3 V. Also I tried sending the I2C signal by toggling GPIO pin, but same problem happening here also. AI: It looks like your data pin is a push pull output which is wrong. Make sure both the data and clock pins are open-drain outputs as requires by I2C protocol.
H: Calculate current in one way circuit In this circuit. What is the current passing through R1? I was thinking about looking at the left and right sections separately and then just add both currents to get the total current. But then I realized that for eg the 50 ohm resistor and R1 are not parallel, but they are not in a series either. How should I approach a circuit problem like this? AI: This is a transmission line problem if you really want to figure out the momentary/transient charge that flows in R1 when you connect up the power supplies to the circuit and would involve adding L and C to model those real world effects. But as drawn, the circuit is ideal and in a vacuum so no current flows through R1 because there is no closed circuit for it to flow. Since no current flows through R1 then the voltage drop across R1 is 0V via V=IR. That means the potential on both sides of R1 are the same. That might take some time to wrap your head around if you're new to this. So if you took a volt meter and measured the voltage between the two negative terminals of each source you would actually measure 40V (or -40V depending on which way you stuck the red and black probe).
H: Verilog "bus switching" Sorry I am not an expert with Verilog. I come from a software background. I have RAM sharer/multiplexer that I am creating which can take "command requests" from 3 different sources (1. VGA controller, 2. Blitter, 3. External CPU). Each source gets a "slice" of time to communicate with an SRAM chip. Rather than having if conditions everywhere, is there any way in which I can switch some wires to act like C pointers? For example, I have the following 3 outputs: bit [DATA_WIDTH-1 : 0 ] vgaCommandData bit [DATA_WIDTH-1 : 0 ] bltCommandData bit [DATA_WIDTH-1 : 0 ] cpuCommandData Is there any way I can point something to one of these 3 buses so that my RAM controller just does a read to a "currentCommandData" bus that maps to one of the above 3 buses? I don't want to do this: if( sliceOwner == SLICE_VGA ) begin vgaCommandData <= blah; end else if( sliceOwner == SLICE_BLT ) begin bltCommandData <= blah; end else if( sliceOwner == SLICE_CPU ) begin cpuCommandData <= blah; end This may be fine once, but I'm trying to avoid repeating these 3 conditions everywhere. Ideally I would like to have one statement that does something like this: if( sliceOwner == SLICE_VGA ) begin use vgaCommandData when currentCommandData is read/assigned end else if( sliceOwner == SLICE_BLT ) begin use bltCommandData when currentCommandData is read/assigned end else if( sliceOwner == SLICE_CPU ) begin use cpuCommandData when currentCommandData is read/assigned end .... currentCommandData <= blah; I realise I can have a temporary currentCommandData value and then add a condition to copy it back into the respective bus but that's not what I am after. Perhaps what I want cannot be done but I welcome suggestions. AI: I'm not sure whether this is the sort of thing you're looking for, but here's a module that I've used to select one of three AXI stream sources (video) to forward to a single destination. The concept can be generalized to handle any interface that has both input and output ports, like your memory interface. /* axi_mux3.v */ /* This module selects one of three streams to send to its output. * TREADY on the deselected streams is negated. */ /* History: * 2021-02-07 DT Start. */ `timescale 1ns / 1ps module axi_mux3 #( parameter TDATA_WIDTH = 1, parameter TUSER_WIDTH = 1 ) ( /* AXISV video in 0 */ output reg vin_0_tready, input vin_0_tvalid, input [TDATA_WIDTH-1:0] vin_0_tdata, input [TUSER_WIDTH-1:0] vin_0_tuser, input vin_0_tlast, /* AXISV video in 1 */ output reg vin_1_tready, input vin_1_tvalid, input [TDATA_WIDTH-1:0] vin_1_tdata, input [TUSER_WIDTH-1:0] vin_1_tuser, input vin_1_tlast, /* AXISV video in 2 */ output reg vin_2_tready, input vin_2_tvalid, input [TDATA_WIDTH-1:0] vin_2_tdata, input [TUSER_WIDTH-1:0] vin_2_tuser, input vin_2_tlast, /* AXISV video out */ input vout_tready, output reg vout_tvalid, output reg [TDATA_WIDTH-1:0] vout_tdata, output reg [TUSER_WIDTH-1:0] vout_tuser, output reg vout_tlast, /* configuration */ input [1:0] select ); always @* case (select) 2'd0: begin vin_0_tready = vout_tready; vin_1_tready = 0; vin_2_tready = 0; vout_tvalid = vin_0_tvalid; vout_tdata = vin_0_tdata; vout_tuser = vin_0_tuser; vout_tlast = vin_0_tlast; end 2'd1: begin vin_0_tready = 0; vin_1_tready = vout_tready; vin_2_tready = 0; vout_tvalid = vin_1_tvalid; vout_tdata = vin_1_tdata; vout_tuser = vin_1_tuser; vout_tlast = vin_1_tlast; end 2'd2: begin vin_0_tready = 0; vin_1_tready = 0; vin_2_tready = vout_tready; vout_tvalid = vin_2_tvalid; vout_tdata = vin_2_tdata; vout_tuser = vin_2_tuser; vout_tlast = vin_2_tlast; end default: begin vin_0_tready = 0; vin_1_tready = 0; vin_2_tready = 0; vout_tvalid = 0; vout_tdata = vin_0_tdata; vout_tuser = vin_0_tuser; vout_tlast = vin_0_tlast; end endcase endmodule