text
stringlengths
83
79.5k
H: How exactly averaging is performed in the diode sensor based power meter? I was just wondering how the power averaging works in the diode sensor based power meter. Can you please enlighten me? Thank you. AI: I guess you're referring to an RF Power meter like this: The sensor is in a probe that you connect to this "base unit". The signal from the diode, representing the power level, is fed into this unit and measured by an ADC (Analog to Digital) converter. As the data is then in a digital format, averaging is easy as you can simply calculate the mathematical average value. This is very likely done in software (the firmware running inside the base unit) as that is the easiest and most flexible. Flexible as in that you can easily vary the amount of samples over which the average is calculated.
H: DC Battery Stability I have a 12 V load that works by connecting an adapter from the AC socket and this adapter output 12v to the load. I decided to make a 12 v battery that can charged and the feed this load , all the work is done perfectly but the problem is that the battery when connected to the load its output voltage varies from 12 til 0 and the increase and continues like that, which may damage my load, so i think i should use a voltage regulator that outputs 12 v but it will work? if yes what kind of regulators i can buy?? Note : the load takes 1.2 A and the batteries are 4000 mAh AI: I would use a 8.4V LiPo battery pack rather than 12.6V. An 8.4 will would use a DC-DC step-up boost converter. A 12.8V would require a combination step-up/step-down converter. Off the shelf solutions are few for a 1.2 A, 12V - 12V chargers and regulators. But you already have a 12V battery pack. You could use the versatile Linear Tech LT3652 Battery Charger Input voltages from 5V to 32V Will charge up to 2A Works with Lead Acid, Li-ion, LiPo, and Li-phosphate. Example 8.4V Li-ion charger powered with 12V AC adapter: Example 12V Lead Acid charger powered with 5 VDC to 32 VDC : Then for the output regulation the Linear Tech LTC 3111 12V 1.5A Buck-Boost DC/DC Converter With low battery shut off. If you want to switch between the AC adapter and battery without the voltage dropping to zero you can use a Linear Tech LTC4358 Ideal Diode Switch . Or a Linear Tech LTC4412 Automatic Switch
H: How can I identify these capacitor values? I’m trying to build the power supply from this schematic. I’ve been purchasing the parts, but am confused about the capacitors I’ve labeled, especially became their numbers start with “R”. What are their values? What common sense can I use so I can continue to find this out myself? AI: Since a couple of other commenters seem to think it reasonable, I'll go ahead and make an answer from my comment: Taking a wild guess: I have seen a few cases where resistances were written as for example 1R1 to represent a 1.1 ohm resistor. So, those might be 0.1 and 0.01 microfarad capacitors. Additionally, those values would make sense in the given positions for a 7805 linear voltage regulator.
H: Zero-crossing in AC with DC offset signal Introduction I have a project about measuring the voltage, current and power factor of an electrical system. I had designed a system that allows the microcontroller to measure the peak of an AC with DC offset signal. The whole system relies on making an ADC conversion right on the middle of the half positive cycle of the signal. I have two AC with DC offset signals, one that comes from a current transformer and other from a voltage transformer. When I finally got both ADC measurements I can calculate how much is the actual voltage, current flowing through the system, and the power factor between signals. This is my circuit schematic. It’s a bit large so you might want to expand it: Explanation of the circuit: It has a sort of “Load selector” because since the current transformer is a current supply I can change the voltage range by changing the load resistor. (I’m using a 120 ohm for measuring >15 A and 1 kohm for measuring <1 A) I’ve simulated the whole circuit on VSM Proteus and the results were flawless. I can correctly measure voltage, current and power factor with my microcontroller. The problem The problem comes with the real circuit. I had designed and built the PCB for the shown circuit. The resulting output signals were expected. The zero-crossing signal from the current and voltage transformers had a 10 ms HIGH and 10 ms LOW logic levels, this means a 20 ms period signal, thus 50 Hz signal; seems PERFECT! But, when I tried to measure the middle of the positive half cycle the results were not as expected, on the other hand the results on the simulated circuit were ideal, steady output numbers. On the real circuit the ADC measurements were “oscillating”, this might imply that the middle of the zero-crossing signal doesn’t point to the peak of the original signal. Simulated results: 2.869-1.696-2.874-2.874-2.874-2.874-2.874-2.874-2.874-2.874-1.701-2.879-2.879-2.879-2.879-2.879-2.874-2.879-2.879-2.879-2.879-2.879-2.879-2.879-2.879-2.879-2.879-2.879-1.701-2.879-2.879-2.879-2.879-2.879-2.879-2.879-2.879-1.706-2.879-2.879-2.879-2.879-2.879-2.879-2.879-2.879-2.879-2.879-2.879-2.879-2.879-2.879-2.879-2.879-2.879-2.879-2.879-2.879-2.879-2.879-2.879-2.879-2.879-2.879-2.879-2.879-2.879-2.879-2.879-2.879-2.879-2.879-2.879-2.879-2.879-2.879-2.879-2.879 Real results: 2.801-1.740-2.400-3.182-2.278-1.686-2.776-3.089-1.940-2.053-3.079-2.581-1.730- 2.527-3.196-2.136-1.706-2.933-2.898-2.019-2.248-3.177-2.351-1.691-2.674-3.167-2.297-1.887- 3.065-2.708-1.716-2.444-3.148-2.239-1.696-2.835-3.040-1.926-2.414-3.099-2.522-1.691-2.615- 3.187-2.107-1.730-2.957-2.889-1.799-2.283-3.148-2.341-1.691-2.698-3.143-2.058-1.916-3.030- 2.796-1.711-2.468-3.177-2.239-1.716-2.845-3.025-1.916-2.107-3.104-2.498-1.691-2.576-3.172 Thanks for reading, any hint on this would help me! If you need more information just ask. P.S: I'm not a native speaker so feel free to correct any grammar errors. AI: The comparator from the zero-crossing detection has an RC time constant at the output that defeats the purpose of having a clean pulsed output. If there is noise and needs to be filtered, you can still keep the RC but with a much lower value for the capacitor. As it is, the time constant is 10ms, which is too high, since it is comparable to the input's period. This is what happens to the signal: The green trace is with \$\tau\$=10ms. red with 1ms, blue with 0.1ms, and black with 10\$\mu\$s. Depending on the present noise, you can reduce the time constant to a minimum such that it leaves the pulses as clean as possible, to be able to provide the necessary edge triggers for the next stage, while still functioning as it was intended: a zero-crossing detector. One minor thing to remember is that the LM311, as open collector as it is, has a source/sink current limit for its output stage, so care should be taken that, when going low, the capacitor doesn't discharge more current that it can handle. The datasheet says 50mA, so a quick solution is this (consider the 2N3904 the open collector): Note that I didn't change the resistor/capacitor values so the time constant shown is double. Change according to your requirements.
H: The wavelength region of the IR sensor I was reading an article that explains the Infrared sensor until I came to the wavelength region's section, which has been mentioned as the following: The infrared waves typically have wavelengths between 0.75 and 1000µm. a- The wavelength region from 0.75 to 3µm is known as the near infrared region. b- The region between 3 and 6µm is known as the mid-infrared region, and c- infrared radiation which has a wavelength greater higher than 6µm is known as far infrared. I have searched for an image that shows those numbers, and I found this one: I have transformed the µm's values to m, but they didn't fit to the numbers shown in the image. So, what's wrong? The article: https://www.azosensors.com/article.aspx?ArticleID=339 A side-note: I took into consideration that that image is wrong, and I found this one, but I don't think it is right either. My calculations: 0.75µm and 1000µm = 750nm and 1000000nm = 0.75x10^-6m (= 7.5x10^-7m) and 1x10^-3m (= 0.001m) 3µm = 3000nm = 3x10^-6m 6µm = 6000nm = 6x10^-6m AI: As with most SI units it is convenient to quote our dimensions in values of 1 up to 999 followed by the multiplier (mΩ, kΩ, MΩ etc.). As we can see from your graph the visible light spectrum is in the range 400 nm to 750 nm. To keep the units consistent we often refer to the IR wavelengths in nanometers as well. The infrared waves typically have wavelengths between 0.75 and 1000µm. This is 750 nm up. a - The wavelength region from 0.75 to 3µm is known as the near infrared region. So 750 nm to 3000 nm. b - The region between 3 and 6µm is known as the mid-infrared region, and 3000 nm to 6000 nm. c - infrared radiation which has a wavelength greater higher than 6µm is known as far infrared. At this stage it's probably worth switching to μm. Figure 1. Section of OP's image with wavelengths marked in nanometers.
H: Li-ion battery powered circuit design I designed a PCB, but I'm unsure whether this topology correct or best one. The circuit powered with Li-ion battery and the battery should charge over USB. When USB has not been connected, Step up-down IC supply 3.3Volt to the board. When USB has been connected, Li-ion charging and also supply power to the board. Both charging and working of board could be possible at the same time. Is there any drawback? AI: UPDATE TWO ltc4056 damaged 2 times, i'm try to understand the reason of this damage this is my typo mistake. U2 ltc4054, not ltc4056. Okay. This is a very simple circuit. I do not know how 2 of them burned up on you. I only see one serious deficiency. What will you do to keep the battery from being discharged so low the battery gets damaged? You may want to consider adding an LTC1998 Voltage Reference for Battery Monitoring. You could use the BATTLO to shut down the LTC3240. Keep in mind the full featured MCP73871 costs about the same as the LTC4054. Low battery detect, battery temperature monitor, multiple power sources (USB and adapter), set max charge voltage and cutoff voltage, charge status indicator, and power good signal. All nice features you do not currently have. Just add resistors for settings and LEDs for status. UPDATE ONE ltc4056 damaged 2 times, i'm try to understand the reason of this damage Notice in your schematic, pin 2 is connected to ground? ISENSE (Pin 2): Sense Node for Charge Current. Current from VCC passes through the internal current sense resistor and out of the ISENSE pin to supply current to the emitter of the external PNP transistor. The collector of the PNP provides charge current to the battery. Source: LTC4056 Datasheet Notice BAT pin 3 in your schematic? BAT is pin 6. BAT is an input, not output. BAT (Pin 6): Battery Voltage Sense Input. Source: LTC4056 Datasheet Pin 3 is Base Drive Output, for the External PNP Pass Transistor. Provides a controlled sink current to drive the base of the PNP. This pin has current limiting protection Source: LTC4056 Datasheet I asked: I do not see an inductor. Is your chip a charge pump and linear step down? You replied: As i said this is stup up/down converter. I think there's a inductor inside this. – Berker Işık There are no semiconductor inductors. There are different types of step-up and step-down typologies. Your step-down is not a buck step-down. That is why I asked. The LTC3240-3.3 is a charge pump step-up. That's okay. The LDO step-down mode efficiency (87%) of this chip is okay at 100 mA. You could do better with a buck step-down without a step-up mode. You should not need a step up mode. An Li-ion should not drop below 3.3V with a 100 mA load. You should make 3.4V as your cutoff. Li-ion are sensitive to being drained too low. You need to set an input voltage point where the regulator is shut down so the battery is not drained too low. The reason I recommend the MPC73871 is you can use the LBO low battery output to shut down the 3.3v regulator. And the LBO voltage is programmable. You could also instead use a buck step-down regulator with a programmable LBO/UVLO input. END OF UPDATE I would prefer a more sophisticated charger chip like the MCP73871 Battery Charge Management Controller You can use the LBO low battery output to shut down the 3.3v regulator. The 3.3V Regulator Not much to say here without part number or max current. I do not see an inductor. Is your chip a charge pump and linear step down? You do not need the buck/boost 3.3V regulator if your load is not too heavy. Use an LDO buck step down converter. In the discharge curve of a 18650 Li-ion battery, the voltage does not reach 3.3V until near the end of the battery's capacity. Source: Panasonic 18650 datasheet
H: Current biasing in npn transistors I need to calculate bias current Ic1 and Ic2. I understand that both currents are the same and, because of beta being infinity, there is no base current (Ic1 = Ic2 = Ie1 = Ie2) and Ic3 = 2 * Ic1. I am confused of Q3 being there, because I can't split the circuit into 2 single ended stages and calculated the current to 1 single ended stage, or can I? I would be happy if you could help me to understand the schematic. AI: I would be happy if you could help me to understand the schematic. That much I can attempt. Let's look at the schematic, drawn somewhat less jazzy: simulate this circuit – Schematic created using CircuitLab The current sink part is pretty easy. \$Q_3\$ is arranged into an emitter-follower. The pair of base biasing resistors, \$R_1\$ and \$R_3\$, form a simple voltage divider. Since their values the same, the mid-point voltage will be half the difference between ground and \$V_\text{EE}=-15\:\text{V}\$, or \$-7.5\:\text{V}\$. The emitter of \$Q_3\$ will follow that base voltage, one base-emitter diode drop below that point. Since this is \$700\:\text{mV}\$ as from your text (and I think higher, but who is counting?), then the emitter voltage will be \$-8.2\:\text{V}\$. This leaves \$6.8\:\text{V}\$ across \$R_2\$, meaning that the emitter current (which is the collector current in your case with \$\beta=\infty\$) is sinking \$6.8\:\text{mA}\$. It is a current sink. The rest is a differential pair or so-called long-tailed pair using two collector resistors. (Other arrangements are often made for the collectors, different from this.) The emitters of \$Q_1\$ and \$Q_2\$ are tied together, so they are always at the same voltage as each other. If both bases are tied to the same low-impedance voltage source value (say, \$0\:\text{V}\$), then the emitters will be \$700\:\text{mV}\$ below that. Since the collector current of a BJT is determined by its base-emitter voltage, and if both base voltages are the same (and the emitters are tied together, too), then both BJTs will have the exact same collector current. The only way this happens is if the current determined by the current sink splits two ways, equally. So this means each collector current is the same and will be \$3.4\:\text{mA}\$, apiece. (Which totals to the current sink value computed above.) If both base voltages move upward or downward a little bit, but do so exactly together with each other, then the collector currents remain equal to each other and they split the current sink value. It is only when the two base voltages are different, that there is a difference in the two collector currents. I don't think I noticed anything saying that there was a phase difference in your two signal sources. If not, then the two collector currents will remain the same even with these signals applied. All that happens is that the two base-emitter junctions of the two BJTs move up and down together with the signal. But there is no difference in their base voltages so there will be no differences in their collector currents. If, however, your two signals sources had a different phase or were operating at different frequencies, then something else would happen. But apparently your problem specifies quite clearly that the two signal sources have the same phase and frequency. So that's all there is to it.
H: Different I/O pins of same PORT of ATMEGA8 not providing exact output I have written code to switch ON/OFF some LED light connected different I/O pins of same PORT (i.e PORTD) of atmega8 microcontroller. This process is performed using android app by sending different byte through USART. When a data byte is sent then the corresponding LED is ON. When two or more LED is ON by sending their corresponsing data bye then if to switch OFF a specified LED, a specified byte is sent ,the whole LED is OFF. if i use two separate PORT (i.e PORTC and PORTD) then i get exact output but in this case i can use only one pin of PORTD and one pin of PORTC for two LED ON/OFF. if i use more than two pin, the above fault occur. My code is below. ISR(USART_RXC_vect) { while(!(UCSRA & (1<<RXC))); rec=UDR; switch(rec) { case 65:{ PORTD |=1<<4; }break; case 66:{ PORTD |=1<<5; }break; case 67:{ PORTD |=1<<6; }break; case 68:{ PORTD |=1<<7; }break; case 69:{ PORTD&=~1<<4; }break; case 70:{ PORTD&=~1<<5; }break; case 71:{ PORTC&=~1<<6; }break; case 72:{ PORTB&=~1<<7; }break; } } please anyone help me to solve this problem. AI: The expression PORTD &= ~ 1 << 4; is actually interpreted as PORTD &= ((~1) << 4); due to operator precedence. In C++, the unary ~ operator is higher priority than binary << operator. See https://en.cppreference.com/w/cpp/language/operator_precedence Fix this by using parenthesis to enclose the 1 << 4 expression: PORTD &= ~(1 << 4);
H: Physical effort in outputting 5V 1–2A? I have an iPhone, and sometimes recharging it from a wall is inconvenient. Maybe I am on a long bus ride. If I am willing to do physical activity/exercise to produce power, how much effort would I need to exert to act as a phone charger, supplying a steady 1–2 amps at 5 V? This hypothetical device would need to be small and light enough that I could carry it... no point in it if I have to be at home to use it. For example, there’s a simple hand exercise device that you squeeze over and over to build hand muscle. How much power could that generate? AI: 20 watts delivered into a hand-cranked generator (enough to deliver 10 electrical watts after conversion losses) could be managed all day by a fit and motivated person. This would employ all of your arm muscles. However, you'd need reasonable length cranks, comfortable handles, a good secure mounting for the generator, it's not something you'd nonchalantly carry onto and use on a bus. A grip-squeeze device could be rigged to generate some power but, only being able to use the small grip muscles in the forearm, you'd struggle to get more than a few watts for a few minutes before exhaustion. If you don't mind standing, then a mini-stepper could be rigged with a generator. This would use your legs, so we're back in the sustained many 10s of watts, even 100+ region. It could lie stably on the floor, and maybe fit into a small backpack, so is probably the most suitable device overall. Consider that a 70kg individual walking up 200mm high steps one per second is delivering 140 watts.
H: How to simulate a component hspice model in multisim I'm trying to simulate TS5A22364 and they have hspice and ibis models, and CAD model .bxl in Multisim. Is it possible? I have tried to add the package model but I don't know how to add the .bxl model to Multisim, and the hspice model can't be inserted in the component wizard spice model. Is there any chance I can use this model in my simulation? If it is not possible, what simulator can I use that makes it possible? Thanks AI: Don't use those, but one thing you can expect, in general, is that a model made specifically for one simulator, should not work with any other. That goes (I dare say) 100% so for symbols. But subcircuits and/or models that are SPICE-friendly, should work. In this case, looking at the files, I see the HSPICE files are encrypted (100% sure only works for the program that encrypted it), and IBIS one with unknown language, probably specific to IBIS only. My guess is no, in this case.
H: Over-current sense I am using a circuit shown below. it is designed to sense 1.5 A whenever the load takes current >= 1.5 A. Rsen senses the related voltage and activates the transistor. Here I use a Rsen = 0.46 R(0.7V/1.5A). Whenever 1.5 A flows the BC547 turns ON and the gate of MOSFET gets turned off (Vgs less than Vth). But our problem is source of MOSFET provide a voltage and MOSFET getting over heated. Can someone provide a solution for this? AI: Your circuit is in fact a current regulator: it won't let the current exceed the threshold, but it will never cut off the load in case of over-current. And power MOSFETs make very poor linear regulators because they tend to go into thermal runaway and die. If you want over-current protection, you need to latch the over-current signal either temporarily or until a reset. If you PWM comes from an MCU, you can route your over-current signal to its input pin and program the protection the way you want. Another form of protection is to install a polyfuse in series with the load: polyfuses have the latch-up behaviour built-in. Getting back into a working state would require power-down and cooldown delay, so it's a less flexible solution.
H: Powering ESP32 project from mains power Apologies if this question was already asked, but my searches didn't end up very consistent on this matter. I want to build a curing chamber in an old small fridge and I thought the ESP32 board will be a good choice. However, I'm a bit stuck in the powering the whole thing, since I will need different voltages for the components. The parts I will use will be: ESP32 board DHT22 temperature sensor 5V small humidifier 12V CPU fan that is laying around 1.3" TFT screen Future implementation: power meter sensor load cell sensor So, my first struggle is with powering all this from mains power, to keep it simple and compact. I was thinking to use the Hi Link power supply module to transform the 220VAC into DC 5V 0.6A for the humidifier and relays, and another Hi Link 3.3V for the ESP32 and screen (since the 5v Hi Link doesn't have enough current to power it all). But then, how I power the 12V fan? Or should I get a 5V fan which are a bit expensive and I already have a 12V one. Maybe someone has a good scenario for my struggle :) It would give me hope that I can eat some good sausages in the near future :) AI: As the fan is probably to most power consuming device I'd convert your mains to 12V and suppy the rest of your peripherals from there. This presumes that you can build a small PCB holding the required DC/DC converters (12V/5V and 12V/3.3V). Another approach would be to have a separate supply for all your different voltages.
H: STM32L4's Temperature Calculation Equation shows improper results While using STM32L4's ADC to measure its internal temperature sensor data, I am facing an issue. The equation provided in STM32L4's reference manual, seems to showing improper results. The equation is: *Temperature = ((110-30) * (TS_DATA - TS_CAL_1) / (TS_CAL_2 - TS_CAL_1)) + 30* where, TS_DATA = 945 (raw ADC data for temperature), TS_CAL_1 = 1035 (calibration point read from predefined memory address), TS_CAL_2 = 1373 (calibration point read from predefined memory address) This results in 'Temperature = 8.69' at room temperature (about 26 Celsius), which is clearly incorrect. My Code for the same is: #define TS30 ((uint16_t*)((uint32_t)0x1FFF75A8)) #define TS110 ((uint16_t*)((uint32_t)0x1FFF75CA)) uint32_t ADC_Value; double temperature; void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef* hadc){ ADC_Value = HAL_ADC_GetValue(&hadc1); temperature = (double)ADC_Value - (uint32_t)*TS30; temperature *= (double)((uint32_t)110 - (uint32_t)30); temperature /= (double)(int32_t)((uint32_t)*TS110 - (uint32_t)*TS30); temperature += 30; } int main(){ /**Main Loop**/ MX_ADC1_Init(); HAL_ADCEx_Calibration_Start(&hadc1, ADC_SINGLE_ENDED); HAL_ADC_Start_IT(&hadc1); while(1) { HAL_Delay(400); HAL_ADC_Start_IT(&hadc1); } } static void MX_ADC1_Init(void) { ADC_ChannelConfTypeDef sConfig; hadc1.Instance = ADC1; hadc1.Init.ClockPrescaler = ADC_CLOCK_ASYNC_DIV1; hadc1.Init.Resolution = ADC_RESOLUTION_12B; hadc1.Init.DataAlign = ADC_DATAALIGN_RIGHT; hadc1.Init.ScanConvMode = ADC_SCAN_DISABLE; hadc1.Init.EOCSelection = ADC_EOC_SINGLE_CONV; hadc1.Init.LowPowerAutoWait = DISABLE; hadc1.Init.ContinuousConvMode = DISABLE; hadc1.Init.NbrOfConversion = 1; hadc1.Init.DiscontinuousConvMode = DISABLE; hadc1.Init.NbrOfDiscConversion = 1; hadc1.Init.ExternalTrigConv = ADC_SOFTWARE_START; hadc1.Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_NONE; hadc1.Init.DMAContinuousRequests = DISABLE; hadc1.Init.Overrun = ADC_OVR_DATA_PRESERVED; hadc1.Init.OversamplingMode = DISABLE; if (HAL_ADC_Init(&hadc1) != HAL_OK){ _Error_Handler(__FILE__, __LINE__); } /**Configure Regular Channel**/ sConfig.Channel = ADC_CHANNEL_TEMPSENSOR; sConfig.Rank = ADC_REGULAR_RANK_1; sConfig.SamplingTime = ADC_SAMPLETIME_640CYCLES_5; sConfig.SingleDiff = ADC_SINGLE_ENDED; sConfig.OffsetNumber = ADC_OFFSET_NONE; sConfig.Offset = 0; if (HAL_ADC_ConfigChannel(&hadc1, &sConfig) != HAL_OK){ _Error_Handler(__FILE__, __LINE__); } } Please review the code and help me. AI: You need to apply a scaling because your reference voltage is different from the reference voltage when the parts where calibrated. They use a 3 V reference during calibration, you use a 3.3 V reference. So the absolute value of the temperature sensor will not change, so the ADC value you get will be smaller than the one they got during calibration. So your ADC value has to be scaled by a factor of 3.3 V / 3.0 V or 1.1. If you enter that into the formula (and use the correct calibration temperatures of 130 and 30 °C) you end up with 31 °C. Still a bit off of your 26 °C, but that could be because your electronic is actually warmer, and even with the calibrated values we measured up to 6 K deviation in our tests, so I'd consider that as okayish. (similar answer with a small code snippet, but there it was 110 and 30 °C)
H: Transistor base/collector voltage I've read that with an NPN transistor, there is a voltage drop of about 0.6 V between the base and the emitter, so you need to have about 0.7 V on the base to switch it on (circuit 1). But what happens when you have, say, 5 V on the base (circuit 2)? Where does that extra 4.3 V go? What is it being dropped across? If your base voltage is higher than 0.7 V, should you always have a resister on the emitter to drop the excess voltage (circuit 3)? AI: tl;dr: It blows. Starting with the collector current which can be described with the following relationship: $$ I_C = I_S \cdot e^{\frac{v_{be}}{V_T}} $$ with \$V_T\$ being a temperature dependent variable which is commonly set at around \$26\,\mathrm{mV}\$ at room temperature. \$I_S\$ is \$15\,\mathrm{nA}\$ for the BC107. If you plug in the numbers, you will see, that for a 5 V base-emitter voltage, the current will explode: $$ I_C = 15\cdot10^{-9}\ \mathrm{A}\cdot e^{\frac{5\mathrm{V}}{0.026\mathrm{V}}} = 4.95\cdot 10^{75}\mathrm{A} $$ This means that the transistor is willing to let this amount of current flow through its collector, which obviously no man-made current source can produce. In your case, the transistor will open, but the current is limited by the resistor in series with the collector and the only thing which matters is \$V_{CEsat}\$, the saturation voltage of the transistor which is around \$600\ \mathrm{mV}\$ at \$5\ \mathrm{mA}\$ collector current. The more problematic thing which will happen is, that the base-emitter junction is a diode and its current can be calculated with \$h_{fe}\$ being the small signal DC gain of about 150 for the BC107B: $$ I_B = \frac{I_S}{h_{fe}}\cdot e^{\frac{v_{be}}{V_T}} = \frac{15\cdot 10^{-9}}{150}\ \mathrm{A} \cdot e^{\frac{5V}{0.026V}} = 3.3 \cdot 10^{73}\ \mathrm{A} $$ This would overheat and destroy the base junction immediately with a little smoke and a bright flash. Therefore, this current has to be limited too. Using a small signal model, the collector current is calculated as: $$ I_C = h_{fe} \cdot I_B $$ Beware that \$V_{T}\$ I talked about changes with temperature and therefore \$h_{fe}\$ does! As the transistor heats up, \$V_{T}\$ decreases and therefore base and collector currents increase - the transistor runs away. This is why designers go to great lengths to make their design temperature-compensated. The emitter resistor limits the collector current and the base current at the same time. Since the collector current is 150 times greater than the base current, we can neglect the base current to make the calculation quick. The sum of all voltages in a loop has to be zero. Going around the base circuit of your last reference and solving for \$I_C\$: $$ -V5+V_{be0} + V_{RE} = 0 $$ Since \$V_{RE}\$ can be expressed as \$I_E \cdot R_E\$, we can solve for \$I_E\$: $$ V_{RE} = V5 - V_{be0} \cong I_E \cdot R_E = V5 - V_{be0} $$ Since we neglected the base current, \$I_E \sim I_C\$ and therefore we can calculate the collector current based on the voltage V5 as followed: $$ I_E \sim \frac{V5 - V_{be0}}{R_E} $$ If you want to check the base-emitter voltage, calculate the collector current and use Equation 1 to get \$v_{be0}\$ which we assumed to be \$0.7\ \mathrm{V}\$. You will see that this assumption is true. If you play around with various collector currents in Equation 1, you will see that a large change in collector current results in a very small change in the base-emitter voltage. This is due to the logarithm introduced when solving for \$v_{be}\$. The logarithm is the function which has the least change in output compared to the change in input! This is also the reason we can work with \$v_{be0} = 0.7\ \mathrm{V}\$ since the available current flowing into the base introduces a large collector current which will raise the emitter voltage until the base current is restricted so much it reduces the collector current which will in turn make the voltage drop over \$R_E\$ larger and therefore \$v_{be}\$ smaller again. "Transistors are current controlled" because a small variation in \$v_{be}\$ results in a huge change of \$I_C\$ which makes controlling the collector current with voltage very unstable up to impossible. Therefore, we use the relationship \$ I_C = I_B \cdot H_{fe}\$ to control the collector current. The relationship is linear and therefore nice for us engineers to work with.
H: Hook up 2 HC-SR501 PIR's to Wemos D1 mini I have two HC-SR501 PIR's I'd like to use to detect motion and light up a 12V LED strip when motion is detected (each PIR is assigned a LED strip). I am, however, unsure on how to hook them up to my Wemos D1 Mini. I know I can't hook up a LED strip to an output (not enough current from the WEMOS) so, for now I just hooked up 2 leds instead while my relays are on order. My circuit works as long as only one PIR is hooked up, but when the second is hooked up the ESP8266 starts behaving weird / restarting. I guess I'm drawing too much current with two PIR's? Excuse the poor photoshop. I couldn't find any online circuit diagram tool that has an Wemos D1 / ESP8266. Ok, so, my reasoning is I'm drawing too much current. So I figure I try this: This way, I can later, when the relays arrive, power the LED strip from the same 12V connection and simply hook the (now) LED contacts to a relais: I was planning to power the Wemos simply from a USB power adapter (I have enough of the (genuine) 5W Apple USB power adapters laying around). My question is: I'm unsure if this will work. Will it? If not, what would I need to change? Basically I want to control 2 LED strips that turn on when a PIR detects movement; there is some more logic involved but that's all software. The software will be no problem. It's the circuit I'm uncertain about. Bonus question: maybe I can do without the USB power and hook the Wemos to the 12V too? I guess I'd need a resistor? How would I hook it up correctly? Bonus question two: Instead of a relay, I'm pretty sure I could use a MOSFET like this one (link) too, right? I also asked this question here. * The actual I/O pins I've used may differ, not sure, I hope the idea gets across. AI: If you use different supplies they should at least share one ground. According to the "datasheet" the HC-SR501 should be low power, so I'm not sure if the problem you're facing are really due to a unsufficient power supply. Do you have a chance to measure the drawn current? Could you be more specific in regards of "weird behavior"? If you want to power the Wemos from 12V I'd suggest to use a voltage regulator (LDO) instead of a simple voltage divider. And yes you could switch your LED stripes with a Mosfet instead of a relay.
H: Calculate linear phase when given in decibel The datasheet of the LT6230 shows the op amp's phase lag in decibels (page 14). The datasheet does not give a formula to recalculate the angle in degrees, so can I just assume the following being the correct conversion? $$ [\text{Phase}] = 10^{\frac{X_{\text{dB}}}{20}} $$ I'm afraid, the numbers do not really check out: From 80dB to 0dB, the phase margin is 1000° which seems to be a bit high for an operational amplifier. AI: It looks like the data sheet has screwed up. The right hand vertical scale should not be "Phase (dB)" but "Phase (degrees)". This sort of thing happens now and then. How do I know? I know this because the mid-band phase of an op-amp is usually about 90 degrees (as shown at 100 kHz). There is also the correct axis shown on page 15 in a similar graph!
H: Example of stable non minimum phase system with negative gain or phase margin I read in a particular book that the fact that gain margin and phase margin are positive implies stability is only true for minimum phase systems. But, for non-minimum phase systems, system can be stable even with negative gain and phase margins Can you please given an example of a non-minimum phase system, which is stable but has a negative gain margin or phase margin AI: The author uses a different definition than I'm used to. According to wikipedia: Systems that are causal and stable whose inverses are causal and unstable are known as non-minimum-phase systems. While your book describes it using: When a transfer function has either a pole or a zero in the right-half s-plane, it is called a nonminimum-phase transfer function. So your book includes RHP poles, while Wikipedia's definition requires a stable system, so no RHP poles. If RHP poles are allowed then it is relatively simple to find an example: $$ F(s) = -\frac{2s\cdot (2s+3)}{(s-1)(s+5)} $$ The bode plot looks like this: This shows a GM of about -3.67dB. So it technically violates the Bode criterion, but it is stable when closing the loop. The closed-loop transfer function is: $$ F_{cl}(s) = \frac{2s\cdot (2s + 3)}{3s^2 + 2s + 5} $$ which has only poles in the LHP. You can kind of see how I constructed it from the Nyquist plot: In order to have a GM < 0, you want the transfer function to cross (not end/start at) the x-axis (real axis) left of \$s=-1\$. Given that I had a pole in the RHP, I want the curve to loop around \$-1\$ CCW once to make sure it is stable (\$Z = N + P, P = 1 \Rightarrow N = -1\$). So I just shifted and scaled the graph until \$s=-1\$ was in the right part of the \$\infty\$-figure. This part has been added after the question in the comments Is it possible to find such an example for stable systems? Yes it is possible. Take for example the following stable system: $$ F(s) = \frac{1}{150}\frac{(s + 10)(s^2 + 6s + 4)(s^2 - 0.1s + 2)}{(s+1)^2} $$ It has 2 zero's in the RHP so it is a nonminimum phase system. It does not contain poles in the RHP so it is also stable. The bode plot looks like this: But the closed loop response is stable. The Nyquist diagram shows you how that is possible. The two low-frequency LHP poles and LHP zero will make the curve start downwards. Then we can use multiple zero's in left and right half planes to make the curve go move up and down. I made sure to use two RHP zero's and not one to avoid that the curve would start on the left instead of on the right (I wanted to start at \$0^\circ\$ phase for this example).
H: Low voltage LCD glass displays I have a simple circuit I built using a 7-segment LCD glass display and an ATTiny (just a simple timer for now). I was hoping to use the setup in a low power, single coin cell device (3.3V - 2.7V), but then I noticed that the recommended voltage on the LCD is 5V. I looked for lower voltage LCD panels (they use them in the little freebie calculators that give away, and those have little coin cells) but either I'm looking in the wrong place or they don't exist. Never mind, I just tried using lower voltages, and I can almost get it usable at around 3V by putting a large (\$>10M\$) resistor from the signal pins to GND (somewhat legible at 2.9V and 50Hz PWM at 50% duty). I thought this might work because I think the segments are capacitive so the resistor increases RC and causes the segment to stay lit longer. So my question is, does anyone know if there is a secret to getting these LCD panels to work at lower voltages? Ideally I'd like to get down around 2.5V and still somewhat readable, and I imagine it's possible since I've seen simliar devices that must be working from small 3V batteries. Or am I barking up the wrong tree and there exist LCDs somewhere that already use a lower voltage? And before I get "there are 3V panels listed on Mouser, Digikey, etc.", I see that some of them come up as such in the product databases, but they are not <3 digits (I only need 2 digits) and the datasheets/technical drawings/whatever all still list 5V anyway, so I'm guessing they are all the same. AI: You should be driving the common in sync with the segments, either in phase or 180° out of phase (depending on the on/off state of the segment). The DC content of your drive waveform should not exceed some tens of mV or you will damage the display permanently. If you are driving your (static) display with single ended port pins you will get less contrast and will damage the display eventually. To minimize the DC content you want the out-of-phase waveform to be very close to 50% on off ratio. You can work out the permissible error in time from the frequency (which should be in the range 32-100Hz for this display). 5V is required for Lumex displays that operate up to 80°C, 3V is okay for 60°C. With your 3V supply (and properly driving the common) you will be driving the display with 6V RMS so it should be fine. It's quite possible to source LCD displays that fit your requirement, in fact custom displays are more common than standard ones. There is an NRE cost and usually a minimum order quantity. You get to specify the type of drive (static or the more common multiplexed), pick a fluid temperature range, a viewing angle, glass size, type of termination (zebra strip, FPC or pins) and so on. Figure on a starting cost in the low thousands of dollars for an ordinary display.
H: Is a Real-Time Clock (RTC) necessary for real-time systems? Assuming that we are working on a real-time Linux system and hardware which consists of high resolution timers, does having an RTC affect the real-timeliness of the system? Here it says that it reduces CPU and memory usage, but is there a way to compare the difference somehow? AI: The article you linked is just complete and utter nonsense. The "real time" in "real time clock" (as it's used to refer to the type of hardward device described in the article) and the "real time" in "real time systems" are completely different terms. The former means storing the current calendar time (usually some very poor approximation of it, as opposed to high-precision like the linked article claimed) and advancing it without external power, using a long-life button/coin type battery. The latter means responding to events with hard bounds on latency from the time of the event to the time of the response. A few other bits from the article, to establish that it should be regarded as untrustworthy: Almost negligible. Of the order of 1 sec in 100 years 1 sec in 100 years is roughly 317 ppt (yes, that's parts per trillion). You can't get that kind of clock stability with any existing commercially-available clock technology. Even getting it to 1 second per year would require at least an OCXO which requires a high-power, always-on oven regulating the temperature. The idea you could get it with a device powered by long-life coin battery is laughable. real time systems like digital clock, attendance system, digital camera None of these are what one would call real time systems.
H: Can I use MCP23008 with G6K-2F-Y relay? From specs of MCP23008: Maximum output current sunk by any output pin is 25 mA. Output High-Voltage is VDD-0.7, which is 4.3 V in my case. From specs of G6K-2F-Y: Rated current (mA) is 21.1 mA Must operate voltage (V) 80% of max, which is 4 V. Coil resistance (Ω) is 237 Ohm (measured actual is 245 Ohm). I am planning to use 1 relay connected from GPIO to GND. So my calculations gave me 18.1 mA using +4.3 V as described per datasheet which is more than 25% max current from the specs. Is it safe to use that design? If it is not is there anything else with 5V power supply and I2C interface? Updated schematic: I am planning to use internal pull-up resistor to keep p-channel mosfet closed. AI: From Microchip's data sheet: The I/O pin is not spec'd for more than 3mA as a current source. It is anyone's guess how much voltage is dropped below the supply for larger currents, like 20mA.... At 3mA, you're guaranteed 4.3V. It is a very weak switch for coil current. More promising is sink current - it is a better switch pulling down compared to pulling up. Again, it is anyone's guess how it performs above 8.5 mA. So using just one I/O is still risky. It might be safer to parallel two or three I/O pins, to ensure a strong-enough switch. Like this: simulate this circuit – Schematic created using CircuitLab Just be sure that those three I/O are always switched together high to de-activate the relay, low to activate the relay. Always with the same I2C command....you never want Out_1 fighting Out_2 or Out_3 with one pulling up while the others pull down.
H: Why in the Thevenin Theorem do we have to "turn off" independent sources to find Thevenin resistance In my basic circuits course we learned a handy circuit analysis technique so that we can simplify a linear circuit to it's equivalent voltage source and resistance. When looking for the Thevenin resistance I wad told to turn off all independent sources. Why do we do this (proof wise). Also why don't we turn off dependent sources too? AI: Say you connect a voltage source Va at the external terminals across which you want to find the the equivalent resistance. Now if you change the voltage Va, voltage across the elements in the network changes, so does the current. The ratio of this change in voltage to that of current, \$\Delta V/\Delta I\$ is the equivalent resistance offered by that element. The total resistance of a network can be calculated by replacing each element by its equivalent resistance. For a reistor, \$\Delta V/\Delta I\$ will be its resistance value only. Since voltage across an independent voltage won't change (\$\Delta V=0\$), its equivalent resistance will be zero. Hence it can be replaced by a short. Similarly, independent current source (\$\Delta I=0\$) can be replaced by an open circuit. Which is basically 'switching off' these sources. But for dependent sources, this \$\Delta V/\Delta I\$ ratio need not be zero or infinity as the value of source depends on voltage/current at some other node/branch in the network. Hence effectively it can have a non zero finite resistance to offer and hence can not be 'switched off'.
H: What if the current draw is greater than the rated discharge of a battery? I have a 48 volt, 20 kW motor that I need to supply with power. I am looking at a configuration of 16 LiFePo4 cells each in series, each 200 Ah rated at 1 C. At that rated capacity, it would seem the most power I could draw is half that, or 9.6 kW which means a lot of unused power to the engine. If that is correct, the 200 Ah cells must be 2 C rated to make use of the 20 kW of power. Is that correct? (Note: the 20 kW is occasional short-duration peak, not the normal range. Normal use would be 10 kW - 15kW.) Then I thought, what if I had a larger motor than 20 kW, say 40 kW? How do you feed a hungry power draw like that if only 2 C 200 Ah cells were available? If I had 32 cells, divided into two 16 bank 48 V batteries (say, bank 'a' and 'b'), and banks 'a' and 'b' were wired in parallel to each other, would that satisfy the current draw to a 40 kW motor? AI: Yes, it's perfectly acceptable to put banks of cells in parallel. You'll actually commonly see this in battery packs. If a pack has the designation "5S3P" for instance, that would mean that it has stacks of 5 cells in series, and has 3 "banks" of those in parallel. Have you worked with Lithium-Ion batteries before? If not, I'd advise extreme caution for your use-case. You're dealing with quite a lot of potential energy, and if these batteries fail it can easily become destructive and dangerous (gouts of flame or explosions). Particularly in your case, you'll need to take precautions against thermal runaway (where if one cell fails and vents/overheats, the heat can spread to the adjacent cell, and cause it to vent/overheat, causing a chain reaction which can easily destroy an entire battery pack, and everything else that happens to be in the same room as it). You should take care to ensure that the batteries are sufficiently protected, and that they have dedicated battery monitoring circuitry keeping them safe (preventing overcharge, overdischarge, temperature monitoring, overcurrent protection, etc.). You'll need to also ensure that you are balancing the cells that are stacked in series (most BMS solutions will include some way to do this). Moreover, you must ensure that the cells are all at identical, or nearly identical states of charge when you hook them all up in parallel. If one cell is at 3.9V, and another is at 3.4V, when you plug them in to one another an extremely large current will flow between them, until they balance with one another. This current can and will destroy the cells if it is large enough.
H: How to Find R.M.S value how can I find the R.M.S value of this question? AI: The root of the mean of the square. So first, you square the data series or function. Then you calculate the mean of that (this is a matter of evaluating an integral over exactly one period of the waveform.. see mean value theorem) then you take the square root of the mean. This is the mathematical definition of RMS and always works. Sometimes you can use shortcuts for particular waveforms such as sine waves or square waves.
H: Proper connection of choke coil in ethernet magnetics I need to use the medical ethernet magnetics by Pulse HXU6200NL (it is the only 2MOPP medical-certified PoE magnetics I can find). These are of the rather common transformer/choke coil topology. My confusion comes from the location of the common-mode choke coils. As I understand common practice, and most magnetic data sheets I have seen (except by Pulse), you should place the common-mode chokes on the cable side of the magnetics. The intention being avoiding the injection of circuitry-generated EMI into an (unshielded) ethernet cable. But Pulse places the chokes on what they denote as the PHY IC-side of the magnetics. Which side is the correct one? Should I ignore Pulse's data sheet regarding this? (There is a related, but unanswered, question regarding this) AI: My understanding of the common mode choke is that it works to prevent RF noise from entering from outside, as some Ethernet runs might be a hundred meters-by noisy power wires, and stops harmonics from the PHY drivers from getting outside and possibly violating FCC rules regarding EMI emissions. The common mode chokes would serve no purpose on the PHY side, and I have seen no schematics with them on the PHY side. The PHY side actually must be as a clean as possible with just bias resistors at most. The PHY side drivers expect a very short connection directly to the magnetics. Designs vary so not all center taps are used. Also I cannot say that nobody ever has or ever will use common mode chokes on the PHY side, with many designs being proprietary with no public release of certain details. As long as the PHY drivers can behave as they should I see no problem with that topology. On the outside the center taps allow for PoE to be used without corrupting high speed data on the twisted pairs, as the supply current is common to both wires and at the magnetics it cancels out so no DC offset current is passed to the magnetics. Usually twisted pair 'A' carries one side of the DC power and pair 'D' carries the other side. The 2 middle pairs are grounded unless the ports are rated for 1GB Ethernet.
H: Why does this "square wave" have what seems to be a charging action on it's leading edge? I'm trying to produce a basic square wave output across a resistor from an ATMega328P Xplained mini. VCC is 5 V. Setup: Code: (Stuff with DDC/PORTB is just to control the onboard LED) #define F_CPU 16000000 #include <avr/io.h> #include <util/delay.h> int main(void) { // Turn off global pullup disable MCUCR &= ~(1<<PUD); // Direct pins PORTC = PORTC & ~(1<<PORTC1) | (1<<PORTC3); DDRB |= (1<<DDB5); DDRC |= (1<<DDC1) | (1<<DDC3); while (1) { PORTB ^= (1<<PORTB5); DDRC ^= (1<<DDC1); _delay_us(500); } } But when I place an oscilloscope probe on the PC1 side of the resistor, rather than a square wave I'm seeing this: It seems strange to me that the output isn't just a square wave, I understand that resistors aren't ideal and that they have small capacitive and inductive elements to them but this seems excessive? Additionally, why is the peak voltage of the waveform only 600 mV? AI: This line: DDRC ^= (1<<DDC1); is actually inverting the direction of the PC1 pin at every iteration of the while loop. This places the PC1 pin in output mode and probably LOW state during one half-cycle and then in Hi-Z mode during the next. The impedance of the PC1 pin is then 10k-100kΩ, so this acts as a very poor RC circuit with the parasitic capacitance of the breadboard and PCB. Your square wave is an RC circuit for half a cycle then a driven LOW for the other half, hence the waveform you are seeing.
H: What are these exposed copper rectangles for on the mbed NXP LPC1768? Today I noticed some exposed copper rectangles on the bottom of an mbed NXP LPC1768 dev board. They don't look like they're meant for components. I think they may just be test points, but I'm curious if there's another answer. Here's an image of the board with the copper rectangles circled in red: I'm not sure what the mbed interface chip is. Googling it suggests that it's proprietary. I can't tell where the traces are going. AI: Adding to the answer of phill g: What are these exposed copper rectangles for on the mbed NXP LPC1768? which provides the schematic of that board at https://www.nxp.com/downloads/en/design-support/ARM_mbed_LPC1768_Schematic.pdf In the schematic they're even designated as the cfg0-cfg5 pads of MBED-IF01 chip. On https://os.mbed.com/questions/76861/mbed-IF01/ on a question regarding the datasheet of that part, it is stated that: IF01 is the the interface circuit of the LPC1768, which infact is an "LPC2148" MCU, in short we can't open source a lot of the information for the interface so this is why its hidden. It seems to be the predecessor of https://os.mbed.com/handbook/mbed-HDK It's a microcontroller implementing https://os.mbed.com/handbook/cmsis-dap-interface-firmware The CMSIS-DAP Interface Firmware provides: USB Mass Storage Device for drag and drop programming of the target chip USB Communications Device Class for Serial Communication with the target chip USB HID CMSIS-DAP for debugging USB bootloader for updating the interface firmware itself As to what those pads really are, when you look in the datasheet of the LPC2148 https://www.nxp.com/docs/en/data-sheet/LPC2141_42_44_46_48.pdf we can see that those pins are in fact the tdo, tdi, trs, trst and rtck pins. Those pins are used thus to flash their custom cmsis-dap interface to that chip (probably using pogo pins).
H: Circuit to a/b switch like a relay would. So an analog or digital signal can be turned on or off or routed I need to build an arduino-based switcher / router for a multi-arcade to route controls to different game boards, and also switch 2 vga inputs into one output. Without introducing any lag also. 3 increasinly complex examples of what I need this to do: First is to take a bunch of leaf switch buttons (which technically are each connecting a pin on a jamma board to ground when pushed) and using arduino to route which pin on 2 different jamma boards is being connected to ground by the button push. It's basically button mapping for different games. I'll have some limited needs in this area but the biggest one is a/b switching between 2 full sets of controls based on what game is being played. Example 2 is switching 4 pins from the leaf switch buttons to trackball outputs. Which I think is still taking the lines low to ground but is more of a digital signal than a guy randomly smashing on a button. Example 3 is a/b switching 2 vga outputs to a single vga output. And the lines in a vga are analog signals. I'm not an EE so I still think in terms of a relay, which can a/b switch a single line no matter (within reason) what's on it. So I would expect a relay could pass through any signal in either direction on that line since it's physically connecting the 2 pins together. What is the digital circuit equivelant of a relay? I was considering optocouplers but that still functions like a transistor, right? So not any signal could travel through it in either direction. But maybe something like this would work for examples 1 and 2. Would it introduce any lag? If I can do parts 1 and 2 I could always buy a vga switcher to do part 3 and hack the switch to still allow arduino to control it. Any ideas? AI: You could use a multi-channel analog switch like the 74AHC4066.
H: Why can't I implement a frequency divider using a mux in this way? I found an interesting interview question for FPGA engineer online - Implement a counter with Mux, so I decided to try to do that. I tried to keep it simple and so implement a counter with two bits, so it can count only to 3 and then reset. I came to a conclusion I need 3 multiplexers, two for each bit, and the other one to serve as a frequency divider for the clock (I'm sure there are other ideas, would love to hear them as well). Note that I wanted this frequency divider to work at the falling edge of the clock. Basically this is what I tried to do: simulate this circuit – Schematic created using CircuitLab I used a clock of 1Hz just so it won't be too fast (though maybe it doesn't matter?), With mux1 being the frequency divider. The idea here is that the counter is like this: Q1 Q0 0 0 0 1 1 0 1 1 So, since Q0 changes with every clock edge, I connected the clock to mux3. Since Q1 toggles every two clocks, I tried to design a frequency divider which will make sure that Q1 will toggle every two clock (clk1) falling edges. I thought it would work well, but in a simulation (used Multisim for that, because I don't know how to simulate it work circuitlab, would love if you could show me how I can do that), I got a very strange result - the simulation just stopped. Here is how it looked (the output of mux1): When I zoomed in at the falling edge (at 500ms) it looked like this: So my questions are: Why doesn't my frequency divider work? Is this implementation of a counter even good, if that frequency divider worked? Is this even possible? AI: Think about what each part of your circuit does. MUX3 All this is doing is saying if CLK1 is high, then output 1. If CLK1 is low, output 0. What is the purpose of this mux? Simply MUX3 = CLK1 MUX2 Again, if MUX1 is high, output 0, if MUX1 is low, output 1. So basically MUX2 = !MUX1 MUX1 What for example happens when CLK1 is low? It selects In0 of MUX1. In0 is simply the inverse of the output of MUX1. So in other words MUX1 = !MUX1 - you've made an oscillator that will toggle at whatever the propagation delay of the not gate is. Uncontrolled inverter loops like this are almost never a good idea. What happens if CLK1 is high? Well, you get MUX1 = MUX1, so basically the output will hold whatever state it had previously. I think the theory of the interview question lies in the fact that a 2-input MUX is functionally complete - you can use multiple muxes to make any logic gate. One of those is that a mux can be configured as an AND gate with one input inverted by simply tying the IN1 pin to GND. You can then simply use two of these to create an S-R latch. Once you have an S-R latch it is very easy to build registers, and then counters.
H: What happens if the frequency of the receiver osc does not match (exactly) the carrier frequency? I thinking about FM and AM. Theoretically the carrier frequency is perfectly match the demodulation frequency. But what happens if there is a mismatch? I think using AM the frequency of the base-band analog output will be pitched low/high depends on higher/lower demodulation frequency respectively. Am I right? But what happens using FM? AI: With both AM and FM, there are sidebands on both sides of the carrier. With AM there is a simple relationship between the sideband offset frequency and the modulation frequency but with FM the relationship is less straightforward. With both types of modulation the edges of the signal spectrum with be attenuated by the IF filter if there is a frequency error. AM usually uses envelope demodulation and is quite tolerant of frequency errors. The pitch of the demodulated signal comes from the difference between the carrier and sideband frequencies, which remains constant as the error increases, so no pitch change. There is only moderate distortion with just the carrier and one sideband with AM but as soon as the carrier is filtered out, the envelope is destroyed and there is gross distortion. Try listening to a single sideband signal with an envelope detector. With FM there will be distortion if some parts of the signal are lost. You can experiment with a broadcast band receiver but bear in mind that the filters are usually not very sharp.
H: Electrical Power Question I am trying to compare watts exiting the battery vs watts being consumed by the bulb. I have set up a test circuit shown below. Should not A-B watts match C-D watts?? Sorry for such a basic question...I'm learning here... AI: You should also include the power dissipation from the resistor in there. $$ P_{battery} = -(P_{resistor} + P_{lamp}) $$
H: Emitter Resistor Why is there a voltage drop of 2v across the C/E in the following circuit (XMM2)? I thought that a transistor behaves like a variable resistor, in that when you apply 0.7v across the base, it's like the resistance across the C/E goes to zero. So I was expecting the 6v to be mostly dropped across R1 and R2. Note : This is an amplifier circuit that I took from one of the books I am trying to learn electronics from. I was just seeing if I could explain the values I was seeing in the simulation. AI: The voltage across R2 rises when the collector current increases so it counteracts the base current. Transistor dude (as seen in Win Hill & Horowitz's Art of Electronics) only sees the base current resulting from the voltage at the base relative to the emitter. As an approximation (and if the divider on the base is low enough resistance, the transistor is high gain and is in the active region), the base current is close to zero, so Vb = 6V* R4/(R3+R4) or about 1.72V. The base will load this (Ib= Ic/hFE), so it will actually be less. The emitter voltage will be about 0.7V less than the base (about 1V), so the emitter (and thus collector) currents will be around 1mA. Which means the collector voltage will be about 6V - 3V = 3V. Checking, the Vce is thus about 2V which is far from saturation. And, in this case, the numbers match the simulation quite well. If you increased the base divider values by (say) 10:1 the estimate would not be as accurate because the base current would load the divider much more heavily.
H: UART expander (5 ports to 11 ports) I have a board that I would like to design and there are 11 devices that can only be spoken to via UART. I am restricted to a Microchip uC chip product range and I have found one with 5 UART ports. I have come up with a jumper based solution whereby the user, with making the connection via jumpers to the 5 available ports, can choose 5 of the 11 devices. I have been looking for a chip that will take either UART, SPI or I2C in and give me a few additional UART ports but I have come up short. Can anyone suggest a solution or a product that they may have come across? It is not critical that all 11 devices are able to connect to the uC (that would be nice) but it is important that these devices are on the board for a modular product. However, I wish to make the product more user-friendly as the jumper based solution is a bit complicated at first glance or so I have been told. EDIT Okay sorry, I am not explaining the problem properly. With this method, you limit the user's options. Let say you link port a to device 1 and 2 and port b to device 3 and 4 and so on... But what if the user would like to use device one and two? Then the product is limiting the user heavily. With 5 port options and 11 choices for devices, the binomial coefficient yields 462 combinations for the user to choose from. That is overkill, I am not looking for that level. But with the jumper based solution port a can connect to 9 of the devices while port b can connect to 7 of the devices, port c can connect to 8, port d can connect to 7 and port e can connect to 9. The number of mux switches needed to do this would be over the limit. Is there another solution to giving the user the option to use (close to) any combination of the devices? I have thought about using two uC with 5 UART port each to connect to 10 of the devices and then using a much smaller jumper based solution for the last device, but this solution is too complicated for production and is expensive. Are there any Chips or concepts out there that will expand the UART control to 11 devices? AI: Use some UART-SPI bridge ICs, like: MAX3701 FT9xx HT45B0F SC16IS7xx You can have as many UARTs as you have spare GPIO pins to use as Chip-Select lines (or use a demux or decoder and you can have orders of magnitude more) - limited only by your UART baud rate vs the max speed you can run your SPI.
H: Max power draw on voltage rails of mini PCIe Card I am designing a custom mini PCIe card. What is the max power I can draw from the 1v5 rail, and the 3v3 rail? AI: The document your looking for is called PCI EXPRESS MINI CARD ELECTROMECHANICAL SPECIFICATION. You can find the PDF on the homepage of the PCI-SIG if you are a member or on your favorite search engine. The most recent revision seems to be 2.1. In the older version 1.2 I have on hand, it says in 3.4.3 Power: 1100 mA (2750 mA) normal (peak) current on 3.3V 375 mA (500mA) normal (peak) current on 1.5V
H: Testing Capacitor in PWM Circuit with Oscilloscope Calibration Signal I'd like to measure the effect of a capacitor in a PWM circuit with an oscilloscope. The capacitor is engaged on a switch connected to a DC motor. Can I hook the motor up to the 1 kHz calibration output and ground to measure? Will this adversely effect the oscilloscope? AI: Probably not. I wouldn't think that the cal output on the oscilloscope is capable of providing enough current to drive the motor. It probably also won't drive a large capacitative load, either. I doubt it will hurt the scope -- but I don't see a very compelling reason to try, either.
H: Identifying the pins of an AC lamp I have an AC indicator lamp which I have to add to a design and and here is the only information. As you see the two terminals are tied on one side and the other two pins has no continuity with any other pins. I cannot verify the correct phase and neutral pins. Is the upper two(silver like) neutral and the bottom gold like color is for line? What can be the reason there are four pins? I measure the resistance infinity but shouldn't it be 230/3mA = 76kOhm? I measure between the golden and the silver pins. AI: I suggest you contact the (real) manufacturer (or design owner) and ask if you don't feel like figuring it out for yourself (if you are 100% comfortable poking around with mains voltage just use a series resistor and you won't harm the lamp- if you are not comfortable get someone else local to help so you don't harm yourself). Clearly the mains voltage will be applied on opposite sides of that barrier! So that narrows it down to the commoned terminals and one of the other terminals. This is an LED lamp, probably with a high value series resistor and maybe a half-wave series diode. My guess: simulate this circuit – Schematic created using CircuitLab It could be a capacitive dropper too but the German documents show AC/DC compatibility which points to a resistor. The manufacturer appears to be: Signal Construct GmbH Brückenäckerweg 4 D-75223 Niefern-Öschelbronn Tel. (49) 7233 / 9531-0 Fax (49) 7233 / 9531-29 E-Mail: info@signal-construct.de Web: http://www.signal-construct.de GPS-Daten: N 048° 54´ 03,4" E 008° 48´ 31,1" I think the actual part number is 22H0289. A pox on distributors who hide manufacturer's information.
H: When reading the digital wave from a DAQ, should I be getting the same wave I'm generating to it? I am using a DAQ device, which is said to be capable of 400kS/s maximum, and therefore 50kS/s per channel when using all 8 channels. This is listed in the manual of the 1608fs plus DAQ So I connected a function generator, and I'm sending a square wave of 25kHz, following nyquist theorem, to all 8 channels. I thought at 50Ks/s sample rate I'll see the square wave in the software, but even at 10kHz from function generator I am not seeing a square wave. I am seeing a square wave more and more as I lessen the frequency, but I'd expect a square wave at 25kHz and below if its capable of the sampling it specifies that it is, am I wrong to expect that? Is it not capable of what it says it can do? AI: The Nyquist criterion applies to pure sinusoids. The problem here is that a square wave contains numerous higher-order harmonics, at 3× the base frequency and higher, and these components are not being captured by the sampling. Think of it like having a near-ideal low-pass filter on the input. For further information, you might want to look up the Fourier transform, and spectral content of the square wave.
H: What is the name of this piece component? I'm repairing my DVD pioneer and I need to buy this piece, could you tell me her name and where can I buy it? On some site? Highlighted in red color AI: Those are surface mount power inductors. They are pretty rugged, just thick copper wire. If they are broken, chances are something else is too. I can easily see that your capacitors are completely blown. Where to buy them is off topic for many reasons.
H: Simultaneous write and read to/from a FIFO Could someone, please, clarify whether or not I could simultaneously read and write from the soft FIFO described in this document on p.157? It does say that I can use separate read and write clocks. I assume, this feature is rather for being able to read and write with different clock rates. But how about read and writes simultaneously? Is it even a common practice to have simultaneous r/w access to FIFOs? AI: Yes, any FIFO can be simultaneously read from and written to. Reads are valid only if the FIFO is not empty, and writes are valid only if the FIFO is not full. Most implementations also have optional element count outputs that allow flow control actions before critical states are reached. There is an option to use separate clocks if you want to use the FIFO for clock domain crossing, but if both sides use the same clock, this option should be disabled as it increases resource usage and delay (in cycles) between input and output.
H: Interfacing coin cell back up for internal RTC of ESP32 In esp wroom-32 all the VDD pins has a common connection. It includes VDD_RTC too. So in case of power failure if I switch the power between main DC source and coin cell using a mosfet, will it create any interrupt on updating the RTC time? I haven't done any practical on this topic. I got this doubt while going through the internal connection of wroom-32. So please share if there is any proper solution. AI: A diode steering type setup is common. As long as the supply voltage is slightly higher than the battery voltage the diode will stay reverse biased. If the supply voltage drops out then the battery will take over automatically. Using a Schottky type diode can help reduce the forward voltage drop. Also, the device would have to detect the missing power supply and go into a hibernation type mode not to kill the battery too fast. simulate this circuit – Schematic created using CircuitLab
H: STM32 - ADC based temperature measurement on FreeRTOS I've been trying to measure the MCU's (STM32F103RB) temperature as part of a FreeRTOS application. I've tried initializing the ADC both with the low and the high-level HAL functions, but whenever I try to get data, the variable storing them has a value of about 68 (when normally it should be ~1500 - 1600 in room temperature). Any ideas? Code follows here: TempMsr.c - HAL #include "Peripherals/TempMsr.h" volatile int32_t sensorData = 0; volatile int32_t temp = 0; ADC_HandleTypeDef adc1_config; ADC_ChannelConfTypeDef adc1_channel; int32_t getTemp() { sensorData = HAL_ADC_GetValue(&adc1_config); temp = (int32_t)( ( (10 * V25 - 8 * sensorData) / (AVGSLOPE * 10) ) + 25 + BIAS); //manufacturer's formula for determining the temperature in Celsius, adjusted for unit //compliance and for minimizing errors due to possible floating-point operations return sensorData; } void ADC_TempMsr_Init() { ADC_Config(); HAL_ADC_Init(&adc1_config); HAL_ADC_ConfigChannel(&adc1_config, &adc1_channel); } void ADC_Config() { adc1_config.Instance = ADC1; adc1_config.Init.ScanConvMode = ADC_SCAN_DISABLE; adc1_config.Init.ContinuousConvMode = ENABLE; adc1_config.Init.DiscontinuousConvMode = DISABLE; adc1_config.Init.ExternalTrigConv = ADC_SOFTWARE_START; adc1_config.Init.DataAlign = ADC_DATAALIGN_RIGHT; adc1_config.Init.NbrOfConversion = 1; adc1_channel.Channel = ADC_CHANNEL_TEMPSENSOR; adc1_channel.Rank = ADC_REGULAR_RANK_1; adc1_channel.SamplingTime = ADC_SAMPLETIME_239CYCLES_5; //~17 us, manufacturer-suggested time for temp sampling } TempMsr.c - Low-level: void ADC_TempMsr_Init() { ADC_Config(); LL_ADC_Enable(ADC1); LL_ADC_StartCalibration(ADC1); } void ADC_Config() { LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_ADC1); //enable the clock for ADC1 LL_ADC_SetCommonPathInternalCh(__LL_ADC_COMMON_INSTANCE(ADC1), LL_ADC_PATH_INTERNAL_TEMPSENSOR); uint32_t wait_loop_index = 80; //CPU cycles which correspond to ~10 us, suggested stabilization time for temp.sensor stabilization while(wait_loop_index != 0) { wait_loop_index--; } /* Set ADC group regular trigger source */ LL_ADC_REG_SetTriggerSource(ADC1, LL_ADC_REG_TRIG_SOFTWARE); /* Set ADC group regular continuous mode */ LL_ADC_REG_SetContinuousMode(ADC1, LL_ADC_REG_CONV_SINGLE); /* Set ADC group regular sequencer length and scan direction */ LL_ADC_REG_SetSequencerLength(ADC1, LL_ADC_REG_SEQ_SCAN_DISABLE); /* Set ADC group regular sequence: channel on the selected sequence rank. */ LL_ADC_REG_SetSequencerRanks(ADC1, LL_ADC_REG_RANK_1, LL_ADC_CHANNEL_TEMPSENSOR); LL_ADC_SetChannelSamplingTime(ADC1, LL_ADC_CHANNEL_16, LL_ADC_SAMPLINGTIME_239CYCLES_5); } The corresponding header file (TempMsr.h): #ifndef INC_TEMPMSR_H_ #define INC_TEMPMSR_H_ #include "stm32f1xx_hal.h" //#include "stm32f1xx_ll_adc.h" //#include "stm32f1xx_ll_bus.h" #define AVGSLOPE 4.3 //average slope of T-V chart according to datasheet pg 79 //(min is 4 mV/C, max 4.6, default (4.3): typical) #define V25 1430 //voltage of temperature sensor at 25C according to datasheet pg 79 (in mV) //(min is 1340, max is 1520, default(1430): typical) #define BIAS 20 //according to the manual (pg 235), due to mfg processes //there is an offset in the V(T) plot different //to every chip (up to +-45oC) that needs to be found. //(default is 0 so it MUST be calculated before any meaningful measurements //are made) int32_t getTemp(); //returns current MCU temp. in Celsius void ADC_TempMsr_Init(); //initializes the ADC, this needs to be run in prvHardwareSetup() void ADC_Config(); Finally, the FreeRTOS task: void vTempTask(void *pvParameters) { while(1) { xSensorData.temp = getTemp(); //continually update the appropriate variable inside the sensor data struct vTaskDelay(pdMS_TO_TICKS(1000)); //1 second per measurement is enough } } Thanks in advance. AI: I'm not 100% sure about HAL but I think you only read the value from the registers - it doesn't start the conversion. Software trigger means that you need to manually start the conversion. Look for a function which does that in HAL.
H: Is it possible to lower an ADCs input range? I'm trying to use an ADS8504, a 12-bit ADC, and get as good a resolution as possible. The ADC accepts inputs in the range of +-10V. However, my circuit is limited to only having a power supply of 5V via USB (I've already manage to produce a -5V source), as such, even though I'd want to amplify the desired signal to +-10V, the maximum I'll get is +-5V. So my question is if there is any way to change the input range of the ADC so it will only consider +-5V as the conversion range. i.e: go from 10V being +2048 and -10V being -2048 to +5V being 2048 and -5V being -2048. I've gone through the datasheet and haven't been able to figure out a way to do it. There is a part that talks about calibration, but I'm not quite sure if the trimming circuit provided does what I'm looking for or if it's for something else entirely. If it is possible to remedy the same issue through software rather than hardware, it would also be good to know. Any solutions are appreciated. AI: If you use an external 1.25V reference voltage you will reduce the full scale input range to +/- 5V. Precision ADC references require more than a resistor divider and some of the performance characteristics might suffer with the reduced Vref and input range.
H: Two source diode protection I need to protect the 12.8v regulator from the 14.5v battery. Do I try to just reduce the battery voltage below 21.8V with a bunch of diodes? Do I just put one diode protecting against current flow into the regulator output? Do I do both? The load operates on 6-36V, and 30w. The reason I put several diodes in the last option is this. If both the sources are connected I would like the load to take power from the regulator instead of the battery. I thought with multiple diodes in there it would take from the regulator instead of the battery. Am I right? simulate this circuit – Schematic created using CircuitLab Need to protect the regulator from burning. Which option is correct? AI: Your first 2 options won't work. Both of them will allow your regulator to be 'back-fed', which is usually not a good thing. The other 2 will prevent the regulator from being back-fed. If your load doesn't mind the higher voltage then the extra 3 diodes in option #4 are not all necessary, but you'll probably want to keep one of them unless you intend for your regulator to charge the battery too.
H: Thevenin equation of a circuit with two voltage sources, one on an open circuit I am incredibly sorry, as I'm sure this specific example has been asked before, but I missed the class on it and the professor hasn't yet uploaded the video to his website. I need to know how to find the thevenin equivalent of this circuit: A lot of the resources online don't seem to cover this specific example, and while I understand how to do it for one source, or sources that are in sequence, the parallel is tripping me up. What really confuses me is how I should be measuring the source connected to the open circuit. I would really appreciate the help. Since this is for a lab, I need to measure the equivalent resistance, the open circuit voltage, and the closed circuit current. AI: I would start by redrawing the circuit: simulate this circuit – Schematic created using CircuitLab Then use a source transformation: simulate this circuit Combine the resistors: simulate this circuit Transform back: simulate this circuit Finally combine the series components: simulate this circuit
H: STM32F4 - RCC reset register I can't understand what's the job of RCC_xxPeriphResetCmd() function in the stm32f4xx-rcc driver? in fact the thing that i can't realize is what happens to a peripheral when we reset it (by setting it's relative bit in the RCC AHBx(or APBx) peripheral reset register) ? for example for AHB1 Peripheral : the register is : and stm32f4xx-rcc driver function is : void RCC_AHB1PeriphResetCmd(uint32_t RCC_AHB1Periph, FunctionalState NewState) { /* Check the parameters */ assert_param(IS_RCC_AHB1_RESET_PERIPH(RCC_AHB1Periph)); assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { RCC->AHB1RSTR |= RCC_AHB1Periph; } else { RCC->AHB1RSTR &= ~RCC_AHB1Periph; } } AI: The Peripheral Reset Registers should cause the peripheral's entire register set and internal state to be reset to power-on defaults. This means not just the registers that are exposed to the user, but also any internal registers, counters, or flags should be set as they would be when the device is initially powered on. However, this is not clearly specified in the datasheet or reference manual, which is unfortunate. Some of the peripheral descriptions in the datasheet reference things that happen when the peripheral reset is activated, and this gives some insight into how deep the peripheral reset goes. Here's an example from the STM32F4xx reference manual: GPIO port configuration lock register (GPIOx_LCKR) (x = A..I/J/K) This register is used to lock the configuration of the port bits when a correct write sequence is applied to bit 16 (LCKK). The value of bits [15:0] is used to lock the configuration of the GPIO. During the write sequence, the value of LCKR[15:0] must not change. When the LOCK sequence has been applied on a port bit, the value of this port bit can no longer be modified until the next MCU or peripheral reset. This makes it clear that the peripheral reset can accomplish things that the user program can't otherwise do. To your comment: as i understand ,you say that RCC unit, reset a peripheral to its default value by giving it some clock ? Clocking a peripheral is what enables that peripheral to operate. Peripherals generally all require a clock to drive their internal operations, and ensure synchronicity with the rest of the MCU. This is entirely separate from the reset operation, even though the Reset and Clock Controller handles both functions. It would be logical to assume that the peripheral reset activates the same circuitry that the power-on reset does, which would mean that the peripheral reset will be effective even if the peripheral's clock is disabled by the RCC, however, this is also not documented anywhere that I can find, and it is possible that some aspects of the reset behavior are synchronous, and won't work if the peripheral is not receiving a clock.
H: Op amp LM324 as pre-amp to LM3915 LED VU Meter simulate this circuit – Schematic created using CircuitLab I have made a LED VU Meter using LM3915 and added a low pass filter too. Then I've tried a basic op amp circuit using LM324 (inverting and non inverting) to amplify the LM3915's input, but it doesn't work. It only lights up the first led, it doesn't work like a VU meter should. Can anybody show me how to use an op amp like the LM324 with the LM3915? My LM3915: The two LM324 circuits I tried: AI: You haven't indicated what you did for the low pass filter, but what I've found with these devices when I used them 30+ years ago is that you really can't see the higher LEDs turning on with a straight signal going into them, since they are on for such a short time, they're very dim. For a proper VU meter, you need a peak hold circuit - mechanical VU meters had a fairly quick rise under the moving coil's force but were well damped so returned fairly slowly under the hairspring. The LM3915 datasheet shows a peak detector based around an op-amp, the size of that output cap will determine the response. The gain of the op-amp circuit can be adjusted to get a reasonable scaling, but you can also reduce the value of the reference voltage on Rhi (pin 6) to increase the sensitivity at the expense of accuracy. The datasheet shows examples of that too.
H: NVIC Pending register vs EXTI Pending register (STM32F4) Why there are two pending registers for interrupt? One of them is EXTI_PR and other one is Interrupt Set-pending Registers(ISPR) which is in NVIC controller registers. EXTI unit pending register: NVIC unit Pending Register: Are these two having the same purpose? If not, what is the difference? Also I am confused about Interrupt Set-enable Registers (ISER) in NVIC unit and Interrupt mask register in EXTI unit. What's the difference between them? AI: The NVIC is the core peripheral for handling interrupts. The nested vectored interrupt controller if memory serves me right. The NVIC doesn't know about which peripheral does what, it just handles all the interrupt coming from them. The NVIC_ISPR0-7 register are used to trigger interrupts by software, so you write a 1 to bit there and the corresponding interrupt will be pending and if the interrupt is enabled it will be handled. Now the peripherals of the STM32 have their own capabilities to fine tune the interrupt sources. The external interrupt unit you are looking at, can trigger up to 22 different interrupts, only a part of them are mapped to own interrupt vectors of the NVIC. So to distinguish between those, you have to check the EXTI_PR register which interrupts you are currently handling. If you look close, you can see that you cannot set bits in the EXTI_PR register just by writing a 1 to it, that will actually clear the bit (which you have to do in some cases). The interrupt set enable register of the NVIC gives you the coarse level of enabling or disabling interrupts. For example you can enable the EXTI9_15 bit there, which will now enable all EXTI interrupts from line 9 to 15, but you maybe just want an interrupt from EXTI line 12. So to allow the fine tuning of this, the EXTI interrupt mask register allows you to only enable line 12 to trigger an interrupt.
H: STM32F4 struct unnamed has no field brr I'm a newbie to STM32 coding and struggling with the following: I used to code a little bit with STM32F103C8T6, using cubeMx and HAL libraries. I made a code using the following code to set the pin to High: GPIOB->BRR = STEP_Pin; It worked like a charm. I just try to move my project to an STM32F446RE Nucleo. I changed a few pieces of my code but I have a compiling error I can't get rid off. ../Src/main.c(175): error: #136: struct "<unnamed>" has no field "BRR" I have this error for every single line using BRR. Do you know what I should change? Config: CubeMx, Keil, HAL Lib, STM32F446RE Thank you AI: BRR Register isn't defined for the GPIOs in the STM32F4 MCUs .You can use BSRR regster instead. for more information see the STM32F4-Reference manual page 286 and also STM32f4xx.h file for the registers have been defined for GPIOs.
H: Is it safe to charge single 18650 cells without temperature sensing? I was looking at 'power bank' circuit boards on Aliexpress, the kind that you add to a 18650 cell to make a basic 5V in/out supply. I noticed they all seemed to be lacking any kind of temperature sensing. Most serious BMSes come with some kind of temperature sensor, so they can kill the charge current if the temperature rises too much. Is this necessary for a single lithium ion 18650? I know about failure modes of packs where a cell goes short circuit in a parallel group, causing the other cells to discharge through it. Or a cell in a series group has a bit less capacity and ends up reverse biased. These events might cause damage if the charger continues to pump current through the battery. But neither single-cell 18650 charging boards, nor 18650 protection circuits, appear to have temperature sensing. So is it safe to run a single cell without it? AI: With a decent battery and charge-protect circuit it should be fine, since both the single-battery protection (using, for example, the popular DW01 chip) and charging IC (like TP4056) already limit the current through the 18650 cell; the current has nowhere else to flow, unlike the case with serial/parallel configurations. If you look at the DW01 datasheet and it's typical application circuit (below), you can see that it actually monitors the current already and can completely disconnect the battery using M1 and M2 transistors in case of a failure. In parrallel and serial connected cells the IC does not monitor the currents between different cells and can't disconnect them from each other in case of a failure. The temperature sensor, however, is still recommended for additional safety and redundancy, that is why some LiPo cells include a temperature sense output in their integrated protection circuit: for example, an external short circuit directly between the cell contacts situation could only be handled by a temperature sensor. This situation, however, could easily be avoided by designing a decent PCB and enclosure.
H: Best way to develop a kapton tape cutter machine? I'm constructing a machine that cuts kapton tape in a specific length, the way I'm doing is there's a motor that keeps pushing tape forward, when the tape covers an infrared led, the motor stops and another motor cuts the tape like a knife. The only part I'm not so sure it will work is the cutting part, anyone have a better idea? I'd like to hear some before I spend money buying everything... Ps: I'll be using an arduino to do all the control AI: *Puts on safety goggles* *Puts on a white lab coat* *Cracks fingers* *I am now ready to tackle electronic design questions!* Instead of using a knife to perform the cutting, use a scissor. A simple servo (the 9g kind) can easily be fixed to one of the scissors blades while controlling the other blade. It appears I'm not making myself clear enough, so I will show three images that should make everything crystal clear. This is a scissor: It's from the Wikipedia link above. This is a 9g servo: Reference Last but not least, a 3D-printer, or whatever method you were going to use to construct your machine. If you have tools for making an adapter, then use your tools. If not, then use a 3D-printer. This is how a modern 3D-printer looks like, circa 2018: Reference With a 3D-printer, you should be able to make an adapter that fits your scissor and the outer part of the 9g servo. The outer part being the plastic shell with the thin cover on it that says "Tower Pro". I shan't confuse you, the color of the plastic shell is blue. To this blue plastic you can connect an adapter, that you make with a 3D-printer (that I've shown above this text). With the servo (the 9g one) connected to the scissor, you are ready for a second adapter. One that connects the white part (on the 9g servo) that connects to the other blade of the scissor. I'm still talking about the images above. If you do not possess a 3D-printer, then look elsewhere on the Internet for other companies that 3D-print for you. Though, you will have to pay, as if you are a human being. This is an electronic design site, where I will give everything and a little bit more when it come to electronics. If you want a 3D-design, then make it yourself or beg someone else.
H: Shorting capacitors using a transistor? Introduction First off, I'd like to let you know I am a beginner at electronics so some of the stuff I say might be very wrong. What I want to make is a 'spark generator' for lighting some gases in a chemistry project. I have been having a bit of fun just shorting a mini capacitor bank and seeing the spark it produces. Now I want to include a remote switch so I can discharge them from a distance. I have decided to use a transistor controlled by an Arduino Uno (Arduino is controlled by nrf24l01 module). Circuit simulate this circuit – Schematic created using CircuitLab Sorry if my circuit drawing is bad, here is a written description if you prefer: capacitors are 35v (I only charge them to 12v) 1000uF and there are 5 in parallel with eachother arduino I/O pin connects to a 500 ohm resistor, which connects to base pin of transistor transistor collector pin is connected to capacitor+ transistor emitter pin is connected to capacitor- the arduino ground is also connected to capacitor- (HAVE NOT TESTED!) - I have made separate cables for charging them up. Essentially I have charged capacitors hooked up to a transistor switch which is controlled by an arduino. Here is what I need help with Previously to making this circuit I had tested it without arduino ground connected to capacitor-. It did not work which is what led me to attach arduino ground to capacitor-. I am concerned that shorting the capacitor bank will actually just flush it all into the arduino ground and fry it. I was tempted to try it but I came here for reassurance from someone more knowledgeable. Thanks AI: I composed this answer before you posted your schematic. In what you drew the transistor will remain in the active mode and will not behave as a switch. This is what I thought you were describing: simulate this circuit – Schematic created using CircuitLab Unless the transistor blows up (which is very likely) the Arduino would be safe. On the worst case scenario you would be pumping around 20mA into the protection diodes of the Arduino micro controller, as the current will be limited by your resistor. Not advisable, but not too bad. But this idea will not work. The reason you get the spark when you short the terminals by hand is because you are placing a very small impedance very quickly on a device that basically has no current limitation. This vaporizes the tiny region of metal that initiates contact which vaporizes and initiates the plasma that you can see as a spark as the rest of charge dissipates through it. If you manage to get the transistor to switch quickly enough (unlikely, as several parasitics come into play that will reduce the rate of discharge) what you will get is all of this current heating up the transistor, possibly to the point of failure. With this idea the only way I can see to generate a spark would be with a very thin wire (basically a low-value fuse) in series with your capacitor and transistor. The fuse will blow (if the transistor doesn't), just like the metal does on the point of contact. To be able to get a spark across a fixed gap, you need to generate high voltages. Not high currents.
H: Microcontroller PWM output volume So I am designing a cheap and simple sound device using the Atmega32U4 uC and stumbled across one problem. I am using the 10-bit PWM output of the uC to output audio and I want the user to be able to control the output volume using buttons, not a discrete potentiometer. A typical solution would be to just decrease the PWM output duty; but that way I am losing the already low resolution - by decreasing the output volume only by 10dB I already get 60% lower output voltage, and, therefore, I am entering the 8-bit resolution territory already. That's why I started looking for a cheap hardware volume decreasing solution and I don't want to use a digital potentiometer, since they are relatively pricey. In the end, I came up with the solution shown below; basically, it uses two uC PWM outputs, one to control the volume (VOLPWM) and one to output the audio (OUTPWM); the VOLPWM gets heavily integrated and then the Q1 switches according to the OUTPWM between ground and the VOLPWM output voltage. Notice that the output integration happens after the Q1+R2 pair, pure PWM signal enters the Q1 base. I've also considered using a push-pull pair instead of Q1+R2, however, I wasn't able to get a decent low level output. My questions are: Are there any better solutions to my problem? Won't the similar value of R2 and R5 be problematic? What could be the other cons of my solution? AI: That's actually pretty good — you've created a multiplying DAC. The biggest problem I see is that the integrator time constant varies with whether Q1 is on or off — when it's on, you have only R5 in the circuit, but when it's off, you have R2 + R5 in series. To minimize the effect of this, make R5 a couple of orders of magnitude larger than R2. (Reduce the value of C2 to compensate.)
H: Help with demonstrating the meaning of this information Regarding the following information about open drain and push pull configurations: The advantage of the push-pull output is the higher speed, because the line is driven both ways. With the pull up the line can only rise as fast as the RC time constant allows. The R is the pull up, the C is the parasitic capacitance, including the pin capacitance and the board capacitance. The push-pull can typically source more current. With the open-drain the current is limited by the R and R cannot be made very small, because the lower transistor has to sink that current when the output is low; that means higher power consumption. However, the open-drain allows you to short several outputs together, with a common pull up. This is called an wired-OR connection. Now you can drive the output low with any of the IO pins. To drive it high all outputs have to be high. This is advantageous in some situations, because it eliminates the external gates that would otherwise be required. I'm stuck with understanding two parts above: 1-) "With the open-drain the current is limited by the R and R cannot be made very small" What is meant by that? 2-) Regarding wired-OR: "This is advantageous in some situations, because it eliminates the external gates that would otherwise be required." Why would external gates required in push-pull case Can these be explained by using circuit diagrams? AI: The early logic, from Fairchild, was RTL resistor-transistor-logic. simulate this circuit – Schematic created using CircuitLab
H: Voltage divider with pull up resistors I'm designing a peripheral circuit between a sensor (U1) and a MCU (U2). U1 has an open-drain output pin to indicate its status. This pin will be staying at either HIGH or LOW constantly (not frequently toggling). U2 requires 3.3V as input. I only have 5V supply and therefore a voltage divider is used to produce 3.3V. Since the voltage divider already has high enough resistors (100k and 200k), the current flows through R1 will be really low. In this case, do I still need a pull up (R3) for the 3.3V? In other word, can I replace R3 with a wire/jumper? simulate this circuit – Schematic created using CircuitLab AI: No, you don't need R3. Be aware of the current draw of your input. Input circuitry impedance isn't infinite, and some logic circuits might struggle to "understand" the signal if the resistance is too high. I don't know what is U2, but your device should not suffer if you were to use a single pullup resistor. It's common for ICs to have over-voltage protection circuitry inside, and some 3v3 powered ICs even have 5V tolerant inputs simulate this circuit – Schematic created using CircuitLab For input current draw and input voltage tolerance, you should read the datasheet.
H: How do universal IR remote "codes" work? It is easy to find this kind of reference when searching for IR protocols and codes for specific equipment. The actual IR transmission contains far more data than these small codes can hold. What exactly do these codes represent? How can four digits represent all the commands a device can receive? Are these "codes" references to some standard protocol? How do the universal remote knows the protocol and all the codes the product understands from this small configuration code? I would love to understand more about this technology. For me it seems that every remote is different, and you would have to reverse engineer every message to identify which bit/byte does what. AI: The codes are just a reference to a set of actual IR codes. It tells the microcontroller or CPU (loose term) of the remote which type of code modulation, brand and device type to use. The standard protocols are RC5 and NEC, though there are other types. Once you know the protocol, the rest is just crafting the actual button code, which is a fairly small set of generic codes, typically 8 bits so 0 to 255 or 0x00 to 0xFF, and a manufacturer code. Each value does different things based on the device, so one tv may take 0x0A to mean power on, another might use that for channel down. Universal remotes work basically by the manufacturer gathering as much data about common IR code sets for common devices and providing the end user with a way to set that code set. The codes you put in are just like a street address, with the remote figuring out all the information it needs for that code. TV manufacturers sometimes reuse codes from one tv to another, and some white label manufacturers reuse them (white label manufacturers make generic TVs with a store name brand). So there's a lot of overlap in codes. No one likes to reinvent the wheel.
H: Need help with calculation SPI Frequency I am using Bit banging SPI to communicate with SDCard. I am using QCA4020 and I have no information regarding the Pin Toggling Frequency. To get the max speed of SPI Possible with the hardware I am generating clock by setting and resetting pin w/o any sort of delay in between. I am taking the time before starting the communication and after ending the communication of 512 Bytes, and getting around 25600 Bytes per second from that calculation. I have to put down on paper a rough SPI Frequency that I am using for the communication and I have no tool to do it atm. My calculations are 25600 Bytes per second , hence 25600*8 bits per second, 1 Bit change = 2 edge and hence 1 Clock. therefore my speed comes to around 25600*8 = 204800 Hz. Does that sound correct or do you suggest any other method to do so? 2) How is one supposed to get Bytes per second using the Pin Toggling Frequency? My assumptions are : Pin Toggling Frequency : 400000. Hence Bytes per second will be 400000/8 = 50000. Is it correct? or Am I missing something? Does this hold true in terms of bitbanging as well? AI: Your calculations are correct (sort of), but this is not a good way to do SPI given you have a feature packed microcontroller. You should use the SPI module on your microcontroller - this will generate all the signals and protocol correctly. You've missed that you also need to update the data at each clock tick. So (depending on the SPI phase), it will be more like: clock down > change data > clock up. Having a toggling pin is not optimal for a couple of reasons: You also need to update your data, so just toggling the pin tends to give uneven mark/space. Any interrupts that happen will stop transmission. Bit-banging is great if you have a low-power microcontroller without proper hardware, and just want something quick and easy. It's a fun exercise to write your own reusable code for such situations, but these days even the lowest end micros come with hardware SPI (it's essentially just a shift register).
H: 40 kHz Emitter Frequency Response I've recently purchased 40 kHz transceivers and I tested its frequency response in anechoic chamber using a B&K microphone located 90cm away from the emitter. The response provided in the datasheet is whereas my finding is What can be causing this discrepancy? The center frequency is clearly not 40 kHz as it was claimed to be. Is a standing wave causing the notch that is at ~38 kHz? I am pretty sure the experiment setup is functioning well. AI: The linear Vs Db scale thing accounts for much of this, and these are not exactly precision devices so the centre frequency being slightly off is not a huge surprise. The notch is only about 3dB, and may well be two transducer modes being excited, you may also be seeing a null due to a reflection from the housing or something, try rotating the transducer very slightly off axis and see if the notch moves. If reflections causing standing waves are a concern, you can try setting up a time gate on your measurement (Emit a pulse, gate the measurement for when you expect the signal to arrive).
H: Q: Whats the schematic of this Potentiometer Just wondering what's the wiring, kinda confused on how this actually looks on a schematic. Does this look correct? simulate this circuit – Schematic created using CircuitLab AI: It's a (simulated) variable resistor between pins 5 and 6. From Wikipedia: Of course there are some differences with real resistor, such as the requirement that both ends of the resistor must always remain within the power supply rails of the chip for proper operation. The "wiper resistance" is in series with the "element resistance" which means some nonlinearity that will vary with voltage of the simulated rheostat and the supply voltage.
H: MSP430F5529 UART: UCTXIFG Doesn't Set Again After Initiating Transmit I am attempting to program a sort of bridge between UCA0 and UCA1 in UART mode on the MSP430F5529 using the MSP-EXP430F5529LP development board. I am using an interrupt for receiving data but for transmitting I am just loading the UCAxTXBUF directly (no TX interrupts are enabled). I say UCAxTXBUF because the bridge should be bidirectional, so it can either be UCA0TXBUF or UCA1TXBUF. My interrupt service routine is based on TI's UART examples available in the MSP430Ware packages. The examples use a busy wait inside the ISR to wait for the TX buffer to become available (UCTXIFG goes high) before loading UCAxTXBUF with the data. I hate the idea of putting a busy-wait inside an interrupt but for the sake of argument I'm following the examples. Anyway, the problem is that, while UCTXIFG is high when I'm preparing to transmit the first byte, as soon as I load the UCAxTXBUF with the data the UCTXIFG bit clears (as expected), but then is never set again. This suggests that for reason unknown, the data is not being transmitted so UCBUSY remains set and UCTXIFG doesn't go high indicating the buffer is ready for more data. What might be the issue? The ISRs for UCA0 and UCA1 are shown below: UCA0 ISR: #pragma vector = USCI_A0_VECTOR __interrupt void USCI_A0_ISR(void) { __no_operation(); switch(__even_in_range(UCA0IV,4)) { case 0: // No interrupt break; case 2: // RX interrupt __disable_interrupt(); // Disable interrupts UCA0_rxByte = UCA0RXBUF; while (!(UCA1IFG & UCTXIFG)); // Wait for UCA1 TX buffer to be ready // Bad practice - should not have busy // wait in ISR UCA1TXBUF = UCA0_rxByte; // Pass through to 485 UCA0_rxString[UCA0_idx] = UCA0_rxByte; // Save current byte in buffer UCA0_idx++; TA0_clearTimer(); // Restart timer __enable_interrupt(); // Re-enable interrupts break; case 4: // TX interrupt break; } } UCA1 ISR: #pragma vector=USCI_A1_VECTOR // UCA0 RX/TX interrupt vector __interrupt void USCI_A1_ISR(void) { switch(__even_in_range(UCA1IV,4)) { case 0: // No interrupt break; case 2: // RX interrupt __disable_interrupt(); // Disable interrupts UCA1_rxByte = UCA1RXBUF; // Get current byte UCA1_rxString[UCA1_idx] = UCA1_rxByte; // Save current byte in buffer while (!(UCA0IFG & UCTXIFG)); // Wait for UCA0 TX buffer to be ready // Bad practice - should not have busy // wait in ISR UCA0TXBUF = UCA1_rxByte; // Pass through to TTL UCA1_idx++; TA0_clearTimer(); // Restart timer __enable_interrupt(); // Re-enable interrupts break; case 4: // TX interrupt break; } } The __disable_interrupt() and __enable_interrupt() lines were added in after this problem first appeared, so I am fairly confident they are not the problem. When I attempt to transmit the first character from UCA0 the test while(!(UCA1IFG & UCTXIFG)) falls straight through, as I expect it to since the UCA1TXBUF should be empty and ready for data. However, when I attempt to transmit the second character from UCA0 the program hangs at that same test. Checking the registers in CCS I see that UCBUSY is set and UCTXIFG is still clear. What could cause this sort of behavior? I have found multiple questions asked here and on other sites that describe a similar issue, but they all seem to be for I2C or SPI, and the solutions do not seem to apply to my current problem with the UART. The actual ISR from TI's UCA0 example is shown below. The added bits above are modifications to variables I use for my own purposes. switch(__even_in_range(UCA0IV,4)) { case 0:break; // Vector 0 - no interrupt case 2: // Vector 2 - RXIFG while (!(UCA0IFG&UCTXIFG)); // USCI_A0 TX buffer ready? UCA0TXBUF = UCA0RXBUF; // TX -> RXed character break; case 4:break; // Vector 4 - TXIFG default: break; } UPDATE: For sake of completeness, here is the initialization code for UCA1 (effectively identical to the initialization for UCA0): void UCA1_init(uint32_t smclk, uint32_t baudrate) { P4SEL |= BIT4 + BIT5; // Select alternate function for P4.4, 4.5 (UCA1 TXD, RXD) UCA1CTL1 |= UCSWRST; // Reset USCI state machine UCA0CTL1 |= UCSSEL_2; // Set clock to SMCLK UCA1BR0 = 52; // Low byte of clock prescaler (9600 bps) UCA1BR1 = 0; // High byte of clock prescaler UCA1MCTL = UCBRS_0 + UCBRF_1 + UCOS16; // Modulation stages; oversampling mode UCA1CTL1 &= ~UCSWRST; // Restart USCI state machine UCA1IE |= UCRXIE; // Enable RX interrupt } And the port initialization for UCA1 (note that UCA1 is port-mapped): // PORT4 P4SEL = (BIT4 + BIT5); // Set P4.4 as UCA1TXD, P4.5 as UCA1RXD, rest as I/O PMAPKEYID = 0x2D52; // Unlock port mapping register configuration PMAPCTL |= PMAPRECFG; // Allow reconfiguration of mapping P4MAP4 = 12; // Map P4.4 to PM_UCA1 P4DIR |= BIT4; // Set P4.4 as input (UCA1TXD) P4MAP5 = 11; // Map P4.5 to PM_UCA1 P4MAP5 &= ~(BIT5); // Set P4.5 as input (UCA1RXD) P4DIR |= (BIT7 + BIT6 + BIT3 + BIT2 + BIT1 + BIT0); // Set rest of PORT4 as outputs P4OUT &= ~(GPIO_ALL); // Clear PORT4 outputs I am beginning to wonder if there may be an issue with my mapping of the ports. I should have included this from the start. Perhaps someone can identify an error? AI: void UCA1_init(...) { ... UCA1CTL1 |= UCSWRST; // Reset USCI state machine UCA0CTL1 |= UCSSEL_2; // Set clock to SMCLK ^ This leaves the USCI_A1 clock source at its default setting (external), and I guess that P4.0 is not configured for that. There is a method to avoid the loop inside the interrupt handler (it does require both TX/RX interrupts): bool UCA0_received; bool UCA1_txReady; USCI_A0_ISR() { switch (UCA0IV) { case USCI_UCRXIFG: UCA0_rxByte = UCA0RXBUF; UCA0_received = true; maybeEchoTo1(); break; } } USCI_A1_ISR() { switch (UCA1IV) { case USCI_UCTXIFG: UCA1_txReady = true; maybeEchoTo1(); break; } } maybeEchoTo1() { if (UCA0_received && UCA1_txReady) { UCA1TXBUF = UCA0_rxByte; UCA0_received = false; UCA1_txReady = false; } } And please do not use magic numbers but the proper symbols for the interrupt vector values. They are not documented anywhere (even the writers of TI's examples do not know them), so you have to scrape them out of the header file: /* USCI Interrupt Vector Definitions */ #define USCI_NONE (0x0000) /* No Interrupt pending */ #define USCI_UCRXIFG (0x0002) /* Interrupt Vector: UCRXIFG */ #define USCI_UCTXIFG (0x0004) /* Interrupt Vector: UCTXIFG */
H: J K Flip Flop and Boolean Algebra Y=K'J'Q+K'J+KJQ' The output Y should be that of a JK flip-flop. That is: Y=JQ'+K'Q I tried to solve the following way: 1. Y=K'J'Q+K'J+KJQ' 2. =K'(J'Q+J)+KJQ' 3. =JK'+K'Q+JKQ' 4. =J(K'+KQ')+K'Q 5. =J(K'+Q')+K'Q 6. =JK'+JQ'+K'Q It appears as if the term JK' is 0. Please help. AI: Start with the original equation: Y = K'J'Q + K'J + KJQ' The trick is to create two terms that are equivalent to the middle term, using the fact that X + X' = 1: Y = J'K'Q + JK'(Q + Q') + JKQ' Y = J'K'Q + JK'Q + JK'Q' + JKQ' Now factor the pairs of terms: Y = K'Q(J + J') + JQ'(K + K') Simplify, again using the fact that X + X' = 1: Y = K'Q + JQ' This is really obvious if you draw the Karnaugh map for the function. The JK' term is redundant, given the other two terms.
H: Does pin A15 on a Z80 tell if the CPU is addressing ROM or RAM? I am designing a simple, hobbyist single board computer similar to an Arduino using a Z80 CPU. The trouble I am running into is how the CPU addresses memory. I know that the Z80 uses pins A0-A15 to form an address bus, but reading "The Z80 Microcomputer Handbook", https://archive.org/details/The_Z80_microcomputer_handbook_William_Barden/page/n109, page 118 (In the book, not in the slider at the bottom of the webpage), second paragraph under "Interfacing ROM and RAM", it says that pin A15 is used to differentiate between the CPU addressing ROM or RAM. It says that when A15 is low, then ROM is being addressed, and when A15 is high, then RAM is being addressed. Is this true? If it is, would I be correct in saying that that would take my 16 bit address bus to a 15 bit one, since one of those address pins is used to tell if the CPU is using ROM or RAM? Wouldn't it make more sense to AND MREQ and M1 together and connect that with the chip enable on the ROM, so as to make the ROM active whenever the Z80 is in opcode fetch mode? The reason I ask this is because I would like the CPU to have 64K of ROM and RAM, if this is possible. I'm new here, so any help is much appreciated, but if I did anything wrong, please tell me and I'll fix it. AI: Look at the schematic on the following page. A15 is connected to the chip selects of the ROM and RAM to make that happen. It's not a function of the Z-80 per se -- it's a function of how the external memory is laid out. Good choice -- the Z80 was the second microprocessor I ever worked with (in a TRS-80), and the first one I was paid to develop software on (at 13 -- you gotta love family businesses).
H: Help identify this breaker I salvaged this breaker unit from the scrape yard. Compared to every other breakers i have seen before, this is very different. It has 5 terminals. The labels are very clear but there is no information about the usage of its terminals. The terminals are labelled A, B and C. Its not even labelled clearly which side is load and which side is line. The greatest mystery is the terminal C. What is it's purpose and how is it used? AI: It's an interesting type of circuit breaker, a Hydraulic-Magnetic. See the catalog here. Anyway, the third pin is actually for a trip coil. Which is a coil when energized, will trip the circuit breaker. Ther are most often found as clip-on units for rail circuit breakers. But this one has it integrated. Different catalog.
H: Can 10-100mA kill a person / be deadly? According to various sources something as little as 0.01A = 10mA can be painful, at 0.1A = 100mA you can expierence * "ventricular fibrillation of the heart". "an uncoordinated twitching of the walls of the heart's ventricles which result in death". "As well as other painful things such as extreme breathing difficulties, Severe Shock, Muscular paralysis ...". * How is that true? I've worked with an arduino and LEDs, LED Strips etc for quite a while yet never heard that 10mA can be painful let alone 50-100mA deadly. AI: First off, its voltage not current that kills (because you have to bypass the skin). The actual mechanism is current once you get under the skin. The minimum current a human can feel depends on the current type (AC or DC) as well as frequency for AC. A person can feel at least 1 mA (rms) of AC at 60 Hz, while at least 5 mA for DC. At around 10 milliamperes, AC current passing through the arm of a 68-kilogram (150 lb) human can cause powerful muscle contractions; the victim is unable to voluntarily control muscles and cannot release an electrified object.[11] This is known as the "let go threshold" and is a criterion for shock hazard in electrical regulations. Source: https://en.wikipedia.org/wiki/Electrical_injury Your not getting 10mA through your heart when you are playing around with electronics or low voltage <60V. Skin is more than 10k (as much as 100k), to get 10mA through 10k is at least 100V. If you have dry skin, it is much higher. Per IEC directives Low voltage is lower than 50V In the European Union, the Low Voltage Directive defines low voltage starting from 50 V AC, and 75 V DC. The directive only covers electrical equipment and not voltages appearing inside equipment or voltages in electrical components. IEC 60364 defines it as 50 V AC and 120 V DC. Source: https://en.wikipedia.org/wiki/Extra-low_voltage The body has resistance to current flow. More than 99% of the body's resistance to electric current flow is at the skin. Resistance is measured in ohms. A calloused, dry hand may have more than 100,000 Ω because of a thick outer layer of dead cells in the stratum corneum. The internal body resistance is about 300 Ω, being related to the wet, relatively salty tissues beneath the skin. The skin resistance can be effectively bypassed if there is skin breakdown from high voltage, a cut, a deep abrasion, or immersion in water (Table ​(Table2).2). The skin acts like an electrical device such as a capacitor in that it allows more current to flow if a voltage is changing rapidly. A rapidly changing voltage will be applied to the palm and fingers of one's hand if it is holding a metal tool that suddenly touches a voltage source. This type of contact will give a much greater current amplitude in the body than would otherwise occur. Source: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC2763825/
H: How to drive a 3” TFT I want to display 2 or 3 images in a loop (every 5 seconds or so) on a 3 inch TFT. The TFT can be found here, Resolution 240x400 Screen 3 Inch Tft Lcd with MCU Interface It uses an MCU interface, I am looking for the easiest way to drive this display. I have done some Arduino stuff before, could I drive this display with an Arduino and display images such as JPEGs on it? I'm always nervous when it comes to buying these parts from Alibaba, because I don't know if there is a library that will drive the display or not already. I'm also trying to do this as cost effectively as possible and was planning on driving 10 of these display for a mini project that I am working on. AI: It would probably be a big challenge to get that display working with an Arduino, for a few reasons. It has an 40-pin flat flex connector. You'll need a suitable socket to plug it into, which breaks out the signals to something breadboard-friendly. How will you interface with it? It says it has an 8/9/16/18 bit interface, but does it have data sheet explaining how? It's probably using a standard interface, but which one? Where will the images come from? The flash memory on an Arduino Uno is only 32KB, which wouldn't be enough for even one image. A better approach would be to find something friendlier at SparkFun or Adafruit, like "2.8" TFT Touch Shield for Arduino with Resistive Touch Screen", at https://www.adafruit.com/product/1651. Note the "for Arduino". It's a shield that plugs directly into an Uno. As a bonus, it has an SD card slot as well, which can hold your images. It should also come with documentation and some sample code, which is a huge help. I'll bet one of the sample programs will display .BMP images from the SD card on the LCD. Dealing with JPEG files requires decoding them first before you can transfer the pixels to the display, so stick with BMP, which will be much simpler. And the price is only double the Ali Express item, which is cheap for something with the above features. But you need 10 of them, so you'll have to decide if it fits your budget.
H: Does Reactive Power flow between Energy storage elements in a three phase system? I noticed that unlike the single phase ac power sources, the power in three phase is constant which means the instantaneous power is the same as the real power which is $$3V_{rms}I_{rms}\cos{\theta}$$ But there is also a reactive power present. $$3V_{rms}I_{rms}\sin{\theta}$$ Clearly, the complex power would just be the VI for each of the branches leading to the complex power 3VI but the reactive power is clearly missing in the instantaneous power which for single phase sources would have been $$s(t)=cos(θ)P+sin(θ)Q$$ (as shown in this link S = VI*/2 derivation) But in this case only the real power is present in the instantaneous power. At first I thought I didn't understand something, but now I'm wondering if the reactive power is present but just flows between each load. Am I correct or is there something I don't understand? AI: In a balanced three phase system, the power in each of the three phases behaves in the same way as it does in single-phase systems. When you add together the power in the three phases, the result is constant rather than pulsating. The reactive energy flows back and forth between storage elements in each of the three phases of the load and storage elements in the source or distribution system just as it does in a single phase system.
H: How do I find the inputs/outputs of an unlabeled transformer? I’ve been trying to wire a transformer according to this schematic. but nothing is labeled on the actual transformer. There only only colored wires. On the primary side, the Blue and White wire show a resistance of zero ohms when probed. On the secondary side, both Red wires along with the Black wire show a resistance of zero ohms while probed, while the Orange and Gray wire show a resistance of zero ohms when probed. The Green striped wire on the primary side doesn’t seem to be connected to anything when probed. Theres no resistance or anything happening. To measure the resistance I’m using a digital multimeter first set at 200 ohms, which I recieved a resistance of 0. I changed to the diode continuity setting and still recieved a reading of 0 ohms, which my multimeter also beeped. The only information I saw on the cover was just this: 100V 31.9V 102V FUSE 2A And yes, the cover actually does say 102V. Could this be a typo? How do I wire this without breaking it? AI: The yellow-green wire is certainly connected to the core the transformer, and is to be connected to the ground. The blue and white seem to be the primary. I am surprised the resistance is exactly 0 ? If you are sure the transformer corresponds to the one in the schematics, clearly the two red wires and the black one are connected in the same winding, and correspond to pins 6, 7, 8. I guess the two reds are 7 and 8 (order does not matter) and the black one is N° 6. Of course, orange and gray correspond to 9 and 10 (order does not matter). Are you sure the primary corresponds to the blue and white wires ? If you are, I think you can plug these two to a 100V AC source (don't forget the fuse). Then, with a voltmeter, you could check that the voltage between the 2 red wires is twice the voltage between one red and the black. If this is correct, my assumption about red/black wires is correct. If you use a sensitive enough ohmmeter, you should get a small, but not null resistance between the different wires. I think the highest resistance should be between 9 and 10, then a little lower between 12 an 14 (primary). Resistance between 7 and 8 should be lower, and resistances between 6-7 and 6-8 should be half the resistance between 7 and 8.
H: Calculating the Thevenin Voltage of this circuit What I did was apply kirchoff's voltage law to the closed network with the 2 resistors and the voltage source to calculate the voltage of the resistors. I got U - 2*Uresistor =0 <=> Uresistor =5V Then, did the same to the closed network with a, b and the one resistor and got that UThevenin=5V However, the answer is 10V. What did I do wrong? Also, is there a way to do this by calculating the current first, and then applying the formula U=RI? AI: If U is 10V, the answer is definitely not 10V also. simulate this circuit – Schematic created using CircuitLab Two of those resistors form a voltage divider - your answer is correct. As for your second question - yes, there is a way, but it requires an extra step. The total resistance of the network is R1, in parallel with R2 + R3 in series. This gives the total network resistance as: \$ R_{eq}= \frac{1}{\frac{1}{R} + \frac{1}{R+R}}\$ We don't need to work that out but - let's just leave it as "Req". The current through the whole circuit is 10V divided by this entire resistance. \$ I = \frac{V}{R} = \frac{10}{R_{eq}} \$ We now know the total current, but we need the current specifically through R2 and R3 - so we need to do a current divider. Remember, current divider you use the resistance you aren't interested in on top. \$ I_{R3} = I\times \frac{R1}{R1+R2+R3} = I\times \frac{R}{3R} = I\frac{1}{3} =\frac{10}{3R_{eq}}\$ Now, we know the current through R3. As you have hinted, we can now use V=IR to find the voltage across it - which is the same as the voltage across AB, which is the Thevenin open-circuit voltage we want. \$ V_{th} =IR=\frac{10}{3R_{eq}}\times R = \frac{10}{3(\frac{1}{\frac{1}{R} + \frac{1}{R+R}})}\times R= \frac{10}{3}\times (\frac{1}{R} + \frac{1}{R+R})\times R = \frac{10}{3}\times (1+0.5) =5V\$ What do you know - we got the same answer! You can see that took a lot longer. The voltage divider law is actually derived from finding the total current, and multiplying by the resistance you want the voltage drop of - that's why it was a lot quicker to just use that. Finally, if those two weren't enough, here's a simulation screenshot showing that it is definitely 5V. Your answer source is wrong. Good work to you for getting the answer right but :)
H: Op-amp voltage boost circuit : how does it work? I want to boost the output voltage of op amp to a higher value. I found the conceptual circuit below online. I understand that Q1 and Q2 are used to provide the necessary supply voltage for the op-amp. link : https://www.analog.com/media/en/technical-documentation/application-notes/28080533AN106.pdf figure 14 But how do the other parts work ? In particular, the voltage gain is apparently Av=3 (written in the text). How did they arrive at that? Should the (voltage gain)Av not be -33 ? What is the function of R4 and R3? EDIT: In the answer by Photon, it is stated that the gain of the whole circuit is 33 while the gain of the output is 3 . So you can have 2 gains in an op-amp ? So one is the gain of the input to the Vout? and the other is the gain of the op-amp output to the actual Vout?(the second one is bit confusing) AI: About the gain being stated as \$A_V=3\$, the complete relevant text is R3 and R4 form an output voltage gain stage whose gain, \$A_V=3\$, is reduced to unity at high frequencies by C1 to maintain stability. What this is saying is that R3 and R4 form a voltage divider so that $$v_o = \frac{v_{out}}{3}$$ where \$v_{o}\$ is the voltage at the output of the op-amp IC. Or, turned around, $$v_{out} = 3 v_o.$$ This works because the negative feedback around the op-amp will cause it to push or pull current from its output pin to make it work. The overall gain of the circuit is 33, as you calculated. , it is stated that the gain of the whole circuit is 33 while the gain of the output is 3 . So you can have 2 gains in an op-amp ? No, the "stage" formed by R3 and R4, with gain 3 doesn't really involve the op-amp. But even within the op-amp integrated circuit itself, of course every stage in the design can have a different gain value. So one is the gain of the input to the Vout? and the other is the gain of the op-amp output to the actual Vout? 33 is the gain from \$v_{in}\$ to \$v_{out}\$ 3 is the gain from \$v_o\$ to \$v_{out}\$. I think Tim's comment does a better job explaining it than I could: If the voltage on the op-amp output is not equal to 1/3 of the output voltage (ignoring C1), then current will flow in it's positive or negative power pin. That forms a negative feedback loop composed of the four external capacitors and the op-amps (internal) output stage.
H: Calculate the Norton Resistance and Current and the Thevenin Voltage of the following circuit U=10 V, R=10 ohm I calculated the resistance as such: 1/Rt = 1/R + 1/R <=> Rt = R/2 = 5 ohm To calculate the voltage I did KVL as such: U - 2Ur = 0 <=> Ur = 5V, where Ur is the voltage in the resistors And then by applying KVL to the closed network that goes from a to b passing through the resistor, I got Ut=5V Then I calculated the current using U=RI, and I got I=1A. Is this correct? Because in my solutions I=0,5A AI: I answered your last question here. Once again, you have the right answer and your "solution" answer is wrong. You have done the correct method; found the open-circuit terminal voltage, which is the Thevenin voltage. You have then found the Thevenin resistance - also correct. You have then used the transform \$ I_n = V_{th}/R_{th}\$ to find the Norton current, correct again. Good job - wherever you keep getting your solution answers from, stop using it!!!
H: What is the difference between a Sallen-Key Band pass filter and a band pass filter? Am currently doing an assignment on sine wave generation and am using a sallen key band pass filter - i am unsure what the difference between the band pass filter and the sallen-key band pass. AI: There is no such thing as a "normal" bandpass filter - only different topologies. For instance alternative filters might be biquad or multiple feedback. A Sallen-Key is widely used because (unlike the biquad, for instance) you can construct it using a single op-amp. The Sallen-Key is also useful because its design equations are simple. If there is any bandpass which is "normal", in the sense of the most widely used, it's probably the Sallen-Key. A biquad has better sensitivity to component variations and the parameters gain, center frequency and Q are much more independent. That is, it's much easier to adjust a single variable than with a Sallen-Key. It also requires 3 or 4 op-amps to the Sallen-Key's one.
H: Too many vias on ground trace I've got the following layout for 4 layers PCB, I would like to know why there are so many vias on the ground trace. AI: We are clear now that it is microcontroller with two crystal-based clock circuits attached to it. My guess is that signal layer below the top one is ground, and these vias connect the red tracks around the crystals to that layer, I guess "to make better ground". But that may not be the best solution in such circuits. As I said in the comment to the questions the best is to ask developer of the board the following questions: Why did not he consider putting bigger ground polygons at th top layer as it is clear that there're no components around the crystal circuitry? Did he simulate the circuit and perform impedance/EMI check as the generating components are relatively close to each other? Did he consider the negative effects by putting vias creating ground loops? And finally, there must be a clock generation circuit layout guideline in the datasheet or application note of the STM32 microcontroller, which should be followed as much as possible given design contraints. Update: I asked my friend who specializes on the stuff, and his feedback was that actual layout would depend on the frequency, and that ground polygon (instead of separate tracks at the top) would do better job in shielding.
H: Power converters Modelling - NPC versus no NPC I am trying to simulate a three-phase inverter in Matlab/Simulink. So far I figured out that in the Simulink library there are two types of inverters. The first one is illustrated in the figure below and its called "Universal Bridge" The second type of converter is called "Three-level neutral point clamped (NPC) power converter" and you can see it below. The main difference between the two topologies is that in the NPC converter there is one more output at the DC side. I have read that we can use this output to create one more voltage level. Also, the design methodology and the control techniques are pretty much the same. So, I would like to ask if there are any more differences and why should I select the one topology over the other. AI: As the name suggests, an N-level converter can synthesis N-levels of voltage to the load A 2 level can produce 0V and +-Vdc A 3 level can produce 0V, +-0.5Vdc and +-Vdc Why is this important or beneficial? Losses, EMC and breakdown and output quality In the NPC topology each switching device is subjected to half the DC link. This results in half the switching losses (per device). Because only half the DC link is ever switched, the dv/dt is reduced which is a benefit for EMC and long harnesses. Likewise you can construct an inverter that blocks higher potential as each switch only sees a maximum of half DClink (GAN devices are only available in 600V so an NPC inverter can realise a 1200V inverter - NOTE there is an annoying power down case which can result in a switch experiencing FULL DClink) Finally because the output waveform has a total of 5 steps not 3, the synthesised voltage waveform is closer to a true sine wave. If a true sine wave is needed then the needed filtering is not as harsh. Note: there is another topology, T-type which is a 3level.
H: button which wakes up the esp8266 from deep sleep, but can be used as common button The goal is to have a button which wakes up the esp8266 from deep sleep, but can be used as common button while the code is running. This is a follow up of an unsolved Arduino SE question. esp8266 can be wake up from deep sleep by connecting reset pin to ground. For timed deep sleep esp8266 uses io 16 to put reset LOW for wake up, so io 16 must be connected to reset pin for the timed deep sleep to work. io 16 is a logical choice for our button. In this setup the button is connected to io 16 and reset wakes a sleeping esp8266, but resets a runnig esp8266. so we need to disconnect reset pin from io 16 (and button) while the code is running or ensure that reset pin is hold HIGH even if button connects pin 16 to ground. simulate this circuit – Schematic created using CircuitLab (io 16 has no internal pullup, so externall pullup is needed) What circuit is suitable for this? AI: First thing that comes to mind whenever I see a question similar to this is a diode. In this case, a diode you can "enable." Or... a BJT. simulate this circuit – Schematic created using CircuitLab You'd want \$R_2\$ to be 10X the value for \$R_3\$. So, I'd probably recommend \$R_1=R_3=1\:\text{k}\Omega\$ and \$R_2=10\:\text{k}\Omega\$, as an initial guess of values to consider (or try.) Set IO X to active-LO when you want to disable the RST being controlled by the switch. Processors come out of reset with their IO pins as high impedance inputs. So, in the case where you haven't yet had time to configure IO X, because you just came out of RESET, the switch will still reset the processor. Once you have time to set up IO X's activity, you can make sure that it is set to either of these: RST disabled: Configure IO X as an output programmed for active-LO. RST enabled: Configure IO X as an input or else very weak active-HI output (if that's possible on your processor.) This allows you to control the activity of the switch and disable it's RST functionality when you are up and running and want it disabled. Regardless, the IO 16 behavior remains unaffected. Here's a simulation of the circuit: I won't vouch for the great colors here. But it gets the point across, I think. The bottom trace (dark blue) is the activity of the switch itself. It is HI when the switch is actively being pressed. It is LO when the switch is released. (This is a control line I'm using for the Spice simulation only. So keep that in mind when interpreting it.) The next trace up (magenta?) is the behavior of the IO 16 line. As you can see, it responds directly and always to the bottom trace's condition. It's never blocked or inhibited. It simply follows the behavior of the switch itself. The next trace up (red) represents your control line, IO X. It is HI for case #1 above and LO for case #2 above. The LO condition represents the case where RST is enabled. The HI condition represents the case where RST is disabled. (If you look at the schematic, I've added a \$100\:\Omega\$ resistor in order to represent the typical output impedance of an IO pin, when LO.) The top trace (green) represents the activity of the RST line in response to the traces below it. As you can see, it is only actively enabled to respond to the state of the switch when a specific set of conditions occur, as I believe you want here.
H: Difference between these RF adapters Can someone explain me the differences between these two RF adapters. I know the one on the right is better (and much more expensive as well) but is there a difference in the functioning of these adapters ? Thanks a lot. AI: This: is a simple BNC splitter, it has no real circuit inside, all ground/shields are directly connected and so are the signal pins. There is only a straight wire between all pins. This BNC splitter is only suitable for low frequency applications like distributing a 10 MHz reference clock to all your measurement equipment. Or for connecting low frequency signals from a waveform generator to an oscilloscope. If you use this BNC splitter for signals above 100 MHz or so, you can expect issues like reflections that will distort your signals. At low frequencies this is less of an issue and at DC it is no issue at all. The other device is a proper RF power splitter/combiner, inside it might look similar to these splitter/combiners: Fancy model, note that the lid has been removed: or this poor man's model, just a PCB with connectors: Oh, but there I only see (PCB) traces ! It is also a straight connection! Yes but no, note the shape of the traces, these are designed such that RF signals of certain frequencies (see the datasheet) are properly divided / combined between all inputs and outputs. This device can split one signal into two signal with a smaller power. This device can also combine two signal into one signal with the combined power of the input signals. This device only works properly if all ports are properly terminated with the right characteristic impedance (usually that will be 50 ohms). You would normally only use such an RF splitter / combiner with RF equipment that already has the proper input and output impedance. The ZFRSC-42 you show a picture of is actually simpler than the splitter/combiners I show above, the ZFRSC-42 is a resistive version and probably has a circuit like: That is simpler than the "special traces" shown above but means some power is lost in the resistors. The advantage is that the usable frequency range can be larger than those shown above.
H: Can I solve this relay output issue by using a resistor? For an enclosure, I will control the power at the terminals of a panel mount AC socket by using an SSR. The AC mains socket will have this indicator lamp in parallel to indicate whether the socket is live/powered. The indicator lamp according to the datasheet draws only 3mA current at 230V AC. Below is the diagram of the system: As shown above the system worked but the lamp was extremely dimmed when the relay was ON. Then I connected a voltmeter across it(across A and B) and nothing changed. Except I saw 230V AC even relay is OFF due to capacitive coupling. But when I set the voltmeter to low impedance setting, the indicator started to glow as it supposed to. And the fake ghost voltage at OFF times also disappeared. So I went back to the SSR’s datasheet and at its output characteristics it says “Min. Load current to maintain on: 50mA” My conclusion was the problem is: if the load draws less than 50mA I will have problem; either with the indicator lamp or any such weak load. To solve this issue can I connect a resistor across the node A and B in my diagram which draws 50mA current. To make sure the weak loads like the lamp would work fine when the SSR is ON. If I use a resistor across A and B for 50mA the minimum resistor becomes 1000*(230/50) around 47k. And power for such resistor is 1.25 Watt. I never used a resistor for such purpose for AC power application. Can any 3W 47k resistor be used? Do I need any heatsink? The relay might be ON more than six months. Can this be a solution or what else can be done? edit: AI: The problem with the light being on is not the minimum current, it's the "leakage current" caused by the snubber network (a resistor in series with a capacitor) in the SSR. That is 10mA according to the datasheet, implying an impedance of about 23K assuming they are using 230VAC as the test voltage. Your solution idea is sound, however the numbers may be off. There is no "guaranteed off" voltage specified for the lamp, but if we assume 10% voltage make it dim enough you would need to use a resistor that would draw around 100mA when the output is on, wasting 23 watts. That seems pretty wasteful to me. Maybe if it only rarely switches on for a brief time it might be acceptable but usually not (and your case of it being almost continuously on is such a case). You could buy a 50W chassis mount resistor (eg. Dale) but the wastefulness is not very elegant. On the other hand, if the lamp inside circuit is as I suspect the actual 'leakage' into a diode load may be much less than 10mA, so a higher value resistor may suffice, you would have to test that. You might want to try a 47K resistor to see if it will work. The 5 or 10W wirewound "cement" type is suitable and does not require an external heatsink. Another suggestion would be to use an indicator that would be driven by the input voltage to the SSR if possible (the one you have is not compatible with the low DC input voltage). Alternatively you could use a capacitor that is rated for cross line voltage in series with a wirewound resistor instead of the resistor. That would draw current without wasting much power. The capacitor would be physically large, like a motor run capacitor, maybe a few uF in series with 100 ohms.
H: Why does capacitor never fully discharge in this circuit? I've found in the following circuit, when the value of RPD is very high (say 10MΩ), sometimes the capacitor actually never fully discharges and the mosfet stays partially on. The LED dims but never completely turns off. For lower values of that resistor (say 100kΩ) it fades off completely as expected. What's going on here? AI: There is some leakage from the channel of the FET to the gate: There might be additional leakage across the PCB itself, especially if you used a no-clean process, or left some flux residue on the board after hand soldering. With 100 nA leakage, through a 10 megohm drain resistor, there could be up to 1 V on the gate. This is more than the 0.8 V minimum for the gate threshold voltage, so it's not surprising the FET channel remains at least somewhat conductive.
H: how to wire together multiple photoresistors to make one big sensor? I'm using an esp32 dev board, and a bunch of 5v laser diode emitters pointed an equal number of photocell resistors across a plane. The goal is only to detect when any two or more beams break at the same time. I could try to wire up one resistor per pin (the 32 has 18 analog pins), which I know enough to do on my own, but that feels stupid. I feel like there is a smarter way to just wire up the photocells so that any simultaneous break of two or more beams will result in a net change that is big enough for me to read on one pin. To be clear, I don't care when 0 or 1 beam breaks, only 2 or more. Is there a way for me to wire together the photocells (series? parallel?) so that I can then test what 0 breaks reads at, what 1 reads at, and then act on 'whatever 2 or more breaks' reads at? What would that circuit look like? AI: I would take the following approach: Measure the resistance of one device with laser absent and laser present. You will have two readings. Mathematically model the circuit with all photo-resistors lit and then with two dark. See if you think you can create a potential divider that will allow you to reliably detect the difference in voltage between those two states. Post your readings and calculations in your question if you get stuck. You will improve the rejection of ambient light if you add filters to the sensors. The filters should pass the laser wavelength - typically red - and block others.
H: Why is the usb shield always tied to ground (GND pin)? The shielding on a cable is to avoid interference from the outside world however it is always tied directly to the GND pin. Not inside the cable itself but inside a device. Every single device I take a look at, will do this, computer/hubs, usb soundcards, usb bluetooth dongles, usb powerbanks, usb harddrives, arduino's etc. In my perspective this make no sense at all because the shielding is now acting like a big attenna instead of a faraday cage, or am I wrong? I think this a source of noise and/or ground loop problems. What is de reason why they doing this? Example, when measuring resistance between shield and GND pin, it reads 0 ohm: AI: This question has been discussed over many entries on SE EE and elsewhere. See USB Shield. To ground or not to ground? How to connect USB Connector shield? USB 3.0 Hub shield connection Does an overvoltage TVS for USB hot-plugging connect to shield ground? and most elaborate answer is provided here, Structure of a usb 2.0 connector [duplicate] It explains that the shiled serves two contradictory functions, (1) provides the path for ESD discharge, and (2) shields EMI from noise of internal digital ground. So the trade-offs must be made, depending on particular shape of USB device - handheld, grounded enclosure, etc.
H: how to reduce current to power LEDs I am replacing a microscope lamp with a motorcycle LED headlight. The light is 20W, 9-85V DC; the driver built in and a complete black box to me. I power it with a 65W power supply (18.5V/3.5A). For as long as I have tested it (short), this seems to work well. Now the original housing had a potentiometer to adjust the brightness of the lamp. Naively, I soldered that in serie with the headlight. For as long as it lasted it worked functionally well to reduce the light, but of course, within a minute, smoke, smell, and the potmeter even emitted red light (it had to endure 20W). If I understand it well now, I am to reduce the output power fed to the light. Similar questions here suggest a FET is the way to go. What type of FET should I select here (and why?). I sketch below how I understand it now: simulate this circuit – Schematic created using CircuitLab Is this the idea? It doesn't need to be very precise as it is only a light dimmer. AI: LEDs need to be driven with a constant current source to be able to regulate the brightness without flicker (automotive LEDs are PWM'd fully on/fully off, and it surprises me that there doesn't seem to be any regulation about flicker, I find it annoying). Since any linear circuit is going to dissipate the 'unwanted' power from the supply, you'll need either 1 - a large variable resistor/rheostat. These things are fairly pricey as well as getting hot. a linear regulator circuit. There's many ways to drive a transistor or FET as a constant current source or sink, here's one from a TI app note - ratings of components aren't selected for this particular application. The output device will again be dissipating a fair amount of heat, so it'd need to be heatsinked well. There are buck regulators that can operate in constant current mode, and at frequencies high enough that the any flicker that there is from ripple in the current is not noticeable on even photography. Here's a possible arrangement from here This approach has the advantage that the efficiency is high, so there'll be little heat to dissipate. One thought - is there any existing regulator included with the LED you are using? That voltage range, aside from sounding odd for an automotive product, wouldn't be achievable without some regulator.
H: stall dc motor 12 volt for long time hi every one i make water cooling system for dc motor 12 volt how can i make the dc motor hot to test the system ? whan i stall the dc motor the wires get very hot before that effect the motor and i tried to connected with riss 2 ohms and 1 ohm and the same problem . here the part i used i am mechanical student riss ohm dc motor 12 v AI: When the motor is stalled, the current is the applied voltage divided by the resistance of the armature winding. If the stall current is 23 amps with 12 volts applied, the resistance is 12/23 = 0.52 ohms. If you put 1 ohm in series, the stall current will be 12/1.52 = 7.9 amps. If you want the stall current to be equal to the 0.14 amps rated current of the motor, the armature plus series resistance must be 12/0.14 = 85.7 ohms. If you don't want to buy or build a variable-voltage power supply, you can use resistors to have any stall current you want using the calculations described. Remember the power dissipated in the resistor will be the current squared multiplied by the resistance. The same is true of the power dissipated in the resistance of the armature winding.
H: Parts inside a LCD 16x02 This picture is from an application note from Microchip about LCDs. I just disassembled a common 16x02 LCD and I want to identify the components shown in the Microchip's figure with the ones from my LCD. Can you help me to figure out how it works ? Thank you. AI: Your one has a backlight, unlike the reflective or transmissive type shown in the Microchip data. The white and transparent plastic bits are diffusers for the backlight LEDs. All the rest is bonded together in the glass part to the left. There are no pins on your display, the connections to the Indium-tin-oxide (ITO) terminals on the glass are made with little elastomer strips that have alternating conductive and insulating layers. Presumably out of the photo.
H: op amp compensation with C or RC In reading about op-amp compensation I came across two variants of compensation. Sometimes the compensation is done with a simple capacitor. And sometimes a rc as shown in the figure below (r1 and C1). So, the capacitor is used to roll off the frequency response for stability reasons. What effect could the resistor in series have? To me the resistor seems rather useless. AI: A single capacitor is often used to provide dominant pole compensation. This pole ensures that the open loop gain falls away with a phase shift of less than 180 degrees at the point where the loop gain is unity. The resistor results in a zero in the open loop response, which can still ensure stability while offering a wider bandwidth. The zero can effectively cancel a pole.
H: BJTs to drive N-Fet I stopped using BJTs for a while and now I can't figure out why this configuration does not give me a 12 V PWM at the gate of the MOSFET? I am only getting slightly more than my PWM voltage about 4.2 V. I have tried resistors at the gate to limit current and different resistors at the PWM for some input impedance but nothing. If I am not mistaken, when the top transistor is on it should effectively close that "switch" and I should get my 12 V at the gate. Maybe I've spent too much time playing with MOSFETs and I have forgotten how BJTs work. simulate this circuit – Schematic created using CircuitLab AI: Your BJTs are configured as followers so the gate signal will be smaller than the drive by a diode drop each way. Perhaps add a common emitter amplifier between the drive signal and Q1/Q2 to boost the amplitude to near 12 V peak to peak.
H: 4.5µA Li-Ion Battery Protection Circuit I tried to simulate the circuit given in your design note "https://www.analog.com/en/technical-articles/battery-protection-circuit.html" According to the designer, the cut off voltage is 3V but the circuit is not going to cut off when the i/p is below 3V also. Please see the attached simulation result. Could you please help me how to solve this issue? AI: The problems with this simulations are: The circuit has no load. Use something reasonable, like 100 ohms. The PFET looks wrong, try something like FDS4465. Not sure what the V/V chart mean, I just applied a variable voltage V1.
H: What could cause the mosfet to burn out in my motor driver? Here's the schematic: I've tried to make this motor driver as tough as possible, but I'm still seeing occasional failures where the MOSFET and the diode D1 are both failed short. Any ideas what could be causing this? Also is there anything I can do to make this driver even tougher? Additional info: The motor is speed controlled by a microcontroller. The PWM duty cycle is capped around 60%. The motor can draw about 5A or more depending on the load, but this whole thing is powered by a switching power supply rated for 3.75A with a (fast) over-current shutoff, so that should limit the current in cases with excessive load. PWM frequency is approx 700hz. I don't know what's burning out first, the mosfet or the diode. I tried replacing the diode (before I knew that the mosfet was also burned), and it burned out again after I toggled the interlock a few times. AI: Maybe your circuit stresses the MOSFET during switching. I could see two possible problems. First, you placed a 100nF capacitor across the freewheeling diode. When the MOS is turned on, it has to dissipate an amount of energy equal to $$ \frac{1}{2} C_5 (24)^2 $$ plus the energy due to the recovery charge of the diode. To avoid this, you should have inserted an inductor in series between the diode and C5. Then, the inductance of the loop constituted by the MOS, D1 and the decoupling capacitor C6 should be kept as low as possible, to limit overvoltages across the MOS during turn off. I'm afraid it is not the case in your design, because this loop also includes a switch, and possibly the wires between this switch and the PCB. I would have put the interlock AFTER diode D1. Edit: these are the changes I would advise : simulate this circuit – Schematic created using CircuitLab
H: No current through AC optocoupler I am just testing this component MOC3021 optoisolator, its datasheet can be found here. This is my circuit in Proteus: Please forgive me for my ignorance of electronics, I have my background in computer science. I tried the whole day yesterday trying to make out what's written about it in the datasheet, the point of connections was easy to understand, rest I don't know much. However, I did learn a lot and welcome to accept more. However as you can see the LED didn't glow, now for one thing I know it's an AC optoisolator but shouldn't current flow from one of the diodes of the DIAC? Thanks a lot :) Update : Problem Solved Thanks a lot, all of you it's a great community here ( especially for noobs like me ). This is the final working circuit. P.S. All answers were correct but I could only choose one, sorry others :| AI: You've got three problems. 1: no current limit on the MOC3021 LED. With 5V there the LED inside the MOC3021 will not last long, so add 220 ohms in series with the input. 2: not enough voltage on the output. The output is is a phototriac which has a forwards voltage drop of 1 to 1.5V - to light the blue LED you want 3V or so and a resistor to limit current, 9V with a 470 ohm resistor in series would be a good starting point. 3: the output is a triac: once triggered on, it will continue to conduct until something else stops the current - using an AC supply to power the output side circuit would help here.
H: STM32CubeMX/STM32L0 UART Transmit unknown symbols I am trying to connect UART communication with STM32L053C8-Discovery. But the problem is on terminal I get unknown symbols. My Setup on CubeMX /* USER CODE BEGIN Includes */ uint8_t tx_buff[]={1}; uint8_t rx_buff[10]; while (1) { HAL_GPIO_TogglePin(GPIOA, GPIO_PIN_5); HAL_UART_Transmit_DMA(&huart1,tx_buff,sizeof(tx_buff));// Sending in DMA mode HAL_Delay(1000); } To RX,TX pins I connected FT232RL FTDI module. With Arduino it works but with STM32 in terminal I get only symbols. Maybe someone could explain me how to correctly set the format? Also there is a full code of main.c: https://pastebin.com/kST92XWZ AI: Baud rate mismatch. Baud rate is set to 9600 baud on the screenshots, but it's 9800 in the linked code. huart1.Init.BaudRate = 9800;
H: Adafruit Pt100 temperature sensor I want to connect 3 wire pt100 sensor with arduino uno, without using any amplifier or op-amp. What could be the circuit of the same? AI: simulate this circuit – Schematic created using CircuitLab You can connect it like that. It will not exceed the 1.0mA current recommended for a Pt100 element. The resolution will be about 15°C, which is useless for most applications but it meets your requested limitations and does respond to temperature, after a fashion. If you abuse the element by reducing R1 to 499 ohms (10x the maximum current and thus 100x the recommended dissipation) you'll get about 2°C resolution but a lot of self-heating (read your sensor datasheet to calculate how much at whatever temperature) and dubious reliability. Perhaps you can see why basically nobody does anything like this. There are microcontrollers that can work well with small signals but the Arduino does not contain one. If you switched the 5V to a 499R resistor with a small MOSFET (p-channel) and operated at a very low duty cycle you could probably get this to work with reasonable results, but an op-amp would be a much more sensible answer.
H: Can I use these normal IR Photo-Diodes for long range laser communications? This is my first time working with lasers, I made a data transmission system with a laser using normal components, and now I would like to change It to a very long range system (~2-3 KM). My question is, would I be able to use these cheap IR photodiodes: Link if I use a very powerful laser Such as > 5-watt laser? If not do you have any recommendations for a photodiode for the range I specified? AI: So I can't find the data sheet for the diode in question but I have approximated with a similar diode The current though the diode is proportional to the intensity of the light on the diode. in your case we have a 808nm laser, lets round that to 800nm for simplicity. For your requirement there are a lot of variables to take into account such as environmental factors, background radiation etc. The peak response from the diode is at 940nm where we have an intensity of roughly 1W/m^2 so roughly 0.0001 W/cm^2 or 0.1mW/cm^2 so we can assume that the response from the diode is 0. Here is the relevant graphs from the data sheet: From our data sheet we can see that peak response is at 940nm so your 800nm laser will have a relative intensity of about 0.3 (quite low, I would suggest getting closer to that 940nm mark) lets say we are converting current to voltage with a resistor and op-amp. set our logic threshold to everything above 1V is logical 1, everything below 1 is logical 0. lets say that our system turns 50uA of current though the diode into 1V output with a simple resistor and op-amp with a gain of 20000. This means that the diode will need to receive 1.1mW/cm^2 of 940nm light, but will need 3.67mW/cm^2 from your 800nm laser. lets say that you're going to be transmitting in clear conditions over 2km with negligible weather conditions (you're traveling down the rabbit hole of optical comms, SNR and environmental effects) but lets assume that your laser pulse is 50% as intense when it arrives so you're going to need at least a 7.4mW laser. I feel I have approximated too broadly there and the actual required power is going to be possibly orders of magnitude higher, but the premise is the same. you will need to take that 3.7mW received power and work backwards taking into account how the light diffuses and spreads as it travels and what the effects the environment will have on the light pulse. Maybe other commenters can expand on these effects. I don't know much about optical comms, but I'm assuming that real laser or optical communication systems are finely tuned to specific frequencies so finding a diode with a narrow response and a laser with a tightly matching wavelength will be very important for signal integrity.
H: Are three-phase contactors rated per pole or in total? Are three-phase contactors rated per pole or in total? For example, have a look at this datasheet for a random three-phase contactor: datasheet In the datasheet it says that for AC-3 loads (1) the rated operational current [Ie] is 32 A, and (2) the motor power rating is 7.5 kW at 220..230 V. These numbers match, since 32 A * 230 V = 7360 W. On the Technical FAQ pages of this manufacturer it says: "Contactor current ratings are per pole. For example a contactor rated 40 amps AC3 could switch upto 40 amps AC3 on just one pole or on all the other poles." (see source) What I'm confused about is that motor power rating is usually not declared per pole, but in total. So if I use 10 kW contactor for a 10 kW motor, my contactor if oversized by a factor of 3. Is this correct, or I'm missing something? AI: I think the calculation is not that easy because: the power rating for (industrial) motors is not given for the input (electrical) power but for the output (mechanical) one. If you want the electrical power, you have to consider the efficiency ; you have also to deal with the power factor which is not equal to 1. I think the powers that are given in the datasheet you write about is the one you can find for standard motors. For example, here is a list of AC 3 phase motors from Emerson/Leroy-Somer: For example, a 4kW motor at 415V (voltage difference between two phases) 50Hz has a rated current of 8.2A and a power factor of 0.81. We could calculate its efficiency: $$ \eta = \frac{4000} {\sqrt{3} \times 415 \times 8.2 \times 0.81} = 0.84$$ Now, if we take the datasheet for contactors from Schneider (TeSys Green) (I think this is approximately the same products you gave the datasheet): We can see that for a 4kW/415V motor, we have a 9A current. This is just above the 8.2A of the aforementioned motor. Also, when you read motor datasheets, you will see that standard output powers are the same given in your document: 7.5kW 15kW 18.5kW...
H: MOSFET Circuits: Which value of \$ V_S \$ should I choose? 1)\$ V_S \$ potentially has two values. Which value of \$ V_S \$ should I choose? 2) Why? 3) What should I generalize from here about value of \$ V_S \$ that should be chosen while solving such problems? AI: You made the assumption Assuming saturation region operation Which is an entirely reasonable assumption. You need to validate that your assumption was correct, and eliminate "impossible" answers. Going by the requirements for saturation, you need Vgs > Vt, and Vgs-Vt =< Vds. You'll find that one of the answers does not satisfy both conditions for saturation.
H: Question on PID for speed control of DC motor in treadmill application In treadmill applications with DC motor, you can't go from 0.5 mph to 1 mph instantly. The speed should be gradually increasing. If I want to design a PID for speed control, my setpoint should be a ramp instead of steps, right? Or, I can give the setpoint in steps and the P gain adjust the time response of the system? Which one is the right approach? I think that once the final setpoint is reached as ramp, the PID controller should compensate the output for changes in the load. My feedback is a speed sensor that will tell the controller the actual speed. If I said my setpoint is 0.5 mph, the PID doesn't care if gave the setpoint as a ramp or step. Am I right? AI: Correct. If you use a PID controller with fixed gains and you ramp the command to it, then the loop characteristics will always be the same, and you'll attain your goal of ramping the speed up and down in a way that neither burns up the motor or trips the person on the treadmill.
H: Why isn't Nyquist taught like this? When I learnt how to do a Nyquist plot I was taught a really long-winded method that I don't understand to this day. I realised by myself that if you are given a system like below where \$s=j\omega\$ $$\frac{s+1}{s+10}$$ you can just replace \$s\$ with \$j\omega\$ and put in several values of \$\omega\$ and plot these outputs on the real-imaginary axis. Is there a problem doing it this way because I cannot understand why it would not be taught like this if it is this easy? AI: There is no problem with the method you propose. It's the one I've used for years designing real systems. You were probably taught a graphical method (I'm curious as to what it is -- do you have a link?). The graphical methods were invented before digital computers, or even calculators, were ubiquitous, and were designed to make it easy for an engineer with pencil, paper, a ruler, and a slide rule to make the graphs needed to get the job done.
H: Precision Full-Wave Peak Detector component values so, I am a beginner in electronics...hoping to find some help... here I've found a circuit that I want to use from LM 3915 datasheet..... but the problem is I don't have 0.2 and 0.47 Capacitors... capacitors that I have are 1UF 2.2UF 3.3UF 4.7UF 10UF 22UF 33UF 47UF 100UF 220U... if I want to change c1 and c2 with capacitors that I have, which resistors should I change the value so it would reach max capability of this circuit? and I was hoping You guys can recommend best value of c1 and c2 for me based on capacitors on my possession... Thank You for helping me... I want to make 4 channel vu meter... AI: With the capacitors available, you can produce a value of \$C_1 = 0.2 \, \mu F \$ by connecting 5 capacitors of \$ 1 \, \mu F \$ in series. If they have a polarity then it's advisable to alternate those. For \$C_2\$ you can put 2 of \$ 1 \, \mu F \$ in series. Again, if they have a polarity, connected their negative terminals together. Anyway, for \$ C_1 \$ it won't hurt to take just 1 piece of \$ 1 \, \mu F \$ instead of \$ 0.2 \, \mu F \$. I would stick to the value of \$ C_2 \$ however, as it forms a low-pass filter in combination with \$ R_6 \$. If on the other hand you insist in using only 1 capacitor, you could change \$ C_2 \$ into \$ 1 \, \mu F \$ while halving \$ R_6 \$ into \$ 500 \, \Omega \$ in order to preserve the value of the existing time constant.
H: Charge Pump Circuit explaination I am trying to understand a charge pump circuit here but one part has me scratching my head and this sort of scenario happens a lot with me in electronics. It’s a question of what happened first?? If you look at the image below: I understand the left image where the capacitor is basically in parallel with Vs and GND so this configuration is charging it up to VS . In the next drawing, If I understand correctly, the Capacitor is connected in series with VS thus giving you 2VS. Then, because VS goes through the mosfets Drain -> Source thus connecting VS to what was previously the GND node of the capacitor How did the mosfet turn on to let that through? It seems like to get 2VS the mosfet has to have BEEN on, So basically a catch22 , which happened first? I don’t understand. I think an answer might be if you switch S1 to off position first, that way the gate is not grounded and the source is still at ground and then the cap begins to charge the gate and once the mosfet is on then you flip S2 off and it works as described to give you 2VS ??? Any insight would be much appreciated. Thanks. AI: Similar circuits are used to make a charge pumps (switching with capacitors) to give you more than what your voltage rail can provide. Some DC-DC converters use circuits similar to this to boost the voltage rail for driving N-ch mosfets. With N-ch mosfets the gate voltage needs to be more than the source voltage (Vgs) for the mosfet to be able to turn on. The cool thing about mosfets is the gate needs a voltage (it's a capacitor) so the current is mimimal to get the mosfet to turn on. In this circuit the switches are driven external to the circuit, so you would need additional circuitry to drive the switches. The switches all switch at the same time. How did the mosfet turn on to let that through? The switches turn off and then the capacitor starts to charge the gate (remember the gate voltage would start to charge at Vs and V source of the mosfet would be 0V, so Vgs would still be enough to turn the mosfet on). As the mosfet turns on, the capacitors negative terminal is always higher than the source of the mosfet, so the mosfet will always be on.
H: NMOS/PMOS Characterization I have some questions regarding NMOS/PMOS characterization. I'm designing a common source amplifier using gm/Id method and since it requires characterization, I did so but using minimum lengths and widths for NMOS and PMOS (90 nm for all lengths and widths). My question is, is this okay? Are there no restrictions to lengths or widths when characterization? Also, an assumption was mentioned here that width of PMOS is thrice of NMOS. Is this applicable all the time and should this be followed always? Because my final width and length values do not follow this trend and yet it can achieve the desired specs. AI: Always use the same transistor width and length what you would like to use in your circuit. If you do not know yet, start with your best guess. Using minimum length will reduce your threshold voltage. But also would a minimum width on an STI process. Once you have a fairly high channel length, it will not vary any more. Unless you design an RF circuit, it is better to use longer channels than the minimum to reduce noise and mismatch. Layout dependent effects could have an impact on your design, but I guess by default the model assumes that you have enough dummies. So I would not worry about that.
H: Altium PCB Layout How can I make a single via or a hole with different sizes at different layers? for example, I have a 4 layer board and I Need 4mm hole size from layer 1 to layer 2 and 3.5mm size from layer 2 to layer 4. Thanks in Advance. AI: You can do that by placing two different vias on top of each other and adjusting the start and stop layer. Just be careful about how you're going to communicate this to your manufacturer. NOTE: It looks wrong in 3D viewer, but the gerber data is correct.
H: How to check integrity of stepper motor I have two stepper motors in parallel on my 3d printer Z axis. The type of motor is Wantal 2,5A 1,8 deg/step and they are both driven by a Polou driver type A4988. Since I suspected that the Z axis was loosing steps during printing, I swapped the driver around with the X axis where, while printing, it is much easier to see if steps are loosen, simply looking at the result of the printing while progressing. I detected that the driver on the X axis (ex Z) was the problem because visibly losses steps (the printing was moving away from the original position). Now that I have found out that the problem is the driver I also experienced that the one from X now on Z has been damaged. I think I have a problem on one of the motors on the Z that damage the driver. How do I check such motors to make sure they are fine without incurring the risk to damage additional drivers? AI: Start by checking the stepper coils for shorts. If the motors are of same type, all coils should have pretty much the same resistance. If one coil is shorted (or with very low resistance), for example, then this could possibly fry the driver as well. Spec sheet says coils should be 1.25Ω, if it is less than that, that could be the problem.
H: Two voltage internal power plane I have a board with a mix of voltages. It wound up being one voltage to one side of the board, and one to the other. I'd like to make this board 4 layers instead of the original 2. Is there any reason I shouldn't split the internal +ve voltage plane into two? A 3.3 VDC on the left and a 12 VDC on the right on a single internal layer? I'd keep a single ground layer for all. I don't immediately see an issue with this and it would save cost from needing 5+ layers. AI: I had some experience with multi-voltage boards (design that for whatever reason need different voltages for different parts of the circuit). I learned the hardway that multiple voltages can be treated the same way you treat different ground signals (for example analog and digital ground). That is, you dedicate different parts of your board to different "functionalities". Therefore, if your design permits it, put all 5V components on one part of the board, an all 12V components on another part. That way you can have both voltage planes coexist in the same layer of your PCB, as they would not overlap.
H: Altium PCB Layout : Rectanguler Vias in Altium Can we design a rectangular via ? Thanks in Advance. AI: No, but you can design a (nearly) rectangular board cut-out. Simply draw the internal cut-out when you are drawing your board outline, then use "Board Shape -> Define from selected objects" to create the board shape with an internal cut-out. Be aware that the cut-out will be made with a router tool, so you should allow for a non-zero radius (.0465 inches radius is a common size --- consult your fab shop if you want a smaller size) on the inner corners of any cut-out. If you want to make a cut-out only partially through the board, that's also possible, but you'll need to shop around for a fab shop that will do it, and consider their capabilities carefully. You'll need to allow for Non-zero inner radius on the cut-out outline Non-zero tolerance on the cut-out dimensions Non-zero tolerance on the cut-out depth You'll communicate your design to the shop with an additional drawing made on a mechanical layer, or with a detail on your fabrication drawing. In Altium, this is often made on the "Drill Drawing" layer. Be sure to provide all the dimensions of the cut-out, along with tolerances in this drawing or detail. The shop that is able to do this type of design is probably not the lowest-cost shop in the world (or in your market).
H: Execution inside a process [VHDL] I have, for example, this code snippet: p1 : process (clk) begin if (a = '1') then a <= 0; end if; if (b = '1') then b <= 0; end if; end process p1; Which if-sentece is executed first? a or b? I know that process is a concurrent statement but I don't know if within a process the execution is secuential or concurrent. Thanks! AI: This code does not describe a state machine, so the concepts of sequential statements or program execution don't apply here. The correct answer to your question is "無." The sequential execution of a process will create a state machine only if there are wait statements, which are not allowed in processes with sensitivity lists. The order of statements is relevant for resolving signal assignments (last assignment to a signal wins), and for conditions based on variables (where assignments are visible to the following statements in the same process). The two conditional statements only depend on signal values, only modify signal values and have no interdependencies, so their effects are concurrent even though they are technically part of a sequence. If you synthesize this design, you end up with completely independent circuits. In a bigger scope, the entire process is optimized out, as there is only a single place driving a and b, and the only value ever assigned is 0. You cannot have other concurrent statements or processes drive a and b either, as that would cause a conflict.