text
stringlengths 83
79.5k
|
---|
H: short circuit with two power supplies
I have a radio controlled power switch (one that you plug in between the wall and a lamp to switch it on and off with a remote), that has an atmel microcontroller on it. I connected the radio switch to an atmel programmer (Gnd, Vcc(3.3v), Miso, Mosi, Clk, Rst). The atmel programmer is connected and powered via USB.
I accidentally left the programmer connected when I plugged in the radio switch and both the switch and the programmer blew up.
Now I wonder why.
The radio switch's power supply is a resistor followed by a 4 diodes (rectifier?) followed by a capacitor (filter?) followed by a VIPer12A switcher (provides lower voltage?).
I assume that somehow there was a voltage difference between Gnd of my USB port and Gnd of the radio switch, but how can that be?
AI: Power supplies are (usually) voltage sources, approximating ideal voltage sources, so they have a very low impedance looking in. A nonideal voltage source can be approximated as a resistance in series with an ideal voltage source. If we connect two such sources in parallel, we get the following situation, which reduces to a simpler equivalent circuit:
simulate this circuit – Schematic created using CircuitLab
So if \$V_1\$ and \$V_2\$ are not precisely the same, a nonzero difference voltage \$V_1-V_2\$ is applied across \$R_1 + R_2\$. Since \$R_1\$ and \$R_2\$ are very small (ideally zero), even a small \$V_1-V_2\$ can cause a large current to flow.
If \$V_1 \neq V_2\$ and \$R_1 = R_2 = 0\$, then there is a pure short circuit: the circuit cannot be solved for current flow due to division by zero in \$I = V/R\$. |
H: Op-amp subtractor: problems supplying a fixed base voltage to be subtracted
The context is that of a simple sound-level meter. An electret mike, pre-amp (transistor), amplify with a 386 op-amp, detect the envelope of the waveform, and the output the level to an ammeter. (Simple reflection of the level, with no need for a logarithmic response.)
After the envelope stage is complete, the quiet signal is at 4.0V, and with sound in the room it jumps to 4.5-5.0V. Up to there, everything seems fine.
But before I show this signal on a meter, I want to subtract the 4.0V of quiet signal, using a 741 op-amp (the photo's a bit fuzzy, but should suffice):
This requires me to provide a fixed 4.0V to R1 on pin 2, but I'm failing to do that. I tried a simple voltage divider (shown on the left), but I see two problems when I connect my voltage divider (point A, above) to the R1 resistor on the inverting pin 2:
the voltage at A drops by 1.5V
the voltage at A is no longer fixed. It reacts to sound level.
What am I missing?
My voltage divider shares the same +9V and ground as the main circuit.
Here is a link to the schematic.
AI: When you hook up the voltage divider to the amplifier, the divider has to supply some current through R1. Because the R values in the divider are so high, this makes a big voltage change at "A".
From the point of view of the input to the amplifier at "A", the op-amp's noninverting input (pin 2) is held at a fixed voltage by the feedback action of the circuit. It's a lot like a virtual ground except not at 0 V.
You can solve this by using much lower values in the voltage divider (say, less than 1/10 of the R1 value, depending how accurate you want the voltage to be) or by adding an additional voltage follower buffer between the divider circuit and the op-amp circuit. |
H: Missing connection in amplifier example?
I've been staring at the datasheet for NXP's TDA1308 headphone amplifier IC for a while, and I'm just feeling confused.
Their recommended application circuit (Figure 4 in the datasheet) looks like this:
Notice that Vdd, pin 8, isn't connected to anything labelled as a positive power supply. Instead, it's shown connected through what I believe to be a voltage divider, to ground. In fact, I can't see any positive supply anywhere in the figure.
So, the chip looks like it's not being powered, which is very confusing.
Might this be a schematic error? Perhaps the line that has the ⌜ corner in the top left of the figure should continue to a positive supply?
AI: It makes sense that pin 8 is connected to +Vdd. The pin is labeled with that in the datasheet and notice the 100uF (in parallel with 100nF for high frequencies) capacitor to decouple power supply from pin 8 to ground.
R1/R2 form a voltage divider that biases both amplifiers at half the supply voltage so you can suffice with a single power supply (and in- and output capacitors in the signal way).
It seems that the author of the diagram just forgot to include the power supply itself. |
H: A very small microcontroller that can be programmed wirelessly
For fun, I'm building a microcontroller and a couple of sensors into a toy. The microcontroller must fit into a 2 cm wide cylinder. Also, removing it from the toy takes some time, so I'd like to be able to program it wirelessly. It doesn't matter how (IR, wifi, Bluetooth), as long as I don't have to remove it from the toy during testing.
I don't have much experience with these things, and so I don't know what to search for or if such a microcontroller even exists. What would you suggest?
AI: That is going to be very difficult.
The typical way to do this is to have two MCU's. One with a wireless connection that can program the other MCU's. The programming MCU would require some firmware in it that can receive the wireless communications and twiddle the pins on the main MCU to program it. You also have to power this circuit, which will put a burden on your toy's batteries.
This is a big project to make one MCU program the other, and the number of people who would benefit from this (a.k.a. pay money for it) is small. That's why you don't see this in the market. While cool, the market for it isn't large enough to justify the development costs.
If I were you, I would instead focus on a way to make the programming signals accessible without removing the PCB from the toy. There are many ways to do this using fancy connectors or even just spring loaded "contacts" that touch metal bits on the toy.
Sometimes the straightforward approach is the best. Skip the wireless. |
H: How should I build this circuit?
I have this homemade LED-USB thingy to illuminate my desk:
simulate this circuit – Schematic created using CircuitLab
I guess it's not a very technical schematics, sorry, I'm not even near the EE area. The LED is 3V, and according "to the internet" (there was no manufactorer info on it) a blue LED usually supports up to 0.03A.
Thing is, it's not bright enough, so I want to attach more LEDs to it.
Since I have spare current from the USB I thought I should build a parallel circuit. Now, the last class on circuits I had was on high school, so I don't know if my calculations and schematics are correct:
i_total = U_wanted ( 1/r + 1/r' + 1/r'' ), r=r'=r''
i_total = U_wanted ( 3/r )
0.5A = 3V ( 3/r )
0.5A = 9V / r
r = 18 Ohms
simulate this circuit
Is this correct? If so, what material should I use as wire? A copper wire? Also, is it safe to touch it while it's on? I've been avoiding it, but I guess it's a low current and voltage...
AI: The voltage across each resistor/LED pair will be the same, so assuming that each LED has the same forward voltage, you will need to use the same value resistor regardless of how many resistor/LED pairs there are. Therefore you should use 68-ohm resistors.
That much voltage won't even be noticeable through dry skin, and copper wire is an acceptable conductor.
(Also, you don't want that wire all the way on the right side of your new schematic; that will cause a short and possibly break something.) |
H: > 20 Minimum Hfe on a BJT Power Transistor?
I'm having trouble finding what I want due to the way mouser.com limits searching on BJTs. I'm trying to find out if anyone manufacturers a medium to high power BJT with a gain of at least 30. The higher the better. The classic 2n3055 has a minimum gain of 20. I want something higher if possible. Does anyone know if there's anything out there with such high gain and also moderately high current capability?
AI: This question was a poor question... formed from misinformation I read on another electronics site. Recommendation was to always use minimum Hfe in doing calculations. When I look at transistor curves on datasheets, it appears that the recommendation is misleading.
Maximum Hfe occurs in a range of low base current. At a certain 'grey area', as base current further increases, collector current doesn't increase as much. That means the minimum Hfe is only a factor when trying to drive a transistor full on. It's also somewhat of a conundrum since a BJT is never technically 'full on' (as you'd get with a FET). The Hfe simply gives diminishing returns that approach zero once you are pushing enough base current. Since you get diminishing returns, it's not quite realistic to just pick a certain value to turn the transistor full on and then aim for it.
I'm less concerned with minimum Hfe now -- as it's only a rough guide in power transistors.
This comes out of me having had a lot more experience with FETs than BJTs, so I didn't quite have a proper view of things. |
H: Lower voltage and stay energy efficient
My circuit need to be plugged into a normal (canadian) 120V outlet.
But everything on it is made to run 5V.
I'm very beginner, so yet, I'm thinking of adding a bunch of resistance, but I feel that it would be a terrible way to proceed ... if it would work, a lot of power would be dissipated in heat.
How do you proceed to lower voltage from 120V to 5V ?
Thanks !
AI: Use a transformer to efficiently reduce your 120 V a.c. from the wall outlet to something like 9 V a.c. Add a bridge rectifier to convert the 9 V a.c. to pulsing d.c., and then a capacitor to smooth the d.c. Finally, add a linear regulator, like a 7805 to give you a nice steady 5 V power supply. |
H: Concept of "resistance" and "power dissipation" in a transistor - Explanation?
Ok, so I've got way more experience with mosfets than BJTs. I'd become very accustomed to the idea of mosfets having a specific 'on' resistance, which would allow me to calculate actual heat generation and operating conditions for the mosfet quite easily.
I understand a BJT doesn't have an actual 'on' state. Instead, it has a diminishing gain as you raise base current further and further. What I'm wondering about is how to get an idea of how much resistance there is in a BJT -or- how much it will heat up when I operate it in various conditions. I'm guessing that if I have a resistive load that allows 5 amps (for instance) and I am switching it with a BJT, then biasing the BJT on as high as possible will minimize heat generated in the BJT because you open the channel as wide as possible. But what I find awkward is the fact that the gain approaches zero once you get above a certain 'grey area'. So how do I figure out what is practical? Do I just have to look at the gain curve graphs on the datasheet and pick some reasonable range?
AI: To calculate power dissipation in a bipolar transistor you just need to know the collector-to-emitter voltage when it's passing the current that you want to control. This may be called the saturation \$V_{CE}\$ in the data sheet, and it will typically be less than 1 V, perhaps as low as 0.3 V (assuming that your providing enough base current for the transistor to be conducting really well). Multiply that voltage by the current being switched and you have your power dissipation.
Just FYI, there is no "channel" in a BJT. Bipolar transistors work by a completely different mechanism than field-effect transistors. Also, the notion of a fixed source-to-drain resistance for an FET is a highly simplified model and is really just an approximation of the true behavior. |
H: Film or Ceramic Capacitors for Op Amp Feedback BW Limit?
Does it matter what type of capacitor is used in the feedback path of an op amp to limit audio bandwidth?
I have always used cheap Radio Shack ceramic caps reasoning that I shouldn't care about distortion at frequencies above the audible range as long as it serves it's purpose to stabilize the circuit. But it so happens that I have some fancy 47p film caps (polystyrene I think) and I'm wondering if they would actually be better somehow. I must ask because I don't have the equipment necessary to actually measure a difference.
AI: Assumption: By ceramic capacitors, you mean the low cost, no-name generic Y5V ones such as are cluttering up my parts boxes - not NP0/C0G capacitors with tight specifications
Generic ceramic capacitors (not NP0 / C0G) may exhibit some fairly strong non-linearity, with temperature, frequency and voltage. That last, the voltage related non-linearity, is easily handled by using ceramic capacitors rated for an order of magnitude or more greater than the voltage they will be used for, i.e. a 50 or 100 volt cercap for a 5 Volt circuit (Thanks to David Kessner for pointing this out).
Also, generic types of ceramic and mica capacitors act as tiny microphones, changing their capacitance and inducing voltage variations corresponding to incident sound.
This is a function of the piezoelectric effect of some dielectric materials: The accumulation of electric charge across such materials due to mechanical stress, in this case ambient sound. In effect, the capacitor behaves as a piezoelectric sensor, which is not its desired function on a feedback loop.
Both these factors, non-linearity and microphonic behavior, contribute to generic ceramics being not recommended for audio feedback paths, especially where aural quality is important. You should be fine with an NP0 / C0G ceramic capacitor with tighter tolerances. If you don't know what ceramic capacitor you have, it is safe to assume they aren't ideal.
While mathematically, a fractional percentage of distortion appears insignificant, the human ear can often distinguish very minuscule distortion in sound, especially on stringed instrument pure, extended notes.
Besides the scientific concerns above, there is also an entire school of thought among DIY audiophiles, who would swear by various types of capacitor, provenance of the power supply, the color of the PCB, or even the cloth weft and weave of a cable cover, as factors contributing to a non-quantifiable "feel" of a sound system. |
H: Executing Spice commands written in file
I successfully executed ngspice commands via the command line.
When I wrote those commands to the .net file, and run that file via ngspice, they didn't work.
The following is my netlist file:
* gnetlist -g spice-sdb ./RC_filter.sch
* Spice file generated by gnetlist *
* spice-sdb version 4.28.2007 by SDB -- *
R1 2 1 1MEG
V1 2 0 DC 5V
C1 1 0 1uF
* Set Initial conditions: Voltage on Capacitor C1 is being set to zero
.IC V(1)=0
.end
When that file is loaded to ngspice, and then I run the following commands:
tran 10m 5s
plot V(1)
They work perfectly.
But when those commands are written in the .net file, right before the .end line, they don't work when ngspice reads the file:
* ... Rest of file
.tran 10m 5s
.plot V(1)
.end
How can I make these commands to work?
Thank you.
AI: Have a look at the description of .control / .endc in the ngspice manual.
You will have to write something like:
.control
tran ...
plot v(1)
.endc |
H: Problems with UART on STMF4 Discovery Board
I have some problems with UART comunication. My platform is STM32f4 Discovery Board with STM32f407VG.
First my system setup:
void clock_setup(void)
{
RCC->PLLCFGR = (uint32_t)0x27412A04;
RCC->CFGR = (uint32_t)0x00081000;
RCC->CR |= (uint32_t)0x00010000;
while((RCC->CR & 0x00020000) != 0x00020000);
RCC->CR |= (uint32_t)0x01000000;
while((RCC->CR & 0x02000000) != 0x02000000);
FLASH->ACR = (uint32_t)0x00000702;
RCC->CFGR |= (uint32_t)0x00000002;
while(!(RCC->CFGR & 0x00000008));
}
void system_setup(void)
{
SCB->CPACR |= 0x00f00000; //fpu can be configured
clock_setup();
}
Main and button interrupt handler:
int main(void)
{
int i = 0;
__enable_irq();
NVIC_SetPriority(EXTI0_IRQn,0x31);
NVIC_EnableIRQ(EXTI0_IRQn);
SYSCFG->EXTICR[0] = 1;
EXTI->IMR = 0x00000001;
EXTI->RTSR = 0x00000001; //rising edge on
EXTI->FTSR = 0x00000000; //falling edge off
RCC->AHB1ENR |= (uint32_t)0x00000009;
GPIOD->MODER = (uint32_t)0x55000000;
GPIOD->OTYPER = (uint32_t)0x0000000;
USART1_Config();
while(1){
}
return 1;
}
void EXTI0_IRQHandler(void)
{
if(EXTI->PR & (1<<0))
{
USART1_puts("Test\n");
enableBlink = !enableBlink;
}
EXTI->PR |= (1<<0);
}
USART configuration and functions:
void USART1_puts(volatile char* s)
{
while(*s)
{
while(!(USART1->SR & 0x00000040)){
}
USART_SendData(USART1,*s);
*s++;
}
}
void USART1_Config(void)
{
USART_InitTypeDef USART_InitStruct;
GPIO_InitTypeDef GPIO_InitStruct, GPIO_InitStruct2;
NVIC_InitTypeDef NVIC_InitStruct;
/* Enable clocks */
RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1,ENABLE);
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA,ENABLE);
GPIO_InitStruct.GPIO_Pin = GPIO_Pin_9 | GPIO_Pin_10;
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStruct.GPIO_OType = GPIO_OType_PP;
GPIO_InitStruct.GPIO_PuPd = GPIO_PuPd_NOPULL;//GPIO_PuPd_UP;
GPIO_Init(GPIOA,&GPIO_InitStruct);
GPIO_PinAFConfig(GPIOA,GPIO_PinSource9,GPIO_AF_USART1);
GPIO_PinAFConfig(GPIOA,GPIO_PinSource10,GPIO_AF_USART1);
USART_InitStruct.USART_WordLength = USART_WordLength_8b;
USART_InitStruct.USART_BaudRate = 9600;
USART_InitStruct.USART_StopBits = USART_StopBits_1;
USART_InitStruct.USART_Parity = USART_Parity_No;
USART_InitStruct.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
USART_InitStruct.USART_Mode = USART_Mode_Tx | USART_Mode_Rx;
USART_Init(USART1,&USART_InitStruct);
USART_ITConfig(USART1,USART_IT_RXNE,ENABLE);
NVIC_InitStruct.NVIC_IRQChannel = USART1_IRQn;
NVIC_InitStruct.NVIC_IRQChannelPreemptionPriority = 0;
NVIC_InitStruct.NVIC_IRQChannelSubPriority = 0;
NVIC_InitStruct.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStruct);
USART_Cmd(USART1,ENABLE);
}
void USART1_IRQHandler(void)
{
int i = 0;
if(USART_GetITStatus(USART1, USART_IT_RXNE) != RESET)
{
static uint8_t cnt = 0;
char t = USART_ReceiveData(USART1);
USART1_putch(t);
if((t!='n')&&(cnt < MAX_STRLEN))
{
received_string[cnt] = t;
cnt++;
}
else
{
cnt = 0;
USART1_puts(received_string);
for (i = 0; i <= MAX_STRLEN+1; i++) // flush buffer
received_string[i] = '\0';
}
}
}
First problem is when I send Test to terminal it shows ˙ţ‡đ˙ţř
Second problem when USART interrupt is fired it reads only one char from input. During debug ASCII code is the same as send from terminal. But the rest of string from terminal is not readed. And USART1_putch function gives to terminal different char as input.
What can be the problem? Maybe it is something connected with clocks? Code is basing mainly on this tutorial.
AI: When working with the STM32F4-Discovery board (or any similar board), you have to make sure that the pins of the microcontroller you want to use are not already in use by another component on the board. The user manual for the STM32F4-Discovery has table 5, which shows you exactly which IO pins are in use, and which are free. If they are not free, you may still be able to use them, but you will need to check on the schematic how exactly they are connected to other components, and how those components might affect the desired operation.
In your case, pins PA9 and PA10 are not free (they are connected to the USB port and a LED), which most likely interferes with the serial communication. |
H: 10V from USB port
I want to connect a loading cell to the computer via USB port.
The recommended excitation voltage of the load cell is 10V, and USB output is 5V.
The current through the load cell is about 20mA at 10V. Is it safe to just make serial connection of 2 USB ports to get in sum 10V from them?
I suppose that it would draw 40 mA at 5V from each USB port which is far below maximum USB specification of 500mA.
If not, maybe there is some very simple electrical scheme to convert 5V DC to 10V DC so that it can be connected to a single port?
AI: You cannot connect two USB ports in series to obtain a higher supply voltage. You will short out the PC's power supply and although USB is specified with protection for a similar situation, many motherboards do not implement that. This means you'll short the power supply and if you are lucky you PC will restart fine after removing the short circuit.
As an alternative look for a step up / buck / boost converter. These are available from many webshops/ebay for couple Dollars/Euro's and do exactly what you want: input voltage eg. 5V and output voltage most of the time adjustable.
Here is a random example of what I mean. |
H: How high is "high impedance" on this chip (CD74HC125E)
I'm trying to interface my electronics with an existing remote. The remote requires me to set one of its pins to either low or nothing (not connected) to activate it.
While getting the "low" value is easy, I have more doubts about the "nothing". It currently works if I use the "high impedance" state of a CD74HC125E chip. But as the remote consumes about 1.5 micro amp, I'm worried that the "high impedance" state might be a little too low sometimes.
I tried reading the datasheet, but I'm still a newbie and I can't figure out where to read this impedance. Any help?
Datasheet: http://pdf1.alldatasheet.com/datasheet-pdf/view/27003/TI/CD74HC125/+Q51QWUPGZwEYtKhBYw+/datasheet.pdf
AI: Here is a direct link to a datasheet, since "alldatasheet.com" has gone offline.
If you look at the top of page 4, the parameter you're looking for is IOZ, output leakage current. It is given as ±0.5 µA typical at 25°C, ±5 µA worst-case over the commercial temperature range. This translates (assuming VCC = 5 V) to resistance values of 10 MΩ (typ.) and 1 MΩ (min.), respectively. |
H: Use bipolar transistor to power LED from a certain power on?
I'm trying to do the following: I have a LED that is supposed to be on, whenever a control voltage (CTRL) exceeds a certain voltage (0.7V). To do this, I created the following circuit:
I know that a bipolar transistor is controlled by the current, not the voltage and it's probably not the best way to go here. However, it is actually working quite well - except for one thing: When CTRL reaches ~0.6V, the LED is slowly starting to go on until reaching its final brightness at about 0.9V.
Is there any way to make this junction more abrupt - even with an BJT? So the LED does not seem to fade in and out anymore? Maybe I should mention that CTRL itself slowly ranges between 0 and 5V.
AI: There are two simple approaches you could take. The first would be to add a second transistor for additional gain, which will make the off-on transition happen over a narrower range of voltages. Something like this:
simulate this circuit – Schematic created using CircuitLab
The second approach would be to use the second transistor to create positive feedback for the circuit, causing it to have a "snap action" (hysteresis). However, this would also mean that the on-off transition happens at a lower voltage than the off-on transition. Something like this:
simulate this circuit |
H: Arduino Motor Shield R3 Current sensing
I am trying to use current sensing functionality of Arduino Motor Shield R3, the shield is based on L289.
The values that I read seem to be very noisy. I am using Arduino UNO A0 analogRead() function to sense current. To fix this I have tried to use low pass filter between the motor shield and arduino uno.
simulate this circuit – Schematic created using CircuitLab
This helped to fix measurement noise however I have several questions about it:
Is the noise in the sensing signal caused more by the motor it self of the fact that the motor is driven by PWM? (Note I have already increased PWM frequency of Arduino Uno to to 32kHz.)
If I would add a low pass filter to the input PWM signal would the current sensing still be noisy? I have tried adding low pass filter to PWM but it did not seem to change current sensing. The low pass filter however affected the motor, it started to run as usual and slowed down almost to stop over time. Maybe I connected the low pass filter for PWM incorrectly.
Is there actually any advantage of adding a low pass filter for an input PWM signal or is 32kHz PWM fast enough and I should just go with the low pass filter for current sensing?
AI: From the block diagram in the datasheet, you can see that the current sensing is influenced by the output stages of the H-bridge. This means that when you use PWM to drive the motor, the Sense voltage will vary with the PWM signal. The voltage across the sense resistor is proportional with the current through it, which in turn depends on the voltage across the motor's induction. During the positive period of the PWM signal, the current will be 'slowly' increasing whereas during the negative period of the PWM signal the current will be 'slowly' decreasing. In practice this will look a bit like a triangular wave and that is the noise you measure.
The solution is to make sure that you synchronize the sense voltage measurement with the PWM signal. For example you can attach an interrupt to the timer that is used for the PWM signal and it requires a fair bit of digging into the microcontroller's datasheet (and some trial-and-error) to figure out how to realize that. Another option is to connect an interrupt pin to the PWM output pin, which may be simpler to start with. It can be done, though you might need to lower the PWM frequency (to fit the ADC conversion within the PWM duty cycle), directly program the hardware registers (Arduino libraries are slow) or use some assembly. |
H: Wireless communication between multiple microcontrollers?
I have 3-6 microcontrollers, up to 2m apart. One of them is designated the server and will be fed sensor data from the others, at least at 100 Hz. (Each data point is just a couple of bytes)
Since the microcontrollers move around, I can't connect them with wires. What's a good wireless solution here?
My initial idea was Bluetooth, mainly because that's the one solution I'm familiar with, but Bluetooth consumes much power (my circuits will be battery-powered) and Bluetooth modules are expensive.
AI: For communicating within a couple of meters range, these nRF24L01+ modules, at around $1.42 apiece on eBay, would suit the requirements:
The module has a PCB trace antenna, which does a pretty reasonable job.
The range seems to be stable at around 6-7 meters during the day, and I have occasionally seen as much as 20-25 meters late at night when most other electronic devices in the vicinity are off.
Sparkfun sells a similar module but with an SMA connector for an external antenna, which claims as much as 100 meters range at 250 kbps data rate. Of course, at nearly $20 plus the cost of an antenna, that may be overkill for the required 2 meter range.
Relevant to the specific application:
The key improvement of the nRF24L01+ over the now obsolete nRF24L01 is the implementation of an auto-retransmit feature, which addresses the collision detection complexity concern raised in comments on the question. |
H: Control NES via Arduino
I'm relatively new to electronics - most of my experience is just tinkering with Arduino projects in a more limited sense. I've been working on a project for a week now and have a bit of a (probably basic) quandry..
So I'm trying to convert an SNES controller to be wireless. I've got the SNES Controller side finished - its an ATMega328 + nRF24L01; I'm using the SNESPad library to get input from the controller - I put the state into an int and send it off to the receiver - another ATMega328 and nRF24L01; from there I can bitshift to get the state of each button.
That all works perfectly.
What I'm struggling with his how to take the current state and output that back to the SNES. I've looked at the NES/SNES serial protocol, and understand what I need to be doing there, but the only part I can't figure out is how to wire the sucker. The SNES has its 5v vcc line and its ground. I would imagine I would tie its ground to the ATMega's (it's powered by its own source), and not take the 5v. At that point, I should be able to read high/low off of the Clck, latch, and data lines coming from the snes? Or is that not the case?
To sum up the root of the question, I have a powered circuit that I want to interface with another circuit - is sharing ground all I need?
AI: If your ATMega is running off its own 5V rail, connecting the grounds should be all you need to do. If the ATMega is running off a different supply voltage (e.g. 3.3V) you would need some level shifting circuitry to avoid damaging the ATMega with the higher level signals presented by the SNES hardware.
(I wonder why the 5V from the SNES wouldn't be good enough to power your ATMega. I can't imagine it drawing tons of current...) |
H: How to use iPhone to evaluate an IMU chip?
I have a quadcopter like the below (source of the image)
and I have an IMU (inertial measurement unit) having acc sensors in X-Y-Z and gyro sensors in X-Y-Z. Now I am trying to find an iPhone app by which I can check the values such as rotation and accelerations in each dimensions over X-Y-Z coordinates. I need to export the data in order to design a proper smoothing algorithm probably with Kalman filter or incremental filter. I noticed that the IMU needs to be calibrated because levels do not start with zero for non-moving object. For this kind of things, independent measurements with iPhone could help to adjust things.
So how can you use iPhone to evaluate an IMU chip? Which apps? Other considerations?
AI: What are the specifications on the iPhone accelerometer? If this were something I was working on, I would start with a static 3d test to validate the imu output when it was fixed In multiple known positions. The iPhone uses a fairly cheap part, you could probably figure out what the part number is by doing some sleuthing, and then you could figure out if the iPhone is better or worse then the imu's you are looking at
(Updates 5/27/13)
From this teardown http://www.ifixit.com/Teardown/iPhone+4+Teardown/3130/2 Apple seems to use a ST Micro proprietary part. This part ST L3G4200D (http://www.st.com/web/catalog/sense_power/FM89/SC1288/PF250373) is mentioned as a potentially commercially available part.
The Iphone isn't intended as an IMU, and so if I were trading off performance vs cost when designing it, I'd go for the lowest performance, cheapest part that would work.
In your case, I'd build a fixture that I could mount an IMU in, and fix it in multiple orientations so I could determine how accurate and repeatable the IMU reading were in a known, accurate position as you're taking data. Make it so that you could put in arbitrary positions and you can evaluate coupling between directions.
I like having measurement techniques that are accurate enough to truly evaluate differences between systems. If you're using a iPhone as your reference, then you'll probably have trouble figuring out the difference between multiple sensors. |
H: How do I decide the resistance of a DC solenoid valve?
I am designing a circuit for a solenoid valve from BIO-CHEM. My product number is 075P2N024-02SQ. I want to know the resistance of the valve in order to decide how big a resistance I should use in series. Here is the printscreen of electrical chart.
I use "Power:2.8w" and "Current:0.1 amps"to get one value of resistance: 280 ohm.
I use "Voltage:24VDC" and " Current:0.1 amps" to get one value of resistance: 240 ohm.
I use "Power:2.8w" and "Voltage:24VDC" to get one value of resistance: 205.714 ohm.
I use a ohmmeter to get the value: 213.6 ohm
Which one should I believe?
AI: You don't wish a series resistor. You want a supply that can provide 24 VDC @ 0.1 A. You can think of the device as having resistance in the 206-280 Ohm range as you wish. But that's what it is, not what it requires. See PeterJ's comment.
I might guess the difference in your calculations is rounding. Or there may be a maximum power the part can take, to allow for voltages a little higher than 24 VDC, but it doesn't need that much to operate. |
H: Charge indicator LED
I'm designing a battery charger PCB using a LTM8062 2A battery charger IC. I'm going to use it to charge a 14.4v battery and I would like to have an indicator LED to let you know when it's done charging. The IC has an active low CHG pin for this purpose. However, the datasheet says: "Open-Collector Charger Status Output: typically pulled up through a resistor to a reference voltage. This status pin can be pulled up to voltages as high as Vin and can sink currents up to 10mA. During a battery charge cycle, this pin is pulled low. When the charge current falls below C/10, the pin becomes high impedance."
My question is, how can I hook up an LED that only turns on when the pin goes to high-impedance? (I'm assuming high-impedance means the pin is left floating) I'm thinking of using a PNP transistor, with the base hooked to the CHG pin, which also gets pulled to ground. The LED is hooked up to the collector end, and the emitter is just hooked up to the voltage source. Is this the correct way to do this?
AI: As described, you could place a resistor from CHG to either battery+ or to Vin and an LED from CHG to ground. Resistor value depends on desired LED current.
When CHG is low LED is off.
When CHG goes O/C CHG is pulled high by R and LED is driven.
If you use say Vin = 16 V and want say 2 mA I_LED the R ~~= ( Vin - V_LED)/I_LED
~= (16-2) / .002 =~~ 6k8.
The LTM8062 comes in an LGA package which is liable not to be overly home-constructor friendly.
It costs about $17 in 1's which is high if only basic functionality is going to be used.
However, it will work with a range of battery chemistries and it has MPPT capability. If you need the fancier features it's a bargain.
LTM8062 data sheet here.
15 x 9mm LGA package. |
H: VCO - sawtooth and duty cycle?
I've successfully built a VCO using an LM13700 OTA. The circuit generates square and triangle wave. I wonder if I can add a couple of diodes and a potentiometer to be able to skew between triangle-ramp/saw and change the duty cycle of the square wave? Is it that simple?
The second schematics gives you an idea of what I meant. It's a similar circuit realised with op amps.
Any idea would be very much appreciated!
AI: I googled "LM13700 VCO" and the top answer was the pdf file which contained: -
Figure 37 should help and figure 38 is for a sinewave. Note that if this is to be part of a synthesizer project you'll need octave / volt tuning and not linear tuning as per your design and TI/Nat semi design. |
H: Relay resistance
Excuse the crude ms paint drawing.
The above is based on an actual relay whose coil has a resistance of 320 ohms. The common to normally closed contact has a resistance of near zero. When the switch is open, no current goes through either of the parallel paths. However, when the switch is closed (this is where i get confused (the rest is my guessing)), first current would flow through the coil. This would thus close the contacts. However when this happens wouldn't the current (by Kirchhoff rule) go only through the contact and bypass the coil. This would thus open the internal contact and current would be forced to flow through the coil again. Then the current by kirchoff would go through the contact. Thus the process would repeat. What actually happens? Does it flip on and off extremely fast or does something else happen? In real life it does not flip on and off and rather current flows normally.
AI: The idea you describe can work, but it is very crude to remove the power from the coil by shorting the battery. At the very least you should insert a resistor to limit the current somewhat, as is you rely on the internal resistance of the battery, which can be OK for a 9V radio battery, but disastrous for 12V car battery.
The more common way to achieve roughly the same is to use a 'relay' with a Normally Closed (NC) contact, so you can open the circuit instead of shorting the battery. This is in fact how the common electro-mechanical doorbell works. |
H: Fastest way to toggle a bit in ASM
What's the fastest way to toggle a bit1 in MPASM for the 14-bit enhanced instruction set? (I'm working with a PIC16F1829)
The code has to be standalone - I mean that it can be called on any moment, without knowing the value of the bit on that moment.
Key criteria is speed here: a program with fewer instruction cycles is better. The number of instructions cycles is calculated as the number when the bit is 0 + the number when the bit is 1, divided by 2.
1: with toggle I mean that the code has to be similar to pin=!pin in C
AI: You could try the following using an XOR:
movlw 0x01 ; move 0x01 to W register
xorwf lat, F ; XOR W with port & store result in port latch
An exclusive OR operation will preserve the values in bits where the bits in the working register are set to zero and invert the values where it is set. So you could also use the same technique to toggle multiple bits. |
H: How do I decide the bandwidth of a driver through 'input transition rise and fall rate'?
I am carrying out a design with a driver:74LVC1G125 datasheet of 74LVC1G125. Signal that will go through this driver is about 600khz so I have to know the bandwaidth of 74LVC1G125. I have read the datasheet and I can not find anything about bandwidth but an unknown parameter:input transition rise and fall rate.
I think it must has something to do with the bandwidth of 74LVC1G125 and I find a description about itinput transition rise and fall rate.Unluckily, it makes me more confused that this parameter is about the amount of ground current. So can anyone give suggestions about bandwidth of this driver?
AI: Bandwidth isn't the term your looking for, you want to know what the maximum operating frequency or switching rate is. Look to table 11 snipped here.
I'd use max numbers, so at 5.0 V and room temp you can run that at 4.0 ns + 4.0 ns = 8.0 ns which is 125 MHz. The IC will run that fast but it may not be useful for you unless you can make sure that you can handle the variable delay in subsequent circuits. |
H: microcontroller slew rate
I have to control some device which require minimum 40mV/uS as slew rate for ENABLE input. My mcu runs at 3.3V so the rise and fall should be faster than 82.5uS. This is correct? Does it matter the actual speed of MCU?
AI: Yes, that's correct. If you're comparing to datasheet rise time maybe it would be slightly better to use 2.6V for the calculation, as the rise times are spec'd at 10% - 90% voltage instead of the full 3.3V swing.
But it hardly matters here. Any microcontroller should have faster edges than that. You normally would only get in trouble with slowly rising lines, e.g. an RC delay circuit, or open-collector outputs, or if the enable input is shared with a lot of capacitance for some reason. A microcontroller with its push-pull outputs should give a really nice signal. |
H: What makes a magnetic field probe insensitive to E-fields?
Consider a magnetic field (B-field) probe such as this one:
(source)
I understand that as as the magnetic flux through the loop formed by the coax shield changes, the charge carriers in the loop will be shoved around the loop by Faraday's law of induction. Since the loop is small relative to the wavelength of interest, we can pretend that the current in it is constant. The high impedance formed by the gap at the top means this induced current will be accompanied by a voltage difference at the gap, and that voltage difference will travel down the transmission line formed by half of the hoop and the feedline to \$Z_L\$, where it's measured. In this way, the probe measures the B-field.
But, what about the E-fields? The point of this probe is to be maximally sensitive to B-fields and minimally sensitive to E-fields. Why is it not sensitive to E-fields?
AI: It is sensitive to E-fields, but since it is shielded the only reasonable place for the E-Fields to interact with the conductor is at the very top and the wavelength must be of the same order as the size of the gap for it to couple in any energy.
That is presumably several orders of magnitude difference in wavelengths and your circuit that is analyzing the output will be looking at the larger (presumably) return signal form the dominant magnetic coupling. The E-Field that is of the same wavelength as the H-Field will not "see" that gap. |
H: Why use an input resistor in this current sense circuit?
In the Linear Technology AN 105 on current sensing one can find the following circuit.
I am wondering what the purpose of the 200 ohm resistor on the inverting input is. It appears to have no effect.
Note that in the following paragraph a virtually identical circuit is presented that is lacking said resistor:
As a side issue: is there any downside to sizing the 200 ohm input impedance resistors significantly larger, e.g. 10k? (Keeping gain constant.) The aim would be to reduce the current the opamp draws from its supply to drive the BJT.
Edit 1: Need for Q1
In the comments it was questioned whether the output transistor Q1 was needed. See my comment below on my interpretation.
Edit 2: Johnson noise
The Photon's back of the envelope calculation suggests that the input resistor's Johnson noise is not likely to be an issue even for large values if 0.1% (of output range) noise on the output is acceptable: $$ Vrms = 10\times \sqrt{R}\sqrt{\Delta f} \times 10^{-9}\text{in Volt}$$
For Vrms = 0.005V and 70kHz: $$ R = (\frac{Vrms}{1.3\times\sqrt{\Delta f}}\times 10^9 )^2 = 211 G\Omega $$
AI: The 200 Ohm resistor on the inverting input has no effect for an ideal op amp, which has no input current.
But real op-amps require a (very small) bias current, and also have offset currents flowing from the non-inverting input to the inverting input.
Because of the offset current it's best practice in a precision circuit to have equal impedances feeding the two inputs of the op-amp.
In the case of the LT1637 with 5 V supply, the offset current could be as high as 15 nA. If the input impedances weren't balanced this could cause an error of up to 3 uV, corresponding to an error in the current measurement of 15 uA.
is there any downside to sizing the 200 ohm resistors as e.g. 10k?
There's no real issue with a small change in that resistor value (for example to 211 Ohms or something), but no advantage either.
If you were to increase the R1 resistance to 10 kOhms, I'd start to worry about Johnson noise generated by the resistor. But I haven't looked at the effects carefully, and of course the maximum acceptable noise depends on your system-level requirements. |
H: Raspberry Pi GPIO
I need to make a connection between the "Device"'s 2 wires using a Raspberry Pi, but I am unsure how to go about doing this (and I don't want to just play about with it and get it wrong as I might end up hurting my Pi).
The 2 wires coming from my Pi are a GPIO pin and ground, I figure if I make a direct connection between the "Device" and Raspberry Pi and set the GPIO pin low this would create a connection between the two wires, is this correct? Will I damage the Pi because of the 5v coming from the "Device"? If I set the GPIO pin high, will this break the connection?
Also the 0v/ground of both the Device and the Raspberry Pi are not common, does this affect things?
EDIT:
Would something like this work
Thanks
AI: I did some experiments with couple of floppy drives I have and it appears that on the step pin, current is limited to around 5 mA. This means that we can indeed omit the collector resistor in this case. For base, I'd recommend a 1 kiloohm resistor. This will give us 3.3 mA coming into the base of the transistor, which should be more than enough to saturate usual small signal transistors.
Another point worth mentioning here is that same setup will most likely be needed for the direction pin as well, in order to prevent read heads from colliding with end-stops. Some floppy drives have security mechanisms which will prevent the stepper motor from forcing the head when the disk is inserted.
So the schematic looks something like this:
simulate this circuit – Schematic created using CircuitLab
OLD ANSWER:
I was about to make a really long comment, but then decided that it's better to turn it into an answer in hope that you'll be able to better understand our standpoint.
First, you're being difficult to work with! That may not be obvious to you, so I'll try to explain: You came to us with a question that looks basic and emits air of someone who isn't very experienced with electronics. In your question, you already have some idea for a solution to your problem (which is good, since in general we like it when people post questions they thought about) and then you exclusively ask for help related to implementation of your solution and are avoiding any information that could lead us to provide any other way to accomplish your real objective (which is bad).
The problem is that your solution (as you posted it) is in direct conflict with what we got as a part of basic electronics training! This is NOT a minor thing. I'll provide an analogy which will hopefully make this a bit easier to understand. Imagine this scenario: You just spend a whole evening drinking alcoholic beverages with your friends and can barely walk in a straight line. Now you're planing to get in your car and drive back home. While there is a chance that you will be able to get home safely, and it's true that many have done so in similar circumstances, there is also a great big chance that you will crash and kill yourself (or worse) and possibly someone else as well, making such a plan a bad idea in general.
It's relatively same with what you're providing. Sure, it seems that nothing bad is happening when you short the two wires together by hand (just as many drunk people drove safely to their homes), but it doesn't mean that it's the proper way to do it (unless we're really convinced that it's safe, for which we need details which you refuse to provide believing that your plan is correct).
Instead, the proper way to do this (assuming that you just have a simple control line that's being monitored by stepper motor driver) would be to place an appropriate resistor between the transistor and +5 V line, which will limit the current, so that we don't have a short-circuit there which could potentially destroy the driver.
Unfortunately, we can't tell you what type of resistor to use, since we don't know anything about your circuit and you refuse to provide information. Also the transistor itself needs to be appropriately dimensioned to be able to survive the current, provide low enough impedance to the current's path and switch quickly enough. Again we can't do that without any additional information.
Next, in comments I recommended a MOSFET since they can survive greater currents and dissipate less power that NPN transistors. You said that you don't have a MOSFET and want to use an NPN transistor. It's quite likely (based on my assumptions at least) that your NPN transistor would work just fine instead of a MOSFET, but for it and the Pi to work fine, you should use a resistor to control the current going from the Pi into the base of the transistor. Remember, Pi can provide only a little bit of current on its GPIO pins. Without knowing which transistor you have, we can't give you a good recommendation for the base resistor value. We can provide some values that may or may not work fine, but that's against what we're supposed to do and it's called bad engineering. You could also make this work without a base resistor on the transistor, but for how long it's going to work (if at all) and will the Raspberry Pi survive that, we can't tell. You'd be risking a $35 computer for a $0.1 resistor, which is pointless.
Finally, there's the coupling of two grounds. Since they're both grounds of two different wall adapters, I personally can't see anything bad happening if you short them together, as shown in your circuit. Some noise may couple into the Pi from the motor, but I don't think it will be a problem.
I hope that this provides a bit of background on the long comment chain. |
H: Generating 19kHz and 38kHz phase-locked sine waves
As a personal project, I'm designing a stereo FM transmitter from scratch. Part of this entails design of a stereo multiplexer.
Using this description, I've worked out how I'm going to implement most of the stereo multiplexer in analog hardware. The only thing I'm having trouble with is figuring out how to generate 19kHz and 38kHz phase-locked sine waves. I'll need the 19kHz signal for the pilot tone and 38kHz signal for the DSBSC mixer. I'm pretty sure if they're too far out of phase, the receiver will choke up trying to demodulate the L-R channel.
As the square wave can be busted apart into sine waves with Fourier analysis, my current design feeds a 38k crystal oscillator into a TTL frequency divider to get in-phase 38k and 19k square waves, then uses Sallen-Key lowpass filters with a high Q-factor (Q=10) and the cutoff frequencies set to the fundamentals to pull out the fundamental frequenies and block the harmonics. Here's the circuit I was using to simulate that. The trouble is I can't easily guarantee the sine waves will be in-phase, as by setting the cutoff frequency close to the frequency of the sine wave I'm trying to get means that it's at the same spot as the steepest drop on the bode phase plot.
Ideas? I think PLL would help out here.
AI: Generate a sawtooth wave (so it has even harmonics) at 19kHz and use a 19kHz and 38kHz tank circuits to get the two frequencies. Or take the 19kHz sine and rectify it (full wave rectification doubles the frequency).
Here's a stereo decoder from my Leak Troughline Stereo tuner (only 3 transistors):
Q1 amplifies the pilot tone, which is then rectified (using D3 and D4), then Q2 generates the 38kHz signal that is phase locked to the pilot tone.
Though I'm sure it's possible to do this easier now compared to when the FM stereo was just introduced (and the tuner was designed). |
H: Non-round through hole issues for Micro USB
I'm on a project where a microUSB connector seems to need a bit more mechanical strength than a surface mount, so I'm looking at through hole receptacles.
The pic is of a Hirose part, bottom of page 6 in THIS PDF, and Molex has similar footprints
A few questions - Do the non-round through holes need to be plated for increased mechanical strength, or is the solder connection to both sides good enough?
If they need to be plated through holes, and I'm using EagleCad, I assume the only way I'm going to get it done right is to communicate with the board house. Does anyone have any experience with non-round plated through holes and Eagle that they can share?
AI: If your board house supports internal routing, you can use a 'wire' on layer 46 (milling) to make oblong holes. Basically set the width to 0 (or some small number) and draw the shape using the wire command. Another thing you can do is to create the oblong hole using overlapping drills spaced a distance apart (basically offset). That is the reason why some board houses disallow "overlapping drills", so you will have to check with your board house. |
H: Should I use lead free solder?
I have been a hobbyist solderer for about 6 years now, and my skills are very proficient. I have always used lead solder because my experience with lead free solder is awful. But I'm going to college in a few months and I just upgraded to a very nice digital soldering gun because I am making and selling aviation cables online. I am hoping to expand my little cable business in college and if I am going to be soldering often I would like to get away from lead solder.
Are there lead free solders that can be used as easily as lead solder, and if so, if there really any health benefit from lead free solder? Are the fumes from solder toxic, and does lead free solder solve that problem?
AI: Use leaded solder if you can. It is easier to work with, requires lower temperatures, and there are less quality issues with the joints. The only reason to use lead-free solder is if it is not allowed in your jurisdiction or you are want to sell soldered goods someplace (like Europe) where this is forbidden for practical purposes.
No, lead in solder doesn't pose more of a health risk to you when soldering. The vapor pressure of lead is so low that there just aren't significant numbers of lead molecules in the air as a result of soldering. The predominant health danger from soldering is inhaling the vaporized flux. This is made more dangerous by lead-free solder since the temperature required for a good joint is higher. Even that is a small issue compared to different types of fluxes. If you are worried about this, use a fume extractor. In any case, avoid breathing the immediate vapors from soldering, whether leaded or lead-free and regardless of the type of flux. |
H: P-Channel Mosfets in Series to Increase Max Drain-Source Breakdown Voltage
Would there be any problems with putting two P-Channel MOSFETs in series in order to double the maximum operating voltage for drain-source? The body diodes when used this way should act just like ordinary diodes put in series to handle more voltage, correct?
AI: There are a couple of issues that you need to be aware of.
First of all, you need to make sure that they share the blocking voltage equally. Just like with diodes, you need to put high-value resistors in parallel with their drain and source terminals such that the current through the resistors is on the order of 10× the reverse leakage current of the transistors (or diodes). This will equalize the voltage drops to within 10% or so. Also, the speed of the individual devices might vary a bit, so it's also a good idea to put capacitors (typically 1 to 10 nF in line-frequency applications, less at higher frequencies) in parallel with them as well, to tame the transient behavior.
The second big issue is that the gate drive to each transistor needs to be relative to that transistor's source terminal; they can't share a common connection. Depending on the application, you might use transformers, optoisolators or specialized high-side driver ICs to allow each of the gate drive signals to float relative to all the others. |
H: Adding 4-bit numbers to 16-bit shift register
I am trying to find a way to add four 4-bit binary numbers to a 16-bit shift register, one(group of 4 bits) by one. This way I can store 4 decimal numbers(0-9) in the register, adding them by pushing 1 of 10 buttons labeled from "0" to "9"(simple push buttons).
I thought of something but I think it's wrong:
Step one: load 4-bit data
Step two: shift them four times
Step three: load 4-bit data again
But the simulator say it does not know the values of the shifted bits.
Another way would be adding the numbers bit by bit, using only the "shift" and the "input pin", but it won't be easy since there's a clock.
What is the best way of doing it?
AI: The LOAD DATA input isn't just loading the high 4 bits, it's loading all 16. Since you have no inputs connected to the other 12 bits, the stored values are going to the unknown or 'x' state.
You can easily fix this by just using 4 4-bit shift registers. If the LOAD DATA input only controls one of the four, the other registers won't be affected when you load the first one.
simulate this circuit – Schematic created using CircuitLab
The circuit you have currently is equivalent, but with all the LOAD pins tied together. |
H: Floating Voltage to Bias a P-Channel Mosfet without Exceeding Source-Gate Max Voltage
I'm not sure if this is what you'd call "floating voltage" or not. I'm lacking on some terminology so bear with me. Here's the circuit with explanation below:
The premise of the circuit is this: I want to power L1 coil with square pulses. You can see I've got a freewheeling diode to handle the back emf field collapse to protect the circuitry.
From previous experiments and talking to others on here, I learned that using an N-channel mosfet on the high side of the coil like this doesn't work because the large negative voltage during the back emf coil collapse puts negative voltage on the mosfet source which causes the gate (at zero volts) to turn on while the field is collapsing.
I experimented with BJTs and they make it easy to fix the problem, but they also get hot. I really want to use mosfets for the ability to pass a lot of current with minimal resistance. So I've switched to a P-channel mosfet in the circuit shown. This seems pretty simple but I'm adding a level of complexity.
I want to have arbitrarily high voltage in the main circuit -- 80volts shown here but it could be more or less. Since the voltage is prone to change in use conditions, the circuit design must be agnostic to the actual main power voltage . In the 80 volt example shown, since the p-channel mosfet requires 80volts at the gate to turn it off, I have added a small resistor network to supply the required voltage from the power src. You can see I'm using a 555 and some BJT's to pull down the gate voltage to turn it on.
Now the tricky part. From my understanding, I can't drop the mosfet gate all the way to 0V because that would make an 80volt difference between the Source and the Gate which would destroy it. I need to make sure the gate drops to about 12 volts less than the Source but drops no further. THe solution I've come up with is to add a 12 volt zener diode and adjust the resistances accordingly so once the gate starts to become more than 12 volts less than the source, the diode will reverse bias and bring the gate back up. It should stay right around 68volts if the power supply is 80 volts -- as long as the BJT is biased on anyway. Once the BJT turns off, the gate will recover to 80 volts and shut off the mosfet.
So my question is simply this: Am I doing this right? Am I over-engineering it or perhaps doing something wrong? Let me know. Thanks!
Jim
AI: Here's a better way to drive a high-side P-channel MOSFET:
simulate this circuit – Schematic created using CircuitLab
Note that the BJT Q1 is a current sink; the current value is the control voltage divided by R2. If your control circuit puts out 12V, the current will be 12 mA.
This current will create a voltage drop across R1 as well, and if you happen to make the two resistors equal, this voltage drop will be essentially equal to the control voltage supply (minus the VBE drop of Q1). Or you can make the resistors different in order to get a particular relationship.
You need to be aware of two things: The current level that you set will have some bearing on how fast the MOSFET M1 switches; higher current means faster switching. However, keep in mind that Q1 has a lot of voltage across it. When off, it has the full high voltage supply across it. And even when switched on, it has the high voltage minus 2× the control voltage across it. This means that it will be dissipating power equal to that voltage drop times the current when on. |
H: What is the term for resistance to change in current and what is its correct formula?
In all the texts I read, including online tutorials, "reactance" is defined as the resistance to alternating current and they always base the equation off the assumption that the voltage is continuously changing. The equation is X(L) = 2piFL
But as far as I can tell, this doesn't seem to hold up right when you're talking about a coil's reaction to applied DC where you apply a steady ON voltage and then wait for the current to reach maximum amplitude.
As far as I can tell the inductive resistance to a 50% duty cycle square wave is actually just 2x the circuit's DC resistance if the pulses are timed to exactly 1/4 the inductor's natural frequency. The current will rise and fall steadily at the start and end of every pulse. During the transition period, it will always move from zero Amps to maximum Amps assuming you are always cutting the voltage input right when the maximum current amplitude is reached. So the result is you're getting approximately half the current you'd get if it were just a continuous flow DC circuit.
Can anyone clear this up if I'm missing something here. And if I DO understand it right, then is there some special term for what I'm describing?
Here is a diagram of what I'm talking about:
It appears to me that the average current is just a matter of computing the average amplitude of a parabola, which I don't know how to do. LOL I can go research that, but I'm just trying to see what some of the other folks have to say about this.
AI: they always base the equation off the assumption that the voltage is
continuously changing. The equation is X(L) = 2piFL
That's actually not quite right. The correct assumption is that the voltage is sinusoidal. There are an infinity of voltage waveforms that are continuously changing but are not sinusoidal.
More generally, for an ideal inductor, the voltage across the inductor is proportional the time rate of change of the current through the inductor. If you place a constant voltage across an inductor, the current changes at a constant rate.
So, generally, the voltage across an inductor does not have the same form as the current through the inductor; the waveforms "look" different.
However, if the current is a sine wave, the voltage will be a sine wave though there will be a difference in phase.
Since both the current and voltage have the same form, we can take the ratio of the magnitudes of the voltage and current sine waves and call that ratio the reactance. Since higher frequency sine waves change more rapidly, the reactance increases with frequency.
For analyzing non-sinusoidal waveforms, like a square wave, one can use calculus to find the average current in the time domain. If your voltage source and inductor are ideal, the current waveform for a voltage square wave would be triangle wave:
not a parabolic wave. If there is significant internal resistance, the current looks more like:
So, your parabolic current waveform isn't the result of applying a voltage square wave across an inductor. |
H: plotting frequency response
Above is an excerpt from a textbook. My question is, why is that when we plot H(w), we need to think of it as a complex exponential???, can't we just plug in values for w and t, evaluate it, and then plot it?? (I thought that if we are going to plot H(w), we simply substitute the value of 'w' and assume t as constant and then plot the corresponding value to the w axis)... If we think of it as a complex exponential, the magnitude is 1. But what if H(w) is not of the form "", but it is in the form of . How can now we plot it? (It has no complex exponential on it so theres no way to regard for magnitude and phase.)
AI: why is that when we plot H(w), we need to think of it as a complex exponential?
We don't need to think of it that way but it's convenient in this case to do so.
We know there's a property of Fourier transforms where if
\$x(t) \iff X(j\omega)\$,
then
\$x(t-t_0) \iff X(j\omega)e^{j\omega{}t_0}\$
So in this case writing the frequency response in this form makes it clear that the time domain effect is a delay shift.
But what if H(w) is not of the form \$e^{-j\omega{}t_0}\$, but it is in the form of \$j\omega\$. How can now we plot it? (It has no complex exponential on it so theres no way to regard for magnitude and phase.)
There's no reason it should have to have an exponential component. Any complex number has a magnitude and phase.
For example, 3 + 3 j has magnitude \$3\sqrt{2}\$, and phase \$\pi/4\$. And \$j\omega\$ has magnitude \$\omega\$ and phase \$\pi/2\$.
In general if you have a complex number a + jb, its magnitude is \$\sqrt{a^2+b^2}\$ and it's phase is \$\mathrm{atan}(b/a)\$.
If you have a complex response function that depends on frequency, you can always plot its magnitude and phase as a function of frequency.
If you already know the magnitude and phase of a complex number it's convenient to write that number in the form \$Ae^{j\phi}\$, but that's not the only way to write it. You can also write \$A\cos(\phi) + jA\sin(\phi)\$. |
H: Reactance / Inductance / Impedance of a 1:1 Transformer
I've searched around and poored through what references I have available, and haven't been able to find an answer to this question.
Regarding 1:1 transformers, I found a website where an audio amplifier electronics guy mentioned that it doesn't seem too much to matter how many winds you put on a 1:1 transformer so long as the reactance/impedance is at least about 4x the circuit impedance. He said "about" as if there was no magic way he calculated it -- it was simply based on his experience building and fixing amplifiers and transformers. I was wondering if someone shed some light on this issue.
I'm most interested in a full-load transformer. Here's a circuit showing an inductor and resistor in series with the transformer.
What is a practical Z for the primary coil of the transformer to make sure it works properly? And what kinds of problems will arise if my Z is way too low?
So for the sake of total extremes. Assume I only had 100 Volts and 0.9amps in the primary circuit, limited mainly by the resistance and impedance of R1 and L1 Let's assume the resistance of the transformer is minor for simplicity. What is going to happen in the secondary circuit if my impedance on the transformer primary is near zero? Will I just get no power at all in the secondary? Will I get some current with very small voltage?
And what will happen if the reactance of the transformer primary is 100Ohm making it very similar to the L1?
Thanks in advance.
EDIT: I should clarify that by "full-load" transformer, I'm meaning the condition that the transformer secondary is dead-shorted. The diagram is showing an amp-meter (A) between the leads.
AI: You should possibly consider looking at the transformer in two ways; one without a load and one with a load on the secondary.
Without a load on the secondary, the transformer is just an inductor and if you have components (such as L1 and R1) in series with the primary, the voltage developed on the primary will not be the full AC amount from your generator. It's a simple case of calculating the impedances and volt-drops. This is with the secondary unconnected remember.
The primary has inductance like any other coil but, for a transformer to more effective, it is desirable for the primary's self inductance to be high in power applications. If you looked at how much current flowed into the primary (secondary open circuit) you would find that the current was small compared to when driving a load on the secondary and it may have an inductance of several henries.
With 10 henries inductance, at 50Hz the impedance is 3142 ohms and from 230VAC would take a current of 73mA - that current through R1 (10 ohm) hardly drops any voltage.
It's a different matter when there is a load on the secondary. If the turns ratio is 1:1 and you have 100 ohms on the secondary, it is reasonable to argue that the impedance presented to the primary circuit is also 100 ohms. This assumes power out is close to power in. In fact the impedance relationship between primary and secondary is related to turns ratio squared. For instance if it is a 10:1 step-down transformer with a load of 100 ohms, the equivalent impedance at the primary is 10k ohms i.e. 10 x 10 x 100.
In summary, for a power transformer, you'd like the primary inductance to be infinite but that is impractical so you live with something that doesn't take too much current when the secondary is open circuit. The off-load current that flows is real current taken from the AC power and if everyone had low-impedance transformers the electricity companies would be supplying a load of current that doesn't get them revenue. This is a slight exaggeration but not far off the truth. On industrial sites power factor correction is used to minimize this effect but that's a whole new story!
And if your transformer primary was 100 ohm impedance you'd be seeing something less than half your AC voltage applied. If R1 was zero then you'd see exactly half.
As regards saturation I've shown the equivalent circuit of a transformer below. Note that saturation is caused by the current flowing through the magnetizing inductor which is nothing to do with load current: -
Here is a good document from Elliott Sound Products and please note what it says about maximum flux density therefore saturation:
Why doesn't the core saturate more under load conditions? Imagine two coils sharing the same magnetic core. Ignore magnetization currents and losses. The primary is 100 turns and the secondary is 10 turns. If the secondary load current is 10A, the primary current must be 1A and the ampere-turns is therefore the same on both coils. Are these ampere-turns additive or subtractive? They are subtractive and this can easily be seen with dot notation....
If current is flowing into the dot on the primary, current is flowing out of the dot on the secondary and this produces opposing fluxes in the magnetic material. When you think about this you have to be consistent and use the right-hand rule to see that the two fluxes oppose and cancel.
Because the dots are at the top on both coils, they are wound in the same direction and the currents are flowing in (primary) and out (secondary) therefore due to the RH rule the fluxes (due to ampere-turns) are cancelled. |
H: Are there compliance problems with selling products with exposed PCBs?
If I were to go to mass production with a consumer product is there a good guide on making sure I was following the correct compliances so that stores would accept selling it?
For example can part of the PCB be exposed? If it was a wall-mounted clock for example would it need a cover on the back of it?
AI: This area is a bit of a thicket; in practice you have to hire a specialist test and certification company to do the tests, and they'll guide you with the precise list of requirements.
In the EU, to be saleable a product must have a "CE" mark. The list of requirements is quite long, and mostly deals with avoiding RF emissions. But there is a section on surviving electrostatic discharge, and that's the part that's going to be hard to meet with an exposed PCB. You might be able to do it with PCB conformal coating.
(You also have to make sure there are no high voltages exposed! That and the mains interference requirement is why external power adaptors are so widespread.)
Edit: CE certification is mandatory for electronic products and you will have trouble selling without it; however if you sell your clock as a kit or component you can skip all this. "Explaining" to stores is likely to hit a bureaucratic wall as soon as someone notices the lack of a CE mark.
It is, however, a self-certification ... putting the CE mark on certifies that you believe it to be compliant.
There's no rule banning bare PCBs per se, it's just the ESD rule that may or may not cause problems. You may be able to design an ESD-safe bare PCB. |
H: What is logic contention when using a voltage supervisor?
I am using a voltage supervisor from MAXIAM (MAX6734A).I am confused about design notes in page 11.
So, what is logic contention? The uP that I want to monitor is STM32F103ZET6. I read its datasheet: STM32F103. On page 30, it says that NRST pin is a IO type. Does it mean that I should consider it as a bidirectional pin and use a resistor in series? What if I do not follow this design? I have no idea what the logic contention is.
AI: Note that this is talking about a bi-directional reset pin. That means that under some circumstances the processor could drive the pin instead of it being a input. This means that under just the right circumstances both the voltage supervisor and the processor could be trying to drive the same line, possibly in opposite directions. This is called a logic contention.
I am not familiar with the particular processor you are using, but I don't recall using a microcontroller where the reset input could also be driven by the processor. All Microchip PICs, for example, don't have the ability to drive the reset (called MCLR on PICs) line. Some can apply a weak internal pullup to that line, but being weak, it doesn't cause a problem. Such a line is meant to allow driving it low by a "strong" output.
A different issue the datasheet didn't mention but is a lot more common is that the reset input might need to be driven by other circuitry, like a programmer. In that case the possible contention isn't with the processor but this additional hardware also connected to the reset line. The 10 kΩ in series with the reset supervisor is low enough to easily drive a CMOS input, but high enough to not cause excessive current when connected to a CMOS output set to the opposite polarity.
Added:
There seems to be some confusion about how a series resistor can get around the problem caused by contention.
Ideally, each digital output is a voltage source. That means it would source or sink whatever current is required to maintain the desired output voltage. Connecting two of these together that are trying to drive to different voltage levels would be bad. Large current would flow (infinite current in the idea case), which is bad from a current consumption point of view, but it could also damage the parts.
Real parts have real upper limits, which are found in the datasheet. For example, a particular digital output may only be able to maintain the output voltage within the guaranteed high range when no more than 10 mA is drawn from it. If you draw more, the voltage could sag to the point where digital inputs connected to it no longer see it as a logic high level, and the part could also be damaged by the excessive current.
The series resistor limits the current. In the case of 5 V logic and a 10 kΩ resistance, the current is limited to 5V / 10kΩ = 500µA. That is well within the safe source or sink range of any normal digital output. In this case, the reset supervisor can source 500 µA indefinitely without damage.
This how the resistor limits current and protects the part. However, it must also be able to pass the signal in the normal case where the reset supervisor is driving and the micro's reset line is a input. Such CMOS inputs have very hign impedance, usually specified in terms of maximum leakage current, which is typically around 1 µA. This means that when the reset supervisor is driving its output high and the reset line on the micro is a input, that no more than 1 µA will flow. This causes a voltage accross the series resistor of 1 µA x 10 kΩ = 10 mV. This is essentially the error in the voltage as seen at the micro relative to what the reset supervisor is producing. Such a tiny error won't cause any problems. |
H: Solution for detecting a magnetic field
I have an Arduino based circuit that performs a mechanical job and I'd like the circuit to turn on when it detects a magnetic field. I want to use a magnet as a trigger for the circuit. When a magnet is attached to something like say a stick and put near the circuit board I'd like it to detect the magnetic field and turn on.
I have learnt that an operational amplifier can be used for this purpose but need guidance on how to do it as I am a novice in embedded systems & electronics.
AI: One way or another, you need some kind of transducer that can make a electrical signal that is a function of magnetic field strength. No, a opamp can't do this. A opamp may be useful in tranforming the raw signal from such a transducer into something the microcontroller can read, but by itself a opamp is not a magnetic sensor.
Two possibilities come to mind:
Reed switch. These are the bare switch parts of a relay, usually enclosed in a small glass envelope. The right magnetic field causes the switch to close. This will be the simplest solution if you have a strong enough magnetic field. This usually means a reasonable permanent magnet can be placed with a half inch or so of the reed switch.
Hall effect sensor. The underlying physics of these sensors creates a small electrical signal proportional to the magnetic field in a particular direction. However, you rarely get bare Hall sensors directly. Usually they are integrated into a single package with something that either makes a reasonable size voltage proportional to magnetic field strength, or provides a digital output, usually with some hysteresis, to indicate presence or abscence of some level of magnetic field. Allegro is a supplier that makes a lot of these things with various options. |
H: DC Motor Efficiency at Fixed Torque
I am in a muddle here, so thanks for making the effort to have a read.
I understand that electrical power going into motor is given by:
\$P_e=I^2R\$
I understand that mechanical power out is given by:
\$P_m=\tau\cdot\omega\$
Where \$\tau\$ = Torque at motor output shaft
Where \$\omega\$ = Speed at output shaft
I understand that for a DC motor, torque is proportial to current:
\$\tau=k_E\cdot I\$
Therefore if current is proportional to voltage via resistance, and electrical power in is proportional to current, power is proportional to current.
Then imagine that a motor is reacting a fixed torque value, and the supply voltage is increased to raise the output speed. A fixed torque and a rising speed means a rising output power. However input power is fixed, since torque is fixed because current is fixed. Graphing this (x-supply voltage, y-Power) gets you a flat line for electrical power in and an angled line for mechanical power out. Therefore the lines must intersect and therefore on one side of the intersection point, output power must be greater then input power, which is impossible.
I am clearly overlooking something so any pointers would be greatly appreciated.
Cheers now, all the best.
AI: Some of your basic premise is correct : torque is proportional to current, and power DISSIPATED IN THE MOTOR ITSELF is a constant I^2*R, where R is the (constant) DC resistance of the motor, as measured across its terminals with the motor stationary.
Now let's run the motor at current I. The V required is not IR. (If it is, the motor is stalled so that the back EMF = 0.)
Instead, V = IR + back-EMF.
Now, I * back-EMF is the electrical power delivered to the load as mechanical power, and I * IR is the power wasted in the motor as heat.
Let's increase V and increase speed keeping I constant. Now, input power has increased (IV) but the motor's resistance hasn't changed : therefore IR is the same and I*IR is the same. But what HAS changed is the back-EMF - obviously, since it is proportional to speed (which has increased).
So the power dissipated in the motor as heat is constant; but the electrical power delivered to the load (I * back-EMF) has increased, exactly as the mechanical output power (torque * speed) has.
No magic, and it all adds up correctly.
But what IS interesting is that the efficiency has increased because the wasted power is constant but the useful power has increased. So a general rule is that electrical efficiency is higher in a lightly loaded motor running fast, than a heavily loaded motor running slow and drawing high current.
(There are limits to this : the less you load a motor and the faster you run it, the higher a proportion of power lost to friction in bearings and especially brushes. Bearings (ballraces) are easy : brushes are not, so brushless motors have a big advantage at high speed and high efficiency) |
H: Gyroscope and compass. When its better to use one instead of another?
Why people prefer gyroscope instead of compass? Does gyroscope replace compass? I would like to see the pros and cons of each.
AI: First, to keep in mind: gyroscopes measure how fast you are turning and in what direction. Compasses measure your orientation to the earth's magnetic pole.
Positive Side of Gyroscopes:
With this in mind, we can see that gyroscopes won't be as sensitive to external magnetic fields as compasses will be. So, if there's an opportunity for your device to come close to a magnet, a compass may not be what you want.
Also, gyroscopes will work even in space, whereas compasses won't really work. (Side note: well, actually, the compass will still work, it just might not work in the way you want it to.)
Negative Side of Gyroscopes:
Since a gyroscope measures the how fast you're turning, and not really how far you've turned, you must perform numeric integration (of some form or another) to estimate your actual heading. This means that some error can be introduced. Along the same lines, because the sensor value for the current heading is dependent on all those that came before, any significant error in reading from the gyro could throw your calculations off permanently.
Also, a gyroscope is a relative reading, whereas a compass is absolute. The gyro will tell you how much you've turned since you begun the numeric integration, but it has no way of knowing if it started off pointing north or south. |
H: Reprogramming a Microcontroller
I have been recently been collecting parts from various machines that I'm quite sure have micro-controllers. My question is this: is it possible to take the micro-controller and reprogram it (to be somewhat similar to an arduino, and at least Arduino IDE compatible) with only some to very little hassle? Would I need to remove it from its current circuit board and rebuild around the specific micro-controller? How feasible is all this?
Note: I know this is very vague, and was hoping only to get a very generalized answer.
AI: The Arduino Uno is an Atmega328p AVR microcontroller in DIP package. If you can find one of those in a piece of equipment, then using it as an Arduino is as easy as hooking it up to the right ICSP header and using a in-circuit programmer.
I'd put the chances of finding a DIP AVR microcontroller in a random piece of gear at around 0.001% or so. Buying the $2.50 part from Digi-Key seems like a better way of going about finding one of those. Also, if the kind of microcontroller is any other kind (8051, PIC, ARM, 403, etc) then Arduino compatibility isn't going to happen.
Most if not all electronics made commercially in the last 10 years or more uses mostly surface mount technology. This not only makes large-scale assembly easier and cheaper, but it also saves on size and materials, which leads to lower cost. Surface mount chips are notoriously hard to de-solder and re-use for anything, requiring at a minimum a good workstation setup with hot air rework capability and good flux and de-solder braid, as well as some new carrier board to mount the device on, as it won't plug into a breadboard like a DIP part will. |
H: Bidirectional Level Shifter without IC
I'd like to connect R-Pi serial to PC's RS232 port without IC (such MAX3232), using only diode (thus block negative voltage to 0V), voltage divider resistors, and common BJT.
For TXD (RX from R-Pi perspective):
Using my USB-to-RS232 adaptor, measured voltage level for logic high is 7.5V, 6.85V after 0.65V diode voltage drop, so I'll use 270:220 ohm resistor for 3.07V (for 10 mA current) - 3.36V (no current, no voltage drop) divided voltage. Current is limited to about 10 mA with 490 (270+220) ohm resistance.
For RXD (TX from R-Pi perspective):
Borrowing power from DTR line, switch it using BC557 PNP transistor (DTR to collector; emitter to RXD) with base connected to R-Pi's TX in series with 680K resistor (for limiting drawn current to 0.5 mA).
My question is: will this work? (I'm not sure whether impedance of the connected pins will affect this simple circuit). Thanks in advance for your response.
AI: There are lots of issues with the circuit that you drew. I could go on at great length about what is wrong, but it doesn't matter because there is one fundamental issue: RS-232 levels are inverted from TTL signal levels. A binary '1' coming out of your PI is a high voltage level, but a binary '1' to your PC is -12 volts (ideally). Your circuit doesn't do the inversion.
Other issues that you have are: Modern RS-232 ports can't source much current. 10 mA is probably too much. RXD needs a pulldown resistor. The transistor might have problems switching correctly-- you can use an NPN to level shift AND invert. |
H: Why ngspice doesn't accept UIC for TRAN?
I'm using ngspice and trying to add UIC at the end of the TRAN statement, but I get an error:
$ ngspice 1 -> tran 10m 5 UIC
Warning: Error: unknown parameter on .tran - ignored
Why does this happen and how can I make it work?
ngspice compiled from ngspice revision 20
Thank you.
AI: UIC = Use Initial Conditions and is used in conjunction with the IC= specification for inductors and capacitors.
They may not support this and instead expect you to use .IC on node voltages and currents rather than on a component basis. |
H: Looking for identification of an item
I have had some trouble identifying this piece of hardware, even with the help of the inter webs. I have disassembled the printer (Brother HL-2270W or a similar device), so getting it to run is a bit of an issue for me too, so. My questions is: what is this device? It obviously looks like it is a motor or servo or etc of some sort, but specific name would help. Then my next question would be this: can I somehow reuse it with, say, an Arduino Uno r3?
Note: I am new to this sort of thing, and so would not be surprised if something i ask is misrepresented in some way or vague. Thanks in advance for understanding.
AI: It looks like a 3-Phase Brushless DC Motor. The U,V,W markings are apparently standard notation. The three little chips labeled HU,HV,HW are likely Hall Effect Sensors (or simply Hall Sensors) for position/speed feedback. |
H: Using a 5v voltage regulator - Capacitors necessary? Better options?
I am very new to electronics. I am learning as I go, and I haven't quite found the answers I need; when it comes to programming, I'm not afraid of mistakes as they happen constantly. With electronics, though, I don't want to have to buy parts again because I fried them!
I am trying to build something that has three different components in it: a 12-volt 4.3-inch LCD screen, a 5-volt Raspberry Pi, and a 12-volt custom device. I've had the idea that I can split the power I need three ways from a 12-volt power supply: one directly to the LCD screen, another directly to the custom device, and one to a 5-volt regulator, thereafter splicing into a USB cable to plug into the Pi. As I've been researching, I've noticed that people say that capacitors in the circuit before and after the regulator are mandatory to keep the current from oscillating.
Question 1: Is this three-way split with the regulator a sound idea, or am I missing something? I understand there is the potential to need a heatsink on the regulator. That's not an issue for me if necessary.
Question 2: Does my circuit require the said capacitors? If so, what kind/quality would be best? I know little about capacitors thus far. Also, I came across this component while reading another question/answer here; maybe this would be better than a regular regulator?
Question 3: Someone who is not extremely proficient in electronics but definitely better than me said that it might just be easier to use one of those 12-volt car USB charger devices instead of a regulator, which makes sense-- USB is a 5-volt world by nature, and I don't have to worry about splicing a USB cable for the Pi; wiring up the car adapter would be easy. And I have plenty of room to allow for a car adapter; the box I'm putting all of this in will be relatively empty for how large it is. Is this a sound idea? Perhaps better/easier/safer for the Pi than using either of the beforelinked regulators and capacitors spliced to a USB cable?
As for amperage, I'm still researching just how much draw the custom device and the LCD screen will need to make sure there is enough current. That's not going to be a big issue, unless there is something I am overlooking about a regulator requiring a substantial amount of amperage more than it gives out... but I don't think that will be an issue. I'm planning to get a PSU with a good amount more amperage than my setup theoretically requires-- just in case.
AI: 1: Yes, you can do that. Essentially, that's how power supplies work. They can handle multiple parallel networks within their current capacity. As for the heatsink, that depends on the regulator, the current draw, the ambient temperature, how efficient it is, etc. It's not a simple yes or no.
2: The capacitors depend on the regulator as well. Some require them all the time, some only require them depending on the input or output conditions, some never require them. The NTE1960 you linked to does not have an extensive datasheet, but is pretty similar to the LM7805. The capacitors are pretty much required for stable use. But these are linear regulators. Not efficient and they convert wasted energy into heat. Going from 12v to 5v, at say 700mA which is the high end for the RPI, that means 12 - 5 = 7v * 700mA = 4.9 Watts of energy being converted into heat. A heatsink would be required.
A Switching regulator is more efficient, in terms of both energy and heat. The OKI-78SR component you chose is a Switching Regulator. It shows that it would not need a heatsink in that same situation (Not in the engine compartment though, that's a different story). It is also a complete module, including the capacitors and the resistors it needs. It would be better.
3: A Car USB regulator would work just fine for your case, as long as the draw on it is under it's maximum. Some are 500mA, some are 1A, or better or in between, but some can't actually supply the amount of current it says it should, so you would need to test. The Model B has a 700mA draw/limit, the Model A is 500mA. Most of these usb regulators are switching supplies, and for your purposes, a car usb adaptor would be exactly like the OKI-78SR. At 4 bucks for the OKI-78SR (plus shipping) compared to a few bucks for a car USB adaptor, it really just depends on which you can get easier. Even retail, you can get a decent car one at any convenience or auto store for 10 bucks.
You could even gut the car USB adaptor for the board inside. Those things are so small now they are smaller than a car cigarette lighter, with the case, and the size of an SD card without the case. |
H: can an "owner" lock RAM?
I've been reading http://www.ccs.neu.edu/course/com3200/parent/NOTES/DDR.html
and it seems to suggest that a closed page cannot be accessed by anything other than the owner, paraphrasing.
Is this true? If not, how can RAM be locked, if at all?
AI: Dram as implemented can't be locked per se. What that sentence means is that if you interrupt the process or interfere with it, the results are uncertain and may end up in corrupted memory. There is nothing preventing you fro m messing with the memory locations so be careful. |
H: How to change the range of voltage?
I am doing a project to use dsPIC as controller to output PWM signal to control motors. I can use driver IC (I used L293D actually) to simply let motors to rotate, but I cannot control the voltage range to control the motor to rotate with all range of speed.
The output of dsPIC PWM pins is in the range of 0V~5V, but for motors, the input range is different.
Assume the range is -10V~10V, I want to change the 0~5V output to -10V~10V (0V->-10V, 5V->10V). Is there a good way to achieve this?
AI: Assumptions:
The circuit has +10V and -10V supply rails available
Isolation of the dsPIC from the motor power / ground rails is desirable, to prevent back-EMF from frying the dsPIC
The following arrangement would provide arbitrary voltage switching, isolated from the controller side of the circuit:
simulate this circuit – Schematic created using CircuitLab
This will provide an inverted PWM signal to power the motor.
The PWM signal switches the optocoupler's internal LED on and off.
This turns the output phototransistor of the optocoupler on and off correspondingly.
When the PWM signal is high, the opto's transistor conducts, pulling the MOSFET gate low, and thus it behaves as an open switch.
When the PWM signal is low, the opto's transistor does not conduct, so the MOSFET's gate is pulled high, it behaves as a closed switch, allowing current through.
The diode across the motor prevents back-EMF from frying the MOSFET. |
H: ModelSim Altera: simulating the "lpm_add_sub" module?
I'm trying to simulate a verilog module that uses the "lpm_add_sub" module to provide an adder with a separate carry in (for some reason Quartus II doesn't recognise that a+b+c where c is a single bit can be implemented in a single adder and synthesizes two adders for it). However when I try to start the simulation in ModelSim, I get the following messages:
vsim -L altera_ver -L altera_mf_ver -L cycloneiv_ver -L cycloneive_ver -L lpm_ver -voptargs=+acc work.rotation_sensor
# vsim -L altera_ver -L altera_mf_ver -L cycloneiv_ver -L cycloneive_ver -L lpm_ver -voptargs=+acc work.rotation_sensor
# Loading work.rotation_sensor
# Loading work.bitcounter
# Loading lpm_ver.lpm_add_sub
# ** Error: (vsim-3584) C:/Development/ican/IcanFinal2/rotation_sensor.v(119): Module parameter 'LPM_DIRECTION' not found for override.
#
# Region: /rotation_sensor/bitcounter/genblk1
# ** Error: (vsim-3584) C:/Development/ican/IcanFinal2/rotation_sensor.v(119): Module parameter 'LPM_REPRESENTATION' not found for override.
#
# Region: /rotation_sensor/bitcounter/genblk1
# ** Error: (vsim-3584) C:/Development/ican/IcanFinal2/rotation_sensor.v(119): Module parameter 'LPM_WIDTH' not found for override.
#
# Region: /rotation_sensor/bitcounter/genblk1
# Error loading design
Any ideas what I'm doing wrong? The line of code causing the error is this:
lpm_add_sub #(.LPM_DIRECTION("ADD"), .LPM_WIDTH(SUBRESULTSIZE), .LPM_REPRESENTATION("UNSIGNED")) a (
.dataa(tophalf_count),
.datab(bottomhalf_count),
.cin(bits[INPUTWIDTH-1]),
.result(add_out[SUBRESULTSIZE-1:0]),
.cout(add_out[SUBRESULTSIZE]));
AI: According to Altera's knowledge base, it's a bug in their simulation library, which incorrectly has the parameter names defined only in lower case (it should, apparently, be able to accept either).
http://www.altera.co.uk/support/kdb/solutions/rd04192000_5867.html
Searching directly for the error message didn't turn it up, because the text of the error message appears to have changed since they added the description of the problem to their knowledge base.
Fortunately, for synthesis the lower case names are accepted just as the upper case ones (as used in the documentation) are. |
H: Voltage regulator IC with external reference
Is there a linear regulator that can follow a reference?
The broader problem I have is that I have an ADC with reference that can only source 50mA (I have no control over the ADC or reference circuit) but I have some sensors that are low impedance and measured with a Wheatstone bridge so I need the same reference voltage but more current.
I thought of doing this (below) but there must be an IC that does the job.
simulate this circuit – Schematic created using CircuitLab
AI: The requirement basically translates to the ability to source high current at a specified reference voltage.
A low component count way to implement this is to use a high power high current op-amp as a voltage follower, with the reference voltage at the non-inverting input.
For instance, the Burr Brown (now TI) OPA549 can deliver 8 Amperes continuous current with a suitable heat sink. With its 300,000 open loop gain, this should be sufficient for using the available low current reference to generate a stable high current output.
There are many other such high current op-amps, which dispense with the need for the external MOSFET.
From this page:
In other words, a voltage regulator IC is not required. |
H: Is there an electronics reason why implantable RFID capsules are made of glass?
I am curious why implantable RFID capsules are made of glass because they create a huge risk of breaking under the skin causing some serious trouble.
I would guess a silver/titanium encasing will be better, and, if I'm not wrong, those metals are not magnetic, so I don't see them causing a problem with the electo-magnetic fields.
I'll put the same question on a medical stack exchange, and see maybe the reason is medical not electronics related.
AI: Glass is chosen because of it's chemical composition. Certain glass formulations are very close to the composition of bone, making it very biocompatable, and the composition can be tweaked for various behaviour (mostly regarding the way nearby tissue reacts).
Furthermore, you are far, far overestimating the issue of the capsule breaking. Any trauma sufficent to break the capsule will cause massive trauma, break or pulverize bones, and probably be a far greater issue. Basically, capsule failure of the glass tags is a non-issue from a medical standard.
A quick perusal of pub-med seems to support this, though it wasn't exhaustive. There is one interesting article looking at the survivability of RFID tags under extreme temperatures (such as autoclaving or liquid nitrogen), and only had one tag fail (and it didn't rupture or anything, it just stopped responding)after the tenth autoclaving cycle.
Basically, despite the fact that it's glass, implantable RFID tags are ridiculously durable, and far stronger then the puny human and/or pet they're normally implanted into. |
H: Dual Rectified 12V 5V Tapped Power Supply Safe?
Is the following regulator valid, safe and efficient?
The transformer is a dual 7V output toroidal. So B1 is supposed to rectify out 14v and B2 taps the "center" to produce 7V.
INAE and I've never used dual bridges in a tapped arrangement like this so I thought I should ask before playing around with mains like this.
UPDATE:
The following is the circuit corrected as discussed but without the regulators:
This is supposed to model the Amgis L01-6310 14V/7V transformer to see what sort of voltages might be supplied to the 12V/5V regulators (because I should have used a 12V/6V part since Vpeak of 14V is *1.414 = 19.8V. Secondaries have 7 ohms series resistance per datasheet. I have never modeled a transformer in LTSpice before but I reasoned the turns ratio is 120 / 14 = 8.57 squared = 73.5 but this seemed to be off by a factor of 2 so I figured the primary is wired in parallel for 120V mains so I doubled the ratio to 147 / 1.
Green is the 14V tap. Blue is the 7V tap. Red and light blue shows the load on the outputs.
So it seems I get 16V and 7.2V which isn't too bad. If it comes out to 16V thats only a 4V drop. But I don't think the 12V load will be loaded much. If I only load it with ~25 mA, I get 18V which is 6V * 0.025 = 150 mW.
INAE so this could all be wildly wrong. IIWAE it would probably still be wrong.
AI: The second bridge rectifier (the one connected to the center tap) is actually completely redundant. You can just connect the input of the regulator directly to the center tap, and it will get half the voltage, full-wave rectified by the two left-hand diodes of the other bridge. |
H: Is this a certain kind of oscillator?
I was having a ton of trouble understanding oscillators, and I needed something to power a tank circuit at its resonant frequency.
I decided to just come up with something myself and this is what I arrived at. I tested it and it seems to work great.
I know that there are many named oscillators and I wanted to know if anyone could tell me what other oscillators this might be similar to or how you might classify it.
AI: The circuit diagram looks a bit weird so I took the liberty of redrawing it.
Your circuit looks like a oscillator that produces a pulse output at the collector of Q1. This pulse will excite the tank circuit and provided the loading is small will cause it to go into oscillation. If you compare it with the circuit below it you will see the same basic configuration of PNP and NPN transistors mirror imaged. The orginal circuit came from the 1950's and was a curious circuit called Garner's oscillator. (http://www.covingtoninnovations.com/michael/blog/0502/#garnosc) The circuit shown below is borrowed from the site for completeness and yes I do know it its not drawn correctly as it shows two PNP transistors but read the article. |
H: Where are the UART Rx and Tx pins on a dsPIC33FJ32MC202?
I'm a beginner to micro-controller and now learning Microchip's dsPIC. I'm trying to use UART with RS232 to communicate with my laptop, but I can't find out where the Rx and Tx pins are on the chip.
I've checked the datasheet and I can't find out where it has mentioned about which pin number it is.
AI: Further to Keelan's answer:
The official name for the technology is "peripheral pin select" or PPS.
The 4th column in table 1-1 is the PPS column. You can see that the UART pins are all listed as 'Yes' which tells you that you need to use PPS to get these functions physically connected to pins.
Table 4-16 lists the input register map: file RPINR18 concerns the UART receive function. The value you write to RPOR18's low byte will determine which pin acts as UART receive.
Table 10-2 lists the output registers for PPS. UART transmit is 0x03; you would write 0x03 to the RPOR register corresponding to your desired output pin to connect it to UART transmit. |
H: Its ok use different layers for power?
For example in a double side board I'm using one layer as gnd and the other layer as power, and then I route the whole circuit inside the planes.
Is that ok? Because I saw that usually both sides are ground. But its easies to me to work one plane as power and the other as ground.
AI: For a 2-layer board its pretty common to have one dedicated GND layer and use the other layer for all signals and power. In any case, prevent long traces on the GND layer, otherwise you may have unnecessary long GND return paths (due to the split GND plane/islands).
For multi-layer designs, its good practice to have at least one 100% dedicated GND layer with no excuses. Regarding a supply layer it depends. If you only have one Vcc for example, use a dedicated layer as well. If you require 5V for one localized part of the circuit and 3.3V for another you can place those into the same layer (use planes, not tracks) if you have no spare.
Just keep in mind what you want to achieve: Short, low impedance tracks for commonly used signals (especially GND/supply). With dedicated layers for those signals, you just have to place a VIA. |
H: Should I use a resistor between an input pin of MCU/CPLD and VCC/GND?
Some times, I want my MCU or CPLD to input a static logic. So, I choose to tie it to VCC or GND. The problem is that should I put a resistor in series to limit the current? I just think by myself for a while and get my own answer: no!
Take STM32F103(datasheet) for instance,on page 86:
From the 'input leakage current', I know that when applied VDD the input resistance is at least 1 M ohm so that I do not need a resistor in series to limit current. Is that reasonable?
AI: Hard connection of a pin to the VCC or GND is o.k. from a functional standpoint for high impedance inputs such as CMOS logic inputs. It also happens to be convenient on PC board design where it eliminates an additional component.
There are several conditions under which having an input pulled up or down via a resistor would be better than a direct rail tie. Here are some of those reasons.
1) If the pin happens to just be an input by default but can be programmed as bidirectional or output then accidental programming could cause the default state to change. A resistor could save a part from damage provided the pullup resistor value was sized properly to limit current to safe levels.
2) If there was any chance that you wanted to utilize the pin for some added function or feature during your project development having a pullup resistor allows for immediate use of the pin whereas a GND or VCC connection would require copper etch cuts. Having a pin connected into a copper plane via a thermal spoke type pad it can make it quite difficult to perform to pin isolation from the power rail copper.
3) Spare I/O pins can often see good use for temporary connections while developing the software for an MCU. With a pullup / pulldown on the pin you can use the pin at will and you have an easy place to attach a wire to connect the test signal. If it happens to be a leaded resistor you may even have a nice place to clip on a mini hook grabber. |
H: How to identify and remove unintentional PCB antenna?
It has been pointed out to me, more than once, that I might be making a few too many antennas unintentionally on the PCB with the copper pour, an obvious example is this L shaped pour at the edge of the PCB:
I can easily remove that, with a restrict polygon, so that it looks like this:
I was wondering what to look for exactly, generally speaking, and if placing vias to the ground on the edges of those shapes would stop them from acting like antennas and radiating ?
Note: the red and blue pours are ground planes, 2 layer PCB.
AI: Since that pour is connected to ground, I would not remove it.
First, because there's no currents flowing in that area, there's no reason for it to radiate.
Second, because rather than acting as an antenna, it will act as a (extra) place for fields from the nearby traces to go, so they don't become antennas. Which of course implies that small currents will flow in that pour area, but better they flow through the pour than allow the trace to radiate.
An extra via between the top layer pour and bottom layer pour might be advisable to keep the potential on the two ground pours tightly tied to each other...but is probably only a very small improvement.
Even if the top layer pour were a power net, I would probably leave it alone. It's not likely to produce any noticeable problem given the ground pour immediately below it. I have seen design rules that advocate pulling power planes back 0.050" inches or so while running ground pours to within 0.010 of the edge, the idea being this keeps fringe fields between the two planes better confined within the PCB volume. |
H: Differential remote sense circuit for 0.85V DC/DC supply
I have this sort of odd requirement and I'm wondering if someone with experience might have some advice on a circuit to use. I have a chip that draws 40 Amps of current at 0.85V with +/3% tolerance. Now normally I would use a DC/DC supply with a differential remote sense feature to counteract the IR drop from the switcher output to the core power balls at the middle of the chip.
However this time I'm forced to use a specific switching controller that does not have differential sense pins, just a single vsense pin. I was hoping I could maybe use an opamp setup as a differential amplifier. Then run the inputs as a diff pair under the chip and have the output drive the vsense of the regulator. Or maybe drive it through a resistor and keep the vsense hooked up locally.
Oh and one more thing I can't use any supervisor or power manager chips like the LTC2974. So it has to be a circuit I put down on the board. Crazy design constraints, I won't go into the reasons behind it.
Anyway does anyone have advice on what kind of opamp circuit I could use to accomplish this? Am I missing something critical?
AI: Sure, a standard 4-resistor opamp difference amplifier, or a single-chip instrumentation amplifier with its gain set to unity, should work just fine. Just make sure the device you select includes ground in its common-mode input range.
Make sure you connect the output reference node directly to the ground terminal of the regulator, with no other currents flowing in that path. |
H: Anyway to Visualize Current without an Oscilloscope with that Function?
Having only an ordinary oscilloscope that shows voltage, is there any way to modify the circuitry or do some intelligent guessing to get an idea of what the current wave form looks like?
In my case, I'm pulsing a coil with square voltage waves and I want to see the resulting current being caused by inductance and parasitic effects to get a sense of how well my coil is constructed and what exactly it's doing to the waveform. I'm particularly interested in its behavior during discharge during the low portion of the square wave.
AI: There are many ways you might go about this. If you have a resistor, or any approximately ohmic thing in series with the current you wish to measure, then you can measure the voltage over the resistance and calculate the current by Ohm's law:
$$ I = E/R $$
This gives you the current in the resistor, which must be equal to the current in anything else in a series circuit with that resistor. (Kirchhoff's current law)
It's somewhat likely that you have a MOSFET in your circuit. A MOSFET that's on is almost like a resistor, and depending on how accurate you need to be, you may be able to treat it as one. I've done this many times for sensing motor current in H-bridge drivers where accuracy wasn't critical.
If you don't have a MOSFET or you need better accuracy, then you can always add a very small resistor, small enough to not significantly change the operation of your circuit.
If you have a capacitor in series, then you can measure the voltage across it and calculate the current by:
$$ I(t) = C\dfrac{dV(t)}{dt} $$
The current and voltage in an inductor are also related by:
$$ V(t) = L\dfrac{dI(t)}{dt} $$
Though in this case by measuring the voltage you only get the rate of change of current, which doesn't really tell you the magnitude of the current, but maybe you don't need to know that.
If none of that works for you, you can measure AC current with a current transformer. Put a couple turns of wire around a toroid core, then pass the conductor in which you want to measure the current through the core. There are commercially available current transformers that are already calibrated, or you can make your own and calibrate it with a known AC current source.
Or, you can look at hall effect sensors, which can measure DC currents. There are commercially available modules which contain a straight-through conductor, the sensor, and an amplifier all in one package. Usually not good for small currents, but a good way to measure large currents without the losses that would come from a series resistance.
After having established a relationship between current and voltage by any of these methods, you can now observe the voltage with your oscilloscope, and know what the current must be. |
H: Soldering lifted central pin of TO-252-5 package
I found a very nice voltage regulator of ST (LD39300). But the LD39300PT-R has a package with a lifted central pin (TO-252-5, DPak (4 Leads + Tab), TO-252AD).
Here is a photo:
I just want to do a routing of my PCB but I don't know how to solder the central ground pin.
With an extra cable?
Why is the central pin not manifactured like the rest?
AI: It's interesting that the datasheet doesn't seem to mention this, but it's pretty clear that the mounting tab is supposed to be used for the ground connection, not the truncated middle pin. |
H: Is Op Amp a VCVS or VCCS
I've been asked this question a couple of times in screening tests. Options are VCVS VCCS CCVS CCCS, Which one of the four options is best fit ?And would the answer depend whether we talk about the Ideal op-amp or the non-ideal op-amp ?
AI: With no other qualification, the generic term "opamp" refers to a voltage-controlled voltage source (VCVS). The input impedance is very high (essentially infinite) and the output impedance is very low (essentially zero). |
H: How can you assure JFET Q-point?
As Beta changes from BJT to another, Vp and Idss also change from a JFET to another, but how can you assure that when the JFET changes, the Q-point does no change greatly?
AI: Generic question, generic answer: By using negative feedback.
With a BJT, this can be done by adding an emitter resistor, or creating a path from collector to base. Similar techniques can be used with other types of devices. |
H: Can this RAM bypass be prevented by making the particular memory controller "not idle"?
AbsoluteƵERØ showed me that memory can be bypassed at the memory controller. https://security.stackexchange.com/questions/36592/can-linux-be-made-to-detect-foreign-connections-to-the-ram-bus
by showing me this patent: http://www.google.com/patents/US6745308
In the Abstract of the article, it says
If particular memory controller components are idle, a memory client
is informed that a bypassing of memory controller components is
possible.
Does that mean that there can't be a bypass if the particular memory controller components aren't idle? (More quotes on "idleness" below)
If so, how can a memory controller be kept from an "idle" state?
Idleness Quotes
Only components that are idle or have no other memory requests to process may be bypassed.
The method as in claim 1, wherein the step of providing, to the client, the signal indicating the state of the memory controller
includes providing a signal indicating a level of idleness associated
with the memory controller pipeline.
The method as in claim 5, wherein determining a level of idleness
associated with the memory controller pipeline includes analyzing
memory request queues of a first component and a second component are
empty.
A system comprising:providing the memory access request to a bypass
module when the signal indicates the first component is idle;
Only components that are idle or have no other memory requests to
process may be bypassed.
At least one embodiment of the present invention provides for a method
of bypassing memory controller components. The method includes
receiving a first memory request to read data from memory. In one
embodiment, a bus interface unit receives the first memory request.
The first memory request may be associated with a cache fetch request.
The method includes determining if a first component and a second
component of a memory controller are idle. The first component is a
Northbridge client interface used to organize received memory
requests. The second component is a Northbridge arbiter used to
arbitrate, or select, requests from different clients, allowing
received requests from all the clients to be processed. The result of
determining if the first and second components are idle is provided as
a signal to the host bus interface unit. The method also includes
providing the first memory request to the first component, when the
first component and the second component are busy. The method also
includes determining, in the memory controller, if the first memory
request is valid for access by bypassing the second component. In one
embodiment the second component is used to generate commands to open
closed pages of memory. If the memory request needs to access a closed
page of memory, the memory request is considered invalid. The method
also includes enabling the first memory request to be accessed by the
second component, when the first memory request is considered invalid
for bypass operations. The method further includes enabling the first
memory request to be accessed by bypassing the first and second
components, when the first memory request is considered valid.
with many more.
AI: That patent doesn't do what he thinks it does. The patent is a method for changing the components of a memory controller during design so that you can support a collaborative bypass of the controller within the various components or stages of the memory controller itself. No where do they describe sitting on the external memory bus (to DRAM) and snooping on it. In fact they describe a controller that says "hey guys - I'm idle now, go and do your stuff"
When they say "components" think " functional blocks" not DRAM modules or the like. |
H: finding rf 175 Mhz harmonic source
I have a device that I am pre testing to find possible issues with unintentional rf radation. The processor is a pic32 running at 80MHz, and is connected to a ti dp83848 ethernet phy in mii mode using a 25MHz crystal.
I see peaks at 75MHz, 150, and 175. I am a little unclear where these harmonics could be originating. Could I get this activity from a 25MHz crystal, all the way up to 175? The peaks are pretty much spot on, at least according to the rigol dsa815.
Addition: I have done more testing here, I see most of these harmonics are generated in the phy area, and between the phy and jack. I have some traces that run in an internal layer that go through that area and come out right at the indicator switch legs, and they are picking up these harmonics. Its a little unclear to me whether or not these are over the limit, I may just have to test and see. My understanding is that near field probes pick up a signal whether or not there is an unintentional antenna or slot big enough to pass the signal. I suspect most ethernet devices have some harmonics in this range. The pic32 ethernet starter has similar results.
I may have just have to pay the test house for this education.
AI: If you've got a 25 MHz Square wave oscillator, then it's not surprising to see harmonics up to the 7th. If it's a sine wave oscillator, I suspect your Ethernet Phy is doing some squaring up. |
H: AVR-GCC: Ports Undeclared when compiling
My Setup
I'm running Ubuntu 12.10, and I want to be able to use gcc and avrdude to compile and program my ATmega328.
I followed this Ladyada tutorial: Ladyada AVR Tutorial
Everything installed perfectly, no errors or warnings. I have not installed avrdude yet, but that is beside the point.
I use the command:
avr-gcc -O0 -c blink_1MHz.c -o main.o
However, I get one warning, and many errors:
warning "device type not defined"
error: 'PORTC' undeclared (first use in this function)
The error above repeats itself for each Port and each Data Direction Register used in the code.
blink_1MHz.c is just some simple code I'm using to test my setup. It has worked on my Windows setup through AVR Studio 6.
I've tried Google, but the only real suggestion I got was to import the libraries:
#include <avr/io.h>
#include <stdlib.h>
#include <stdint.h>
Unfortunately, still nothing. I've been playing around with this for a while and I'm simply stumped. I saw suggestions that avr-libc isn't installed, but I have installed avr-libc. I would think that if I didn't have it installed, I would be seeing complaints about the libraries not existing.
Question
Could an enlightened individual suggest what may be the cause of these errors? Thanks.
EDIT
Amoch pointed out that I needed to check out avr/io.h; there you will see that you need to define the processor with the -mmcu flag. In my case, I have an ATmega328, so my command looked like:
avr-gcc -O0 -c blink_1MHz.c -mmcu=atmega328 -o main.o
AI: I'm not familiar with AVRs but the compiler is telling you that it can't find where "PORTC" etc are defined. Normally these definitions are included via a header file, and from your post I would suggest that it is likely avr/io.h. You will need to take a look at this file and determine that it is the source of these missing definitions. Further more, the first error that is encountered states that "device type not defined". This means that this header file requires a #define to inform it which code to include for the processor that you are using. This would normally be provided to the compiler via a -D option.
Seeing that you have had this working on windows under AVR studio, I suggest that you dig into the compiler settings within the GUI or examine the console output and find out exactly what is being passed to the compiler under windows so that you can copy the settings in your custom build under linux. |
H: Interfacing a MCP23S17 (SPI) with a FPGA
I am working with a MCP23S17 SPI I/O expander chip in a VHDL project on my Basys 2.
At first glance I thought this was just a simple SPI interface where I put the chip select low and it will give me the data on the MISO line but it looks like it is bit more complicated with commands and initialization needed.
I added some setup bits ("0100" & "000" & "1") that pop out on the MOSI line once when you try to read data. but nothing has changed. There seems to be a lot of registers to hold settings but I have no clue on how to set these.
Here is a diagram of how I have it all hooked up. The testing I/O is only to make sure I have some known bits that should show up if the transaction succeeds. I will be using the B side of the chip so if something special needs to happen to read that then please explain.
What needs to happen to read data from the chip?
Here is the SPI module (SPI.vhd) that I have written so far.
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
-- Uncomment the following library declaration if using
-- arithmetic functions with Signed or Unsigned values
--use IEEE.NUMERIC_STD.ALL;
-- Uncomment the following library declaration if instantiating
-- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
entity SPI is
Generic (
dataWidthN : positive := 8
);
port(
sck: in std_logic; -- clock
mosi: out std_logic; -- data going into slave
miso: in std_logic; -- data coming out of slave
cs: in std_logic; -- chip select
address: in std_logic_vector(2 downto 0); -- 0 - 7
data: out std_logic_vector(dataWidthN-1 downto 0);
debug: out std_logic_vector(1 downto 0)
);
end SPI;
architecture Behavioral of SPI is
signal data_reg : STD_LOGIC_VECTOR (dataWidthN-1 downto 0);
begin
data <= data_reg;
process (sck)
variable isSetup: std_logic := '0';
variable setupBits: std_logic_vector(7 downto 0) := "0100" & address & "1";
variable setupBitCount: natural := 0;
begin
if rising_edge(sck) then -- rising edge of SCK
if (cs = '0') then -- SPI CS must be selected
if (isSetup = '0' and setupBitCount < 7) then
mosi <= setupBits(7-setupBitCount);
setupBitCount := setupBitCount + 1;
else
isSetup := '1';
setupBitCount := 0;
end if;
if isSetup = '1' then
debug <= "11";
-- shift serial data into dat_reg on each rising edge
-- of SCK, MSB first
data_reg <= data_reg(dataWidthN-2 downto 0) & miso;
else
debug <= "10";
end if;
end if;
end if;
end process;
end Behavioral;
I have not found many articles talking about this chip using code. I found some Arduino stuff but they all use the SPI library which doesn't help explain what exactly is happening. Here are the few links that I have found:
http://www.electrosome.com/expanding-io-ports-of-pic-microcontroller/
http://playground.arduino.cc/Main/MCP23S17
http://www.phatio.com/ideas/mcp23X17/
http://tech-tut.com/how-to-expand-inputs-and-outputs-using-mcp23s17/
Edit:
Alright after working on what Dave Tweed said to do. I am able to send and produce the commands on MOSI but nothing comes back on the MISO line. Keep in mind that the FPGA should get the data and I have a logic analyzer that will show the bits if something comes out and my FPGA code is wrong.
CS: 1111000000000000000000000000
MOSI: xxxx0100aaa10000110000000000
MISO: xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Here is the simulation in ISim. **This will not return data on MISO because it is just a simulation with no chip to actually send back proper data.*
And from a logic analyzer in the real world:
Here is the update SPI.vhd module code:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity SPI is
Generic (
dataWidthN : integer := 8
);
port(
sck: in std_logic; -- clock
mosi: out std_logic; -- data going into slave
miso: in std_logic; -- data coming out of slave
cs: in std_logic; -- chip select
address: in std_logic_vector(2 downto 0); -- 0 - 7
data: out std_logic_vector(dataWidthN-1 downto 0);
debug: out std_logic_vector(1 downto 0)
);
end SPI;
architecture Behavioral of SPI is
type state_type is (idle, s_readSetup, s_read);
signal data_reg : STD_LOGIC_VECTOR (dataWidthN-1 downto 0);
begin
data <= data_reg;
spi_read: process (sck)
variable transactionComplete: std_logic := '0';
variable setupBits: std_logic_vector(15 downto 0);
variable setupCmdBitCount: natural := 0; -- setup command is 16 in length
variable readCmdBitCount: natural := 0; -- A command is same as dataWidthN
variable currState: state_type := idle;
begin
setupBits := "0100" & address & "1" & "00001100";
if falling_edge(sck) then -- rising edge of SCK
case currState is
when s_readSetup =>
if (cs = '0') then -- SPI CS must be selected
debug <= "10";
mosi <= setupBits(setupBits'length-1-setupCmdBitCount);
setupCmdBitCount := setupCmdBitCount + 1;
-- Move to the next state
if setupCmdBitCount >= setupBits'length then
setupCmdBitCount := 0;
currState := s_read;
end if;
else
currState := idle;
end if;
when s_read =>
if (cs = '0') then -- SPI CS must be selected
debug <= "11";
-- shift serial data into dat_reg on each rising edge
-- of SCK, MSB first
data_reg <= data_reg(dataWidthN-2 downto 0) & miso;
readCmdBitCount := readCmdBitCount + 1;
if readCmdBitCount >= data'length then
readCmdBitCount := 0;
transactionComplete := '1';
currState := idle;
end if;
else
currState := idle;
end if;
-- Idle state: if the state is unknown then we just go idle
when others =>
debug <= "00";
setupCmdBitCount := 0;
readCmdBitCount := 0;
mosi <= '0';
if cs = '0' and transactionComplete = '0' then
mosi <= setupBits(setupBits'length-1-setupCmdBitCount);
setupCmdBitCount := setupCmdBitCount + 1;
currState := s_readSetup;
elsif cs = '1' and transactionComplete = '1' then
transactionComplete := '0';
end if;
end case;
end if;
end process;
end Behavioral;
AI: The MCP23S17 is really meant to be connected to a microcontroller. I have used it successfully in a Blackfin-based project. It has a number of internal registers, just like the GPIO ports on a typical microcontroller. Each 8-bit port has a direction register, an input register and an output register, plus registers for input polarity and interrupt-on-change. There's also a global configuration register.
It does default to all-inputs at power up, so if that's all you need, then you just need to create a state machine that reads the two input registers. Note that you need to supply both a chip address byte and then a register address byte for each read cycle.
Also, you need to be aware that this chip has the funky feature of having two different address maps for the registers, depending on the setting of the "BANK" bit. Study this part carefully; it's pretty confusing.
The BANK bit is zero on power-up, so the two registers you want, GPIOA and GPIOB are found at addresses 12 and 13, respectively. Therefore, to read them both, you need to do two 24-clock SPI cycles:
CS: 1111000000000000000000000000111111110000000000000000000000001111
MOSI: xxxx0100aaa10000110000000000xxxxxxxx0100aaa10000110100000000xxxx
MISO: xxxx0000000000000000AAAAAAAAxxxxxxxx0000000000000000BBBBBBBBxxxx
"aaa" represents the chip address.
"AAAAAAAA" represents the data from port A
"BBBBBBBB" represents the data from port B
Note that everything is MSB-first. |
H: Powering off USB - question about grounding
I have a female USB connector that I want to use to power a little piece of electronics I'm working on.
I have a USB cable plugged into a computer with the socket on the other end and I'm using my multimeter to test the voltage down the cable. When I place the multimeter prongs onto pin 1 (5vDC), and pin 4 (ground), I get a reading of ~5.04v, but as soon as I take the prong off the ground pin, the voltage stops. Does this mean when I solder the socket to my PCB, I need to ground pin4 somewhere to close the circuit?
AI: When you place your multimeter leads on two pins, it creates a circuit that allows your multimeter to measure the voltage. If you don't connect both leads of the multimeter to form a circuit, the multimeter will not measure the voltage, even though the voltage is still present.
If you are using the USB socket for power, then you need to connect the ground of the socket to the ground of your circuit. At a simple level and without knowing more about your circuit, as long as you connect ground of the USB socket to your circuit ground somewhere you should be fine. |
H: Current consumption in milliseconds
If I use 10mA for 40 milliseconds. How much current have I used in mAh (milliamperes per hour)?
AI: 40 milliseconds is 0.04/3600 hours = 1.1111e-5 hours therefore you have used 1.1111e-4 mAh.
= 0.0001111 mAh
Please note that you haven't used x amount of milli-amps per hour. You have used 10mA for 1.1111e-5 hours - the two numbers multiply
An ampere-hour is a unit of charge |
H: Why do different resistor values dissipate power at different rates in RL and RC circuits?
Physically what is happening here?
RL
My thoughts on this are that the inductor supplies a certain current, and current through a larger resistor dissipates more power.
RC
This one I'm not so sure about. I would say the same about voltage, but I think the current caused by this voltage will be proportional to the resistance values and so will the power dissipated by this. Somet
simulate this circuit – Schematic created using CircuitLab
The switch opens after being closed for a very long time.
hing isn't right conceptually, can someone help me clear this up?
AI: but I think the current caused by this voltage will be proportional
to the resistance values and so will the power dissipated by this
Let's work it out and see. We assume that the source is disconnected at t=0.
For RL and RC circuits with initial energy, i.e., there is an initial current through the inductor or an initial voltage across the capacitor, the current is given by:
\$i(t) = i_0 \ e^{-t/\tau} \$
For the RL circuit:
\$\tau = L/R, \ i_0 = i_L(0) \$
For the RC circuit:
\$\tau = RC, \ i_0 = v_C(0) / R \$
Now, let's calculate the power associated with the resistor R:
\$p_R(t) = i^2(t) R = i^2_0\ e^{-2t/\tau} \$
For the RL circuit:
\$p_R(t) = i^2_L(0)\ e^{-2t/\tau}\ R\$
As we expect for the RL circuit, the power is proportional to the resistance R.
For the RC circuit:
\$p_R(t) = \dfrac{v^2_C(0)}{R^2}\ e^{-2t/\tau}\ R = \dfrac{v^2_C(0)}{R}\ e^{-2t/\tau}\$
So, for the RC circuit, the power is inversely proportional to the resistance R.
How to intuit this without working through the math? Note that the larger the power, the sooner the initial energy is dissipated, i.e., the smaller the time constant.
Now, note the formula for the time constant. For the RL circuit, a larger R gives a smaller time constant while, for the RC circuit, a smaller R gives a smaller time constant. |
H: Programmable IO
I have three bit input and would like to have a three bit output programmed for the input combinations.
000 - 000
001 - 001
010 - 010
011 - 001
100 - 100
101 - 001
110 - 010
111 - 001
Is there a chip available so that we can program and work accordingly to the above inputs. Also possible that it can take power from the input, rather than external power to get it to work?
AI: For a truly single-chip solution, use a CMOS dual 4:1 multiplexer. If you don't have a power supply, it can be powered via its input-protection diodes.
simulate this circuit – Schematic created using CircuitLab |
H: What is an AVR programmer for Arduino?
I'm a beginner with Arduino. I'm reading a book called Practical AVR Microcontrollers: Games, Gadgets, and Home Automation with the Microcontroller Used in the Arduino.
From the beginning, the book speaks about the AVR programmer. It says that the way to communicate and send code / compile code for the Arduino is by connecting your computer to the AVR programmer and then the AVR programmer to the Arduino.
The book is several years old so maybe things have changed. Do I need to have this extra component called the AVR programmer?
AI: An Arduino is not an AVR. AVR is a family of microcontrollers made by Atmel, which includes 8-bit and 32-bit microcontrollers. Most common Arduino boards (UNO, duemilanove, etc.) use the ATMEGA328p, and new ones like Leo use the ATMEGA32u4 which is also in the AVR family. Arduino is a hardware and software platform built with an AVR. It sounds like your book is about the AVR and is referencing Arduino to draw attention. It's about Arduino as much as a book entitled "Practical Physics. Fun Physics experiments in the same field studied by Sheldon in The Big Bang Theory" is about Sheldon Cooper.
If you have just an AVR, you need something to program it. The most common way is through In-Circuit Serial Programming, or ICSP. Usually this is a 6 pin .100" pitch header. There are devices out there that speak this protocol on one end, and USB on the other. Atmel's AVRISP mkII is an example. There are many alternative products which do the same thing. This is what people often mean when they say "AVR programmer".
The Arduino platform canonically includes the same functionality that is in a device like the AVRISP mkII so that the AVR in the Arduino can be programmed with nothing more than an ordinary USB cable and the Arduino software. If your Arduino has a USB port on it, this is almost surely the case, and you do not need an extra AVR programmer. You just need a USB cable.
There are Arduino variants that omit this component to reduce cost. These Arduinos don't have USB ports. Instead, they have the ICSP header or something similar, and the electronics that would have been present on other Arduinos are instead available in a separate cable or device.
To summarize, if your Arduino has a USB port, you probably do not need an additional AVR programmer, because the programmer is on the Arduino. If your Arduino does not have a USB port, you probably do need an AVR programmer.
If you buy, for example, an ATMEGA328p and put in your Arduino board, it will not work, because it has to be programmed with the bootloader and appropriate fuses to work properly. This programming is done using the ICSP interface by the AVR programmer. This needs to be done just once, after this you can use it to upload sketches. |
H: Power consumption of a 4x4 LED matrix
I have a 4x4 LED matrix multiplexed, meaning that I can control individual LEDs with just 8 lines rather than 16. I am interested in finding the power consumption of the grid. The LED has forward voltage drop of 1.8 V and I am using 330 ohm resistor with each LED. The power supply is 5 volts. Appreciate any help!
AI: Since each LED is dropping 1.8V, then there will be about 3.2V dropped across each 330 ohm resistor -> 5V - 1.8V = 3.2V.
The current through the resistor is the same as the current through the LED in series. This is calculated as resistor voltage divided by resistance -> 3.2V / 330 ohms = 9.7mA. This is the current through each LED string consisting of one series resistor and LED.
There are 16 LEDs, but using this style of matrix multiplexing, a maximum of 4 should ever be on at one time. That means your maximum current consumption should be found by multiplying the current through one LED string by the total number of strings -> 4 * 9.7mA = 38.8mA.
Power (watts) is simply voltage multiplied by current:
Total Power: 5V * 38.8mA = 194mW
Power Per LED String: 5V * 9.7mA = 48.5mW
Total LED Power: 1.8V * 38.8mA = 69.84mW
Total Resistor Power: 3.2V * 38.8mA = 124.16mW
Efficiency: 69.84mW / 194mW * 100% = 36%
The efficiency is very low because so much voltage is dropped across the series resistors. Since you only need one LED at each matrix point, the best way to increase the efficiency would be to use a lower voltage power supply. For example, if the supply was 3.3V instead of 5V, only 1.5V would be dropped across each resistor. To maintain the same 10mA through each LED, the resistor size would be changed from 330 ohms to 150 ohms (1.5V / 10mA). With less voltage dropped across each resistor with the same amount of current flowing, less power is wasted in the resistors. The new numbers would look like this:
Total Power: 3.3V * 40mA = 132mW
Power Per LED String: 3.3V * 10mA = 33mW
Total LED Power: 1.8V * 40mA = 72mW
Total Resistor Power: 1.5V * 40mA = 60mW
Efficiency: 72mW / 132mW * 100% = 55%
When driving LEDs in this manner, you want the total supply voltage to be as close as possible to the total LED string voltage (one LED or a few LEDs in series) with a bit extra to drop across a series resistor to set the current. If you could use a 2.0V supply, 20 ohm resistors would drop 0.2V for the same 10mA. This would drop the total power consumption to 80mW and increases the efficiency to 90%!
Of course, you would probably have to use a voltage regulator to achieve this irregular voltage supply level which will lower the efficiency (matrix efficiency * regulator efficiency). You'd really need to use a switching regulator which could have greater than 90% regulation efficiency. If you use a linear regulator, it will yield the same low efficiency in the end because it is burning off the extra voltage as heat, similar to the series resistor in your original design.
If you are using multiple LEDs at each matrix point, put as many in series as possible (in your case, 2 is all you can do with a 5V supply and 1.8V LED) rather than in parallel to save on wasted current.
You didn't ask this in the question, but keep in mind that when multiplexing LEDs in this manner, each will only be on 1/4 of the time because you are using an Nx4 matrix. Hence, the LEDs will only appear to be about 1/4 as bright as they would be when driven continuously with the same series resistance (again, not exactly due to the nonlinear light output to current relationship). |
H: External CPU design
Apologies if this is a dumb question. I don't have any training in electrical engineering, so I can't gauge for myself how ridiculous this sounds.
Would it be possible to modify a commercial CPU so that it does not have to be directly in contact with the motherboard?
That is, with the right conducting medium, would it be possible to significantly increase the distance between a CPU and the motherboard? And if so, is there some theoretical or practical maximum distance?
AI: I'm not sure why you'd want to do this, but with the socketed processors you could build an extender that lets you move the CPU a short distance off the motherboard.
You can't move it a long way off the motherboard because the increased signal propagation time becomes signifigant. A 1GHz signal has a cycle time of 1ns; in that time a signal can travel a maximum of 30cm, limited by the speed of light. Lengthening this will eventually interfere with normal operation somehow. |
H: SuperHeterodyne receiver
In a superheterodyne receiver, let us assume, I have a signal in the RF range of 88MHz to 108MHz.
From what I have read, my understanding is that by tuning the local oscillator frequency, we can make the incoming RF signal to fall within the IF frequency range which we have designed.
My questions :
Suppose I have a frequency of 95MHz, and my IF filter is designed at 98MHz (Am I correct in assuming this value for the IF filter?) The signal, after going through the filter, will come as a signal having 98MHz, right?
But my actual signal is 95MHz, and all my modulation is done at 95MHz. Not after the filter, the signal is converted to 98MHz. Won't my actual signal present in the 95MHz, be lost or tampered with filter?
In other words, how is the modulation retained even after passing through the IF filter?
Does high carrier frequency imply that more information can be carried and low carrier frequency imply that less information can be carried per unit time? Can someone explain.
AI: Take a Frequency Modulated (FM) signal going into a superheterodyne receiver which has a tuning range over 88 to 108 MHz.
Any given FM signal will occupy a much narrower bandwidth than that. Typically an audio signal will deviate the carrier, that is modulate the frequency, by around +/- 100 kHz. If we take the carrier to be 95 MHz, then the complete signal is represented by the frequency changing from 94.9 MHz to 95.1 MHz.
Let's say we have an Intermediate Frequency (IF) of 10.7 MHz, this is the frequency almost invariably used in commercial FM receivers. The IF could be another frequency in that ballpark, but 10.7 MHz has been settled on as a de facto standard, and there are a lot of cheap components made and used for that frequency.
To 'tune to' our 95 MHz signal, the first Local oscillator (LO) is set to 105.7 MHz. We mix the incoming signal and the first LO, and our IF filter picks out the difference frequency, and signals near to the difference. Typically the IF filter has a bandwidth of a few hundred kHz, to cope with the full width of the frequency deviation, and a bit more. 95 MHz translates to 10.7 MHz. 95.1 MHz translates to 10.6 MHz, and 94.9 MHz becomes 10.8 MHz. All of those signals pass through the IF filter.
So at the IF, just as at the carrier, we have a frequency modulation. It's the same rate and same deviation, and represents exactly the same information.
By setting the first LO to other frequencies, we can get other carrier frequencies to pass through the IF filter. Perhaps the most important part of the filter is that nearby RF frequencies do not pass through the IF filter.
Once down to a fixed frequency range, we can build a high quality FM demodulator, that maps the changes in frequency around 10.7 MHz into changes in voltage, to recover the modulation. Most demodulators are designed to only accept the specific frequencies passing through the IF filter, so all tuning is done by changing the LO frequency.
It's the signal bandwidth that determines how much information can be carried, not the signal centre frequency. The 95 MHz version and the 10.7 MHz version of a standard audio FM signal carry the same amount of information. However, with a higher centre frequency, it's possible to make a signal with a wider bandwidth. So for instance if you wanted to make a 25 MHz bandwidth signal, that's not physically possible at a 10 MHz centre frequency, though is perfectly possible at 95 MHz centre. |
H: 24 AC to 32 DC. How?
I encountered the following problem: inside an equipment, an added PCB needs 32 V DC and in that enclosure, only 24 V AC is accessible. In order to get 32 V DC from that 24 V AC, someone put a bride rectifier and a 6800 uf (68 V) electrolytic capacitor in parallel to the load. Doing this, 32 V DC were obtained.
Now, my questions are:
How did he calculate the value of the capacitor in order to boost the voltage to 32 V DC from 24 V DC (after rectification)?
I don't have an oscilloscope to see the waveform after rectification and filtration but, is there a better way to obtain 32 DC from 24 AC regarding the output waveform?
If you know good tutorials in order to understand these principles better, please let me know.
Your responses will be much appreciated. Thank you in advance!
AI: How did he calculate the value of the capacitor in order to boost the voltage to 32 V DC from 24 V DC (after rectification)?
If the input is really 24VAC, after rectification the DC peak voltage at the capacitor will be given by:
$$V_{cap} = 14VAC \cdot \sqrt2 - 2\cdot (V_{DIODE})\approx 32VDC$$
Provided that the load connected to the capacitor does not draw too much power, down to the point where it would considerably discharge, the average output voltage would be slightly lower than 32VDC.
The capacitor value depends on the load, the allowed voltage drop between cycles, and the line frequency according to the following.
$$C\ge\dfrac{P_{max}\left(\dfrac{1}{2} + \dfrac{\arcsin\left(\dfrac{V_{min}}{V_{peak}}\right)}{\pi}\right)}{(V_{peak}^2-V_{min}^2)\cdot f_{line}}$$
Where:
\$V_{min}\$ is the minimum allowed voltage during discharge;
\$V_{peak}\$ is the peak voltage across the capacitor (e.g. 32VDC);
\$f_{line}\$ is the frequency of the input AC voltage (e.g. 60Hz);
I don't have an oscilloscope to see the waveform after rectification and filtration but, is there a better way to obtain 32 DC from 24 AC regarding the output waveform?
If by that you mean to measure the voltage, you can simply measure the RMS voltage across the capacitor. It should give something close to 32VDC.
EDIT#1
The equation proposed above assumes that no input cycles are skipped.
EDIT#2
Just for clarification, here is the derivation. Assume thatthe voltage across the capacitor is the following:
The capacitor formula is given by:
$$\Delta I = C \dfrac{dV}{dt}$$
By replacing \$\Delta I\$ with \$\dfrac{P}{\Delta V}\$ and integrating the equation, the follwing is obtained:
$$P\cdot t = \dfrac{C}{2} \cdot \left(V_{peak}^2 - V_{min}^2\right)$$
where \$t=t_1 + t_2\$ in the above picture.
Since \$t_1\$ is a quarter of period, its radian equivalent is given by:
$$t_1 = \dfrac{2\pi}{4}\cdot \dfrac{1}{f}=\dfrac{\pi}{2\cdot f_{line}}$$
\$t_2\$ on the other hand can be calculated through the following way. It it is not so clear to see it, assume for the moment that \$V_{peak} = V_{min}\$ in the above image, it would mean that \$t_2=\dfrac{\pi}{2}(90°)\$. This in turn could be used to reverse calculate and check the amplitude ratio of both voltages according to:
$$\arcsin\left( \dfrac{V_{min}}{V_{peak}} \right)=\arcsin(1)=90°$$
That means that the following holds true
$$t_2 = \arcsin\left(\dfrac{V_{min}}{V_{peak}}\right)\cdot \dfrac{1}{f_{line}} $$
Rearranging everything you end up with the formula shown in the original answer. |
H: what is the mistake of my calculation ,Transformation of the \$\Delta\$ to \$Y\$ circuit
If \$I=4A\$ ,and \$r=6Ω\$,then what is \$R\$?The answer for this is \$R=18Ω\$,but my answer of my calculation is always \$R=36Ω\$.
My calculation
Transform the \$\Delta\$ circuit ,which resistors are all \$RΩ\$ ,to \$Y\$ circuit , and combine it with the other \$Y\$ circuit,which resistors are all \$r=6Ω\$,and the circuit will become this
simulate this circuit – Schematic created using CircuitLab
So the resistance for this circuit will become
\$R_{th}=(6|| \frac{R}{3})+[(6|| \frac{R}{3})||(6|| \frac{R}{3})]=\frac{6R}{18+R}+\frac{3R}{18+R}=\frac{9R}{18+R}\$
So \$I=\frac{V}{R}\$.that is \$4=\frac{24}{\frac{9R}{18+R}}\$ ,so \$R=36Ω\$.what is the mistake of my calculation,can anyone tell me??
AI: It should be clear that the leftmost R is connected directly between 24+ and 24-.
Try starting from here:
simulate this circuit – Schematic created using CircuitLab
Figure 1. Schematic redrawn.
Hint: what is the voltage across r3?
Your answer of 18 Ω is correct. |
H: DC Analysis of this common emitter circuit
I'm learning about transistor configurations (particularly in relation to audio circuits) and am having difficulty analysing this fairly straightforward common emitter stage from the Instrument input of a Roland RE-201 Space Echo. Specifically, I am confused how to find the DC bias voltages for this circuit. If R3 220k was connected to Vcc this would be a standard 4 resistor setup but with it being tied to the collector (which is connected to Vcc through R8 27k) I am having trouble calculating the voltages. Every explanation I have looked at so far brings in the transistor beta at some point in the calculations but am wondering if it is possible without using this (or even without estimating beta) with the known resistors and Vcc of 17v.
I tried looking at it in terms of a voltage divider but don't end up with the 5v Vc that the schematic shows:
i.e.
Vb = 17 * ( 47k / [47k + 220k + 27k] ) = 2.71v
Ve = Vb - 0.65v = 2.06v
Ie = 2.06 / 560R = 3.6mA
Ic = Ie
Vc = Vcc - (27k * 3.6mA) = wrong!
I think I'm perhaps incorrect with my first line of calculation as there may possibly also be a resistance to ground from the collector through the transistor (?) which I imagine should be considered, but I don't know how to factor this in.
Can anyone offer some advice?
Many thanks in advance
EDIT: schematic re-uploaded to show that C6 / R10 are connected to other audio inputs which go through a separate amp stage and so bypass Q11.
AI: R3,R6 and Q11 forms a kind of VBE (Vth for MOS) multiplier and almost all the supply current will flow through the collector and emitter, therefore we can write $$ (V_{cc}-I_c \cdot R_8) \cdot R_6/(R_3+R_6)=V_{BE}+I_c \cdot R_7 \, .$$ From that you get Ic, since VBE is approximately constant due to the exponential BJT transfer characteristic. Once you got Ic, you get the emitter and collector voltage, and thus the base voltage as well.
In first estimates you can assume that beta is infinite. At least for discrete implementation. Solve the equations to get an insight into the circuit, and introduce beta in the second round only if it is needed. Usually beta is not needed. For calculation done only to gain insight and understand the circuit behaviour you never take beta into account. So I am little surprised that you have seen it in every explanation so far.
PS: your first equation would be only valid, if no transistor would be there. The current of the transistor, which is way higher than the current of the resistive divider will develop a current drop on R8, which is not reflected in your first equation. |
H: What is the advantage of RLC low pass filter over two RC conneced in series?
I guess two RC in series should be a second order low pass filter. Because the transfer function will have s^2. And an RLC low pass filter is a second order filter for sure.
So what is the difference between to RC in series and one RLC filter.
AI: What is the advantage of RLC low pass filter over two RC connected in
series?
With two RC low pass filters in series, the Q can never be greater than 0.5 and therefore it cannot make use of the peaking effects you get when you use an RLC low pass filter such as this one: -
Picture from here.
Look at the red trace - around resonance you can achieve a peak in the response - this can be used to highly optimize filters and improve the pass band.
With a 2nd order filter made from cascading two RC filters you have limited peak control equivalent to the Q of the RLC circuit being a maximum of 0.5: -
The above was made to have a Q of 0.5 by increasing the series resistance to 200 ohms.
If you want the math: -
A single low pass CR stage has a transfer function of \$\dfrac{1}{1+ sCR}\$
For 2 stages and ignoring loading effects of the 2nd stage you'd get a TF of \$\dfrac{1}{(1+ sCR)^2}\$
If you rearranged this into standard form you'd get this: -
$$\dfrac{\frac{1}{C^2R^2}}{s^2 + s\frac{2}{CR} + \frac{1}{C^2R^2}}$$
And the standard form can be shown to have these equivalent parameters: -
\$\frac{1}{C^2R^2} = \omega_n^2\$
\$\frac{2}{CR} = 2\zeta\omega_n\$
If you rearranged these you'd find that \$\zeta\$ = 1 and, because \$\frac{1}{2\zeta} = Q\$, then Q = 0.5. |
H: Oscillation frequency of ring oscillator
I have the following problem, that may be very simple, though I'm not quite sure.
MY ATTEMPT
Well, if we interpret all the sum of the delays as the period of the oscillation then the answer becomes awfully simple (maybe too easy).
\$f=\frac{1}{T}=\frac{1}{15 \text{ns}+15\text{ns}+15\text{ns}+10\text{ns}+15\text{ns}}=14.286 \text{MHz} \$
I arrive at an answer of 14.29MHz. However, this solution seems way too easy and simple, so I'm wondering if I am understanding the problem correctly?
Can anyone help me tell me if I am on the right track, or if I am way off?
AI: Picture taken from this site
For this basic design you have to use an odd number of inverters to get negative feedback at DC and thus the circuit becomes self biased. |
H: Connect an I2C camera to computer via USB as a webcam
I took out of an old security camera its circuitry and I am trying to figure out a way to connect it via USB to my computer and use it as a standard webcam. Is it possible? Here are the front and the back of the camera circuit. There are the 12V, GND and Video pins. But also there are the 3.3v, SDA, SCL and GND pins which are unused. Maybe those pins can be used to extract image data from the CMOS, but I'm not entirely sure about that. But maybe, is it possible to just take the analog VIDEO pin and convert it to digital data and use the stream as a webcam? Thanks.
Front
Back
AI: If there is an analogue output, your best bet is to buy an adapter to connect the camera to the computer. I guess that the signal on the 3x1 connector is standard.
The I2C bus, most probably, is there to program the board microcontroller. Depending on the frame rate and resolution of your video feed, I2C data rate would range from barely adequate to completely inadequate. Even if there was some kind of digital feed there, that won't be standard, therefore you would have to reverse engineer that.
On top of everything, a cheap webcam probably costs less than the converter, has built in power supply, and has lenses. In case you did not know, lenses are necessary for the sensor to work properly, so if you have the original enclosure make sure to test inside it, otherwise you won't be getting anything useful from that.
All in all, if it's not for fun and to learn, just buy a webcam. |
H: Can dust affect the power output of a PSU?
I've recently had some power issues with my PC and I thought it was due to the PSU being under voltage.
When I took it out my PC, I noticed it had quite the ammount of dust on it, so I cleaned it with compressed air then tested it with a voltmeter and it showed me it was delivering normal voltage (according to this graph : https://cdn.makezine.com/uploads/2014/04/da87333a_atx24-1bcq.jpg).
Since then (2 days), I didn't notice any power issues after cleaning & testing. I'm wondering if dust can affect the ammount of power a PSU can deliver. (Before testing, I had those power problems quite frequently.)
I did search on google but I could not find an answer, I'm just curious to see if dust was the problem.
AI: 2 main ways
Dust can be conductive, meaning it may cause the feedback network used for the controller to read the wrong value
The power supply may be entering some kind of thermal protection, where when too hot, it starts decreasing the maximum current, which causes the output voltage to start falling. |
H: How much power does the voltage source with \$12V\$ provide to the circuit? Which part of my calculation is wrong?
How much power does the voltage source with \$12V\$ provide to the circuit?
The answer is \$84W\$
My thinking:
The question asks me "How much power does the voltage source with \$12V\$" provide to the circuit, so I think I should ignore the voltage source with \$-6V\$, that is, see the voltage source with \$-6V\$ as a short circuit, then the circuit will become like this
simulate this circuit – Schematic created using CircuitLab
Obviously,\$R4||R2,R3||R2,R3||R1\$,so these resistances are parallel connected to each others,so the \$R_{th}=R4||R1||R2||R3=6||6||12||12=3||6=2\$.
And the power of voltage source with \$12V\$ is \$P_{12}=\frac{V^2}{R}=\frac{12^2}{2}=\frac{144}{2}=72W\$, however, as I said in the beginning,the answer should be \$84W\$,so does someone know which part of thinking am I wrong in my calculation?
AI: does someone know which part of thinking am i wrong in my
calculation??
You can't ignore the 6 volt source. You have to calculate the net current into or out of the 12 volt source and you might use superposition (you are actually half way there with shorting the 6 volt source) or some other circuit analysis technique like "simplification": -
You should be able to pretty much see straight away that the 12 volt source is supplying 3 amps to the 6 ohm resistor and 4 amps to the 3 ohm resistor.
The next step is too trivial to mention. |
H: Zero in a basic RC high pass filter
If I write the transfer function I can clearly see a zero at zero frequency and a pole at 1/2πRC frequency. But If I simply look at this circuit I would say that there is one pole and no zero(as there is only one path from input to output(that's one technique I learnt in my engineering)). Is there any intuitive explanation of this zero or am I making some mistake? Please explain.
AI: For a low-pass or a high-pass simple RC filter, there is always a pole and always a zero. For the low-pass the zero is at infinity i.e. infinite frequency. For high pass, it is at zero frequency (aka DC).
But If I simply look at this circuit I would say that there is one
pole and no zero
If I look at it I see a DC blocking capacitor hence the output cannot have DC content hence there is a zero at DC (0 hertz). |
H: Calculate peak input current of switch mode power supply
I have the following problem.
MY ATTEMPT
The switch-mode power supply looks like it's a boost converter. I found that the DC-transfer functions for the boost converter to be:
\$\frac{V_C}{V_{in}}=\frac{1}{1-d} \: \: \$ and \$\frac{I_L}{I_{out}}=\frac{1}{1-d} \: \: \$ where I presume that \$ d\$ is the duty cycle.
My idea was first to find \$d\$ with the first equation: \$d=-\frac{V_{in}}{V_C}+1=\frac{-2.7 \text{V}}{5 \text{V}}+1=0.46 \$
From here, we can plug \$ d\$ into the second equation and find \$I_L=\frac{I_{out}}{1-d}=\frac{2.3 \text{A}}{1-0.46}=4.256 \text{A}\$
And since the \$V_{in}\$ and the inductor is in series, we conclude that \$I_{in}=4.256 \text{A}\$.
But is what I have found the \$\underline{peak}\$ input current or something else? I am in doubt, because I don't use the information about the switching frequency at all.
I hope someone can help me with this.
AI: First thing to notice is that you have a a very small output capacitor, which is used to supply the load during the on phase (when the inductor is being charged and there is no power transfer between the primary and secondary sides).
The required capacitor to hold the output voltage long enough until the next cycle can be calculated through the following:
$$C=\dfrac{P_o\cdot D \cdot 2}{f_S\cdot (V_o^2-V_{o,min}^2)}$$
where:
\$P_o\$ is the output power (\$5V\cdot 2.3A=11.5W\$)
\$D\$ is the duty cycle \$1-\dfrac{V_{i}}{V_o}=0.46\$
\$f_S\$ is the switching frequency
\$V_o\$ is the nominal output voltage
\$V_{o,min}\$ is the minimum output voltage
Plugging in your values, you are gonna find out that with your current capacitor, the output voltage drops to zero at every cycle because of the high load. This also means that at every off cycle, the output capacitor will have to be recharged from zero again, as it was completely discharged during the on phase.
Anyway, disregarding that for the moment (assuming that indeed there is a stable output voltage \$V_o=5V\$ and output current \$I_o=2.3A\$) you can use this application note from Texas Instrument to calculate what you need. Here is a summary using your values:
The duty cycle is given by:
$$D=1-\dfrac{V_i}{V_o} = 0.46$$
The ripple current of the inductor can then be calculated:
$$\Delta I_L=\dfrac{V_i \cdot D}{f_S \cdot L}=936mA$$
The maximum peak current is then given by:
$$I_{SW,MAX}=\dfrac{\Delta I_L}{2} + \dfrac{I_o}{1-D}=4.727A$$
EDIT #1
Here is a small simulation just to double check it. The output capacitor was increased in order to account for the aforementioned problem regarding the high load: |
H: Smoothing capacitor for half wave rectification
I'm trying to implement a half-wave rectifier using just a diode. I'm using a unity gain opamp for isolation from the mains. At the output of the opamp, I'm using a smoothing capacitor to get a DC voltage across 1K load resistor.
But for some reason, I can't get rid of the ripples. Any idea why?
AI: I don't know what you mean here with isolation, but the opamp does not isolate from mains, don't be lured into false sense of safety.
You have an ideal simulator, the op-amp will buffer whatever voltage there is at the input, and it will do that no matter how big capacitor you put at the op-amp output, it will get charged and discharged by the op-amp. |
H: How do I proceed when the current is Io = 2cos (wt)?
I have this problem:
And I would like some help with how to proceed.
My own thinking:
I think Io = 2cos (wt) mA should be 2 mA. For VR (t) I think it should be VR (t) = 2 mA * 1000 = 2 V and for the capacitor I think I should use 1 / jwC = -j 1 / wC = -j 1/10 ^ 5 * 10 * 10 ^ -9 = -j10 ^ 3 ohm = -j kohm and to get Vc (t) it becomes Vc (t) = 2 mA * -j kohm = -2j V.
Am I thinking right or am I on the wrong path?
AI: You are right but just keep in mind for solving these kind of problems the solution used is called "Sinusoidal Steady-State Analysis" and you can google it if you're uncertain about how it works. But overall what you did is right except that don't forget the voltage across the resistor is not just 2V (it's not a DC voltage). 2V is in phasor, so you have to convert it back to Time-domain form which is 2cos(wt).
Just like this convert the voltage for capacitor and inductor too.
General format for time domain is:
$$ A=M\cos(\omega t\;+\;\theta) $$
which is converted to the phasor form:
$$ A=M\sphericalangle\theta $$
In order to convert, this is how it's done for the voltage across the resistor:
$$ I_{o}=2\cos(\omega t)\quad mA $$
$$ I_{o}=2\sphericalangle0 \quad mA$$
$$ V_{R}=2\sphericalangle0\;mA\times1k\Omega=2\sphericalangle0\quad (V) $$
$$ \Longrightarrow V_{R}=2\cos(\omega t)\quad (V) $$
Try to do the capacitor and inductor yourself and note that the phase is not zero anymore for those devices. |
H: Simplifying circuit for Thevenin's theorem
I am supposed to find a Thevenin's equivalent circuit for this one:
I am struggling with simplifying it to calculate Rth. When I apply short circuit to voltage source I achieve a junction connected to R1, R3, R7+R6 and R4. How to handle it?
AI: The first thing to do when you face a schematic that seems complicated is to redraw it. It's a skill, so you do have to work at developing it. But it's easy to learn and get better, with practice. So you should just start and practice.
In this case, let's try something like this:
simulate this circuit – Schematic created using CircuitLab
This is the same circuit. (You can check it out.) But I've removed the voltage source as a separate schematic item and replaced it with the \$+5\:\text{V}\$ rail symbols. This eliminates "busing power around with wires" and helps avoid some confusion over wire connections that aren't important for analysis purposes.
I think you can more easily see, now, that this circuit can be analyzed as two independent sub-circuits. Thevenize the left side and then the right side. Once you've done that, you will have two Thevenin voltage sources with their two Thevenin series resistances.
The difference between the two Thevenin voltages will be what appears across A and B, when open circuit. The current that flows via the wire connecting A and B, when shorted, will be the short-circuit current. This tells you all you need to know. |
H: Adding an LED through a FET circuit that currently drives a solenoid
I would like to save space on a layout by consolidating a FET or two, where feasible, on an existing board. One of the FETs used, a coolMOS P7 series (IPA60R280P7SXKSA1), seems to have the drain current availability and the acceptable logic to combine its existing solenoid drive function to also include a green LED.
Factoring in the flyback diodes/magnetic field collapse aspect of the solenoid, would it be a poor design practice to put an LED in parallel? If so, why?
Thanks
AI: Please add reference designators to each component.
Assuming the diode on the right is the LED, adding a current limiting resistor in series with it should be all you need. The series combination of the LED and its resistor is in parallel with the solenoid coil and the flyback suppression diode. |
H: What opamp configuration to choose to measure 1kHz square wave with 1MHz signal modulated on it
I have 1kHz square wave I would like to measure the max and min voltage of. But, it is asymmetrical in both amplitude and duty cycle and it has a 1MHz 1V signal on it. The input impedance should be > 100kOhm and the output goes into an ADC without a load.
I went through some theory of opamps. Understand the half wave rectifier, the peak detector and the first order low pass filter. It all seems useful. But I was wondering what best way to do this. I know the duty cycle. Those are fixed values of either 4%, 50% and 96%. The amplitude is either around -5 or -10 at the negative side and around 5 or 10V on the positive side. Any change in voltage I would like to detect within 10 periods (10ms). I would like to measure at better than 100mV accurately.
The only thing I know that works is making a buffer with gain 1, a diode, and R and C that settle at the average of the positive duty. And then divide that voltage by the (known) duty cycle. But the voltage drop of the diode was less constant than expected. For the negative value I could do something similar.
But I am quite sure there is a more elegant way. Before you know it, getting rid of the 1MHz in negative feedback RC combined with the diode of the peak detector works. Thanks!
AI: You could rig up a low pass filter with a corner of, say, 30KHz, and take over 24dB off of the 1MHz signal. Add another pole if that's not good enough. The 1KHz waveform should be relatively unaffected and can be measured directly. |
H: Conversion from 0V ~ 3.3V to -10V ~ + 10V
I need to do a voltage conversion to control a servomotor.
I need to convert a pwm signal that ranges from 0V to + 3.3V into an amplified signal that ranges from -10V to + 10V.
I thought about doing this with the use of an operational amplifier (as in the circuit below).
However, I can't get the correct Vout signal, just a voltage ranging from 0V to + 10V.
Is there another way to do this conversion?
simulate this circuit – Schematic created using CircuitLab
AI: This circuit will do it, also it has a high-impedance input so it will not load your (required) low pass filter.
simulate this circuit – Schematic created using CircuitLab |
H: Component identification: general semi LP 3C
I have this component salvaged. I think it's very generic, but I cannot find it.
Properties:
Dimensions: SMT 1206 length size, although the width is wider
Logo: General Semi (now Vishay I think)
Texts: Line 1: LP, Line 2: 3C
One connection at each end
PCB: Unknown
I would like to know what this is, as I cannot find any datasheet or identification.
AI: According to this, 3C would be the date code. LP is the type code.
According to this, LP is an SMBJ16A unidirectional Tranzorb TVS rated for 16 volts. |
H: What is causing this distortion of a pulse wave when recorded to a reel-to-reel tape?
I'm currently trying to record a pulse train used as a tempo clock for music instruments (e.g. output of Korg Volca 'sync out') onto my Fostex M-8 reel-to-reel recorder, with the aims to then reproduce the recorded pulses to act as a clock source for the instruments. A working demonstration of this using a different tape recorder can be seen here in this youtube video, so I know it's possible to get working.
My problem: When I use my recorder pulse signal as input to a Volca Bass unit, I'm getting very erratic behavior where the playback is irregular and at a different tempo than when I recorded the signal.
I'm using a Roland tr-09 as my clock source, and the output of the trig jack gives a nice clean square wave:
The captured signal from the output of the reel-to-reel gives a slightly attenuated pulse, with a very long discharging tail from a negative polarity back to zero.
I'm getting this weird capacitance looking discharge. Is this just the nature of the tape that's causing this? Is there something about a DC component being filtered out? Why did the demonstration in the linked video work, which is also recording onto tape, but I'm getting this result?
AI: Your original digital signal is bent out of shape because it has been high-pass filtered by the tape recorder.
Let's have a look at Korg Volca service manual and dig in the schematics, here is the input circuit for Sync:
Presence of R158 hints at trouble as this is not some simple digital input circuit. On the contrary Q9 is in linear mode, biased by the resistors around it. I'll just run a simulation:
I removed the EMI filters (inductor and caps) on the original schematic. V1 models the original "square wave pulse" clock signal. C1, R1 and unity gain buffer E2 model the tape recorder and its high-pass filtering action. This results in signal "hipass" on the simulation plot, which looks like what you get on the scope.
Trace "out" is the output of the first transistor, and traces "rise" and "fall" are the corresponding signals in the service manual schematics. The names hint at a rising/falling edge detector, and all the signals look like garbage. This is not working.
Now I remove the circuit which simulates the response of your tape recorder and feed the square wave signal directly to the simulated Korg Vulca. It seems to work, outputs "rise" and "fall" produce neat pulses on corresponding edges of the input signal.
So we know the reason why it doesn't work: the Vulca input circuit likes to receive a nice square wave. They could have fixed this with an extra 5c transistor, but, hey, it costs money.
Also the input circuit doesn't seem to care much about input voltage level since I mistakenly used 5V clock pulses and it works. It also works with 12V pulses which is what your scope shows.
So you need a circuit to turn the highpass-filtered clock into a square signal with nice flat constant levels between edges.
Since the signal is digital, a simple way to recover the original signal would be to use a comparator, a CMOS 4000 buffer, or a two transistor circuit shown below:
You can use any kind of NPN like 2N3904, BC547, etc. Power supply voltage is not critical, like 5-12V. You could even stick it inside the Vulca and tap its power supply. |
H: Why is a 103Z capacitor use with N20 DC motor?
So capacitor 103z is used in parallel with N20 DC motor, I would like to know why?
AI: It reduces EMI produced by the motor by absorbing high frequency noise. |
H: Using an op-amp to drive LEDs according to an incoming signal
The following schematic was suggested for visualizing the frequency (which is variable) of an oscillator using two LEDs that light up alternatingly. It seems that the value of the resistor determines how much voltage is provided to the LEDs. I've never seen this circuit before and was wondering, is there no need for a current limiting resistor for these LEDs?
simulate this circuit – Schematic created using CircuitLab
AI: R1 is already the current limiting resistor. Since no current is flowing into the opamp input, and its inverting input is at ground due to the feedback loop, the current through R1 will flow directly into the diodes. Therefore the current flowing through the LEDs will be
$$ I_D = \frac{V_{osc}(t)}{R_1} = \frac {5\ \mathrm{V}} {4.7\ \mathrm{k\Omega}} \sin( \omega t)$$
The current amplitude through the LEDs is approximately 1 mA. In the equation I have assumed sinusoidal oscillation.
It might depend on the LED specification, but I feel the LED current is a little low. |
H: Current Sense Amplifier Potentials
I'm trying to implement a current sense amplifier in my application, but I have a question about setting it up with regards to current flow.
Basically, in this case, you put a very small shunt resistor between the source and the load, and the current sense amplifier measures the voltage across it, and outputs a voltage in accordance with the current flow. This is shown below using the INA293.
However, this assumes a positive voltage at the load supply with respect to GND, being 0 volts, and most likely, \$R_{Sense}\$ is small enough such that the voltage drop is negligible. For my application, I'm considering using it with the LM2673 circuit that outputs a negative voltage shown below. In this case, GND would be the more positive node w.r.t. \$V_{OUT}\$, so current will flow from GND to \$V_{OUT}\$. So, to rework the current sense circuit, the Load Supply would be GND, GND would be \$V_{OUT}\$, and the opamp's GND node would be connected to \$V_{OUT}\$. If I were to place the sense resistor between the Load and \$V_{OUT}\$, would the current sense amplifier work properly, or is there something that would not cause it to work?
EDIT: Proposed Application Circuit:
simulate this circuit – Schematic created using CircuitLab
Rough Schematic idea with Comparator OpAmp:
simulate this circuit
AI: Based on your description, it seems like you mean that you want to implement something like the circuit below. This is essentially the same circuit, using your switch mode inverter as a virtual ground. As long as \$ V_{s+} - V_{s-} \$ is less than 22V (the rated supply voltage of your current sense amplifier) there is nothing wrong with this circuit (or really, anything different from the application diagram from the datasheet that you posted).
simulate this circuit – Schematic created using CircuitLab
Note that if you want to connect the output of this current sensor to something else, it will also need to be referenced to \$ V_{s-}\$. |
H: Thevenin equivalent and maximum power transfer theorem question
I want to find a load resistance's value so that it gets the maximum power transfer, and thus I am using Thevenin's theorem by finding the equivalent circuit's resistance.
By doing so, I got 2929.28 Ω.
The problem is that one of our classmate's claims that the resistance labelled as R4 doesn't have to be taken into account when calculating the equivalent resistance, with no further explanation as to why or how.
The question would be, does that...statement make any sense? Wouldn't all the resistances need to be grouped together in order to get the Thevenin/Norton resistance?
Below is the circuit and my solution:
Thanks!
AI: You are correct. R4 must be taken into account when calculating the Thevenin resistance. The Thevenin resistance is defined as the resistance looking into the circuit from the load terminals. It is clear that R4 is in series with the rest of the circuit. Imagine if R4 was infinite. According to your classmate, it would have no effect on the Thevenin resistance when it is clear that it makes the resistance infinite. Don't rely on your classmates but use the knowledge that you have gained in the classroom. That is why you are there. |
H: Why are one channel's transistors in a power amp getting much hotter than the other's?
(Context: I don't have a background in e.e., but getting better at basic bench work.) I'm repairing/recapping an early 70s German integrated stereo. The power amp output section has four large heatsinks for its transistors, two each corresponding to the left and right stereo channels. After a very short period of time, even a couple minutes, the left-channel's sinks become extremely hot to the touch while the right channel remains cold.
The audio output is correct and expected, a typical radio or aux music signal amplified in stereo. Sound on both channels is totally fine coming out of the speakers. I only noticed the heating asymmetry by accident.
I don't know that this is a problem that needs solving, exactly, but the heat in that area seems likely to reduce the life of the new left channel caps somewhat.
I'd like to understand if (1) this indicates a problem and (2) what might explain it? Could those power transistors be deteriorating unevenly with age? Could something else that feeds them be behaving strangely? (I've replaced all the electrolytics and a couple questionable looking film caps on this board, for what that's worth.)
Any insight or theories/pointers/assistance very welcome. I have a bench oscilloscope and can probe signals in an entry level kind of way if that's useful but not sure what I'd be looking for in this case since output seems fine.
Worth noting that the differential in heat remains over long durations-- the right channel does eventually (an hour?) become perceivably a bit warm to the touch, but the left channel becomes scorching very quickly and stays that way. (This is also true if the left speaker is not even plugged in, fwiw)
Photo of the board and image of the schematic for this board below. The left channel is the left half of the board, and the two left heat sink sections.
Schematic. Input from preamp at left, output to speakers at right. Left channel is top half of the diagram. T708 (and maybe T709? maybe T705?) appear to be the very hot transistors.
AI: Digging down way deep in my knowledge base, but...
Looks like what you have is a push-pull (totem pole) output stage, with the two transistors in the top (T706, T708) and bottom (T707, T709) legs of the totem forming a darlington pair.
These darlingtons should be biased so that with no signal, both the top and bottom pairs of transistors are conducting, just a bit. This is done to reduce the distortion (crossover distortion) that would occur if the output transistors were operated in a pure B mode. This distortion occurs because with pure B type operation, both sets of transistors would be OFF near the 0 V point of the waveform, creating a couple of volt dead zone in the output.
By biasing the outputs transistor pairs to be slight ON at near 0 V, this distortion is rediced/eliminated. The downside is that because both transistor pairs conduct near 0 V, there is higher dissipation in the output transistor due to the current that flows from the top to the bottom pair.
The resistors Brian Drummond mentioned (R715, R615), along with the transistor, establish this quiescent operating point, the amount of current that flows through the top and bottom pairs, and so impacts the power dissipation. If this quiescent point is not set correctly, you have excessive current flow (sort of a shoot-thru affect) that increases dissipation. |
H: Big voltage drop across MOSFET with LED strip load
I'm trying to power up a Giderwell RGBCCT LED strip using ESP32 (a 3.3V microcontroller) with the help of an IRL540N MOSFET.
My circuit looks like this:
(sorry for the amateurish/nonstandard diagram, I'm not educated in EE)
R1 is a simple pull-down resistor to ensure the gate is low while the chip is powered off/booting.
I actually have 5 MOSFETs driving 5 channels of an RGBCCT strip, but everything is the same if only one channel is powered.
My problem: When the gate is high and there is no load, I measure 12V across the drain and source terminals of the MOSFET (as expected). However, when the LED strip is connected, this voltage drops significantly, to 6-8V, depending on the MOSFET and channel I'm measuring. The LEDs are also much darker than when connected to +12V and GND directly.
This is a small segment of an LED strip containing 6 LEDs per channel, and by spec should peak at 300mA for the whole segment, so approx. 60mA per channel.
What could be causing this? I'm using a perfboard - is my soldering to blame? (It's pretty atrocious, this is my first soldering project.) Maybe I cooked the MOSFETs while soldering, causing them to not be able to deliver the current? Is the 3.3V logic level too low to fully activate the MOSFET? The datasheet suggests a max 2.0V threshold and ~10A of continuous current at 3.0V gate-to-source, which should be plenty. I might be missing another parameter though.
I measured the resistance from GND to the source pin on the MOSFET, and from the drain pin of the MOSFET to the cathode pad at the end of the strip, and it's around 0.3 ohm. If it matters, I used AWG 20 wire (0.5mm²) to connect everything, joined by soldering on the perfboard.
Update: I measured the drain-source resistance on the MOSFETs while their gates were high. Most of them have around ~20 ohms, give or take, while one has 3.9 ohms, but even across that one the voltage is ~9V, a 3V drop. For one with 25 ohms, the drop is 6V. I'm even more confused now as the resistances are different and the drops are not proportional to the resistance...
AI: You need a logic-level MOSFET rated for <= 3.3V gate drive to make that work. You have a MOSFET rated for 4V gate drive according to the datasheet so you're not completely driving it 'on'.
It's a bit surprising it's that bad, if the part is genuine. Measure Vgs directly at the MOSFET, from gate to source. If there is excessive resistance in the source circuit it could be taking away the already inadequate Vgs voltage. |
H: do we only use pull-up resistor or pull-down resistors when dealing with switches?
I have heard people state that if your micro controller is not reading the signal properly, then we need to use a pull-up resistor. Which I don't get?
It makes sense when switch is involved because you don't want a floating signal.
What I don't understand is why do my friends mentions the pull up resistor help in better voltage reading??
AI: Sometimes it does not matter if you use a pull-up or pull-down resistor to keep default state of the data pin, and the pushbutton will overwrite that with another potential. Inside a plastic case you can have buttons wired with pull-downs and the buttons connect to common +5V wire. Some MCUs have internal pull-downs so you can omit external resiators.
However, it is far more common to find MCUs that only have internal pull-ups. And, if you want the buttons to be in a metal box, you most likely have the metal case grounded, and so it will be safer and easier to have buttons pulled up and switching to ground, to avoid short circuits of 5V to grounded metal case. Some chips, devices and buses can only pull to ground or let the wire float, as they have open-drain or open-collector outputs, so they need pull-ups for sure. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.