text
stringlengths
83
79.5k
H: Step down transformer without coil? Isn't it possible today to make a down-transformer without coils, without the idea of induction? After all, the AC reaches every voltage in-between, so all we have to do is keep cutting the power flow and only letting current pass when the wave is at the desired voltage. Of course, this will be a series of pulses but it can be smoothed out with capacitors. AI: All of the methods involving motor/generators or cycloconverters are still going to have coils and induction, so do not fit the OPs desired solution. But as alluded to, it can be done electronically with high speed solid state switches, as long as you only want to REDUCE the AC voltage. Do a search on "Phase Angle Voltage Control" for details that are too long to post here. But in a nutshell, that's exactly what it does, delays the firing of a thyristor (SCR) so that only a portion of each sine wave gets through and results in a lowering of the RMS voltage. The main difference however is this; in an electronic voltage controller, the CURRENT on the output will be the SAME as the current on the input, just at a lower voltage, so the POWER is LOWER. With a transformer, the current on one side it DIFFERENT from the current on the other side by the ratio of the windings (inverse of the voltage change), so the POWER is the SAME . There are losses involved in both methods, so for simplicity, call them the same. The capacitor method, also called a "voltage doubler" circuit works too, but only if the desired output is DC, plus becomes incredibly cost prohibitive compared to transformers in higher power levels.
H: Diagram symbol for an inductance with a neodymium magnet as a core I want to know if there is such a symbol (i.e. an electrical diagram symbol for an inductance with a magnet as a core). If such is the case how is it specified the orientation of the poles of the magnet? Thanks in advance AI: Schematics are Logic diagrams and do not indicate the material or all specifications just par numbers . If you wish to convey this information, be creative. or add to the notes. https://conceptdraw.com/a1511c3/preview In any case, you may buy or find library files above for symbols or make your own.
H: How to detect a heat emitting object in a distance from 10 - 50cm? If I have a heat emitting object like a heater, radiator or hot cup of coffee, what sensor can I use to detect it by the fact that it is emitting heat? I have hc-sr04 sensors but they use ultrasound and so are not suited to this. I have found this infrared sensor but I am not sure if it detects heat or just distance. To put context as to what I am asking for, lets say I'm using the hcsr04 as the front eyes of a robot and need something to detect heat from 10cm to 50cm in front of the bot too. Does anyone know what I can use or is the infrared sensors I provided above suitable along with any other type of infrared sensor? AI: Consider that whatever you use for measureing heat, the reading will likely diminish with distance. Thus you should not try to use a heat sensor alone to measure distance (unless the object is of an already-known constant temperature). They make pyroelectric sensors ("non-contact infrared thermometers") for absolute readings. However, I've found that they typically have a wide viewing angle, which can cause trouble when you wish to pin-point heat. The MLX90614 is an example that I think measures with a 45 degree cone. So as the measuring distance increases, the measurement "area" increases. Thus a small, hot object can be "washed-out" by nearby cooler objects. Thus you may need to put "blinders" around it for a more precise measurement, though the blinders will still lower the average reading. See below for a very technical diagram: As Jack Creasey mentioned, pyroelectric sensors (the kind used in motion-detecting PIR (passive Infrared) modules) will detect IR heat. However, the ones Jack posted are for heat differentials, (movement of heat). Each unit actually contains two IR heat sensors inside, right next to eachother, and the unit measures the difference between them. So when there is heat movement, their output changes. However, they are very affordable ($1-3). What's a maker to do? A cheap hack would be to cover one side of a PIR sensor unit's window, so that only one internal sensor can see. This gives a more "absolute" value to the readings. See this blog link on getting absolute values from a PIR sensor. Note that I have personally tried the methods described in that link above for the purposes of measuring body heat. I was not very successful at detecting a person from more than a meter away, and I also noticed that if I held a hot object in front of the sensor, the output would slowly decay back to the baseline over a course of ~30 seconds. Thus pulling the heat source away caused the sensor to report a negative reading until it normalized again. Results will of course depend on the temperature of the object being measured, the object's emissivity, and the sensor model (I tried using the PIR_D202X and the PIS209S.) Oh, and I didn't use a fresnel lens, that could make a difference too. Below is the output of my foiled-PIR sensor test when I waved my hand in front of it (maybe 10 inches above): That data was aquired with no futher hardware or software changes to the signal. There were about 22 levels of quantized output. Notice how the output drops below the baseline immedietly after the heat is removed. To further increase the sensitivity, a reflective dish (perhaps parabolic) would increase the amount of radiation on the sensor. Some IR is lost upon reflection, but smooth metal, even aluminum foil, will reflect a good amount. See below for another state-of-the-art diagram: If you don't need actual temperature readings, and instead just need to detect something above a set temperature, you could try an IR flame detector. These are typically sensitive to IR emitted by CO2 (IR wavelength of 4.4μm). Here is a cheap IR flame sensor. While it's labeled with a range of 760nm~1100nm (0.76μm~1.1μm), the sensitivity is adjustable, and you may be able to tune it to trigger around a certain set temperature. It has both digital and analog output. You would probably need to use the analog output to trigger a digital comparison. IR heat varies in wavelength. I can say that many IR thermal cameras tend to be tuned in the range of 7μm~13μm. This range covers the typical heat emitted from animals and common objects. The MLX90614 sensor from further above is senitive in the 5.5μm~14μm range.
H: Fight inrush current with PTC, good go or not? To power an amplifier, I use a lipo battery 3.7v (4000mah) or two 18650 batteries 3.7v (4000mah) in parallel with a DC/DC boost converter that boost the voltage to 24.2 volts. The circuit performs pretty well. On the load side (output) of the DC/DC converter I use a 25V 4700uF capacitor which introduce a problem, inrush current (when charging) for a second or so when switched on. Not a healthy situation, want to avoid this. I read allot about inrush current and there seem many options to fight against it but it is not clear to me which is the best one. I hope it can be simple as putting one 'simple' component into the circuit without loosing too much effort. The capacitor is really helpfull, especially at high volume with much bass. So I came allong the NTC and PTC thermisistors. The NTC does not fit the situation and could be risky when the device is switched off and on again when the NTC is not cooled down, so it doesn't eliminate the inrush current. The disposed heat (wasted energy) is also something I don't like. The PTC one is the opposite, but how fast is it? Do it really fight inrush current? Because the PTC heats up when there is much current but I suppose it takes some time to heat up (and therefore draw some current) before it enables protection? Before I decide to buy a bunch of these PTC thermisistors, I like to hear/learn/know some advise of you, professionals. Questions I have: Does a PTC avoid inrush current from the start (how accurate)? Does a PTC influence the performance of the capacitor (or the whole achievements of the PSU)? The amperage, is this the maximum current the PTC can handle or is this the maximum amount of current it will use? The next question is, will it help to divide the capacitance into several capacitors with the same amount in parallel to reduce inrush current? Or at least to reduce the time of the inrush current. AI: 1) No, a PTC will not help from the start. You are correct that it takes some time to react to the high current before it will trip or limit current. So it is just a matter of whether it will trip fast enough for your needs. Very short current spikes are often not noticeable. 2) Yes, a PTC does influence the performance somewhat. Since it is in series with the input voltage, and it has some resistance. Whether this resistance will cause a problem depends on many things. Mainly, the allowable voltage drop, the max current, and the resistance of the actual PTC selected. 3) Not clear what amperage you are referring to. Datasheets for PTC's normally have several amperages listed. Dividing the capacitors will not help. It sounds like what is happening is that when there is high demand for current, the power supply is not able to meet the demand, so the regulator output voltage starts to go down. This is what causes the LED's to dim. It may be that you need a power supply with more capacity to avoid this problem rather than using a large capacitor. A lot of audio amplifier designs on the web use a step-down transformer/bridge rectifier/filter capacitor for a power supply. Often this type of supply uses really large capacitors to try to smooth out the 100 or 120 Hz ripple. But your supply, since it is a DC-DC converter probably does not need such a large capacitor. I don't think you should automatically reject the idea of using a smaller capacitor. If your design contains a micro-processor, you can consider using a simple power resistor to limit the inrush current to the capacitor, and use a power MOSFET to bypass the resistor after power on. The microprocessor would turn the MOSFET on during power on (after some delay), and turn it off during power off. If your design does NOT contain a microprocessor, you still might be able to design a simple circuit to turn the MOSFET off until the capacitor voltage reaches over 20V, say. This would eliminate most of the inrush. Someone might be able to give a better answer if you included more information in your question. What is the output power of the AMP? Is it stereo or mono? Does it need to drive a 2 Ohm load? 4 Ohms? 8 Ohms? What is the part number for the capacitor? This could be helpful if someone wants to know the series resistance for some calculation.
H: Op-Amp Voltage Regulator I'm building a linear voltage regulator using the LM 741 (part of school project) but everytime I connect a load than draws more than 1A the output voltage drops down. I'm not sure why this happens and what can I do to solve this ? AI: The TIP31C gain is not very high. In the ST datasheet, some binned parts are guaranteed not to have gain (beta) greater than 50. Other bins are guaranteed not to have gain greater than 24. This means that your 741's output definitely has to produce at least 20 mA, and maybe as much as 42 mA to drive the TIP31 to deliver 1A. This is somewhat mitigated by the fact that the TIP31's beta increases as it heats up, but still you're likely trying to get 10's of mA out of the 741. The 741's short circuit output current is only 25 mA (based on the TI datasheet). And the output voltage range spec implies an output equivalent resistance of about 150 ohms. (Because the typical output swing drops by 1 V when the ouput current is 6.5 mA) So when sourcing 20 mA, the 741 output voltage is likely going to drop by about 3 V, giving a maximum output of about 11 V at this load. Your maximum regulator output is then one Vbe drop lower, or about 10.3 V, lower than the 11 V you were trying to get. So it looks like you were just trying to get a bit too much out of these parts. (Also consider Peter Bennett's comment and double check that your 15 V supply is not sagging with 1 A load)
H: Reflow oven vs even hot plate I've recently been searching for a simple, easy yet cheap way to reflow SMDs on a PCB board as I have never tried it before and always wanted to create a small and compact circuit. I then found a crowd funding campaign (whom I will not currently name because my point isn't to advertise) of a product where instead of a soldering oven, it was a hot plate. However in general, hot plates aren't the best for reflowing as the heating is uneven unlike this one where it claims to have an even heating surface (also because it's quite small). If such product exists being a hot plate that evenly heats up the PCB, how would that be anyway advantageous over a soldering oven? One way I can think of is being able to re-shift the components if they move during the reflow. Any problems or disadvantages? In addition, Is it safe to put components at 219 degrees Celsius when their max storage temperature is 150 degrees celsius? Looking at the reflow process, for 75 seconds, the oven or the PCB reach over the max (and the hot plate crowd funding product follows this exact same profile). And when looking for a PCB, what aspects should I be looking for to ensure it is reflow friendly? I'm guessing most PCBs are designed for this. AI: DISCLAIMER: I have backed the campaign in question, but have no other affiliation with the campaign or its creator. The biggest issue with the r***R, as with all surface reflow tools, is that double-sided loads are essentially impossible to create. Flipping the board over means that it will be held away from the heating surface, resulting in at best uneven heating of the board. A reflow oven uses either infrared radiation or air convection to heat the board instead, which means that suspending the board by its edges does not impede the reflow process (and in some cases may be required), making double-sided loads possible. It also allows for a mixture of SMT and TH devices to be reflowed (insomuch as TH devices can be). The flip side is that with a surface reflow tool heat can be transferred to and from the board much more quickly than via air convection, which allows tighter adherence to JEDEC reflow profiles. In addition, the exposed nature of a surface reflow tool means that not only can parts be manipulated during reflow as you note, but also during rework after the board may have been in service for some time. This of course requires tighter thermal control than has previously been available using more... primitive tools. As for storage, this refers to long-term thermal profiles, a month or longer. The few minutes during reflow or even rework have been factored into the construction of most devices from reputable suppliers.
H: How do you determine the approximate frequency where the magnitude starts decreasing -40dB/dec for complex pole? I am stuck at drawing the approximate Bode plot for the complex pole transfer function as below. Please see the question and problem in the picture. How do you determine the approximate frequency where the magnitude starts decreasing -40dB/dec as the figure? PS: Sorry I made some silly mistake. Actually I want to say that these poles are in the LHS of the complex plane but I got it backward. Please assume that they are in the LHP now and the system is stable. AI: This might help a bit when the damping is low enough to get a resonant peak: - It's based around a low pass filter whose transfer function is this: - This answer might also help and this too.
H: RTC Alarm deepSleep STM32L073RZ I'm trying to configure 2 differents Alarms on my STM32L073RZ to leave the deepSleep mode but unfortunately after the first wakeUp the memory is reset and the second alarm never wakeUp the STM32. My first alarm is 30seconds after the power On of the board and the second 2 minutes after the power on. But actually the card wakeUp every 30 seconds. This is my script (From the STMicroelectronics web site) /* Includes ------------------------------------------------------------------*/ #include "main.h" /* RTC handler declaration */ RTC_HandleTypeDef RTCHandle; /* Buffer used for displaying Time */ uint8_t aShowTime[50] = {0}; static __IO uint32_t TimingDelay; /* Private function prototypes -----------------------------------------------*/ void SystemClock_Config(void); static void SystemPower_Config(void); static void Error_Handler(void); static void RTC_AlarmConfig(void); static void RTC_TimeShow(uint8_t* showtime); /* Private functions ---------------------------------------------------------*/ /** * @brief Main program * @param None * @retval None */ int main(void) { /* STM32L0xx HAL library initialization: - Configure the Flash prefetch, Flash preread and Buffer caches - Systick timer is configured by default as source of time base, but user can eventually implement his proper time base source (a general purpose timer for example or other time source), keeping in mind that Time base duration should be kept 1ms since PPP_TIMEOUT_VALUEs are defined and handled in milliseconds basis. - Low Level Initialization */ HAL_Init(); /* Configure the system clock to 2 MHz */ SystemClock_Config(); /* Configure LED2 */ BSP_LED_Init(LED2); RTCHandle.Instance = RTC; /* Configure RTC prescaler and RTC data registers */ /* RTC configured as follows: - Hour Format = Format 24 - Asynch Prediv = Value according to source clock - Synch Prediv = Value according to source clock - OutPut = Output Disable - OutPutPolarity = High Polarity - OutPutType = Open Drain */ RTCHandle.Init.HourFormat = RTC_HOURFORMAT_24; RTCHandle.Init.AsynchPrediv = RTC_ASYNCH_PREDIV; RTCHandle.Init.SynchPrediv = RTC_SYNCH_PREDIV; RTCHandle.Init.OutPut = RTC_OUTPUT_DISABLE; RTCHandle.Init.OutPutPolarity = RTC_OUTPUT_POLARITY_HIGH; RTCHandle.Init.OutPutType = RTC_OUTPUT_TYPE_OPENDRAIN; if (HAL_RTC_Init(&RTCHandle) != HAL_OK) { /* Initialization Error */ Error_Handler(); } /*##-2- Configure Alarm ####################################################*/ /* Configure RTC Alarm */ RTC_AlarmConfig(); /* Configure the system Power */ SystemPower_Config(); /* Check and handle if the system was resumed from StandBy mode */ if(__HAL_PWR_GET_FLAG(PWR_FLAG_SB) != RESET) { /* Clear Standby flag */ __HAL_PWR_CLEAR_FLAG(PWR_FLAG_SB); } /* Insert 5 seconds delay */ HAL_Delay(5000); /* The Following Wakeup sequence is highly recommended prior to each Standby mode entry mainly when using more than one wakeup source this is to not miss any wakeup event. - Disable all used wakeup sources, - Clear all related wakeup flags, - Re-enable all used wakeup sources, - Enter the Standby mode. */ /* Disable all used wakeup sources*/ HAL_RTCEx_DeactivateWakeUpTimer(&RTCHandle); /* Re-enable all used wakeup sources*/ /* ## Setting the Wake up time ############################################*/ /* RTC Wakeup Interrupt Generation: Wakeup Time Base = (RTC_WAKEUPCLOCK_RTCCLK_DIV /(LSI)) Wakeup Time = Wakeup Time Base * WakeUpCounter = (RTC_WAKEUPCLOCK_RTCCLK_DIV /(LSI)) * WakeUpCounter ==> WakeUpCounter = Wakeup Time / Wakeup Time Base To configure the wake up timer to 4s the WakeUpCounter is set to 0x1FFF: RTC_WAKEUPCLOCK_RTCCLK_DIV = RTCCLK_Div16 = 16 Wakeup Time Base = 16 /(~39.000KHz) = ~0,410 ms Wakeup Time = ~4s = 0,410ms * WakeUpCounter ==> WakeUpCounter = ~4s/0,410ms = 9750 = 0x2616 */ //HAL_RTCEx_SetWakeUpTimer_IT(&RTCHandle, 0x14, RTC_WAKEUPCLOCK_CK_SPRE_16BITS); /* Clear all related wakeup flags */ __HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU); /* Enter the Standby mode */ HAL_PWR_EnterSTANDBYMode(); while (1) { } } /** * @brief System Clock Configuration * The system Clock is configured as follow : * System Clock source = MSI * SYSCLK(Hz) = 2000000 * HCLK(Hz) = 2000000 * AHB Prescaler = 1 * APB1 Prescaler = 1 * APB2 Prescaler = 1 * Flash Latency(WS) = 0 * Main regulator output voltage = Scale3 mode * @retval None */ void SystemClock_Config(void) { RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; RCC_OscInitTypeDef RCC_OscInitStruct = {0}; /* Enable MSI Oscillator */ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_MSI; RCC_OscInitStruct.MSIState = RCC_MSI_ON; RCC_OscInitStruct.MSIClockRange = RCC_MSIRANGE_5; RCC_OscInitStruct.MSICalibrationValue=0x00; RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE; if (HAL_RCC_OscConfig(&RCC_OscInitStruct)!= HAL_OK) { /* Initialization Error */ while(1); } /* Select MSI as system clock source and configure the HCLK, PCLK1 and PCLK2 clocks dividers */ RCC_ClkInitStruct.ClockType = (RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2); RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_MSI; RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1; RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1; if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_0)!= HAL_OK) { /* Initialization Error */ while(1); } /* Enable Power Control clock */ __HAL_RCC_PWR_CLK_ENABLE(); /* The voltage scaling allows optimizing the power consumption when the device is clocked below the maximum system frequency, to update the voltage scaling value regarding system frequency refer to product datasheet. */ __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE3); /* Disable Power Control clock */ __HAL_RCC_PWR_CLK_DISABLE(); } /** * @brief System Power Configuration * The system Power is configured as follow : * + RTC Clocked by LSI * + VREFINT OFF, with fast wakeup enabled * + No IWDG * + Automatic Wakeup using RTC clocked by LSI (after ~4s) * @param None * @retval None */ static void SystemPower_Config(void) { /* Enable Power Control clock */ __HAL_RCC_PWR_CLK_ENABLE(); HAL_PWREx_EnableUltraLowPower(); /* Enable the fast wake up from Ultra low power mode */ HAL_PWREx_EnableFastWakeUp(); /* Configure RTC */ RTCHandle.Instance = RTC; /* Set the RTC time base to 1s */ /* Configure RTC prescaler and RTC data registers as follow: - Hour Format = Format 24 - Asynch Prediv = Value according to source clock - Synch Prediv = Value according to source clock - OutPut = Output Disable - OutPutPolarity = High Polarity - OutPutType = Open Drain */ RTCHandle.Init.HourFormat = RTC_HOURFORMAT_24; RTCHandle.Init.AsynchPrediv = RTC_ASYNCH_PREDIV; RTCHandle.Init.SynchPrediv = RTC_SYNCH_PREDIV; RTCHandle.Init.OutPut = RTC_OUTPUT_DISABLE; RTCHandle.Init.OutPutPolarity = RTC_OUTPUT_POLARITY_HIGH; RTCHandle.Init.OutPutType = RTC_OUTPUT_TYPE_OPENDRAIN; if(HAL_RTC_Init(&RTCHandle) != HAL_OK) { /* Initialization Error */ Error_Handler(); } } /** * @brief This function is executed in case of error occurrence. * @param None * @retval None */ static void Error_Handler(void) { /* Turn on the LED2 */ BSP_LED_On(LED2); while(1) { } } #ifdef USE_FULL_ASSERT /** * @brief Reports the name of the source file and the source line number * where the assert_param error has occurred. * @param file: pointer to the source file name * @param line: assert_param error line source number * @retval None */ void assert_failed(uint8_t *file, uint32_t line) { /* User can add his own implementation to report the file name and line number, ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */ /* Infinite loop */ while (1) { } } #endif /** * @brief Alarm callback * @param hrtc : RTC handle * @retval None */ void HAL_RTC_AlarmAEventCallback(RTC_HandleTypeDef *hrtc) { /* Turn LED2 on: Alarm generation */ BSP_LED_On(LED2); } /** * @brief Configure the current time and date. * @param None * @retval None */ static void RTC_AlarmConfig(void) { RTC_DateTypeDef sdatestructure; RTC_TimeTypeDef stimestructure; RTC_AlarmTypeDef salarmstructure; RTC_AlarmTypeDef salarmstructure2; /*##-1- Configure the Date #################################################*/ /* Set Date: Tuesday February 18th 2014 */ sdatestructure.Year = 0x14; sdatestructure.Month = RTC_MONTH_FEBRUARY; sdatestructure.Date = 0x18; sdatestructure.WeekDay = RTC_WEEKDAY_TUESDAY; if(HAL_RTC_SetDate(&RTCHandle,&sdatestructure,RTC_FORMAT_BCD) != HAL_OK) { /* Initialization Error */ Error_Handler(); } /*##-2- Configure the Time #################################################*/ /* Set Time: 02:20:00 */ stimestructure.Hours = 0x02; stimestructure.Minutes = 0x20; stimestructure.Seconds = 0x00; stimestructure.TimeFormat = RTC_HOURFORMAT12_AM; stimestructure.DayLightSaving = RTC_DAYLIGHTSAVING_NONE ; stimestructure.StoreOperation = RTC_STOREOPERATION_RESET; if(HAL_RTC_SetTime(&RTCHandle,&stimestructure,RTC_FORMAT_BCD) != HAL_OK) { /* Initialization Error */ Error_Handler(); } /*##-3- Configure the RTC Alarm peripheral #################################*/ /* Set Alarm to 02:20:30 RTC Alarm Generation: Alarm on Hours, Minutes and Seconds */ salarmstructure.Alarm = RTC_ALARM_A; salarmstructure.AlarmDateWeekDay = RTC_WEEKDAY_MONDAY; salarmstructure.AlarmDateWeekDaySel = RTC_ALARMDATEWEEKDAYSEL_WEEKDAY; salarmstructure.AlarmMask = RTC_ALARMMASK_DATEWEEKDAY; salarmstructure.AlarmSubSecondMask = RTC_ALARMSUBSECONDMASK_NONE; salarmstructure.AlarmTime.TimeFormat = RTC_HOURFORMAT12_AM; salarmstructure.AlarmTime.Hours = 0x02; salarmstructure.AlarmTime.Minutes = 0x22; salarmstructure.AlarmTime.Seconds = 0x00; salarmstructure.AlarmTime.SubSeconds = 0x56; salarmstructure2.Alarm = RTC_ALARM_B; salarmstructure2.AlarmDateWeekDay = RTC_WEEKDAY_MONDAY; salarmstructure2.AlarmDateWeekDaySel = RTC_ALARMDATEWEEKDAYSEL_WEEKDAY; salarmstructure2.AlarmMask = RTC_ALARMMASK_DATEWEEKDAY; salarmstructure2.AlarmSubSecondMask = RTC_ALARMSUBSECONDMASK_NONE; salarmstructure2.AlarmTime.TimeFormat = RTC_HOURFORMAT12_AM; salarmstructure2.AlarmTime.Hours = 0x02; salarmstructure2.AlarmTime.Minutes = 0x20; salarmstructure2.AlarmTime.Seconds = 0x30; salarmstructure2.AlarmTime.SubSeconds = 0x56; if(HAL_RTC_SetAlarm_IT(&RTCHandle,&salarmstructure,RTC_FORMAT_BCD) != HAL_OK) { /* Initialization Error */ Error_Handler(); } if(HAL_RTC_SetAlarm_IT(&RTCHandle,&salarmstructure2,RTC_FORMAT_BCD) != HAL_OK) { /* Initialization Error */ Error_Handler(); } } /** * @brief Display the current time. * @param showtime : pointer to buffer * @retval None */ static void RTC_TimeShow(uint8_t* showtime) { RTC_DateTypeDef sdatestructureget; RTC_TimeTypeDef stimestructureget; /* Get the RTC current Time */ HAL_RTC_GetTime(&RTCHandle, &stimestructureget, RTC_FORMAT_BIN); /* Get the RTC current Date */ HAL_RTC_GetDate(&RTCHandle, &sdatestructureget, RTC_FORMAT_BIN); /* Display time Format : hh:mm:ss */ sprintf((char*)showtime,"%02d:%02d:%02d",stimestructureget.Hours, stimestructureget.Minutes, stimestructureget.Seconds); } #ifdef USE_FULL_ASSERT /** * @brief Reports the name of the source file and the source line number * where the assert_param error has occurred. * @param file: pointer to the source file name * @param line: assert_param error line source number * @retval None */ void assert_failed(uint8_t *file, uint32_t line) { /* User can add his own implementation to report the file name and line number, ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */ /* Infinite loop */ while (1) { } } #endif EDIT: This is my new script with the LED and the "PWR_FLAG_WU". The LED still OFF during all the process #include "main.h" /** @addtogroup STM32L0xx_HAL_Examples * @{ */ /** @addtogroup PWR_STANDBY_RTC * @{ */ /* Private typedef -----------------------------------------------------------*/ /* Private define ------------------------------------------------------------*/ /* Private macro -------------------------------------------------------------*/ /* Private variables ---------------------------------------------------------*/ /* RTC handler declaration */ RTC_HandleTypeDef RTCHandle; /* Buffer used for displaying Time */ uint8_t aShowTime[50] = {0}; static __IO uint32_t TimingDelay; /* Private function prototypes -----------------------------------------------*/ void SystemClock_Config(void); static void SystemPower_Config(void); static void Error_Handler(void); static void RTC_AlarmConfig(void); static void RTC_TimeShow(uint8_t* showtime); /* Private functions ---------------------------------------------------------*/ /** * @brief Main program * @param None * @retval None */ int main(void) { /* STM32L0xx HAL library initialization: - Configure the Flash prefetch, Flash preread and Buffer caches - Systick timer is configured by default as source of time base, but user can eventually implement his proper time base source (a general purpose timer for example or other time source), keeping in mind that Time base duration should be kept 1ms since PPP_TIMEOUT_VALUEs are defined and handled in milliseconds basis. - Low Level Initialization */ HAL_Init(); /* Configure the system clock to 2 MHz */ SystemClock_Config(); /* Configure LED2 */ BSP_LED_Init(LED2); RTCHandle.Instance = RTC; /* Configure RTC prescaler and RTC data registers */ /* RTC configured as follows: - Hour Format = Format 24 - Asynch Prediv = Value according to source clock - Synch Prediv = Value according to source clock - OutPut = Output Disable - OutPutPolarity = High Polarity - OutPutType = Open Drain */ RTCHandle.Init.HourFormat = RTC_HOURFORMAT_24; RTCHandle.Init.AsynchPrediv = RTC_ASYNCH_PREDIV; RTCHandle.Init.SynchPrediv = RTC_SYNCH_PREDIV; RTCHandle.Init.OutPut = RTC_OUTPUT_DISABLE; RTCHandle.Init.OutPutPolarity = RTC_OUTPUT_POLARITY_HIGH; RTCHandle.Init.OutPutType = RTC_OUTPUT_TYPE_OPENDRAIN; if (HAL_RTC_Init(&RTCHandle) != HAL_OK) { /* Initialization Error */ Error_Handler(); } /*##-2- Configure Alarm ####################################################*/ /* Configure RTC Alarm */ RTC_AlarmConfig(); /* Configure the system Power */ SystemPower_Config(); /* Check and handle if the system was resumed from StandBy mode */ if(__HAL_PWR_GET_FLAG(PWR_FLAG_WU) != RESET) { /* Clear Standby flag */ __HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU); } else { RTC_AlarmConfig(); BSP_LED_On(LED2); } /* Insert 5 seconds delay */ HAL_Delay(5000); /* The Following Wakeup sequence is highly recommended prior to each Standby mode entry mainly when using more than one wakeup source this is to not miss any wakeup event. - Disable all used wakeup sources, - Clear all related wakeup flags, - Re-enable all used wakeup sources, - Enter the Standby mode. */ /* Disable all used wakeup sources*/ HAL_RTCEx_DeactivateWakeUpTimer(&RTCHandle); /* Re-enable all used wakeup sources*/ /* ## Setting the Wake up time ############################################*/ /* RTC Wakeup Interrupt Generation: Wakeup Time Base = (RTC_WAKEUPCLOCK_RTCCLK_DIV /(LSI)) Wakeup Time = Wakeup Time Base * WakeUpCounter = (RTC_WAKEUPCLOCK_RTCCLK_DIV /(LSI)) * WakeUpCounter ==> WakeUpCounter = Wakeup Time / Wakeup Time Base To configure the wake up timer to 4s the WakeUpCounter is set to 0x1FFF: RTC_WAKEUPCLOCK_RTCCLK_DIV = RTCCLK_Div16 = 16 Wakeup Time Base = 16 /(~39.000KHz) = ~0,410 ms Wakeup Time = ~4s = 0,410ms * WakeUpCounter ==> WakeUpCounter = ~4s/0,410ms = 9750 = 0x2616 */ //HAL_RTCEx_SetWakeUpTimer_IT(&RTCHandle, 0x14, RTC_WAKEUPCLOCK_CK_SPRE_16BITS); /* Clear all related wakeup flags */ __HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU); /* Enter the Standby mode */ HAL_PWR_EnterSTANDBYMode(); while (1) { } } /** * @brief System Clock Configuration * The system Clock is configured as follow : * System Clock source = MSI * SYSCLK(Hz) = 2000000 * HCLK(Hz) = 2000000 * AHB Prescaler = 1 * APB1 Prescaler = 1 * APB2 Prescaler = 1 * Flash Latency(WS) = 0 * Main regulator output voltage = Scale3 mode * @retval None */ void SystemClock_Config(void) { RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; RCC_OscInitTypeDef RCC_OscInitStruct = {0}; /* Enable MSI Oscillator */ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_MSI; RCC_OscInitStruct.MSIState = RCC_MSI_ON; RCC_OscInitStruct.MSIClockRange = RCC_MSIRANGE_5; RCC_OscInitStruct.MSICalibrationValue=0x00; RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE; if (HAL_RCC_OscConfig(&RCC_OscInitStruct)!= HAL_OK) { /* Initialization Error */ while(1); } /* Select MSI as system clock source and configure the HCLK, PCLK1 and PCLK2 clocks dividers */ RCC_ClkInitStruct.ClockType = (RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2); RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_MSI; RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1; RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1; if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_0)!= HAL_OK) { /* Initialization Error */ while(1); } /* Enable Power Control clock */ __HAL_RCC_PWR_CLK_ENABLE(); /* The voltage scaling allows optimizing the power consumption when the device is clocked below the maximum system frequency, to update the voltage scaling value regarding system frequency refer to product datasheet. */ __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE3); /* Disable Power Control clock */ __HAL_RCC_PWR_CLK_DISABLE(); } /** * @brief System Power Configuration * The system Power is configured as follow : * + RTC Clocked by LSI * + VREFINT OFF, with fast wakeup enabled * + No IWDG * + Automatic Wakeup using RTC clocked by LSI (after ~4s) * @param None * @retval None */ static void SystemPower_Config(void) { /* Enable Power Control clock */ __HAL_RCC_PWR_CLK_ENABLE(); HAL_PWREx_EnableUltraLowPower(); /* Enable the fast wake up from Ultra low power mode */ HAL_PWREx_EnableFastWakeUp(); /* Configure RTC */ RTCHandle.Instance = RTC; /* Set the RTC time base to 1s */ /* Configure RTC prescaler and RTC data registers as follow: - Hour Format = Format 24 - Asynch Prediv = Value according to source clock - Synch Prediv = Value according to source clock - OutPut = Output Disable - OutPutPolarity = High Polarity - OutPutType = Open Drain */ RTCHandle.Init.HourFormat = RTC_HOURFORMAT_24; RTCHandle.Init.AsynchPrediv = RTC_ASYNCH_PREDIV; RTCHandle.Init.SynchPrediv = RTC_SYNCH_PREDIV; RTCHandle.Init.OutPut = RTC_OUTPUT_DISABLE; RTCHandle.Init.OutPutPolarity = RTC_OUTPUT_POLARITY_HIGH; RTCHandle.Init.OutPutType = RTC_OUTPUT_TYPE_OPENDRAIN; if(HAL_RTC_Init(&RTCHandle) != HAL_OK) { /* Initialization Error */ Error_Handler(); } } /** * @brief This function is executed in case of error occurrence. * @param None * @retval None */ static void Error_Handler(void) { /* Turn on the LED2 */ BSP_LED_On(LED2); while(1) { } } #ifdef USE_FULL_ASSERT /** * @brief Reports the name of the source file and the source line number * where the assert_param error has occurred. * @param file: pointer to the source file name * @param line: assert_param error line source number * @retval None */ void assert_failed(uint8_t *file, uint32_t line) { /* User can add his own implementation to report the file name and line number, ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */ /* Infinite loop */ while (1) { } } #endif /** * @brief Alarm callback * @param hrtc : RTC handle * @retval None */ void HAL_RTC_AlarmAEventCallback(RTC_HandleTypeDef *hrtc) { /* Turn LED2 on: Alarm generation */ BSP_LED_On(LED2); } /** * @brief Configure the current time and date. * @param None * @retval None */ static void RTC_AlarmConfig(void) { RTC_DateTypeDef sdatestructure; RTC_TimeTypeDef stimestructure; RTC_AlarmTypeDef salarmstructure; RTC_AlarmTypeDef salarmstructure2; /*##-1- Configure the Date #################################################*/ /* Set Date: Tuesday February 18th 2014 */ sdatestructure.Year = 0x14; sdatestructure.Month = RTC_MONTH_FEBRUARY; sdatestructure.Date = 0x18; sdatestructure.WeekDay = RTC_WEEKDAY_TUESDAY; if(HAL_RTC_SetDate(&RTCHandle,&sdatestructure,RTC_FORMAT_BCD) != HAL_OK) { /* Initialization Error */ Error_Handler(); } /*##-2- Configure the Time #################################################*/ /* Set Time: 02:20:00 */ stimestructure.Hours = 0x02; stimestructure.Minutes = 0x20; stimestructure.Seconds = 0x00; stimestructure.TimeFormat = RTC_HOURFORMAT12_AM; stimestructure.DayLightSaving = RTC_DAYLIGHTSAVING_NONE ; stimestructure.StoreOperation = RTC_STOREOPERATION_RESET; if(HAL_RTC_SetTime(&RTCHandle,&stimestructure,RTC_FORMAT_BCD) != HAL_OK) { /* Initialization Error */ Error_Handler(); } /*##-3- Configure the RTC Alarm peripheral #################################*/ /* Set Alarm to 02:20:30 RTC Alarm Generation: Alarm on Hours, Minutes and Seconds */ salarmstructure.Alarm = RTC_ALARM_A; salarmstructure.AlarmDateWeekDay = RTC_WEEKDAY_MONDAY; salarmstructure.AlarmDateWeekDaySel = RTC_ALARMDATEWEEKDAYSEL_WEEKDAY; salarmstructure.AlarmMask = RTC_ALARMMASK_DATEWEEKDAY; salarmstructure.AlarmSubSecondMask = RTC_ALARMSUBSECONDMASK_NONE; salarmstructure.AlarmTime.TimeFormat = RTC_HOURFORMAT12_AM; salarmstructure.AlarmTime.Hours = 0x02; salarmstructure.AlarmTime.Minutes = 0x22; salarmstructure.AlarmTime.Seconds = 0x00; salarmstructure.AlarmTime.SubSeconds = 0x56; salarmstructure2.Alarm = RTC_ALARM_B; salarmstructure2.AlarmDateWeekDay = RTC_WEEKDAY_MONDAY; salarmstructure2.AlarmDateWeekDaySel = RTC_ALARMDATEWEEKDAYSEL_WEEKDAY; salarmstructure2.AlarmMask = RTC_ALARMMASK_DATEWEEKDAY; salarmstructure2.AlarmSubSecondMask = RTC_ALARMSUBSECONDMASK_NONE; salarmstructure2.AlarmTime.TimeFormat = RTC_HOURFORMAT12_AM; salarmstructure2.AlarmTime.Hours = 0x02; salarmstructure2.AlarmTime.Minutes = 0x20; salarmstructure2.AlarmTime.Seconds = 0x30; salarmstructure2.AlarmTime.SubSeconds = 0x56; if(HAL_RTC_SetAlarm_IT(&RTCHandle,&salarmstructure,RTC_FORMAT_BCD) != HAL_OK) { /* Initialization Error */ Error_Handler(); } if(HAL_RTC_SetAlarm_IT(&RTCHandle,&salarmstructure2,RTC_FORMAT_BCD) != HAL_OK) { /* Initialization Error */ Error_Handler(); } } /** * @brief Display the current time. * @param showtime : pointer to buffer * @retval None */ static void RTC_TimeShow(uint8_t* showtime) { RTC_DateTypeDef sdatestructureget; RTC_TimeTypeDef stimestructureget; /* Get the RTC current Time */ HAL_RTC_GetTime(&RTCHandle, &stimestructureget, RTC_FORMAT_BIN); /* Get the RTC current Date */ HAL_RTC_GetDate(&RTCHandle, &sdatestructureget, RTC_FORMAT_BIN); /* Display time Format : hh:mm:ss */ sprintf((char*)showtime,"%02d:%02d:%02d",stimestructureget.Hours, stimestructureget.Minutes, stimestructureget.Seconds); } #ifdef USE_FULL_ASSERT /** * @brief Reports the name of the source file and the source line number * where the assert_param error has occurred. * @param file: pointer to the source file name * @param line: assert_param error line source number * @retval None */ void assert_failed(uint8_t *file, uint32_t line) { /* User can add his own implementation to report the file name and line number, ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */ /* Infinite loop */ while (1) { } } #endif AI: The problem is with your code. The RTC registers are part of the backup-domain, and this part is not reseted during Standby mode. From reference manual. SRAM and register contents are lost except for the RTC registers, RTC backup registers and Standby circuitry It is you who resets the RTC config. On wakeup, the code will be executed from the begining of the main, where you reconfigure the RTC and the alarms. So the time will be set back to stimestructure.Hours = 0x02; stimestructure.Minutes = 0x20; stimestructure.Seconds = 0x00; and the alarms will be reset as well to Alarm A: salarmstructure.AlarmTime.Hours = 0x02; salarmstructure.AlarmTime.Minutes = 0x22; salarmstructure.AlarmTime.Seconds = 0x00; salarmstructure.AlarmTime.SubSeconds = 0x56; Alarm B: salarmstructure2.AlarmTime.Hours = 0x02; salarmstructure2.AlarmTime.Minutes = 0x20; salarmstructure2.AlarmTime.Seconds = 0x30; salarmstructure2.AlarmTime.SubSeconds = 0x56; So again the 30 sec alarm (Alarm B) will be fired. Now you already have the solution in your code: /* Check and handle if the system was resumed from StandBy mode */ if(__HAL_PWR_GET_FLAG(PWR_FLAG_SB) != RESET) { /* Clear Standby flag */ __HAL_PWR_CLEAR_FLAG(PWR_FLAG_SB); } You should configure the RTC time and alarm only if the MCU does not come from Standby mode. Something like: /* Check and handle if the system was resumed from StandBy mode */ if(__HAL_PWR_GET_FLAG(PWR_FLAG_SB) != RESET) { /* Clear Standby flag */ __HAL_PWR_CLEAR_FLAG(PWR_FLAG_SB); } else { RTC_AlarmConfig(); }
H: 12V LED dimmer burning out after several weeks of usage We have changed the lighting in our room, but after several weeks the dimmer just puffs in smoke and stops working. This already happened twice. Basic setup is like this -> 2 way switch goes to 220->12V transformer (meanwell 12V 5A) -> to dimmer that burns out (similar to https://www.amazon.co.uk/LED-Dimmer-12V-Controller-Brightness/dp/B01B0UP1SE/ref=sr_1_67?ie=UTF8&qid=1479382252&sr=8-67&keywords=dimmer+12v ) -> 6x Philips Lighting 6.5MR16 connected in parallel. As total power of circuit is under 50W, and dimmer supports up to 96W when operating in 12V, this should not be the cause of burning out. We are not using dimmers power off feature, as we are killing power with 2 way switch. Odd thing is that after we turn them back on, sometimes bright flash happens (if this might cause anything) What would you suggest? Use a better dimmer or there are some parts of the lighting system missing that causes this behaviour? AI: I concur with other comments. The assumptions for an 12-24V AC dimmable LED make certain compatability model assumptions on the dimmer type. Normally these designs use a buck-boost type that must store energy to sustain the power between 50 Hz half cycles and this stored energy in reactive elements includes a storage cap that must be pre-charged in 1 or few cycles to obtain instant On characteristics. The down-side is this stored energy has an equivalent watt second or Joule equivalent energy value and when this energy is transferred on power up is a shorter time during a random phase angle where the peak Ac input is 325V nom for 230Vac/50 Hz can challenge a designs ability to withstand or soft start inrush currents. They can operate off AC or DC with these circuits. Now that's just the LED bulb, but the same holds true for the dimmer with it's stored energy and inrush current and random phase angle and is compounded by the inrush of its load and its input storage needs to charge up without exceeding some max current. Unfortunately there are always combinations of products that may be incompatible and over the years has caused designs to choose leading edge and trailing edge type control methods in other products to prevent hysteresis on dimmer functions. The third challenge is your contact switch will likely have contact bounce and this during a peak AC sine can cause massive inrush current to caps with mechanical bouncing high dV/dt or arcs from V=Ldi/dt and then LC resonating effects during the turn-off arc. This explanation won't help you but there may be in expensive ways to curb the over-stress condition if we knew exactly the root cause of the component(s) that failed. OVP, Turn-off over voltage: from V=LdI/dt CLC-line filter and or MOV to dimmer or maybe an X cap 0.047uF across input switch. OCP, Turn-on over-current: An ICL metal-oxide NTC soft-starter (cheap) Switch debouncer: A ZCS triac control by power switch (not common consumer product, but common in SSR's which often cost more than your cheap dimmer or maybe the X cap solution above. This reminds me when we tested OEM power supplies, one of my test requirements was 10k AC power cycles with random phase during life test, on,off, on , off. We did the same for OEM disk drives. It should be common knowledge for any Test Engineer to do this. Obviously an oversight on this dim product. Best guess? get an Cap and an ICL from Digikey and call their hotline tech support or email them for your shopping solution. The holding current for 50W on 230Vac means the ICL must be rated for 500V minimum and 0.5A to 1A. Get extra, they are cheap and install in series between switch and dimmer input. You could also get ones for higher current on dimmer output for 5A. They come in different Curie temperatures and are designed to run hot from 55 to 125'C Choose the lowest range for an office environment. Good luck shopping.
H: Differences between Interrupts and sampling for hardware button? I have a hardware button I connected to an interrupt, but my problem is it bounces a bit, making the button press unreliable. I think a good deal of these issues would be solved by sampling in the main loop, but that just feels technically wrong. Are interrupts more appropriate for intra-circuit communication or are interrupts also appropriate for hardware switches? If so what debounce techniques can I use? I've tried keeping a timer variable and checking it against current time, delays, and other techniques. It seems as if the bounces are just so fast it doesn't matter. AI: Debouncing is a FAQ. You should be able to find... nearly unlimited numbers of web pages on the topic. Smith commented about Jack Ganssle's widely read PDF on the topic, as well. And with all these answers you've got both hardware and software methods. I'll add to this "literature" just a little bit by mainly talking about ideas that aren't already covered well. But before I do, a point or two: Debouncing in analog hardware can achieve results that you cannot achieve by a switch "observed" only digitally on a periodic basis by polling or even by hardware pin-change events. But you can do "well enough" for all intents and purposes, digitally. Almost no one these days uses external analog debouncing solutions. But I have used everything from pulse stretching using one-shots (74121) to techniques mentioned by Jack Ganssle here. For those doing embedded programming only and not at all interested in learning about electronics, debouncing switches is probably one of the two basic skill sets needed. Operating LEDs is probably the other one. And by this, I don't mean having only one skill at these. I mean being able to do it in a number of ways. So you really do need to fully apprehend what Jack Ganssle writes about, and still more, regarding switches. Since I've mentioned pulse stretching using a 74121 and since Jack Ganssle does not mention it, and neither does anyone here as yet, I may as well provide this additional link as additional suggested reading on using the 74121 or 555 as a one-shot timer for debouncing switches. Now, on to doing this through observation with a microcontroller. I usually use a state machine to handle debouncing. This is almost always driven by a regular "heartbeat" timer I set to about \$8\:\textrm{ms}\$, where possible. (I generally do NOT use edge-triggered interrupt events for several reasons.) The state machine looks like this: simulate this circuit – Schematic created using CircuitLab The value of DEBOUNCED for the switch could take on "inactive", "active", and "unknown" values. In this way, you could make sure that your software waits until the switch value settles down after initialization. But usually, I don't bother with that. I replace the "unknown" value with some default value and just use a binary value system, instead. The state machine is entered by first setting the debounced value to its default and then entering the "CHANGING" state of the state machine. At each time interval (typically \$8\:\textrm{ms}\$ if I can get away with it), I will read the current switch value and perform an update of the current state and possibly, the debounced value. Then I just exit. The high level code then only accesses the debounced state. If it matters to me, I may also keep a prior debounced state. In these cases, when updating the debounced state itself, I will first copy that state to a 'prior debounced state'. I can then use the pair of values to determine if there has been a debounced transition. Sometimes, I don't care about transitions. Sometimes, I do. So it depends. But in all cases, I only want to know about transitions that have been debounced. I never care about runt transitions. So high level code never uses any of the internal state that the state machine uses for its own work. One of the nice things about this method is that I can debounce an entire port of switches, at once. And I can do it without a single branch in the interrupt code, too. This means very fast and short debouncing code for up to the port-width of the microcontroller (usually 8 bits wide.) An example from the Atmel AT90 shows how this is achieved using a Timer0 interrupt event: .equ SWPORTPINS = PINB .def SwRawCurr = r4 .def SwRawPrev = r5 .def SwState = r6 .def SwDebCurr = r7 .def SwDebPrev = r8 ; Debounce the input switches. mov SwRawPrev, SwRawCurr in SwRawCurr, SWPORTPINS mov Timer0Tmp1, SwRawCurr eor Timer0Tmp1, SwRawPrev mov Timer0Tmp0, Timer0Tmp1 or Timer0Tmp1, SwState mov SwState, Timer0Tmp0 mov Timer0Tmp0, Timer0Tmp1 com Timer0Tmp0 and Timer0Tmp1, SwDebCurr and Timer0Tmp0, SwRawCurr or Timer0Tmp1, Timer0Tmp0 mov SwDebPrev, SwDebCurr mov SwDebCurr, Timer0Tmp1 Now, this example shows the full deal, including the previous and current debounced switch values. And it performs all of the necessary state transitions, as well. I don't show the initialization of this code. But the above gets the point across about how easy the state machine is to operate and how little code is required to do so. It's quite fast and simple and does not require branching (which sometimes involves additional cycles as well as additional code space.) I prefer using \$8\:\textrm{ms}\$ timing because long, long testing with a variety of different people using equipment I've worked on in the past has led me there. I've tried longer periods and when I do so, I start to get people telling me that the "responsiveness" isn't "brisk" enough. (These days, with children growing up working real-time "shoot 'em up" gaming, I might even shorten it up further. They will complain bitterly about even slight delays caused by modern digital TVs in setting up and displaying a frame.) Some people will have very clear feelings about how crisp and responsive a system should be. Crisp and responsive means sample more often, not less. But personally, I find \$20\:\textrm{ms}\$ observation periods acceptable. (I do not find longer times good enough even for me, though.) Please note that the state machine I've mentioned must first enter the SETTLED state and then stay there for one more sample time before the value for DEBOUNCED is updated. So pushing a button and holding it, even in the best circumstance, will require these transistions: change from SETTLED to CHANGING change from CHANGING to SETTLED stay in SETTLED, updating DEBOUNCED So a new debounced state requires a minimum of 3 sample time periods to achieve. A push button will require at least 6 sample times to go from inactive, to active, and then back to inactive. I mentioned the above details so that it is absolutely clear that a sample time of \$8\:\textrm{ms}\$ means that it somewhere between \$16\:\textrm{ms} \lt t \le 24\:\textrm{ms}\$ to go from inactive to a recognized active debounced result. And it will take another \$24\:\textrm{ms}\$ before the state can return to inactive. That's a minimum of \$40\:\textrm{ms} \lt t \le 48\:\textrm{ms}\$ to go through an entire push button cycle. Using longer sample times will have correspondingly longer periods. Using the \$20\:\textrm{ms}\$ I mentioned as "acceptable" to me already then means somewhere around \$100\:\textrm{ms} \lt t \le 120\:\textrm{ms}\$ for an entire push button cycle. And that is getting squarely up into the area where people do tend to notice. I certainly don't like the "feel" if it gets any longer than that. If you go this route, don't be cavalier about using longer sample times. If you must, then I think you also must do a lot of testing with users/consumers. And if you are developing code for a typing keyboard, then use shorter times. The record for a typist was set decades ago at 217 wpm. This results in about one key every \$45\:\textrm{ms}\$. Typists like that are hitting multiple keys in a controlled ordering. To get good performance for very fast typists using a mercury-wetted reed relay switching system, I found that \$2\:\textrm{ms}\$ worked well.
H: What is the difference between electrical engineering and electrical engineering technology? I have recently found that someone can get a BS. in Electrical Engineering and a BS. in Electrical Engineering Technology. I'm trying to find the fundamental difference between the two, but the only thing I can find is that EE deals more with AC currents and power, while EET is more focused in device-controlling circuits. What are the fundamental differences between the two? are there an parts of EET that shouldn't be discussed on EE.SE? AI: My understanding is that engineering degrees are more theory based and engineering technology degrees are more application based. It isn't a complete distinction between theory and application since there is always some overlap but this was the main distinction when I attended ITT Technical institute's Electronics Engineering Technology program. This is also one of the main differences cited by ABET which accredits some of these programs: Engineering and engineering technology are separate but closely related professional areas that differ in: Curricular Focus – Engineering programs often focus on theory and conceptual design, while engineering technology programs usually focus on application and implementation. Engineering programs typically require additional, higher-level mathematics, including multiple semesters of calculus and calculus-based theoretical science courses, while engineering technology programs typically focus on algebra, trigonometry, applied calculus, and other courses that are more practical than theoretical in nature. Another area that can differ is career path. EET questions are appropriate here. See this answer about how the name was chosen and the history of the site. Keep in mind that, there are some things that you may get better answers to in different places like physics.se or mathematics.se
H: Resistor placement in filter circuits Why does the placement of the resistor in a filter circuit matter? I've heard if you switch an inductor and a resistor in a series circuit it could change the type of filter you get. Ex: From a low pass filter to a high pass filter. AI: Some things in nature simply aren't commutative. A R-L filter is one of them. In this case, the signal must pass thru one of the components, then the result is shunted to ground by the other. It should be obvious that if you make the signal pass thru a high resistance then shunt the result to ground with a low resistance, you don't get much. Conversely, if the signal passes thru a low resistance then is shunted to ground thru a high resistance, it will be largely unaffected. In this case, you can think of the inductor as a frequency-variable resistor. That's not exactly what it is, but it's a good enough mental model to understand low pass and high pass L-R filters at this level for now. The effective resistance of the inductor goes up with frequency. If it is in series, it will cause high frequencies to be attenuated more. If it is the shunt, then it will affect high frequencies less. Low pass filter: High pass filter:
H: What type of battery does a small gray Mastercraft Pocket Digital Multimeter (model 52-0051-4) require? Canadian Tire is a retail chain which operates only in Canada. They're probably one of the biggest retailers of hardware and tools in the country. One of their store brands is Mastercraft. About ten years ago, they carried a small dark-gray "Mastercraft Pocket Digital Multimeter". The model number is 52-0051-4. It cost between CAD $10 and CAD $40 or so, depending whether or not you bought it on sale. The multimeter uses one battery. When the battery gets low, the multimeter starts giving you inaccurate readings. To replace the battery, you unscrew two screws and open the multimeter up. Engraved on the inside of the multimeter's battery holder is a generic battery symbol, a plus sign, and a minus sign. This engraving tells you which way the battery goes. Unfortunately, there's no information printed or engraved anywhere on the outside or inside of the multimeter about which type of battery it requires. So, what type of battery does it require? AI: This multimeter requires one single A23 alkaline battery. This type of battery is occasionally also called "23A", "23AE", "GP23A", "V23GA", "8LR932", "8LR23", "MN21", "L1028", or "ANSI-1181A". Dead alkaline batteries sometimes leak. When your old battery dies, remove it from the device before it starts leaking.
H: When and why use triangle solder joints I found these triangular solder joints in a 24v power supply. Why are they made as triangles? This is the first time I have seen it and I was unable to google anything about it. AI: Please note a little notch (adjacent to "R7"), a narrow slot in the thick trace. These special-shape traces are used to minimize (separate) effects of one high-current path from another high-current path, or maybe from a sensitive signal. The triangles are deliberate solder mask openings to allow a solder build-up, to beef-up the trace near the joint, to compensate for reduced current carrier capability of the PCB traces at the junction point. Since many of the through-hole pins are of a large diameter, there is often little annular copper remaining to form a current path on it's own, so the solder itself is used to provide increased current capacity at those locations.
H: Extending signal cable I have a signal cable (also transmits power) that is extremely short (see attached picture). I would like to extend the cable with one meter (3ft), and I was thinking of cutting it in two (again see picture), and then attaching it to either a phone cable or a flat console (serial) cable, but I don't know how to best attach the cables. How do I attach thin twisted cables so that I can extend my signal cable? Edit: I have tried different ways of extending and done extensive testing that the signal survives (it does). However, none are good "permanent" solutions. The signal is 9600 baud, and the device draws minimal amounts (<1W) of power. AI: This is how I have been doing it for decades...
H: Amp Draw On Battery Over Time & Battery Run Time Can someone post a formula / help me figure out how to figure out the battery run time for the following scenario? I have a single 12v led light bulb with a draw of 510mA @ 12v and 1400mA @ 8v. If I start with a AGM 12v 80Ah battery and let it run for say 10 hours how do I figure out the run time given that the amp draw will rise as the battery is discharged? I know battery discharge is non-linear so I am not sure how to calculate. Also it is worth noting that I plan on using 4 of the these light bulbs so ultimately I need to also calculate that in as well. Battery Specs: Product ID: 24M-XHD Cranking Amps: 1000 Cold Cranking Amps: 800 Voltage: 12 Termination: Common Code M Weight (lbs): 44.6 Width (in): 6.88 Length (in): 11.00 Height (in): 9.50 ReserveCapacity-25: 135.00 WET/DRY: W AI: What you need is the battery capacity, usually expressed in Amp-hours. If you want to run something that takes 510 mA for 10 hours, then it will drain 5.1 Ah from the battery. Any 12 V car battery will handily exceed that minimum rating. Car batteries don't like to be deep discharged, so plan to use only half the rated capacity. At that level, the voltage will be fairly close to 12 V the whole time, so you shouldn't have to worry about the 10 V draw. In any case, are you really sure about this light taking 1.4 A at 10 V, but only 510 mA at 12 V? That sounds really odd and implausible, like maybe you read something wrong. This implies it uses 6.1 W at 12 V but 14 W at 10 V. Where do the extra 7.9 W go? If it has a switching power supply I could believe a little less efficiency at 10 V compared to 12 V, but not such a whopping change with just a little less input voltage. Something isn't right in what you're telling us.
H: Does metal toggle switch in simple AC lamp circuit need to be grounded I am getting into woodworking and would like to build a simple lamp like the one in this video on Youtube: https://youtu.be/BY5FzfxvZrg In the video, the lamp body/enclosure is built out of wood. The switch used to turn the lamp on and off is a basic metal toggle switch mounted through the top of the wood enclosure. I noticed in the comments that some have expressed concern that the switch is not grounded. Is this lamp unsafe as-is, or should I ground the switch? If it needs to be grounded, how would I do that? AI: A company, Leviton, made (possibly now discontinued) metal bat toggle switches for double insulated applications. The metal mounting plate is not exposed on the back of the switch and I suppose the metal bat is 'double insulated' from the contacts. They seem to be available on eBay, Amazon and elsewhere. I cannot say if these are up to the latest modern standards but they are marketed for the specific application. For the little extra they might cost it could be a bit of extra peace of mind. The obvious alternative is to get a plastic shell switch with a plastic bat and it is automatically double insulated. Designing in a fuse is probably overkill, risk averse manufacturers do not do it and it is one more point of failure (connections) and user stupidity faults (incorrect fuse) and provides very little extra protection. Mostly because the live and neutral polarity cannot always be trusted even with an earthed or polarised mains plug the polarity is only as good as your last electrician. As per the comment above the strain relief DID include a cable tie but no protection from rotation, the goop covered the back of the Edison base terminals. Adding an additional section of good (woven glass reinforced) sleeving over the wire where it enters the cabinet that was then bent and fixed in place with a small durable strain relief would be good insurance. Fine stranded wire is ill suited for screw terminals but with a ring lug they can be fine under a screw, with a bootlace ferrule they are fine in a cavity terminal and screw terminals that have a pressure plate. The switches above come with wire tails that reduce the number of termination points by one at least and allow the use of a wire nut or in line crimped splice for one other which are safer than a badly made termination under a screw head. I applaud the novel way the YouTube clip maker re-purposed the para-cord outer sock as a vintage decorative silk/cotton wire covering.
H: Trouble analyzing transistor's circuit simulate this circuit – Schematic created using CircuitLab \$V_{cc}=20V\\V_{BE1}=V_{BE2}=0.5V\\V_{BE3}=0.6V\\\beta_1=\beta_2=100\\\beta_3=50\$ I need to find V in this circuit. I tried to use the path for KVL with the least unknowns but a lot of times I end up with linear dependent equations that leads to nowhere. It's been 3 hours since I'm trying and I didn't get anything close to a result on this. I think my major issue is (1) figuring out what path to take on KVL's equations and (2) figuring out when the KVL equation will be linear dependent of another one. What's a good approach to analyze circuits like this? AI: Normally, a circuit like this really would take careful consideration. But less so, provided some of the givens. I'm a little concerned about your value for \$R_4\$, only because the schematic editor uses that value as a default and I'm not sure you intended that value. \$R_3\$ seems a bit odd, as well. But let's go with it: simulate this circuit – Schematic created using CircuitLab I think you can see that pretty much everything turns on the value of \$V_x\$. So let's just do nodal analysis and shoot for its value: $$\begin{align*} \frac{V_x}{R_2} + \frac{V_x}{R_3} + \frac{V_x}{R_4} + I_{B_1} &= \frac{600\:\textrm{mV}}{R_2} + \frac{20\:\textrm{V}}{R_3} + \frac{V_x-1\:\textrm{V}}{R_4} \\ \\ V_x\cdot\left(\frac{1}{R_2} + \frac{1}{R_3}\right) + I_{B_1} &= \frac{600\:\textrm{mV}}{R_2} + \frac{20\:\textrm{V}}{R_3} - \frac{1\:\textrm{V}}{R_4} \\ \\ V_x &\approx 12\:\textrm{V} - 755\cdot I_{B_1} \end{align*}$$ Hmm. We don't know \$I_{B_1}\$. So let's re-group a bit. You know that \$Q_3\$ has \$\beta=50\$ and that it's collector current must include \$I_{R_4}\$ and the base current of \$Q_2\$. This must be more than \$10\:\textrm{mA}\$. It follows that \$I_{B_3}\ge 200\:\mu\textrm{A}\$. So you know that \$I_{R_2}\ge 260\:\mu\textrm{A}\$ and therefore also that \$V_x\ge 9.18\:\textrm{V}\$. You also know that \$R_3\$ must include \$I_{R_2}\$, \$I_{R_4}\$, and \$Q_1\$'s base current. So \$I_{R_3}\ge 10.26\:\textrm{mA}\$ and therefore \$V_x\le 12.07\:\textrm{V}\$. So we now can at least say this: $$\begin{align*} 9.18\:\textrm{V} \le \left(V_x \approx 12\:\textrm{V} - 755\cdot I_x\right) \le 12.07\:\textrm{V} \end{align*}$$ Thanks for asking questions about this. Here's my additions. I've added the current \$I_{B_1}=I_x\$ to the schematic. (This must be returned to the collector of \$Q_3\$ via the base of \$Q_2\$, since both \$Q_1\$ and \$Q_2\$ share the same \$\beta=100\$ value.) So we have the above equation. But what is missing is the value for \$I_x\$. \$I_x\$ adds to the \$10\:\textrm{mA}\$ from \$R_4\$, so that the collector current of \$Q_3\$ increases by that amount. This means that the base current for \$Q_3\$ increases by \$\tfrac{1}{50}\$ of that. So we can set this up: $$\begin{align*} V_x = 12 - 755\cdot I_x &= 600\:\textrm{mV}+\left(60\:\mu\textrm{A}+\frac{10\:\textrm{mA}}{50}+\frac{I_x}{50}\right)\cdot R_2 \\ \\ 12 - 755\cdot I_x &= 600\:\textrm{mV}+\left(260\:\mu\textrm{A}+\frac{I_x}{50}\right)\cdot R_2 \\ \\ I_x &\approx 2\:\textrm{mA} \end{align*}$$ From this, we can now estimate \$V_x\approx 10.5\:\textrm{V}\$ and then that \$V\approx 10\:\textrm{V}\$. Thanks for asking additional questions. It helped me to add my own additional thinking to this and to provide what I think is now a more complete answer to your question.
H: Is my schematics correct? (Atmega328p for solenoids control) Finally I finished the second version of my circuit which should control different solenoids. You can view the large version here. In particular, this circuit should control 2 proportional solenoids and 7 ON/OFF solenoids. The solenoids parameters are: V = 12Vcc, R = 3.7 Ohm, I = 1.80A In order to prevent an atmega328p reset due to noise (like it happened in the first version), I added: an optoisolator 6N136 for each output, a MOSFET driver MCP1406 for each MOSFET an isolated power supply THL-25 to power up the atmega328p (main battery is an AGM Battery 12V, 200Ah). As suggested in the application note of its datasheet, I used an inductor L1-1UH with a capacitor for the THL-25 input. Is it OK? In this way, I have two different grounds, GND5 is the gnd for 12V, while GND is the ground for 5V . I also added a big 2200uF capacitor between +12V and GND5 in order to avoid noise. The capacitor C5 100nF is OK for the atmega328p? I will place it very close to the atmega pins. The output named "OUT5/SERVO PWM" should control a 12V, 4A RC servo. Is there any error in my schematics? Anything to improve? The big C3 capacitor is enough for the filtering? The circuit close to the isolated power supply is correct? Can you help me, please? I would like to improve my circuit, if possible. Thank you for your support and your help! EDIT1: I updated my schematics by adding the SERVO connections and pinout. EDIT2: I changed the SERVO circuit by using a P-mosfet. This is the SERVO schematics. EDIT3:: This is the new schematics for the servo controlling. AI: The area in Yellow needs to be fixed as PWM will not work. Dont you want to put a cap on RESET to gnd for POR? How far are all the cable interfaces? What type of shielding do you need? Do you have a functional spec for immunity? Are you planning to do Susceptibility testing? Radiated Arc, Impulse RF , Induction spikes etc.... if so what is your spec for dV/dt , dI/dt or field strengths for crosstalk from load to inputs etc. if you dont make a spec, how will you know it wont fail? or when it will fail or if it is interface overkill./..\ It's like an architect who designs a bridge with elastomers and even tension supports and forgets about wind effects. If you dont define all the environmental risks, how can you say it passes?
H: What do these Battery Specifications mean? I have a sealed lead acid battery with the spec as below: 6V 4.5Ah/20HR Constant voltage charge Cycle use : 7.25V-7.45V Initial current : less than 1.8A Standby use: 6.8V - 8.9V What do these data mean? Thanks for your help. AI: "Standby use: 6.8V - 8.9V " It means you made a typo error. Standby use: 6.8V - 6.9V or 6.85/3=2.28V/cell at std temp=20'C Cycle Use= Charge-discharge voltage per cell is the std way to specify multi-cell batteries. Normally battery chargers for SLA's must be temperature compensated to achieve rated life of 500 charge cycles. There is a float voltage range and a charge voltage range which can be discharged in this range as well so it is called CYCLE USE. Much more can be learned by getting OEM specs not reading stuff on Ebay or Amazon http://sa.tipa.eu/datasheet/04250135-datasheet-en.pdf
H: Understanding and measuring voltage output of chime transformer I am interested in replacing my doorbell chime with a new one. The existing button and transformer work, but I want to make sure that the chime I get is compatible with the output of the transformer. I'm not sure where the transformer is actually located in the house. I've taken a voltmeter, set it to 20v AC maximum and set to to 'peak hold' and had a friend push and hold the doorbell. I measured approximately 10-14 volts that way at the chime. Most of the doorbell chimes I've seen are rated 16V/10VAC which I understand is 10volts AC. But, what is the 16volt value? Peak voltage of the sinusoid? Was my technique for measuring the voltage output of the transformer reasonable? Since I've set it for AC voltage reading, the value I'm hoping for is 10V (or close to it) vice 16 volts if I want to purchase one of these 16V/10VAC chimes, correct? AI: All of those voltages (specified and measured) are NOMINAL. You can expect an open-circuit (no-load) voltage of 20~24VAC, and 10~16VAC under load. These things are rather sloppy by electronics standards and your design should be able to tolerate and operate on probably anything between 10VAC and 30VAC.
H: What kind of LED do I need? I want to learn about analogue circuit design and thought I'd start of reeeaaally simple, with a circuit where you connect the battery and the LED turns on. I've been looking on digikey.nz for the right components but they don't seem to offer the kind of LED I'm looking for. I want a small LED that's simple to work with, something that looks like this: Does anybody know what the name of this kind of LED is, and where I can get one? I've been trying to find a place to order one online but can only find lines of christmas lights, LED bulbs, or weird complicated circular things. AI: Learn how to search Distributor's using any search engine Use a description of desired specs in any search engine or use their website with key words , use shopping tab in Google or include Digikey as a key word or use their website and "drill down" the Product Index - = Product Index > Optoelectronics > LED Indication - Discrete results < here Click V descending sort on brightest LED [mcd] or Millicandella Rating My pick for you MT5470E-UR Marktech ( Private label Distributor) Oval Red diffused tinted lens 2300mcd 40x110 deg radial $0.29 usd (100pcs) These are rated at 2.1V @20mA and have an equivalent zener resistance of 7 Ohms. {#1 Choice} Red in clear lens $0.11usd (100pc) http://www.digikey.com/product-detail/en/cree-inc/C4SMF-RJF-CT0W0BB1/C4SMF-RJF-CT0W0BB1-ND/2809664 n.b. If you want deep Red (660 nmD) not as bright but lower Vf, 1.3V GaAs in Diffused tinted Red > Search However the easiest to use are 12V strip LEDs with built in resistors THAT OPERATE BRIGHTEST AT 14.2v FOR CARS simulate this circuit – Schematic created using CircuitLab
H: How to simulate a d-flip flop counter/divider? I would like to simulate a simple one-bit counter (or frequency divider) using the D-flip flop. However, I don't want to use the abstracted D-flip flop above. Rather, I want to simulate this using primitive NOR/AND gates directly. I rigged up a D-flip flop based on NOR Gates below. The full simulation can be seen at this link: http://tinyurl.com/z6mae9c However, I cannot connect the Q' output back into the "D" input without getting an error (endpoints circled in red below). Can anyone recommend how to fix this? Is this a limitation of the simulation framework? If so, what's a good package to simulate this on? AI: http://tinyurl.com/zonbe7q It cant work as you expected, but I fixed the simulation Difference between latch and flip-flop?
H: Would this isolated boost topology work? I've been trying to create an isolated DC/DC converter for cell balancing but I can't seem to get the topology quite right. In the topology shown in the picture, the cell is on the left and the battery on the right. The MOSFET with the tag "C1" shorts the inductor, increasing its current. Then it turns off and the inductor current forces the diode to conduct, thus charging the capacitor and increasing the current in the primary of the transformer. When the MOSFET turns off again, the capacitor would take the decreasing current from the transformer. Since the current in the transformer is always going up and down (but always with the same polarity), this would create magnetic flux in the core of the transformer and transfer energy to the secondary winding, charging the main battery. The FET with the "BoostON" tag would only turn on when the converter is turned on, and it would be always conducting. When the converter stops the energy transfer between cell and battery, this transistor would be turned off. This is to avoid shorting the cell through the transformer and boost diode when the converter is not working. So, are there any flaws in this topology? Are there any reasons why this would just outright fail, or would it actually work as intended? Extra information: This is just a typical boost converter with an extra transformer and a diode on the secondary side. The bigger circle in the transformer indicates the primary side. The transformer used would be this one, with a 1:4 turn ratio. The objective is to implement PI/PID current control to get an average inductor current of 3 A. The reason I want to avoid the typical fly-back topology is because of the control issues that may arise. The switching frequency is going to be 30kHz, and the inductor used would be somewhere around 70~90uH (calculated for the normal boost topology). The capacitance value in the image is random. Simulations show that the circuit should work as intended. AI: Your topology very much resembles a standard PC PSU with active PFC. A boost stage followed by an isolated down-converter stage. Except that: the inductor in series with the transformer primary... that looks a little odd... what's the purpose? the FET in series with the "main stage" (the isolated transformer) is N-type in your design, which matches the typical topology, but yours is connected in "common collector" fashion to the + polarity of the "midway bulk capacitor". This would force you to implement high-side N-polarity driving circuitry in the primary PWM control block... This is normally done in a different way: the N-FET is hooked up as a low-side switch (common emitter) and is driven by a PWM controller IC which also uses the bulk cap's "-" as a common ground with the FET's emitter... What voltages are we talking about on the primary side? By the transformer's winding end marks, your converter would be a "forward" converter. That's more typical than "an isolated flyback" (which is sometimes used for low-power SMPS, and has its own pitfalls - e.g. the primary FET must cope with higher voltage spikes if memory serves).
H: Audio AMP Datasheet help Disclaimer: I know you aren't supposed to ask about specific IC's as it is not helpful to the community in general, but I am at my wit's end here so I will try to make this as relevant as possible. I would like to add audio to a good ol' Raspberry Pi Zero. Specifically I would like to take the audio generated by the PWM pins (GPIO 18 and 19) and feed them into a small 8 ohm speaker and a headphone jack. To do this with the raspberry pi an amplifier would need to be used. I would like to use one amplifier for both outputs so I can control the volume of both outputs with one potentiometer on the input to the amplifier. I found one family of amplifiers that I thought could do the trick, namely the Diodes Inc. PAM8009. The PAM8019 would also work, but it has the same issues. The problem is that I don't know what to do for the Undervoltage Protection (UVP) pin. There is a small circuit connected to the pin with three resistors and it gives a couple of equations for desired UVP voltage and hysteresis. The problem is that I don't know enough about audio AMPs to know what my desired UVP voltage and hysteresis should be, much less the values of the three resistors. Sadly, Diodes does not provide an evaluation board for this chip and my attempts to contact them have gone unanswered for weeks. They have no public forums to seek help from other people. I really have no idea what their values should be and I don't want to apply a "try random values and see what happens" approach if it can be avoided. If you know of another amplifier that can do the trick that does not use I2C control for amp volume (because I don't want to have to right a driver for that and the I2C buses already have a few devices on them) then please let me know. Otherwise any help with the PAM8009 would be greatly appreciated. Again I know this may be against the posting rules, but this is the last place I can turn to for help. If you know somewhere better to ask then let me know. AI: The Undervoltage Protection (UVP) function is intended to avoid noises on the speakers during the power-up and power-down phases. If you provide a low voltage on the UVP pin, the amplifier will be muted, and noises will be avoided. If these noises are not an issue for you, you simply can ignore this function, and disable it leaving the pin open, or connecting it to a logic high level. If instead you have to avoid the noises, that can rise for instance from uncontrolled voltages on the PWM pins during power up, you must find a way to provide a control voltage on the UVP pin; the simple circuit with resistors and capacitor illustrated on the datasheet can do the job. You can start with 100k for R3 and 10k for R1 and R2, and then adjust the values experimentally.
H: Unable to enter in Programming mode (AT_Studio) I've a board with the SAML21E17B uC, when I want to connect/ program it using JLink(edu) and Atmel Studio I get and error message, that the IDE is unable to enter the programming mode any idea what's the problem and how may I solve it ? UPDATE after Wossname answer I've resoldered the uC and double chekced the board, and could find and shortcut, and I still can get an access to the board , here's the part of schematic where the programmer is connected, maybe I've made a mistake here : and yes I've place the capacitor and the induktivity near to uC as mentioned in the datasheet. And I've also set the programmer frequency to 32khz AI: In most cases it is one of the following problems: Clock speed is set too high in the IDE. The microcontroller you are attempting to communicate with is running at a lower clock frequency and cannot keep up. Set the IDE's clock rate to the lowest setting and try again. There may be a wiring fault with the product you are connecting to. This is very common in hobby projects as opposed to manufactured products. Done it myself more times than I can remember :) Check that you have a pull-up resistor (4.7k is about right) between your nRESET pin and VCC, as that is a common omission. There may be a firmware incompatibility on the programming tool you are using. Your programming tool may have older firmware than the IDE can use. Atmel's IDE will usually attempt to update the tool's firmware for you. The computer may have the wrong hardware driver installed for your programming tool or has misidentified the tool. Uninstall the tool and attempt to reinstall using the latest drivers from the manufacturer.
H: Superconductivity and LR Time Constant It takes a certain time for current to reach it's maximum value(i.e steady state at 99% or 100%), and that times is(to my knowledge) determined by the value of inductance(L) and resistance(R) of a conductor. If a superconductor is used instead of a normal conductor(like copper), how would things change? If we assume R=0. And since some superconductors have quite low inductance due to their small diameters,example. AI: V = L di/dt. Apply a fixed pure voltage source across a pure inductor and the current rises and continues to rise until the superconductor cannot sustain its superconductivity any more.
H: Are these two circuit equivelent (the same)? Question: Are these two circuit equivelent (the same)? AI: Look good and you see that only C3 and L3 have changed position. Connecting wires do not change a circuit. Now if you need to calculate voltages and currents in such a system then all loop currents are the same in both diagrams. If we take the -V as reference then the voltage and phase at the node between C3 and L3 is different depending on the values of C3 and L3.
H: Why are car batteries still so heavy? Back when I was a kid, car batteries used to be huge heavy lumps of plastic filled with lead and acid. They used to weigh almost as much as a mobile phone (slight exaggeration there, sorry). 45 years later, car batteries still look the same and weigh the same. So, in this modern age and emphasis on fuel economy, why do batteries still weigh 40 lb? Why have advances in technology not been able to make them lighter and more efficient? AI: So, now after the answer to your literal question to your real question, that you sadly didn't ask Battery technology has moved so far in the last 100 years. The lead-acid starter battery became common in cars in 1920, lead is essentially poison, and sulphuric/lead acid isn't any less dangerous. They tend to fail in cold temperatures, especially if not regularly maintained, and even though they're obviously cheap as hell to produce, the whole handling of them, including legal requirements to take back old batteries, must be a nightmare. Why hasn't the industry just drawn a line and switched to things like LiIon or good ol' NiCd or NiMH batteries, now that electric cars have shown you can reliably drive years based on those? The NiCd batteries are simply worse in every aspect but energy density than lead acid. NiMH is better, but much more expensive, and still has a higher rate of discharge, typically (unless you make them even more expensive). And still pretty hard to properly dispose of. Lithium batteries aren't that easy handle. You need to protect them against all sorts of failures, and some of them are pretty fatal: don't overheat your lithium Battery. It will explode. And heat is a serious problem inside a motor compartment (in fairness, a battery doesn't have to be in there, but it's pretty handy). The main reason really is cost. The battery in my last car, a 1999 Fiat Punto, supplied max 100 A (when I tried to estimate the actual short circuit current, around 43 A, but still a lot. Let's say P=U·I=12V·40A=480W) current, and had a nominal capacity of around 30 Ah (that's an energy of 12V·30Ah = 360Wh). It cost me 25€. So, rough guess, it's cheaper than 10€ to produce. So, let's take a lithium battery type that is mass-produced and hence cheap. The commonly found round cells that make up many laptop battery packs are around 3€ each (let's say 1€ in production) for around 3Ah (11.1Wh), supplying up to 5A (tops, don't do that for long) at some 3.7 V. That says a single cell of these can supply 18.5W. So to reach the estimated 480W of my cheapo car battery, you'd need 26 of them. They'd cost 26€ in production, not counting the Euros you spend on control, charge and protection circuitry, on encasing them in something rigid and safe, and the fact that the minerals needed to produce some of the rare-metal components in Lithium batteries aren't currently getting cheaper, and equipping cars all over the world with those will definitely speed up that market mechanism. Let's assume cost scales with capacity. My 26-cell lithium battery has 26·11.1Wh=288.6Wh energy. So we need to scale that by 1.25 to achieve the same 360Wh as the lead-acid battery. Such a cell weighs around 90g. So the weight of the cells is 26·90 g = 2.34 kg. Ok, I don't have the exact weight of my cheap car battery in my head, but let's say it was 15 kg. So we saved weight by a factor of about 6.3, if our casing, and electronics are lightweight (they're not – as far as I can tell, you'll need a hefty switch mode power supply to be able to efficiently charge these using your car's generator, and those mainly consist of a pretty bulky coil of copper, and maybe some ferrite core that isn't exactly lightweight, either). That leads to a cost factor of about 3.5 between component A and component alternative B, with handling disadvantages, lesser reliability and supply chain changes. No wonder the car industry isn't pushing in that direction. (And, by the way, they have excellent lobbying.)
H: Windings of BLDC motor I learned an algorithm for winding a BLDC motor. This algoithm has the windings crossing several stator teeth similar to this image: When I google BLDC stator, I see way more images like this : In this image, the windings mostly go around a single tooth. They do not span multiple teeth awkwardly. This second version looks much easier to wind... So my question is, the second version... Does winding a motor like that make it lose efficiency? If so, how much efficiency? I am building just a practice motor, so I don't really care if its 100% efficient if it would be easier to wind! Also, can anyone recommend some good modeling software to model the magnetic fields? I saw this program "motorsolve" but it looks expensive! AI: In short: go for the second motor! Motor topologies The second motor has what the litterature refers to as concentrated windings, and the former has distributed windings (and also stator skew encompassing a whole slot). As I see it, the main benefits for concentrated windings compared to distributed windings are that they: Are simpler to wound => cheaper Have less end windings (more important in short machines) The main drawback is, as you suspect, losses. The concentrated windings have more harmonic contents in the magnetic flux, due to not having the smoothness gained by distributed windings (and also sometimes stator skew as seen in your first figure above). These harmonics lead to significantly larger magnetic losses in the iron core. I learned a lot about this by reading Design of Rotating Electrical Machines, by Pyrhönen et al, so that’s my recommendation if you want to dive deeper. Magnetic Fields How to simulate magnetic fields is actually very well known. There’s no need for expensive tools. I used the free FEMM solver for a PhD level course in numerical motor analysis. It can compute quasi-static frequency dependent solutions, and get really nice results when compared to reality. It has some examples to get you started. From a quick inspection of the Motorsolve package: I think you get nice pre-made geometries with boxes to fill in your sizes and shape factors etc. So the drawback of using a free solver is that you have to draw the geometry yourself. But that’s exactly what I did in the course I mentioned earlier: complete reverse-engineering of a professional machine sawed into two. I can recommend it as an exercise.
H: small audio amplifier (voltage converter) output DC bias problem Update The circuit I used was wrong as answered, the output cap needs to be polarized in reverse from the drawing. It otherwises causes the DC bias! Except that the cirucit is working fine, I am using it to power a raspberry PI audio from 1Vpp to 3Vpp I have built a small audio amplifier to convert a 1vpp audio signal to 3vpp. This signal is then fed into a strong amplifier with input impedance of around 6k. The main signal I am going to drive is around 60Hz. Here is the circuit I used as base: I left out the cap next to RB (maybe a mistake?), RL is 6K in my case. At first I had big issues with this circuit, once I added 6k as RL the output signal broke down. I changed the output capacitor from 0.1uF to around 4uF because it acted like a high pass filter and this seemed to have caused the voltage breakdown. Now the voltage is mostly stable when I add RL (6k) but I have a DC offset at my audio output of about 2V. The audio signal is looking perfect, 3Vpp but it's on +2V offset. My guess: The Ra/Rb resistors are not perfect, so the middle voltage on + of the opamp is not perfectly centered, this causes the capacitor to be dragged up in voltage. How can I get the signal cenetered around 0V and is my guess correct ? AI: TL;DR output C is the wrong way round RA and RB set the +ve input voltage to 2.5v. C1(series with R1) breaks the gain back to unity at DC, so the output will be centred around 2.5v DC. C1(output cap) (see any problem with having the same C1 reference designator for several components?) should shift the output voltage to zero DC across RL (I assume RL will be in parallel with CL, see any problem with not showing all components on the schematic that are mentioned in the text?). If you and I are using the same graphical convention, then C1output is a polarised capacitor, with the +ve terminal to the curved side (the symbol for a non-polar cap uses two straight lines). That means it is reverse biassed. A reverse biassed electrolytic will support a small voltage across it, perhaps half a volt, before the dielectric breaks down and it begins to conduct. Your measurement of a 2v output offset is completely consistent with an average DC output from the amplifier of 2.5v, and only 0.5v across the capacitor. BTW, the cap in series with R1 is the right way round. If the cap in shunt with RB is indeed polar, then it is reverse biassed, and if present would be expected to pull the voltage at that node down to less than vcc/2. However, at the value shown, it's more likely to be a non-polar capacitor, so will not disturb the voltage, regardless of how you've drawn it.
H: Address decoding I'm currently working on a task where I'm supposed to find the memory address of the following external bus interface of a microcontroller (logical 0, CS-signal) However, I am uncertain of how to solve the issue. I managed to find the the memory address of ROM and RAM 2. ROM (HEX): 0000 - 00FF (0000 0000 xxxx xxxx) RAM 2 (HEX): 8000 - FFFF (1xxx xxxx xxxx xxxx) Here's my idea of RAM 1: 8000 - FFFF (1xxx xxxx xxxx xxxx) RAM 1 and 2 can't have the same memory address obviously, so what am I doing wrong? What is the memory address of RAM 1? Thanks in advance! AI: Let's start by labelling some bits of the diagram for easy reference: Now we can define what the different labels mean. A is HIGH if any of A8-A15 are HIGH. B is NOT A C is HIGH if either B or E (which is A15) is HIGH D is HIGH if B is HIGH and E is NOT HIGH. E (as I mentioned) is A15. So we can make some boolean expressions now: A = A8+A9+A10+A11+A12+A13+A14+A15 B = ¬A C = B+E D = B+¬E Expanded: C = ¬A+E D = ¬A+¬E Since CS is always active LOW you are interested in the FALSE values of those expressions - the values that make the expression result in an answer of FALSE. So if any of A8-A15 are true then A must be true, ergo to get A to be false NONE of A8 to A15 can be HIGH. So A will be LOW for address range 0b00000000XXXXXXXX (or 0x0000 - 0x00FF) If either B or E are true then C is true. Therefore B and E both have to be false for C to be false. E is A15, so we know now that A15 must be LOW to ensure that C can be false. A has to be true since it is negated to form B. So one of A8-A14 must be high to make A true and thus B false. That leads us to the address 0b0YYYYYYYXXXXXXXX where at least one of Y must be high and we don't care about X. That is, anywhere between 0b00000001XXXXXXXX and 0b01111111XXXXXXX, or in hex: 0x0100 to 0x7FFF. D is the same as C except for the fact that E is inverted. That means that A15 must be HIGH to make D able to be false. Since A15 is high we have the ability to set A8-A14 low and still be valid for this range. So we get 0b1YYYYYYYXXXXXXX, or 0b10000000XXXXXXXX to 0b11111111XXXXXXXX, or in hex: 0x8000 to 0xFFFF. To put those address ranges in context let's build a full memory map:
H: Which flux type to use for SMD hobbyist (home-made) PCB? "Short" question Which flux type to use for SMD hobbyist (home-made) PCB? How to know if a specific flux (e.g. F-SW-33) is no-clean or require cleaning. How to know if a specific flux conduct electricity? What is the impact of Halides? Longer question, including context and previous researchs I just had a hard time searching why my SMD circuits was not working properly, up to the moment I found the flux deposit was conducting enough to switch some transistors ON. After some research, I found the following info: Wikipedia flux specification differenciate types: Base material: Resin, Organic, Inorganic Corrosivity: not, weak, strongly. With/Without Halides Base component etc. Different types as: no-clean (which unintuitively do not need to be cleaned) water-soluble etc. On the other side; With my poor understanding of PCB fabrication, the process is simplified to: The circuit is printed (UV-positive painting, exposure, development, etching) I protect the circuit with some soldering mask/protection (recommended) Silk-printing (optional) Soldering (using flux) Cleaning of flux ? But, how to clean below SMD small resistors or IC? That seem to me not an easy task. My conclusion is: Better use a no-clean flux, or at lest a non-conductive flux. But which type match this specification? This answer suggest that for electronic I should only use Rosin flux. Is that generally correct? or could an F-SW33 fill the task? Are all the F-SW26 to F-SW32 equally good? Related questions: Specific solder wire/flux questions Solder Flux Classifications AI: If a flux is "no clean" it means it doesn't, under normal circumstances, conduct electricity. The exception is when the flux gets burned by too high a temperature and turns brown. At this point it can start to conduct due to carbon deposits. Water soluble flux conducts and must be cleaned before use. My personal choice is to never use water soluble flux and to clean flux off with isopropyl alcohol as a matter of course. I have two fluxes - one in a pen form and one in a syringe. I find I use the syringe one more than the pen one these days. Both are Rosin based. As always the exact properties and handling / cleaning instructions can be found in the datasheet. Fluxes designed for metalwork, such as soldering pipes, is generally an acidic flux and must never be used on PCBs or it will corrode things horribly. Only ever use electronic-grade flux.
H: There are multiple things to be discussed regarding LEDs and KVL simulate this circuit – Schematic created using CircuitLab I have 3 Red LEDs and a 3 volt cr2032 coin cell. All the LEDs are in series with the cell. Obviously, none works as the combined forward voltage is more than supply voltage. But voltage across each LED is 0.12 volt, but it should be around 1 volt. The main problem is with sum of the voltages; the supply voltage is showing 2.88 volts on multimeter whereas adding the voltage across each led gives me only 0.36 volts. Where is the rest of the voltage? since Total voltage = V1 + V2 +V3. Is there any theory behind it? The same problem occurs with LEDs of different forward voltages with the same cell. For example, white in series with red. I think that when these LEDs are in series there is a small current flowing through the circuit. And according to its V-I curve, for that small current, LED gets a particular voltage across it. Because when only 2 LEDs of same forward voltage (same colour) are in series they satisfy V=V1 +V2. Please help with this one and thanks already. AI: The term non-conducting is misleading. Even in reverse polarity a LED's internal resistance is not infinity but still has a (very) high resistance that can be measured or found in the datasheet as I-sub-R (reverse current). Replacing the LEDs and the DMM by their resistive values it is easy calculating their parallel (LED and DMM) and their serial resistances. It is a simple Voltage-divider circuit, but you should be aware that the voltage measured at each node is depending on the DMM connected parallel to it or not. If you put DMMs parallel to each LED at the same time the sum of the voltages will add up to the input voltage. But still the measured voltages are different to those that exist without the DMMs. E.g.: 100 MΩ parallel 10 MΩ = ~9 MΩ. 100 MΩ || 100 MΩ = 50 MΩ If the DMMs internal resistance is not substantially higher than the internal resistance of the subject to be measured then the result is rather far away from reality.
H: Floating USART line cause uC reset I am working on a project using Atmel SAMD20 microcontroller (anyway, my question is in a general aspect, so I think this should not affect the answer) I use an USART to connect my board to the serial port for debugging purposes, TX and RX lines are directly connect to CP2102 RX and TX respectively and I send debug information through the serial port during the whole execution of the program. When developing stage is over and the product is in use, these pins are no longer used and are left floating. Everything was fine until I detected that putting noise (just touching BOTH lines with my hands) cause a hardware reset in the uC and the program stop working at all. I suspect that the uC is interpreting that noise as a signal and causing infinity USART interrupts. What can I do to ignore signal on these pins when the CP2102 is not connected? What I've tried: Setting a pull down in RX pin. Didnt work. What I definitely CANT do: Have two different boards, one for developing and another without those pins when the product is finished. What I could do: Have two different firmwares. One for developing and another for production removing all code related to that USART, avoid it's initialization and sending information through it. But is this the best solution?? Is there any hardware or software change I could do to avoid this problem using just one firmware? Many thanks! AI: Setting a pull down in RX pin. Didnt work. Bad idea, that would be detected as a break. Use a pullup resistor for RX, as UART signals are idle high. Everything was fine until I detected that putting noise (just touching BOTH lines with my hands) cause a hardware reset in the uC and the program stop working at all. Touching signal lines with bare hands may cause ESD, and no, the MCU is not supposed to work properly in that case.
H: How to eliminate noise from switched power supply I have an isolated switching power supply (120v in, 12v out) that gives an output shown in Figure 1 when referenced to the output ground (I'm not TOO worried about that noise). The bigger issue I have is the noise I have when referencing the output voltage to the input ground shown in Figure 2. To me it looks like the differential mode noise is acceptable but there is a ton of common mode noise but I am not 100% sure how to go about fixing this. I read a lot about common mode chokes but I am not exactly sure how to choose the correct one. EDIT: So to give the full story to clearify. I have a touchscreen that is picking up random touches only when powered by the power supply described. I have already tried full power and signal isolation and power regulation which was able to get rid of nearly all differential noise. The only noise still getting through is all common-mode. Also, I only have the option to fix this issue on the touchscreen circuitry with no ability to alter the power supply. A simple fix would be to bridge the input and output grounds with either a jumper or cap but unfortunatly, this cannot be done. Figure 1 Figure 2 AI: The core of an isolated switch mode power supply is still, though cleverly switched, a transformer. Thus, your problem is the same as this circuit: simulate this circuit – Schematic created using CircuitLab The whole point of an isolated supply is that there's not a single conductor from the primary to the secondary side. Therefore, you can imagine the pair "OUTPUT+" / "OUTPUT GND" to have a defined voltage between them, but they float on a "random" offset relative to the primary side's Ground. That offset doesn't actually contain much energy, and you can break it down very easily, for example by connecting "OUTPUT GND" to primary ground (thus eliminating the isolation!).
H: Driving IRF540N with darlington I'm trying to drive MOSFETs with 3.3V PWM signal. Here is a (probably bad) circuit: I know that a darlington is not the best thing to drive a mosfet with. But actually I need to drive many of them and the ULN2003A is very comfortable: 7 darlingtons in a single package, and it is cheap. I can buy them for $0.1/piece, whereas a dedicated MOSFET driver IC costs much more and can only drive a single MOSFET. In the above circuit, I have used R2=100 Ohm. I noticed that most circuits use at least 1K for pulling up the gate of the FET. But I want to be able to switch the FET relatively fast, at least 500Hz. The threshold voltage of the FET is about 2V, and the input capacitance is 1800pF. That is documented in its datasheet. What I don't see in the datasheet is the gate saturation voltage (maybe I'm looking at the wrong place). But I guess it is fully open at about 10V. I may be totally wrong, but I tried to calculate the time needed to fully charge that capacitance through a 100 Ohm resistor: http://mustcalculate.com/electronics/capacitorchargeanddischarge.php?vfrom=0&vto=10&vs=12&c=0.000001800&r=100 It seems that it reaches 10V in 320uS. That gives me 1.6KHz max. switch frequency. The charge/discharge peak current is 120mA. It is way below what an ULN2003 can handle. Peak power on the resistor is 1.44W. Which is quite high, but I want to switch at 500Hz only, and it easy to get a 1W resistor. I guess the extra power discipation on the resistor pays of because it opens the FET much quicker. The ULN2003A collector-emitter saturation voltage is below 3V, input current is less than 1mA and it can sink 500mA - more than needed. But I still feel that I'm missing something. Usually I do not see others driving FETs with darlingtons. That must not be by coincidence. Am I missing something? Would this circuit work? And once again: I know that a dedicated MOSFET driver IC would work better, but using 20 MOSFET drivers for $100 vs. using 7 darlingtons for less than $1 makes a big difference... AI: A 100 ohm resistor has a CR time of 180 ns when charging a 1.8 nF capacitor (the gate). 5 CR gets you easily to within about 99% of fully charged hence your rise time will be about 0.9 us. I'd be a little concerned about the ULN2003A not properly turning the MOSFET off. According to the data sheet it will get down to about 1 volt with a 100 mA load and some MOSFETs might still be partially turned on even with 1 volt on the gate. I think you'll be OK with the IRF540 though. If in doubt, you can always try the TPIC2701. It has 7 outputs and the same pin-out as the ULN200x but, importantly, the output switches on to near 0V because it uses a MOSFET with 0.5 ohms on resistance: - In some applications you may not even need to use the IRF540.
H: Goral Oscillators I am studying Colpitts oscillators with one single JFET. These circuits are well known. However, I experienced that I sometimes have start-up problems. I know this is related to the loop gain being too low. I the book 'Practical Oscillator Handbook' by Gottlieb I found the Goral oscillator. I modified my circuit and found out that the Goral oscillator works much more stable and reliable than the ordinary Colpitts. However, besides the mentioned book I didn't find any other sources about those Goral oscillators, this is why I think these are not very well known or they must have some drawbacks I didn't find out so far. After whom are they named, what is the theory behind them and what are their pros and cons? AI: The goral oscillator used as a VCO: - Taken from here. Adding an emitter follower just boosts the drive current to the centre tap point of the capacitors in what would otherwise be a standard colpitts oscillator. I've used this design in a capacitance probe based on the probe feed line being a tuned half wave resonant transmission line. However, it wasn't something that I knew about beforehand but something that was developed to solve a problem indicated below. Because the t-line can present a very low impedance (especially at high temperatures of +1000 degC) the extra drive capabilities of the emitter follower make this a good solution. I have no idea why it is called this name but, after a quick google I think it is named after a guy called Pierre B. Goral. The main drawback is that because they use two transistors in cascade, the highest frequency the pair can oscillate is limited to the low to mid hundreds of MHz (currently).
H: Is it possible that I fried an MCU pin by performing a continuity test I have a microcontroller (dsPIC33EP64GS506, 64-pin, TQFP, link to its datasheet), which doesn't seem to work on 2 GPIO pins (pins 4:RC0 and 11:RC11), whereas all other pins are functional. The problem with these two pins is that they are directly connected to GND, even when the MCU is not powered. I tested all neighboring pins with continuity check to check for possible short circuits (bridges between pins), using a Fluke 179 multimeter. None of the neighboring pins are short-circuited. Now, MCU pins are 3.3 V tolerant, and some of them are 5 V tolerant. In the multimeter's User manual, it says that the open circuit test voltage is <8.0 V DC, and the short circuit current is <1.1 mA. Is it possible that I fried the two MCU pins using this continuity test? I have two equal boards, the other one seems to work just fine. Is it possible that I fried these pins while soldering? I've soldered the MCU on 300 °C with a 2.2 mm tip. I found the error. It was due to the bad PCB manufacturing - via is connected to the ground plane, and it shouldn't be. See attached image. I've fixed this by cutting the ground plane around the problematic via. AI: Both scenarios (damage from using a multimeter or damage of a particular pin from soldering temperature) are very unlikely. My guess is that you either have a firmware problem (some sharing of peripherals that have to be disabled) or you have damaged them in some other way such as too much voltage from ESD or an ungrounded soldering iron tip. Since you have a board that is working (presumably? with the same firmware), it would have to be something that is undefined during startup to be a firmware problem.
H: Relation between Resonant frequency and Resistance in series RLC circuit simulate this circuit – Schematic created using CircuitLab I have a series RLC circuit and I calculated the resonance frequency. Say its w (omega). Now in second experiment, i use the resistor of half the value used in above ciruit. What effect will it have on my resonant frequency now? Example: Experiment 1: C = 100nF, L = 100mH, R = 100ohms Experiment 2: C = 100nF, L = 100mH, R = 50ohms Only resistor is changed. Nothing else. AI: What effect will it have on my resonant frequency Theoretically it will have no effect on the resonant frequency. The resonant frequency is purely determined by the capacitor having exactly the opposite reactance of the inductor at a particular frequency and the two reactances cancel leaving the series tuned circuit having only resistance at resonance. However, with lower values of resistance the peak shape of the resonance will change but the centre point of the peak will remain as previous.
H: What's the purpose of the components shown in this circuits? I have a question when studying a power switch circuits. As shown in the picture below. It's an switch to enable 12V and 5V to the system by EN signal. My questions are: What's the purpose of C2, C4, C5? What's the purpose of D1, D2, R3, R4? Thanks a lot for any reply! :) BR, David Wu Hi Olin: Thanks for the detailed feedback! :) I still got few questions about your answer and hope that you can give me some hints.... Add more pictures for discussion. For C2/C4/C5, you said that they are there for slop control. I add another picture to show the possibe charging current. Take Q3 and Q4 for example, did you mean that due to the existance of C4 and C5, the voltage built on drain node of Q3 and Q4 will be lower than not having C4/C5? Same idea for Q2? How about the turn-off slop? Still controlled by discharging this C ? (See pic 1 and 2 below) There comes a another question, when Q3 and Q4's gate go high, will it boost the drain at the same range, due to C4/C5 existance? Will drain voltage exceed 12V then? (same situation when Q3 from off to on, will drain be coupled to negative voltage first?) For Diodes, I think you mean that they are used to make charging/discharging time symmetrical. Charging : 12V => 4.7K => D => Q3 gate Discharging : Q3 gate => 100K => Q2 on resistor Not sure if the resistor value make sense to balance the timing. (See pic 3 below) Is C3 there only for compensate the charging time of Q2's gate? Thanks a lot for all the helps!! David AI: C2, C4, and C5 all slow down the switching edges. These are probably a attempt at slope control. Note that this kind of slope control lengthens the time the switching elements are kept in the transition region between full on and full off. This can significantly increase dissipation, which needs to be taken into account in the design. D1,R3 and D2,R4 cause the final switches to be turned off quicker than turned on. The diodes conduct when the gate voltages are slewed up, which happens when the switches are turned off. A forward biased diode will have roughly constant voltage across it, so the coupling from the output of Q2 to the gates has low impedance. When the gate voltages is slewed down, the diode are reverse-biased. This means they are in effect not there. The resistors now couple the output of Q2 to the gates. That, together with the gate capacitance and the extra deliberate capacitors C4 and C5, cause the switches to be turned on more slowly then they are turned on. One reason for the asymmetry introduced by the diodes and their parallel resistors may be to compensate for the higher Q2 output impedance when driving high. When Q2 is turned on, it actively drives its output low. When turned off, that same node is only passively pulled up by R2. Since values aren't shown, we can't tell if the slow rise due to R2 dominates, or the slow fall due to R3 and R4, or if they are roughly balanced. Note that Q1 and R1 introduce yet another rise/fall asymmetry. Q1 will actively drive its output low, which is then passively pulled up only by R1 to go high. Again, without values we can't tell the relative strengths of these various asymmetries, and therefore which ones dominate, or whether they roughly balance each other out.
H: Micro controller power up reset I came across this circuit in pioneer brand vsx522 model amplifier circuit diagram. This supposed to initialize the microcontroller during AC power up. But it looks like wrongly drawn. The resistor on the left is directly connected to the 3.3V linear regulator which is powered by a tiny mains 240V 50 Hz standby transformer. The output of this circuit, at least in my perception, is used to initialize the micro controller and it looks like will locked up at high state (3.3V) indefinitely. The transistor and everything else around it cannot pull the RESET to low. Am I right? Or do I miss anything? The values of components are not fully specified. AI: At first I thought there were 3 errors and then considered what the spec should be. Either way, it looks wrong because there is no base DC pull down to 0V so cap. current makes it have a hair trigger on Vc spikes via diode capacitance . If you put 30pF across each cap and make input R=100 and 1M to R to ground, you might see a 10us reset pulse. but act like a glitch detector and not a good PoR. ok for logic but uC usually expect 100ms if used for uC reset then reverse top diode and swap bottom R and C. then it will protect Vbe and ignore input glitches with high in, low out for base RC time constant to drop to 0.5V from input high to guarantee output high after >100ms
H: Weird Temperature Reading Fluctuations, LabVIEW Click the "edit" link below the image in the preview instead. --> simulate this circuit – Schematic created using CircuitLab First I apologize for the crappy drawing, but I wanted to give a basic overview of what it looks like. It doesn't show my breadboard though so those unnamed ports that look like they go into the Arduino actually go into the power and ground slots on the breadboard which are then connected to the Arduino. I have a temperature 514TC sensor that I am connecting to my Arduino MEGA and I am reading the outputs from a LabVIEW VI. My question is that I also have a voltage divider on my breadboard and it causes my temperature readings to fluctuate. The thing is though, it only fluctuates IF I read both the temperature and voltage at the same time! So if I keep everything the same and only read the temperature the outputs are fine, but if I try to read the temperature of my sensor and the voltage of the voltage divider the outputs start to fluctuate rapidly. Does anyone have any idea how to fix this? EDIT: The pictures show the heart of the problem. You can see in the blue picture of temp and voltage I get fluctuations. You can see the points where I removed power from the voltage divider and gave it back power. The bottom picture has everything the same but I read temperature only and I get no fluctuations, even with the voltage divider receiving power. AI: from web ... The limitation of the 328p's ADC speed is not related to the clock speed or a sw driver, but it is related to the internal ADC sample and hold system (S/H). The ADC must sample the incoming signal such it charges an internal S/H capacitor (~14pF) through an internal resistor (up to 100kohm) to the exact voltage as it is at the analog input pin. When the S/H cap is "charged" enough, ADC disconnects the S/H cap from the analog input and does the ADC conversion of the internal capacitor's voltage. The value of this internal S/H component (its RC constant) is too big for a fast 10bit conversion (as you cannot charge the internal S/H capacitor fast enough via the internal resistor because the resistor is large in its value). So even when you make the fastest conversion in your code, the internal S/H capacitor is not being fully charged (it means charged up to the level of the voltage at the analog input's pin) and you do the ADC conversion with much less precision (ie. 7bit only). you could try two successive readings and toss the first to see the change, but that slows the sample rate. if true, then your source impedance is too high and 0.01uF cap across Vin to port will eliminate this glitch.
H: Is there a pin header with 3mm pitch similar to the 0.1" pitch headers? Is there a standard pin header with a 3mm pitch that is similar to the common 0.1" pitch pin headers (shown in photo below)? I'm not even sure what the correct name for these are. What is the best way to search for a part like this on Mouser or Digikey? My searches keep coming up with weird shrouded plastic housing things. Thanks! The part I was interested in connecting to is similar to this, with half-holes along the edges: AI: Google found many examples. For example: http://wppro.com/content/en/products/pin-headers/3mm-pitch/product/973.html
H: Red wire 12V or 5V... How to tell? This is my first post on Electrical engineering, so bear with me. I'm making a project for school that is supposed to mimic a wind turbine. So, it will use a case fan for a computer as the "turbine". When looking at diagrams on Google, I see that there are usually only 4 wires: yellow (tachometer) black (ground) black (ground) red (12V or 5V). Some diagrams literally say 12V or 5V. My question is: how do I tell what the red wires voltage is? I would prefer 5V. Thanks in advance! I can provide more info if needed. Edit: like this: https://youtu.be/jiAhiu6UqXQ AI: I'm making a project for school that is supposed to mimic a wind turbine. So, it will use a case fan for a computer as the "turbine". If you mean that you intend to blow air at the case fan and use it as a generator, I have bad news: that won't work. Most modern computer fans use a brushless DC motor design. These motors cannot be "back-powered" to run as a generator, as they depend on electronic controls to drive the stator coils. If you plan to simply run the fan, though, standard computer case fans are all designed to run on 12V. They may run slowly on a 5V input, though.
H: Phase shifting DC+AC audio signal without affecting its DC content I have a strongly and asymmetrically clipped audio signal (green signal on attached picture), with DC bias content (blue signal). In order to obtain the exact DC bias level of this composite signal later, first I would like to phase shift the signal with 180 degrees, without affecting its DC content (red signal on the following picture). The inverting op-amp configuration change the polarity of the DC content too, it can not be used in this case. Is there any possible solution in the analog signal domain? For the time being I don't want to switch to digital domain. AI: Your method of extracting the bias voltage will only work if you know the nature of the original AC signal and can infer the zero crossing point from its shape. It will not work for an arbitrary waveform which has been distorted by your circuit. For example, imagine the output is a square wave going from 0 to 1V. How much (if any) of the bottom half of the original wave has been cut off? You don't know! What shape was the cut off part? You don't know! Since that information has been lost there is no way to reconstruct the original AC waveform, and no way to determine its average value (DC bias point).
H: Reading from ROM and Generate a VGA Signal in FPGA I have generated a VGA signal, and succeeded to draw a rectangle. I have also code for ROM designed using VHDL, and initialized with a file that has patterns. I'm beginner in VHDL and FPGA. I would like to read the contents of the ROM and use the VGA generator to display the contents. here are the codes. LIBRARY ieee; USE ieee.std_logic_1164.all; ------------------------------------------------------------------ ENTITY rom IS PORT (address: IN INTEGER RANGE 0 TO 15; data_out: OUT STD_LOGIC_VECTOR(7 DOWNTO 0)); END rom; ------------------------------------------------------------------ ARCHITECTURE rom OF rom IS SIGNAL reg_address: INTEGER RANGE 0 TO 15; TYPE memory IS ARRAY (0 TO 15) OF STD_LOGIC_VECTOR(7 DOWNTO 0); SIGNAL myrom: memory; ATTRIBUTE ram_init_file: STRING; ATTRIBUTE ram_init_file OF myrom: SIGNAL IS "rom_contents.mif"; BEGIN data_out <= myrom(address); END rom; VGA Generator Code architecture Behavioral of VGA_display is -- Intermediate register telling the exact position on display on screen. signal x : integer range 0 to 1023 := 100; signal y : integer range 0 to 1023 := 80; begin -- On every positive edge of the clock counter condition is checked, output1: process(clock) begin if rising_edge (clock) then -- If the counter satisfy the condition, then output the colour that should appear. if (hcounter >= 1) and (hcounter < 120) and (vcounter >= 1) and (vcounter < 120 ) then pixels <= x"F0"; -- If the condition is not satisfied then the output colour will be black. else pixels <= x"00"; end if; end if; end process; end Behavioral; Currently I'm getting that from simulation result. AI: I have not written in VHDL for a long time but what you need to do would be something like this. Instantiate the rom and connect the signals, e.g. rom1: rom port map(address => addr, data_out => pix); Somewhere appropriate, you assign the address by flattening the horizontal and vertical counts: addr <= vcounter * 120 + hcounter; This is likely to have type checking issue with VHDL as is. With this you would be relying on the synthesizer to optimize the x120 and add operation. I would waste 8 bytes/words to make each horizontal line occupies a power of 2 (=128) number of words, then I would write this in bit-slice operations and this would be a lot more efficient. Finally, use the output pix inside your VGA_display block, such as: pixels <= pix;
H: How to choose electric motor for a linear actuator? First of all, I'm an undergrad student of Mechanical Engineering, and I'm working on a project where the main component is a type of linear actuator which I'm going to design. I will use a roller screw mechanism for the actuator, and it's main job will be to compress some material. One of the specifications for this project is that the electric motor needs to deliver between 2-3 horsepower, and still be precise enough to control the speed of the linear actuator (between 0.5 and 2 mm/s). Which kind of electric motor should I use for this project? I've thought about using a commom electric motor like this one (link) with a reductor. Would that be enough? I have little background in electrical engineering, so any insights would be helpful. AI: You have selected a 3-phase induction motor. To control the speed, you will also need a variable frequency drive (VFD). I suppose "Apto ao uso com inversor de frequência até 575V" refers to the VFD. Depending on the capabilities of the selected VFD, that combination will probably provide what you need. You need to determine the range of required motor speeds required and amount of deviation from set speed that can be tolerated. With a good VFD, the motor can be expected to deliver the rated torque for full speed at reduced speeds down to nearly zero speed. The motor may need a separately driven cooling fan to avoid overheating if operated at below perhaps 1/2 or 1/3 speed for longer than a few minutes. You would need to get the details for that from the motor manufacturer. You can expect a good VFD to hold the speed at the set speed regardless of load change with a deviation of about 0.1 to 0.5% of full speed. Get details from VFD manufacturer. You can probably find a VFD that will allow the motor to deliver rated torque while stalled and the motor will probably tolerate that for some period of time depending on cooling. Get details on stalled torque deviation from VFD manufacturer.
H: What am I misunderstanding in electrical circuits regarding voltage/current/resistance I thought I understand electricity but some thing don't add up so I'm hoping someone can tell me what I am doing wrong. So, to me, voltage represents a potential ability/energy of a charge to do some work/to transfer energy. Resistor uses some of that energy to heat itself or do something else (doesn't matter what really), in order to drop the voltage of the charge. By dropping voltage, it also reduces the current (because the charge is now 'less needy' to get to the other terminal). With this understanding of electricity, I tried to understand the following circuit: simulate this circuit – Schematic created using CircuitLab The Voltage source is 3V. The current is easily calculated as 1A. So the story goes: Source is giving 1 amper of current an 'ability' of 3 volts. The first resistor causes a 2V voltage drop. Now that amper has only 1 volt of 'ability' left. The current reaches the branch. It divides equally, 0.5A goes to each branch. But the resistance of the resistors in parallel branches is 2 ohms, and I only have 1V left per ampere! Not only that, but my current that passes through the resistor is not even 1A anymore, now it's only 0.5A, which means it has only 0.5V of 'ability' left! So what's going on here? A side question that arises: By Kirchhoffs laws, the sum of voltage drops has to equal the voltage of the source. So in the end, the voltage of a charge is 0 (after it passes thorough the last resistor). Why does it even move then, if it's 'willingness' to get to the other terminal is now 0? AI: I'm going to zero in on your mistake: Source is giving 1 ampere of current an 'ability' of 3 volts. Funny use of terms, but okay. In my terms, 3 volts per ampere is the same thing as saying 3 Ohms. The first resistor causes a 2V voltage drop. Yup. It takes 2 V of motive force to cause 1 A of current to flow through 2 Ohms of resistance. Now that ampere has only 1 volt of 'ability' left. Now you are 'okay' but starting to tread on thin ice. But yes, there is 1 volt of potential difference remaining and all of the 1 A of current that has arrived at this point, must then also leave this point. And to do so, it must only face one remaining Ohm of resistance. The current reaches the branch. It divides equally, 0.5A goes to each branch. Yes. The remaining potential difference (1 V) can only cause 0.5 A in a 2 Ohm resistor. Luckily, there are two of those resistors, so luckily all of the incoming current can find an outgoing way to move given the remaining potential difference. But the resistance of the resistors in parallel branches is 2 ohms, and I only have 1V left per ampere! Here's where you suddenly jump tracks. One volt per ampere means one Ohm. That's what it means. And it turns out that there is only one Ohm there, too. Good thing. Let me re-write your statement: "But the resistance of the resistors in parallel branches is 2 ohms, and I only have 1 Ohm!" I didn't change one whit of meaning there. It says exactly what you just wrote. But now you can see that there is a conflict. You are simultaneously saying there is 2 Ohms and there is 1 Ohm. And that doesn't make sense. The fact is that there is 1 Ohm between the two points under consideration, not 2 Ohms. Yes, there are two galvanic paths and each of these paths represents 2 Ohms, apiece. And the current will only be 0.5 A for each of these two paths, like it should be. But the combined result is still 1 Ohm and the combined current will still be 1 A. You just need to fix your mental models.
H: Difference between positive and negative LCD drive I have a positive type custom ordered LCD with 60 segments. Display type: Reflective Duty: 1/4 Bias: 1/3 Now, i want to replace the positive LCD with negative type. The LCD is presently driven directly by the micro controller. (MCU has dedicated LCD driver, SEG and COM pins, direct connections). Question: Do i have to change anything in the MCU firmware? I believe i need not. Except the addition of back light control, because it is a negative mode display. AI: I received the response from one of the LCD manufacturer. According to them the LCD interface will remain the same irrespective of Positive or Negative LCD.
H: Difference between select lines and control lines in Digital circuits? I want to know about the conceptual difference, not a specific case. AI: A select line selects something, like a specific chip. A control line is a line that controls something. A select line is a form of control line, along with such things as read, write, etc. Common names for control lines include: /CS - Chip Select (a select line) /SS - Slave Select (a select line used in SPI) /RD - Read /WR - Write RD/WR - Read / Write /OE - Output Enable /EN - Enable The list goes on. Broadly speaking, in a traditional parallel CPU bus, the control lines are all the digital signals that come from the CPU (or go to it) that aren't the address and data, and select lines are decoded from the address bus. In other systems though that is not always the case.
H: Refreshing flash memories. Does it work? We all know that the flash memories have data retention time of around 10..20 years. But what if we need to design a device that has to work for 1000 years? The obvious solution is to make a flash reprogramming once every 5..10 years, refreshing the charges in the memory cells. If the flash memory has 100K writing cycles life, it makes 500K..1M years retention time. Almost infinity. But the obvious way is not always the right way. So, is it possible to prolong the data retention time of the flash memories almost infinitely, by reflashing it every 5..10 years? AI: Rewriting flash is indeed a mechanism to extend flash retention when your device is running in a high-temperature environment (at lower temperatures, flash retention is not so much a problem). Texas Instrument's application report MSP430 Flash Memory Characteristics (which should also apply to all other NOR flash-based MCUs) says in section 4.2 ("Enhancing Flash Data Retention Time With Flash Refresh"): As explained in the previous section, data retention time is very much dependent on the ambient temperature of the MSP430 application. One possible solution to enhance flash data retention is refreshing the flash contents from time to time with software. In an ideal scenario, the application has idle time frames, where no external events must be observed. During such an idle time, the software can copy one flash segment into RAM or any other flash segment. After erasing the original segment, the content is copied back into the original segment. After such a flash refresh cycle, the data retention time for this segment restarts. [...] CAUTION The application must ensure that flash refresh of a flash segment is not interrupted by a power failure.
H: Picking correct level of resistance for a voltage divider I want to measure my DC voltage source (aka batteries), vs my known Dc voltage from my DC-DC regulator. To do this I'll need a voltage divider. I can calculate the resistances I need - but what I'm not sure about is the over all level of resistance I should go for. If the voltage divider resistance is to low, I'll be burning current for no effect. If it's excessively high.... is there any downside if the current is near zero? Should I just got for 100K ohms and leave it there? The math is easy. But picking the right target? That's hard. AI: When you factor in the input impedance of the measurement device, your options will reduce but yes, there will be a range of values that can be chosen and you will tend to choose the option with the highest impedance that still produces acceptably low errors in measurement. For instance, the ADC inbuilt in such devices as a PIC micro will not want to see a signal impedance more than a few kohm. As you go to greater values than a few kohm, the measurement error will increase and this can be alleviated, to some extent, by adding a capacitor from input to 0V. So, read the data sheet for your measurement device, restrict your range of impedances and choose the highest set of resistors that give you an acceptable measurement error. Sometimes you find that there is no overlap and, in cases like this you would use a spare IO line to activate a MOSFET to connect your battery to a potential divider. Then you can use quite low values and get good measurement accuracy and the battery energy spent is only for a short period of time in the bigger picture of things: - Taken from this stack exchange answer (by me).
H: Are AVR multi-cycle instructions pipelined? Since AVR is a RISC architecture, most instructions only take a single cycle to execute. Still some need two or more cycles, e.g. adiw, which performs 16-bit addition, or ld to load data from SRAM. Do these execution times denote only the latency of these instructions, or does the processor actually wait this long before moving to the next instruction? Could I run, say, 6 two-cycle instructions, and the entire code would still only need 7 cycles to run? AI: Simple answer is nope. An instruction taking 2 cycles to complete will block any further instructions until it is done. Obligatory quote from ATMega328P datasheet: Instructions in the program memory are executed with a single level pipelining. While one instruction is being executed, the next instruction is pre-fetched from the program memory The pipeline is only single level, so the instruction being fetched cannot start execution until the one currently being executed is finished.
H: How to verify the contents of ROM in FPGA I'm new to FPGA and VHDL. I'm using Xilinx Spartan 3A. I have wrote a custom ROM with initalization file .hex. I would like to verify that the rom is initalized with the values in the .hex value. Is there a method to verify the contants that is loaded from the file. here is my design file LIBRARY ieee; USE ieee.std_logic_1164.all; ------------------------------------------------------------------ ENTITY rom IS PORT (address: IN INTEGER RANGE 0 TO 15; data_out: OUT STD_LOGIC_VECTOR(7 DOWNTO 0)); END rom; ------------------------------------------------------------------ ARCHITECTURE rom OF rom IS SIGNAL reg_address: INTEGER RANGE 0 TO 15; TYPE memory IS ARRAY (0 TO 15) OF STD_LOGIC_VECTOR(7 DOWNTO 0); SIGNAL myrom: memory; ATTRIBUTE ram_init_file: STRING; ATTRIBUTE ram_init_file OF myrom: SIGNAL IS "test.coe"; BEGIN data_out <= myrom(address); END rom; I have used a test bench and I tried to simulate a ROM using initialization file but I get undefined output according to that image. Test bench: -- Entity library ieee; use ieee.std_logic_1164.all; entity tb is end entity; --############################################################################# -- Architecture library ieee; use ieee.numeric_std.all; architecture sim of tb is --=========================================================================== -- Clock and reset decl. -- Clock constant CLK_FREQ : real := 100.0E6; -- Clock frequency in Hz signal clk : std_logic; -- Reset constant RST_PER : time := 100 ns; -- Reset period; and then waiting for rising clk edge before deassert rst signal rst : std_logic; --=========================================================================== -- Device Under Test (DUT) decl. signal dut_address : integer range 0 to 15; signal dut_data_out : std_logic_vector(7 downto 0); --=========================================================================== -- Test control decl. -- None begin --=========================================================================== -- Clock and reset impl. -- Clock generation process is begin while true loop clk <= '1'; wait for 0.5 sec / CLK_FREQ; clk <= '0'; wait for (1.0 sec / CLK_FREQ) - (0.5 sec / CLK_FREQ); end loop; end process; -- Reset generation process is begin rst <= '1'; wait for RST_PER; wait until rising_edge(clk); rst <= '0'; wait; end process; --=========================================================================== -- Device Under Test (DUT) impl. rom_e : entity work.rom port map( address => dut_address, data_out => dut_data_out); --=========================================================================== -- Test control general process is begin -- Wait for reset release and clock. wait until rst = '0'; wait until rising_edge(clk); -- Address apply and data output check for address in 0 to 15 loop wait until rising_edge(clk); dut_address <= address; wait until rising_edge(clk); -- Check output of ROM end loop; -- Run for a while wait for 1 us; -- End of simulation report "OK ########## Sim end: OK :-) ########## (not actual failure)" severity failure; wait; end process; end architecture; AI: Design functionality should be verified using simulation, for example Xilinx Isim or Mentor ModelSim. So make a test bench and instantiate the rom entity, and make a number of accesses to the module. The test bench can for example read the test.coe file with the expected values, and then test all addresses to be sure that the rom returns the expected values. Best bech template for kick start: --############################################################################# -- Entity library ieee; use ieee.std_logic_1164.all; entity tb is end entity; --############################################################################# -- Architecture library ieee; use ieee.numeric_std.all; architecture sim of tb is --=========================================================================== -- Clock and reset decl. -- Clock constant CLK_FREQ : real := 100.0E6; -- Clock frequency in Hz signal clk : std_logic; -- Reset constant RST_PER : time := 100 ns; -- Reset period; and then waiting for rising clk edge before deassert rst signal rst : std_logic; --=========================================================================== -- Device Under Test (DUT) decl. signal dut_address : integer range 0 to 15; signal dut_data_out : std_logic_vector(7 downto 0); --=========================================================================== -- Test control decl. -- None begin --=========================================================================== -- Clock and reset impl. -- Clock generation process is begin while true loop clk <= '1'; wait for 0.5 sec / CLK_FREQ; clk <= '0'; wait for (1.0 sec / CLK_FREQ) - (0.5 sec / CLK_FREQ); end loop; end process; -- Reset generation process is begin rst <= '1'; wait for RST_PER; wait until rising_edge(clk); rst <= '0'; wait; end process; --=========================================================================== -- Device Under Test (DUT) impl. rom_e : entity work.rom port map( address => dut_address, data_out => dut_data_out); --=========================================================================== -- Test control general process is begin -- Wait for reset release and clock. wait until rst = '0'; wait until rising_edge(clk); -- Address apply and data output check for address in 0 to 15 loop wait until rising_edge(clk); dut_address <= address; wait until rising_edge(clk); -- Check output of ROM end loop; -- Run for a while wait for 1 us; -- End of simulation report "OK ########## Sim end: OK :-) ########## (not actual failure)" severity failure; wait; end process; end architecture; --############################################################################# -- EOF
H: How to calculate output resistance impadence with using small signal analyse? Hello I am trying to understand calculating impadence of a transistor using small signal analysis. In the book I came across with following exmaple. It tries to calculate Rout. So I didn't understand how circuit at the left side have equivalent small signal analysis as circuit at the right side. I mean how Vin transported to emitter as Vx? I understand that Vin must be grounded for calculating Rout with one port input. But I can't see any relation about Vin and Vx. AI: You use the second diagram (with vin grounded) and apply a small signal test voltage (vx) and measure the small signal test current (ix). The important thing to realize is that you are measuring small signal parameters. Vin (large signal biasing input voltage) is assumed to be still exist, biasing the circuit in the linear region. But since you are only interested in the small signal parameters, you treat vin as grounded (measuring output resistance around the operating point of the circuit). For this circuit (which is neglecting the c-e output resistance, ro), and summing the currents at the node (and noticing that vx = -vpi) \$ i_x + g_m*v_{\pi} = -v_{\pi}/r_{\pi} \$ \$ i_x -g_m*v_x = v_x/r_{\pi} \$ \$ i_x = v_x/r_{\pi} + g_m*v_x \$ \$ i_x/v_x = (1/r_{\pi} + g_m) \$ \$ r_o = v_x/i_x = 1/(1/r_{\pi} + g_m) \$ Unless my algebra is incorrect somewhere. Also \$ r_{\pi} = {\beta}/g_m \$ So, \$ r_o = 1/(1/({\beta}/g_m) + g_m) \$ \$ r_o = 1/(g_m/{\beta} + g_m) \$ \$ r_o = {\frac1{g_m(1/{\beta} + 1)}} \$ Since \$ {\beta} \$ is large, this can be easily approximated to \$ r_o = {\frac1{g_m}} \$ Keep in mind this is ignoring both the input source resistance and the collector-emmitter resistance, so a very idealized formula.
H: Draw power from a portable mobile charger to power circuits I usually power my beginner prototype circuits using mb102 power supply board, but it needs an external elimeter to draw power and then regulate it. I was looking for a portable solution for my 5 volt and 3.3 volt circuit needs and came up with using a portable battery charger for mobile phones. I tried powering up a simple transistor and LED circuit with it but it wouldn't power-up. I feel that there is some load sensing circuit in the portable charger which doesn't detect these low power circuits. I also tried connecting different resistors to the charger, the charger outputs 5 Volts for a few seconds and then again shuts down and doesn't stay ON continuously. It would be really comfortable to use a portable charger since it could be charged using a phone charger and would be very handy. What can I do to make the charger output power on low loads? AI: What can I do to make the charger output power on low loads? You probably can't do anything reasonable. Charging power banks are designed to cut off power when they think the charge is done, when load drops below certain cut-off level. This condition will happen every time you connect-disconnect your project while debugging it. you can load it with proper resistor, but it will drain the bank battery quickly. you can reverse engineer your powerbank, determine what kind of PMIC (power management IC) is used, and disable this cut-off function if possible, but it is very doubtful. You need to design your own PMIC on the top of existing circuit, replace it with power management you need. This new design must have all features to charge and protect the powerbank battery, but will have no cut-off function.
H: High efficiency mosfet driver This is a follow up from Driving IRF540N with darlington I came up with a different circuit that uses jfet op amps and smaller fets instead of gate pull up resistor: The basic idea is that the opamps create a normal and an inverted 12V pwm signal. They open and close the 2N7000 fets. Those fets charge or discharge the gate of the power mosfet. Because the smaller fets are never opened at the same time, almost no current is needed to keep the power mosfet opened or closed. Much less power is discipated. And because of their very low open resistance, the power mosfet's stays less time in half opened state, allowing higher pwm frequency and increasing efficiency. The jfet opamps are fast enough to be used at higher frequencies (slew 13V/us). I'm not sure how fast can they fully open or cose the smaller fets. Max output current of the opamps is limited but I do not see it in the datasheet. (At least the gate of the 2N7000 has far less capacitance than the IRF540N.) Would this work better than the previous design? Would it work at all? AI: Or save yourself all that messing around and just use one of these: - They cost 44 pence from mouser here and they are in a SOT23 package, Vcc can be as high as 40 volts, Using a TL074 to drive a MOSFET is going to be problematic because with its negative supply pin at 0V the output won't swing down below about 2V and you are likely to be never able to switch the lower MOSFET off. No, I'd just go for an integrated MOSFET driver and save time, money and space.
H: When eqvivalent transfer function of two systems in series is a product of two transfer functions that describe these systems? In control systems theory when two systems with transfer functions \$ H_1(s)\$ and \$H_2(s)\$ are in series, equivalent transfer function is given as \$H(s)=H_1(s)H_2(s)\$. However if we have two RC filter in series, the equivalent transfer function is not a product of the two transfer functions of RC filter. It is indicated here Can you find the transfer function of two cascaded networks if you know their individual transfer functions?. My question is, does this means that transfer function \$ H_1(s)\$ and \$ H_2(s)\$ are calculated and these systems are always made such that input and/or output resistance of the other connected system doesn't make any influence on its performance? Or I am missing something? Or, when is it possible to do simple multiplication of the transfer functions? AI: In control systems theory when two systems with transfer functions \$ H_1(s)\$ and \$H_2(s)\$ are in series equivalent transfer function is given as \$H(s)=H_1(s)H_2(s)\$ This is definitely true but why would you consider two cascaded RC circuits as two separated systems! For example these two circuits are different from each other [One of them could be considered as two cascaded systems each of \$H_1(s)\$ and \$H_2(s)\$ while the other is considered as only one system with a transfer function \$H_3(s)\$ Circuit A: Circuit B: In circuit A you cant assume its just two cascaded RC circuits, since the first RC circuit affects the second RC circuit [THE LOADING EFFECT], you need to solve the whole circuit using any circuit theory to come with the differential equation representing the out/input relationship While in circuit B you can assume these are two separate RC circuits such that none of them affects the other in this case you can do the multiplication Circuit A transfere function would be \$\frac{1}{R_1C_1R_2C_2S^2+(R_1C_1+R_2C_2+R_1C_2)S+1}\$ Whle circuit B transfere function would be \$\frac{1}{(R_1C_1S+1)(R_2C_2S+1)}\$ Since i have assumed \$R_1 = R_2 = C_1 = C_2 =1\$ which are not practical values but just for demonstration Now when examining the unit step response of both circuits you would definatily expect identical responses. But in circuit A due to the loading effect the capacitor on the right \$C_2\$ is charging through both \$R_1\$ and \$R_2\$ [SLOWER] while in circuit B the same capacitor is only charging through \$R_2\$ [A BIT FASTER] The unit step response of both of them The curve in the yellow [THE SLOWER RESPONSE] represents circuit A while the other curve in pink [THE FASTER RESPONSE] represents circuit B. So if you think your system is composed of two simmiller systems and its overall transfere function is the multiplication of both of them, you need to ask your self Does each of them affect the other? if so then your assumption is wrong and its a single system that you need to derive its equation. Also the loading effect is not only in electrical systems, for example in a double tank system you might have the same effect!
H: What are the low level programming waveforms for the Atmel ATF16V8B? I want to program some ATF16V8B chips for a project. Naturally I don't have a programmer. No problem, I'll homebrew it with a Raspberry Pi. It will be fun. I only need one thing - I need the programming waveforms. Specific sequence enter programming mode, what voltage to apply and for what duration for each byte to be programmed, etc. All the stuff that they used to put in the datasheets before they replaced that whole section with "Program PLDs using a programmer". Can anyone provide? AI: The programming algorithm for standard GALs, including the 16V8, is documented on this web page. It's too long to reproduce in its entirety here, but there are a couple of "quirks" that will make it difficult to perform using a Raspberry Pi: The GAL is a 5V part. The Raspberry Pi uses 3.3V I/O. To program the GAL, you have to supply 12V to the EDIT pin, and an even higher programming voltage (14 to 16V, depending on the part) on another pin. My advice? Get a prebuilt programmer to handle it for you. I use a TL866 USB programmer, which can handle GALs as well as many other programmable parts (parallel EEPROMs, serial flash, AVRs and other microcontrollers...). It's a handy thing to have around.
H: what does reactive power mean here? simulate this circuit – Schematic created using CircuitLab assuming this circuit is run for 5 seconds period, the switch is closed for 1 second starting at t=3s we can calculate average power as average = 1.8 W but apparent power S = Vrms * Irms = 4.023 VA and the difference will be the reactive power which is >0, right? what does this reactive power mean? in rl or rc circuit it's the powered stored in inductor or capacitor but switch cannot store power. AI: I am not seeing any reactive power there, that would require and inductor or capacitor. During the 1 second the switch is closed current is 3V/1 ohm = 3A, and power is 9W giving a total energy expended of 9W * 1s = 9 joules, the rest of the time there is no power dissipated, so the average is indeed 1.8W integrated over 5 seconds, but I do not see where you get ~4VA from? RMS current is (4 * 0^2 + 1 * 3^2)/5 = 1.34V, and because of the 1 ohm resistor RMS current must be 1.34A. 1.34V * 1.34A = 1.8W * 5s = 9 joules.
H: Stopping DC motor when motion being blocked without a limiting switch Is there a way to stop a DC motor when its motion be blocked ? For example if it rotates in a free motion raising a load and the load reached a blocking part making the shaft not rotating while the current is on, ( without using a micro limiting switch). AI: Monitoring the motor current would appear to be a viable way of detecting suddenly increased load (like blockage, etc.) If you are controlling the motor from a microcontroller, you could make it adaptive to avoid false triggering.
H: AC measurement in a circuit I used the spice language to build an integrator op-amp, and one of the questions I had to address is to run an AC analysis on it. long story short- by looking at the transfer function of an integrator, I imagined I would get a negative voltage, but I got a positive one. Someone explained that since it's AC measurement, it only measures the amplitude and thus I don't need to actually get negative values. Can you please explain why this is true? thanks! AI: Well, it isn't true that AC simulation only returns positive values. The input to an AC analysis is a sine wave with a given amplitude and phase. The output again is a sine wave with an amplitude and phase determined by the transfer function of the system. So the result consists of two values which are usually computed as a complex number. The representation often consists of the magnitude and the phase, since they are easier to work with than the real and imaginary part. In order to see if a value is negative, it is therefore also required to check the phase. For a negative result an additional phase shift (relative to the input signal) of 180 degrees should occur.
H: Arduino - Calculating Resistor's Power and Resistance My Question I know, for example, that using a LED in Arduino without a resistor would cause damages to the Arduino's I/O (damages the LED too?), right? Resistors as far as I know have the two main properties resistance and power, so if I needed to calculate the correct resistor, what would be the steps? Why for pushbuttons, for example, I don't need it? Is it because it has an internal resistance and LED has an almost zero resistance? My Guess Let's test if I am getting this right, let's say all I want is to turn on a LED so Arduino's voltage is 5V (controlled by the board) and its ideal current is ~20mA (it has to be controlled by me). For turning on the led without causing damage I would do: $$I = \frac{V}{R} \rightarrow 20mA = \frac{5}{R} \rightarrow R = 250 \Omega$$ But I also have to know the if power is correct then I do: $$P = I *V \rightarrow P = 20*10^{-3}*5 \rightarrow P = \frac{1}{10}W$$ So the power that would be applied to the resistor is 1/10W and a 1/8W resistor would be enough since 1/8W is the maximum power that can be applied and it is bigger than 1/10? AI: Your calculation would be correct if you had no LED in the circuit. But a simplified schematic might look like this: simulate this circuit – Schematic created using CircuitLab Notice here that it shows you could drive the LED from VCC or to GND. When driven to GND you are sourcing current from the Arduino Pin and when driven from VCC you are sinking current through the Arduino Pin. Here's handy calculator for the resistor: http://www.digikey.com/en/resources/conversion-calculators/conversion-calculator-led-series-resistor In this calculator you can set the VF for the LED to anything you like (including zero), so you can see the conditions you set in your question. For the correct answer you will see that if the LED VF was 2.2 V with a 5 V supply, then the resistor would be 140 Ohms for a 20 mA current and not the 250 Ohms you calculated. The power dissipated by the "R" is W = I^2 * "R" In this case with 20 mA and 140 Ohms this gives about 0.06 Watt so a 1/10 W resistor would be more than adequate. So you need to understand what the VF is for the LED you want to use before you can get an accurate answer to the value of "R". Just to get you to think about the larger problems, it's more complicated when there are multiple I/O pins driving LED's. If you look at the datasheet for the Atmega328 (you should get used to understanding datasheets) used in the Arduino Uno: http://www.atmel.com/Images/Atmel-42735-8-bit-AVR-Microcontroller-ATmega328-328P_Datasheet.pdf If you look at Section 32 on the DC characteristics of the device, you will see the absolute maximum I/O port current is actually 40 mA. But there are further restrictions in the Notes. It turns out that within a group of I/O pins the absolute maximum current spread across a group of I/O pins is 100 mA. See Table 32-2(Notes #3 and #4), these restrictions are in place because of the current density limits for conductors within the integrated circuit. This means that if you were to connect up 5 or more LEDs to a group of I/O pins you could easily exceed the recommendations even at only 20 mA per LED. So the answers become more complex as you use more I/O to drive load currents, and you could easily increase the risk of damage to the processor if you didn't take these restrictions into account. This is why you see external LED drivers used in situations where even higher pulse currents (PWM brightness control) are used.
H: how to identify no of states? If a sequential circuit will produce output as high if both present and previous inputs represent even number with present input being LSB. How many states are required to analyze this? how to identify and choose a parameter as state? AI: If you are using a a mealy maching, you need two states Either the previous LSB was zero or not. If it was 0 and you get another 0 output 1 and set to previous number even again. If it was 0 and you get a 1 output 0 and set to previous number odd. Even and odd only depend on the LSB. Ok, there is a little question on what to do with the first bit. I'm assuming that if it is even the machine will not output a one since there was not a previous even number. This can be taken care of by initializing the machine to the odd state. Doing that, the state machine looks like this; I've assigned the even state 0 and the odd state 1. You should see this would be easy to do with a D flip-flop. The rays on this diagram have labels in the form input/output. You see that if it is in the even state, another even will stay in the even and output a 1. If it is in the even state and the next input is a 1 it will not output a zero and go to the odd state. The input is going to have to be syncronized for this to work without glitches. Perhaps I'm missunderstanding the question. Here is what I thought you asked for; Here is the output showing that two or more evens in a row produce a one output; If I understood the question correctly, the number of states is two.
H: What could this signal be? I'm attempting to use an oscilloscope to measure the power draw of a Raspberry Pi 2. I've got a circuit set up that looks something like this: simulate this circuit – Schematic created using CircuitLab I'm measuring on either side of R (I know that to determine the actual power consumption of the RP2, I'll need to measure either side of it as well. Then I can determine the current I through R, multiply that by the RP2 voltage, and voila!). I'm getting some very noisy readings off on my o-scope however and after zooming in on the signal I'm seeing this (apologies for the faint coloring): There's a pretty obvious dampened oscillation going on here, and as I've always been a far better coder than a circuit build, I have absolutely no clue what this is. Especially since I'm seeing this after unplugging the USB power supply from the wall. Could someone help me identify what this noise is from, and what I can do to minimize it (and try and get a cleaner reading)? AI: You put a 500 mOhm resistor in series with your MCU. In this way a change in consumed current will show up as voltage drop. Your oscillogram indicates that you have short changes in consumed current with amplitude of about 100 mA (+-50mV on 500mOhm resistor), which is not much. The spikes are coming on 10us schedule, which could be related to CPU activity while serving some interface like HDMI link. The spikes can also come from the internal DC-DC converter built into Broadcomm processor.The spikes are also pretty short, likely way under 1us, which results in the ringing over the board power rail. Why the spikes disappear after the HDMI interface is out? Likely because the processor went to sleep, and the switcher stops, maybe entering some linear trickle mode.
H: Question about the 3-transistor current mirror This is a basic 3-transistor current mirror: I see some circuits add an extra resistor from emitter of Q3 to \$V^{-}\$. Just like this: What's the purpose of this resistor? AI: I'll draw up the schematic you are talking about: simulate this circuit – Schematic created using CircuitLab Rather than just tell you the answer (I will, but allow me a moment), let's start by just laying out the nodal equation for \$V_x\$ shown in the schematic: $$\frac{V_x}{R_2}+I_{B_1}+I_{B_2}=I_{E_3}$$ Adding \$R_2\$ makes only one difference here. There are two directions to head, in considering "why" it's added. One direction is to focus on the impact on \$Q_3\$: (1) Increased emitter current; and, (2) reduced \$r_e=\tfrac{k T}{q I_C}\$; and, (3) The ability to set \$Q_3\$'s emitter current so that it is relatively independent of the base currents for \$Q_1\$ and \$Q_2\$. The other direction is to focus on the impact of "current in" and "current out" of the node. I think it is this latter option that matters more here. Imagine that there is some unmanaged capacitance sitting at \$V_x\$ (to \$V_-\$.) \$Q_3\$'s emitter can charge up this capacitance up quite actively, having access to the current through \$R_1\$ multiplied by its \$\beta_{Q3}\$. But it can only be discharged through the relatively much smaller base currents (the same current through \$R_1\$ but this time divided by \$\beta_{Q_1}\$ and \$\beta_{Q_2}\$.) This asymmetry leads to an undesirable response to higher frequency changes. Adding \$R_2\$ provides a separate way to sink current out of the node and to help balance the ability to sink and source current at \$V_x\$. This is also achieved another way that you may also encounter: simulate this circuit None of these are high precision circuits for discrete designs. They lack careful consideration of operating temperature differences, beta mismatch, and \$V_{BE}\$ mismatch, just to name a few reasons why. A lot of good work went into designing around those issues back in the 1960's. So if you are considering building these on a protoboard, you might want to research beta compensation resistors and .. well, probably Wyatt's pretty nifty design, too. (It's interesting entirely on its own.) You can also consider getting pairs of BJTs built on a common substrate for better thermal matching (BCV61 and BCV62, for example) and, in some cases, much better beta matching as well (BCM61 and BCM62, for example.)
H: How to model devices external to FPGA in a testbench? FPGA could connect to lot of devices like memory devices (SRAM, SDRAM, DDR RAMs), data converters and various other complex ICs. Is it a normal practice to model them in a testbench to make verification "complete"? I assume that doing so will atleast require a cycle accurate behavioural model. Lets take example of SRAM or SDRAM, is it normal practice to use some sort of cycle accurate model of these memory devices in a testbench? AI: If you are to use an external SRAM in your FPGA platform, then you need not only the "cycle accurate", but also (mostly) "timing-accurate" model, if you want something to work. The timing depends on particular memory chip and manufacturer, so the normal way is to download the model form manufacturer's site. Again, you keep repeating your questions, but continuously mixing "SRAM" with "SDRAM" and other types of memory. The SDRAM (dynamic RAM) is totally different beast as compared to SRAM (static RAM), and requires much more complex on-FPGA controller, cycle-configurable and therefore very cycle-accurate. Same thing, the behavioral and interface timing model are coming from manufacturers.
H: Current in Transformer Primary (Forward Converter) I currently read an application note from ON Semiconductor concerning forward converters. Latter explains why one needs core reset in case of the "single-switch" forward converter. Consider the following slide, especially the graph of the current in the primary side, i.e. the magnetizing inductance. I know that a transformer can be modeled by an "ideal" transformer with infinite inductance (here X1) plus Lmag on the primary side and some leakage inductance (which was obviously omitted here because the explanations target the primary side effects only?) I also know that the magnetizing inductance is a model for the energy needed to "allow" a magnetic field to change inside the transformer core (so I suppose it is somehow related to core losses.) To my question: When Q1 turns off, where is the REAL WORLD path for the current? Since Q1 is open and ILmag cannot be "stopped" immediately, there must be a way for the current to circulate until the magnetizing energy is dissipated. All the slides I found draw this "circulating path" though Lmag and (for the given picture) the primary side of X1. I don´t understand that, neither conceptually nor for real-world scenarios. Conceptually, why would the current circulate through the primary of X1 and Lmag? (is there even a current through an infinite inductor? and if there is, should not the voltage across the inductor then be zero, so no voltage anywhere across the inductor and therefore a short?) For real-world considerations: Since the primary of X1 is just a model for the ideal transformer and no real thing, where does the current circulate that flows in Lmag? AI: With the schematic posted as is, when Q1 turns off, in the ideal case, there is no current path available as you said. In the real world, a large positive voltage would appear at the drain of the Q1. Unless D1 breaks down first, the most likely current path is through Q1 under Vds breakdown. I think the circuit can actually work under this condition because a MOSFET can survive Vds breakdown if the power being dissipated is low enough. By the way, infinite inductor means infinite impedance. Therefore an infinitesimal amount of current corresponds to a voltage approaching infinity. So the assumption such a (unloaded) transformer as being a short is not right. In the real world, a common scheme of resetting the magnetizing current is by an extra reset winding on the transformer. Going back to the diagram post, with the schematic as is, the current would not behave as illustrated. In order for the current to behave as illustrated, the transformer needs to be shorted by something when Q1 is off. One easy way to do something close to that is to put a diode (sometimes called a flyback diode in some applications) across the primary. Such a diode would not produce a working design in this application.
H: Why is DC component ignored and AC analysis is used when obtaining input output impedance of a BJT transistor amplifier? What I understand is: in discrete amplifier circuits, the aim of the DC analysis is to find the DC operating point. (I get this part) And the texts I read so far mentions that AC analysis is done to obtain the Voltage gain, input and output impedance, and frequency response. My confusion is that: why do we need AC analysis but not DC analysis to find the input and output impedance? Why do we ignore the DC part of an input signal when finding input or output impedance? Is there a way to clarify/understand this in a simple fashion? Would be nice to consider a BJT common emitter amplifier with a resistor at its emitter such as: AI: The amplifiers you are speaking of are audio, that is, they only concern themselves with AC. As such, they are ordinarily AC coupled at both input and output with capacitors. So their DC input impedance is expected to be infinite, and their DC output impedance infinite. EDIT - You added your schematic while I was composing this. Note the input and output capacitors. END EDIT For amplifiers which are expected to include DC, DC input impedance must be specified, and likewise output impedance. You'll see both of those addressed in the data sheets of operational amplifiers. For inputs, you'll see specifications for input offset voltage, input offset current, and input bias current. For outputs, you'll commonly see the maximum voltage swing available for one or more load resistors, which is directly related to output impedance (although the presence of loop gain complicates the matter).
H: How to prototype 9-VFQFN? I am working on a project that will boost my Lipo voltage to 5V. I am looking at trying to use a boost converter like the TPS61235P from TI. Is there a good way to prototype this IC package (9-VFQFN) without having to create a custom breakout board just for this IC? AI: TI is usually good about listing evaluation modules on the "Tools & software" section of the product page. In this case it has a link to TPS61236EVM-676, available for $49 from TI direct. Other companies may do something similar; as always examine the appropriate product page.
H: Confusion in the difference between DC current gain and AC current gain in common emitter amplifier Here is a definition: It is easy to understand what DC current gain means here. The base current is constant, the collector current is also constant. An their ratio βdc = Ic/Ib. This is the DC current gain. But I don't get the meaning of the βac AC current gain formula here. Is that the derivative of Ic wrt Ib? I came across the following plot but still didn't get how to calculate this gain. How would one practically calculate this if one knows the input and output currents? Imagine the base current Ib is a sinusoidal current signal with 10uA peak to peak; and Ic is 1mA peak to peak. If it was DC current we would say the beta is 100. But here since we are dealing with AC, we need to find the AC gain by looking at the Ic Vce characteristics. How can we progress and make a logical derivation of AC current gain from this point? AI: There is no difference in your graph ideal real classic 2222A
H: 2x10 amp = 20 amp? I have a pretty simple setup, but i have a problem, that i what to solve the simple way. I have buy a led bar supposed to be for truck but i will get it inside to light up a big wall here is the bar with the specs : Simplive® 42 inch 240w Led Work Light Bar Flood Spot Combo Beam Driving Lights Fog Lamp Off Road Lighting for Suv Ute Atv Truck 4x4 Boat with Mounts. this bar is for 12v, 240 watt. so with little calculation it must use a 100v to 12v 20 amp ? right.... if the calculation is right so i need a tranformer that get me 12v 20amp, it's quite expensive, i just cannot get a 100$ transfo for a 100$ led bar.... so my question : can i buy this transformer (10$) 110v to 12v 10 amp and to get the require 20amp i will get 2 of these, wire in paralle, to get 10a+10a=20A... is it ok, can it be made, will it work ? any other suggestions ? note, i have search harder and found this 12v 20amp for a good price, maybe it simpler, but that does not answer my question AI: The light bar operates from 10 - 30 Volt DC, so you need a DC power supply. The Halogen light transformer in your first link outputs AC, so cannot be used with this light bar. Look for "LED power supply" or "DC power supply" rather than "Transformer". The "12 volt 20 amp" unit in your final link looks suitable.
H: What is this jelly like substance on electromagnetic shield of a LTE Modem? I took apart a Huawei E3372 LTE Modem, and this is what I saw. A jelly like substance on the electromagnetic shield. It is very soft and a bit sticky. I guess it is there to dissipate the heat from the modem, since it couple well to the back enclosure of the modem. What is this substance and what is the function? AI: It's a thermal pad. It performs the same function as thermal grease except that it's easier to apply but is slightly less effective.
H: required wattage of chip resistors in audio opamp circuit? I have the following DAC output stage in a design I'm working on, which takes the differential outputs of a DAC to create an unbalanced audio signal, 5.7Vpp. For the R and C I would like to use 0402 chip capacitors and resistors. How do I figure out the required watts for the resistors and if the standard 1/16 watt power rating will be adequate? The differential inputs to the stage are 2.8Vpp signals centered around 5V. I'm not an everyday user of opamps, but have used TINA-TI by texas instruments to simulate the stage to make sure it works (i.e. that it has the current gain and frequency response). The circuit is powered by +14/-14V rails and I did put an amp meter in the simulation software on the rails, which gave me 4mA both for each of the rails, but that doesn't tell me everything? I also have a second (similar) version of the below circuit in which I want to use the opa1622 headphone amplifier opamp to drive headphones, and there this question will be even more important since that opamp is capable of outputting a lot more power than the ne5532. AI: Well there is clearly less then 6V in play anywhere, so that is ~2mA into a 3K ohm load, giving 12mW, so 0402 is probably fine from that perspective. There is however something to be said for physically larger parts as they tend to have lower excess noise. I note you are specifying 0.1% parts, for resistors, but that PC92 & 93 are not so tightly specified (Good luck with that!)? This will hurt CMRR at high frequency. Also R110 should be 100 ohms or so, to ensure stability when driving long cables. In the headphone case R110 should be 20 ohms or so, but may dissipate some power if the cans are shorted, or the jack is only partly inserted, calculate this assuming a short to ground and full scale output, a 1206 or so is usually sufficient. I note the lack of an output coupling cap, usually a good idea, 100uF or so with a 10k bleeder across the socket, particularly for headphones, DC offset matters (But for cans the coupling cap should be much larger to support low impedance units). If you think a phantom power accident is possible then make this cap a 63V part and wire it positive terminal to the socket, with the ESD diode where PC148 is, that way the diode is behind the build out resistor which will limit the surge current.
H: Circuit analysis of graphic equalizer I am having difficulty analyzing the following circuit: Schematic from: eleccircuit.com - 5 Channels 2 Octave Graphic Equaliser by 4558 (copy from Wayback Machine) I can see what the circuit does after running an AC sweep simulation. However, I would like to work out how the capacitor values were chosen. Specifically, I get stuck with the analysis of the individual stages due to the 10k resistor across the input pins. The normal rules of ideal op-amp circuit analysis seem to be violated here. Vn does not equal Vp or there is current flowing into the input terminals of the op-amp. What's going on here, and how can I proceed? AI: C2,C4,etc caps invert the voltage and thus impedance of these caps in the -ve feedback loop of the filter and thus call Negative impedance converter (NIC) filters or Gyrators. NIC: This reverses the voltage polarity or the current direction of the port and introduces a phase shift of 180° (inversion) between the voltage and the current for any signal generator. The two versions obtained are accordingly a negative impedance converter with voltage inversion (VNIC) and a negative impedance converter with current inversion (INIC) GYRATOR: An important property of a gyrator is that it inverts the current-voltage characteristic of an electrical component or network. In the case of linear elements, the impedance is also inverted. In other words, a gyrator can make a capacitive circuit behave inductively, a series LC circuit behave like a parallel LC circuit, and so on. It is primarily used in active filter design and miniaturization if R1 = R2 \$V_{in+}/I_{R_1} = - R_{3}\$ Note in this EQ a -ve cap is used for an inductor. \$ V_{in+}-V_{in-}=0\$ as always, when linear. Note your schematic that you show, has an (obvious) error, with the common line at bottom not grounded, as it should be...corrected below. This equivalent circuit is shown above, except for values.
H: Pin functionality multiplexing in NXP p1010 processor I am trying to make a small design using P1010 processor. During power-up sequence processor fetches configuration through specific pins. All of them are also used for other functionality. The processor guide told us we have two options here. First - use a PLD device (CPLD specifically). The second one in to use pull-up and pull-down resistors. I don't need a PLD flexibility now so I will plan to use resistors. I will write about a specific pins here but generaly it is the same for all of them. First question: We have two pins. One of them is EC_MDC/cfg_cpu_boot. The second is READY/ TRIG_OUT. READY: Asserted-indicates that the device has completed the reset operation, and e500 core is not in a power-down state (nap, doze, or sleep). I need some kind of sheematics here so while READY is 0 the porcessor should use resistor (pullup or pull down). But when READY goes 1 it should use EC_MDC functionality (go to other part of the scematics and bypass resistor) Second question is almost the same. We have some pins wich have triple mennings. Something like IFC_CLK_1/USB_NXT/IFC_CS_3_B. We will switch between them using software. But how should we rote this pinn in such a way that we use different part of schemes and completely bypassing others. For example IFC_CLK_1 is used as a clock during some operations for one part of scematics. At the other time we would like to use IFC_CS_3_B as chip select for completly different part of schematics. So generally, how can we use pins for different activities represented by different and unrelated same parts? AI: That is a pretty broad question. So, most microcontrollers have some way, typically some control registers, that you can use in your firmware to change the functionality of a pin. Now, if you need to "multiplex" that pin to different signals/elements of your circuitry, you'll need some kind of multiplexing. In case of digital signals, that might simply be some transistors that you address with another pin; in case of analog signals, or fast digital signals, this might be a bit more complicated and need specific analog switches – whether those are discrete-transistor-based, based e.g. on analog switch ICs (e.g. from TI, or ST. Basically, go to any semiconductor manufacturer's website, and search for "analog switch") , or even relays, completely and utterly depends on your application. Furthermore, you'll still need some output to program these multiplexing devices – and that will require more output pins, and it seems you're already in a situation where these are sparse. Generally, I kind of feel like you're doing something wrong: If you already use a relatively large microcontroller, just use one with even more pins, and simply have one pin for each part of your schematic. If you can't do that, find the digital outputs or inputs that you don't need to switch/read fast, and attach them to some sort of IO extender – be it a simple shift register, or some kind of I²C-connected IO-extender IC, or a CPLD, or something connected to some high-speed bus, or any other way of using few pins to provide many IO pins.
H: Which Machine out of Induction machine, separately excited DC machine and permanent magnet DC machine will have the highest Torque to weight ratio? Which factors affect this ratio. I am aware of the general statement that Induction machines are bulky and have seen DC machines that appear to be compact and light weight, but I am stumped at comparing the torque produced by them. AI: There is a wide torque range for which induction machines, separately excited or permanent-magnet commutator DC machines and brushless permanent-magnet AC or DC machines are all available. Those machine types are also available with similar power and speed ratings. Considering just the machines without any required control equipment, a comparison of machines offered for sale will probably show that the permanent-magnet machine have the highest ratios of torque to mass and torque to volume for machines with equal torque and power ratings. In considering the required control equipment, it is necessary to consider if there is any need for variable speed. If there is no need for speed control, relatively simple on/off control is all that is required for induction machines with AC power available or for commutator DC machines with DC power available. Brushless permanent-magnet machines require electronic control regardless of the need for variable speed or whether AC or DC power is available. Considering the machine and control units together may alter both the torque/power density and the efficiency comparison. Electric machines that are offered for sale are designed to meet performance, purchase price, efficiency, reliability, expected lifetime, mass and volume objectives that are estimates of anticipated customer requirements and competitive offerings. Separate products are often offered for various market segments such as general industry, specific industry, land vehicles, aircraft, watercraft, military, consumer products. There seems to be some interest in electric machines for aircraft for which the top priority is torque to mass ratio with purchase price and volume being lower priorities. Rare-earth, air-core permanent magnet machines seem to be of great interest for that market.
H: Why Op-Amp Saturation voltage drop with increasing frequency? i was Implementation of square and triangular wave generator using op-amps LF353. I observed that when I choose different values of Resistor and Capacitor for different frequencies, with increasing frequency the amplitude of Square wave decreases and amplitude of triangular wave increases. If I extrapolate a trend line in the graph of Amplitude Vs frequency they join a common point where both amplitudes become the same. Why the saturation voltage(square wave amplitude) is decreasing and triangular amplitude increasing? Note: There are two points at 45Khz. The lowest amplitude point of square wave are taken when I selected a greater value of capacitor and smaller value of resistor to form the same combination for 45KHz. Circuit Diagram: R1 and R2 are capt constant: R1=1kΩ & R1=2KΩ AI: I obseved that When i choose different values of Resistor and Capacitor for different frequencies, with increasing frequency the amplitude of Square wave decreases It will because a lower value of "R" loads the output of the op-amp more and its saturation voltage increases. Remember the integrator input resistor feeds a virtual ground so it acts just like a load resistor to ground on the output of the comparator. and amplitude of triangular wave increases As you raise the operating frequency, the time it takes for the comparator to switch becomes more dominant in the period of the signal frequency being generated. This "extra time" allows the triangle wave (formed by the integrator) to rise to slightly higher peak values. When using an op-amp as a comparator, the output transistors enter saturation and it can take several micro-seconds to recover from saturation. I don't think the the two other answers understand what is happening in this circuit - the whole point is that the triangle p-p amplitude is dictated by the hysteresis of the comparator; theorestically, with perfect op-amps, the triangle wave p-p amplitude is constant.
H: lithium ion battery queries I am currently looking at this battery: http://www.ebay.com/itm/DC-12V-1800mAh-Super-Rechargeable-Pack-Protable-Li-ion-Battery-EU-Plug-For-CCTV-/400940782911?hash=item5d59eed53f:g:mxwAAOSw5dNWj4Bn I am going to use it for a slightly large robotics project where 12v is required for several sensors, 4 motors (2 in each output of an l298) and an arduino mega. Since the battery only has a male and femal dc jack (no regular wires) am I able to use this for the male jack to go into so I can plug into a breadboard? I have used nimh batteries for my last project and the charge of them vary over time and from looking at many different lithium battery packs ive seen that some of them drop charge quite a lot, Is this true for all of them? The reason i am looking at li-ion is because from googling it seems the best choice out of nimh and li-po (cheaper and safer). Would you suggest this a good choice of power supply? (im on a tight budget too) AI: Yes, this connector should fit the one of the battery. Also, all Lithium rechargeable batteries suffer quite a lot from voltage drop. This should not be an issue, since for the motors the voltage is not critical, and the logic stuff uses regulated 5V anyway. Li-Ion and Lipo are the same thing. The only difference is that the term Lipo is usually applied to batteries in a plastic pouch, whereas cylindrical cells are branded Li-Ion.
H: What is the formula for charging a capacitor with constant current? I read that the formula for calculating the time for a capacitor to charge with constant voltage is 5·τ = 5·(R·C) which is derived from the natural logarithm. In another book I read that if you charged a capacitor with a constant current, the voltage would increase linear with time. Is this true, and if it is, what is the formula used for calculating this? Would a complete voltage charge be possible with a constant current? AI: Normally I would let you go and look as this is not a hard question to solve, but as I am feeling generous here is how we get there: From fundamentals, we know that \$Q =CV\$ If we take the derivative with respect to time (remembering that \$I = \frac {Q} {T}\$) we yield \$i = C\frac {dv} {dt}\$ Rearranging, we find that \$\frac {i} {C} = \frac {dv} {dt}\$ Therefore charging a capacitor from a constant current yields a linear ramp (up to the compliance of the current source). I will leave finding the solution in terms of time versus some voltage to you.
H: PID Control Lithium-Ion Batteries Please help in finding good literature/articles about PID Control for Li-Ion Batteries. I searched the internet but I heardly find anything. There are a lot of articles regarding motor control design, however no battery chargers. The literature especially should handle control design regarding parameters choice based on battery models. Books Master/Doctorial Thesis IEEE articles Application Notes Where you have found them useful. Will be highly appreciated. Thank you! AI: They basically use threshold control with some hysteresis for LiPo chargers. Phase 1 Check Voc and temp as each parameter is Temp compensated. Phase 2 Check Vbat with load for Drop in voltage and charge slow if V<3V due to high ESR -Phase 3 If above 3V to 3.2V (approx) apply constant current according to Mfg specs at Constant Current C1 or other... Phase 4 When Vcv threshold is reached go into CV mode, ( usually 4.2V but can be higher at low currents. ) Phase 5 When Ich drops below 10% approx of CC rate, then shut-off charger and go to Vfloat mode at 3.7 to 3.9V So there is no PID gain feedback as it is non-linear.
H: Need help understanding IC Behavior I built a circuit based on this IC. Link: http://www.mouser.com/ds/2/256/MAX756-MAX757-92691.pdf It says if you put the 2nd pin to Low, then it switches to 5 v out. That seems to be untrue. I found that if you float the pins and then touch a finger to the 1st pin, then it switched to 5 v. I can also touch it with a jumper wire, paper clip, and also hoover my finger over the pin and it jumps from 3 v to 5 v. What is going on? Thanks AI: From the datasheet: Control-Logic Inputs The control inputs (3/5, SHDN) are high-impedance MOS gates protected against ESD damage by normally reverse-biased clamp diodes. If these inputs are driven from signal sources that exceed the main supply voltage, the diode current should be limited by a series resistor (1MΩ suggested). The logic input threshold level is the same (approximately 1V) in both 3.3V and 5V modes. Do not leave the control inputs floating. Sounds like you left the control input floating, in violation of the explicit direction in the datasheet, which leaves the CMOS input in a high impedance state, susceptible to nearby electric fields (like those created by the charge stored on your finger). In essence, the behavior is unpredictable in this condition.
H: Does the temperature of a processor influence its energy consumption? I don't have a very strong background in physics and electrical engineering but just from knowing that the major or basically all energy consumption of a processor comes from switching its transistors and from the the electrical resistance, which is very high I would say as a processor is basically a very thigh cable at very low voltages and very high currents, and that the resistance and hence the wasted heat is lower at lower temperatures, I would conclude, that a processor in a cooler environment also consumes less energy. This also leads to another other question: assuming that a CPU has a specific power consumption at a specific level of utilisation, would the power consumption be much more than twice as high at "double" utilisation (although this is hard to define in practice) as the overall temperature would increase and the same "work" would lead to more energy loss due to more resistance? To give a short background on the question: I was wondering if my notebook battery life lasts longer if I'm using it outside in the winter for example. Of course this is hard to answer as there are many other factors like the behaviour of the battery itself at different temperatures and the display, but this has lead to the basic question described above. AI: A CMOS chip ideally acts as you suggest with the dynamic power consumption proportional to the switching speed and the square of the power supply voltage (and the static power consumption with clock halted zero). However, as you try to lower the supply voltage (for reasons obvious from the above) the transistors no longer quite turn off all the way, and an ever larger static consumption appears. This is called subthreshold power leakage and increases with temperature. There is also gate oxide leakage. There are mitigation techniques, including circuit design and using exotic materials such as high-K dielectrics that can reduce the effect. At one time it was predicted that static power consumption could approach dynamic power consumption but I don't think that has happened.
H: When you are designing a device with a CPU that only supports ddr3, is it possible to use ddr2 in that design instead? Sitara™ AM57x Processors I want to make a system and have access to ddr2 ram slot design files only. How can I re-route the controller to use ddr2 sodimm memory with a ddr3 interface. I am designing my own board. AI: You can't (*). DDR3 is not backwards compatible with DDR2 and vice versa. You can't attach DDR2 RAM and expect a DDR3 external memory interface controller to work with it. Your best bet is simply to design around DDR3 and update your design files. (*) You could get an FPGA and write some controller to allow it to appear as DDR3 memory, and have it interface with the DDR2 memory as effectively some form of translation, but that is really a pointless idea as it would take far more time, effort, and cost to do compared with just designing a DDR3 PCB footprint.
H: Are diodes backwards? So I've been learning about diodes (since I don't have an electrical background). Technically, current flows from the negative side to the positive side (electron current flow). However, a diode allows a flow from the + to the - side (forward bias) and disallows a flow from the - side to the + side (reverse bias). So, let's say I want to protect the GPIO pin on a raspberry pi (this would be the + side) and have a diode, then a circuit and in the end, connected to a ground pin (-). How can the diode protect the GPIO pin, when the current actually comes for the negative side to the positive side? It makes more sense to think that the electricity within a diode can flow from the positive to the negative side, in order to protect the positive side. The ground (- side) is less important (or is this wrong?). How can a diode allow electricity to flow from the + side to the - side, while electron flow is the opposite? Is my thinking wrong? Edit: the following schematic shows where I can see a contradiction and what I am confused about. simulate this circuit – Schematic created using CircuitLab AI: Do you mean this circuit? U1 is the Raspberry, \$R_p\$ is the internal pullup the GPIO pin shown has. simulate this circuit – Schematic created using CircuitLab This works as follows: When the switch is open or connects the circuit to a voltage higher than 3.3V, the diode is non-conducting. This means the GPIO is internally tied to 3.3V by \$R_p\$. When in contrary the switch connects the circuit to 0V, the diode is conducting and there is current flowing from the Raspberry GPIO to ground. The GPIO internal potential is a bit above GND because of the diode voltage drop and the outer resistor, but still detectable as low. The outer 1kΩ resistor is for the case you accidentally configure your GPIO as an output and set it to high. It limits the current to ~3mA then.
H: What are the disadvantages of using a laptop power supply (into an LM317) as a bench power supply? I have a Dell laptop charger, which claims to output 19V, 1.58A . Is there any value in re-purposing this for hobby electronics? I'm tempted to do something quite crude, such as feed an LM317 from it, and use that as a basic voltage source. I'm aware that this will have various limitations, but what are they, exactly? Are there risks involved in driving the laptop charger in this way? AI: First, there is nothing wrong with your idea. It will make a quite capable supply if you use it within its limitations. You can add an inexpensive panel meter to show you the output voltage (get the three-wire type that has a separate supply line). In terms of limitations- your LM317 (+ heatsink) supply will only be adjustable from 1.25V to about 17V without adding more circuitry. In practice this is a very useful range. There will be no current limit other than the limiting inherent in the LM317 and the brick (probably around 1.5A to 2A). Bench supplies often have an adjustable current limit which is useful when you are gingerly powering something up for the first time, for example. Ripple may be worse than a linear supply, especially at high frequencies, depending on whether you try to filter it well or not. Power dissipation limiting will be by overtemperature cutout on the LM317 chip, which is pretty rough on it (it limits way above the absolute maximum listed temperature for operation), so you may have to be a bit more careful. Many bench supplies are only optionally earthed, and have a jumper to allow earthing one side of the output. Your brick is probably permanently earthed on the minus side, so you cannot put supplies in series, for example. It would make damaging things that are already grounded such as USB ports more likely. Again, you can be careful.
H: VQFN Footprint for PCB Design? I am currently working with TI's TPS61235. I need to put this IC onto a custom PCB for a project, but I cannot find any libraries for PCB designing software for this VQFN-9 layout. Is there anywhere where I can find these weird layouts to design PCBs with? AI: You do not know how to use a PCB design tool unless you know how to make a part for yourself — what you own owns you, self-sufficiency, and all that jazz. Reference You should always be familiar enough with your PCB design package to easily create your own parts. How else can you be be absolutely sure that the footprint matches exactly and adjust solder amounts and stuff? At the end of practically every (not every, but close enough) datasheet, you'll find a good description of the package and the manufacturers recommended layout, including all measurements needed. Often they also describe how big the opening in the solder stencil should be and more. If you follow those recommendations, you can be reasonably sure that the design can be manufactured properly, with only minor adjustments.
H: How can I remove transformer windings from wooden template? I usually wind my larger MOT transformers by using a 2x4 as a template, then I push the zip-tied winding off the 2x4 and into the E section of transformer. As I knew I would be fighting for the last turn on this specific winding, I REALLY wound it tight. I cannot get it off. I've tried slowly punching down each side with a hammer and wood buffer. I've lubed it up with some olive oil. I've got a big clamp holding the "buldge" (mine doesn't really have one since it's so tight). I REALLY do not want to have to rewind this one. I'm sure I can come up with a primitive violent way to get it off, but I would love to hear from someone with a clever idea or has been in this frustrating situation before. Thanks. Picture attached AI: I would cut both sides off, one only close to the edge, maybe drill some big holes, and split it with a BF hammer and a chisel. You could also try whaling on the longer end with a dead blow hammer to try and shatter it after drilling the holes. Personally, I have a small benchtop 12 ton hydraulic press that would be more controlled or a 3 ton arbor press (that might not be strong enough). A big C-clamp or large bench vise might work just as well, but leave enough room on at least one end to get ahold of the 2x4 or you may actually make things worse! I think oil or soapy water would just make the wood swell. Your PVC jacket is probably good for about 90°C (but do check the rating on the markings) so you could try leaving it in an oven for 24 hours (or enclose it in an air tight box with fresh dessicant from the hobby store) to dry and shrink the wood. Drilling it first would make that process faster. An hour or two in a vacuum chamber might also do the trick (again, drilling the center out would expose more wood).
H: Significance of Capacitor Attached to output so I have a question about a circuit design for an earpiece. It seems clear to me that the first op-amp functions as a high pass filter, and I think the second op-amp is a simple inverting loop, but I'm not sure what the function of C2 is. Basically I'm confused as to what it's doing. AI: Since your earphone is a dynamic speaker, it's only sensitive to AC. Thus, a high value C2 is in place to block DC from flowing through the speaker. It doesn't stop AC. That way, the designer of the amplifier circuit doesn't have to make sure the "zero" output voltage (ie. output with perfect GND-level input) is really bias-free (ie. at perfect GND-level itself). That's a good thing, because Opamps aren't perfect and typically do have some DC offset. And that offset would lead to a constant bias current through the earpiece, which reduces sensitivity of the same, and increases power consumption, without any benefit.
H: Is it safe to frequently restart an ATX power supply I'm powering five Arduinos and four LED strips (600 LEDs total) from an ATX power supply (CoolerMaster B2 Series 700W). Four Arduinos drive the four LED strips, and the fifth Arduino periodically cycles the power supply to keep the LED strip animations in sync. The restart interval is approximately 2 minutes and will be running for about three hours per night over December (i.e. around 2700 restarts for the month). Is it safe to be cycling the power supply this frequently? I'm a bit uneasy about leaving this to run whilst I'm not at home. I imagine my alternative would be to use relays or MOSFETs to cycle the Arduinos. AI: If you have your mind set on power cycling the Arduinos, why not do the following? This way you don't have to restart the whole PSU. Make sure you get a FET that can handle all the Arduinos (or you can use one FET for each Arduino). simulate this circuit – Schematic created using CircuitLab Another solution that ocurred to me is.. why not control the ATX PSU the same way computers motherboards do? Put a FET/relay (or even control it directly as per this tutorial) between the Pwr_On and GND pins (on which I believe you must have some jumper if you are using ATX PSUs). So.. not many external components, the problem with inrush current in the input caps is gone, and.. you got the power cycle you wanted.
H: Is more fuel consumed immediately when spinning reserve is brought on-line? Spinning reserve is additional capacity (reserve) that generators which are on-line (spinning) are able to apply to the grid quickly in response to a failure elsewhere on the grid, or a spike in demand. It's my understanding that spinning reserve is controlled primarily through passive frequency response - spinning generators seek to maintain 50/60Hz - similar to how I would pedal harder when I start biking up a hill in order to maintain the same speed. Where my understanding breaks down is, how is this physically accomplished at the energy source (before the generator)? Specifically: To increase torque/power, does more fuel need to be burned (or steam produced) at the instant when more torque is demanded? If so, does this mean that such generators spend most of their time in a less efficient operating state than they are capable of? Or, is the increased torque output simply a transient response? What is the timescale of this response? Is there a portion of response (sub-second, I presume) that is simply due to mechanics of the generator, prior to an increase in fuel consumption? How do coal or nuclear plants supply spinning reserve (as opposed to natural gas or hydropower), since their thermal cycles operate on longer timescales? AI: In a coal or nuclear plant, the thermal power changes very slowly, perhaps 10-20% per hour. To have power available for spinning reserve, the steam turbines are run at a lower power than the boilers, the main throttle is set so that there is some steam available but not used. The excess steam bypasses the turbine and its energy is wasted. If more power is required, the steam valve can be carefully opened and the power delivered increases. For a big steam turbine this might still take 30 seconds. So to a first approximation the slow thermal plants consume fuel for the full total of actual power + spinning reserve. You have a good question about the timescales. At the shortest timescales, fractions of a second, the frequency is passively stabilised by the inertia of all the generators (and rotating loads). At longer timescales it's entirely up to the control systems adjusting the power of each generator, and depends on the transient power response of the generator. Some time back I found a very good presentation by John Undrill, called "Power Plant / System Dynamics and Control" presented at a NREL / EPRI workshop, May 2013. I can't find a copy of the document to link to now, see if you can find a cached copy somewhere.
H: No output from shift register I'm trying to use a Teensy 3.2 to control a digital scoreboard display. I'm using 6 common anode 7-seg displays controlled by two 74HC595 shift registers daisy chained to control a transistor array. (Schematic attached). I followed this tutorial to connect the shift registers to the board using 3 output pins. I have tested and mounted the circuit onto protoboard but I cannot get the displays to light up at all. (The Teensy is powering up and excecuting code correctly). I have tested every connection between nodes with a multimeter and there are no shorts or missing connections, but no matter what data I send the output pins all read LOW when tested with a multimeter. I know the circuit should work as I tested a condensed version with one shift register and one 7-seg display on a breadboard and all worked fine. I aim to multiplex the displays such that only one is on at a time (selected by the first (leftmost) shift register and the number displayed driven by the rightmost chip so each LED should be able to recieve the required current from the DC source. The schematic and test code (just lights up one display) are attached below as well as the data for the components: Transistors: 2N5210; Displays: SA40-19EWA (8V 20mA common anode); Any help as to what could be going on would be really appreciated as I am relatively new to digital circuits EDIT: The schematic shows sets of 8 LEDs in series-parallel as one LED for clarity. int dataPin = 3; int clockPin = 5; int latchPin = 4; void setup() { pinMode(dataPin, OUTPUT); pinMode(clockPin, OUTPUT); pinMode(latchPin, OUTPUT); } void loop() { digitalWrite(latchPin, LOW); shiftOut(dataPin, clockPin, MSBFIRST, B11111111); shiftOut(dataPin, clockPin, MSBFIRST, B00010000); digitalWrite(latchPin, HIGH); delay(1000); } AI: Your problem is your multiplex drive. First, though, I have to point out that I believe your problem description is wrong. When you say, "the shift registers have no voltage across any of the output pins", I'm pretty sure that you mean that no LEDs are lighting, and that is not the same thing at all. Second, your schematic is extremely misleading, since you show single LEDs in your displays. In fact, each display segment is composed of 4 pairs of LEDs connected in series, and this makes a big difference, With that said, when you use NPN for your display selectors, you produce the following circuit for a selected segment: simulate this circuit – Schematic created using CircuitLab Since Q1 is being used as an emitter follower, the LED Voltage cannot be more than about 4.3 volts, and so the LEDs are not lighting. You need to replace your multiplexing transistors with an NPN-PNP pair, like so: simulate this circuit Driving Q1 will cause base current to be pulled through Q2, turning it on. You do not need a 100 ohm in this case, 1k will be more than adequate, and the 2k base resistor will draw about 5 mA through the base, which will be more than adequate to turn on Q2 to the tune of 20 mA or less. You could actually use 5k and the circuit would work perfectly.
H: If I re-scale my input range for differential input to ADC, can I double resolution? I'm just building my first separate ADC circuit, after deciding Arduino was limiting me too much / it is just time to start understanding how to do things properly. I currently am using a LT1290 ADC with a LT1027 5V reference. I have essentially stuck to exactly the example circuit given in the data sheet to get started, it is what I need anyway. I am currently sticking with single-inputs. I was just wondering if by re-scaling my input signal from 0to5V to -5Vto+5V, and feeding this in as a differential input, is this an easy way of doubling the resolution (2 x 4096)? Or is there a high price to pay in accuracy compared to the increased complexity of the needed circuit? Thanks AI: No, you will get 12-bit resolution in either case. The codes for unipolar operation and bipolar operation can be found in the datasheet And you can see that for bipolar operation the LSB changes from 1.2mV to 2.4mV. So there is no increase in resolution, just a different scaling.
H: MOSFET Safe Operating Area vs Maximum Ratings I've been building a project using some Infineon IPA093N06N3 MOSFETs. I carefully picked the correct values for the MOSFET that I needed, and calculated an estimated Tj based on the thermal resistance of the package I was using. I only just noticed today the Safe Operating Area graph in the datasheet whilst looking up the pinout for the package. The SOA suggests that this MOSFET (and a lot of others I took a look at afterward) is only rated to "safely operate" in a very small window, despite the much larger maximum operating conditions listed on the first few pages of the datasheet. Taking the linked datasheet above as an example, it states that the MOSFET is capable of a VDS of 60V and a ID of 43A. A further look on page 4 shows the SOA graph, which states that at any VDS over 10V you are limited to a ID of 10A. I previously assumed that, so long as you stayed inside the maximum ratings and you could cool the MOSFET to below Tj(max), that any value for both of these would be alright. If the MOSFET is capable of switching a large current whilst staying under the Tj(max), what other limiting factors might there be that would cause the manufacturer to state that they are only capable of smaller currents above certain voltages? AI: With a Vds of 10V you should be in the linear are of operation of the FET (not fully on). In a switching application, that is a "switching" loss. When fully on, you will approach the lowest Rdson that your given Vgs can achieve, and that would be a "conduction" loss. Image source The voltages on the SOA graph are not the voltages across the FET + the load, just the voltage across the FET. simulate this circuit – Schematic created using CircuitLab If the FET is "off", then the drain will "float" up with the load (so Vds will be high, but current will be very low). When its "on" Vds will be very, very low (Rds * current), and current high. So provided your FET is properly turned on, it should spend very little time on the upper-right part of the graph.
H: analog output from pic 18f4520 i am trying to generate analog signal using pic and dac circuit attached when i simulate using Proteus the signal does not make a full cycle i thought that pic make reset after 24ms so i make the timer0 interrupt 50u instead of 100u then the signal make like reset after 12us can any one help me in that ? the signal is [vo=2,5+1,5 sin(2 pi 25 t) + 0.5 sin (2 pi 1000 t) ts = 100 us t = 0 : 40 ms] #include"pic18f4520.h" #pragma config WDT = OFF unsigned char k = 0; unsigned char m = 401; unsigned char signal[] = {128,144,155,156,148,134,120,112,113,124,140,156,167,168,160,146,132,124,125, 136,152,168,178,179,171, 157,143,135,136,147,163,179,189,190,182,168,154,146,147,157,173,189,199,200,1 92,178,164,155,156,166, 182,198,208,209,201,186,172,164,164,174,190,206,216,217,208,193,179,170,171,1 81,196,212,222,222,214, 199,184,175,176,186,201,216,226,226,217,203,188,179,179,189,204,219,229,229,220,205,190,180,180,190, 205,220,229,229,220,205,189,180,180,189,204,219,228,228,218,203,187,178,177,186,201,216,225,224,214, 199,183,174,173,182,196,211,220,219,209,193,178,168,167,176,190,204,213,212,202,186,171,160,160,168, 182,196,205,204,194,178,162,152,151,159,173,187,196,195,184,168,152,142,141,149,163,177,185,184,174, 157,141,131,130,138,152,166,174,173,162,146,130,119,118,126,140,154,162,161,150,134,118,107,106,114, 128,142,150,149,138,122,106,95,94,102,116,130,138,137,126,110,94,83,82,90,104,118,126,125,115, 99,82,72,71,79,93,107,115,114,104,88,72,61,60,69,83,97,105,104,94,78,62,52,51,60, 74,88,96,96,85,70,54,44,43,52,66,80,89,88,78,63,47,37,36,45,60,74,83,82,73, 57,42,32,31,40,55,70,79,78,69,53,38,28,28,37,52,67,76,76,67,51,36,27,27,36, 51,66,76,76,66,51,36,27,27,37,52,67,77,77,68,53,39,30,30,40,55,70,80,81,72, 57,42,34,34,44,60,75,85,86,77,63,48,39,40,50,66,82,92,92,84,70,55,47,48,58, 74,90,100,101,92,78,64,56,57,67,83,99,109,110,102,88,74,66,67,77,93,109,120,121,113, 99,85,77,78,88,104,120,131,132,124,110,96,88,89,100,116,132,143,144,136,122,108,100,101,112,128}; //unsigned char signal[] = { 128, 217, 255, 217, 128, 37, 0, 37 }; void InitTimer0() { T08BIT = 1; //8bit mode T0CS = 0; PSA = 0; T0PS2 = 0; T0PS1 = 0; T0PS0 = 1; TMR0L = 5; TMR0H = 0xFC; TMR0IF = 0; TMR0ON = 1; T0IE = 1; GIE = 1; } void interrupt timer( void ) { GIE = 0; if( TMR0IF ){ TMR0L = 0x17; ///T=0,02496 TMR0H = 0xFC; TMR0IF = 0; //i?lem k++; LATC = signal[k]; if( k == 401) {TMR0ON = 0; LATC = 0; } } GIE = 1; } void main(void) { InitTimer0(); TRISC = 0x00; LATC = signal[k]; while(1){ } } AI: The variable k is unsigned char so can only hold values up to 255. Ideally it should also be volatile as it's used in both main and interrupt. Change the declaration to volatile unsigned short k = 0; and see if that helps, similar with m too, so something like: #include"pic18f4520.h" #pragma config WDT = OFF volatile unsigned short k = 0; volatile unsigned short m = 401; // etc. Actually, the code you posted doesn't use m, but maybe that's not all of your code, so just be aware. Assuming you are using Microchip's XC8 compiler, the supported data types and ranges are all described from page 151 of the XC8 Compiler User Guide. For example, here are the two relevant tables: If you want to ensure that your code is portable, regardless of differing compiler defaults, you can #include <stdint.h>, which defines types that specifically identify the size. For example: #include <stdint.h> volatile k uint16_t = 0; // 16-bit unsigned integer Other types follow a similar pattern, for example int32_t is a 32-bit signed integer, uint8_t is 8-bit unsigned, etc.
H: power and fusing for first mains-powered project (100x WS2811 (RGB LED)) I'm a software guy who's done simple Arduino projects powered by a computer but doing my first project which involves mains/"wall" power. Working backwards: 2x 50-LED chains of WS2811 addressable LED's will be controlled by a FadeCandy. (A tiny controller that takes instruction over USB, then tells the LEDs what to do.) This half I have no problem with or questions about. But the LED's are power hungry. 18.5mA per color, for 55.5mA per light, x 100, = 5.55 amps. I've got a S-100-5 power supply that takes in wall power (100-240VAC) and outputs 5V20A. So lots of headroom there, apparently. I have a fuse holder and 6A fuses (just say UEC 6A). Would I put this on the DC side or AC side? Or is this unneeded such a project? I'm OK at soldering in electrical guitars and electronics but I never worked with AC power before and am worried that just one stray whisker of wire will short or arc or something. Finally, in Japan we don't have polarized plugs or three-prong plugs so I don't know which side is hot and which side is neutral. Does it matter, as long as I don't touch the power supply? (And it's in a plastic case.) AI: A fuse is first and foremost to protect the wiring. It then offers you some protection against dropped bits of wire if you are 'adjusting live'. But where semi-conductors are involved, it's unlikely to protect the equipment itself. Your wiring from wall to PSU must be fuse protected, consistent with the size of wire you are using. 'Soldering for electric guitars', while a good skill, is not really sufficient qualification for dealing with mains-side wiring. You need to add extra care, and complying with the mains regulations for your region. If your wiring from wall to PSU is large enough to be protected by the fuse that you will have back in your distribution fuse box, say a 10A distribution fuse and 1mm2 wiring, then you do not need a mains fuse. If you want an additional lower value mains-side fuse, then buy a fusable plug, or shrouded fuse holder, or mount the fuse securely (not hot-melt glue) inside your plastic box. A 6A fuse will be adequate for down to 0.5mm2 conductor. A smaller fuse, down to 1A even, will be better at offering some slight protection to the PSU as well. That particular power supply is protected against overcurrent on the output, as will the vast majority of SMPSs be. This means it's unlikely to blow a mains-input fuse without itself being in trouble first. It also means you don't need an output fuse if your DC wiring is at least 2mm2. A 6A fuse, for a 5.5A load is a bit 'close', and might run hot, drop excessive voltage, and nuisance blow. If you do want to fuse your DC side, then 10A, or a 6A fuse on each chain, might be better.
H: Net names aren't shown in EAGLE PCB layout I created a PCB in EAGLE Cadsoft but Net names are invisible in PCB layer though all layers are selected to be visible. Any suggestion? (I need names to be shown like the "jp1" on top left corner of PCB layer as in below image) AI: Net names on tracks is available on Eagle 7.6.2 forward. If you have an appropriate version of Eagle, you can: Enable signal names on nets under the Misc button, found under Options > Set from the EAGLE menu.
H: Which OpAmp supports voltage supply greater than + - 36V I'm looking OpAmp which could be powered from dual power supply greater than + - 36V. Current transformer provides 36,9V. And LM358 on a single supply could work up to 36V. I'm looking something what could be work on dual supply up to 40V. Any suggestions? Thank you AI: If it's a conventional current transformer and has an internal burden then applying an extra external burden resistor will lower the output voltage and give you more options on the choice of op-amp. Alternatively just use a potential divider to reduce the voltage to a more acceptable level. PS asking for device recommendations is the quickest way to get a question closed. read the rules: https://electronics.stackexchange.com/help/on-topic
H: How to add reset functionality to a master-slave D-type flip-flop? I'm trying to implement a shift register and therefore need values to be stored on the downwards edge of the clock signal (otherwise the whole register just sets to the input), so I am using a master-slave D-type flip-flop to store each bit. The design also requires a control line that resets the value stored in each flip-flop to 0 (low voltage) regardless of the clock value. How would I implement this by editing the below circuit? simulate this circuit – Schematic created using CircuitLab AI: An asynchronous reset can be implemented by adding a third input to the lower NAND gate in each of the cross-coupled pairs in your diagram. Connect them together and drive this input low to reset the output; otherwise, drive it high. BTW, it would have been easier to talk about the individual components of your diagram if you had left the reference designators on them.