text stringlengths 83 79.5k |
|---|
H: Find the resistor's value
I have bought some resistors and I am trying to find their value. The thing is that in class they taught us that you use the gold strip to find which is the right side at first and then you check the other colours strips. The thing is that the resistors I got don't have a gold strip and they have more "other-colour" strips. I have searched in google extensively and also in this site (having found relevant questions) and I have found that resistors come in different styles but I have not found how to "translate" them in their value. Also most sites are calculators to put the colours and calculate the value but I don't know which is the side with which I must begin. These are some of my resistors:
There is this post but these resistors begin with same colour in both sides.
How do I find their value?
AI: The trick here is to look at the spacing. It's subtle, but when you know what to look for it's obvious.
The right-hand band of the top resistor has a slightly wider space infront of it. That's the % band.
So you have Brown Black Black Silver, at Brown %, which is
100×10-2Ω at 1%. (1Ω±1%)
The bottom one, the left hand band has a slightly wider space. That's the % band. As I say, subtle differences. The top one is more obvious than the bottom one.
So you have Brown Black Black Brown at Brown %, which is
100×101Ω at 1%. (1kΩ±1%) |
H: Arduino (ATmega328) in-circuit programming
I am designing a circuit/software for some guy...
I am using an ATmega328 surface-mounted microcontroller in the design and am just supplying the schematic and code. He is going to build it (make a PCB) and use it for his business.
I was going to program it using the Arduino IDE since I have more experience with that and was going to add in an ISP header and suggest using this http://docs-europe.electrocomponents.com/webdocs/0dba/0900766b80dba9b4.pdf to program it..
However I noticed that the 328 is not listed under the supported devices for that programmer?? And even if it was I am unsure if that would work using the regular Arduino program?
What is the best way for me to do this? I need to be able to test the code on my Arduino Uno, and also provide the means for him to easily program the code onto a new chip on the PCB.
I don't mind programming it outside of the Arduino IDE if I need to as long as I can test that code with my Arduino Uno.
I tried looking around for answers, but I didn't find anything satisfactory. Here is the schematic I have so far, with an ISP header (that apparently isn't supported?)
AI: See AVR Studio 4 online help ...
...
Created: Tue 01 Nov 2005 08:17:09 AM EST
The '328 didn't exist until 2009. This is why you go to the primary source when possible.
But yes, that programmer supports the '328, as well as all AVR chips that support ISP. The software needs to support the programmer and the chip as well, but I can tell you that AVRDUDE, which is the AVR command line programmer of choice (as well as the one that the Arduino IDE uses), does. You're covered. |
H: What is the purpose of a PCB with no copper tracks, but only unconnected copper rings?
I have a PCB which has the perfect size for a project of mine, so I would like to use it if possible. However, the copper plating on the back side of PCB only surrounds the individual holes (that is, no holes are interconnected). See picture right here:
I find this strange. How can this be useful? I would definitely need some copper tracks with interconnected holes in there because some components need to be connected to each other. Am I supposed to make my own tracks somehow?
I saw some stuff online about people who would insert multiple wires in the same hole to make interconnections, but this seems undesirable. I'd rather avoid that if there is some way to make tracks.
AI: What you've got is called a prototype board. It is available at electronics suppliers everywhere and is obviously not meant for production. Join things together any way that is convenient for you. Many methods have been pictured. Another common way is inserting a component lead beside its next connection and just bending it over to fit.
The results are typically quite messy, but it can take a lot more handling than a breadboard prototype. Thus it is a common step before getting printed and etched boards made.
You can also find prototype boards in the same circuit pattern as the push-in breadboards, so you can simply transfer your circuit from one to the other, solder, and install. |
H: MSP430 Launchpad connection of photoresistor and concerns regarding Launchpads protection
I am using the MSP430 Launchpad and I have a question regarding photoresistors. The thing is that when you connect a LED with a pin in Launchpad, which you have configured, as output I read that you must use a resistor in series as not to damage the LED. When trying to find how to connect the photoresistor every source said that one must connect a 10kOhm resistor in series as not to damage the Launchpad. Regarding both the LED and the photoresistor as a simple resistor why in the first case we connect the resistor for the protection of the LED and in the second for the protection of the Launchpad? Also why can the Launchpad be damaged by its own voltage? I mean if a pin is configured to input and one tries to use an extremely large voltage then sure it will be damaged, but when you try to use 3.3V generated from its own Vcc whay may be damaged?
AI: An LED is not a resistor; it does not follow Ohm's law. Basically, once you exceed the drop voltage, it will draw as much current as it can, to the point that it destroys itself. This is what the resistor does: limit the current flowing through to a safe level. Try connecting an LED directly to a 9V battery - it may last long enough to give a visible flash of light before it dies. It may also become hot enough to be uncomfortable to hold.
As for the microcontroller on your Launchpad, again it's not the voltage but the current that will damage it. If you were to connect an output pin to ground and drive it high (or connect it to Vcc and drive it low), you are basically making a short circuit. Excess current will flow through the pin and can burn out the silicon of the chip or the internal wire connecting the silicon to the pin.
For the phototransistor, assuming you connect it only to an input, then the internal resistance of the input pin will greatly limit the current through the phototransistor and input pin. However, since GPIO pins can be programmed to either input or output, it's a good idea to put a current limiting resistor, just in case you accidentally set the pin as an output instead. |
H: How data transfers to micro-controllers memory?
I have been working with Arduino for a while now i thought of using AVR micro-controllers in the bread-board . I saw several tutorials on how to transfer .hex file to the AVR micro-controller . They showed how to use the USB programmer to transfer the .hex file but if i say i want to know how to make a USB programmer works , what is the structure of a USB programmer ? I found nothing , can anyone give me a good answer of how the .hex file is transfered into the micro-controllers memory , i.e code-segment in the memory .
Thanks,
AI: There are two ways of programming an AVR device.
The first is via an external programmer that interfaces with "hidden" hardware on the chip. The most common form of this is ISP, described in AVR910. Other methods exist, see the datasheet of the relevant AVR device for details.
The other is self-programming, which involves code running on the AVR device to accept the data to be programmed through one or more pins on the chip and then using special opcodes to write the data to flash and EEPROM. This is described in AVR109.
Note that "programming by USB" is actually self-programming where the bootloader opens a serial connection and the programming software sends the data through this serial connection. This is true both on devices with a separate USB interface chip such as the Arduino Uno as well as devices with integrated USB support such as the Arduino Leonardo. |
H: Water pump with opto-isolator MOC3063M and triac BT137
I have designed a circuit for water pump. Please correct me if I am wrong with schematics. The idea is to to switch on/off AC motor pump with 230V and 7.5A, when water is detected.
I have used opto-isolator MOC3063M and triac BT137.
I have four questions:
Can be used 1.5V to signal water detection or should be at least 6V? The current should be not more than 25mA.
Is it RC snubber set up correctly including resistors R2, R3?
Is it FUSE in right place? Should it places before RC snubber or after that
Can be used additional measure for heating? For example heatsink or another alternative.
Thanks.
P.S. Water detector is nothing but plate with two conductors to detect water presence.
Additional: Yes you are right 1.5V is too small, because of voltage drops of led D1 and the led in MOC3063. I consider to use 6V DC power source.
AI: As others have noted in the comments, the voltage is not high enough. Assuming the WD1 output is a relay, you might be able to get rid of the indicator LED and use that circuit, perhaps with an indicator light across the pump motor. Alternately, use a 5V wall wart supply and increase R1 to get the proper current.
The triac drive circuit looks okay, suggest a higher value for C1, maybe 0.1uF with appropriate AC voltage rating.
Fuse placement should be in the 'hot' line- it's not clear if that's what you have done.
Heating will be around 7-10W so you need a fat heatsink for the triac. Note that the 8A BT137 is grossly underrated for a 7.5A motor load and will probably fail 'on' at the first opportunity. Suggest using at least a 25A triac (40A would not be too excessive) and giving it a large heatsink. |
H: Sendingdata on display
I have 132x65 dot matrix LCD. I am using STM32f303 controller in my application. I got success in displaying the normal 5x7 fonts on LCD.
Now I what I want to do is to display 13x16 custom sized fonts on the LCD. I generated the appropriate hex code for all 95 characters for the 13x16 size.
In 5x7 i was able to send all the bytes using following routine.
void Display(uint8_t Display_Row, uint8_t Display_Column, unsigned char)
{
uint16_t String_Pointer_Offset;
String_Pointer_Offset = 0;
while( '\0' != *(String_Pointer + String_Pointer_Offset) )
{
#if (defined(DISPLAY_WRAP_TEXT_STRINGS) && (DISPLAY_WRAP_TEXT_STRINGS == YEP ))
if(Display_Column > SHADOW_LAST_COLUMN) /* Check if it's the appropriate to wrap the row printing the exceeding character on the next line. */
{
Display_Column = 0;
Display_Row ++;
};
if (Display_Row > SHADOW_LAST_LINE)
{
return; /* Ran out of space :( */
};
#else /* if (not defined(DISPLAY_WRAP_TEXT_STRINGS) || (DISPLAY_WRAP_TEXT_STRINGS == NOPE )) */
if( (Display_Column > SHADOW_LAST_COLUMN)
|| (Display_Row > SHADOW_LAST_LINE ) )
{
return; /* Ran out of space :( */
};
#endif
Display.Row[Display_Row].Column [Display_Column] = *(String_Pointer + String_Pointer_Offset);
Display.Row[Display_Row].Touched[Display_Column] = TRUE;
Display_Column ++;
String_Pointer_Offset++;
};
return;
}
And using Display_Print(1,1,"ABC \0"); function in the main file i was able to display the string on my LCD.
But here number of bytes 26 instead of 8 so which can not be sent simultaneously on parallely interfaced LCD. Can anyone help me how to achieve this big 13x16 pixel font display task?
AI: I just simulated the character you added to your question, and it looks OK to me. For reference, I wrote this code:
unsigned char cha[] = {0x00, 0x0C, 0x00, 0x03, 0xC0, 0x01, 0x30, 0x01, 0x0C, 0x01, 0x30, 0x01, 0xC0, 0x01, 0x00, 0x03, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
void main(void) {
int i;
int j;
for (i=0; i<sizeof(cha); i++) {
for (j=0; j<8; j++) {
printf("%c",(cha[i]&(1<<j)) ? '#' : '.');
}
i++;
for (j=0; j<8; j++) {
printf("%c",(cha[i]&(1<<j)) ? '#' : '.');
}
printf("\n");
}
}
and it prints out:
..........##....
........##......
......###.......
....##..#.......
..##....#.......
....##..#.......
......###.......
........##......
..........##....
................
................
................
................
So it seems that your font data for the character "A" seems ok and to write this to the LCD's row 0, you'd write bytes 0,2,4,6,8,... (0x00, 0x00, 0xc0, 0x30...) to row 0 and bytes 1,3,5,7,9... (0x0C, 0x03, 0x01, 0x01,...) to row 1.
I have only worked with LCDs on a direct hardware level. In case it's useful to you or someone else familiar with this platform, I can explain how to write byte B to row R, column C using the LCD display you seem to be using (NT75451):
First give the command SET PAGE (R), which in c language is (0xB0 | R). Then SET HIGH COLUMN ADDRESS, command (0x10 | (C >> 4)) and SET LOW COLUMN ADDRESS (0x00 | (C & 0xf)). Finally send the data byte (B).
Commands are sent with the LCD display's pin A0 pulled low and data is sent with A0 pulled high, but I suspect you already know this.
Hope this is helpful to you or someone else.
[EDIT]: Based on the draw function added to the question, you might try something like this to draw the big character:
void LCD_Draw_Char(uint8_t Line, uint8_t Column, unsigned char Char) // Bypass shadow display characters matrix to directly draw one character.
{
Task_S_T Task;
uint8_t Index;
LCD_Write_Command_SetPage(Line); // Set the virtual line index.
LCD_Write_Command_SetColumn(Column); // Set the column index.
Task.Command = TASK_WRITING;
Task.Iter = 0;
for( Index = 0; Index < 13; Index++ )
{
if( (Column + Index > DISPLAY_LAST_COLUMN)
|| (Line > DISPLAY_LAST_LINE ) )
{
return; /* Ran out of space :( */
};
Task.Data = Combination_Of(ACTION_WRITE_DATA_TO_RAM, Font_13x16[Char - BIG_FONT_FIRST_CHAR_CODE][Index*2]);
LCD_FIFO_Push(Task);
};
Task.Data = Combination_Of(ACTION_WRITE_DATA_TO_RAM, 0x00); /* The separator column of each char is set here to prevent dirty pixels being left unerased. */
LCD_FIFO_Push(Task); /* The separator column of each char is set here to prevent dirty pixels being left unerased. */
LCD_Write_Command_SetPage(Line+1); // Set the virtual line index.
LCD_Write_Command_SetColumn(Column); // Set the column index.
Task.Command = TASK_WRITING;
Task.Iter = 0;
for( Index = 0; Index < 13; Index++ )
{
if( (Column + Index > DISPLAY_LAST_COLUMN)
|| (Line > DISPLAY_LAST_LINE ) )
{
return; /* Ran out of space :( */
};
Task.Data = Combination_Of(ACTION_WRITE_DATA_TO_RAM, Font_13x16[Char - BIG_FONT_FIRST_CHAR_CODE][Index*2+1]);
LCD_FIFO_Push(Task);
};
Task.Data = Combination_Of(ACTION_WRITE_DATA_TO_RAM, 0x00); /* The separator column of each char is set here to prevent dirty pixels being left unerased. */
LCD_FIFO_Push(Task); /* The separator column of each char is set here to prevent dirty pixels being left unerased. */
return;
} |
H: Current limitation of a power supply by using transistors
DALI standard limits the maximum current as 250mA. I have a 12V source that is capable of supplying more current. I implemented from one of Motorola reference design the below schematics that limits the 12V source to 250mA.
DALI has 2 wires which are short circuited. so TX and RX can be thought as a loop. when 250mA is driven by R13 (2.7), it turns on Q3 which switches off the Q2 transistor, so that the power supply. It usually works fine but I experience that Q3 transistor burns. When Q3 burns it makes the all circuit to be useless. It happens rarely but it is till not a reliable solution. As it happens rarely I don't know how I can debug it. I assume a spike may cause the problem.
How can I improve the circuit so that Q3 would not burn and it would still limits the current supply to 250mA? Or would there be a better solution instead of the below circuit?
AI: If you short the output terminals then Q3 will be dissipating 250mA * 11.3V = 2.8W.
BSR14 is an SOT-23 transistor with an \$R_{\theta JA}\$ of 357°C/W (typical layout) so the junction would head for >1000°C, without pausing at the absolute maximum temperature of 150°C. That would tend to be terminal.
If you replace Q3 with a much larger transistor (with some kind of a heatsink) then it should survive an output short of substantial (or indefinite) duration, depending on the heatsink.
Note however that that if the output can be shorted to your circuit ground, then it bypasses the current sensing and the output current will not be limited at all except by the gain of Q3 and the power supply.
If you could put the current-limit transistor directly in series it would avoid that potential problem. For example:
simulate this circuit – Schematic created using CircuitLab
You still need a BFT (big fat transistor) for the output driver. |
H: How do we predict if power loss will increase or decrease in a DC circuit?
I want to know whether it is possible to predict if power loss will increase or decrease in a circuit with a fixed EMF, a fixed resistor in series and a variable resistor in series.
If we change the variable resistor's resistance, how do we know if power loss over the variable resistor will increase or decrease? This is presuming we already know the values for EMF, the resistance of the fixed resistor and the original power loss before changing the resistance.
For example, if we double resistance, what happens to the power loss of the in the variable resistor?
Furthermore, we can assume no internal resistance.
I think its something related to the maximum power loss when load resistance equals internal resistance rule.
AI: If you look at this problem qualitatively, if the variable load resistance is either infinite or zero there is no power dissipation in the variable resistor load. So if we had an expression for the power dissipation in the variable load as a function of variable load resistance it would have a maxima at the series R0 resistance (we could guess, since that's like source resistance) and would decrease on either side.
simulate this circuit – Schematic created using CircuitLab
We can derive this expression- current is V/(R0 +R), and power dissipation in the variable load R is \$I^2 R\$, so load dissipation is \$V^2 R\over {(R0 + R)^2 }\$
Plot some typical values to get an idea: (V =5V, R0 = 5\$\Omega\$)
If you differentiate that expression wrt R to find the maxima you get
\$-V^2 (R - R0)\over {(R + R0)^3}\$ , which is 0 at R = R0, as expected.
The curve is not monotonic- it decreases on either side of the series resistor value. |
H: 8080 assembly comparing which of the numbers is greater etc
In my 8080 assembly project I need to check if user entered digits and if so do some stuff on it, otherwise display some error and close app.
Normally i would do it like that
CPI '0';if below '0'
JS ERR
CPI 58D;if over '9'
JNS ERR
but there's no JN and JNS in 8080 instructions, So how can I accomplish this?
AI: CPI compares an immediate value with the accumulator, by internally using a subtract operation:
In particular, the zero bit is set if the quantities are equal, and reset if they are unequal.
Since a subtract operation is performed, the Carry bit will be set if there is no carry out of bit 7, indicating the immediate data is greater than the contents of the accumulator, and reset otherwise.
(Some notes on usage here: I am using I for the Immediate value, and A for the Accumulator).
First comparison: (A < 0) -> ERR
So you are looking for the carry bit to be 1 (I > A) for the first ERR branch. That can be achieved with JC (Jump if Carry).
Second comparison: (A > 9) -> ERR
The second CPI wants to see if I < A, which using the same method as above makes things a little tricky. You need to know that the Carry bit is not set (I <= A) and the Zero bit is not set, which gets a little tricky.
JNC performs a Jump if Not Carry, and JZ performs a Jump if Zero. So you want to combine those.
Firstly you know that the Zero bit must not be set under any circumstances. That bit being set would indicate the two values are the same, which is valid. So you can first check that bit to rule it out. Z being set means its a valid entry ('9') regardless of the state of the carry:
JZ GOOD
And then if the Carry bit is not set you can do a JNC to your error routine:
JNC ERR
And finally give it somewhere for the GOOD label t jump to:
GOOD:
So to wrap it all up:
CPI '0' ; Compare with '0'
JC ERR ; Jump to ERR if Acc < '0'
CPI '9' ; Compare with '9'
JZ GOOD ; Jump to GOOD if Acc == '9'
JNC ERR ; Jump to ERR if Acc > '9'
GOOD: NOP ; This is where we end up if it's all valid.
So remember, when doing a CPI you can test for the three things - exactly equal to (Z = 1), Less than (C = 1), and Greater Than or Equal To (C = 0).
If you want to lose some readability, but save a byte or two of program space, you can instead of comparing your upper bound with '9', compare it with '9'+1, which is ':'. That way you're only really interested in the "less than" portion of the CPI, and all others go to ERR:
CPI '0' ; Compare with '0'
JC ERR ; Jump to ERR if Acc < '0'
CPI ':' ; Compare with '9'+1 = ':'
JNC ERR ; Jump to ERR if Acc >= ':' |
H: Dual-supply op-amp LDO does not work, but single-supply does
I'm designing an LDO with dual outputs (Vout and -Vout), and only the positive output is shown in the pictures below. I'm having large trouble using dual supply op-amps in the design, and my single-supply one works fine and is shown in the first image.
But my LDO using a dual-supply op-amp does not work at all in the same configuration, and I've tried a few different dual-rail op-amps. Am I missing something in the dual-supply design?
The design with a dual-supply op-amp just saturates to the positive rail.
The problem was that the dual supply could not get close enough to the rail.
AI: Dual supply opamps are not known for their ability to operate near the rails. So, most likely is that the opamp can't get close enough to the \$V_{\text{dd}}\$ to control the FET. FDS4465 has a \$V_{\text{th}}\$ of -0.2V to -1.8V and the LT1007 for example can only get to about -1.5V of \$V_{\text{dd}}\$. If the FET you have has a nominal or less \$V_{\text{th}}\$, then try as it might, the opamp will not be able to reach a high enough output voltage to modulate FET conductance or turn FET off. A high \$V_{\text{th}}\$ FET, and/or a drive circuit that can reach \$V_{\text{dd}}\$ should be used. |
H: How to make an octant display?
I am trying to construct a display that is shaped like an eighth piece of a sphere.
The resulting device shall be self-sufficient and possibly portable, meaning projection onto matte octant won't do it. The screen should be capable of displaying photorealistic images at a high frame rate, so POV display won't suffice as well.
Primarily, I see two options here:
to curve light output from a regular “planar” display with a lens or anyhow else,
or to give needed curvature to the display matrix itself.
Having thought over the first approach, I foresee two main concerns to deal with. The first one is that homogenous pixel density will become heterogenous when light is bent in non-isomorphic manner (see figure).
That is, to make a plane into a sphere, we need to stretch periphery more than centre, therefore pixel density will be affected likewise so we get fewer pixels to corners. This could be partially mitigated through software, but the problem still remains.
The second problem is the lens itself. I am not confident enough on the right branch of optics or optical engineering to be able to determine which type of optical device and of what metrics should be used here.
The second mentioned approach with already curved matrix seems less complicating, although I do not know how to produce such displays, or how to order them; and I am not sure about image quality of such displays, should they exist.
Thank you for your interest. Any suggestion would be much appreciated.
AI: I think that given the constraints on size and resolution, interior projection using some form of Pico projector will probably be your best approach. The DLP-based units from TI are particularly nice.
You'll probably need to find a way to fold the optical path using one or two mirrors in order to make it self-contained, while still covering the entire octant. |
H: Can this be anything other than a resistor?
I have been messing with an old valve amp and have replaced the filter caps and a couple of resistors that were a little out of tolerance. The component in the picture does not look the same as any of the others and, if it is a resistor, seems to be out of tolerance by a couple of orders of magnitude (my reading is 1.2M, whereas the colour bands seem to indicate 95R). The others were only a few percent out. I just wanted to check it really was a resistor before replacing it...
Thanks!
AI: It's a 1 M ohm carbon composition resistor. Different manufacturers used different ways of showing the value and the Brown of the body indicates a 1 in this example I believe. The black at the end then indicates a 0. This is then followed by 5 zeros due to the green band.
If I remember correctly silver indicates tolerance but I'm unsure about this - I think it's either 5 or 10%. |
H: Physical Layer: How do how frequency sources work?
This is likely basic: but how do the source that rapidly generate 0-1s thru a channel "work" so fast? If it is a electric signal that is the source [as it is I believe even for fiber optic where a source converts electric signals to light pulses to be transmitted along the fiber]: how are these high frequency signals generated?
I am thinking that there must be some "moving part"/mechanical part that "vibrates" so fast: but can we really have mechanical parts vibrating that fast? Or is there a frequency amplification from the mechanical to electrical that happens?
AI: What kind of frequencies are you talking about? You can use crystals up to something like 50 MHz after which they become tricky to use.
Higher frequencies are often generated by VCO (Voltage Controlled Oscillator) circuits, which can generate frequencies of several gigahertz, but are themselves not very accurate. They are made accurate by a technique called Phase Locked Looping (PLL), where a digital divider circuit is used to divide the high frequency by some integer factor, for example 64, 128 or 100. Then the divided frequency is compared to a frequency of a crystal and the control voltage of the VCO is adjusted accordingly to make it stay at the desired frequency. |
H: I2C dummy write
If you want to read from the I2C bus you have to:
Send start condition
Send 7 bit slave address with R/W being a '0' which indicates a write
Send register number where you want to read from
Send start condition again
Send 7 bit slave address with R/W being a '1' which indicates a read
Slave sends data to master and master will send an ACK after each byte
When done, the master sends a stop condition
Why isn't it done like this:
Send start condition
Send 7 bit slave address with R/W being a '1' which indicates a read
Send register number where you want to read from
Slave sends data to master and master will send an ACK after each byte
When done, the master sends a stop condition
Wouldn't this be more efficient?
AI: Michael gave you the formal response, which is how I2C is defined. The practical problem with your approach is that you fix the register address at 8 bytes. What if a slave
has only a single register? Sending 8 address bits would be a waste of time, and a waste of circuitry in the slave.
has more than 255 registers?
If you address these issues, you end with a protocol that depends on the type of slave. That would complicate matters considerably. |
H: What limits the maximum allowable current of a power LED?
I wonder what it is that limits how much current can flow through a power LED. If the heat removal is managed properly how large can the current get? Why 45x45 mil size LED chips are rated 3W (700mA) but smaller ones 350mA?
I've got an LED module, it has 9 45x45mil LED chips (It is RGB), I want the maximum light intensity possible, what is the maximum safe current? I don't care if the life is shortened to half or one third compared to if it were drived at 350ma (the manufacturer rated current).
AI: One of the things that determines the LED lifetime is the junction temperature (the temperature of the LED die inside the package). Then it's a matter of how fast you can remove heat from that, given the thermal resistance between the junction and the pad where the heatsink attaches (upon which you have no control, and which may be lower for larger LEDs).
Some manufacturers have published data on temperature and current vs. lifetime which shows that indeed if you accept some reduction in lifetime and have proper heatsinking you can drive their LEDs at 2x the rated current.
See for instance the OSRAM Dragon reliability information. Note how the lifetime drops smoothly from 100,000 to 20,000 hours with increasing current/temperature and then suddenly to 0 hours when you exceed the maximal temperature (fig. 5). Note also how this depends on the LED color (fig. 5 vs fig.7), with blue/green/white LEDs much more fragile than yellow/red LEDs. |
H: Breadboard computer
Is it possible to make a simple computer entirely with breadboards and basic electronic components? Is it feasible to, for example construct a scientific calculator in this way?
AI: I'm going to disagree that placing a microcontroller on a breadboard qualifies as building a computer on a breadboard. Except for I/O (such as a keyboard and display), a microcontroller by itself is pretty much a complete computer. Just placing it on a breadboard and connecting up a few wires is trivial and can be done in ten minutes.
When the OP asked, "Is it possible to make a simple computer entirely with breadboards and basic electronic components?", by basic electronic components I think it means something more like this:
Now that's a computer on a breadboard (well, several breadboards), built from basic components. The description of it is here. It's made up of a dozen types of 74LS00 series IC's. (I don''t think we want to go all the way back to transistors; the original PDP-8 was the size of a small refrigerator).
As far as a scientific calculator goes, if you built a general-purpose computer like the one shown above, then it could be programmed as a scientific calculator. Constructing a scientific calculator using only logic IC's (no computer) would be extremely difficult; all the manufactures of calculators like that (Ti, HP etc.) used special large scale IC's. Here's a home-built calculator that uses am early 4-bit calculator IC.
I will agree that if one wants to get a computer up and running as quickly as possible, then using a microcontroller is the way to go. If one wants to really understand how a computer works internally, then building one out of basic ICs is the right path. |
H: Question about Circuit Analysis
This is my first question of Electrical Engineering SE.
I have the following circuit.
I want to calculate it's transfer function, considering ideal Op amps and circuit elements. I have almost completed the analysis of the circuit. Vb = -Vinput because of R0 = Ro and i know that the second Op Amp U4 acts as a mixer, it will add two signals accordingly (based on superposition theorem). I want to ask one thing that is not clear to me. What is the voltage entering the inverting input of the second Op Amp? Not in numbers, in terms relative to the other voltages we know that are present in the circuit such as Vinput. What is not clear to me is that the capacitor (non polarized) C2 lies between Vin and Va(ground) and therefore it creates a voltage drop (or does it?). Also Va should be zero because of virtual ground of Op Amp U4. Therefore does that mean that the second signal on the inverting input of U4 is Vinput? (never mind the first signal, that one is coming from the first op amp and it's -Vinput*(other stuff)) I'm confused with this. If someone could help me out i would be very grateful. Don't consider values of capacitors or R2, R1. I want to understand the logic behind this particular thing. Thanks in advance!
AI: Start by analyzing the steady state. That means all capacitors are open circuits. The first opamp then just inverts Vinput with respect to ground. The second then inverts it again, but with a gain of 1/2. Therefore Voutput = Vinput / 2.
Since both opamps are ideal and have feedback so that they operate in their linear region, the negative inputs of both will be held at 0 V.
Analyzing the dynamic behavior is more tricky, but you already know what the steady state will be after everything settles. C2 feeds current proportional to the derivative of Vinput into the node at the negative input of the second amp. This will add to the steady state signal. Voutput will therefore have a component that is proportional to -dVinput/dt.
C1 and R2 form a high pass filter, which in the feedback path results in a the second stage being a low pass filter. Whatever the Voutput would have otherwise been, it will be low pass filtered by a single pole at 1/2πR2C1. When R is in Ohms and C in Farads, then this expression is in Hz. |
H: Darlington with 3.3V
I've been using TIP120 darlington transistors to drive various motors, I apply a 5V Base-Emitter voltage, that I sometimes modulate with PWM and a resistor on the base, this works great, but is there a same type of transistor for 3.3V?
More generally, what is the best way to look for transistors?
AI: The TIP120 will work at 3.3V as well. You do not apply a voltage to a bipolar transistors base, but you apply a current to the base. The resistor between your micro controller and the TIP120 will convert the voltage to a current. You might need to reduce the resistance your base resistor a bit at 3.3V.
Using a Darlington transistor can be effective for loads with a high voltage that are switched often, but are only switch on for a short time. If you switch a low voltage load, e.g.: a single LED, a motor running at 3.3 V volts, then bipolar transistors and especially darlingtons will be very ineffective. MOSFET can often be just as easy (or even simpler) to use and losses at the transistor will be smaller. Between collector and emitter of a Darlington transistor you will always lose around 1.2 V, no matter how much current you are switching. This is especially problematic if you are operating at high currents and low voltages.
See for example these tutorials on how to use nFETs as a switch:
http://www.hobbytronics.co.uk/arduino-tutorial9-power
http://bildr.org/2012/03/rfp30n06le-arduino/ |
H: Can I combine 3x 1000ma power supplies (wall warts) to get a 3amp supply [answer: no]
I have a device that requires 3A, 9V. I also have three 1A power supplies (wall warts).
Can I cut the wires of these power supplies, reconnect them all together in parallel, and use them all as a single 3amp 9v power supply?
AI: Chances are that they will have slightly different output voltages, and the one with the highest voltage will be supplying most of the load and will be overloaded.
Just buy a suitable 3A supply. |
H: Volume control with DS1807 digital potentiometer?
I'm making a digital synth for a project and I need to wire in an Arduino-controlled volume circuit.
Right now I'm outputting a 0-5V audio signal and cutting it down to a pure AC 0.5V signal with a voltage divider (1kohms and 10ohms) and a capacitor. I would like to tack on a digital potentiometer to this circuit to control the audio volume so I bought a DS1807.
The datasheet is here but I'm still not totally sure how to use this -- it refers to the resistor settings in db rather than ohms, but it feels like I should be putting in a second resistor to form a voltage divider with it. What should that resistor value be? I don't see a reference to what the actual resistance of the DS1807 varies between. Or am I thinking about this circuit completely wrong?
(p.s., the speaker we'll use is a powered computer speaker)
Here's the circuit I was thinking of-- is that correct and how do I choose R3?
Thanks!
simulate this circuit – Schematic created using CircuitLab
AI: You dont need additional resistor. Just wire audio signals to digital pot pins H0-L0 or H1-L1. W0 or W1 will give you divided signal.
Pot values are indicated in datasheet page 10.
Also be carefull not to avoid recomended limits again indicated on page 10. |
H: KiCad: Power with hierarchical sheets
I just started trying to use KiCad (complete newbie), and I have a very basic question about using power inputs with hierarchical sheets.
Let's say I want a single LED on a hierarchical sheet, while my main sheet simply contains a battery.
Should I use hierarchical labels to connect power from the main sheet to my hierarchical sheet, or is there another way?
For instance, the main sheet:
And the hierarchical sheet:
Is this the correct solution? I initially tried to used the +9v and GND elements in my hierarchical sheets (many of them in a single sheet), but KiCad complains that some of them are not driven.
I found lots of topics discussing this, but nothing I can really understand, nor related to hierarchical sheets.
If I need to use hierarchical labels for connecting power, then when should I use +9v and GND?
AI: The solution that you have on your pictures will work fine. I have checked the Battery element in the library editor and it has both pins as a passive pins, so ERC wont complain.
If you want to use +9 V and GND elements from Power library, then you also need to add a power flag. In the reference they say:
It is common to have an error or a warning on power pins, even though all seems normal. [...] This happens because, in most designs, the power is provided by connectors that are not power sources (like regulator output, which is declared as Power out).
The ERC thus won’t detect any Power out pin to control this wire and will declare them not driven by a power source.
To avoid this warning you have to place a "PWR_FLAG" on such a power port.
So, using the power flags, you can make following configuration:
Regarding the hierarchical sheets, take a look at this video to learn more (browse the channel, there are lots of very useful videos for KiCad). |
H: What will be this CMOS logic circuit's Truth Table?
I encountered with this MOSFET logic circuit and asked to find which logic gate it represent.
simulate this circuit – Schematic created using CircuitLab
As far as I understand , When \$V_{x1}\$ is high then COMS with input \$V_{x2}\$ became active and transmission gate became OFF . So we get output \$V_{x2}'\$
But when \$V_{x1}\$ is low , then CMOS inverter is deactivated. Transmission gate's PMOS and NMOS have LOW and HIGH as input. But it confusing me that sources of PMOS and NMOS of the transmission gate are both connected with input \$V_{x2}\$ . How that will affect output \$V_f\$ ?
How can I calculate it's logic output value \$ V_f \$ ?
forgive me if this is a very silly question, I'm new at this.
AI: The two leftmost transistors forms a simple not gate, but it is powered only when \$V_{x1}\$ is high. Luckily enough the passgate on the right is turned on when \$V_{x1}\$ is low instead, and directly connects the \$V_{x2}\$ input to the output.
To sum it up:
if \$V_{x1}\$ is high the output is NOT \$V_{x2}\$
if \$V_{x1}\$ is low the output is \$V_{x2}\$
in a table:
x1 x2 out
0 0 0
0 1 1
1 0 1
1 1 0
that's a xor gate. |
H: Hall effect sensor operational distance from magnet
I want to use a this hall effect sensor to detect the presence of magnet. I'm pretty sure I understand how to use the hall effect sensor, but I'm not sure how to calculate the distance the sensor can detect a magnet of a given Gauss. I'm not even sure that the Gauss rating is relevant to the question.
The Output On rating is listed as 35G and the Output Off is listed as 25G. If I use a magnet like this one (13,200 Gauss), can it be detected up to 6 inches (15 cm) away?
I found an online calculator to use but it appears to calculate the rating between two magnets and not a magnet and a sensor.
AI: That depends a bit on how the magnet is oriented with respect to the sensor.
I would approach this question by first making the approximation that your magnet is a point dipole. Even though it is a cube, this approximation will be reasonable when you are an inch or so from the cube.
Therefore, you can use this equation for flux density at a given point. You will need to figure out the magnetic moment based on the specifications from the magnet manufacturer.
Then, determine the critical distance which results in a field of 35 Gauss. |
H: Suppressing contactor coil inrush, is this possible?
http://www.kvc.com.my/EnterpriseChannel/SharedResources/Datasheet/0/?ProductId=1000066755&Filename=SCHNEIDER-LX4-FH024.pdf
I am trying to operate a 24VDC coil with an inrush of approximately 30A, and a holding current of only 250mA. To avoid needing a 750W supply for a holding current of less than an amp, I attempted to use a 4 ohm thermistor to suppress the inrush current down to about 5A and allow me to use a much smaller 250W supply.
Unfortunately I'm thinking this might've been flawed logic. I was thinking the trick was to simply suppress the inrush current, but now I'm thinking maybe that inrush current is critical to closing the contactor. I tried testing the circuit as designed, but the contactor is not closing. The thermistor worked in the sense that my 10A breaker is not tripping, but I can not operate the coil. My assumption is it is not getting enough initial power to close.
My question is, are coil inrush currents something that can be suppressed? If so, I'm assuming there is a more correct way to do so as my idea does not seem to be functional.
AI: You don't want to suppress the inrush, but rather, find a different way to supply the inrush current — it is required for the contactor to operate properly. It needs about 30 A for up to 50 ms, or about 1.5 C.
If you are willing to allow your supply to sag by, say, 6 V, then you need about 1.5C/6V = 250mF of capacitance to supply the short-term current.
You can use a low-value resistor, thermistor, or inductor between the power supply and the capacitor in order to isolate the power supply from the surge. |
H: Opamp AB Class Current Buffer
I am trying to design 100W (100V - 1A) Opamp Current Buffer with unity voltage gain. I will use PA441 or LT6090 opamp.
Apex published a circuit for this amplifier. Please look at page 3 from the link below
https://apexanalog-public.sharepoint.com/Resources/AN52U.pdf
Shared circuit is for inverting amplifier configuration. I need non-inverting configuration. When I tried the circuit in LTSpice, for negative side, it seems works well. But for positive side there is a problem witn nmos i could not handle.
How could I amplify 0 to 100V 100mA output to 0 to 100V 1A with non-inverting configuration?
I would be very glad if anybody could help. Thanks.
AI: At a guess, your PA341 is bad. Try disconnecting the buffer, and just close the loop with about a 10k load resistor.
EDIT - Since the PA341 is good, a closer look establishes your problem. The app note clearly requires a depletion-node FET, and you are using an enhancement-mode part. They do not work the same. |
H: Using a high resistance pull down resistor
I'm trying to make a circuit where closing a switch will change a GPIO from low to high, and I want to minimize current as much as possible to increase battery life. The chip I will be using is Nordic Semiconductors nRF51422 (https://www.nordicsemi.com/eng/Products/ANT/nRF51422).
My understanding of pull up and pull down resistors is that they limit current, protecting the chip and decreasing power usage, while still keeping the GPIO either pulled up or pulled down. Having too large of a pull up/down resistor increases the time constant of the circuit making transitions from high to low slower and 'pushes' the GPIO out of the range where it is recognized high or low.
The exact set up I was envisioning was this. I use a very large pull down resistor (on the order of mega Ohms). The voltage drop across this resistor will be so large that it will essentially behave as a pull up resistor with the added benefit of exceptionally small power usage. I then have a switch that when closed connects the GPIO to ground across the recommended size resistor (13 kOhms). The circuit diagram would then resemble a GPIO connected to ground across two parallel resistors, one very large and one much smaller, which will behave like a single smaller resistor Thus, when the switch is closed the digital value of the GPIO changes from high to low, and when open there is only a small trickle of current which saves battery life immensely.
Would that work? In particular, does my idea with the large resistor even make sense?
EDIT:
I'm gonna rephrase my question and add a schematic.
So my understanding is that GPIO's have high input impedance hence a very small leakage current when connected to ground. If I were to connect a resistor that had a impedance of, say, 10 times the input impedance of the GPIO between the pin of the GPIO and ground would the GPIO pin be at 0.9*VDD? I'm assuming the input impedance of the GPIO is independent of what is connected to it.
I've made a schematic that illustrates what I'm thinking by simplifying the GPIO as a black box resistor. Schematic
Would this work? Is my schematic just straight up wrong?
AI: Thus, when the switch is closed the digital value of the GPIO changes from high to low, and when open there is only a small trickle of current which saves battery life immensely.
You have the wrong idea. A pull up should not result in much current aside from the leak current of the gpio
simulate this circuit – Schematic created using CircuitLab
In the first picture, a pull up pulls the GPIO IN high. The only current is the leakage current required to measure the voltage input level. This is a few nA, a fraction of a milliamp. This can most often be checked as Input Logic High/Low (ILH, ILL) in a datasheet but I can't find it in your product. Assume 10nA or less on average.
It's only in the second picture that a significant current can be drawn. When the button is pressed, there is a straight path from V+ to Gnd, through R2. Assuming 3.3V, that's 3.3V / 47000Ω = 0.00007A It's 70000 nA. Which looks large in comparison, but that's still only 0.07mA or 70µA.
The significant current draw is only when the button is pressed. So simply design your circuit so the default state of the button is where the button is open. |
H: Powering a ESP8266 and an auxiliar device using a single power source
I am trying to connect two components to the same 12V/1000mA DC power source. The devices are 300mA/9V (D1, auxiliar device) and 500mA/3.3V (D2, ESP8266) respectively. See the diagram below:
Given that R1/D2 and R2/D2 are connected in parallel I can simplify the resistance in the circuit using the following expression:
$$\frac{1}{R}=\frac{1}{R1+30} + \frac{1}{R2+6.6}$$
And the final expression using the formula R=V/I=12V/1000mA is:
$$\frac{(R1+30)(R2+6.6)}{R1+R2+36.6}=\frac{12V}{1A}$$
Is there any way to get proper values of R1 and R2?
Thanks in advance!
AI: If the resistance of D1 and D2 does not change and 12v power supply is stable, you can simply calculate R1 by ignoring R2 and D2:
R1=(V1/I1)-D1
R1=(12/0.3)-30=10 Ohm
You can calculate R2 by ignoring R1 and D1 as well.
BUT, actually the resistance of the load (ESP8266) will change when it turn on. Connecting the resistor to 12v supply will risk damaging the devices. Use voltage regulator instead. You can use LM2576 regulator adjusted to 9V and 3.3v. |
H: Generic parts library for Altium Designer 15?
I am just started using the Altium Designer 15 on 30 trial.
I realize the library is empty by default. And as a trial user it seems I don't get access to the Altium Vault (cloud based part library?).
I don't need anything specific, just the usual 0805 SMD resistors, caps, op-amps, some headers.
Is there a generic part library that I can use?
They have a page for old, frozen library for Altium 10. Not sure this is a good start, as it's old!
AI: Altium should install a minimum set of items into the following location: C:\Users\Public\Documents\Altium\AD15.1B\Library
(replace AD15.1B with your version)
Do you get access to the forums with the trial version (forums.live.altium.com)? |
H: Interesting property of Op-Amp. It Inverts Transfer Function of the system in it's feedback
This is a theoretical question. I saw this circuit somewhere:
System (a) has transfer function: \$H(s)= V_{out}(s) / V_{in}(s)\$
And it stated that when system (a) is put into system (b) in the exact way that is shown, then circuit (b) has transfer function: \$ H_{o}(s) = 1 / H(s) = V_{in}(s) / V_{out}(s) \$
I tried to prove that but unfortunately i can't figure it out. I want to rigorously prove that this is true. Can someone help me? Thanks in advance!
EDIT
I found the answer. It's trivial but i guess i'll post it here.
In circuit \$(β)\$ the voltage of the inverting input of the ideal opamp is the same as in the non inverting input, because of virtual ground, therefore it's \$V_-(s)=V_+(s)=V_{in}(s)\$. But the voltage on the inverting input also equals to \$H(s)V_{out}(s)\$ (the transfer function of system \$(α)\$ times whatever it has in it's input, which in system \$(β)\$ that is \$V_{out}(s)\$. The two previous equations give us that\$:H_{o}(s)=\$ voltage on it's output/voltage on it's input =\$V_{out}(s)/(H(s)V_{out}(s))=1/H(s) \$ which is what i wanted to prove.
AI: The classical feedback formula (H. Black) is
Ho=Ao/(1+AoH)=1/(1/Ao+H) with Ao=open-loop gain and H=feedback function.
Of course, for Ao approaching infinity we have Ho=1/H.
Example:
If the feedback path consists of a resistive voltage divider R1/(R1+R2) we get the classical closed-loop gain expression for a non-inverting opamp stage Acl=1+R2/R1. |
H: MOSFET Gate-Source protection question
I have seen different schemes in the three phase motor inverter design when people try to protect gate-source from high voltage as shown in the picture.
I understand the usage of zener diode to limit Vgs, and the usage of R to prevent unwanted switch-on when gate is floating (Am I correct in the understanding?). Here are my questions.
why are zener and R used together as the 3rd picture shows? Are
those different config related with inverter power ratings?
what's the difference between using zener diode and TVS diode as in 4th picture?
How to choose zener diode in term of breakdown voltage Vc? Vc higher
than Vth but lower than Vgsmax?
Edited
One more question, is it common to use zener and R in parallel between gate and source to both limit Vgs and avoid unwanted switch-on?
AI: Your interpretation for the reason why Z-diodes or resistors are used is corrent, in my opinion.
When the driver leaves the MOSFET's gate floating, you want at least something to give you a defined voltage, and a single resistor is an often-used solution. You choose the resistor's value as a trade off between a "good" low with a floating driver output (i.e. a small value for the resistor) and low losses while the driver has a high signal while turning on the MOSFET (i.e. a large value for the resistor).
A series combination of a diode and a resistor is just another trade-off, and one I have hardly ever seen. It prevents excessive currents should the diode ever start to conduct, while it "just somewhat" limits the gate-to-sorce voltage in such events. Also, a resistor is always a dampening component in any circuit prone to oscillations; it may have been designed in to prevent ringing once the diode conducts, but I'm really just guessing here and have never used such a snubber myself; usually, you want the snubber in the drain-to-source path, because this is where oscillations are usually caused. Putting it in the gate path will likely only limit effects that originated somwhere around the drain.
A (bidirectionial, like in your picture) TVS is just two zeners. Some diodes marketed as TVS have higher peak power handling capabilities or are designed for really fast breakdown. The anti-serial-connection of two diodes goes along with the specification of VGS, max = ± (some voltage). In words: Negative gate voltages are OK for the MOSFET, and sometimes, a gate driver will provide a negative voltage to turn off the MOSFET, either for a "better" off-state, or because VGS, th is quite low, or because your FET is a normally-on type (although that's not mainstream for the application of motor drives).
Yes, that's basically it. Just for completeness, one should as well add the obvious VZ > Vdriver, ON, because otherwise, the driver will just dissipate power into the protection diode.
(One more answer to one more question ;-) Sure, this sounds like a good idea and I believe I've seen it many times. |
H: Unable to understand Verilog syntax
I found an example Verilog code as following:
module test #(parameter p=1) ();
localparam [1:0] lp = ~(p)'(1'b0);
endmodule
I'm unable to undestand the localparam lp assignment.
Can you please explain the code?
AI: Very strange example, not sure what this example was intended to do. There's only the module declaration and a localparam declaration, nothing else.
Defines a module which is named test, which has no input nor output ports (because the port list is an empty set of parenthesis). However it does take a single parameter named p (this is inside the hash-parenthesis list #(p) part of the module declaration ). The default value of the parameter p is 1 unless otherwise specified.
Inside the definition of the module, there is another parameter declared, which is named lp, which is defined as the constant expression ~(p)'(1'b0).
The unary ~ is the bitwise negation operator, and the literal integer expression (p)'(1'b0) is a constant that is "p" number of bits wide, and all of the bits are 0. So ~(p)'(1'b0) is all bits 1. Note in verilog, we always care exactly about the bit width of every constant, wire, and net; literal constants use that infix apostrophe ' to indicate the bit width.
This is a very strange example, because with no ports and nothing making any use of the parameters, there's nothing for a simulator or an HDL compiler to do.
Usually verilog modules have input and output ports, with the exception of a test bench that is used to simulate and test other modules. But that's not the case here, because this module doesn't instantiate any other modules -- it literally does nothing. |
H: Board structure relative to ground plane
I'm sorry if this question has already been asked, but I did not reach a full understanding of this subject area.I have read several guides for PCB layout, including the articles on this site. And now I want to consult with you to make sure that everyone understood correctly.
I plan to design pcb that will have onboard set of components. I'm worried about the performance of the pcb, since the board based on STM32 microcontroller will communicate with digital IMU ( MPU-9250 6 dof accelerometer + gyroscope ), drive BLDC using MOSFETs and measure set of ADC signals ( back-emf ) as feedback from BLDC.
Based on this explanation: http://sa.nxp-lpc.com/docs/an10897.pdf
Here is picture:
I plan to use 3 ground plane with ground plane bridges to pass signals:
Digital GND above which I will place Microcontroller and IMU IC which will communicate using I2C protocol.
Power GND above which I will place voltage regulator and set of MOSFET to drive 3-phase BLDC. That MOSFETs will be driven by MCU's PWM signals.
Analog GND that will receive back EMF from BLDC and pass them to MCU's voltage comparators.
1) Does this structure is correct? Or it is completely wrong?
STM32 has onboard ADC and voltage comparator.
2) If I have to use them did I should consider MCU as a mixed signals IC? And accordingly place a MCU between digital and analog ground as here:
AI: It's a very wide ranging question and I am going to answer only one part.
Because an ADC has to contain analogue and digital sections it needs to sit across the boundary between analogue and digital ground planes. This is a generalism and there will likely be exceptions to this rule. |
H: choosing the right Opto isolator?
In the process of developing an RDM Compatible DMX receiver board (using a ATMEGA328) and I have been fortunate enough to come across kimliv's most informative answer concerning such a board;
DMX on Arduino with RS485
However I was wondering why (if) it is necessary to use a TTL Compatible isolator? In this case the 6N317 or if perhaps a more traditional repeater isolator style circuit could be implemented using a more common and cheaper isolator for example the H11A1 (which I just so happen to have in stock).
This all said it seems several DMX circuits I have come across utilise the 6N317 but so far as I am aware the transceiver (MAX481) could be used to drive other isolators.
Is there something obvious I am missing here? or anything in particular that makes the 6N317 quite so desirable for its use here?
thank you.
AI: Is there something obvious I am missing here? or anything in
particular that makes the 6N317 quite so desirable for its use here?
According to the data sheet for the 6N137 it can handle data rates up to 10Mbps: -
I took a quick look at the H11A1 and it has rise times and fall times of about 3 us. That informs me that it may be good for data rates of about 100kbps.
That's a big reason in my book for using the 6N137 |
H: How does sin cos encoder work?
Sin cos encoders are used in motors to determine position and direction of motor. However I am unable to understand its exact working.
AI: It is similar to quadrature encoder with A and B signal that are shifted 90 degress, except that sic/cos outputs a sine and cosine waveform of signal. The electronic part is then splitted in two main circuits:
1. A comparator with hysetersis converts sin and cos signal to quadrature signal and then you have a counter that counts up/downn like those with quadrature encoder.
2. The position in between two quadrature pulses can be determined by calulation of sin and cos signal: tan(phi) = sin(phi)/cos(phi) , therefore phi = atan(sin_signal / cos_signal).
You get a better resolution in between quadrature pulses, very useful when it running at low speed, since the velocity is determined by diferentiating the encoder position. You may soon understand that if signal has low frequency, then you won't get any good value for the speed calculation. That's why sin/cos are better performance. |
H: Diode question help here please
We have the circuit in the figure.I have to find the currents in the diodes and in the resistances R1 and R2.
The diodes are real and Vd=0.7 V
Awesome.
Here is the original figure
I have drawn the circuit and I have replaced the diodes with the voltages
I apply the KVL in the first loop and I have -20+ 0.7+0.7 - I2R2=0 so I2 here is negative...what am I doing wrong?
AI: Assuming all the diodes take 0.7V.
VR1 is parallel over D2 = 0.7V
VR2 = 20V- 2* 0.7V = 18.6V
With these values known you can calculate the currents |
H: Need help designing headphone amplifier circuit
I have to design a headphone amplifier circuit. We are told the impedance of the headphones and the minimum voltage they require and also the voltage source. After researching I have found that the LM386 is a popular choice. I've seen many circuit diagrams but what I don't understand is how to pick the voltage gain needed for the amplifier.
I originally thought that you would need to know the input audio signal voltage and when you multiplied that by the gain that would need to give the minimum voltage required by the headphones, but it appears that what matters is the current which I don't get.
And are you able to design such a circuit without knowing about the audio input signal? If you do need to know about it what is it you need to know about it and why?
I would greatly appreciate any help as I am very lost. Thanks
AI: Voltage in x gain = voltage out. The current that flows in the headphones is V/Z where Z is impedance of headphones. Z is a little frequency dependent.
Input current to amplifier is voltage in/ input impedance. Input impedance is usually 1k to 1Mohm (generalism warning).
Yes, you need to know the input voltage. You need to know the maximum it can attain and the nominal RMS value that would produce (say) a comfortable nominal listening level in the headphones. The headphones will have a SPL (sound pressure level) characteristic that you need to research. Also research what would be a comfortable SPL level. You then begin to know what the voltage level ought to be across each speaker in the headphones.
You might also consider hard-clipping to prevent acoustic shock (should your amplifier be capable of delivering much higher voltages to the head phones). |
H: Old cellphones versus new cellphones noise
Why older cellphones cause impulse sounds in our loudspeakers, but new cellphones not? Why these impulse sounds can be heard in our soundspeakers?
AI: I'll give one answer. Any cellphone will have its transmit power output set by the local mast it is talking to - this is to avoid wasting too much battery power and also to prevent the sidebands of a higher power signal slightly overlapping (this was before GSM i.e. the old analogue days where each phone was allocated a frequency channel rather than a timeslot). Maintaining the power at an adequate level also means that you are not trying to login to several cells at once.
With the development of the cell network cells become smaller thus power outputs from handsets reduce thus interference with the input to an audio amplifier feeding a loudspeaker drops.
So, my single answer is the reduction in size of a cell. I live quite far away from my local cell mast and I still get interference thru my yamaha electric piano.
Your new phone may also be using a higher frequency band and the effectivity of RF/EMI blocking components on analogue inputs becomes better. |
H: Ways to measure current in picoamperes
I need to check the low power consumption of a microcontroller in the range of picoamperes. I only have a multimeter capable of measuring milliamperes and as such it shows 0.
Is there an easy and precise way to measure picoamperes?
AI: Power the micro-controller with a capacitor, charged to a known voltage. Wait an appropriate amount of time, then measure the voltage. Calculate the current from the delta-V and the C. (Don't measure the voltage continuously, unless you have a meter with a high-enough impedance, because that might draw extra current.) You will need a capacitor with known capacitance, but in a pinch you could measure a capcitor in the same way by discharging it through a known resistor.
As the comments point out, other current paths might contribute to the discharge of the capacitor (including self-discharge). You could repeat the measurement with the UC removed and see what value that gives. Then you might think about whether you can realisticly avoid such 'other' currents in your design.
And don't forget your batteries self-discharge and/or ageing!
If you aim is too 'see' the power-down mode of the chip in action you could use the capacitor, build a simple circuit that periodically connects it to the power supply (if possible synchronysed with the uC's activity cycle, must have a realy low leakage current!), and watch the C's voltage on a scope (the scope impedance must be higher than the UC's current consumption, or you might even use AC coupling if the uC"s activity cycle is short enough). This way you can verify both the time-wise division in high and low current consumption, and the currents in both modes. |
H: How to power 3 different AC circuits without crossing them
I have 3 zones in my house with 3 24v thermostats. These thermostats tie into a zone relay that triggers a 120v line to each circulator to heat that area of the house.
I need a way to have my timing circuit supply power to all 3 circulators without having the possibility of one thermostat activating all 3 zones when the timer is not on.
Is there a circuit or setup available to do this?
AI: You could add an additional layer of single pole, dual throw relays (SPDT) between the thermostats and the existing relay panel. These new relays would be wired so that they pass though the signal from the thermostats when the timer is OFF, or pass though 24V when the timer is on.
Note that the output of the timer can be anything (24 VAC, 120VAV, 5V DC...) as long as the relays are matched to it and capable of handing the 24VAC they are passing though. |
H: Whats the overrall power available from two PSUs in series?
Consider this circuit:
PSU 1 is rated at 100w, PSU 2 is rated at 200w.
How do I calculate how much power is available to the load, given the mis-matched power supplies?
AI: The maximum current you can draw is the value of the lowest one.
In this case the 100W supply could provide 8.3A, while the 200W supply could provide twice that at 16.6Amps. If you attempted to extract more than 8.3A the lower capability power supply would collapse (and possibly damage it). So the output is limited by the smaller supply to 8.3A @24V, 200W.
If you put supplies in series it is often desirable to put a diode across each supply so that under overload conditions the output polarity does not reverse. The diode should be able to pass the current of the highest output supply. The diode polarity should be such that under normal conditions it is reverse biased.
A similar arrangement is used with photovoltaic solar arrays to avoid reverse biasing modules if one gets shaded. |
H: Strange frequency of audio output voltage
For a school science experiment, we have stripped an audio cable and hooked the right channel and ground wires up to a voltage graphing device. The audio cable is plugged into the audio output of our computer. The computer is playing a constant sine wave tone at 880Hz, and so we'd expect the voltage graph to have a period of 1/880 seconds. However, the voltage graph is instead showing a very slow sine wave with a period of 12 seconds. When doubling the frequency of the sound we were playing, the period halved to 6 seconds. Why would the computer be outputting a different frequency voltage than we were playing?
AI: The graphing device in the question was a Vernier LabPro with a voltage sensor. Silly me didn't realize the sampling frequency was 20Hz. That means that the sine wave from the computer could complete 44 times in between samples from the sensor. Credits to @Nicolas D for pointing this out. Will leave this question up for anyone else with a similar confusion. |
H: Calculating Transfer Function of passive circuit
I have the following passive circuit:
I want to calculate it's transfer function \$V_{out}(s)/V_{in}(s)\$.
My thoughts are: Part I: The voltage on the capacitor in the center (call it \$V_c(s)\$) is taken by the voltage divider created by the resistor and inductor in series to it's left and that capacitor i.e. \$V_c(s)=V_{in}(s)(1/sC)/((1/sC)(R//sL))\$ (these lines\$\\\$ mean that R and L are in parallel). Part II: Then since we have \$V_c(s)\$ which is of course a function of \$V_{in}(s)\$, we can calculate \$V_{out}(s)\$ from the voltage divider created by the rightmost resistor and the inductor on the left as\$V_{out}(s)= V_c(s)(R)/(R+sL)\$. Part III: Afterwards i substitude the expression of \$V_c(s)\$ that i calculated in part I and this way i find the expression for the transfer function \$V_{out}(s)/V_{in}(s)\$.
Are my ideas correct? If not what should i do? All ideas that can help me are welcome. Thanks in advance.
AI: Sounds about right. However the voltage divider for Part one also needs to include the R and L of the right side of the cap.
Zc = (1/sC * (R + sL)) / (1/sC + R + sL)
and
Vc = Vin * Zc/(Zc + R + sL)
Unfortunately that's a bit of math to go through here. Since the Rs and Ls appear to the same, the whole thing will simplify quite a bit as you walk through the math. |
H: Vias without annular ring on internal layers, non-functional pads in a via
My PCB layout package (Altium) has an option to define the full stack of a via so one may have different sized annular rings on different layers.
I was wondering if it is considered "manufacturable" if a via has annular rings only on layers where it connects to other copper. On layers without connection (passthrough), may have no annular ring, just the plated hole. I understand this this is more of a question for a board house, but i was wondering what the general opinion on this is.
The motivation behind this question is that in very high density designs, it may be critical to have less clearance on an internal GND plane for example. The lack of the annular ring would be of great benefit as it would reduce the area the via needs to pass hough the internal GND plane.
Thanks in advance.
AI: Removing non functional inner pads should lead to a more reliable plated through hole via. Some people might also say it reduces drill wear for your mfg but the primary reason is long term reliability especially under thermal stress. |
H: High voltage AC-AC or DC-DC buck conversion
I have a schematic for an amplifier which if supplied a lower voltage will still work as a low-wattage amplifier. In the original circuit this is achieved using a 3-tap transformer:
I would like to "emulate" that 15W/7W switch using some buck conversion circuit.
The high tap giving 238VAC and the lower 173VAC. I have a transformer which gives me 238VAC, and I want to optionally "regulate" that voltage into 173VAC.
I tried searching for buck-converters but there seem to be none in this voltage category.
I thought about using a resistor network as efficiency is not a concern, but as the amplifier can't be treated as resistive that doesn't seem right.
How could I convert 238VAC to 173VAC or DC equivalent 314VDC to 229VDC?
If possible I'd prefer a cheap and simple solution over an efficient one.
AI: Normal buck converters work with DC. Since the transformer just feeds a bridge rectifier all you need to do is to do the variable buck conversion after the rectifier.
If efficiency is not a concern why not just leave it in the 15W setting?
What is the purpose of doing this change? What will it do that it doesn't do now?
This circuit I found looks like it could be adapted to your needs. This is a linear DC voltage regulator. It should be incorporated after C25. It will need a low voltage supply as well to power the opamp. As designed it could go up to ~600V. If you change the value of R7 you can alter the voltage range (470K total would do about 300V). R2 could be reduced to a single 470K as well. M1 should be put on a heatsink appropriate to dissipate 10-15W.
Bartola Valves |
H: Is disabling time sensitive interrupts in C a bad idea?
I sometimes see code that disables interrupts, for example to perform a non-atomic read/write to a global variable used in an ISR. On AVR with gcc, this may look like:
ExpensiveOperation();
cli();
// Perform a non-atomic read/write
sei(); // Assume that it is acceptable to enable global interrupts here.
The cli and sei macros expand to asm volatile statements with memory barriers. The volatile keyword ensures that the cli/sei instructions are not optimized out, while the memory barriers ensure that if the non-atomic read/write is to a volatile variable, it will occur between the cli and sei instructions. However, this page suggests that nothing is preventing the compiler from putting ExpensiveOperation after the cli instruction.
Interrupts often require precise timing. If disabling interrupts in C risks having expensive operations run with interrupts disabled, should timing critical interrupts only be disabled in inline assembly (or should your program be rewritten to use only atomic reads/writes)?
AI: Depending upon what kind of side-effects ExpensiveOperation() has, it may be illegitimate for a compiler to move it beyond a call to a function that the compiler can't "see" into if, from the compiler's point of view, there would be a possibility of such a function making use of such side-effects. It would be helpful if there were a standard function, typically implemented by an intrinsic, which would in actuality do nothing, but which a compiler would be required to treat as though it might do anything. Compilers which treated such a function as an intrinsic could avoid having to actually generate a useless "call" instruction [or any other code] for it beyond the fact required to ensure that any global variables which are cached in registers would get flushed before the "call".
Unfortunately, while calling an outside function would probably force a compiler to process ExpensiveOperation() in its entirety first, I don't know of anything that would 100% eliminate the possibility of a compiler identifying portions of that function whose execution could be deferred. Still, adding a sequenced side effect to ExpensiveOperation() and calling an outside function that would require any such side effect would need to have been completed may be the best one can hope for. |
H: Can the CMOS 4014b be used as a SIPO shift register?
I'm currently working on a school project that requires the use of an 8-bit shift register. I collected the components for the project on the last day of school rather hurriedly, and I picked the first 8-bit shift register that I found, which was the CMOS 4014B IC. I'm now trying to wire it up, and I need it to be a SIPO shift register. I can find almost no resources for the chip's operation. The datasheet suggests that the ABCDEFGH pins are all parallel input pins; however the chip also has a serial input pin and a P/S control pin. I don't fully understand what the datasheet says about the P/S pin but it sounds to me that it enables serial inputs to the chip. Can I use it as a SIPO shift register? If so, which pins are used for the parallel outputs?
AI: No, there are no parallel outputs on this chip.
As you can see from the truth table below, when Parallel/Serial in is low a rising clock edge shifts data in from the serial input. When it is high, a rising clock edge loads from the parallel inputs. The only way you can get data out is from Q8, Q7 or Q6. |
H: Help with resolving warning "inferring latch(es) for signal or variable "..", which holds its previous value in one or more paths through the process"
Below is the code for my branch unit implementation. This unit calculates the jump destination address and writes it into the PC register.
There are a few different types of jumps, etc, standard story.
library IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
USE IEEE.NUMERIC_STD.ALL;
USE work.defPaket.all;
entity BR_UNIT is
Port (
CLK : in STD_LOGIC; -- clock
RST : in STD_LOGIC;
N : in STD_LOGIC; -- negative
Z : in STD_LOGIC; -- zero
C : in STD_LOGIC; -- carry
V : in STD_LOGIC; -- overflow
flushfifo : out STD_LOGIC;
pcOUT : out STD_LOGIC_VECTOR (31 downto 0);
pcWrEn : out STD_LOGIC;
in1 : in STD_LOGIC_VECTOR (31 downto 0); --input1
in2 : in STD_LOGIC_VECTOR (31 downto 0); --input1
validOut : out STD_LOGIC; --output
wr_reg : out STD_LOGIC;
regOut : out STD_LOGIC_VECTOR (4 downto 0);
dataVal : out STD_LOGIC_VECTOR (31 downto 0)
);
end BR_UNIT;
architecture Behavioral of BR_UNIT is
signal opc : STD_LOGIC_VECTOR (4 downto 0);
signal newpc : STD_LOGIC_VECTOR (31 downto 0);
signal offset : STD_LOGIC_VECTOR (31 downto 0);
signal validOut_t : STD_LOGIC;
signal wr_reg_t : STD_LOGIC;
signal regOut_t : STD_LOGIC_VECTOR (4 downto 0);
signal dataVal_t : STD_LOGIC_VECTOR (31 downto 0);
signal pcOUT_t : STD_LOGIC_VECTOR (31 downto 0);
signal pcWrEn_t : STD_LOGIC;
signal flushfifo_t : STD_LOGIC;
begin
clk_part : process (CLK)
begin
if (CLK'event and CLK = '1') then
validOut <= validOut_t;
wr_reg <= wr_reg_t;
regOut <= regOut_t;
dataVal <= dataVal_t;
pcOUT <= pcOUT_t;
pcWrEn <= pcWrEn_t;
flushfifo <= flushfifo_t;
end if;
end process;
comb_part : process (in1, in2, N, Z, C, V)
variable temp : signed(31 downto 0);
begin
if(
(in1(31 downto 27) = OPC_BEQ) or
(in1(31 downto 27) = OPC_BGT) or
(in1(31 downto 27) = OPC_BHI) or
(in1(31 downto 27) = OPC_BAL) or
(in1(31 downto 27) = OPC_BLAL)
) then
opc <= in1(31 downto 27);
elsif(
(in2(31 downto 27) = OPC_BEQ) or
(in2(31 downto 27) = OPC_BGT) or
(in2(31 downto 27) = OPC_BHI) or
(in2(31 downto 27) = OPC_BAL) or
(in2(31 downto 27) = OPC_BLAL)
) then
opc <= in2(31 downto 27);
end if;
offset <= std_logic_vector(resize(signed(in1(26 downto 0)), 32));
temp := signed(offset) + signed(in1(8 downto 1)) + 1;
newpc <= std_logic_vector(signed(temp));
regOut_t <= "00000";
validOut_t <= '1';
case opc is
when OPC_BEQ =>
if (Z = '1') then
flushfifo_t <= '1';
pcOUT_t <= newPC;
pcWrEn_t <= '1';
end if;
when OPC_BGT =>
if (((N xor V) or Z) = '0') then
flushfifo_t <= '1';
pcOUT_t <= newPC;
pcWrEn_t <= '1';
end if;
when OPC_BHI =>
if ((C or Z) = '0') then
flushfifo_t <= '1';
pcOUT_t <= newPC;
pcWrEn_t <= '1';
end if;
when OPC_BAL =>
flushfifo_t <= '1';
pcOUT_t <= newPC;
pcWrEn_t <= '1';
when OPC_BLAL =>
flushfifo_t <= '1';
pcOUT_t <= newPC;
pcWrEn_t <= '1';
regOut_t <= "00000";
dataVal_t <= newpc;
wr_reg_t <= '1';
when OTHERS =>
end case;
end process;
end Behavioral;
Quartus altera throws the following warnings:
Warning (10492): VHDL Process Statement warning at IDEXWBBranchUnit.vhd(94): signal "offset" is read inside the Process Statement but isn't in the Process Statement's sensitivity list
Warning (10492): VHDL Process Statement warning at IDEXWBBranchUnit.vhd(100): signal "opc" is read inside the Process Statement but isn't in the Process Statement's sensitivity list
Warning (10492): VHDL Process Statement warning at IDEXWBBranchUnit.vhd(105): signal "newpc" is read inside the Process Statement but isn't in the Process Statement's sensitivity list
Warning (10492): VHDL Process Statement warning at IDEXWBBranchUnit.vhd(112): signal "newpc" is read inside the Process Statement but isn't in the Process Statement's sensitivity list
Warning (10492): VHDL Process Statement warning at IDEXWBBranchUnit.vhd(119): signal "newpc" is read inside the Process Statement but isn't in the Process Statement's sensitivity list
Warning (10492): VHDL Process Statement warning at IDEXWBBranchUnit.vhd(125): signal "newpc" is read inside the Process Statement but isn't in the Process Statement's sensitivity list
Warning (10492): VHDL Process Statement warning at IDEXWBBranchUnit.vhd(130): signal "newpc" is read inside the Process Statement but isn't in the Process Statement's sensitivity list
Warning (10492): VHDL Process Statement warning at IDEXWBBranchUnit.vhd(134): signal "newpc" is read inside the Process Statement but isn't in the Process Statement's sensitivity list
Warning (10631): VHDL Process Statement warning at IDEXWBBranchUnit.vhd(66): inferring latch(es) for signal or variable "opc", which holds its previous value in one or more paths through the process
Warning (10631): VHDL Process Statement warning at IDEXWBBranchUnit.vhd(66): inferring latch(es) for signal or variable "flushfifo_t", which holds its previous value in one or more paths through the process
Warning (10631): VHDL Process Statement warning at IDEXWBBranchUnit.vhd(66): inferring latch(es) for signal or variable "pcOUT_t", which holds its previous value in one or more paths through the process
Warning (10631): VHDL Process Statement warning at IDEXWBBranchUnit.vhd(66): inferring latch(es) for signal or variable "pcWrEn_t", which holds its previous value in one or more paths through the process
Warning (10631): VHDL Process Statement warning at IDEXWBBranchUnit.vhd(66): inferring latch(es) for signal or variable "dataVal_t", which holds its previous value in one or more paths through the process
Warning (10631): VHDL Process Statement warning at IDEXWBBranchUnit.vhd(66): inferring latch(es) for signal or variable "wr_reg_t", which holds its previous value in one or more paths through the process
Regarding these warnings about signals not being in the sensitivity list, how do I resolve that? Should I skip using them whenever possible or use variables where not possible?
The big and the main question is: what do these errors mean:
Warning (10631): VHDL Process Statement warning at IDEXWBBranchUnit.vhd(66): inferring latch(es) for signal or variable "opc", which holds its previous value in one or more paths through the process
What do they mean and what are your suggestions on how to resolve them?
AI: I'm guessing that like me, you probably come from a software development background and are now learning HDL.
The when others case is empty; that's where you are implicity making all the latches. You clear this warning by explicitly setting the output's next value to its previous value, like x <= x;. Remember this is a Hardware Description Language, not a procedural computer programming language. So you have to think in terms of what actual hardware you expect each module to implement.
As a general rule, when you have a case statement, each clause (i.e. each "execution path" though that's the wrong terminology) -- should define the value of each of the statement's output ports, even if there is no change intended. There are certain code patterns that HDL synthesis tools recognize, and for best results you should try to stick with those forms whenever possible.
Response to the comment:
There's two kinds of warning mesasges here.
Warning # 10492 seems to indicate that an input signal is missing from the sensitivity list.
Warning (10492): VHDL Process Statement warning at IDEXWBBranchUnit.vhd(105): signal "newpc" is read inside the Process Statement but isn't in the Process Statement's sensitivity list
In the delcaration
comb_part : process (in1, in2, N, Z, C, V)
the sensitivity list only declares in1, in2, N, Z, C, V as the available input signals. In terms of hardware, this is like declaring that comb_part is implemented with some hardware block that has these six inputs -- and then oh by the way, surprise, here's this other signal called offset, which looks like it was meant to be another input.
offset <= std_logic_vector(resize(signed(in1(26 downto 0)), 32));
So because this is a non-blocking assignment statement, offset must be some kind of signal, but is it an internal register or an output? The HDL compiler can't tell of that's what was intended, thus the error message.
Recommended fix is that you need to review your design and determine whether you need to add those inputs to the sensitivity list.
Warning # 10631 seems to indicate that an output signal has an inferred latch.
Warning (10631): VHDL Process Statement warning at IDEXWBBranchUnit.vhd(66): inferring latch(es) for signal or variable "flushfifo_t", which holds its previous value in one or more paths through the process
In software it's assumed that variables hold their value until explicitly changed, but in HDL synthesis that requires a latch or a flip-flop. When you have an HDL module that describes code in terms of "behavioral" statements like if/else, or swtich/case, and there is at least one non-blocking assignment to a signal, then every "execution path" should explicity make a non-blocking assignment to that signal.
case opc is
when OPC_BEQ =>
if (Z = '1') then
flushfifo_t <= '1';
pcOUT_t <= newPC;
pcWrEn_t <= '1';
end if;
-- etc...
when OPC_BLAL =>
flushfifo_t <= '1';
pcOUT_t <= newPC;
pcWrEn_t <= '1';
regOut_t <= "00000";
dataVal_t <= newpc;
wr_reg_t <= '1';
when OTHERS =>
-- [MarkU] here's the problem, missing non-blocking assignments should go here
flushfifo_t <= flushfifo_t;
pcOUT_t <= pcOUT;
pcWrEn_t <=pcWrEn_t;
-- [MarkU] and so on for all the non-blocking assignments that are unchanged in this case
end case; |
H: Programming Flash memory
I am very much new to Electronics. I recently bought a Flash memory of 4mbit size. The interface is parallel type. The link to the memory is http://www.mouser.com/Search/ProductDetail.aspx?R=SST39SF040-70-4C-PHEvirtualkey57940000virtualkey804-39SF0407CPHE. I want to know if I can program this flash memory using Arduino Uno. I am guessing that this memory type is not serial so I cannot use the usual protocols (like SPI, I2C etc) to program the memory. But given the limited number of pins in Arduino UNO, would I still be able to program the flash?
Thanks.
AI: Short answer: yes, but not without a couple extra parts.
Longer answer: You can program your flash device if you add 2 I/O expanders into the path between your Arduino and the flash memory, and use them as the middle-men when interacting with your flash.
One expander is required to hold the R/W address during the R/W operation, because according to the datasheet, the address must be held on the address lines throughout the operation.
A second expander is required to handle the R/W data lines. It will be used as a serial-to-parallel converter when performing write operations, and then as a parallel-to-serial when reading.
I/O expanders come in both I2C and SPI flavors, so you can certainly use these usual protocols to the expanders.
In any case, an Uno might not be the best choice for the task here. You'd really benefit from a microcontroller with more available I/O. |
H: Simple amplifier circuit for a synth chip
I have bought a SID chip with the intention to build a simple synth. I'm pretty confident with the digital aspects of using it but I'm not very familiar with the analog ones and specifically I would want to convert its output signal to something that can drive head phones or be fed into a stereo.
This is the data sheet for it:
http://www.waitingforfriday.com/index.php/Commodore_SID_6581_Datasheet
The output Signal specification looks like this:
This open-source buffer is the final audio output of SID, comprised of the three SID
voices, the Filter and any external input. The output level is set by the output
Volume control and reaches a maximum of approximately 3 volts p-p at a 6 volt DC
level. A source resistor from AUDIO OUT to ground is required for proper operation.
The recommended resistance is 1 KOhm for a standard output impedance. As the output
of SID rides at a 6 volt DC level, it should be AC-coupled to any audio amplifier
with an electrolytic capacitor in the 1-10uF range.
What type of circuit would I need to build in order to plug in a pair of weak head phones or feed it into a stereo? Off the shelf components and pointers to dyi projects providing this feature works for me.
AI: Appendix C at the bottom of the datasheet link is the Typical Application Circuit.
(source: waitingforfriday.com)
Notice the top right corner listed Audio out. That's the typical circuit needed, just a 1kΩ resistor, and a 1µF electrolytic capacitor (and a plug connector). As a 3V peak to peak, basically a strong line level, it can plug into most stereo line ins, and it should drive headphones directly in an okay manner (mono of course). You shouldn't need anything else, but I suggest using a pair of dollar store headphones first. |
H: How to make if condition run once in while(1)
I am intergrating inputs and uart in PIC MCU. My program is if I press a switch, this info is send to terminal but the problem is it keep on displaying until I release the switch. I want it to be displayed just for once regardless of how much time switch is being pressed.
For ex:
while(1)
{
if(switch == pressed)
putsUART("switch 1 pressed");
}
Its just a pseudo code. This keep on displaying as it is in while(1) but is there any logic or some function which displays it for one time, and if some presses the switch again, it prints again for one time.
AI: If I understand correctly you want to print it only once for each time the button is pressed, but as the controller will loop quite fast, currently for a single press you will have multiple prints.
So to get around that, you will have to save that you printed it, and as long as that is saved you don't print it. If the button is released you clear your saved variable, so that it gets printed again on the next button press.
Something like this:
bool printedOut = false;
while (true)
{
if (switch == pressed)
{
if (!printedOut)
{
putsUART("switch 1 pressed");
printedOut = true;
}
}
else
{
printedOut = false;
}
}
Note that this is prone to bouncing of the switch and you'll have to debounce the switch either in software or in hardware to really only get one print per press. |
H: Earphone cable resistance
Earphone cables are usually very flexible - does anyone know how much resistance they tend to have? Are they cable of carrying 2A at 5V? My guess is that they are copper strands, but I'm not sure how many strands there are to make them so flexible.
Could they be used as power cables?
Thanks
AI: After some googling, earphone/headphone cables has 18-26 AWG gauge.
With the assumption we are using the thinnest cable (AWG 26), from the AWG gauge specification, the maximum current for chassis wiring is 2.2 A, and for power transmission is 0.361 A.
It has resistance 134 ohm/km or 0.134 Ohm/meter. Using this cable for 2 A, we can expect power dissipation 0.536 W/m and voltage drop 0.268 volt/meter that is very big. |
H: 3 phase AC motor 220V powered from 12V battery
I need occasionally drive watergate with gear box (e.g. http://www.servomech.com/main/screw-jacks.htm). Because location is far away from 220V I suppose powering from SLA 12V battery charged from solar panel. Battery capacity 7-20Ah. Required motor power is 50-100W (torque I think >0.2Nm). Because of outdoor usage I need IP66 or so. Price is also essential.
I did not find any 12V DC motors and seems that 3 phase AC motor (e.g. SIEMENS 1LA7063-6AB, 0.09kW,870 rev/min) produced in large quantities is the only option.
I can use power inverter 12V-DC/220V-AC and 3 phase frequency changer (e.g. Sinamics G110) to power motor even with trapezoidal profile. Expected efficiency 85%*95%. It could be assembled from stock products and it should work. I don't think it's worth to do it as home-made application.
I wonder if I can do it much simpler when I make simple inverter (IRS2153+current sensing IR2127+FETs+toroid transformer 2x12V/220V) and connect to 3 phase motor using Steinmetz method. Output of inverter is rectangular 220V voltage with adjustable frequency (easy to implement IRS2153 has option to force switching frequency from MCU).
The questions are:
1) Steinmetz decrease motor power to 70% and starting torque to 50%. But I believe efficiency remains unchanged, i.e. in other words I can use stronger motor without power loss compared to regular 3-phase triangle connection. Is it true ?
2) Is it possible to regulate motor revolutions via changing of inverter output freqeuncy (i.e. apply trapezoidal profile) ? I'm uncertain how Steinmetz capacitor value (70uF/1kW) is related to voltage frequency (50Hz).
3) how motor copes with rectangular AC waveform? I think it may affect insulation bacause of voltage peaks.
AI: To actually answer the questions:
1) The efficiency is most certainly changed when you use a capacitor so generate a phase shift. The winding's magnetic field is going to be reduced. It will get it turning in the right direction, but not efficiently.
2) Yes, you can (and do) regulate a three phase induction motor's speed by controlling its frequency. They can run (with simple Volts/Hz control) down to nearly zero speed while maintaining decent torque, and up to beyond base speed as well. But, your capacitor phase shift isn't going to like variable speeds unless you use an absolutely huge value capacitor, which is going to be difficult to find since it has to be non-polar.
3) The most common early AC Variable Frequency Drives (VFD) used a totem pole of SCR's to generate a six-step waveform that went to the motor. These had little impact on the actual driven motors windings. The newer drives do need motors with a better rated insulation system since newer drives use a high frequency PWM waveform to generate the low frequency output to the motor. Older insulation systems don't like modern high frequency waveforms.
All that being said, you would be better off with a simple 12V DC motor. If you MUST go AC, and need variable speed, build at least a full three phase inverter, even if only using 6-step technology. |
H: Do polygon pours have to be either ground or supply voltage?
I was wondering if it is possible to have polygon pours but not connected to anything. Will that affect the circuit in some manner ?
Because for the pcb I'm designing, if I use polygon pours as ground planes it results in a large number of isolated islands.
So is it better to send the pcb design off without any polygons or is it ok to send it with non-connected polygon pours?
Many Thanks
AI: You have two options. First you can turn off orphaned polygons (in the properties of the polygon after it's placed un-check orphans). Second you can punch VIAs into the areas that are orphaned connecting them to ground. (I'm assuming your using Eagle).
There may be issues with orphaned pours if you are using high speed signals near them because they may tend to couple into them but otherwise there shouldn't be an issue. |
H: Transistor capacitor circuit . need help
This isn't working as expected. It should work like this:
the led should stay on after pressing push button for one second.
Although when I press push button once then led stays on for 4-5 minutes and very slowly fades away.
Why isn't this circuit working properly?
AI: This circuit is reminiscent of a boot strap. When Q1 is off the space between Q1 and R5 is at ground level. When you press the button you charge C1 (reversed polarity!). Once C1 is charged it will supply current to Q2 that will intern supply current to Q1. When Q1 begins to conduct the spot between Q1 and R5 begins climbing in voltage pushing the base of Q2 higher. This action further turn on Q2 and then Q1. Finally when the charge that was stored in C1 is depleted the circuit will slowly dim the led until it turns off. The time the circuit stays on depends on the effective resistance of the base emitter junctions of Q1 plus Q2 plus R3 and the size of C1. |
H: Injecting UUIDs into ROM during production
I'm brand new to electronics and was wondering if someone could explain to me how individual MCU/MPU-powered electronics units can be assigned unique identities on the factory line.
For instance, lets say a particular device is being built. This device has an MCU/MPU (still don't fully understand their difference) that has a CPU, ROM to hold a binary/RTOS and RAM for running that binary at runtime. A control program is flashed to the ROM at some point during production.
Say this device has the need to be given a UUID that can be read from memory when the control program starts up. Obviously, each device needs a different (unique) ID. And so I would imagine that the MCU would undergo two different phases during its production build: an initial flashing of the control program to ROM, followed by a second flashing that "appends" (without overwriting, that is) a device-specific UUID to a specific address in ROM. The control program would then be hardcoded to look for the value (UUID) stored at this address at startup.
Am I on track here, or is there a more efficient/different/standard way of accomplishing such a task? And I guess I would generalize it beyond a UUID and ask the same question of any situation where all units share a binary (the control program) but then also have their own unique information that must be present in ROM at startup.
AI: The way you describe is a valid one, at least it's one we use in our projects. First we flash the whole program which contains an initial set of values, so the program will run fine. During calibration the serial number (UUID) of the device will be set, along with the other calibration factors. For this we reserve a flash page at the end of the flash, so an update of the program is possible without erasing the calibration constants.
For this to work, of course, you need some way of communicating with the controller and a program part which will do the writing to the flash. If your product is not designed to have that, you have to inject that data during the initial flashing. For that you can change the hex file on the fly for each (the format is rather easy) or use capabilities of the flasher to include an automatically incremented serial number or something like that. The capabilities of the flashers are also quite different - for example, Segger produces some with quite good production programming capabilities.
If you just need a way to identify a device without a requirement for what that UUID has to look like, microcontrollers often have some device info in them, among others an ID. Whether that is usable has to be determined for every microcontroller type you use, as there is no standard that I am aware of.
For example the STM32F401 (a device I'm currently working with) has a 96-bit Unique Device ID which can be read by the CPU and with JTAG. (more details in the reference manual) |
H: Is it possible to use a dual rail power system to power op-amp which is designed for a single supply?
I am designing an amplifier circuit using the LM386 amplifier. I am using the schematic below as a guide. I have access to 3 pins: +5V, virtualGND and -5V. Is it possible to power this amplifier using those pins? This amplifier only works with a single supply (not dual-rail apparently) so I'm wondering whether it would work with +5V as the supply voltage and replacing the ground in the circuit below with the virtual ground (which the audio input signal oscillates about). Thanks in advance, any help would be greatly appreciated.
AI: It won't work as you wish - the ground in the circuit must be connected to the most negative supply rail i.e. the -5V rail. You might be able to couple your audio to the circuit thru a capacitor but it could be quite noisy. This could be overcome with an audio coupling transformer but, maybe just try running it from a single 5V rail (yes it will work at 5V or even 4V for some versions) then consider using a boost regulator to give you a clean (after extra filtering) 10V or 12V. |
H: DC-DC SPMS Boost Converter DCM Prevention
Sorry for the long question, it's really opinions I seek which is why I felt I needed to explain the scenario and how much I know/don't know. I would really like some input on my design. I am designing a DC/DC SMPS(switch mode power supply) boost converter.
The general advice about DCM(discontinuous conduction mode) in SMPS boost converters is to try and avoid it. This advice is usually backed up by a barrage of equations. Unfortunately I am not very good at Engineering Maths, but if the DCM is anything like the equations, I get the point, I'll stay away :D ! Aside from adjusting switching frequency, increasing the inductance value looks the biggest way to avoid DCM. In my boost converter the output voltage can be varied(it's microcontroller based) and I expect the load to make the input current vary from 10mA(high inductance needed) to 4A(relatively high saturation current needed). I have had some problems in finding an inductor that would fit my specification, I used Digikeys' Parametric search.
Since inductance value is mostly inversely correlated to saturation current, I understand why it may be hard to find my golden inductor. I have found about 8 out of tens of thousands on Digikeys' site, but they are unshielded(which I don't want for this application), large :( and expensive :( .
I understand how DCM works well enough, that the converter enters DCM when the load current is so low that the discharge cycle of the inductor lets the inductor current slip past zero.
So here is my take, since this application is microcontroller based, couldn't one simply just stop the discharge of the inductor when the current nears zero? I know this means distorting the PWM. What I am suggesting is having two microcontroller pins connected to the base of the MOSFET(or gate driver to MOSFET) that controls the inductor charging. One is switched based on the PWM while another simply goes high when inductor current value drops to the microamperes range. I plan to use another MOSFET (Q2) in the inductor discharge path to measure the inductor current. I'll be using the Vds of the MOSFET (Q2) to calculate the inductor current and decide when step in to charge the inductor. So do I get the IEEE prize for SMPS design :D ? Well I doubt it, as while I was learning how to design a boost converter(which I did off the internet thanks to so many kind people), most of the designs I saw used a SMPS controller so I can understand that there wouldn't have been as much flexibility as with a microcontroller based approach because I never saw anyone discuss this.
So my question is, what are your thoughts? I haven't had the opportunity to test it on a breadboard yet, will do soon, but whether it works or not, I want to know if there is something I am missing, or the opinions of anyone on this idea. I am not an experienced circuit designer so I could do with some input.
Thanks for taking the time to read the question. :)
AI: So here is my take, since this application is microcontroller based,
couldn't one simply just stop the discharge of the inductor when the
current nears zero?
Think about this - the only way to stop the "discharge current" is to prematurely ground the transistor in the boost device to start "charging" current thru the inductor - you have no option - to keep the inductor open circuit is to enter DCM and that is what you are trying to avoid.
The cycle for a boost converter (or flyback converter) can be: -
Ground the inductor thus current ramps up and inductor stores energy (charge)
Un-ground the inductor - energy gets released to the output cap and load (discharge)
If inductor can't sustain current into load via diode you enter DCM and basically the inductor becomes open circuit except for the parasitic capacitance of the MOSFET switcher i.e. you get a damped oscillation until...
The cycle begins again.
OK, so then what happens (in that cycle) is a tiny little too much energy becomes transferred to the output capacitor and load (during inductor discharge). This causes the output voltage to rise fractionally higher than what it would and, over a period of a few milli seconds, you might exceed the output voltage that is safe for the load. A few seconds later and you have a dead load and a few seconds later you have a dead boost regulator.
OK before you get to this, the control loop would probably have implemented cycle skipping but cycle skipping is noisier than ordinary DCM so why bother?
BTW, going into DCM isn't that bad - the line regulation of the output isn't as good but it's still quite controllable. There isn't much on the web about this but, due to the self-resonance of the inductor and MOSFET drain capacitance, once DCM is entered there is a small oscillating current in the inductor that is asynchronous to the PWM and when the inductor restarts charging it does so at sometimes a slightly positive or negative current. This can cause the noise on a simple controller such as a fixed-on-period controller. |
H: Controlling power via code?
I have a lithium battery connected to a 0.33 amp / 12V pump via a connector (which can be changed - this connector option is part of the question). Is it possible to control power to the pump via code running on a Raspberry Pi or some alternative, and what connector would be recommended?
The reason behind my question is that I need to be able to power and unpower(?) the pump automatically, hence the need for code.
If it is possible, what avenues can I pursue to build a practical solution? If relevant, the main concerns, in order of priority, are: weight, complexity (number of independent components, complexity of code and dependencies), and power consumption (efficiency).
AI: Controlling the power going to the load can be done using various ways the design usually depends on the concept of the driver,it also depend upon the current your pump drives
There is always a need to isolate reactive loads in your circuit as the have reflective power hence there always a chance that the power may flow back to PS damaging any controlling unit in the way
Using the Raspberry pi you could use relay(ON/OFF) as Wouter van Ooijen suggests
or you could use a DAC to get a range of analog output to derive the pump,by varying the voltage across the pump.
you will need to bias the pump and vary this biasing voltage using the DAC output to give variable speed to the pump.
Or you could just you a simple analog solution ,where you can use a H bridge which can be unbalanced using a POT resistance,you can relate this value POT in a form of feedback hence relating it with some of the control variable like speed(rpm),or temperature in cooling application.
Also you can use a PWM circuit as Scott says with a 555 timer,to drive the pump,change the duty cycle to adjust the rpm. |
H: Differentiate Value of Unmarked Potentiometers
I am constructing a signal generator using a kit. Upon soldering it together, I have encountered a problem. The board is marked with two potentiometer slots, identical except for the values named on the board: 50K for the amplitude control and 1K for the offset control. I have two potentiometers, nearly identical. One of them is completely unmarked. The other has B503 etched on the back. How can I tell which one is 50K and which is 1K?
Thanks.
AI: B503 is probably a 50K pot with a 'B' (linear) taper.
But to measure it, just measure the element with a multimeter. |
H: How to interface two leds and two push button with 8051?
i'm using 8051 mcu to do some tests.
i'm trying to use two input for two push buttons and two outputs for two Leds.
SW1 = push button 1
SW2 = push button 2
LED1 = led1
LED2 = led2
for example
-if i push S1 the Led1 will glow continuously.
-if i push S2 the Led2 will glow continuously.
These two command works independently.
So here what i tried:
only S1 and Led1 are working.
Please help, thank you.
#include <reg51.h>
sbit S1 = P2^0;
sbit S2 = P2^1;
sbit Led = P1^0;
sbit Led2 = P1^1;
void main()
{
S1 = 1;
S2 = 1;
while(1) // For ever
{
if(S1 == 0) // if press Push button
{
Led = 0;// ON LED ( active low )
while(S1 == 0);// Wait here for release of push button
}
Led = 1;
}
{
if (S2 == 0)
{
Led2 = 0;
while (S2 == 0);
}
Led2 = 1;
}
}
AI: You have un paired or extra curly brackets.
void main() {
S1 = 1;
S2 = 1;
while(1) { // For ever
if(S1 == 0) { // if press Push button
Led = 0;// ON LED ( active low )
while(S1 == 0);// Wait here for release of push button
}
Led = 1;
} // LOOPS BACK TO WHILE
{ // ***EXTRA***
if (S2 == 0) {
Led2 = 0;
while (S2 == 0);
}
Led2 = 1;
} // While?
} // Main?
Fixed:
void main() {
S1 = 1;
S2 = 1;
while(1) { // For ever
if(S1 == 0) { // if press Push button
Led = 0;// ON LED ( active low )
while(S1 == 0);// Wait here for release of push button
}
Led = 1;
if (S2 == 0) {
Led2 = 0;
while (S2 == 0);
}
Led2 = 1;
} // While
} // Main |
H: Making a magnetic levitation system with arduino
I am planning on making a magnetic levitation system with an arduino that checks the value of a hall's effect sensor twice per second (but I have tried even 1000 times a second though) and turns the electromagnet on or off based on the hall's effect sensor's value. I have managed to check the output voltage of the sensor and turn the electromagnet on/off too but when a magnet is placed below the electromagnet it either sticks to it (then falls) or falls immediately. Now I am starting to believe that my idea is impractical but before I abandon my project, I'd like to know: is my idea practical? Can it be done? If so do you have any advice on what could be wrong? If not what can I do to make it practical?
AI: Your design is fundamentally a feedback control loop where the position is actuated by an electromagnet and measured by a pair of Hall effect sensors. At the core, such a design is practical but there are some critical details that merit close attention:
Your method for measuring the displacement of the magnet is a bit questionable here because the sensor will also be influenced by the electromagnet turning on and off. Even though you use two sensors to attempt to account for this, the cancellation is not perfect and thus you will have some component of positive feedback. Consider some other displacement sensor.
You are only allowing the coil to be on or off. This will make it much more challenging to stabilize. Consider an anlog current source for the electromagnet and a PID controller.
You are only sampling at 2-1000Hz. You may need to go faster than that. It depends on the other time constants in the system (which should be measured).
The magnetic system is far from linear. This further complicates control.
In short, it is possible but far from trivial. |
H: Is UART necessary to send AT-commands to Bluetooth module?
I'm looking to alert a connected device over Bluetooth when an accelerometer detects motion. I'm thinking of using the HM-10 Bluetooth module and an ATtiny for controlling the accelerometer.
The doc says that AT-commands can only be sent via UART. Does that mean the ATTiny will need to have an UART port? Could an ATtiny45 be used instead?
Thanks
AI: The module does require you to use the UART protocol in order to use it. It is possible to emulate a UART signal via bit banging, but this requires more from the MCU in order to make it work. AVR304 describes the most efficient way to do this.
Fortunately, the USI found in most tinyAVR devices, including the ATtinyX5, can be used as part of a half-duplex UART connection, alleviating some of the load. This is covered in AVR307. |
H: Open-loop gain vs supply voltage
I have a question regarding the relationship between open-loop-gain and supply voltage. Using op270 as an example:
We need to operate this device at +-5V. The datasheet has a plot (Figure 19) which shows Open-Loop-gain (in units of V/mA??) which decreases linearly as the supply voltage drops (from around 3000 at +-18V to 100 at +-5V). Is this in any way related to the GBP of the device? I'm confused by the V/mA units here.
AI: It's a typo- it should be V/mV.
See the typical and minimum gains Avo for the different suffixes in the tables. |
H: Isolating GPIO's using diodes
Schematic
The arrows are GPIO's
I want to be able to close multiple switches at once in any particular order in order to manipulate GPIO's manually. I could give each GPIO its own resistor, but when I close multiple switches the current will increase (by 2, 3, 4 times) reducing battery life. I tried to find a way where each GPIO would share the same resistor and be properly pulled down, while still remaining isolated by the switches. Would the above circuit work?
In particular, when the switch is open will the GPIO be at ground as I want it to be, and when the switch is closed will only the specified GPIO be high?
AI: No, your circuit won't work as you want.
When any switch is closed, the associated diode will pull the junction between the diodes and the resistor up to about Vcc - 0.7 volts, leaving the unselected GPIO inputs in an unknown state (but perhaps, due to leakage in the diodes, the unselected inputs may appear as Highs.) |
H: piezo and 3v LED in series to 3v battery
I'm a complete newbie to electronics. This piezo I have works with a 3v battery, and this green 3v LED works with the 3v battery, but when I combine both the piezo and LED in series on the 3V battery, neither of them work. I know both the piezo and LED are omni directional, but even when I turn around the LED and try the battery both ways around it's not working. It should be so simple, how do I get this to work?
AI: Piezo buzzer and LED in series with 3v battery are not working because the voltage at the buzzer and the LED are not 3v anymore.
Voltage at the buzzer:
\$ V_{buzzer} = \large \frac{ R_{buzzer}} {R_{buzzer} + R_{led}} * V_{source}\$
Voltage at the LED:
\$ V_{led} = \large \frac{ R_{led}} {R_{buzzer} + R_{led}} * V_{source}\$
For example, if LED and buzzer resistance both of them are 200 Ohm, then the voltage at buzzer and LED are 1.5v. You may look at their datasheet to find exact LED & buzzer resistance.
For a good practise, always use a resistor in series with your LED, use a 100 Ohm resistor for 3v power supply or battery. This resistor is for limiting current.
If you would like to turn on some devices at same time, connect them in parallel.
For example: LED+Rseries are parallel with buzzer. |
H: Chip resistors: how much power can they *really* dissipate?
For a variety of reasons, I'm currently considering a design for a linear regulator that uses some input resistance to help it regulate a higher current than it could handle on its' own. The issue is thermal: the regulator is nominally rated for more than the 100mA or so that I'd like from it, but the input voltage is high enough that the dissipated power would trip the thermal shutdown.
While most resistors have a power rating (for instance, the 0805s I'm considering are typically rated for 1/8W) I'd like some more detailed information. There is quite a bit of interesting literature describing the various common IC packages, covering things ranging from thermal resistance to the many effects of layout, convection, etc.
Sadly, this is not the case for resistors! The best reference I've been able to find on this topic is a short app note from Vishay, which you can get here:
http://www.vishay.com/docs/28844/tmismra.pdf
Specific questions:
Does anyone know of a better treatment of the thermal characteristics of chip resistors?
What does the power rating of the chip really mean? At what temperature? Is it soldered onto a board? Which kind? What thickness of copper is involved?
AI: I'm currently considering a design for a linear regulator that uses some input resistance to help it regulate a higher current than it could handle on its' own.
It's not a hopeless plan. Increasing the radiating surface area effectively lowers the system's overall thermal resistance.
That said, there's no free lunch. Dropping some of your excess voltage across an additional resistor just shifts part of the heat generated to a different part of the board. If the resistor is close to the regulator, it will heat up the air next to the regulator and thereby likely fail to give you the benefit you want: device temperature is a function of thermal resistance, and thermal resistance is always relative to ambient temperature. Raising ambient temperature eats into your thermal budget the same way excess voltage does.
Another big downside of your plan is that the resistor will create additional current-modulated ripple for the linear regulator to remove. That is, if your load current is varying by ±5 mA at a rate of 1 MHz, sticking a 100 Ω resistor in series with the regulator will create an additional 1 V of pre-regulator ripple. Worse, linear regulator effectiveness drops as frequency goes up, so that your regulator might let much of this ripple sail right through.
(Look for the ripple rejection vs frequency graph in your regulator's datasheet. One 78L05 sheet I have here says RR is down to ~20 dB at 1 MHz from ~55 dB at 60 Hz. A 35 dB difference means it is letting 57× more ripple through!)
You can avoid generating current-modulated ripple by dropping the excess voltage across a low-impedance stage instead of a resistor: several diodes in series, an extra pass transistor, a second linear regulator, a DC-DC converter, etc. The latter option is fairly common, actually: a DC-DC converter to get the voltage into the right range, followed by a linear regulator to reduce the hash put out by the converter to acceptable levels.
Does anyone know of a better treatment of the thermal characteristics of chip resistors?
Any good resistor datasheet should include a power vs temperature graph, like this one:
This is for a nominally ½ W resistor, showing that you should expect an 85°C rise over ambient at its rated limit, or about 110°C in free air at room temperature. Inside an enclosure surrounded by room temp air, the air will be warmer, so you can make a first-order guess that this resistor should never run hotter than about 125°C.
A good datasheet should also include thermal resistance numbers, expressed in degrees per watt. From those, you can calculate the effect of cooling on the resistor's temperature, which then feeds back into that graph to tell you whether you're running the resistor too hot.
What does the power rating of the chip really mean?
It's just a nominal value, not a hard limit. That's why it's shown as a dotted line in the graph above, with the graph extending above and below that "limit." That graph says that if you can arrange to cool the resistor somehow, you can run it over the rated wattage. But equally, if the resistor is inside a hot enclosure, you have to derate it.
Is it soldered onto a board?
That certainly affects things. If you use wide, heavy copper traces (say, 100 mils wide on a 2 oz copper board) you get some heat dissipation in the traces, which might let you run the resistor a bit hotter than otherwise.
A proper heat sink is a better solution than thick copper traces.
Your datasheet is almost certainly giving values that assume no significant cooling from the nearby copper, unless it specifically talks about the copper. Some datasheets actually give you recommended copper patterns and their expected thermal resistance values. |
H: Can a charged 120v high voltage capacitor really kill you?
recently I have been hacking few psu and have to deal with some high voltage caps. It sort of scared me, but thinking about it, what is the chance of it really killing me.
Is it safe to touch one terminal of a charged and opened 120v cap? I mean the other terminal is opened, and connected to nothing, so there is no current flow, so it should be safe.
Touching 2 terminals of a charged cap with one of your finger will give you a shock in your finger, but since no current go through your heart, it will not kill you. am I correct?
The only scenario a charged cap could kill you is when you touch one terminal with one hand, and other terminal with other hand, and the shock go through your heart. but still, what is the chance of that tiny 120v killing you if you are a health person. I think doctors use high voltage to save people.
Is a tiny 120v charged cap really that intimidating?
AI: You are right that 3) is the most risky situation, and I (and I think most other contributers here) have experienced 2) (not with that sissy 120V you americans use, but with the european 220V that real men use...) and survived with only a tinkling sensation, and in theory 1) should be harmless.
But that depends on the situation being exactly what you think it is. And we never make mistakes, do we? There never are any unexpected leakage paths, especially not across you skin because you were sweathing from concentration?
I can cross the street in front of my house with my eyes closed for 10 times and I will (probably) survive unharmed. That doesn't realy make it a good idea to do it an 11'th time... |
H: LED strip and current
I have an LED strip that uses around 2A from 12V DC (25W). I will probably use less than the full strip, so if I cut the strip, will it draw more current (the voltage will stay at 12V) or less? I want to figure out if the LED's will get brighter or hotter if I use less of the strip.
AI: Another way you could look at this situation is that removing a few LEDs will not influence the voltage over the other LEDs(all in parallel), so the current through the remaining LEDs will stay the same while the removed LEDs do not draw current anymore of course, so the required current is less. |
H: Opto-characteristic for schematic
I am referring below circuit, where I am using P781 opto-isolator.
H1G is I/O pin from LPC2138 controller.( VCC for LPC is 3.3V )
J24: 12V,6W Heater
Link for opto datasheet:
http://www.mouser.com/catalog/specsheets/TLP781_datasheet_en_20080117.pdf
For above opto, what is minimum If for LED to glow and therefore to conduct transistor at o/p side. I am checking min If in datasheet but couldn't get it.
For 2V or say 3V at H1G pin can transistor conduct?
Thank you.
AI: You need to look at this table in the data sheet: -
Look at the bottom row - it's telling you that for a forward current of 8.4mA, providing you don't take more than 2.4mA through the collector, you can expect a volt drop from collector to emitter of 0.4V max.
How does this work with your circuit? 2.4mA through R10 will generate a gate voltage of 24 volts but of course this is not possible with a 12V supply - this means the opto's transistor will be even more saturated - that is good normally but, you have another 10k resistor (R6) in series with the collector - this will limit the drive voltage on the gate to about 6V. I'm mentioning this because I don't recognize the MOSFET number and cannot tell you if this MOSFET is suitable with this gate voltage.
If you used a forward current of 1mA and a collector current of 0.2mA the saturation voltage is typically 0.2V but, 0.2mA through R10 will only produce 2V at the gate and this certainly may not be enough to adequately turn it on.
So, given that all we have is the data sheet you are probably looking to drive at least 2mA thru the diode BUT the outcome is pretty much determined by the MOSFET. Also, why are you using R6 - it doesn't seem to serve a purpose. |
H: Opamp with Caps
I am having an issue with the output of an opamp. Not sure its the opamp but also not sure what this circuit is doing.
simulate this circuit – Schematic created using CircuitLab
I should be getting something like
but i dont get this . Any idea on what to check or why . Would it be the caps? or the opamp?
thanks
AI: They clearly seem they are there as low pass filters. You also have to notice that since this is an open loop amplifier there will be a very huge gain.
So unless the input signal is very small the output will be saturated. |
H: Three questions about the use of a transformer in switching power-supply
In this document (an introduction to switching power supplies) a boost-mode switching power supply is presented: it has a simple inductor, diode, capacitor and load. Then (page 9) it is specified that this device can be used only for input voltages not greater than 42.5 V, because there is no physical isolation between the input voltage and the load.
1st question: why greater voltages would require an isolation? That is: why flyback converters are used instead of buck-boost converters in such cases?
The solution is to use a transformer instead of the inductor. Suppose that the input voltage \$ V_{in} \$ is the 220 V AC mains rectified, which could be a \$ \simeq 311 \ \mathrm{V} \$ DC voltage.
2nd question: if the input voltage is so high, why can the transformer in a switching power supply be smaller than that of a traditional (not switching) transformer (which first drops and then rectify the 220 V AC signal)?
The output of the switching power supply depends on the duty cycle of the switch, according to equation 1, page 6 of the forementioned document. I know (that means: I heard) that it would be difficult to obtain a precise duty cycle with a 311 V DC input (which would be the result of the 220 V AC rectified).
3rd question: why should be difficult to obtain such a precise duty cycle? Is this an importat reason to choose to insert a transformer which drops the voltage before the LC filter?
AI: if the input voltage is so high, why can the transformer in a
switching power supply be smaller than that of a traditional (not
switching) transformer (which first drops and then rectify the 220 V
AC signal)?
Because the operating frequency is so much higher than 50 or 60Hz. With a higher operating frequency, the inductance of the primary can be proportionately smaller requiring fewer turns and a smaller core size because core saturation is caused by ampere-turns. It's not unusual for a switcher to run at 200kHz i.e. 4000 times higher than 50 Hz.
It's all about core saturation, even for a laminated mains transformer - the current in the primary when the secondary is unloaded is the current that saturates the core. The magnetizing inductance of the primary is proportional to primary turns squared so if you double the turns you quadruple the inductance and quarter the magnetization current. So amps have gone down by 4, turns have doubled but, importantly, ampere-turns have halved.
(Generality alert) This is why a 230V mains transformer needs about 1000 turns on the primary - it needs to maintain a primary inductance of about 10H. This then limits current to about 73mA and ampere-turns will be about 73 At. For a given core size, the mean length of the mag field might be 300mm so, mag field strength, H will be about 244 At/m. At this field strength iron and ferrite and other such transformer core materials are seeing a peak flux density that is on the cusp of beginning to cause core saturation. A bigger core means less saturation. More turns means less saturation. Higher frequency means less saturation. Weigh this against the down sides. More turns = more cost and more copper losses. Bigger cores means bigger product and more cost. higher frequency means smaller core, fewer turns, smaller cost BUT cost of control electronics to run this higher frequency has to be considered.
why greater voltages would require an isolation? That is: why flyback
converters are used instead of buck-boost converters in such cases?
It's a legislative safety thing as mentioned on page 8 |
H: How PN junction diode is used as temperature sensor
I know the operation of PN junction diode. But I wonder how they use it as a temperature sensor.
AI: Effect of temperature on forward characteristics :
The characteristics curve of a Si diode shifts to the left at the rate of -2.5 mV per degree centigrade change in temperature in forward bias region.
Refer to the graph shown above. The curves are shown far apart just
for illustration purpose and are not to scale. The curve shifts to the
left at the rate of -2.5 mV per degree centigrade change in
temperature. Hence if the temperature increases from room temperature
(25° C) to 80° C, the voltage drop across the diode will be (80-25) x
2.5 mV = 137.5 mV.
Note:The values will change with respect to diodes,not all diodes are made up of same parameters and composition.
Hope this helps... |
H: arduino boot up button and shutdown mode on regulator
We've a projet with an important autonomy concern. We use an homemade arduino (atmega328), and for the moment we're using interrupts on buttons to wake up the atmega.
so we have: sleep ->(button pressed) -> wake -> (user RFID identification) -> (RF Communications) -> sleep.
We've optimized the total consumption with advanced sleep, modules isolated from current with transistors and so on...
I was asking myself if we could use a voltage regulator with a shutdown pin, and link one button and one pin of the atmega with it.
We would have this cycle:
shutdown -> (button pressed) -> shutdown pin HIGH -> atmega is powered-> atmega set shutdown pin HIGH during sketch configuration -> user RFID identification) -> (RF Communications) -> atmega set shutdown pin LOW -> shutdown
You get get the schematic here:
So to summarize: I need the button during my sketch, so when it's pressed and get the shdn pin high on the regulator, the first thing the arduino makes is maintaining this high with its pin 4. Furthermore, it restore the pull-up configuration of the button by reconnecting it to the ground through the npn transistor. When arduino is shutdown, button is linked to VIN as the npn make a NOT function with arduino state (HIGH or LOW).
Do you think it could work? If something is unclear don't hesitate to tell me :-)
Thank's a lot!
AI: Unfortunately I can not open your schematic, but I have an improvement that will definitely make this thing work.
Have a look at this:
simulate this circuit – Schematic created using CircuitLab
where:
reg_shdwn is the regulator shutdown pin
atm_wake_me is the pin you use to wake up the ATMega
atm_keep_on is the pin you would use to keep the regulator on
When SW1 is pressed all three pins go high, C1 is charged at \$V_{cc}\$ and the micro turns on. If the user releases the button before that the ATMega managed to pull atm_keep_on high the whole system does not shutdown though, since the capacitor will need some time to discharge through R1. You should size R1 and C1 to have a time constant \$\tau\$ that allows your micro the time it needs to pull the pin high.
The downside is that you dissipate some power through R1 when the system is on, but of course the resistor can be sized to minimize this power, while still being smaller than the input resistance of the arduino and the reg_shdwn pin.
Since of course \$\tau=RC\$ we can make an example calculation to aid you. I'd say that for R1 you should choose somethin in the \$100\$k\$\Omega\$ range, let's say \$R1=470\$k\$\Omega\$. \$\tau\$ can be some \$100\$us, i.e. 100 clock cycles at 1MHz. This leads to \$C\approx22\$nF, a perfectly reasonable value.
As a side note, a \$470\$k\$\Omega\$ resistor would dissipate about 23uW if \$V_{cc}=3.3\$V. |
H: What generates the clock signal in a fast CPU and how does it work?
Often, for integrated circuits, a quartz crystal is used to generate the clock signal. However, this only reaches speeds in MHz. What component, or what circuit, generates signals up to 5 GHz like in computer processors?
How is it possible to increase that speed when you overclock a PC (since I don't assume that a crystal speeds up when you put a higher voltage across it, or make it cooler)?
AI: Actually crystal oscillators can easily go up to 10's of MHz. Above that in most cases a PLL (Phase Locked Loop) is used, which is an oscillator that is not very accurate in itself, but can be tuned (its frequency can be adjusted somewhat). The frequency of this high-frequency oscillator is divided by a suitable factor (dividing a signal by a power of 2 is easy and totally accurate), and then compared to a let's say a 10 MHz oscillator. The comparison is used to adjust the high-frequency oscillator. Thus a high frequency is made with (almost) the accuracy of the lower frequency crystal oscillator.
In most cases, the circuitry to do all this is built into the processor chip. This is so it can be configured under software control, and routing such a high-frequency signal between chips is a nightmare. |
H: Connecting AVRISP MKII programmer
I need to connect an AVRISP MkII microcontroller programmer to my ATTiny2313 microcontroller in order to program it. I've never done this before and don't want to damage the programmer, so I have a question on the power supply connection. On this page it states that
The AVRISP mkII does not provide power on the Vcc pin, but uses this pin to sense the voltage on the target circuitry. Your circuit needs to be powered by external means to operate.
Does this indicate that I have to connect the microcontroller's Vcc pin to 5V and then connect the programmer's Vcc pin to the same microcontroller pin? Also, does the power supply have to be exactly 5V?
AI: Does this indicate that I have to connect the microcontroller's Vcc pin to 5V and then connect the programmer's Vcc pin to the same microcontroller pin?
Yes.
Also, does the power supply have to be exactly 5V?
No, based on its documentation here, AVRISP MkII supports target voltages from 1.6V to 5.5V. |
H: control multiple leds using only 2 connection wires
i want to control 5 led bulbs using just 2 wires .depending on some condition i want to turn a led with a specific color from 5 led set and only one led should on at a time.
here is a small explanation .
in my house we use water tank .if water level is max i want to show it by turning on specific color led.if water level is fine ..weak.. i want to show another color led on the motor switch .but distance between motor switch and tank is very big so i can't really use 6 wires for control 5 leds.
so what I'm asking is is it possible to control 5 leds just using 2 wires ? i'm thinking about pulse technique.for example if level is max i send a specific pulse/bit pattern so using small circuit determine which led should turn on. but for that i think i need 3 wires( 3 wire is also ok but led amount can be vary -10 led may be) .what is the cheapest and easiest way to do this ??i'm really new to electronics. if i can do this without using bit pattern it's lot better because detecting bit patterns quite complex to me. thanks
AI: You could send an analogue signal over the two wires to power and signal an LM3914 Dot/Bar Display Driver.
https://www.sparkfun.com/products/12694 |
H: Magnetizing current in switching converter
I have a question about the magnetizing current in a forward switching converter (image from "ON Semiconductor: Am improved 2-switch forward converter application").
From the picture it looks like there is a finite current in the primary, when the switch Q1 is off. My question is, how is that possible, since the primary is made out of a single wire ? How can you physically have a current in an open wire ?
AI: That picture is incorrect for anything other than what it is intended for i.e. to demonstrate that you need to reset the flux in an inductor or transformer.
What happens in reality with the circuit shown is that the energy built up (by the rising current) creates a high voltage when the MOSFET turns off and destroys it. They are using this circuit as a "device" to explain the problem.
If you'd shown the full picture and read the subsequent pages you might have made more sense of it: - |
H: Wilson current mirror analysis
I've just analysed a Wilson current mirror (part (ii)) and was wondering if someone could check that I've done it correctly. The input current should be mirrored to the load current right? Isn't that the whole point of a current MIRROR? It's just I saw another example where the load current was 10 times more than the input current...
Would I instead need to calculate I(C) of Q2?
Also any ideas for part (i)? Not sure what a load plot line is and couldnt seem to find one anywhere.
Thanks]1
AI: You got it partially right. The wilson mirror will reflect the reference by physical propriety of the transistor junction. The following relation show that:
\begin{gather}
\frac{I_{0}}{I_{ref}} = \frac{1}{1+\frac{2}{\beta ^{2}}}
\end{gather}
In your particular case, you assume both transistor are identical physically therefore and because the beta = 100 you can assume:
\begin{gather}
\frac{I_{0}}{I_{ref}} = 1 \\
I_{0} = I_{ref}
\end{gather}
To have that relation, you need that the beta of each transistor equal and both transistors to be matched. |
H: How to determine the maximum power required by given devices?
I need to power 4 devices with these power input specs:
Ethernet Relay Module: 18-27V DC max. 250mA@24V
Ethernet Dimmer Module: 9-24V DC max. 80mA@12V
Ethernet Dimmer Module: 9-24V DC max. 80mA@12V
Ethernet Shading Controller Module: 18-27V DC max. 250mA@24V
Is a 24V power supply (15A, 360W) enough to power these devices? (like this one)
How do I calculate the minimum necessary to power these devices?
UPDATE:
How to determine the maximum power required by given devices?
What power supply I should use?
AI: Two of the devices are spec'ed at 24V so these are easy.
The others are spec'ed to consume 80mA at 12V. It is likely that they will consume the same or even less at 24V but we can't assume that : a conservative approach would treat them as resistive loads, so their current would double as you double the voltage, for 160mA each.
Summing the currents then gives 500mA + 320mA = 820mA at 24V, so a 24V 1A supply should work, but a 1.5A or 2A supply working further from its maximum load is likely to be more reliable.
And a 15A supply may not even regulate correctly at such low loads, as Andy says. |
H: Transistor feedback loop
In an attempt to create a single transistor flipflop I made this :
The Idea : When the base is triggered by a pulse ,current starts flowing from collector to emitter . From the emitter it divides and goes to the base and ground keeping the circuit open .
The Reality : Current stop flowing when trigger is removed .
Adding a resistor to the base made no difference .Adding a capacitor from the base to the emitter got me the expected results but when the capacitor was fully charged the current stopped flowing from collector to emitter .
I have two question ,
1) Why will this not work ?
2) What did the capacitor do to make it work ?
AI: A flip-flop cannot be implemented by a single BJT or transistor,there is no feedback hence your output only depends on the current input,its not a flip-flop.
You have shorted the base and the emitter hence they are at same voltage,giving trigger will add same potential to both terminals,hence no current flows,when you add a capacitor between the base and emitter,it acts like a voltage source, hence current flows as long as the capacitor charges to the base supply or your trigger voltage,but when the capacitor voltage become equal to the trigger same problem arise the base Vbb and the emitter are at same potential Vee.hence Vbb- Vee = 0. (no current flows).
The base and emitter must have alteast have 0.6v difference for current to flow,also remember BJT is a current switching device. |
H: USB power in Parallel, increasing the maximum current using a Y splitter idea[POWER ONLY]
When you connect batteries or power sources of the same voltage, in series, the voltage adds together. When in parallel the capacity of the two add together.
Ive seen a few usb>sata cables in which there are two usb cables at one end. One for data+power and one for the extra power that larger HDD 3.5inch needs.
So my question is. If I treat the usb ports on my external battery as seperate sources of power, if i join the positive of port 1 to the positive of port 2 and then to a Micro usb cable. The same with the negative. This puts both sources of power/ports in parallel. This is confirmed by the face that if one port breaks the circuit is not broken.
By connecting them in parallel I should increase the capacity. In micro usb battery bank or whatever you want to call it. Capacity is measured in Ah or mAh. 1Ah is 1 solid amp for 1h. So by joining these two ports in parallel, I cant increase the total capacity as they are both the same battery. But should this increase the current.
The above was just to get the idea going, what im planning to do is below
Another mod I have is to take a usb hub, with ONLY a Usb cable with a usb male connector on it. Slit the cable open half way, find the red and black wires and make a T junction out of both. connecting the extra cable I just added to a male usb port that will go to my battery (usb power bank). Im joining 5v to 5v, whats the problem, the power system is working in parallel (because the hub can take it from a pc or the battery) and the data pins are unaffected. Allowing me to take a LOT more current when nessesery. Meaning I could hook up like 12 Hard drives or charge a few phones quickly. This being current each device will only take what it needs?
Any thoughts or issues spotted. What im aiming to do in total is that I have a windows tablet, but it only has a micro usb 3 port, im gunna use an adapter to make it into one female usb3 port. then give it some power by making a t junction to my power bank (it will be fixed to the back of the tablet) and then will go to a usb3 hub also on the back of the tablet:: http://www.amazon.co.uk/gp/product/B00Y25XFGK/ref=ox_sc_imb_mini_detail?ie=UTF8&psc=1&smid=A2PGPJL0BBLHLX
Not important but the power bank is "Anker® 2nd Gen Astro Pro 15000mAh Triple Port "
Im also using its 9v port to extend my windows 8 tablets battery to about 16-20 hours by my estimate
just to check and reduce peoples time that I waste (apologies in advance)
Im only touching power pins, so I do not think I need the processing chips in smarthubs or whatever
Its current so it does not matter how much I supply, each device "Should" take what it needs.
The voltage is identical from both sources. Only the current is different as the pc provides 0.5A and the charger 1A and 2A ports.
AI: The problem with this approach is, as with every other "connecting two power supplies", that the voltages are not the same. The nominal voltage is 5V - yes, but the actual voltage is different. One might be 5.05V and the other 4.8V. Both are in the spec for USB 5V.
But if you connect those two together, one will start to drive the other because it has a higher voltage.
Why the normal Y-Cables work? You plug them into the same device which has a single 5V source, so the voltage is really the same. Only each port is current limited.
And I see another possible question coming:
But there are USB hubs which use an external power supply, which is also a different voltage than the original port - how does that work?
Right, but those use either completely the external power supply or have some switching logic inside to switch from bus-powered to self-powered mode. For example the TPS2070 from TI.
So I would not connect two seperate power supplies to a single cable as long as I don't know the exact inner workings and can be sure that nothing will go wrong. It might work (if the things are reverse current protected for example) or it might not.
But I'm not an expert on USB power, so maybe I'm completely wrong. |
H: Can I connect a MOSFET to an Arduino directly?
I have the following electromagnet and plan on connecting it to the following MOSFET which will be controlled by an Arduino (I'm thinking analogue or PWM). Do I need any other parts (resistors etc.) I'm sorry about the vague question but I don't know much about electronics at all and am just starting. By the way, the aim is to be able to control the strength of the electromagnet (12v 300mA-1A) using the Arduino easily.
AI: You can connect a MOSFET directly, even without a resistor if you like (though it's not nice to put such a heavy load on the output), but if the MOSFET fails with a Drain-Gate short your Arduino will be scrap. I strongly suggest using a higher voltage MOSFET than that one- it's only 12V and you will at least be subjecting it to at least 12.5-13V when the MOSFET turns off. It does have nice specs at 4.5V drive (good for an ampere or two), but Vds breakdown is too low.
If you want a modicum of protection, (Edit: Assuming 5V Arduino) put a 5.1V zener on the Arduino output and a 200 ohm metal film resistor to the gate. Put 10K across the 5.1V zener as well so if the output goes open it won't partly turn on.
You must put a catch diode across the coil. Something like a 1N5819 would be good.
Otherwise the MOSFET will get very hot and may fail very quickly.
Edit: You should make sure the MOSFET you select is capable of handling the full current of the solenoid (1A you say).
simulate this circuit – Schematic created using CircuitLab |
H: Efficient way of setting bits in verilog
I'm just learning verilog and have a question regarding setting bits in a 2 bit register (assuming I'm even making the register correctly).
Suppose I have a hypothetical module, foo(), which has two inputs, and I want to combine these inputs into a 2 bit register. My thinking is that I would do something like ...
module foo(a,b)
input a,b;
reg [1:0] c;
c[0] = b;
c[1] = a;
I have two questions:
Am I doing it wrong?
Is there a better way? (e.g. something like c = {a,b};)
AI: It really depends if you want c as a reg or a wire. Both aproaches work, but reg needs to be assigned in procedural block, while wire needs an assign statement (or assigned at declaration).
As a reg, it needs to be defined inside a procedural block. Such as:
reg [1:0] c;
always @* begin
c = {a,b};
end
or:
reg [1:0] c;
always @* begin
c[1] = a;
c[0] = b;
end
There is no functional or behavior difference with the two always blocks, it is just a matter of preference for readability.
As a wire it can be declared and assigned in one line:
wire [1:0] c = {a,b};
Or declared and assigned on separate lines:
wire [1:0] c;
assign c = {a,b};
Or declared with each bit assigned on separate lines:
wire [1:0] c;
assign c[0] = b;
assign c[1] = a;
All of the above examples will simulate and synthesize the same.
With wire if there are two conflicting drivers on the same net, there will be an X in simulation. With reg it is last assignment wins in simulation and not synthesis. The assign per bit method has more simulation overhead, but normally only noticeable with very large designs.
Simulators are not required to evaluate always blocks at time-0, so there could be a short mismatch. Results will be identical after the stimulus changes after time-0. (Note: SystemVerilog's always_comb always does time-0 evaluation and throws errors there is another possible driver on one of its bits it assigns.)
For a small module that only have simple combinational logic; it really doesn't matter using wire with assign vs reg with always. With an FSM, I like to put just about all my combination logic in one big always @*. I find this typically gives the best simulation performance and synthesis result with my tool set. Occupationally I split the one always @* into separate always @* chunks when dealing with particularly noise asynchronous input signals. |
H: PIC18F14K50 with 8Mhz crystal and 50Hz PWM
I'm looking to generate between 50Hz to 150Hz square waves with a PIC18F14K50, which is running with an 8MHz external crystal (XT).
Apart reading an analogue value for the frequency from a pot and displaying the value on a 7-seg display, the PIC doesn't do anything except the square wave.
My options are to either use the PWM module or just write code that alternates the relevant pin between 0 and 1. I don't necessarily mind doing the latter, except there will be a slight interruption when I periodically (maybe a couple of times per second) fetch the potentiometer value from the ADC.
I've never done PWM before so I looked it up. There is one place where you can type in your MCU's frequency and your desired frequency, and it'll give you the corresponding XC8 code. When I tried this, it seems 8MHz might actually be too fast, and I cannot produce a 50-150Hz square wave with the PWM module. My only option is to move down to 500kHz or to use the manual method.
Is this correct? Can I really not produce a 50-150Hz square wave using the PWM module if my MCU is running at 8MHz? Is there any better way to achieve this square wave?
AI: If you really need to operate that slowly (usually faster is better, at least up to some kHz for PWM) then you have a couple choices- use a slower clock frequency (much lower, so maybe not desirable- but slower clock means less power consumption). It also does not give you fine resolution on the PWM period (because normally nobody cares that much as long as it is fast enough).
Or you can use the timer compare function to provide sub-microsecond accurate transitions since it can toggle the pin with the hardware compare function- you then set it up for the next compare (and, optionally, toggle the output pin). That would be the preferred approach, in my opinion.
Some of the 16F series parts have a numerically controlled oscillator peripheral (NCO), but I don't think it's available in the 18F series (could be wrong). |
H: Designing a *linear* MOSFET driver stage
I'm looking for a MOSFET driver circuit that can be placed between an op-amp
and a power MOSFET to operate the transistor as a linear amplifier (as opposed
to a switch).
Background
I'm developing an electronic load circuit that must be able to step a load in
about 1µs. The most important step size is small, say 100mA, although once
I get that worked out I'd probably like to also attain a large signal step
speed of 2.5A/µs. It should accommodate sources from 1 to 50V, currents from
0 to 5A, and will be able to dissapate about 30W.
Here's what the circuit looks like at present. Since appearing in earlier
questions I have replaced the MOSFET with the smallest capacitance device I was
able to find (IRF530N -> IRFZ24N), and moved to a reasonably wide bandwidth,
high slew-rate op-amp (LM358 -> MC34072) while staying in jelly-bean territory.
I'm currently running a gain of about 4 on the op amp for stability purposes,
which gives me a bandwidth in the neighborhood of 1MHz. Further background
below for anyone interested.
The problem
While the circuit performs reasonably well, the problem now is that the
stability is, well, not stable :) It doesn't oscillate or anything like that,
but the step response can range from overdamped (no overshoot) to quite
underdamped (20% overshoot, three bumps), depending on the source being loaded.
Lower voltage and resistive sources are problematic.
My diagnosis is that the incremental input capacitance of the MOSFET is
sensitive to both the voltage of the source being loaded as well as Miller
effect produced by any source resistance, and that this produces in effect
a "wandering" pole from \$R_o\$ of the op amp interacting with the
source-dependent \$C_{gate}\$ of the MOSFET.
My solution strategy is to introduce a driver stage between the op-amp and the
MOSFET to present a much lower output impedance (resistance) to the gate
capacitance, driving the wandering pole up into the tens or hundreds of MHz
range where it can't do any harm.
In searching for MOSFET driver circuits on the web, what I find mostly assumes
one wants to "switch" the MOSFET completely on or off as quickly as possible.
In my circuit, I want to modulate the MOSFET in its linear region. So I'm not
finding quite the insight I need.
My question is: "What driver circuit might be suitable for modulating the
conductivity of the MOSFET in its linear region?"
I saw Olin Lathrop mentioned in passing in another post that he would use a simple
emitter follower for something like this from time-to-time, but the post was
about something else so it was just a mention. I simulated adding an emitter
follower between the op amp and gate and it actually worked wonders for the
rise stability; but the fall went all to heck so I'm figuring it's not quite as
simple as I might have hoped.
I'm inclined to think I need something roughly like a complementary BJT
push-pull amplifier, but expect there are nuances that distinguish a MOSFET
driver.
Can you sketch out the rough parameters of a circuit that might do the trick in
this instance?
Further background for the interested
The circuit was originally based on the Jameco 2161107 electronic load kit,
recently discontinued. Mine now has about 6 fewer parts than its original
complement :). My current prototype looks like this for those who, like me, are
interested in that sort of thing :)
The source (generally a power supply under test) is connected to the banana jack/binding posts on the front. A jumper on the left of the PCB selects internal or external programming. The knob on the left is a 10-turn pot allowing a constant load between 0-3A to be selected. The BNC on the right allows an arbitrary waveform to control the load at the
level of 1A/V, for example, with a square wave for stepping the load. The two light-blue resistors comprise the feedback network, and are in machined sockets to allow the gain to be changed without soldering. The unit is currently powered by a single 9V cell.
Anyone who wishes to trace my learning footsteps will find the excellent help
I've received from other members here:
Is it ever useful to add a capacitor between op amp inputs?
Calculating gate resistor value for enhanced active-region stability
How to test op amp stability?
Why doesn't LTSpice predict this op-amp oscillation?
What can be inferred from the frequency an op-amp is oscillating at?
Why does smaller step show instability better?
How do I determine \$R_o\$ for an op amp?
Does this Schottky provide MOSFET transient protection?
Why 60% overshoot with 55° phase margin?
How can I measure gate capacitance?
I'm thoroughly amazed that a simple project like this has been so rich
a motivator for learning. It's given me occasion to study quite a number of topics that would have been so much dryer if undertaken without a concrete objective in hand :)
AI: This is indeed an interesting problem, because of the variation of effective load capacitance with the load resistance due to Mr. Miller, and your need to not overcompensate it.
I suspect a biased push-pull BJT output driver would work fine- maybe 4 small BJTs (2 connected as diodes) a couple bias resistors plus maybe a couple ohms each of emitter degeneration.
simulate this circuit – Schematic created using CircuitLab
If I was doing this I'd be tempted to throw a beefier, but still fairly inexpensive, amplifier at it such as an LM8261 instead. |
H: Choosing the correct thermistor
I need help choosing a thermistor. I’m not sure what I need to look for. Let’s say I have this circuit measuring temperature:
I have a range of temperatures from 0 to 10 degrees that I need to measure. I need outputs between 0 to 5 volts based on those temperatures.
I can’t seem to find how to choose a thermistor. I have found how to calculate the resistance of the fixed resistor to maximise sensitivity and range. I would choose a resistance that is the same as the thermistor when the thermistor is at a nominal temperature...
Thanks.
AI: The most suitable thermistors for temperature measurement are NTC types. The sensitivity is similar for most types (Beta in the range of 4000, give or take). If your range is 5°C +/- 5°C you might have an output of 2.5V +/-0.3V. If you want more like 0-5V you'll have to offset and amplify it.
Physical characteristics have to match the requirements- leaded, SMT, waterproof etc.
Other than that, the main thing is to pick an accuracy that is good enough and a resistance that is high enough that self-heating does not cause too much error, and not so high that whatever is reading it has problems (for example, an ADC might specify no more than 2.5K source impedance*. If the latter is a problem then a buffer amplifier can be added.
* the maximum source impedance is 1/(1/R + 1/Rtm) where Rtm is the resistance at the minimum temperature (maximum resistance). |
H: BUZ71 MOSFET seems to be not fully activating
I'm controlling a coil running at 32V from a microcontroller running at 5V via a BUZ71 N-Channel enhancement mode MOSFET. The coil has a resistance of about 30 ohms and it draws about 0.6A at 32V.
I supply +5V (or about 4.9V according to my multimeter) to the gate of the BUZ71 via a 1K resistor, and I've also grounded the gate with a 100K resistor to ensure it stays off when the microcontroller isn't supplying 5V.
I've got +32V going into the coil, and the coil connects to the BUZ71's drain. The BUZ71's source connects to ground without a resistor.
The whole apparatus seems to "work", and the coil is energising as expected, however when I measure the voltage going to the coil, it appears to initially spike at about 22V and then drop down to about 10-15V. It's hard to see exactly what's going on and when because my digital multimeter only updates about twice a second.
I'm totally new to MOSFETs, and I haven't even really use transistors a great deal. I've looked at the data sheet for the BUZ71 and I think +5V on the gate should fully activate it, but I'm not sure.
Does the setup I've described here reflect how I should be using the MOSFET? Is +5V enough to fully activate the MOSFET? Is the BUZ71 appropriate in this case, and if not then what other MOSFET do you recommend?
Big thanks.
AI: While your setup sounds OK, I suspect you're doing something odd. To begin with, a 30 ohm coil should draw about 1 amp (32 volts/30 ohms), so your current draw of 0.6 amps suggests that you've got a ground problem in your coil circuit.
I assume you're using your 5-volt ground as your reference. Try activating your FET, then measure all 3 pins. Is the source reading 0 volts? What is the drain reading? Are you sure you've got your 32 volt ground properly tied to your 5-volt ground? |
H: Xref Net Labels in eagle
I'm trying to make a shield for Arduino in Eagle.
I connected a floating NET from my shield pin and labeled it as for example PIN5 and marked it as XRef
But on ERC I'm getting Only INPUT pins on net PIN5 and Only one pin on net PIN5
Here is and image of it:
What is the correct way to fix this?
AI: Only INPUT pins on net PIN5
This error is caused by pin 14 of IC6 being labelled as an INPUT pin. The ERC has noticed that there is no corresponding OUTPUT pin connected to the PIN5 net, so it believes there is an error. Since you are building an arduino shield, you can safely ignore this error.
Only one pin on net PIN5
Eagle is saying that it sees a net, called PIN5, that has only one thing connected to it. This error should not be ignored. Without seeing the rest of the schematic, it's hard to tell what the cause of this error is. But I'd guess that you have not added the shield's mating connectors (or have not labelled the connector's pins). Once you add the mating connector to the schematic and connect the corresponding pin to the PIN5 net, that error will go away. |
H: USART necessarily signal lines
Can an USART peripheral works (in Synchronous mode) with only TX, RX and Clock lines. And without the other left handshake signals (CTS, RTS, DTR, DCD)?
AI: Yes. Neither mode actually requires the handshake signals. The handshake signals are more of a convenience feature that can be used in each mode to determine when the devices are ready to do something. But they can easily be ignored (and often are).
The asynchronous mode requires only the rx and tx lines. Transmission rates are generally slower in asynchronous mode to ensure good performance. Since the clock signal is not provided, timing conditions must be recovered from the data signals - typically in the form of start and stop bits. These extra bits reduce the amount of useful information that can be transmitted in a given time period.
The synchronous mode requires only clock, rx, and tx lines. Transmission rates are generally faster in synchronous mode. Since the clock signal is provided as a reference, start and stop bits are usually not necessary. |
H: How to change properties of holes?
I'm very new to Eagle so please bare with me. I'm hoping to check and change the properties of the holes on a PCB, but I can't seem to right click them. I've removed all layers except for the hole and drill ones.
The biggest issue is that, after converting to gerber, the drill file blows up the area by almost 100x (from 0.5in^2 to 70in^2), so I wonder if my holes are problematic.
Thanks
AI: I believe my issue is related to resolution. In eagle.def, under [EXCELLON], I divided the values of ResX and ResY by 10. I'm not sure why EXCELLON_24 uses 10000 whilst EXCELLON uses 100000 by default though.
However, I'm not sure if it's right to just change the resolution of Excellon - perhaps Excellon 24 is more appropriate. Choosing EXCELLON_24 also produces (seemingly) good results. |
H: How do I wire these potentiometers?
I'm trying to make this circuit (components in question are R10 and R11). I have two really nice sliders I bought from Science + Surplus. Problem is, I'm a teensy bit confused on how to wire even regular pots - and these ones have eight (8!) pins each. I think they're dual-gang sliders for stereo systems, but I can't for the life of me pick out the three connections I should be making. Which are my left/right/wiper pins (or how can I find out)?
The sliders in question:
AI: Using an Ohm Meter, measure any two pins until you get a reading of 10kΩ. Those will be the two far ends of that pot. Then picking any of those two pins to keep one of your meter leads on, measure a third pin, while changing the slide around. If you get a measurement on it that changes accordingly, you have found the wiper for that pot. Repeat for the pins of the second pot. |
H: Simple piezo buzzer circuit--could I power it using a large battery?
I am fairly new to electronics. I was thinking about a simple circuit and was wondering if it would theoretically work or not. Say I wanted to connect a 12V Piezo buzzer to a switch and a large battery (press momentary switch, buzzer buzzes, release and it stops). Say I wanted to use a large battery, like a lead-acid 12V battery found in a car. I realize this is probably a terrible circuit design and much better ones for buzzers already exist, but I want to know why it wouldn't be a good idea. My real question is this: if I have a 12V Piezo buzzer connected across a large battery, is this basically shorting out the battery by connecting the terminals together? Is it bad for the buzzer or the battery? Or would the battery's internal resistance allow this to work?
Edit: The piezo in question in question is a self-driven 12VDC 58mA buzzer.
AI: simulate this circuit – Schematic created using CircuitLab
Try this instead, connecting buzzer directly to battery is bad idea and i would not recommend you do that,the circuit that i have proposed has a 10 k resistance ,i am not sure about its value but it should be safe,when it comes to car batteries they produce a lot of current which is not safe for MCU or any other device so use a BJT with proper ratings to isolate the MCU or any other device
1)If the internal resistance of your buzzer is very small i will cause buzzer to explode as soon as you connect it to battery and battery will remain intact.
2)Batteries internal resistance will also be small so it wont allow your buzzer to survive.
Use V=IR or(I=V/R) lower the value of R more current flows through the load , if you short the battery ideally infinite current flows and melt the wire but if you connect a thick wire i will become very very hot (Disclaimer :Don't try this at home or anywhere on earth)
Hope this helps |
H: How does charging a phone battery work?
For example, if a phone comes with a charger rated at 5V and 0.7A, when it's plugged in to charge, what dictates the current the phone draws, is it the resistance of the phone?
If I = V/R, do phones typically provide little resistance so that the current is the max the charger can provide? i.e in the above example, if the phone was off, would it constantly be drawing 0.7A, and if the charger was changed with one rated at 5V and 2A, would the phone draw more than 0.7A? could it reach 2A?
...bit of a side question, but when the phone is done charging, how does it stop drawing current? again if I = V/R, does the phone have to alter the amount of resistance it is providing? how does it do that?
I'm only looking for fairly simple answers to be honest as this is just a general query and not something I need to go in depth with.
Thanks.
AI: There is a charge controller chip inside the phone that determines how much current to put into the battery. Generally lithium ion batteries are charged with a constant current until the cell voltage reaches a specific level, at which point the charge controller switches over to constant voltage charging until the current drawn by the cell decreases to zero. It's a bit difficult to think about in terms of resistances as the cell itself has chemical reactions going on inside and the charge controller is built up with many transistors.
One thing to note about ratings: the rating on the power supply is generally the nominal voltage and maximum current. It does not supply the current on the label at all times. It's quite easy to see why this is: when nothing is connected, there is no path for the current to flow so the current is zero.
Charge controllers generally regulate the flow of current into the cell in one of two ways. Depending on the design of the charge controller, the controller IC can use a transistor to act either as a switch or as a variable resistance. Linear charge controllers work like super fancy variable resistors, changing the resistance between the charger input and the battery terminal so that a specific amount of current flows. The current is usually measured with a current sense resistor, a resistor with small value (generally 0.01 to 0.5 ohms) that generates a small voltage in proportion to the current. The measured current is then used in an analog feedback loop to control the transistor. This drive transistor dissipates the difference in voltage between the charger input and the cell as heat, P = (Vcharger-Vcell) * Icell. Linear charge controllers are generally small and cheap, but inefficient. This dissipated power can result in quite a bit of extra heat that has to be dissipated somewhere. Linear charge controllers also must have a higher input voltage than the desired cell charge voltage. Lithium ion batteries generally charge to around 4.2 volts per cell, so a single cell with a 5v power supply leaves the charge controller around 800 mV to work with.
Another design of charge controller is a switching controller. These controllers use a DC to DC converter to move charge into the cell. A DC to DC converter uses two switches (generally a transistor and a diode) and some form of energy storage (generally an inductor and several capacitors) to efficiently change the input voltage. A step-down conveter (also known as a buck converter) works by alternately storing up and draining energy in the inductor at a high frequency (100s of kHz to a few MHz). Since the transistors are either fully on or fully off most of the time, less power is dissipated making the converter more efficient. It is also possible to design a converter that can draw power from a supply with lower voltage than the cell voltage. Aside from the DC to DC converter, the operation of a switching charge controller is essentially the same as a linear charge controller: it measures the cell current and voltage and generates a control signal to adjust the duty cycle of the switching transistor to change the current flowing into the battery. Switching charge controllers are more complex and more expensive, but more efficient than linear charge controllers.
Now, as for how much current the charge controller can draw to charge the battery, this is generally determined by the software running on the phone. When you connect the phone to your computer's USB port, it can only draw a limited amount of power before it has to ask the computer for permission to draw more. Cell phone chargers generally advertise their current limit via a resistor connected between the USB data lines. This resistor is detected and measured and the corresponding current limit is then passed along to the charge controller so it knows how much current it can safely draw to charge the battery.
As far as sharing power with the battery charger, the phone will certainly draw additional power above and beyond what goes in to the battery. In fact, depending on how the phone is configured, it can draw more power when plugged in to a charger than it would if it was running off of its internal battery, using this current to provide a brighter display, longer backlight on time before standby, higher CPU performance, etc. |
H: ADXL345 generating interrupts without MCU
I wonder if it's possible to drive an ADXL345 without an MCU on the board. That is, to set the ADXL345 to generate an interrupt on activity without needed an MCU on board. Could the register values stay persistent? If so, it could generate an interrupt without an MCU.
Thanks
AI: I see no mention of eeprom or flash memory in the datasheet, so the reasonable assumption is that all settings are volatile. Hence you can't use this chip in any reasonable way without a processor. |
H: Feedback op-amp voltage regulator help
I have made a voltage regulator:
simulate this circuit – Schematic created using CircuitLab
And here is the zener circuit:
simulate this circuit
I have already tried to charge a device with this circuit,but it actually acts as an external battery.The device starts charging,but the battery's percentage doesn't go up,it remains the same.This must be happening because of low voltage or current supplied.What should I modify in order make the voltage regulator output more current and voltage(if necessary)?.The mentioned device charges at 5 V and 2000mA(charger's specifications).
AI: First of all, a 9V battery will not output 2Amp. This alkaline battery http://data.energizer.com/PDFs/522.pdf can give you 500mA but even then the rated capacity is halved.
Next, your "Zener circuit" will start conducting above 17V (it starts conducting when Q2 base is 0.7V above ground, so when current through voltage divider reaches 0.7V/4.7kOhm=0.149mA ; this happens when input voltage is 114.7kOhm * 0.149mA = 17V). As-is it is equivalent to the voltage divider alone ; your + input is therefore about 0.2V below 9V. So the op-amp will be fully-on all the time.
Finally, did you use this particular amplifier? That's not an op-amp (gain is 20x) and the output is referenced to Vcc/2 (here to 4.5V). So, when inputs are equal the output voltage for your circuit is 3.8V.
I'd suggest you replace it with a proper op-amp, and choose it so that the output voltage can swing to at least 1V above output (that's 3V below rail) while delivering significant current. Also mind the input voltage range...
Or, if you're not after high precision (as your use of a non-temperature-compensated reference suggests) why not use directly your zener "circuit" and a pass transistor? Something like this :
simulate this circuit – Schematic created using CircuitLab
This works because the zener steals the current from the transistor base as soon as the voltage is above the zener threshold, which is 0.7V above the output (because of the base-emitter voltage drop of the transistor).
Obviously for 2A you also need a beefier pass transistor, something like TIP41 instead of poor little BC547... It will have to dissipate max 2A*4V, that's 8W of power!! Then lower R3 to 47 Ohm. |
H: LED without resistor
I know Ohms Law, i know leds need resitors.
My scenario is this: I need to make a little circuit that controls 2 RGB leds with a 9 Volt battery. This gives an avergare o 5 hours of light before the battery is gone. I would like to avoid to throw all that energy away into heat. Is there an alternative, safe way to turn those leds on without wasting all that energy?
there are a few requirements tough:
The circuit has to be simple because it has to fit in a 7x4cm slot. so no 100 components.. :)
the RGB pwm will be generated by a small 12f683 microcontroller.
there will be an additional LM7805 in the circuit for the microcontroller, it can eventually be used if needed.
thanks
AI: First off, LEDs don't need resistors, they need a constant current.
If you don't want to waste energy to heat, you have to use a switch mode power supply to bring the voltage down efficiently. The LM7805 is a linear regulator, it can be seen as an advanced resistor, you won't gain any energy benefits.
Based on the comment you want to connect them in parallel, basically they shall have the same colour. In this case you only need a 3 channel design and could connect them in series, so that the current will go through both LEDs. And you use standard 5 mm 20 mA per LED RGB LEDs. Good to know.
There are switch mode constant current drivers around, but they have a rather large quiescent current (roughly 1 mA per channel) so that would come to 3 mA quiescent current. They can be quite efficient (depending on the output current) and most of them allow PWM dimming. Let's throw in some ballpark numbers:
Per channel:
The current sense resistor drops 100 mV. The diode takes another 0.4 V (probably less). Because of the low current of 20 mA, the inductor needs a high inductance so the resistance is going to be a bit higher than usual, let's say 1.5 \$\Omega\$ because you want it to be small. So that accumulates to roughly 10 mW of power losses plus the IC, we end up at 17 mW of power loss. The output power is dependent on the LED voltage so assume 2.2 V for a red one and 3.2 V for the blue one, as you connect them in series the voltages will double. The output power would be between 88 mW and 128 mW. Efficiency would be between 83% and 88%.
A simple resistor with a 9 V battery would give you 24% to 35% or in a series connection 48% to 71%. So it's not that easy to decide, it will be more efficient and you will have a longer battery life, but it's debatable if you really want to go through all the trouble.
And there is a big BUT: The 9 V block will drop in voltage down to 4.8 V if you want to salvage all the energy. That makes a series connection only usable if you have a buck-boost type of switch mode supply, they are less efficient, so probably not worth the trouble again. I can't tell if a buck mode down to 6.4 V will last longer than a simple resistor down to 4.8 V. I think my second suggestion would be a better approach. Another thing to realize is that with dropping voltage the current and brightness will decrease quite noticeably for a simple resistor.
Using SMD components a 3 channel design should be doable on a 4 x 7 cm² board. I could fit a single channel in a 11 x 25 mm² area. I've used a AL8805, which worked reasonably fine.
Another suggestion would be to use a small lithium ion pack. There are plenty around for the RC hobby market. I have a pack at my desk which is just a bit bigger than 9 V block battery but has 2 times the capacity of a standard 9 V block. And as an added benefit it's voltage is 7.4 V so you will waste less energy. With that approach I would definitely go with a series connection of the LEDs and just resistors. The lithium ion pack will also hold it's voltage much better so the current won't vary much over the lifetime of your battery, which is a problem in case of the 9 V battery approach and just resistors. |
H: TEXTIO : Read past end of file in ModelSim Simulation
architecture Behavioral of INST_CACHE is
subtype word is std_logic_vector(63 downto 0);
type storage_array is array (0 to 2*16 - 1) of word;
--type storage_array is array (0 to 2**10 - 1) of STD_LOGIC_VECTOR (DATA_WIDTH - 1 downto 0);
signal InstCacheOut1_t : STD_LOGIC_VECTOR (DATA_WIDTH - 1 downto 0); -- data output line 1
signal InstCacheOut2_t : STD_LOGIC_VECTOR (DATA_WIDTH - 1 downto 0); -- data output line 2
type load_file_type is file of word;
file load_file : text open read_mode is "D:\instcachecontent.txt";
shared variable storage : storage_array;
begin
clk_part : process (CLK, RST)
variable index : natural;
variable rdline : line;
variable char : STD_LOGIC_VECTOR (7 downto 0);
begin
if (RST = '1') then
-- load ROM contents from load_file
index := 0;
readline(load_file, rdline);
while not endfile(load_file) loop
readline(load_file, rdline);
hread(rdline, storage(index)(63 downto 32));
read(rdline, char);
read(rdline, storage(index)(31 downto 0));
index := index + 1;
end loop;
elsif (clk'event and clk = '1') then
InstCacheOut1 <= InstCacheOut1_t;
InstCacheOut2 <= InstCacheOut2_t;
end if;
end process;
end Behavioral;
Above is my architecture design.
I'm not supposed to synthesize it, only simulate it in ModelSim.
However, during run, I get this error:
Fatal: (vsim-3551) TEXTIO : Read past end of file "D:\instcachecontent.txt".
the line the error is reported at is (before the loop)
readline(load_file, rdline);
This is the content of the file:
00000010
00000010 01111000000000100000000000000001
00000011 01111000000000000001000000000000
00000012 10100000000001000000000000000000
00000013 00001000100001000001000000000000
00000014 11010111111111111111111111111110
00000015 10101000000001000000000000000000
00000016 11111000000000000000000000000000
Any help would be appreciated, since I don't know how can it read past end of file on the first line.
AI: Sorry to bypass all the comments but to me the solution to this doesn't really depend on anything. You have not got if (rising_edge(RST)) then <ROM init loop>, but if (RST = '1') then <ROM init loop>. Since you have CLK in the sensitivity list for the process, any change in CLK while RST is high, will cause the loop to run again, causing the error you've seen.
You can easily make sure this happens only once with a boolean variable:
variable rom_init_complete : boolean := false;
...
if (not rom_init_complete) then
-- load ROM contents from load_file
rom_init_complete := true;
index := 0;
readline(load_file, rdline);
while not endfile(load_file) loop
readline(load_file, rdline);
hread(rdline, storage(index)(63 downto 32));
read(rdline, char);
read(rdline, storage(index)(31 downto 0));
index := index + 1;
end loop;
end if; |
H: How does this logic level converter on the Adafruit HUZZAH work
I am busy with a project where I am connecting a 5V(Amtel ATMega328) MCU to an 3V(ESP8266) via the serial port. Obviously I need some logic levels converted. I looked at the schematics of several open-source ones on the market to gain a understanding of how other people tackled this problem. On a side note I did build a voltage divider circuit just to start on something basic(just want to be sure I get the concept).
So I reviewed the FreeTronics logic level converter that uses a BSS138LT3G for logic level conversion. This makes some sense as it appears that this design is using a transistor with a low drop out to convert between voltage levels. You can find the schematic for freetronics logic level converter here.
I then looked at the Adafruit HUZZAH schematic board expecting to find one of the following components a voltage regulator or a MOSFET transistor or voltage divider of some sorts. Well I found the voltage regulator SPX3819 on the board but then I realized the serials pins where not using this at all...
When I studied the schematic I found that a 1N4148 diode was connected to the FTDI RX(receive) pin. I never realized you could use a diode this way(I am learning). So since this is a high speed diode it obviously causes a voltage drop from 5V to around 3V by the high speed switching almost like a PWM function would(Educated guess could be wrong). It seemed simple and elegant but then I noticed that they did not do the same on the FTDI TX(transmit) pin.
So at this point I am confused why would you convert a 5V input to the RX pin to 3.3V and then not convert it on the outgoing pin. Surely a serial port cant accommodate both voltages unless it is specified to handle it. Send 5V and receiving 3V just felt wrong.
Now I am speculating at this point but from my understanding, serial data transmissions are essentially bits being transmitted. A 5V being on and 0V being off. However I don't think that is realistic. How can I always have a 5V and 0V with components heating up, resistance variance and all the other factors in electronics? I suspect this designs works because 3V is above the 2.5V mark and the AMTEL MCU reacts to this voltage level like it was ON/1/YES bit being transmitted.
Now if my theory holds are there any risks with doing serial communications between an AMTEL chip and ESP chip via serial this way?
Or maybe I am just mad and missing something very obvious.
AI: Whenever the 5V device transmits, it pulls the bus down, and the diode conducts to 0.5~7V, when it releases or pulls the bus UP to 5V, the diode blocks the current from flowing, and a resistor on the 3.3V device should pull the bus on the 3.3V side back to 3.3V.
Whenever the 3.3V device transmits, the "HIGH" (about 3.3V or a bit less) is supposedly inside ATMega328's specs for VinHIGH (3.0V to 5V) and the "LOW" is inside the VinLOW threshold (1.5V to 0V).
p.s.: the risks that I can see are having problems with the bus if ESP VoutHIGH is not high enough, if the diode is not fast enough or if the resistor is not strong enough to pull the bus in the speed you need. I dont think any of these will risk burning the ports though.. |
H: Modelling grounding reactor as transformer
First: This is not a question about electronics, it's about large (three-phase) power systems where the components have ratings in kV and MVA. I'm mainly interested in symmetrical components, and how the zero-sequence network is modeled. Although the terminology and simulation tools might differ, the physics should be pretty much the same for small and large components.
I have a three-winding transformer connected YNynd, where the primary side is solidly grounded, the secondary is resistance grounded, and the tertiary winding is delta connected.
In the simulation tool I'm using (PSS/E), three-winding transformers can be modeled, but not transformer with the parameters described aboce. I'm wondering if the following will be a physically correct way to model the system.
Disregard this paragraph (I'll let it be, as this was the original proposal:
If I'm modelling this as a YNdd transformer with solid ground on the primary side, and delta windings with angle 30 deg on the secondary and tertiary sides. Between the secondary winding and the bus on the primary side, I insert a zero-impedance 1:1 two-winding transformer with vector group Dyn where the secondary side is resistance grounded, and the angle reverses the 30 degrees from the three-winding transformer.
New proposal (after Lewis' comments):
Model the three-winding transformer as YNynd1, transformer, with both primary and secondary solidly grounded. Then, I add a 1:1 transformer with the primary side solidly grounded, and the secondary resistance grounded, as shown in the last figure. I'm not sure if the intermediate windings (secondary of three-winding and primary on two-winding should be grounded or not). I can't wrap my head around the zero-sequence equivalent of this (a few years since my university days).
I'm mainly interested in simulating line-ground faults on the secondary side of the transformer, but I obviously want the model to be correct for all other cases. I'm not interested in internal faults in the transformer.
Real system:
Suggested model:
AI: I have done this before.
Make the 132kV winding of the 3W transformer be un-earthed wye.
Insert a "node bus" at 132kV.
At the node bus, model a shunt impedance (if PSS/E will let you do such a thing - maybe it's called a 'constant admittance'.)
Make the shunt impedance have infinite positive sequence impedance, and 30 ohm zero sequence resistance, such that the phase to ground fault current is 2,540 amps. Note 2,540 A = 132kV / sqrt(3) / 30 ohms. (If you get a funny number, try using Z0 = 1/3rd of 30 ohms, or 3 times 30 ohms - funny things happen with 3 × I0.)
I have to run now, please comment if anything requires further explanation. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.