text
stringlengths 83
79.5k
|
---|
H: Simple transistor & capacitor circuit question
I'm new to electronics, so what I've found to be helpful to a good learning process is examples.
Now, I was studying transistors and capacitors, and as far as I could understand, a transistor acts more or less like an "electrical valve/switch" and the capacitor store current until it's discharged.
To test what I've learned, I've made the following circuit:
What I though it will do was:
circuit being in the presented configuration, the LED will stay lit
when R1 is removed, the transistor ("valve"?) will close, the capacitor will gradually discharge, and the LED will fade away
But what the circuit actually does is
circuit being in the presented configuration, the LED will lit and imediatly fade out
when R1 is removed, nothing happens :(. When reconnecting R1, the LED will lit a little, then fade out. If I short the capacitor (to discharge it, I can tell this is maybe not recommended), then reconnect R1, the step 1 repeats again ...
Why does this happen? What did I got wrong ?
PS: the transistor is 2N2222
AI: First draw the circuit with positive power at the top negative at bottom, power currents generally flowing down, and signals feeding left to right. If you do that, two useful things happen. First, many circuits will be drawn similarly most of the time, and you learn to recognize them after a while. Second, you will confuse yourself and anyone you ask to help you less in what is actually going on and what you hooked up where.
Redrawing the schematic so as to better illuminate the circuit, we have:
It is obvious why the LED doesn't come on, or blips on for a short time at best. That is because it is in series with capacitor C1. Capacitors block DC current. There can't be any sustained current thru the LED.
What you probably intended was something like this:
This allows the capacitor to be like a small reservoir for the LED. It will keep the LED lit for a short time after the transistor is shut off.
With this circuit you can see how a little base current can control a larger collector current, which is how a bipolar transistor is used to make circuits with gain.
However, the values don't seem right for what I think you want this circuit to do. Most LEDs are rated for 20 mA maximum, so R2 should be sized to that this can't be exceeded. Let's say it's a green LED and drops 2.1 V at full current, and that the transistor would drop another 200 mV. That leaves 9.0V - 2.1V - 200mV = 6.7V accross R2. From Ohm's law, 6.7V / 20mA = 335Ω, which is the minimum resistance to keep the LED current within spec. Therefore use the next higher common value of 360 Ω. That still results in nearly 19 mA LED current. You won't notice the brightness difference between 19 mA and 20 mA even in a side by side comparison.
Another problem is that there isn't enough base current to reliably light the LED to its full value. Let's say the B-E junction drops 600 mV, then there is 8.4 V accross R1, which results in 84 µA. Let's say you can count on a gain of 50, so the minimum LED current is only 4.2 mA. That's enough to see it light up on your desk, but not to reach full brightness. In reality, you will likely get a gain higher than 50, so you will get more LED current, but relying on that is bad design.
Let's work backwards to see what R1 should be to fully turn on the LED. Again we'll assume the transistor has a gain of 50, and we've already said the maximum LED current is about 20 mA. 20mA / 50 = 400µA. With 8.4 V accross R1 from above and using Ohm's law again, the maximum R1 value is 8.4V / 400µA = 21kΩ, so the common value of 20 kΩ would make this a nice and reliable circuit if the intent is to light the LED to full brightness. |
H: What is the lowest capacitor voltage rating that is safe to use?
I'm using a few Case R tantalum capacitors (10uF 6.3V) as bulk decoupling on the 3.3V power of a 100mbps Ethernet phy. I am also using 0.1uF ceramics closer to the pins.
As usual, I'm terribly pushed for space on the PCB, and so I would like to replace them with 0603 size caps. The problem is that they're only rated for 4V. Normally I would always rate my capacitors for twice the voltage that they're ever going to see.
Is it likely to be a problem if I use a 4V capacitor on a regulated 3.3V line?
AI: Using tantalum caps for decoupling is silly with today's options. 1 µF 6 V ceramic caps in 0603 package are cheap and readily available. That would be better than 10 µF for decoupling anyway. A 10 µF at the power supply connection points makes sense, but not for decoupling. Take a look at the impedance plots of 100 nF, 1 µF, and 10 µF ceramic caps in the datasheets of any of the reputable manufacturers. |
H: Arduino EthernetServer with interrupt
I have an arduino application doing two things in the loop:
A webserver that waits for a connection and renders some html forms to change configuration values.
Process some external data and show them on an matrix of leds.
The problem is that the processing of the data takes much time (~20 seconds). So while this time, the webserver can't do anything. My programm structure looks like this:
EthernetServer server(80);
void loop() {
webServer()
processAndShowData();
}
void webServer() {
EthernetClient serverClient = server.available();
if (serverClient) {
while (serverClient.connected() {
// handle the web server stuff in here
}
}
}
So my question is, if there is any posibility to use a interrupt handler for handling the web server stuff? Then the web server could react while the other task is running.
UPDATE: I now also tried to attach an interrupt to the ethernet pins (using a Mega this are 50, 51 and 52), but this doesn't work too. I tried sth. like this:
attachInterrupt(50, demoFunction, CHANGE);
But the method does not get called, even when changing the pins to 51 or 52 on both, input from a client like a HTTP request and output sending HTML to a browser.
AI: In Arduino sketches, the loop() function is called repeatedly. Your loop function calls webServer() which then blocks in a while loop.
Instead, use if (serverClient.connected()) in your loop and implement your web server logic as a state machine capable of doing a little work then returning control to the main loop.
This way, your program will not block execution. |
H: Transmission of different messages with the SAME ID on a CAN bus
CAN arbitration is done with IDs, and any node on the bus can transmit with any ID (ideally it should not, but a nasty node can).
What if two different nodes connected on the same CAN bus transmit messages with the same IDs but different data bytes?
My thinking: It will generate garbage on the bus. Whoever has the dominant bits those only will get transmitted.
AI: Section 6.1 of the CAN spec:
BIT ERROR: A unit that is sending a bit on the bus also monitors the
bus. A BIT ERROR has to be detected at that bit time, when the bit
value that is monitored is different from the bit value that is sent.
An exception is the sending of a ’recessive’ bit during the stuffed
bit stream of the ARBITRATION FIELD or during the ACK SLOT.
So, the node which first transmits a '1' when the other is transmitting a '0' will note a Bit Error and then signal an error as normal - by transmitting an error-flag (see Section 3.1.3) , as described formally in Section 6.2.
Informally, if that node is error-active (which should be the usual case) it will transmit an error flag of 6 dominant bits, which all other nodes will also detect (as a stuff error). This has the effect of destroying that message completely:
no-one will receive it
none of the transmitters will think they have successfully transmitted anything.
Each transmitter will then attempt to retransmit - depending on the precise timing of the retransmissions, one may start sufficiently before the other the gain control of the bus. Otherwise, the same sequence may happen again. (Or another higher-priority message may put them both off for a while!)
Extended answer inspired by @clabbacchio's answer below.
You mention "nasty nodes", and clabbacchio makes the valid point that if two nodes transmit at different times, each receiver needs to decide what to do with its multiple receptions.
This was demonstrated by a hack last year. The paper discusses, in the section "PSCM specifics", how an attacker can synchronise to the regular messages on the bus and play their evil message just before the one that the "good" ECU is about to send. The receiving ECU accepts the earlier message, updates its message counter and then discards the "good" messages as erroneous, because its message counter has not incremented. |
H: Is this a serial LCD?
I had a broken remote for a small RC helicopter that I took the LCD off.
I dont know the size, but I could try to describe the pins and maybe someone could pinpoint what this is.
It has 7 pins, and from the top it is labeled:
BZB (not used)
BZ (not used)
VDD
GND
DATA
WR
CS
LED-
LED+
Just a serial screen? And what are the WR/CS/LED-/+ pins? Thought I could try to hook it up to my Raspberry PI laters if possible.
AI: Seems like it:
DATA is probably your input serial data line
WR is probably a write enable
CS seems like a chip select for the control to me
LED- and LED+ are the power and gnd for the backlight
Oh and since there's no clock signal it's probably a uart interface like a RS232 (probably not at RS232 voltage levels though). Maybe try that first messing around with the baud rate until you get some garbage or a character to show up. There's probably also single character commands to clear the LCD which you can figure out by trying. Like sending 0x01 clear or something like that. |
H: Factors impacting propagation/gate delay
I was just wondering how the change in transistor sizing, load capacitance and supply voltage affected the propagation/gate delay of an inverter.
AI: For a particular output load, increasing the size of the gate will reduce the gate delay. However, it increases the input capacitance, and this increases the delay of the previous gate.
Increasing the supply voltage, without changing the threshold voltages of the gate, will reduce the delay at the cost of greater power consumption and heat dissipation. (This is why people overclocking their computers will often overvolt them as well).
Optimal gate sizing for a circuit is a painful problem. A technique called "logical effort" works quite well if you can custom size each gate and wire delay is small. |
H: Advanced Math in day to day Electronics?
So i've been watching the MIT 6.002x Classes and they are really interesting, I feel like i've got a good grasp of Circuits and the Basics (I graduated with a CS degree...but EE appeals to me too).
Anyways I noticed....probably like a lot of people that a lot of the advanced math isn't really used on the job. It happens...better to know it than not I guess. But leaving out Signal Processing and similar "Intense"/math heavy sub-fields of electronics....how much Advanced Math do you feel like you use on the job?
I guess someone that did circuit design, Microcontroller Programming and such how much math would they really get into.
And Second Question: Is there a book that goes into the Advanced Math that's necessary for this? or do "most" electronics books pretty much already have what is necessary.
AI: The ordinary common stuff is mostly just basic algebra, like Ohm's law, computing one of frequency, resistance, and capacitance from the other two, etc. The important skill here is not so much math but intuitively understanding the physics behind what you are doing. If you can look at a schematic and feel the voltages pushing and currents flowing and how each of the parts react to those, you can pretty much derive the equations you need to quantify things.
I also find basic physics is very useful to EEs, at least the kind of EE I do, which is designing small embedded systems. My job never just ends at the circuit or the firmware. To do the job right, which is to solve the problem not just make the circuit work, you have to have a good grasp of whatever the circuit is controlling or measuring. This requires good understanding of the system and the physics behind it.
All too often you find the people that know the system and wrote the requirements for what your controller is supposed to do don't really have a good grasp of what things are reasonably possible. They think up one means to solve the problem, then specify a circuit to do that. In other words, they know their world, but don't know yours very well. It is very valuable if you can be the one to reach accross (because they can't or won't), look at the big picture, and propose a better method of solving the overall problem. However, you can only do this if you have a good understanding of the system, which usually requires good basic physics skills on your part.
This brings up another important skill of being a good engineer, which is surprisingly rare. Always take the time to understand the bigger system your little design fits into, then look at the big picture. I find people are usually more than happy to talk about how their part of the system works, so go around and learn it. Then look at the overall picture and see if what you were asked to do still makes sense or only from the point of view of the one guy your gizmo interfaces with and that guy was only looking at his isolated problem. You may think this is a no-brainer, but then you'd be surprised how often this happens, particularly at large companies. The type of people that like to take a narrow view and work on just their little problem tend to gravitate towards large companies. There is room for people like that in a large project, having a few of them in the right place is actually useful, but it takes a skilled chief engineer to utilize these and all the people properly. That last part is very rare nowadays, and you will often find Joe Blinders in charge of stuff he shouldn't be. Even if Joe does try to look around a bit, he often doesn't know what electronics can and can't easily do. The worst is when he fancies himself a EE but doesn't really know what he's doing.
As far as more advanced math than common algebra, definitely learn to think in frequency space. I have done detailed frequency to/from time domain calculations on a few times, but the concept are valuable often. Every EE needs to be able to visualize what the frequency implications are of a time domain signal and vice versa. Here I am not talking about sitting down and solving Fourier transforms, but having a good intuitive sense of it. For me that came from doing the detailed math in college. I have done that math only rarely since, but the understanding behind it is useful every day. |
H: Can I replace all electrolytic capacitors with ceramic?
I am designing the power supply circuit for a system that needs several supplies, my questions are:
Is it possible to replace all electrolytic caps (Mostly 100uF) by ceramic ones? What are the limitations of ceramic?
Should I use a 2x voltage rating for ceramics as it's done for electrolytic?
What about ripple current rating? Is it an important factor when choosing ceramics as in electrolytic?
Added 1/9/2014: More about ceramic limitations
I found this excellent video submitted by Dave at EEVBlog showing the limitations of different types of ceramic caps and how they are affected by the applied voltage and the bias voltage too. Worth watching!
AI: 100 µF is really pushing the limit for ceramic caps. If your voltages are low, as a few volts to 10 or maybe 20 volts, then paralleling multiple ceramics may be reasonable.
High capacitance ceramic caps have their own set of advantages and disadvantages. The advantages are much lower equivalent series resistance and therefore much higher ripple current capability, usefulness to higher frequencies, less heat sensitivity, much better lifetime, and in most cases better mechanical ruggedness. They have their own problems too. The capacitance can degrade significantly with voltage, and the denser (more energy storage per volume) ceramics exhibit piezo effects often called "microphonics". In just the wrong circumstance, this can lead to oscillation, but that is rare.
For switching power supply applications, ceramics are usually a better tradeoff than electrolytes unless you need too much capacitance. This is because they can take much more ripple current and heat better. The lifetime of electrolytes is severely degraded by heat, which is often a problem with power supplies.
You don't need to derate ceramics as much as electrolytes because the lifetime of ceramics is much larger, to begin with, and is much less a function of the applied voltage. The thing to watch out for with ceramics is that the dense ones are made from a material that is non-linear, which shows up as a reduced capacitance at the higher ends of the voltage range.
Added about microphonics:
Some dielectrics physically change size as a function of the applied electrical field. For many, the effect is so small that you don't notice and it can be ignored. However, some ceramics exhibit a strong enough effect that you can eventually hear the resulting vibrations. Usually, you can't hear a capacitor by itself, but since these are soldered fairly rigidly to a board, the small vibrations of the capacitor can cause the much larger board to also vibrate, especially at a resonant frequency of the board. The result can be quite audible.
Of course, the reverse works too since physical properties generally work both ways, and this one is no exception. Since applied voltage can change the dimensions of the capacitor, changing its dimensions by applying stress can change its open-circuit voltage. In effect, the capacitor acts as a microphone. It can pick up the mechanical vibrations the board is subjected to, and those can make their way into the electrical signals on the board. These types of capacitors are avoided in high sensitivity audio circuits for this reason.
For more information on the physics behind this, look up properties of barium titanate as an example. This is a common dielectric for some ceramic caps because it has desirable electrical properties, particularly fairly good energy density compared to the range of ceramics. It achieves this by the titanium atom switching between two energy state. However, the effective size of the atom differs between the two energy states, hence the size of the lattice changes, and we get physical deformation as a function of applied voltage.
Anecdote: I recently ran into this issue head-on. I designed a gizmo that connects to the DCC (Digital Command and Control) power used by model trains. DCC is a way to transmit power but also information to specific "rolling stock" on the tracks. It is a differential power signal of up to 22 V. Information is carried by flipping the polarity with specific timing. The flipping rate is roughly 5-10 kHz. To get power, devices full wave rectify this. My device wasn't trying to decode the DCC information, just get a little bit of power. I used a single diode to half wave rectify the DCC onto a 10 µF ceramic cap. The droop on this cap during the off half-cycle was only about 3 V, but that 3 Vpp was enough to make it sing. The circuit worked perfectly, but the whole board emitted a quite annoying whine. That was unacceptable in a product, so for the production version, this was changed to a 20 µF electrolytic cap. I originally went with ceramic because it was cheaper, smaller, and should have a longer life. Fortunately, this device is unlikely to be used at high temperatures, so the lifetime of the electrolytic cap should be a lot better than its worst case rating.
I see from the comments there is some discussion about why switching power supplies sometimes whine. Some of that could be due to the ceramic caps, but magnetic components like inductors can also vibrate for two reasons. First, there is force on each bit of wire in the inductor proportional to the square of the current thru it. This force is sideways to the wire, making the coil vibrate if not held in place well. Second, there is a magnetic property similar to the electrostatic piezo effect, called magnetostriction. The inductor core material can change size slightly as a function of applied magnetic field. Ferrites don't exhibit this effect very strongly, but there is always a little bit, and there can be other material in the magnetic field. I once worked on a product that used the magnetostrictive effect as a magnetic pickup. And yes, it worked very well. |
H: How to use an audio codec as an ADC?
I would like to add ADC functionality to a TI C6748 dev board. I need 16bit precision, but relatively low sample rate(~5K).
Not finding any suitable daughter ADC card, I am considering the possibility of making use of the on board stereo codec TLV320AIC3106. I notice its analog input voltage range is quite limited (-0.3V ~ 0.3V). But my input voltage range is 0~5V.
Do I just need to scale the signal amplitude such that it falls into [~0.3V ~ 0.3V] range? Any other implications that using an audio codec as a general purpose ADC?
AI: You just need to scale the voltage and adjust the DC offset (if needed). There is an important thing to know when doing this, however.
Audio ADC's often have high pass filters, two of them actually. The first is a cap in series with the signal path. The second is a digital filter that is inside the ADC. These filters usually remove anything from 0 to 10 Hz, but sometimes it could be as much as 0 to 200 Hz. Sometimes you can disable these, but usually not. If you are using the ADC for non-audio this might be a problem for you. |
H: What microcontroller can connect directly to a USB port?
Essentially, I just need to send some data to the microcontroller via USB, then the microprocessor decodes the data and drives an LED light strip, which runs at 5V. I'm having trouble finding the right microcontroller for the job.
The microcontroller just needs to have 2 serial in ports for USB communication, two serial out ports for communication with the LED strip, and be able to operate at 5V. It seems unnecessary to have a dedicated IC for USB communication when all I need is a serial COM port set up.
For example, here is the snippet of Arduino code that writes a byte to the LPD8806 strip:
void write8(uint8_t d) {
for (uint8_t i=0; i<8; i++) {
if (d & _BV(7-i))
digitalWrite(dataPin, HIGH);
else
digitalWrite(dataPin, LOW);
digitalWrite(clockPin, HIGH);
digitalWrite(clockPin, LOW);
}
}
To latch the data you send zeros to the strip.
AI: I guess that by "two serial out ports" you mean one UART (since you also describe USB as 2 ports). Rocketmagmet indicates that many/most LED strings use SPI, but that will need at least 3 wires. Can you specify which protocol you need?
In general Microchip has the lowest cost microcontrollers, also this time. And Microchip has many microcontrollers in DIL package as well, while many others have ditched that. May be important for DIY. The PIC18F13K50
exists in both DIL-20 and SMT packages
works at 5 V (for interfacing with the LED strip)
is low cost at $2.5 (OK, that's relative, but USB able controllers are a bit more expensive than more basic types)
has Enhanced USART for UART interface
has an SPI interface in case you meant that
has 25 mA source and sink I/O, so you can directly drive a couple of indicator LEDs if needed
Further reading
USB Generic Function on an Embedded Device, Microchip Application Note AN1166 |
H: What is wrong with my D flip-flop toggle switch?
Until a few weeks ago, I had never drawn a circuit diagram in my life, so bear with me. I am currently trying to design (in Logisim) a circuit that acts like a toggle switch, using only basic logic gates and no clock. Basically, I want the LED output to turn on when the SINGLE button is pressed and off when it is pressed again, and I have been experimenting with all manner of SR latch/D latch/other combinations to no avail.
I am trying to do it now by making a D flip-flop from scratch, with the button serving as the "clock" and the final Q' output looping right back around as the D input in the first latch, as shown in the picture:
I've looked over this flip-flop very carefully, and I thought I had the master and slave lined up correctly, with the inverters in the correct places, etc., but according to Logisim, it is not correct and doesn't work. What am I missing here?
AI: I duplicated your circuit in Logisim (as an opportunity to do something in Logisim). There's nothing wrong with your circuit. There is something about Logisim I don't understand.
First off, the red lines are not lines in a high state; they are errors. One would expect this sort of error if two outputs were tied together. I did a bunch of breaking the circuit and tying lines high or low, and eventually, all the errors were "flushed out" and reconnecting the circuit normally produced the toggling it was designed to do.
Specifically, break the upper leftmost wire, the one that connects Q' to D, then connect D to a high or low source ("pull resistor" works well here), and toggle it until it's all green. Then, reconnect the feedback, and it will all work. Note that high and low are represented by green and dark green (?).
Pressing "Reset Simulation" will bring all the errors back. My guess is, that somewhere in the logic of the program, it has an "undefined state". These undefined states propagate through the gates to the extent that they don't "sort themselves out" the way real electronics do. Undef AND 0 should result in 0, not Undef. Same goes for 1 OR Undef.
Just in case this has been addressed in a later version, I'll note this Logisim is 2.7.1
Update: I "fixed" the problem (within the scope of this simulator, anyway) by inserting a NOR gate in the feedback path. Then connect a pushbutton to the other input. I replaced the original button with a clock signal (found under "wiring"). Now, pressing the button clears the error. (Resetting the logic brings the error back). |
H: Testing a 0.3W, 8ohm speaker?
I have a 0.3W (RMS), .8ohm speaker coil + cone that I want to test using various music. However, the 8ohm impedance is lower than typical earbuds (24ohm), and also I can't find headphone jack power specs for my computer (Macbook Air 2010) or phone (Nexus S), so I'm worried I'll blow out my speaker sample.
I found this amplifier that's for 8ohm speakers, but it outputs up to 20W! I could turn it to its lowest setting but I'm worried that in tweaking the volume I'd accidentally exceed the speaker's rating just by the error of my hand's motor control abilities. Could I use that amp plus a current limiter, or will its digital electronics become under-currented?
Alternatively, if I can find a "powered / active speaker" product such as for desktop computers which happens to have a 0.3W, 8ohm coil internally, I could just swap out the coil. Know any?
Last resort would be to breadboard an amplifier circuit myself based on an 8ohm-load, 0.3W amplifier IC like the LM4864MM, but that's extra work just for a throwaway test circuit.
What is the laziest way to safely accomplish this test?
AI: Don't be so shy.
0.3W is pretty loud! And don't forget that audio equipment potentiometers are logarithmical ones, so when you turn it halfway, it is roughly one tenth of the output power. So a 20W amp, driven with its rated RMS input signal would output 2W RMS when turned up halfway. A quarter setting would result in 0.2W RMS accordingly. And you said you'd want to test with music - rated music power is around 2x the rated RMS power for most of the speakers.
Don't fret, speakers are quite difficult to destroy in so low power situations. I did try with a PC speaker and a ~20W amp when I was young and feeble, to the point when it got quite warm on the outside - but no pops (it was horrible, by the way)... Ok, PC speakers are not too flimsy. I did build a tube amp from scrap parts, and on that I regularly used a way too -electrically- underrated speaker, and to make the situation even worse, I used it as a guitar amplifier - driven into the maximal power tube saturation I could achieve...
If however you'd want a professional approach, use an LM386 power op-amp to play with, a few external components and you are ready to go. I think that is far easier to obtain than an impedance matcher transformator - not to mention, it degrades and colours the sound a lot less.
LM386 datasheet |
H: First Order RL Circuit
In figure 8.21 $$ R_1 = 50 , R_2 = 200 , L = 2 H$$
Voltage is given by $$ V_{in}(t) = V_{s1}u(-t) + V_{s2}u(t) $$ where $$V_{S1} = -10 V , V_{S2} = 20 V$$
a) Find $$ I_L(0^+) $$ and $$ I_L(t)$$ for t > 0
So far, I haven't done anything because I don't know what to do first. Some hints would appreciated.
AI: Knowing that an inductor will initially behave as an [open][short](pick one) circuit will answer the behavior at t=0+.
Knowing how the inductor behaves at t = infinity will let you find the asymptotic value of IL.
Figuring out the time constant of the circuit will let you fill in the time in between. |
H: Interfacing signals between two parts at different voltage levels
I would like to connect four output pins of a certain IC to four input pins of an AVR microcontroller (Atmega328).
I'm running the IC at VCC that varies between 3.50V and 4.00V. It outputs signals (for status indication) with an Output High spec of V_HIGH = VCC - 0.30, per the datasheet. Thus, in my case, minimum V_HIGH for an output signal from this IC will vary between 3.20V and 3.70V.
But I'm running my microcontroller at VCC = 3.30V, and I want it to read the inputs from the IC above (and not damage the microcontroller obviously).
What is a robust, hopefully simple, way to address this problem?
I am thinking perhaps a diode, to create a voltage drop, in series with each of the signals.
AI: Well, the old fashioned way is using a resistor and a Zener diode of appropriate voltage (mind the polarity!), but if you really wamt a professional solution, I think this would cut it:
5V <-> 3.3V bidirectional level converter
EDIT: you wrote:
Thus, in my case, V_HIGH for an output from this IC will be 3.70V.
Which is not correct. I think that it is meant that it is at least 3.7V, but it might as well as be as high as VCC, which is 4V. (I'm not sure if this sentence is correct English though)
My experiences (ahem, mistakes, to be totally honest) show that these devices tolerate decent amounts of abuse, but I wouldn't intendedly run it under these conditions without level matching.
EDIT2: it's late, and I forgot the most obvious solution: a simple voltage divider on the pins. Especially as they are output only - this should be OK. Be careful with the values though, use resistors so that the lowest HIGH level on the output side should result in a voltage higher than the lowest HIGH level specified on the sensing side, but the highest levels shouldn't result in voltages higher than the specification on the receiver side. |
H: Determine 4p4c wiring
I tried to make this as thorough as possible. I have a 4p4c socket + cable here. As there is no manual for german wiring I had to measure each wire against each other wire while hearing the "ready to dial" tone to find it out, but I am still clueless.
This is what I got
12--0.4V-DC
13--4.2V-DC
14--0.2V-DC
21-0.37V-DC
23-0V-AC
24-0.1V-DC
31-0.4V-DC
32-0.001V-DC
34-0.2V-DC
41-0.2V-DC
42-0V-DC
43--0.2V-DC
Explaination:
1 means white
2 green
3 yellow
4 brown
First number is one of the colors I put the mass of my oscilloscope to.
Second number is the color/wire I put the signal of my oscilloscope to.
one "-" is meant for separation
Then the value follows
Then the unit follows
one "-" is meant for separation
then there is the type of voltage/current measured
So for instance
43--192mV-DC
means
GND to brown, signal to yellow, result: -192mV, type of voltage/current measured: DC
or
42-5.7mv-AC
means
GND to brown, signal to green, result: 5.7mV, type of voltage/current measured: AC
Please tell me, which cable go to speaker and which to microphone. Also, do I need additional circuitry? In the english wikipedia there is a 500 ohms resistor. Do I need this, what is it for and where to put it?
AI: UPDATE:
On rereading it's not obvious where you are connecting this or what it is you are connecting.
If this is a headset cord (as it seems to be) then what I said about voltages is wrong.
What are you connecting to what?
OLDER:
Nothing makes sense.
If this is to a "central Office" you should have 50V DC somewhere.
If to a PBX possibly 25 VDC or lower.
1,3 = 4.2V and 3,1 = 395 mV suggests that you are grounding the signal with your scope ground in the second case. You need a differential probe or isolated scope or measurements relative to ground.
Connecting ground to one wire will unbalance a feed circuit and allow induced noise from all over. Balanced load or feed must be used.
Use a magnetic earpiece of around 1000 Ohms or a high impedance one with a say 470 Ohm resistor across it. Connect to 2 wires at a time and listen for dial tone. Go from there. |
H: How to determine the value of termination resistor?
How to determine the value of the termination resistor? Is the termination resistor used to reduce the reflection of the signals and also have to match with the transmission impedance? How am I going to determine the transmission impedance in order to put appropriate value of termination resistor in series with the load?
AI: I'll assume you're talking about a trace on a pcb so you're looking at either a strip line or a microstrip. The basic impedance is a function of the trace width, the distance of the trace from it's reference plane, and the type of dielectric material between the trace (FR4 for example).
Try one of these calculators http://www.eeweb.com/toolbox/microstrip-impedance
If you are trying to match your driver to a line you'll want to find out the output impedance of the driver. Then that plus your termination resistor should match your line impedance.
Your best bet is to try to consult the datasheet, or ask your vendor. Otherwise if you have access to sim models you should be able to extract. If you happened to have a tdr lying around you could measure it :)
You could also find by connecting a known resistor to gnd and driving the driver high. If you can measure the current used you can use Ohms law to calc the source impedance. You can that in spice too.
Good luck |
H: MOSFET switch with two on/off momentary buttons -- asking for critique
I want a "power button" that is actually two buttons; one on, one off.
This needs to switch on the order of 15 V and up to 10 A, for a LiFePO4 battery powered device.
I don't want to use a hardwired switch where this is mechanical, because I later also want soft (MCU-based) control of the same on/off functions.
I don't want to use a relay because 60 mA for a typical coil current is a lot (the typical load is perhaps 500 mA, but peak load on the device is 10 A.)
This is the best I could come up with. De-bouncing the buttons is not needed. When first connected, I think it enters "off" state because the gate is weakly pulled to ground through the load (output) -- and even if it isn't, the main power P-channel FET isn't going to have any gate charge.
I'm asking for two things here:
If you want to spend a few minutes helping out a poor n00b on circuit design, please critique this design and suggest whatever you think needs improving in this circuit. (Three FETs? really?)
If you think my diagram is hard to read (I got that last time :-) then please at least critique exactly what you think is poor about the diagram, so that I can better communicate in the future.
Thanks in advance for any help!
AI: Could it be that what you had in mind was this?
Purpose of components:
Q5 - P-channel MOSFET, high side power switch
SW1 - momentary normally open OFF switch, which drives the gate high. Since it's connected directly to the gate of
Q5, it will overpower the ON switch, which is connected through 1kΩ.
R32 - pull up, makes sure that the circuit is off when it's not on.
SW2 - momentary normally open ON switch. When pressed, the gate of Q5 is driven low and Q5 starts to conduct. Output drives the gate of Q12 high.
Q12 - N-channel MOSFET, keeps the gate of Q5 low when SW2 is released and SW1 not pressed.
R30 - pull down, makes sure that the output is pulled to ground when the circuit is off and load is disconnected. Because of R30, the gate of Q12 can't float up and turn the circuit on spontaneously. |
H: How do the open loop voltage gain and closed loop voltage gain differ?
The closed-loop gain of op-amp is calculated by the ratio of Vout/Vin. What about the open-loop gain? How does the value of open-loop gain and closed-loop gain affect the performance of op-amp ? What is the relationship between open-loop and closed-loop gain of op-amp?
AI: Closed loop gain is the gain that results when we apply negative feedback to "tame" the open loop gain. The closed loop gain can be calculated if we know the open loop gain and the amount of feedback (what fraction of the output voltage is negatively fed back to the input).
The formula is this:
$$ A_{closed} = \frac{A_{open}}{1 + A_{open} \cdot Feedback} $$
The open-loop gain affects the performance generally like this. Firstly, look at the above formula. If the open loop is huge, like 100,000, then the 1 + does not matter. \$A_{open} \cdot Feedback\$ is a large number, and it doesn't matter whether or not we add 1 to this large number: it is like a drop in a bucket. Thus the formula reduces to:
$$ \begin{align}
A_{closed} &= \frac{A_{open}}{A_{open} \cdot Feedback} \\
&= \frac{1}{Feedback}\\
\end{align}
$$
So, with a huge open-loop gain, we can easily get the closed loop gain if all we know is the negative feedback: if it just the reciprocal. If the feedback is 100% (i.e. 1) then the gain is 1, or unity gain. If the negative feedback is 10%, then the gain is 10. With a huge open-loop gain, we can precisely set up gains: as precisely as we care to design and build our feedback circuit. With open-loop gain which is not that large, we may not be able to ignore that 1 +. All the more so if \$Feedback\$ is small.
Okay, so far that's more of an issue of clean math and design convenience. Big open loop gain: closed loop gain is simple. But, practically speaking, small open-loop gains means that you must use less negative feedback to achieve a given gain. If the open loop-gain is a hundred thousand, then we can use 10% feedback to get a gain of 10. If the open loop gain is only 50, then we must use much less negative feedback to get a gain of 10. (You can work that out with the formula.)
We generally want to be able to use as much negative feedback as possible, because this stabilizes the amplifier: it makes the amplifier more linear, gives it a higher input impedance and lower output impedance and so on. From this perspective, amplifiers with huge open loop gains are good. It is usually better to achieve some necessary closed loop gain with an amplifier that has huge open loop gain, and lots of negative feedback, than to use a lower gain amplifier and less negative feedback (or even just an amplifier with no negative feedback which happens to have that gain open loop). The amp with the most negative feedback will be stable, more linear, and so on.
Also note that we don't even have to care how huge the open loop gain is. Is it 100,000 or is it 200,000? It doesn't matter: after a certain gain, the simplified approximate formula applies. Amplifiers based on high gain and negative feedback are therefore very gain-stable. The gain depends only on the feedback, not on the specific open-loop gain of the amplifier. The open loop gain can vary wildly (as long as it stays huge). For instance, suppose that the open loop gain is different at different temperatures. That does not matter. As long as the feedback circuit is not affected by temperature, the closed-loop gain will be the same. |
H: What is inside a telephone handset?
Possible Duplicate:
Determine 4p4c wiring
This might sound highly trivial, but search in google for it, you won't find a circuitry.
So what does a handset's circuitry look like?
And: What's the wiring for german 4P4C connectors? This is - you might not believe it - not in google.
AI: "you won't find a circuitry"
Sure you will. It took me less than a minute to find this
on Wikipedia. |
H: pull up resistor issue?
I have three i2c devices connected to AVR microcontroller. On the i2c bus on master side there are two pull ups with 2k7 ohm.
What im experiencing is that when i power up the microcontroller devices cannot "drop the line"/initialize. After reseting the uC, everything is ok. On the startup routine of uC there are some initializations that takes around 100ms.
Could this be because of pull-up values or should i wait for more time for initialization ?
UPDATE: Internal pull-up is disabled. Using pull-up for each line.
AI: I don't think there's anything wrong with the pull-up value. I2C drivers mus be able to sink at least 3 mA, and the minimum of 2 kΩ is determined with that in mind: 3 mA through 2 kΩ is enough to pull a 5 V bus voltage all the way to ground.
It looks to me that the I/Os haven't been properly initialized after power-on. Are you sure the reset did its work properly? Does the AVR have an internal reset (you don't mention which type you're using, and I'm not going to read dozens of datasheets), or do you have an RC circuit on an external reset pin, or maybe a reset controller like the MAX809?
I would suggest to add some code which indicates proper reset, like for instance a LED blinking at 2 Hz. Do the initialization for the blinking immediately after the initialization of the I2C. If the LED blinks the port will be properly initialized, most likely not if the LED doesn't blink.
Further reading
I2C-bus specification and user manual
Using the TWI module as I2C master, Atmel Application Note AVR315
Using the TWI module as I2C slave, Atmel Application Note AVR311 (for completeness :-)) |
H: Is unshielded untwisted pair cabling fine for audio?
Noob here just trying to work out if there's much difference between the various types of cabling for use in connecting amps to speakers. I have unshielded untwisted pair cabling here at the moment.
AI: For the connection to the speakers it's fine, for connecting audio sources to the amp's input it's not.
Both shielding and twisting's purpose is to keep noise from your signal. For shielding this will be obvious. Twisting requires some imagination. Suppose a magnetic field, for instance from a motor, may induce a current in the wires, depending on the field's direction.
Here the currents are induced counterclockwise. In the left twist that's to the right for the red wire. But half a twist further the red wire is at the top and a counterclockwise current will go to the left, cancelling the current induced in the other half twist.
Why doesn't a speaker's cable need the shielding or twisting? The susceptibility depends on the cable's impedance: a low impedance like a speaker (8 Ω) will take all the energy out of the noise, neutralizing it. A 100 nA induced noise current would give you 4.7 mV noise across a 47 kΩ input impedance, but that same 100 nA is less than 1 µV worth in the 8 Ω speaker. On top of that: a speaker's signal has a much higher level than the input signal, so the noise will be relatively lower.
The most important for a speaker cable is it's low resistance. don't use thin signal wires.
When you go shopping for speaker cable you'll see OFC cables, for Oxygen-Free Copper. The seller will tell you that it sounds better, and it will only cost you up to 100 dollar per meter(!). If you want to be swindled you definitely have to buy it. Purists will claim they hear the difference, but that is absolutely impossible. Nobody in a double-blind test could ever tell the 100 dollar OCF cable from an average 2 dollar cable. And it will never happen either.
Pick a cable with a polarity indication, so that you're sure you connect both left and right speakers with the same polarity. |
H: What's the best approach to implementing a remote control lock?
I was thinking how I would go about building a remote control lock with an Arduino (or better yet a Raspberry Pi when I get one) and thought I'd check to see if any were available for sale. Schlage has something at a ridiculously high price with a monthly fee of $9-$13 or so. Insanity!
So I'm back to thinking about building one myself. I'm thinking the Pi would have its own web server and wifi interface to connect to my router. I'm pretty sure I can mange the software side of things but need some direction on the hardware.
How would you do it, if you were going to build one? What other hardware would I need to lock and unlock the door? A servo? A general purpose lock that I modify? How?
AI: This is not a hard project. Firstly you'll need to get an electronic lock.
They're pretty cheap (less than £20). These kind of locks require 12v to operate. An arduino can't directly provide this kind of voltage, or even the kind of current required by the lock, so you'll need a driver to interface.
Whenever I need a driver for this level of current and voltage (and especially if it's an inductive load as this is) then I always reach for my trusty ULN2803. It has 8 high current drivers, which is overkill here, but at least it gives you the option of actuating loads of locks. The other benefit of the device is that it has inbuilt diodes to cope with the inductive kickback when the lock switches off. |
H: Does the size of the data bus control the maximum value the CPU can process?
I know the data bus size defines the size of the processor, but can the processor actually process data above that limit?
Would really appreciate some explanation on this.
AI: The external data-bus width doesn't always agree with the processor's internal structure. A well-known example is the old Intel 8088 processor, which was identical to the 16-bit 8086 internally, but had an 8-bit external bus.
Databus width is not a real indicator of the processor's power, though a less wide bus may affect data throughput. The actual power of a processor is determined by the CPU's ALU, for Arithmetic and Logic Unit. 8-bit microcontrollers will have 8-bit ALUs which can process data in the range 0..255. That's enough for text processing: the ASCII character table only needs 7 bits. The ALU can do some basic arithmetic, but for larger numbers you'll need software help. If you want to add 100500 + 120760 then the 8-bit ALU can't do that directly, not even a 16-bit ALU can. So the compiler will split numbers to do separate calculations on the parts, and recombine the result later.
Suppose you have a decimal ALU, which can process numbers up to 3 decimal digits. The compiler will split the 100500 in 100 and 500, and the 120760 into 120 and 760. The CPU can calculate 500 + 760 = 260, plus an overflow of 1. It takes the overflow digit and add that to the 100 + 120, so that the sum is 221. It then recombines the two parts so that you get the final result 221260. This way you can do anything. The three digits were no objection for processing 6 digits numbers, and you can write algorithms for processing 10-digit number or more. Of course the calculation will take longer than with an ALU which can do 10-digit calculations natively, but it can be done.
Any computer can simulate any other computer.
The humble 8-bit processor can do exactly what a supercomputer can, given the necessary resources, and the time. Lots of time :-).
A concrete example are arbitrary precision calculators. Most (software) calculators have something like 15 decimal digits precision; if numbers have more significant digits it will round them and possible switch to mantissa + exponent form to store and process them. But arbitrary precision expand on the example calculation I gave earlier, and they allow to multiply
\$ 44402958666307977706468954613 \times 595247981199845571008922762709 \$
for example, two numbers (they're both prime) which would need a wider databus than my PC's 64-bit. Extreme example: Mathematica gives you \$\pi\$ to 100000 digits in 1/10th of a second. Calculating \$e^{\pi \sqrt{163}}\$ \$^{(1)}\$ to 100000 digits takes about half a second. So, while you would expect working with data wider than the databus to be taxing, it's often not really a problem. For a PC running at 3 GHz this may not be surprising, but microcontrollers get faster as well: an ARM Cortex-M3 may run at speeds greater than 100 MHz, and for the same money you get a 32-bits bus too.
\$^{(1)}\$ About 262537412640768743.99999999999925007259, and it's not a coincidence that it's nearly an integer! |
H: Voltage, Ampere and and Ohm of a DC motor
This might be a quite simple question. I have a small DC motor (it seems to be this one). This webpage suggests that it needs 6V. I have a power supply which outputs 6V and writes "0.6A". But when I connect to the DC motor it does not turn. Neither with 12V (with the same power supply set to 12V). I tried a power supply with 24V and "600mA". The DC motor works with the 24V power supply, but it turns really fast (probably too fast).
Is it possible that 7,2VA from the 12V-power supply are too few? So the voltage is ok, but it needs more power? Can measure the resistance of the DC motor and use Ohm's law to calculate the amount of Ampere the DC motor needs?
Update: The motor writes RS-54ORH DC491509, that's why I suppose it is the one I linked above. And it actually needs a few Ampere to run! But 6V seem to be ok.
AI: The motor will require a startup current which is quite a bit higher than running current, so it's very possible 600mA is not enough (I can't determine the size from the photo - some measurements would be useful so a rough comparison with similar sized motors can be done)
Is there a voltage/current rating plate on the motor? Does it have a model number printed on it?
What makes you think it is this specific motor? There are many that look exactly the same.
Anyway, if you really can't find out any more about it, then you will have to do a few tests:
If you have a scope (or multimeter but will be a bit trickier) then measure the voltage across the power supply, then connect the motor. If the voltage sags significantly (e.g. more than a volt or two) then it's quite likely the motor is trying to sink more current than the supply can provide.
Also, test the winding resistance. Divide the operating voltage by this and you will get an idea of the startup current. It's possible a large capacitor or two across the supply (e.g. let cap charge, then use a series switch to turn motor on) might help it get started if it's not too far off the mark power wise.
Here is a table of data for a 6VDC motor picked at random:
You can see that the starting current is 3.51A, which is about 4 times the max continuous current of 0.84A. If we look at the winding resistance of 1.71Ω, we can see that 6V / 1.71 = 3.51A, so this if your peak startup current (before any back EMF develops)
The measurements for this motor are 22mm diameter and 32mm length. If your motor is a similar size or bigger then it is quite possible it is of a similar or higher power rating and too much for the power supply (although this is obviously far from certain given the widely varying type/quality of motors) |
H: What is the origin of on and off power switch symbol?
I know I (line) and O (circle) symbols are used to specify a switch that turn on and off the power supply.
My question is What is its origin?
Because I thought that it represent a power line that can be plugged (on symbol) and a closed line (and thus without power supply) but seen that in Wikipedia said that it can come from 1 and 0 used in binary to represent on and off bits, I don't know what is the correct answer.
Note: In Wikipedia, it didn't have verified sources, so I need other source.
AI: I'm pretty sure it comes from the binary 1 (on) and 0 (off)
It's an IEC standard symbol, the on symbol is IEC-5007 and the off symbol is IEC-5008
The full standard document they come from is IEC 60417, which you have to pay for, but here is a small reference document with just the power symbols reproduced. |
H: Is a switch considered an active component?
Most of the definitions of "active" components that I have found define them as components able to control current flow. A switch fits this definition, but I am just curious to see opinions on this.
AI: A switch is a passive component.
The main difference between active and passive, is that active components require a power source to perform their function, i.e. using electricity to control electricity as in a transistor. They can be a source of power in the circuit or provide an electrical switching function. They can provide amplification, whereas a passive component cannot.
So Valves(Tubes), Transistors, SCRs, LEDs, Diodes, ICs, etc are all active devices.
Passive devices are things like Resistors, Capacitors, Inductors, Transformers, Thermistor, Speaker, Microphone, etc.
To be honest I think the definition is a bit muddy, and I've never seen a formal definition that satisfies me completely, but the above is the usual sort of answer. For example, take the diode - this often causes a bit of debate on how it should be classified (I think it probably has to be an active device) Either way I think it doesn't really matter much as long as you get the general idea. |
H: Deciphering Part Names in BOM
I need help deciphering a BOM that comes with a particular TI reference design. If you look at "Partlist.rep" in the zip file, it looks something like this [I've edited it down a bit]:
R1 Resistor 0402 R_270_0402_F
R2 Resistor 0402 R_2_0402_F
R4 Resistor 0402 R_4K7_0402_G
R8 Resistor, 0402 R_0_0402
L235 Inductor 0402 L_12N_0402_J
L236 Inductor 0402 L_1N8_0402_S
C1 Capacitor 0603 C_1U_0603_X5R_L_6P3
C2 Capacitor 0603 C_4U7_0603_X5R_K_6
C4 Capacitor, 0402 C_47P_0402_NP0_J_50
C121 Capacitor 0402 C_100N_0402_X5R_K_10
C191 Capacitor 0402 C_10N_0402_X7R_K_25
C214 Capacitor 0402 C_22P_0402_NP0_J_50
C231 Capacitor 0402 C_1P0_0402_NP0_C_50
C261 Capacitor 0402 C_220P_0402_NP0_J_50
C291 Capacitor 0402 C_100N_0402_X5R_K_10
C301 Capacitor 0402 C_1U_0402_X5R_K_6P3
I have some questions about interpreting part names:
Resistors: "R_270_0402_F" is a 270 Ohm resistor, 0402 package. But what does the 'F' signify? How about 'G', or the lack of a letter at all? Do these have something to do with tolerances, or type (thick film, thin film, etc.) ?
Inductors: "L_1N8_0402_S" is a 1.8 nH inductor in an 0402 package. What does the 'S' indicate? Or the 'J' ?
Capacitors: "C_1U_0402_X5R_K_6P3" is a 1 μF capacitor in an 0402 package. "X5R" ("X7R", "NP0") refers to the type/temperature characteristic. The following are educated guesses from reading datasheets: 'K' refers to capacitance tolerance: K = +/-10%, J = +/-5%, C = +/-0.25pF. Am I correct, and what about 'L'? The final number must refer to rated voltage, (10 = 10V, 25 = 25V, etc.) I assume "6P3" mean 6.3V.
Thanks for your help.
AI: According to wikipedia the letter at the end of the resistor part number is its the MIL tolerance designation. Copied table below:
±5% J
±20% M
±10% K
±2% G
±1% F
±0.5% D
±0.25% C
±0.1% B
This page indicates that the letter is also the tolerance code for inductors.
Unfortunately I haven't got a clue what the extra L for capacitors is for (perhaps ask TI support?). |
H: Setting a part's VCC slightly lower than board's supply voltage
I'm interested in using the undervoltage detection feature (in addition to the primary function) of this chip. This IC draws 6 uA (microamps), and accepts any VCC between 1.6V and 5.5V.
The undervoltage detection works like this: When VCC of this IC is below V_threshold, it will declare an undervoltage condition and set a LOW on its "Enable" Output Pin.
Now, the problem is this:
While the IC is available with multiple variants of V_threshold, the only available variants available are V_threshold = 2.0V, 2.9V, 3.1V, or 3.3V at most.
However, I wish to cut-off at threshold of 3.5V. I'm using a Lithium ion battery to supply the VCC pin of the IC; the battery's supply voltage would range from 4.1V (maximum) to 3.5V (my desired cutoff).
So, for the above situation in particular, which of the following options (or something else) might be the best solution for creating a smaller voltage locally for the IC's VCC, and why?
Choice 1) A diode? To create a constant drop between the battery source and the VCC pin of the IC.
or Choice 2) A resistive divider? To set a proportionally smaller voltage at the VCC pin of the IC.
or Choice 3) An LDO regulator? With 3.3V output, placed between the battery source and the VCC pin of the IC.
AI: Go ahead and use the variable resistor suggested by Reid if your project is a one-off sand box project. If you are designing a product where you will be building many of these then I would select a resistor voltage divider made up of precision resistors (0.5 or 1% types are good for this application as the detector has a 1% tolerance). The two resistors in series will connect from battery supply to GND. The junction between the two resistors would connect to the V+ pin of your voltage detector. Pick the two resistors so that when the battery supply is just at 3.5V that the divided voltage (using the standard voltage divider equations) to the detector is just at 2.0 volts. Deploy the 2.0V version of the detector in your circuit. Also select the size range of the voltage divider resistors so that the current is approximately 15 to 20 times greater than the current draw of the detector so that the current drawn by the detector can be ignored when computing the divider ratio.
You want to use resistors like this so that when the battery discharges slowly during use that the divided voltage tracks linearly down along with the battery. At the computed threshold point the battery at 3.5V will trigger the under voltage detector at 2.0V.
Using an LDO is not appropriate because the LDO would give a constant output irregardless of the battery voltage. A diode to offset the battery voltage to the detector would work if you could find an almost perfect diode with the correct forward voltage drop but sadly perfect diodes are hard to find. The resistor divider is a much lower cost approach and will work nicely in this application. |
H: MSP430 programming under Linux - mspdebug fails to connect to programmer
I am trying to program the MSP430 (on an MSP-EXP430F5438 evaluation board) under Linux using gcc-msp430 (I eventually will do code larger than the 16k that the free version of the Code Composer allows).
As a debugger, it is recommended to use mspdebug, but when I try to use it, it doesn't connect to the FET430UIF.
~$ sudo mspdebug uif
MSPDebug version 0.19 - debugging tool for MSP430 MCUs
Copyright (C) 2009-2012 Daniel Beer <[email protected]>
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
TI3410 device is in boot config, setting active
Initializing FET...
FET protocol version is 20408002
Configured for Spy-Bi-Wire
ti3410: usb_bulk_read: No error
warning: fet: set VCC failed
ti3410: can't send data: No such device
fet: command C_IDENT1 failed
fet: identify failed
Trying again...
Initializing FET...
ti3410: can't send data: No such device
fet: open failed
ti3410: warning: TI_CLOSE_PORT failed: No such device
The same device works correctly with Code Composer running on a Windows virtual machine or on a physical Windows system, so I know it is working.
I tried on Ubuntu 12.04 and on Arch Linux and got the same errors.
As recommended in an answer, I tried with -d and got further, but didn't work:
~$ sudo mspdebug uif -d /dev/ttyUSB0
[sudo] password for renan:
MSPDebug version 0.19 - debugging tool for MSP430 MCUs
Copyright (C) 2009-2012 Daniel Beer <[email protected]>
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Trying to open UIF on /dev/ttyUSB0...
Initializing FET...
FET protocol version is 20408002
Configured for Spy-Bi-Wire
Set Vcc: 3000 mV
Device ID: 0x0580
Device: MSP430F5438A
Code memory starts at 0x5c00
Number of breakpoints: 8
uif: read error: Connection timed out
fet: warning: message C_IDENT3 failed
uif: read error: Connection timed out
fet: message C_IDENT2 failed
fet: identify failed
Trying again...
Initializing FET...
uif: read error: Connection timed out
fet: open failed
What is wrong?
AI: This mail thread suggests that you need to specify the -d option like this:
$ sudo mspdebug uif -d /dev/ttyUSB0
They state that this is necessary for FET firmware 2.04.09.001 but not necessary for 2.04.05.003.
Your firmware is version 2.04.08.002. So this issue may affect you or it may not. |
H: Pulse-powering heavy loads with a coin cell
Lithium coin cells are rated for fairly low standard current draws, on the order of 1 to 5 mA. Also, while they allow greater pulsed current draws (i.e., periodic bursts), this appears to be detrimental to cell capacity (and also can cause a drop in the voltage during the pulse).
I am bringing up this topic out of interest in applicability of coin cells for general use-cases (such as LEDs or more recently low-power wireless transmission), so I don't have a specific circuit in mind.
But imagine two scenarios, one a low-duty cycle and one a more demanding case:
Case A: Load draws 25 mA for 25 milliseconds once every 2.5 seconds.
Case B: Load draws 50 mA for 100 milliseconds once every 1 seconds.
I'm interested in an analysis of whether a capacitor-based reservoir can be applied to (and thus, whether it is wise to) run either of the pulse-draw cases above off a coin cell.
Note 1: In both cases, I'm considering a generic situation with Coin cell --> 3.3V Boost regulator --> LOAD [microcontroller + LEDs with series resistors + Wireless module + etc]. And the Cap/Supercap parallel to the load supply.
Note 2: I'm aware that one could use Li-ion/LiPo batteries but they have higher self-discharge (whether due to their chemistry or due to their protection circuitry), so they may not be ideal for, say, a wireless temperature logger that transmits once every hour.
Relevant documents: The following datasheets show various pieces of information, including pulse discharge characteristics, operating voltage vs. load, etc.:
Energizer CR2032 Datasheet
Panasonic CR2032 Datasheet
Sony CR2032 Datasheet
Maxell CR2032 Datasheet
In addition, the following documents discuss some empirical assessment / qualitative discussions about running somewhat large loads (with peak current draw on the order of tens of milliamps) using a coin cell:
TI App note: Coin cells and peak current draw
Nordic Semiconductor App note: High pulse drain impact on CR2032 coin cell battery capacity
Freescale App note: Low Power Considerations for ZigBee Applications Operated by Coin Cell Batteries
Jennic App note: Using Coin Cells in Wireless PANs
AI: The calculation is straightforward. The capacitor size is simply a question of how much voltage drop you can tolerate over the duration of the pulse. The average current from the battery is a function of the duty cycle.
ΔV = I × Δt / C
Solving for C gives:
C = I × Δt / ΔV
Let's assume you can allow ΔV = 0.1V. For your first example, this works out to:
C = 25 mA × 25 ms / 0.1 V = 6.25 mF
The average current draw is 25 mA * 25 ms / 2.5 s = 0.25 mA.
For the second example, the numbers work out to:
C = 50 mA × 100 ms / 0.1 V = 50 mF
Average current = 50 mA * 100 ms / 1.0 s = 5 mA. |
H: voltage determining solenoid force?
I made a silly beginner's mistake: I purchased some surplus rotary solenoids from electronic goldmine without paying close attention to their power requirements ("Oh, they are so cheap!"), so I assumed they were 12v and reasonably powerful. There are no specs - just the catalog blurb (below).
Neither assumption is true, as it turns out. My benchtop power supply only goes to 30 volts and at that power, the solenoids have almost no force.
Before I try to find a 40 volt power supply, I'd like to know: will force increase by any significant amount with the increased voltage?
Of course a 40 volt power supply will probably cost more than just sourcing 12 volt solenoids but I thought I would ask.
AI: For devices like this, force is proportional to the square of the voltage, minus nonlinearities and losses.
So the force you'll get at 40 VDC is (40*40)/(30*30) or about 76% more than 30 VDC, assuming you're already in the zone that overcomes starting friction etc.
There's also a return spring -- that has a static force to overcome, so the equation may become:
(40*40*kL - kS)/(30*30*kL - kS)
kL is the "force of inductor based on squared voltage constant" and kS is "force of spring constant." You can see from this that the higher the kS, the more relative force you'll actually get out at 40 volts than at 30 volts.
That being said, check if your benchtop power supply can be bridged; mine does 30V single, but bridged it can go to 60V. |
H: What is semantics behind BJT and MOSFET transistor symbols?
I'm just wondering sometimes - is there any meaning behind the transistor symbols? I can kinda see that an arrow in BJT points to direction of conventional current flow in BJT and a capacitor on mosfet's gate, is it really so or am I halucinating?
AI: BJT:
the arrow represents the base-emitter junction, which acts as a common diode (remember the 0.7 V drop). So the arrow is like the arrow in the diode symbol.
MOSFET:
This dates back from the JFET days: in that case there's a gate-channel P-N junction, and the arrow points from the P to N doped silicon.
The three short lines indicate that it's an enhancement FET: they symbolize that the channel doesn't conduct when the FET isn't activated. In a depletion FET that will be one uninterrupted line, indicating that the channel does conduct when not activated; the FET is switched off by applying a gate voltage.
The line at the gate side symbolizes that the gate lays over the channel, forming a capacitor (a FET's operation is based on capacitance) with it. |
H: 3 phase induction motor with one phase
Possible Duplicate:
2 Phase to 3 Phase conversion
Is there a way to run a 3ph induction motor with one phase .
Basically I have 3ph motor but my power supply is only 2 phase . Is there anyway I can run it ?
Motor spec :
3ph
induction motor
Hi-tone
ref to is 325
FRAME 80 Duty S1 Hz 50 Insucl.cl.e
V 400/440 RPM 1440 AMP 1.9
K.W. 0.75 H.P 1 M.No : 11209
AI: Found this: http://www.nerdylorrin.net/jerry/ThreePhase.html. Looks like it's possible. |
H: Measuring high frequency current with Adrunio
Is there a way to measure the current of a high frequency signal (100Khz) with an Ardunio? I am thinking that some form of analog circuit could be made whose input takes AC current and whose output is DC current (or voltage), and that this would be readable by any uM's analog to digital inputs.
Edit: The waveform is a sine wave; the output of a chopper stepper driver. The average current is required and I don't expect more than 2 amps of current.
AI: You actually need to detect the envelope. It's useful to think of this as a demodulation problem, as that's what it is!
Send the current through a small sense resistor that feeds a difference amplifier or instrumentation amplifier. Then, feed that output through a precision full wave rectifier, followed by a low-pass filter.
If you don't rectify first, the low pass filter simply zeros everything out. Rectifying prevents this, giving a non-zero mean that moves with amplitude.
Similar processing is routinely done for electromyography signals (muscle-related electrical signals) which are very AC, but most folks are interested in some average activity. I've seen the rectification/low-pass arrangement called a "Paynter filter" in this particular case.
Filter at whatever corner frequency reliably tracks the changes you're looking for, then sample fast enough to avoid aliasing. Depending on what your corner frequency is, and what filter you use, you might have some phase distortion.
rectifier circuit from sound.westhost.com/appnotes/an001-f4.gif
As an aside, I've found this circuit to be trickier to use than it should be. Perhaps it needs faster diodes than I use, but a small cap across the feedback path of the first op amp seems to do wonders. |
H: What is wrong with my 2-bit adder?
I attempted to build an 8-bit adder in Logisim by carefully chaining together a half-adder and 7 full adders, all made from basic logic gates. Unfortunately, it produced erroneous results; for example, 00000011 + 00000011 = 000000100 ! I found that the problem seems to occur around the half-adder and the least significant bit, so I tried to pinpoint it with a smaller, 2-bit adder:
As you can see (unless I am going crazy), this one is off, too; s1 should also be lit! I can see why it's not lit; a0 and b0 produce a carry bit, which, along with a1 and b1 (or even if it DIDN'T carry), makes the XOR gate for s1 false. But from the book I am using, this should be the way to hook them up? What am I missing here?
AI: How does Logisim handle xor gates without exactly two inputs? A two-input xor gate should have an output which is true if one input is true and the other is false, but it's not completely unambiguous from just that description how that should be generalized to N inputs. The normal approach is to say that the output of an XOR gate of any size should be true if the number of "high" inputs is an odd number; I would consider any other meaning to be non-standard. Nonetheless, it's possible that Logisim is defining "xor(a,b,c)" as being "and(or(a,b,c), nand(a,b,c))" (meaning at least one, but not all, of the inputs is true). Split the 3-input xor into two cascaded two-input xor's and the circuit should behave normally. |
H: Manage Software Installs of your Semi Mass Manufactured Product
After you get an assembly house to put together your product:
what are the typical approaches to install your software on every one those product? Is this something the assembly house typically do?
Also, is normal to test every manufactured product?
AI: 1.) Order your flash pre-programmed from your supplier. Usually you can use JTAG to reprogram on the line if things change. Or maybe an ISP header connected to the flash lines if you don't have the JTAG option.
2.) Yes. Especially for smaller runs, or things that need more reliability. Sometimes with high volume consumer products you either test samples or do a simpler test. I'm a little obsessive so I usually have everything tested. At my US factory test time costs about $1/minute so I can afford it. |
H: What is this resistor for in this circuit?
I am studying electronics and I am currently reading/working my way through "Make: Electronics" by Charles Platt. Here is one of the circuit diagrams that he gives for making a basic burglar alarm:
My question is, what is the purpose of the 1K resistor after the switch. I understand the point of all the other components, but why does that resistor have to be there? I have re-read this part of the book a few times but it doesn't seem to mention why that resistor is there or what it does. Can it be omitted?
AI: The 10K and 1K resistors in the circuit form a voltage divider when the switch is pressed closed. With the +12V supply this divider nominally sets a transistor base bias voltage at about 1 volt. Very little base current flows due to the fact that the emitter of the NPN transistor is held above ground and as such the NPN base emitter voltage never gets high enough to let the transistor turn on. In a simulation of such circuit with a 2N3904 transistor model it shows that the presence of the 1K resistor keeps some bias across the LED of about 0.7V due to very low level currents in the transistor . If the 1K resistor is removed and when the switch is closed to GND then the bias across the LED drops to essentially zero because the transistor becomes fully turned off.
From a functional standpoint to get an LED to turn on and off from the switch there is no need to have the 1K resistor as relates to just this simple circuit. On the other hand if this circuit was used in a more complex system that had a monitor circuit across the LED looking for the above mentioned bias it could be an indicator that all the wiring from the switch to the LED was intact and in place. In an real burglar alarm system where the switch and LED may be located far apart this residual bias detection can play a role to ensure that the wiring has not been tampered with. |
H: How to Protect an ADC Input from Overvoltage
I have a module with an ADC with a maximum input voltage of 2V. I would like to monitor the battery voltage of 15V with this input. I have successfully used a trimpot as a voltage divider to effectively divide by 10 to get 1.5V at the input.
The trimpot is to calibrate the reading because fixed resistors will never be exact. Is there something I can add to this in order to protect the ADC input against overvoltage if the trimpot is turned too far?
As an aside, I am planning to also add an op-amp voltage follower at the input to isolate the voltage divider from the ADC input.
AI: If you simply add a fixed resistor between the top of the trimpot and the 15V source, you gain two advantages. First, you can limit the maximum voltage applied to the ADC as you desire, and second, you get better resolution in terms of calibrating the exact divider ratio.
For example, if you have a 2K trimpot and a 13K resistor, the maximum voltage that you can get at the wiper of the trimpot is 2V, and now half the range of the trimpot covers a 1-volt span, rather than just 1/15 of the range. |
H: feedback resistor
How to determine the feedback resistor in negative feedback op-amp configuration ? How does the feedback resistor affect the signal output of op-amp ? What is the consequence of using high resistance or low resistance in feedback circuit ?
AI: The transfer function of the inverting amplifier is
\$ V_{OUT} = -\dfrac{R_{feedback}}{R_{in}} \cdot V_{IN} \$
For the non-inverting amplifier it is
\$ V_{OUT} = \left(1 + \dfrac{R_{feedback}}{R_{g}}\right) \cdot V_{IN} \$
where \$R_g\$ is the resistor to ground.
So the gain is determined by a resistance ratio, where a higher feedback resistance gives a higher gain. About the choice for higher or lower resistance values: lower is better, because at higher resistances the input bias current may begin to play a role. But don't overdo it: if your inverting amplifier would have a 1 kΩ feedback resistor and you want a gain of 10 \$\times\$, then the input resistance should be 100 Ω, and that may be a bit too little for the signal source. So see how much current the source can supply, and calculate the feedback resistor from that.
The non-inverting amplifier doesn't have that problem: the input signal feeds directly to the high impedance of the non-inverting input. To minimize offset error you'll have to make the input impedances for both inputs equal, that means on the signal input a series resistance equal to \$R_{feedback}\$ and \$R_g\$ in parallel. Example: if the feedback resistor is 10 kΩ and \$R_g\$ 1 kΩ then place a 9.1 kΩ in series with the source.
By the way, that equal impedance rule also goes for the inverting amplifier. You'll often see the non-inverting input directly connected to ground, but again placing a resistor between the input and ground will reduce offset error. Again the resistance is the parallel of the other two resistors. |
H: Input and Output pin voltage specs on a datasheet
I'm a bit confused about input pin voltage tolerances and output pin voltage values of ICs.
I would think that datasheets for ICs that involve signal inputs/outputs would list two values:
The maximum voltage for a signal HIGH that it can tolerate at an input pin.
The minimum voltage for a signal HIGH that it will set at an output pin .
But many datasheets don't appear to list them for all pins. For example, I'm experimenting with STM6600, and its datasheet doesn't provide them; see below:
Above, "PB" is an input; "EN" and "INT" are outputs. Notice that only EN's minimum HIGH output is provided, but neither INT's minimum HIGH output nor PB's maximum HIGH input is provided.
Thus, I'm unsure about what to do in this situation.
Let's say I set VCC = 3.0V on this IC.
Then how do I determine:
Will this IC (STM6600) tolerate a given input signal HIGH from a different IC running at, e.g., a higher VCC = 3.3V?
And correspondingly, will a given output signal HIGH from this IC (STM6600) cause damage to a different IC running at, e.g., a lower VCC = 2.7V?
Even if the answer to these questions is No, I would still be interested in knowing the actual numerical values that I should expect, hence my problem with the datasheet.
AI: On page 38 of the datasheet you'll see for instance that the voltage on the PB should never exceed Vcc + 0.3 V. You'll find that this is true for almost all inputs on ICs: the input levels should remain between the rails. An exception is when you have for instance 5 V tolerant inputs on a 3.3 V powered microcontroller, but then that will be clearly indicated in the datasheet. (The manufacturer will consider this as an important feature, so he will make sure you notice that.)
To know if the high output will damage the input of another IC with a Vcc of 2.7 V you'll have to consult the datasheet of that IC. Probably the same limits will apply: input voltage should be no higher than the 2.7 V supply. |
H: How do i control a pressure?
I am looking for a component which can help me controlling the pressure in a tube.
I explain :
I have a compressor which blow some air in a tube. The compressor blow up to 8 bar and the tube is really small. I need a pressure between 1.5 and 2 bar in the tube. Then I am looking for a component, that I can drive electronicaly, which can do that for me.
Does anyone know about this type of component?
I don't know if I am clear, if you need othr information I'll edit my question.
AI: Such components certainly exist. They tend to be called I to P converters (current to pressure). I.E. you give them a signal in the form of a current, and they will regulate the air pressure according to that current.
If you're in the UK, you can buy them from Airlines Pneumatics. Using one of these will solve your problem immediately, but they can be expensive.
The alternative way to solve this problem is to control the pressure yourself. Since you already have a microcontroller, then you just need a pneumatic valve and an air pressure sensor.
Valves come in two basic types, proportional (you have fine control over the on percentage) or digital valves (which are either just on or off). I recommend a proportional valve if you can afford it, and if you can be bothered to make the electronics to drive it. This valve from Sirai is quite nice:
By regulating the current through it, you can control how open it is, and thus the rate at which air flows into your tube.
Next you'll need a pressure sensor.
Measure the pressure (preferable at the other end of the tube to avoid various pneumatic effects caused by the moving air, like Bernoulli's principle, where the sensor will see a false drop in pressure as the air flows past it towards your tube.
Once you have your valve and sensor, the microcontroller can control the valve to control the pressure. I recommend something simple like a pure P controller. |
H: What is the difference between VA and W for a relay
I am trying to choose a relay to control a compressor. The compressor alimentation is 230V (50Hz), the max intensity is 0.9A and the power needed is 130W.
Then I found two relays: the ALD112W and the GNDB-1A-E12VDC with Max switching current 5A and max switching voltage 250VAC.
So that seems ok but when I looked at the max switching power it is 1250VA, 90W.
Since W is the real power needed and VA is the complete power I don't understand why there is a difference for a relay which should just let the current pass or not.
Which one is important? 1250VA or 90W? Since the compressor is I think like a motor.
AI: The difference between VA and W rating is where the current is with respsect to the voltage, or vice versa. However, the difference between 1250 VA and 90 W is surprising. I don't recall seeing that wide a difference before.
Now that you've posted links to the datasheets, we can see what was really said. Here is the relevant section from the first datasheet:
I know this is the political season (at least here in the US), but it's still not nice to misrepresent someone else's statements. Notice the all-important AC after the VA rating, and DC after the W rating. That makes all the difference.
Think of the problem a relay or any mechanical switch has when it is turning off. There are two issues it has to deal with, interrupting whatever current is flowing, and eventually providing enough of a gap so that the open circuit voltage can be withstood without arcing.
Immediately interrupting the current is the hard part. The contacts can't instantly go from touching to having the full gap between them. The gap starts at 0 and then over time grows to the full size. When it just starts to open and there is any current flowing, a arc will form between the contacts. A arc is air turned into a plasma by the flowing current. Plasma has lots of free electrons, so is conductive. Once the arc forms it creates its own low resistance path and thereby perpetuates itself. It therefore takes a much larger gap to break the current once the arc has started. Also consider that if the load has a significant inductive component, like a motor, how that will tend to sustain the arc even more.
Now think about how AC helps. At 50 Hz, the voltage and current will each be zero twice per cycle, or every 10 ms. This means any arc will be extinguished automatically in at least 10 ms. By the time the voltage builds up enough on the next cycle to possibly re-establish the arc, the contacts have moved farther apart and the ionized air has returned to normal state. The result is that much higher voltage is required to re-start the arc. That's a good thing for the relay.
So the net result is that AC is a lot easier for relays to switch, hence the large difference in the AC and DC power handling spec. The AC part is specified as VA instead of W because the problem is related to the peak volts and amps, even if they are out of phase.
Since you are switching AC, you apply the AC VA rating, not the DC W rating. |
H: counter giving erratic results for frequency measurement using Atmega32
I am using a photosensor which gives output as a square wave. The frequency of this square wave is being measured using Atmega32A with 1MHz clock. The full scale output of sensor is 500kHz.
The output of the photosensor is connected to pin T1 and I'm using timer1 clock as a reference to determine the frequency. I have a 100 ms delay using software loop after which I read the timer value and multiply by 10 to get the photosensor output frequency.
The frequency values being obtained using oscilloscope are around 50-100kHz. However the frequency values being returned by this code are around 80Hz greater than value measured with an ocilloscope in one setting .If I change the location of the whole setup this constant extra value is changing to another constant . What am I doing wrong?
uint32_t MeasureFrequency()
{
uint32_t freq=0;
DDRB &= ~(1<<PINB1);uint32_t count=0;
TCCR1B |=(1<<CS12);
TCCR1B |=(1<<CS11);
TCCR1B &=~(1<<CS10); //0.Initalize
TCNT1=0x0000; //1.Clear timer 0 contents
TIFR &=~(1<<TOV1); //2.Clear timer 0 flag
//count=TCNT1;
while(TCNT1<1)
{;}//count=TCNT1;}
if(TCNT1>=1) //3.Check if timer has incremented once
{_delay_ms(100);} //4.100ms delay
TCCR1B &=~(1<<CS12);
TCCR1B &=~(1<<CS11);
TCCR1B &=~(1<<CS10); //5.Disconnect timer clock from input
uint8_t i=TIFR;
i = i&(0b00000100);
if(i==4)
{Send_A_Character('v');}
count=TCNT1; //6.Read Timer
return freq=count*10; //7.Freq=timer*10
}
AI: _delay_ms() is a very unprecise function, besides it takes precessor time to call it and return back.
There are many ways you could use atmega's peripherals to measure frequency, if you want to go by feeding input frequency to T1, I would suggest using another timer to measure time. You could set up and start both timers simultaneously, then catch overflow interrupt of "time" timer which will happen exactly after 256*prescaler system clock ticks, then do your math.
On another note, I would suggest you to increase your processor clock frequency as 500KHz is only 2 times less than 1MHz (Nyquist theorem), that is enough, but you will not get much accuracy at the high end. |
H: Sending IR signals to Robosapien using Arduino
I am trying to send commands to a Robosapien (first generation) using an IR LED hooked up to an Arduino. I have seen web pages on attaching a microcontroller directly to the toy, but what I want to do is just send commands via IR.
I found an article by K. Smith that mentioned that the IR commands sent by the Robosapien remote take the following form:
To send the hex code 85:
The IRout signal is held high until a signal is sent. Then a string of
five zeros is sent to signify a command is coming. Then the hex code
is sent but instead of sending a ‘1’ a ‘1110’ is sent and rather than
a ‘0’ a ‘10’ is sent. So $85 looks like this:
Binary: 1 0 0 0 0 1 0 1
Robosapien: 1110 10 10 10 10 1110 10 1110
So I tried the code below:
int bitTime=833;
int IROut = 4;
// The setup() method runs once, when the sketch starts
void setup() {
// initialize the IR digital pin as an output:
pinMode(IROut, OUTPUT);
Serial.begin(9600);
}
void test()
{
// output high
digitalWrite(IROut,HIGH);
delay(1000);
// 5 zeros
digitalWrite(IROut,LOW);
delayMicroseconds(bitTime);
digitalWrite(IROut,HIGH);
delayMicroseconds(bitTime);
digitalWrite(IROut,LOW);
delayMicroseconds(bitTime);
digitalWrite(IROut,HIGH);
delayMicroseconds(bitTime);
digitalWrite(IROut,LOW);
delayMicroseconds(bitTime);
digitalWrite(IROut,HIGH);
delayMicroseconds(bitTime);
digitalWrite(IROut,LOW);
delayMicroseconds(bitTime);
digitalWrite(IROut,HIGH);
delayMicroseconds(bitTime);
digitalWrite(IROut,LOW);
delayMicroseconds(bitTime);
// send 1110 10 10 10 1110 10 1110
// 1110
digitalWrite(IROut,HIGH);
delayMicroseconds(3*bitTime);
digitalWrite(IROut,LOW);
delayMicroseconds(bitTime);
// 10
digitalWrite(IROut,HIGH);
delayMicroseconds(bitTime);
digitalWrite(IROut,LOW);
delayMicroseconds(bitTime);
// 10
digitalWrite(IROut,HIGH);
delayMicroseconds(bitTime);
digitalWrite(IROut,LOW);
delayMicroseconds(bitTime);
// 10
digitalWrite(IROut,HIGH);
delayMicroseconds(bitTime);
digitalWrite(IROut,LOW);
delayMicroseconds(bitTime);
// 1110
digitalWrite(IROut,HIGH);
delayMicroseconds(3*bitTime);
digitalWrite(IROut,LOW);
delayMicroseconds(bitTime);
// 10
digitalWrite(IROut,HIGH);
delayMicroseconds(bitTime);
digitalWrite(IROut,LOW);
delayMicroseconds(bitTime);
// 1110
digitalWrite(IROut,HIGH);
delayMicroseconds(3*bitTime);
digitalWrite(IROut,LOW);
delayMicroseconds(bitTime);
// output high
digitalWrite(IROut,HIGH);
delay(1000);
}
void loop()
{
test();
}
But unfortunately I am not getting any response from the Robosapien. What am I doing wrong?
AI: A bit time of 833 µs implies a data rate of 1200 bps. I don't know anything about Robosapien, but my first thought is that this signal is possibly meant to be the keying (envelope) imposed on a higher-frequency (e.g., 38 kHz) IR carrier signal.
Can you provide a link to the K. Smith article for reference? |
H: image sensor line problem
I have an image sensor problem and I am looking everywhere to identify the problem but couldn't. Attached is the problem I observe. As you can see there are several horizontal lines in the image.
So far, I have checked power, clocks and all seems in order. Appreciate any ideas you may have. (If I get a test image from sensor-diagonal tiles etc-, all seems to be good. So, I am assuming it is not communication with the sensor. Sensor datasheet is here)
I am not looking for a specific answer but more of a direction and/or ideas. Somebody with the right experience could know where to look.
Apparently this type of problems can be observed in other sensors. See the link.
I have realized, I missed out one critical information, if I reduce the clock frequency of the sensor the problem disappears. So there is a clock frequency dependency. However I do not suspect read out since if I set the test pattern, regardless of frequency all is good.
Imager Power Supply Noise figures
Analog Supply
Digital Supply
UPDATE
After further testing, I figured the problem is same in every frame. Previously, I was wrong. Here is the 4 images from different times. Images are stiched together, all 480x752
AI: If the pattern of the column is the same whenever they appear, the problem is called fixed-pattern noise. This is just something you need to deal with, especially when dealing with a raw sensor. The sensor vendor should be able to help with characterizing it.
To deal with it, you can either go through a manual calibration procedure that allows you to derive offset and gain correction factors for each column, which you then store in nonvolatile memory, or you can develop an adaptive algorithm that can recognize and compensate for FPN in live images on the fly.
To characterize the FPN, you'll need to take a series of flat-field images (same amount of light on each pixel) at various light levels (including completely dark) and various exposure times. For each combination of light level and exposure, take the average value of the pixels in each column, and average these values over many frames (to eliminate thermal noise).
From this set of data for each sensor column, you will be able to determine what gain and offset values to apply to that column to eliminate the fixed pattern. You will also be able to determine whether the correction values need to be different for different exposure times, or a common set of values will work well enough for all exposure settings.
You'll also want to do this across a number of individual sensors, to make sure that the statistical variations among sensors don't invalidate the solution you come up with. |
H: Scaling voltage to meet two conditions at once
I am using an IC (STM6600) which, among other functions that I need, is also capable of Undervoltage Monitoring. It works like this:
The IC monitors VCC in comparison to two thresholds, V_Low and V_High (which is just V_Low+V_Hysteresis).
When VCC < 3.10V (V_Low), then its status output = LOW (undervoltage condition)
When VCC > 3.30V (V_High), then its status output = HIGH (normal condition)
(Thus V_Hysteresis = 0.20V.)
The problem is:
I'd like the status LOW condition at VCC < 3.45 V
I'd like the status HIGH condition at VCC > 3.55 V
(Thus, I'd like V_Hysteresis = 0.10V.)
Since I obviously can't change the IC's operation itself, I am therefore trying to instead find a way to add some voltage-scaling circuitry in between my original supply (V_battery) and VCC of this IC. What are some ways I can accomplish this?
Note:
I considered a resistive divider as well as a diode-based drop, but I couldn't solve it with either of those because the necessity above is not a proportional scaling. One other way might be to use a low-power microcontroller w/ ADC in between, read the voltage, and PWM-output the mapped/scaled voltage. But I was wondering if there are simpler options.
AI: What are some ways I can accomplish this?
Using an offset and a gain, \$V + A(V_{battery}) = V_{CC} \$, the equations are:
\$V + A(3.45V) = 3.1V \$
\$V + A(3.55V) = 3.3V \$
The solution is:
\$ A = 2, V = -3.8V \$
This would be straightforward to implement with a simple opamp circuit. I can post one later if you're interested.
Also, really, I'm just interested in the academic value of knowing how
to do this kind of linear voltage transformation generally speaking
Here's a circuit fragment to illustrate the basic idea. This should get you started. |
H: How to detect SD Card Insertion Without Leakage Current
I'm using a TI CC1111 SoC to read/write a microSDHC SD card, with an Amphenol card socket. The card detect (CD) pin of the socket is connected to ground when no card is present. When a card is inserted, the connection is broken. (This seems to contradict the datasheet, but it's what my multimeter tells me).
One way to detect card insertion would be to connect a GPIO pin to the CD pin. By default the CC1111's pins are configured with an internal pull-up resistor. If a card were present, I'd read logic high, and otherwise the pin would be pulled to ground. But I worried this might draw excessive current, and sure enough, the CC1111 datasheet warns (pg. 90):
Unused I/O pins should have a defined level and not be left floating. One way to do
this is to leave the pin unconnected and configure the pin as a general purpose I/O
input with pull-up resistor. This is the default state of all pins after reset except
for P1_0 and P1_1 ... Alternatively the pin can be configured as a general
purpose I/O output. In both cases the pin should not be connected directly to VDD or
GND in order to avoid excessive power consumption.
Question 1: Where is the power consumed? Is it just in the internal pull-up resistor? The datasheet says the internal pull-ups are 20k, so with 3.3 V that's about 0.17 mA. Is that what they're talking about? Or perhaps the "excessive power consumption" warning only applies when the pin is configured as an output?
Qustion 2: What is the right way to detect card insertion/removal without wasting power?
And no, I haven't measured the current draw yet, but I will.
AI: I'm pretty sure the datasheet warning is there to cover the case where a pin is tied directly to Vcc or Gnd, but then the firmware configures that pin as an output and tries to drive it to the opposite state (either because of a bug or a subsequent firmware change).
If you really want to play it safe, put a relatively low-value (say, 1K) resistor between the card socket contact and the GPIO pin. When the GPIO pin is used as an input, this resistor forms a voltage divider in conjunction with the internal pullup that still allows the pin to be read as "0". However, if the GPIO pin should inadvertently be configured as an output and driven high, it serves to limit the current flow to a few mA. |
H: Basic Arduino question
Incoming Noob question alert!
So, I am new to this platform and I have a few questions.
What happens when I upload a new sketch to the Arduino from the Arduino IDE, the older sketch gets deleted? or older one still survives in the Arduino memory somehow? if it does.. what happens when it runs out of memory? and how do you go about choosing which one to run?I have a feeling that the old one gets deleted, but I want someone to confirm it.
I understand that the there is a void setup () part and void loop () part, the void loop part keeps the thing going indefinitely. Regardless, is there a way to start/stop the program? without cutting the power to the board?
AI: Noob questions most welcome!
The old program is erased, and a new one written.
To pause the program, you could try sending the Arduino to sleep, but then you would need an interrupt to wake it up again and resume processing. You could also put the Arduino into a another loop waiting for an input to continue.
e.g.
while(1) {
delay(100);
if (digitalRead(2,LOW)) break;
}
This will keep the program stuck in the while loop until pin 2 is brought low (checking every 100ms). Make sure to set pin 2 to an input pin in setup(), e.g.:
pinMode(2,INPUT);
The difference between putting the Arduino to sleep and putting it in a loop is that sleep mode consumes less power. |
H: Logic gate counter on 7 segment display
Using logic gates with general purpose transistors, I want to display numbers on a 7-segment display depending on the 2 pushbutton input. If both buttons are not pressed, I want it to say 0. If 1 is pressed, I want it to say 1, if the other one is pressed, I want it to say 2, and if both are pressed, I want it to say 3. I know how to do this with separate LEDs, ( 4 Different LEDS are lit depending on the switches inputs) ,but I am having troubles figuring this out for a 7-segment display because of the overlapping digits on. I may have done a terrible job explaining this, but any info is helpful.
AI: I'd do this in 2 steps. First make a circuit that has 4 outputs that correspond to your 0-3 codes. You can test this by hooking common LEDs to the outputs. I believe this is a common decoder circuit.
The second step is to connect the transistors to the LED segments. Place a transistor on each segment. Put power on the collector appropriate for the type of LED. Connect the emitter to a specific segment. The base should be connected to your decoder's outputs.
Say you have an 7-seg LED with segments numbered from 0 to 7. You decide segments 1 and 2 need to be lit for decoder output #0. Connect #0 to the bases of the transistors responsible for segments 1 and 2. Repeat for the other 3 outputs. Where you have different outputs sharing a transistor base, you may need diodes to prevent current from flowing 'backwards' and lighting up segments unexpectedly. |
H: components within a triangle in an electronics diagram
I'm trying to understand the following circuit diagram:
Specifically, the four triangles within the L293D component. So I understand there are two transistors in there, connected in series from 24v to ground, but what is connected to the bases of the transistors, the lines just end...
From what the circuit should do, I guess that the line coming in to the triangles from the 'and' gates (at the top left of the triangles) should some how enable the whole triangle, and that the line coming in from 1A\2A\3A\4A should toggle 5v between the two transistors. Is that right? And how do I deduce that from the schematic?
AI: The triangle is a symbol for a buffer, driver or amplifier, whatever you call it.
The transistors drawn inside the triangle are there to let you know what is the type of your output. Thanks to this drawing you can see that the outputs are switched via BJTs between the power supply rails using some kind of Push-Pull topology.
Knowledge about the type of output is useful. If those were power MOSFETs, you would expect them to exhibit different behavior than BJTs. A BJT will have a voltage drop whereas a MOSFET will have a resistance between drain and source.
The drawing doesn't provide the exact schematic for the amp/buffer and it doesn't have to. The exact schematic would be a lot more complicated and this image is there to clarify things, not complicate them.
So, in short, the triangle symbolizes your driver/buffer and the transistors are there to let you know that the output was made using bipolar transistors. |
H: My design is not meeting timing. What can I do?
I am using the Altera Quartus II software to compile Verilog for a Cyclone IV FPGA. In my case, the FPGA is fixed; I cannot get a faster one.
Now one isolated module in my design, which deals with relatively fast clocks, is not meeting timing. I have spent some time trying to simply the code, and understand how the compiler interpreted my code with the "RLT viewer" and "Technology Map Viewer".
Despite that, my design is still not meeting timing by a little. What should I do? Are specific techniques/tricks I can try? Can I ask Quartus II to really try its best to optimize the specific module?
AI: Run design assistant and try to optimize design for speed if Your timing constrains doesn't help You to reach the required times. What frequency do You need and how much do You get? What's the worst path? Give us more information.
What You can do is to optimize all combinatorial logic plus always remember to add several pipeline stages if possible. You can also half the internal clock and transfer required data DDR internally. Tell us more about Your application and critical paths, it would be easier to help You. E.g. I recently had a problem to meet timing of MII/GMII mux for Gig-E. |
H: How can I use a 12 V input on a digital Arduino pin?
I am creating a controller for a 12 V system using an Arduino Uno microcrontroller. For the outputs I am using a relay shield to switch the 12 V components. I have a 12 V toggle switch that turns on some 12 V components in the system and I want to use a trigger signal off of this same switch to send to an Arduino digital input. I know that the Arduino can only handle 5 V max. What would be the best way to step down the 12 V coming off of the switch to the 5 V for the input?
EDIT: The system is for use in a car. Would the amperage of the car battery need to be lowered somehow as to not blow up the components?
AI: Good news! This going to be cheap! :-)
A simple resistor divider will bring the 12 V down to the 5 V an Arduino can digest. The output voltage can be calculated as
\$ V_{OUT} = \dfrac{R2}{R1+R2} V_{IN}\$
Resistor values in the range of 10 kΩ are a good choice. If your R2 is 10 kΩ then R1 should be 14 kΩ. Now 14 kΩ is not a standard value, but 15 kΩ is. Your input voltage will be 4.8 V instead of 5 V, but the Arduino will see that still as a high level. You also have a bit of headroom in case the 12 V should be a bit too high. Even 18 kΩ will still give you a sufficiently high 4.3 V, but then you have to start thinking about the 12 V a bit too low. Will the voltage still be seen as high? I would stick with the 15 kΩ.
edit
You mention an automotive environment, and then you do need some extra protection. The car's 12 V is never quite 12 V, but most of the time higher, with peaks several volts above the nominal 12 V. (Actually nominal is more like 12.9 V, at 2.15 V per cell.) You can place a 5 V zener diode in parallel with R2, and this should cut off any voltage higher than the zener's 5 V. But a zener voltage varies with the current, and at the low input current the resistors give you it will cut off at lower voltages. A better solution would be to have a Schottky diode between the Arduino's input and the 5 V supply. Then any input voltage higher than about 5.2 V will make the Schottky diode conduct, and the input voltage will be limited to the 5.2 V. You really need a Schottky diode for this, a common P-N diode has a 0.7 V drop instead of the Schottky's 0.2 V, and then the 5.7 V maximum input voltage may be too high.
Better
Michael's optocoupler is a good alternative, though a bit more expensive. You often will use an optocoupler to isolate input from output, but you can also use it to protect an input like you want here.
How it works: the input current light the internal infrared LED, which causes an output current through the phototransistor. The ratio between input and output current is called CTR, for Current Transfer Ratio. The CNY17 has a minimum CTR of 40 %, which means you need 10 mA input for 4 mA output. Let's go for the 10 mA input. Then R1 should be (12 V - 1.5 V) / 10 mA = 1 kΩ. The output resistor will have to cause a 5 V drop at 4 mA, then that should be 5 V / 4 mA = 1250 Ω. It's better to have a bit higher value, the voltage won't drop more than 5 V anyway. A 4.7 kΩ will limit the current to about 1 mA.
Vcc is the Arduino's 5 V supply, Vout goes to the Arduino's input. Note that the input will be inversed: it will be low if the 12 V is present, high when it isn't. If you don't want that, you can swap the position of the optocoupler's output and the pull-up resistor.
edit 2
How doesn't the optocoupler solution solve the overvoltage issue? The resistor divider is ratiometric: the output voltage is a fixed ration of the input. If you have calculated for 5 V out at 12 V in, then 24 V in will give 10 V out. Not OK, hence the protection diode.
In the optocoupler circuit you can see that the right side, which connects to the Arduino's input pin doesn't have any voltage higher than 5 V at all. If the optocoupler is on then the transistor will draw current, I used 4 mA in the example above. A 1.2 kΩ will cause a 4.8 V voltage drop, due to Ohm's Law (current times resistance = voltage). Then the output voltage will be 5 V (Vcc) - 4.8 V across the resistor = 0.2 V, that's a low level. If the current would be lower the voltage drop will be smaller as well, and the output voltage will rise. A 1 mA current, for instance, will cause a 1.2 V drop, and the output will be 5 V - 1.2 V = 3.8 V. The minimum current is zero. Then you don't have a voltage across the resistor, and the output will be 5 V. That's the maximum, there's nothing there which will give you a higher voltage.
What if the input voltage would become too high? You accidentally connect a 24 V battery instead of 12 V. Then the LED current will double, form 10 mA to 20 mA. The 40 % CTR will cause 8 mA output current instead of the calculated 4 mA. 8 mA through the 1.2 kΩ resistor would be a 9.6 V drop. But from a 5 V supply that would be negative, and that's impossible; you can't go lower than 0 V here. So while the optocoupler would very much like to draw 8 mA, the resistor will limit that. The maximum current through it is when the full 5 V is across it. The output will then be really 0 V, and the current 5 V / 1.2 kΩ = 4.2 mA. So whatever power supply you attach the output current won't go higher than that, and the voltage will stay between 0 V and 5 V. No further protection needed.
If you expect overvoltage you'll have to check if the optocoupler's LED can handle the increased current, but the 20 mA will not be a problem for most optocouplers (they're often rated at 50 mA maximum), and besides, that's for double input voltage, which probably won't happen IRL. |
H: Op-amp inverter amplifier, low current, with AC noise at 50Hz
I was doing some measurements for a coursework.
Op-amp, LM741 in an x10 inversor configuration.
When the resistances in use become high enough, 1MOhm and 10MOhm, the output is correct but it has a 50Hz noise on top, of amplitude that would suggest an extra 80nA through the resistors.
That effect isn't seen while simulating on PSpice, but it is expected behaviour since other people measured it too.
Now, the datasheet gives 80nA as the bias current, so I, who still don't know much of how an op-amp works internally, suspected it was to blame.
However, I've been told that the bias current is always DC so it can't have anything to do with that, and that it has to do with something acting like an antenna, but no clear explanation was offered to me.
Is that true? I have no clue what's going on and would appreciate orientation
EDIT
The objective is just educational, it's to understand the behaviour. With 1k-10k resistors it works perfectly. 50Hz is the mains frequency so the noise is surely somehow due to that. But I'd like to know more why that noise happens, how to model it in a way that it explains the fact that it's there with 1MOhm resistors but not with 1K. Also, if it's related to some parameter in the LM741 datasheet that explains the amplitude of the noise
AI: I won't try to answer the whole question, but I'll try to explain why you're getting pick-up, and why the resistor values matter.
The pick-up, is, like other said, coming from your mains voltage. It might be coming from a small ripple leaking through your power supply regulators to your circuit rails, or it might just be coupled in from nearby power lines. In any case, the fact that changing the resistor values affects it strongly suggests this is capacative pick-up:
The main idea is that electric field from someplace with a 50 Hz signal on it is terminating on the copper connected to the inverting input of your op-amp. This has the same effect as if there's a (very tiny) capacitor between that source and your op-amp input.
So why do the resistor values matter?
I'll assume that the driving circuit supplying the desired signal at the "in" port of your circuit has a low impedance. And we know the output of the op-amp has a low impedance, and the inputs have very high impedance. So the AC equivalent circuit for the interference source reaching the op-amp input looks like this:
Here, the op-amp inverting input is connected to the mid-point where the capacitor connects to the two resistors (just like in the real circuit). We can immediately see this is a voltage divider. For a fixed frequency, the capacitor will have a fixed impedance: 1 / (2 * pi * f * C). So as you increase the resistor values, you'll directly increase the signal seen by the op-amp, up until the parallel resistance is much more than the capacitor's impedance and you are near 100% coupling.
This divider effect explains why we often hear about shielding or isolating the "high-impedance nodes" in op-amp circuit designs. |
H: Which of these approaches for a watchdog timer?
I recently learned about watchdog timers, and am trying to implement one for my circuit for the purpose of resetting my (AVR) microcontroller if it hangs (i.e., doesn't respond to the watchdog).
Based on some research, it appears to me that there are around four options:
Connect my microcontroller with an external dedicated watchdog-timer-specific IC.
Connect my microcontroller with an additional microcontroller (some very basic, inexpensive one), the latter coded for the sole dedicated purpose of watchdog-timing.
Lay out my own 555-timer-based watchdog circuit and connect it to my microcontroller.
Use the internal watchdog timer capability on my microcontroller.
.
Which of the above approaches would you rank higher and why?
I would like to set a watchdog time of around 6 seconds, based on certain criteria for the way I'm making the rest of my design and code (the device will be a battery-powered, periodic temperature logger).
A little note: My preference would be Option 1, for simplicity, however, based on the couple I have found, these parts either appear to be expensive (I'd like a solution under 1.25 USD at most), or only allow only less than 2 seconds for the watchdog timing period.
AI: More expensive, as you already found out. But it should give you the highest level of reliability: because the watchdog is completely independent of the microcontroller it will still keep running, and reset the microcontroller when the latter is on fire, so to say. See 4)
Brian is against it, but there are cheap microcontrollers in a small package, like the PIC10F200 in SOT-23, which you can use as a retriggerable MMV (monostable multivibrator), which the watchdog actually is. If you would consider a 555, a 10F200 is better: no external parts, and more accurate timing (1% accuracy).
a 555? Seriously?
The internal watchdog will do if the dedicated IC is too expensive. If you're really paranoid you can think of a scenario where some hardware error will lock up the microcontroller and the watchdog with it. I've never known this happen, but I don't know how well you sleep.
Like pjc50 says 6 seconds is a long time. A typical microcontroller will execute tens of millions of instructions in that time, and then a lot can go wrong. Suppose you're controlling some load with PWM, and a low 10 % duty cycle keeps the dissipation low. Microcontroller goes bananas and the output gets stuck at a high level, 100 % duty cycle. The load doesn't like it, and dies. You don't want to wait 6 seconds for that to happen. There should be some part of your code where you pass much more frequenct. A main loop may be as short as 10 ms, then you could set the watchdog's timeout at 100 ms, for instance. If you kick the dog once every 10 ms, then a timeout means that you missed it 10 times! Once, OK, but ten times is disaster, and you have to take action. The load will be switched off after 100 ms instead of 6 seconds, which may be the difference between dead or alive. |
H: If I turn a AA around will it drain or damage electronics?
I have an Apple Bluetooth keyboard. The thing turns on all the time when I put it in my backpack. This is bad because it blocks the soft keyboard on my phone. It runs on 2 AA batteries. Lately, I have been turning one of the batteries around to make sure it can't turn on. This works as intended, but my questions are:
Can this damage the electronics?
Will this drain the batteries faster?
AI: No to both questions. Turning one cell around in a two-cell pack simply creates a pack that has zero net terminal voltage, and this can't harm either the circuit or the cells themselves. |
H: Why ground is positive on this part?
I'm using a powered device controller (PD is what they call a device that receives power over Ethernet), and its pins and way of connecting things is really weird. This part, LTC4265, takes in power over Ethernet (POE), negotiates how much power POE can provide to it, and then outputs that power.
What I'm really curious about is why its GND pin is called "input voltage positive rail" and its Vout is "output voltage negative rail". If you look at the data sheet at http://cds.linear.com/docs/Datasheet/4265fa.pdf, page 2 will show a typical application circuit. Also, pin definitions are on page 5. Anyway, it shows Vout outputting negative voltage. Essentially, the positive POE voltage is connected to GND pin, which is then connected to ground, and the negative POE voltage is connected to Vout. Why do they do things this way?
Thanks in advance for the help!
AI: Because in telecommunications (phone central offices), things run off of -48 V. So there are plenty of parts and equipment built that way.
This link explains why. It has to do with electroplating. |
H: Characterizing raw op amp gain
I thought as a first exercise in op amps, even before setting up a feedback circuit, I would determine the gain of the raw op amp.
I tried with an LM324 and an LM358 which should be essentially the same. I assume the input currents are really small, I believe when I glanced at the data sheet it was nA. So I used a 4 AA power supply with 6v (not fresh batteries). To get an input signal, I created a voltage divider from a 1M and 1K resistor (V0). I can measure .0056mV with the meter.
Then I put a second divider of 1M and 1k across the 1k (labelled V1), which should give roughly 5.5 uV though I can't measure that.
For the LM324, pin 2 is V-, pin 3 is V+, and pin 1 is Vout.
If I set pin 2 and 3 to 0V, essentially 0 comes out (some small noise as expected).
If I set pin3 to Vcc, 4.8v comes out (roughly 1.2v drop through the amp).
But when I set pin 3 to the first stage voltage divider, 5.6mV, the output voltage does max out, but I notice the input voltage does change a bit. That one I didn't record, see below for more. Troubling, considering there should be essentially no effect from the op amp. Worse, once I put in the 5.5uA signal, I expected to see something like a gain of 850,000 or 900,000. I swear I did this before, and had planned a lab on it. But now I can't get this repeatably. When I tried again, this time replacing R3 and R4 by 100k each, V1 changed from 2.9mV to 3.2mV I don't see how that could possibly happen.
I tried again with positive feedback mode, I can get a gain of 101 using a 100k and 1k resistor. I used 1M and 1k, and then across the 1k, a second voltage divider with two 100k. Again, voltage V1 is 2.9mV but when plugged into the + side of the op amp it changes, only to 3.2mV, but I wouldn't have thought there would be any change at all.
I'd like to know whether I am simply using the op amp out of the range in which it behaves well, whether it should work in which case I will try to double check my power supply, my wiring. The voltage is still 6v, and the LM324N should be good down to 3V, so I can't believe it's the power. This whole experience is making me doubt my sanity.
AI: You are trying to use the "opamp out of the range it behaves well". Used open loop like this it becomes a makeshift comparator.
Opamps are meant to always be used closed loop. The open loop gain is pretty variable so cannot be relied upon, the only real requirement is that it's as large as possible (ideally infinite) When you close the loop though the huge gain makes the (closed loop) gain very accurate and the open loop variability (usually) makes almost no difference.
In theory, with an ideal opamp what you are trying would work okay, but in real opamps you have slight mismatches, causing things like input offset voltage which just by itself will cause this experiment to fail.
If we look at page 3 of the datasheet, we see the typical offset voltage for the LM324 is 2mV, up to a maximum of 7mV (3mV for the LM324A). This swamps your tiny input signal, and will cause the output to do just about anything, probably saturate.
There is also an offset current, external noise, and other non-ideal parameters that are variable with temperature that will cause issues here.
For an example of how variable the open loop gain is, here is a graph of the open loop gain over supply voltage:
We can see at 5V, the open loop gain is around 100dB (100,000) compared to 120dB (1,000,000) at 15V. This is a factor of 10 difference. Also we can see it varies considerably with load. |
H: Does Arduino need the bootloader if programmed with programmer?
I am trying to program a few Atmega328 (not Atmega328p) with an ICSP. These are TQFP.
What I am trying to do is to upload the program to a fresh chip without having to first load the bootloader. I use a command like this
avrdude -v -p m328 -c usbtiny -U flash:w:blink.cpp.hex:i
avrdude says it is uploaded successfully, but the program does not actually run.
However, when I first burn the bootloader, using the Arduino GUI, then use the command line and programmer to upload the program, the program does run. I am confused about why this is because my understanding was that the bootloader was not needed if the programming was done using the programmer.
Why is the bootloader needed?
Secondly, if the bootloader is needed, is there a way to make avrdude do everything to load the bootloader and the program in one line?
AI: To answer the first question, the bootloader is needed because your program is built in such a way that it depends on the bootloader residing at the reset address of the processor, and then having the bootloader jump to your program. It's a function of how the linker script and the run-time code is set up for the Arduino environment.
I don't know the precise answer to your second question, but it certainly should be possible.
An alternative solution would be to use a different linker script so that your program actually resides at the reset address. |
H: Is this an OK ICSP circuit?
I recently discovered a project to program PIC18Fs with an Arduino here: https://sites.google.com/site/thehighspark/arduino-pic18f
All other ICSP PIC programmers I've seen are more complicated than just 4 resistors. This might just be because this project does not support high voltage programming. Is this an OK circuit to use to program PICs, or is it possible the programming will error out, or worse yet, the PIC burns out?
AI: Yes, that particular PIC can be programmed with the low voltage method. That requires only ordinary digital signals to be connected to MCLR, PGC, PGD, and PGM. The drawback is that low voltage programming must be enabled. Unprogrammed parts come that way from the factory, and it is impossible to disable it over the LVP interface, so you're probably fine unless you are trying to re-purpose a PIC previously programmed with the high voltage method.
As a programmer, it should work fine for the limited set of PICs that allow for LVP and are configured to allow it. My PIC programming introduction gives more background on PIC programming. This only discusses the more common and more general high voltage method, but should give you some good background nonetheless. |
H: How is this Pushbutton Debounce code?
I am monitoring a pushbutton with a microcontroller where I am trying to take care of four things together:
50-msec debounce upon push-begin and 25-msec debounce upon push-release
identify a short-press, defined as when button released within < 1 second
identify a long-hold, defined as when 1 second passes since button push-begin
sleep as much as possible when not doing anything else
Below is a short pseudocode of what I have implemented so far. I think it covers all of these cases.
Do you see any possible refinements or potential issues? (E.g., I am interested in any subtle cases that might be blindspots for my approach.)
Pseudocode:
Main loop {
Sleep
}
Falling-Interrupt {
Disable Falling-Interrupt
Enable 50-millisecond-Debounce-Timer-Interrupt
}
50-millisecond-Debounce-Timer-Interrupt {
if PushButton state is still LOW {
Enable Rising-Interrupt
Enable 1000-millisecond-Hold-Timer-Interrupt
}
}
1000-millisecond-Hold-Timer-Interrupt {
Register as Pushbutton long-hold
}
Rising-Interrupt {
if (Time since Falling-Interrupt < 1000 millisecond) {
Register as Button Short-press
}
Disable 1000-millisecond-Hold-Timer-Interrupt
Enable 25-millisecond-Debounce-Timer-Interrupt
}
25-millisecond-Debounce-Timer-Interrupt {
Enable Falling-Interrupt
}
AI: I can't put code in a comment, hence an answer. My 'framework' for simple embedded systems is the main loop with polling. To minimize current consumption the main loop can wait let's say 50 ms in idle mode. I don't know which uC you use, I am familiar with PICs, which can awake from a sleep by an interrupt.
set up an interrupt to wake me from sleep each 50 ms
down_counter = 0
for(;;){
sleep();
if( key down ){
down_counter++;
if( down_counter == 20 ){
(start of) long_down detected
}
} else {
if( down_counter > 1 && down_counter < 20 ){
(end of) short press detected
}
down_counter = 0;
}
} |
H: "Faster" Arduino bootloader
The Arduino bootloader has a wait-time to facilitate "sketch" (code) uploading; this causes a delay of a couple of seconds before the start of the main code.
I would like to modify the bootloader file (specifically for the Arduino Mega) so as to reduce this time to less than 1000 milliseconds at most.
I am unsure how to get started on this -- Could someone point me in the correct direction?
(Note: I am aware that I can instead directly upload only the hex file corresponding to my firmware, but in this case, I would like to maintain the bootloader.)
AI: For an overview of the bootloader take a look at the Bootloader Development page.
The actual source code is available and can be browsed here. To modify the wait time (or the behaviour of the waiting) take a look at the ATmegaBOOT.c file.
In line 91 is MAX_ERROR_COUNT defined and used to determine when to start the actual application on your arduino. To decrease the waittime, I would start by setting MAX_ERROR_COUNT to a lower value.
After you posted your comment I had another look at the source code.
At line 433 the "forever loop" is startet and in line 436 the function getch() is called.
In this function there is another loop, that checks for a received character. If no character is received within a given timespan the application code is getting called.
The duration of the timespan is determined by MAX_TIME_COUNT.
So changing MAX_TIME_COUNT seems to be more suitable then changing MAX_ERROR_COUNT. |
H: Avoiding false optical rotary encoder readings
I have an optical shaft encoder that has rather big resolution - 2500 pulses per rotation. The problem is that false pulses get registered from environmental vibrations - if I shake it in my hand or slap a hand holding it with other hand - I get several pulses forth, then several back, then forth again - it looks like decaying sinusoide.
One way to deal with that is to count some amount of pulses that are in the same direction before registering "ok, the rotation has started".
Does anyone know some clever tricks to deal with this kind of problem in microcontroller code?
AI: [...]count some amount of pulses that are in the same direction before registering "ok, the rotation has started"
A kind of hysteresis is proposed by the O.P. If there is a slow but real motion, your actual input will be slow and smooth, but it would be perceived as a series of steps.
First thing that come to mind is low-pass filtering your signal in software. Boxcar average (sliding average), for example, is nice and simple.
Second thing that comes to mind is isolating the encoder from unwanted vibration.
P.S.
There are several philosophies.
Philosophy #1. Attempt to solve optical problems with optics, mechanical problems with mechanics, analog problems with analog, digital problems with digital, software problems with software. In that order or precedence (roughly).
Philosophy #2. Try to solve every problem with software, because software changes are more expedient than hardware changes. If it can't be helped with software, try digital solution. Then try analog... Notice that the order is reversed w.r.t. Philosophy #1. |
H: does PIC require MAX232 for uart?
Sorry for the stupid question but, I'm interfacing a PIC18f46k20 to an Atlas pH sensor module. Both are running on 3.3v. Must I use a max232 between or can the pic talk 232 directly to the module?
The reason I'm asking is it seems in the datasheet (pic) that the baud rate generator doesn't generate the 38400 required by the sensor board so I'm thinking the interface chip (max232) would correct for that somehow? Using the formula on page 249, I'm running at the default internal 1MHz and I come up with a negative value for SPBRGH:SPBRG. Or does the autobaud account for this?
AI: All a MAX232 provides is level translation.
"Traditional" RS-232 uses high-voltages to do it's signaling, generally ~+10V to indicate a logical "0", and ~-10V to indicate a logic "1" (though the spec technically says anything > 3V = 0, and < -3V = 1. In real-world applications, you may see a range of signaling levels represented as "RS232").
However, most modern devices do not have the facilities onboard to generate or handle these (relatively) high voltages. As such, things like your PIC will use 0V and VCC for their signalling levels, representing logical "0" and "1" respectively.
What the MAX-232 does is convert an input level of 0V to an output of ~+10V, and an input of VCC to ~-10V. That's all it does. It will not do any baud-rate conversion at all.
In your case, the datasheet for the Atlas Scientific PH sensor states:
The baud rate is: 38400, 8 bits, no parity, with one stop bit.
The voltage swing 0-VCC, not +/- 12 volts
If standard voltage level RS232
is desired, connect an RS232 converter such as a MAX232.
So you don't need a MAX232, as you don't want or need the ~+-10V signalling levels. Assuming you are using the same power supply for the pH sensor and your MCU, you can simply connect the two devices straight together.
As an aside, I would reccomend putting a 1K resistor between the pH sensor's serial output and your MCUs serial input. This way, if you accidentally set the serial input as an output pin, it will not cause the two device's outputs to fight each other, and potentially damage one of them.
You will either need to change the baud rate of the Atlas sensor, or calculate your own baud-rate generator values for the PIC to make it run at 38400 baud you need.
If you cannot achieve the desired baud-rate with your system clock, you have to add an external crystal or resonator, and increase the system clock so you can.
As an aside, I think you're doing something wrong with your math if you're getting negative numbers for SPBRGH:SPBRG.
That said, 38400 baud is pretty high for a 1 Mhz system clock. You're going to be right at the edge of the top-end which you can run the EUSART at.
From the data sheet:
Assuming:
SYNC = 0
BRG16 = 1
BRGH = 1
n = value of SPBRGH, SPBRG register pair
$$ BaudRate = \frac{F_{OSC}}{4*(n+1)} $$
$$ BaudRate * 4*(n+1) = F_{OSC} $$
$$ (n+1) = \frac{F_{OSC}}{4*BaudRate} $$
$$ (n+1) = \frac{1,000,000}{4*38400} $$
$$ (n+1) = \frac{1,000,000}{153,800} $$
$$ (n+1) = 6.51041666666667 $$
$$ n = 5.51041666666667 $$
so the closest available SPBRGH, SPBRG value would be 6 or 5.
Then, we calculate the baud rate error, which will likely be very high, since we're down at such small SPBRGH, SPBRG values.
$$ BaudRate = \frac{F_{OSC}}{4*(n+1)} $$
$$ BaudRate _{SPBRGH=6} = \frac{1e6}{4*(6+1)}, BaudRate _{SPBRGH=5} = \frac{1e6}{4*(5+1)} $$
$$ BaudRate _{SPBRGH=6}= 35714 , BaudRate _{SPBRGH=5} = 41666 $$
So the two availalbe baud rates are:
SPBRGH=6: 35714, -6.9 % Error
SPBRGH=5: 41666, 8.5% Error
Both are too far from your target baud rate to work, so you have to change your system clock rate. |
H: Can electronics survive in cooking oil?
I came across this image, showing an apparently working motherboard soaked in cooking oil, using the heat from the electronics to deep fry potatoes.
Like most of the internet, the content is of course not trustable. That is why I am asking this question to see if such a thing is at all possible.
I found this question regarding the temperature at which electronics can work, whose answers hint at a maximum of 70C. That doesn't seem true about computers though, as the CPU at least may get even up to 85C and working.
In the image, there is also a thermometer that shows 115, but I can't make out the unit.
So, first of all, can electronics be drenched in oil and still work? If so, is it possible for them to be drowned in oil (which absorbs the heat from the electronics) heated up to such a high degree?
AI: Instead of guessing, read the datasheet. Silicon stops being a semiconductor at around 150°C, so that is a upper limit. However, it still has to do useful stuff, so the practical limit is lower. 70°C is a common "consumer" grade upper limit. "Industrial" grade devices will go higher, usually around 120°C. Military grade can go higher. Of course all this comes at a cost premium.
There are other electronic devices than just silicon semiconductors, and some of them can be significantly less tolerant. Look at the datasheet for a electrolytic cap, for example. Not only will you probably see a low max operating temperature, but you will notice that lifetime is severely degraded at that temperature.
As for the oil, as long as it is water free and insulating, most electronics will probably be OK with it, at least for a while. Some seals on electrolytic capacitors are known to swell up and become useless in mineral oil, so cooking oil probably isn't much better. I'd worry about the cooking oil degrading into other chemicals over time or due to bacterial action, and those chemicals causing problems, like shorts, corrosion, electrolysis, etc. |
H: Upgrading from Altera DE2 to DE2-115
I got a DE2 board that failed so they sent me a replacement board which is the finer DE2-115. But my config file (.sof) is not forward compatible. How can I migrate existing projects that I have for the DE2 to DE2-115? I think I need to define a .sof file and I don't know how to do that, it was my university instructor who gave me a public domain .sof file that works with the DE2 but not the DE2-115. I got a spec error msg saying something like pins are different from the Quartus envirronment. Can you propose or suggest what I should do?
Related question what project I want to program with this gear
https://stackoverflow.com/questions/12872409/how-to-make-pong-for-the-nios-ii-processors
I got C code, assembly and hardware definitions that work with the DE2 already. So I want these in DE2-115 as well instead of getting started from scratch with DE2-115 I just want to move some projects but the .sof file is incompatible beteween DE2 and DE2-115. The big difference is that DE2 uses Cyclone II while DE2-115 has Cyclone IV chip.
AI: The DE2-115-board has a different layout so the peripherals on the board are connected differently to the fpga than on the DE2-board.
I would suggest that you read up on how the external peripherals are connected (in the manual for the DE2-115-board) and change that pin mapping in Quartus. You will also have to specify the correct model of the fpga as well so that Quartus will know what part to synthesize for. |
H: How does program execution happen in firmware?
I have heard from people working in firmware domain, that there is no Operating system controlling firmware (eg firmware in a USB drive). There is just a single thread running in a while loop waiting for an external command, and this is the start point for an interrupt to happen, followed by a ISR and the control flowing all the way till the hardware. But fundamentally what is that part of hardware that is executing the firmware code ? Is there a CPU or is it ASIC based code which is triggered as long the device is powered. I fail to understand the paradigm shift from a regular CPU-OS based system to a firmware.
AI: There is no paradigm shift; in both cases a CPU is executing the software/firmware.
Firmware and software are the same thing; the only distinction is in how it's stored. Software is typically stored on a mass-storage device (e.g., disk drive) and loaded into volatile memory (e.g., DRAM) before being executed. It's easy to change software, by simply replacing the file containing it with a different one.
Firmware is typically stored in nonvolatile memory (e.g., FLASH) connected more-or-less directly to the CPU. It's harder to modify (hence the "firm") and it may or may not be transferred to a different memory for execution.
Really, the operation of a computer with an "operating system" is fundamentally no different from your description of firmware. Remember, the OS itself is just another piece of software — or more likely, a huge collection of mutually-dependent pieces of software. At the lowest level, the CPU is still sitting in a loop of some sort, waiting for things to do. It's just that that loop is buried inside the OS. |
H: RC Circuit, finding time it takes for Voltage across capacitor to rise from 0 to 5V
For the circuit shown below what is the time it takes for Vc to rise from 0 V to 5 V in (second). Assume Vc(0+) = 0 V
The answer is \$ t = 2\ln{2}\$, but I am unsure why. What I have so far:
$$ V(t) = [V(\infty) + V(0)]e^{-t/T} \qquad \text{where $\;T = RC$}$$
R = 2e3 and C = 1e-3 , so T = 2
$$ V(t) = [V(\infty) + V(0)]e^{-t/2}$$
at t= infinite, the capacitor acts like a broken circuit so V(inf) = 0
but the problem also states that V(0) = 0 so that would set whole thing to 0
Am I doing something wrong, or am I even on the right track here?
AI: No, at t = ∞, the fact that the capacitor "acts as an open circuit" means that the voltage across it is the same as the source: 10V.
To get this, apply Kirchoff's voltage law around the loop. Since the current in the loop at t = ∞ is zero, there can be no voltage across the resistor. Therefore, the source voltage must also appear across the capacitor in order to make the voltages around the loop sum to zero.
With this value plugged into your equation, you can now solve for the time at which V(t) equals 5V.
Additional: Your equation is slightly incorrect, too. The voltage across the capacitor is actually
V(t) = V(∞) - [V(∞) - V(0)]e-t/T
The first term represents the final static result, and the second term represents the transient result.
Also, keep in mind that ln(x) = -ln(1/x) ... |
H: Effective use of output signal of a watchdog timer
Subsequent to my previous question regarding watchdog timers, I am interested in deciding the RESULT of such a watchdog:
Assume I add a generic external watchdog timer to my circuit. If not toggled by my microcontroller within the watchdog timeout period, the watchdog will assert a Reset pin LOW for a few-millisecond period, then deasserts the signal.
Now, with this watchdog output signal, I have two options:
Option A: I could apply it to the Reset pin of microcontroller
Option B: I could connect it to the Enable-pin of my Voltage regulator which, in this case, thus resets the power for my entire circuit
My question: Are there any possible concerns with Option B? I have never seen a watchdog timer / reset-IC connected to a regulator in this fashion, whether in a watchdog timer datasheet or elsewhere. However, I find it desirable because that way, I would be able to "restart" all parts/ICs on my board, instead of just the microcontroller.
AI: Using an external watchdog circuit to cycle the power to all your on-board circuity is a rather good idea. It helps to cover cases where some stray external event has caused an upset on some silicon chip circuit. Sometimes these events, whether they be high voltage spikes, reverse bias on signal inputs or even alpha particles can cause localized latchup on-board the chip and the only realistic way to clear such fault is to cycle the power.
Using the scheme to connect the WDT to the enable of the voltage regulator does require some due diligence on your part.
a) Make sure the WDT circuit is not powered by the same voltage rails as the disabled regulator.
b) Make sure that the length of time that the regulator is disabled is long enough. Bypass and filter capacitors on the output of the regulator need to discharge to the greatest degree possible in order to qualify as a power cycle to the silicon. In many instances a millisecond or so of disable time will only allow a partial discharge of the output rails. |
H: How do I choose an appropriately sized stepper motor?
My latest hare-brained project involves a stepper motor. But how do I know which stepper to choose?
I'm adding a stepper to the lead screw of my lathe. It will be used for feeds and threads. For feeds, the behavior of the stepper isn't critical; it just needs to move at a constant speed. For threads, however, missed steps are terrible; when making successive passes, the tool bit won't line up to the previously cut groove as well as it should. This is an open-loop system so once it goes wrong it stays wrong.
Some attributes...
The carriage (the part being moved) is about 10 lbs. It rides on well-lubricated 'ways' but mass is mass.
I don't care too much about the speed of the carriage. When threading, the spindle turns slowly, maybe 1 rev per second, and in many cases even slower. Basically, there isn't a case where the carriage needs to move fast. In the most extreme case, a 4 TPI thread, the carriage would travel 1" in 8 seconds. That's .8 RPS for the stepper for my configuration. Feeds would be much slower.
As stated before, the carriage must not get bogged down and lose a step even as the tool bit suddenly transitions from air to steel. Torque, baby, torque.
When threading, a few thousandths of material is removed per pass.
Advice on how to size a stepper would be appreciated.
EDIT -
I just performed a calculation I found on the Gecko site. According to them, I need a stepper about the size of a thimble. It feels like adding a stepper to a lathe lead screw is a corner case since the movement in inches per second is very low. If I recall, this means the motor would be very torquey but would get hot; current and movement are inversely proportional. So I may need to run the stepper faster and gear it down.
AI: If speed and acceleration aren't a problem, then there are two other mechanical performance issues you need to get right. One is the torque. You should measure the amount of torque required to turn the dials on your lathe while making its deepest cut into steel. You're a mechanical engineer, I'll leave you to think of a way to measure it.
Take a look at the datasheets for the stepper motors you are considering, and they should have a speed / torque graph:
You can see that this motor's torque just about peaks at 0.8Nm. But at this torque, it can barely move. Obviously you wouldn't use this motor for any torque duty above about 0.5Nm. Select a motor which has plenty of torque.
The other issue is the resolution you need. Again, it's up to you to decide what resolution you need, and what your lathe is really cable of. Stepper motors are typically 200 or 400 steps per revolution.
If 1" takes 8s, and the motor is rotating at 0.8RPS, then one revolution gives 0.156" travel (is this a metric lathe?). For a 200 step motor, each step gives 0.78 thou travel. That's pretty good actually. If you used a microstepping motor driver, that will essentially increase the resolution. You should do this anyway, even if you don't want the extra resolution. The microstepping will prevent the motor suffering from the resonance that happens at certain speeds. |
H: Behavior of RLC circuit elements at t = 0
I'm wondering what are the behaviors of the inductor, L, and capacitor, C, at t = 0+
Please correct my understanding of the above circuit if I am wrong.
At t = 0, the capacitor acts like a wire. So I think that Vc must = 0 since a theoretical wire has no voltage across it.
However, if that is the case wouldn't Infinite current be flowing through the capacitor at t = 0 ?
What would the current flowing into the inductor be?
Shouldn't inductor act like a open (broken) circuit at t = 0, which mean no current?
Clarification: The switch is closed for a long time before time 0, at t=0 the switch opens
AI: You confuse the role of capacitor and inductor.
The inductor acts as a wire and the capacitor is an open circuit in static conditions
At t = 0- you have iC = 0, iL = 0.5A and vL = vC = 0
At t > 0 you have iL = -iC, vL = vC and Ic = C*vC', vL = L*iL'
As a consequence of vL = -L*C*vL'' (and iL = -L*C*iL'') you get an oscillation of infinite duration for t > 0. I.e. the voltage at and current through inductor and capacitor are sinusoids with frequency of 1/(2pi*sqrt(LC)) = 1/12.6 Hz.
This is also easily understood: The energy stored in the inductor (supplied at times t<0) is at times t>0 continuously oscillating between the capacitor and the inductor at a frequency corresponding to the resonance frequency of the L-C circuit. |
H: Can a transformer be placed next to RF module?
I'm planning a PIC-based power measuring circuit that will transmit measured data through an RF module to an other PIC. I'd like the circuit to be placed inside one of those casings in which you can plug in an AC device (just like all those digital timers and power measurement devices you can find everywhere). So the whole thing is plugged into the wall, and the AC device is plugged into the casing.
My circuit will include this stepdown encapsulated transformer, a bridge rectifier and a 7805 regulator to power the PIC (I don't want to use an external power supply).
It will also include current sensor and op-amp as described in this project.
My questions are:
Can I place the transformer close to the RF module (as required by the limited space in the casing) without any risk
of distorted signals due to EMI from the transformer?
How do I, if necessary, protect the op-amp from EMI and noise from the transformer?
I don't have a circuit diagram yet as I'd primarily like to learn about the pitfalls and useful tips etc. with this type of circuit.
AI: Radiated noise depends more on household devices that use triacs or SMPS circuits without PFC. If any Op Amp line connected circuit had high impedance with a large loop circuit between ground and neutral, it could pick up noise like an antenna.
I do not see an issue with your AC transformer without more details. Ground could be used as a shield and any external data ought to be opto-isolated or properly designed serial port. If just using an RF Tx, take care on supply and return noise with suitable filters.
You do not want to connect neutral to ground and generate ground currents, other than a noise suppression caps to ground with 0.5mA leakage max total , if used. The RF transmitter should have good immunity from radiated 60Hz if low impedance inputs, but conducted noise must be eliminated.
Your ground path must be carefully designed, whether it is neutral or gnd. Common mode chokes do well to suppress external conducted noise coming in. |
H: Battery Power for RC Car
I'm working on a school group project which involves setting up a remote controlled car with a BeagleBone, webcam, WiFi module and a powered usb hub.
To handle the mechanical side, we bought a cheap car from Walmart and hacked it. It came with a battery compartment that holds 5 AA batteries that the motors run off of (at about 2 amps each. I think one measured 2.5). With Alkaline batteries, that gives us 7.5 volts at full charge. With rechargeable batteries (what we hope to use in the end), that is 6 volts. That's fine for the motors, but the issue I'm running into is the BeagleBone and hub. I'm using 7805s to provide power to each the BeagleBone (which requires one amp) and the hub (which should be about a half amp). The 7805s require at least 7v to function. So, I bought a 4AA battery holder to step up that voltage. Now, if I were to hook up that voltage to the motors, it would be way to much.
Final questions:
Could I safely run a wire from the middle of the battery pack to the motors?
Would that end up killing one set of batteries before the other?
If so, I've read that the less dead set will try to charge the other set. Would that matter if I'm using rechargeable batteries?
Is there a way to step down about 4-5 amps without too much cost or wasted energy (via heat)?
AI: In place of the LM7805, using a Low Drop Out (LDO) regulator such as MIC29300-5.0WT would allow operation at as little as 5.37 volts, providing 3 amperes at that voltage, enough for your Beagleboards but not the motors.
The more expensive MIC29500-5.0WT at $5.46 apiece on Digikey would provide the 5 amps you might want instead.
Tapping between batteries is best avoided with unbalanced loads.
And yes, the batteries loaded higher would deplete earlier, with unpredictable outcomes.
In stepping down 6 to 7.5 volts to 5 volts at 5 amps using an LDO, up to 12.5 watts of heat would necessarily be dissipated at the regulator:
Power dissipated as heat = voltage difference * average current
= 2.5 * 5
However, realistically the batteries won't be at 7.5 volts under load, and not for long anyway. Also, the continuous current drawn would not be 5 amperes through the regulator. Your design would ideally provide the motors with unregulated power, so your "step down about 4-5 amps" deserves a revisit. Besides, voltage is stepped down, not current, at least in this context.
Switching (buck) regulators would waste less heat, roughly around 15% that of the LDO, but they usually need more voltage headroom to operate. YMMV, searching DigiKey might yield what you need.
Why is your hub needing to be powered from the same power as your car motors? Your hub should be at your base station, the car would just carry a WiFi dongle of some sort, ideally?
Suggestions:
Edit: [15-Oct-2012] Provide regulated power only to the logic parts, drive the motors directly off the battery, and add a hefty decoupling capacitor before the regulator to work around motor inductive spikes. If your batteries can handle 4 motors of 2 amp each, they can handle the initial surge the capacitor will need.
Provide a diagram of some sort, of what is being attempted, and some clarity on how the powered hubs got aboard the moving car. This will enable more helpful answers. |
H: Lowering voltage linear
Possible Duplicate:
How can I use a 12 V input on a digital Arduino pin?
I want to measure a car battery voltage (range is between 10-13v). But my AVR accepts analog inputs from 0-5v. How can I make the input voltage lower so I can measure the 3v voltage difference (10-13v) in around 1024 steps (0-5v from the microcontroller).
Basically I need a voltage step down converter that works linear, the ones I know only give out a fixed voltage (5-20v converts to 5v always like the 7805).
I don't want to use a voltage divider because then I can never get that 3v resolution I think.
AI: You can use a simple resistor divider to scale the 0..13 V down to 0..5 V.
\$V_{out} = \dfrac{R_2}{R_1 + R_2} \cdot V_{in}\$
so that for \$R_1\$ = 16 kΩ and \$R_2\$ = 10 kΩ you get 0..5 V out for 0..13 V in.
That's the most simple solution, but it will map the 10..13 V to 3.85..5 V rather than to 0..5 V. The question is: do you really need the ADC's full range? A 10-bit ADC gives you a resolution of 13 mV for a 13 V input range. Do you really want to know the battery's voltage to 3 mV precise?
Anyway, if you do want to use the ADC's full range the solution is a difference amplifier, which subtracts a 10 V offset from the input voltage:
if \$R_1 = R_2\$ and \$R_f = R_g\$ then
\$ V_{out} = \dfrac{R_f}{R_1} \cdot (V_2 -V_1) \$
You apply a 10 V reference voltage to \$V_1\$ and connect the battery to \$V_2\$. Select 25 kΩ for \$R_f\$ and \$R_g\$, and 15 kΩ for \$R_1\$ and \$R_2\$, and you'll get 0..5 V out for 10..13 V in.
To use the full range down to 0 V out you'll need an RRIO (Rail-to-Rail I/o) opamp.
Note:
You can't use the optocoupler solution from the question I refer to here, since that is digital only. It saturates the output if the input voltage is present, and is by no means linear. If you want the input to be isolated from the output you can use a linear optocoupler, like the IL300 I refer to in this answer. |
H: Conductive object to raise 6mm height off PCB
I am designing a PCB where I expect to have a certain part assembled at the edge of each board (blue in the picture below).
However, this part needs to be at connected/soldered at a height of about 6 mm above my PCB. Therefore, I'm considering using some conductive object/part to create the vertical displacement (green in the picture below).
So far I have considered
right-angle header pin; but may be too thin/flimsy.
zero-ohm resistors (0402-sized or 0603-sized); but I'd need to stack too many of them to get the 6 mm height.
I am interested in ideas for some object/part I could use for the 6mm height-creation; anything as long as it would be:
inexpensive
widely available
conductive
preferably NOT through-hole (soldered on PCB top surface)
What would be ideal is if it were just a 6mm cube of conductive material, but no such normally-sold object seems to be readily available!
(Note: This height-creator needs to be strong in its soldering to the board, just as any standard part soldered on a PCB, but it does NOT need to be strong in its soldering to my blue part.)
AI: Use an inverted brass flat head machine screw. These will solder easily and depending the mechanical strength you want the part can be selected from a range with various head sizes.
Some possible candidate machine screws would be these part numbers from McMaster-Carr.
Length of 6mm
99658A524 M3 $9.68/100
96686A150 M2 $10.58/50
96686A210 M3 $7.94/50
Lower Cost with length of 6.35mm
92451A092 #3-48 $4.21/100
92451A106 #4-40 $4.29/100
92451A124 #5-40 $5.27/100
92451A144 #6-32 $5.90/100
92480A106 #4-40 $4.72/100
92480A144 #6-32 $5.85/100
This would certainly meet your criteria of being inexpensive, widely available, conductive and NOT through-hole. See the search page here. |
H: problem with printing function return value
I am new to programming. I have small doubt, I know this is simple question but I am confused. I have the following function:
void ReadAdConfReg(void)
{
SPCR = 0x5D;
ADC_CS = 0;
while (MISO_PIN != 0) ;
spi(0x50);
adcConfig = spi(0xFF);
adcConfig = (adcConfig << 8) | spi(0xFF);
ADC_CS = 1;
}
I have declared adcConfig as global variable: unsigned int adcConfig.
How can I print the adcConfig value. Because this is a void function, it doesn't return any value.
I have tried like this:
ReadAdConfReg();
printf("configreg:%d",adcConfig);
Is it wrong? Or how can I print adcConfig value.
Controller is ATMega32A, compiler CodeVisionAVR.
AI: If need the function to return a value it can't be declared void. As you have it now you have to call the function first, then pass the global variable into the printf function. So what you are doing should work.
To use the function with a return value, do something like this:
unsigned int ReadAdConfReg(void)
{
unsigned int retVal;
SPCR = 0x5D;
ADC_CS = 0;
while (MISO_PIN != 0) ;
spi(0x50);
adcConfig = spi(0xFF);
adcConfig = (adcConfig << 8) | spi(0xFF);
ADC_CS = 1;
return acdConfig;
}
(note - the previous edit used a local retVal, whilst leaving the adcConfig variable present which may have been confusing. You can pass the adcConfig directly as it's the correct type. If you want the function to be independent of the adcConfig though, use the local retVal instead in place of the adcConfig - this is probably better than using a global variable)
Then you can do:
printf("configreg:%d", ReadAdcConfigReg()); |
H: Sponge-thing that makes buttons pop back out is torn, any fix?
I'm not sure if this question is fit for this forum. This is my problem, I have a USB game controller (generic) and the spongy thing that's supposed to make the buttons pop back out is slightly torn. This, I believe is what's causing one of the buttons on my controller to get stuck for a few seconds before popping out again as opposed to the other 3. I included an image of what I'm talking about below.
The black parts are those that touch the electronics on the controller. So I wanna know, how do I fix this by, say, using glue of some sort?
AI: Once the plastic is torn it is pretty much stuffed, so best thing is to search out a new part or buy a new controller.
Source: Flogging my AMIGA 500 joysticks to bits and trying to fix them, they used these kind of pads. |
H: What is bit banging
I am new to microcontroller programming. I am using ATmega32-A controller and CodeVisionAVR compiler. I am using the waveform generator(AD9833) to generate a sinewave signal using SPI communication. I am able to generate the sinewave successfully. Now I am passing that signal to the sensor. The sensor output is selected through the multiplexer and sent to the ADC. Now I want read ADC values using SPI communication. I have tried a lot to setup the registers of ADC. Still it is not working. To see SPI communication Code have a look at my previous post ADC registers setup using spi communication. I am using USART(RS232) communication to print values on PC(PuTTY).
Someone advised me to use bit-banging. I am new to that concept. Can any one provide me an example code of bit banging of SPI communication. How to start that procedure? Can any one provide me a good materiel. Do I need any external hardware?
I have written this, including pin connections:
#define ADC_CS PORTB.3
#define MOSI PORTB.5
#define MISO PINB.6
#define SCK PORTB.7
void send_8bit_serial_data(unsigned char data)
{
int i;
ADC_CS=0;
for (i = 0; i < 8; i++)
{
// consider leftmost bit
// set line high if bit is 1, low if bit is 0
if (data & 0x80)
output_high(PORTB.5);
else
output_low(PORTB.5);
// pulse clock to indicate that bit value should be read
output_low(PORTB.7);
output_high(PORTB.7);
// shift byte left so next bit will be leftmost
data <<= 1;
}
// deselect device
ADC_CS=1;
}
AI: Bit banging is creating the whole series of pulses in software, instead of relying on a piece of hardware inside the microcontroller.
Many microcontrollers have a hardware SPI, and then all you have to do is write a byte to the output register, and the SPI controller will shift the data out, and at the same time receive data from the slave. You can get an interrupt when the transfer is complete, and then read the received data.
But some microcontrollers don't have the SPI hardware on board and then you have to simulate it by doing everything manually. SPI has a number of different modes, I'll use this pulse diagram as an example:
So while a dedicated SPI controller takes care of all the pulses, data shifting and timing, when bit-banging you have to take every action yourself:
Make Slave Select low
Short delay
Do 8 times
Make the SCK (Serial Clock) pin low
Make the MOSI (Master-Out-Slave-In) pin high or low depending on bit 7 of the data
Add brief delay
Make the SCK output high
Read MISO (Master-In-Slave-Out) pin
Shift received data left, and shift the bit just read in as bit 0
Add brief delay
Shift the data byte 1 bit left
Make Slave Select high again
Bit-banging SPI is relatively simple, the code for bit-banging I2C for instance will be more complex, and you'll need a timer somehow if you want to bit-bang the UART protocol. |
H: Minimal ARM circuit requirements
I have done some development with the ATMega and I'm looking to broaden my horizons. I have a couple Cortex M4 series chips and would like make an ARM equivalent to the Breadboarduino
I plan to either etch my own board or use a breakout board for the ARM and breadboard the rest. A reference or schematic of the minimum components would be greatly appreciated.
Are there any good resources for determining the minimum required components to operate, and ideally program, an ARM chip?
UPDATE:
I'm open to alternative hardware suggestions. Below is the chip that I'm currently trying to work with:
STM32F407ZGT6
Datasheet
AI: This really depends on the chips you are using - you didn't specify which one you got. Typically you would need at least a crystal, decoupling caps and reset logic. The programming interface might be a simple JTAG interface.
But all of this should be stated in the chips data sheet.
Update (for the STM32F407):
Look at the following pages in the data sheet
23ff. for the needed voltages (1.8-3.6V, so you need a regulator), and how to use the internal regulator (by pulling pin PDR_ON high)
69ff. for the pinouts
69+74 for the power supply scheme (this are the most interesting pages since they show the power supply connections and the needed capacitors)
You won't need a reset circuit (it's integrated - see page 23) or an oscillator (the integrated 16MHz oscillator is selected on startup, see page 22). So using a LQFP144 breakout board (like the one from futurlec(see bottom of page) might really be enough.
You can also look at the schematic of the STM32F4DISCOVERY board (see it's user manual, page 33. What you see there is the basic circuit - and it even contains the external crystals. |
H: Minimization of Logical Equations
I have been giving a problem were I have to design 1-bit subtractor, which performs single bit binary subtraction. It has three inputs: the digits ai, bi (bi is subtracted from ai) and the borrow from the previous 1-bit subtractor Bi-1. The outputs are Di (the difference) and the borrow Bi from the next 1-bit subtractor. Present all four stages (truth tables of the both functions, sum of products, minimization and logical circuits). During minimization follow the same approach that we used in class for 1-bit adder design.
I have search around, but I still cannot figure out how to approach this problem. If anyone could shed some light it would be greatly appreciated.
AI: I'm not going to tell you too much; you show too little of your own efforts. Just a few basic tips to get you started.
You'll have to start with the truth table. With 3 inputs you have only 8 combinations. Start without the borrow bit (the half of the table for which it's zero). Then subtracting shouldn't be too hard: what's the result if you subtract 0 from 1? Or 1 from 1? If you want to introduce the borrow bit it could be useful to do the subtraction of two decimal numbers, that should be familiar since elementary school. Observe how the result is different with or without borrow. Keep it simple: 25 - 13 is without borrow, 25-17 is with borrow. That should get you started. |
H: Designing with AC'97 - why does it not have a (FIFO) buffer?
The AC'97 codec seems to dominate the world of digital audio I/O but, what is weird is that it has neither interrupts nor buffers so that it is difficult to interface with a controller, which has other activities. The AC97 demands polling it periodically (44k times per second), checking for the time to communicate a next sample. This is not the usual way of communicating usually. Usually, CPU fills a buffer and is notified when the operation is complete or waits explicitly for the result if it has nothing else to do. Such "batch processing" is more efficient because, at first, sending bursts is more efficient that doing one item a time and, secondly, it reduces context switching n times, which also optimizes the computational resources accordingly. But, you need a FIFO for that. What is good in this, on sample at time, terrible design of AC97 and why does nobody care? I see that Xilinx fixes it with ML507 demo board (I see FIFOs in AC97 controller introduced there) but I have Digilent's V5 Genesys board whose controller does not provide any FIFO. So that Microblaze must communicate one sample every 1/44100 of a second. Is it efficient? How are you supposed to control it?
AI: The AC-link part of the AC97 specification defines the five-wire interface between the codec and a controller. This is not just a data interface, but also a timing interface. This distinction may not seem important in a small embedded system with just one codec, but it becomes crucial in a larger system, such as a 96-channel digital mixing console. In this type of system, all of the audio interfaces need to be running at precisely the same sample rate and phase alignment, and the AC-link standard is designed to support that.
As the other answers have hinted, it is the responsibility of the device at the other end of the link — the "controller", which could be a dedicated ASIC, part of an FPGA, or a microcontroller — to manage both the timing of the codecs in the system as needed, as well as the movement of data from one timing domain to another with the use of suitable FIFOs or buffers. |
H: How to re-generate a previously saved SIRC protocol waveform?
I am trying to replicate the remote control for my Sony home theater system. I started with anaylzing the demodulated signal of power on button using a TSOP1738 IR demodulator. It looks like this:
You can see the signal (along with the decoded command).
Next I replicated the signal using the Arduino (and as per SIRC protocol, chose 1/4 duty @ 38Khz). Below is the signal of a complete one to show the code sent and a zoomed one to show the 38Khz 25% duty burst within the signal.
Now to drive an IR LED using this signal, I fed this into a 2N2222 NPN BJT transistor's base with its collector connected to +5V and base to IR LED -> Series Resistance -> GND. And to test the signal I fed this "generated" signal through the TSOP1738 again and probed the output.
The signal I get looks like an IR signal except for the 1's (when TSOP1738 goes LOW) instead of being LOW for a duration, as in the first image. I see a lot of toggling going on:
The "generated" signal, of course, does not work. Any idea what's going in here ?
AI: Since I do not have "Comment" privileges, I'm responding in Answer form, though this is not an answer:
Are you sure your IR LED is connected to the base of the transistor as you state, and not like the first schematic on this page?
Is the IR LED you are using, of the same IR wavelength as is expected by the TSOP1738, i.e. 950 nanometer or therabouts?
Possible answer:
Your oscilloscope trace of the Arduino generated signal shows a PWM frequency of 39.215 KHz, and the final signal trace shows effects typical of aliasing between two windows of slightly different frequencies. Try getting your output closer to the nominal 38KHz, and recapture results for this discussion, please.
[Edit: Woohoo, I just received "Comment anywhere" privileges! So I'll leave this answer in place and amend it towards a valid answer if I can.] |
H: Circuit analysis - software?
Surely there is some software that lets you draw a simple circuit diagram (DC voltage source and resistors) and then tell you the voltage, current, resistance, and power on R1, R2, R3, etc as well as totals.. instead of having to do it by hand, right?
The only things that seem to be able to do this that I've found so far are enterprise level software that look like they were designed in the 90's. Places like docircuits.com and circuitlab.com don't tell me the resistance total (for example in series-parallel circuits), or they would be decent.
AI: LTSpice (http://www.linear.com/designtools/software/) will easily do all that and more besides. You can build up the circuit, define your voltage sources and then measure power in all the components, and power being used by the voltage source.
What you're after though is very basic with regards to analysis, so basically any Spice software will handle this. LTSpice is free, as is Tina, and many others. Certainly LTSpice has a great community around it, which sounds like it'll be useful (have a look at the LTSpice users group)
Also, if you want to find overall resistance, then you can find this from the voltage supplied and the overall current draw. For simple DC stuff you can take the values from Spice and bung them into a calculator, or you can do math with sources in LTSpice to be able to plot the resistance out over time for more complex AC analysis |
H: What's the difference between a microprocessor and a CPU?
Possible Duplicate:
What’s the difference between a microcontroller and a microprocessor?
Please inform me of the difference, if any.
AI: A CPU (central processing unit) is the part of a computer that executes instructions. This can be implemented using a single IC, a number of ICs, discrete transistors or a room full of vacuum tubes.
A microprocessor is a single-chip implementation of a CPU.
Nowadays pretty much all CPUs for general use are microprocessors, causing the two terms to be practically synonymous. |
H: Circuit explanation, role of the trimpot and capacitor, as shown in a part of the circuit
Here is a part of the IOIO circuit
.
Wondering if someone could explain the role played by the trimpot (R2) there (why not a fixed resistor?) and the role of the capacitor (C5).
AI: I think the confusion arises because the schematics is poorly drawn. C5 is connected between 3.3V and Ground, while the 3.3V is also connected to pin 35 -> it is a decoupling cap. the trim pot is connected as a variable resistor from the 5V rail and VBus, so it is acting as a Pullup resistor. In the USB spec the various pulllup's on various pins allows for setup information to be determined by the various devices - so it looks like this meant to be adjustable for either experimentation reasons or other more subtle reasons.
As an aside, the floating end of the TRIM Pot should be connected to the wiper.
Typically the D+/D- lines have pullups to indicate speed class, but there I can't find the place in the spec where the Vusb is pulled up.
USB V2.0 spec here from the source
You can tell this is a high speed connection because of the lack of Pullup resistor on the D+/D- lines. My best guess is that the resistor on the Vusb is mean as a current limiter to ensure that only self powered devices attach. If it draws any amount of power the voltage drops and the device will reset itself. But someone with a more intimate knowledge of the spec will ave to comment. |
H: Problem with while loop
I am trying to read external ADC AD7798 values using ATmega32-A controller. In the datasheet, Status register Bit 7 (SR7) indicates the conversion is finished or not:
Ready Bit. Cleared when data is written to the data register. Set
after the data register is read or after a period of time before the
data register is updated with a new conversion result to indicate to
the user not to read the conversion data. It is also set when the part
is placed in power-down mode. The end of a conversion is indicated by
the DOUT/RDY pin. This pin can be used as an alternative to the status
register for monitoring the ADC for conversion data.
Now I want to write code to check if the Status register MSB (Bit7) is 0 or not. So when it is 0, only then can I issue a read command.
I have written code like this:
unsigned char CheckStatus(void)
{
char adcStatus;
spi(0x40);
adcStatus = spi(0xFF);
while((adcStatus & 0x80)!=0x80);
return adcStatus;
}
But it is not working.
My code explanation:
Issuing the read command to read ADC status register.
Reading ADC status register value and stored in adcStatus variable.
Checking the MSB bit is not equal to 1. (I am not sure if this while loop is correct or not.)
I want to check if the Status register MSB is not equal to 1 so that I can issue the read command (0x58) to read in the ADC values. If the status register MSB is equal to 1 then I can't read ADC values.
What am I doing wrong?
AI: You need to re-read the ADC status register inside the loop; otherwise, you're just re-testing the bit you read the first time. Also, you need to reverse the sense of the test — you want to repeat the test if the bit is "1" and drop out of the loop once it switches to "0". It may also be necessary to toggle chip select to the ADC on each read, as shown in the comments below.
unsigned char CheckStatus(void)
{
unsigned char adcStatus;
do {
/* TBD: assert chip select here? */
spi(0x40);
adcStatus = spi(0xFF);
/* TBD: negate chip select here? */
} while ((adcStatus & 0x80) == 0x80);
return adcStatus;
} |
H: Time delayed optionally postponable from a second input
I need functionality similar to that provided by true-off-delay relays, just a little different. I can't come up with a circuit.
I have two inputs (A and B) that I want to control one output (C).
Both inputs can act as resets for the timeout, but only one input (A) can activate the output (C) initially.
I've made an illustration:
"t" represents a 5 minute timeout, if it is reached then the output needs to switch low
I hope this makes sense!
Any help appreciated.
AI: This is a perfect problem for a tiny microcontroller. Even the tiniest and smallest, the PIC 10F200, can do this job easily. The logic itself is trivial. The PIC has a built in oscillator so can perform the 5 minute timeout also. This is really about as simple as it gets. You don't want to do 5 minute timing in analog electronics, and then you'd still have to implement the logic function separately. |
H: Basic code to switch LED for PIC18f4550 C18 not working
Ok, I'm sure it's something stupid but this is probably the 20th variant of this code and I can't get it figured out. I simply want a (debounced) switch to trigger an LED on the PIC18f4550. Should I be using a different port for the switch? Here's my code:
void main(void)
{
TRISBbits.TRISB0 = 1; //switch input
TRISBbits.TRISB3 = 0; // LED output
PORTBbits.RB3 = 0; // make LED low by default
TRISEbits.TRISE2 = 1; // alternate switch input
while (1) { // doesn't work for some reason
if (PORTEbits.RE2 == 1) {
LATBbits.LATB3 == 1;
}
else LATBbits.LATB3 == 0;
}
}
Tried to post the config code but it screwed up the formatting here.
EDIT: sorry for the ugly formatting, but here are the config settings. Had to change some things to keep the formatting from getting weird.
include stdio.h
include stdlib.h
include p18f4550.h
include delays.h
// chip config ////////////////////////////////////////////////////////////////////////////////////
pragma config PLLDIV = 5
pragma config CPUDIV = OSC1_PLL2
pragma config USBDIV = 2
// internal clock, pin #14 (RA6) as I/O pin, pin #13 unused,
pragma config FOSC = INTOSCIO_EC // if OSCCON is left as default clock speed will be 1Mhz
// now the other less confusing options . . .
pragma config FCMEN = OFF
pragma config IESO = OFF
pragma config PWRT = OFF
pragma config BOR = OFF
pragma config BORV = 3
pragma config VREGEN = OFF
pragma config WDT = OFF
pragma config WDTPS = 32768
pragma config CCP2MX = ON
pragma config PBADEN = OFF
pragma config LPT1OSC = OFF
pragma config MCLRE = ON
pragma config STVREN = ON
pragma config LVP = OFF
pragma config ICPRT = OFF
pragma config XINST = OFF
pragma config DEBUG = OFF
AI: You didn't show the external circuit, but if you just have a switch connected between the input pin and ground (or power), then that's not enough. That will drive the pin one way when the switch is closed, but leave it floating when open. There is no guarantee what state it will be in when left floating. To fix this, tie a pullup or pulldown to the pin that pulls causes it to go to the opposite polarity when the switch is open.
For example, tie the switch between the pin and ground, and then the pullup between the pin and Vdd. use 1 - 10 kΩ for the pullup.
Some pins of that PIC can be configured for internal pullups. RB4-RB7 can but possibly others on that PIC (your job to check the datasheet). If you enable the internal pullup, then the only external part you need is the switch between the pin and ground. |
H: transformer conservation of power
lets say we have a transformer, on the left side, it is 220 v and on the right side, it is 10 v. we know that power is conserved meaning power on left is equal to right (ignoring loss). I understand how voltage is stepped up or down (induced emf on the other side, if there are more coils, it will produced more emf and so it will stepped up, vice versa), but how does it actually make the current low or high (or adjust), to make the power still equal?
AI: In a perfect transformer run in forward mode, the change in secondary current exactly ballances the change in primary current to keep the magnetic flux the same.
This means the effective current going around the core in each of the primary and secondary must be the same but in opposite direction. The transformer only sees the current going around the core. The multiple turns of a winding only make it look like more current overall going around. To the core, 13 turns of 1 A each is the same as 26 turns at 1/2 A each. The same overall current is still circling the core.
The current that actually flows thru each winding from the external circuit point of view is the current thru each winding since they are effectively in series. The external current is therefore inversely proportional to the number of windings.
Let's say your transformer has 100 A circling the core. That might be 880 turns on the primary, for 114 mA thru the primary from the outside point of view. In this case, the secondary would have only 44 turns. For the ideal case, this would also have to produce 100 A circling the core. Since each turn only contributes 1/40 of that, the current thru the secondary wire needs to be 2.5 A. |
H: Does anyone know the part number for the package with marking code "MAAC A65A"?
It's a 8-pin, MSOP Package component.
Can you provide a datasheet for it?
AI: I applied some Google-fu and I found the datasheet for this device: LMH6643.
It's a Low Power, 130 MHz, 75 mA Rail-to-Rail Output Amplifier from Texas Instruments. |
H: ultra low noise reference and supply voltage with multiple ldo's in parallel
I need a very low noise power supply and ADC reference voltage for an 24 bit ADC measurement (I need noise level less than 5 uV peak to peak on both power supply and the ADC reference voltage. Supply current can be around 100mA)
I would like the ask the method mentioned in this link
Shortly it says adding 3 LDO output with an op-amp then dividing by 3, it reduces the effective noise on the final output. Will it work in your opinion?
What other methods do you advice?
AI: That technique looks quite silly actually. The best one can hope or is an improvement of sqrt(3) at best for a lot of work. And he is using chopper stabilized op-amps which can leak tones into the ADC.
Good low noise design requires accurate analysis of all noise sources. I scanned the paper and saw no mention of thermal/Johnston noise as a bare minimum.
On a component/board level there are many op-amps that you can use and then filter. Instrumentation amps might be a starting place. |
H: How to build SIPO from RS
can anybody help me how to build a SIPO (Serial In Parallel Out) register just from the RS or RS edge triggered flip flop circuit?
I have tried to build this, but I think its not working. I simulating it in a LOGO!Soft Comfort, and I can not use a different program because its a school project
AI: http://www.cs.smith.edu/~thiebaut/270/datasheets/sn74ls95brev5.pdf
A shift register does just that. Pull up the datasheet for a 4-bit shift register, like the one above, and it will show you a diagram of the effective logic by which it accomplishes this |
H: Selecting power supply unit for an embedded system
I am sorry if this is too naive question in this site. I am from non-electrical-engineering major but I am trying to build an embedded system which will be in a real-time imaging system box along with camera. It will be possibly running 24 h/day
Currently, I have a PC/104 motherboard ADLGS45PC with Intel CPU on it, and the system will have 2-3 SSD or SATA HD with USB port to camera. Naturally, I will need to have a power supply unit for the system. But deciding the PSU seems like a complex puzzle to me.
Question 1. What would be right power supply for this system? Choices are
Desktop PSU
PC/104 Power supply unit DC/DC
PC/104 Power supply unit AC/DC
Question 2. What is right way to decide total amount Wattage for the system?
Following is the list of power consumption for each component in the system I got for PSU unit.
Motherboard: 13-20W from motherboard manual
64GB WD sillicondrive A100's power consumption is 5V 0.9W (Active) -> 2W
512 GB Crucial SSD 6Gb/s CT512M4SSD2 ($400): 0.15W (Active) -> 2W
320 GB WD Scorpio Black HD ($62): 1.75W (Active) -> 4W
USB 2.0: 5V x 500mA = 2.5W => 6 x = 15W
Network port: 5W
Totaling above items is about 60W + 20W (for some extension). Is this right way to calculate wattage for PSU?
AI: You need to break down ALL of the supplies into Voltage, Amperage and Wattage.
- why don't you tabulate that in the question?
Once you have that then you can calculate the total wattage, and compare it against the various options you have for required Voltages vs. the current at each voltage.
You should expect to over size each supply by 15% (although others may have a different opinion on that) |
H: Heating up a container - most efficient
I got a container that must be heated up to atleast 250 celsius, but I don't have alot of space to work with and I am also not so familiar with this kind of topic.
So I've attatched an image which shows my design. Everything in the color dark blue or red will be in iron or steel or even stainless steel, the red container will be in the same material as the blue discs, but I've colored them to visualize what that will be going to 250 celsius and what that should not be heated at all.
I was thinking about heating it up by using the container as a resistor, shown on the second image I would have a circuit of a copper cable going into red through the container out from green and then to a power supply unit (400W, same thing that powers most stationary computers) which leaves me at 12V and X amps. I do have an N-Channel MOSFET 60V 30A and an arduino and a Thermocouple Type-K for controlling the heating.
So my question to you is: Will it even work having the container as a heater? Or do I need some heating-resistors?
On the image below I've shown the diameter for calculation purposes. The resistance got something to do with the area through the material, and I'm sadly not sure how to exactly calculate it since it's going sideways rather than vertical.
I will be checking out this topic about once per day so if there's any extra information you need or even the model itself then I'm happy to give it to you, but since it's a blueprint of something very valueable to me I don't want to give it away unless it's necessary.
AI: The problem with using the container as a resistor is that it's actually a very good conductor. Your wires will have more resistance, and will therefore get hotter than the container.
What would be amazing is if somehow you could deliver a very high current to the container, using a lower current flowing in the wires. Well, you can!
A very efficient way to heat an iron or steel object is by Induction Heating. It's used a lot in industry for heating bearings and things. It's also quite possible to do it yourself. Many people do.
It works by inducing an alternating current in the object to be heated. Essentially you're creating a transformer, where your object is the (single turn) secondary coil. Much more current can be made to flow in the secondary coil simply by using many turns in your primary.
An induction heater can get things really hot if you want:
And you can even use it to heat large containers: |
H: 'Stiffening' capacitor/s for DIY flash battery pack?
I'm planning to build a DIY battery pack for one of my camera flashes that involves basically wiring a bigger external battery to the battery leads in the flash. Admittedly I don't know much about electronics but keep my feet just oh-so wet in it.
The main goal for doing this is actually to improve recycle times of the flash with the added benefit of longevity from the battery.
Question #1 is: Whether or not there would be any benefit to adding a capacitor or two to provide a limited rapid-charge for a quicker, subsequent re-charge after the flash goes off the first time.
My rationale is: often the flow of taking photos involves a flash or two; or three; change spots/framing/talk to subject (which by then the capacitor/s might be recharged to supply the benefit again)
Question #2 is: Is there a formal word/phrase for what this process (a capacitor used for rapid discharge in tandem with a battery) is so I can do further research for academic purposes.
More details:
The battery supply is 6V - there's a variance on how much the flash is willing to draw based on the supply (4AA's vs. the bigger battery mentioned in my links); I don't know what, or if there are limitations on what kind of current the flash can draw (hence if it can benefit from caps). There's an external AC adapter that supplies 200V@4mA for the flash.
AI: I doubt that there would be much benefit to adding a capacitor across your battery. Consider the following:
The charging of the flash can be seen as a process of moving energy from the battery to the high-voltage capacitor in the flash.
Based on some quick searches, the capacitor in the Vivitar 285HV is 1000 uF. Assuming it's charged to 200V, it stores 20 J of energy
A capacitor to hold 20 J at 6V would be 1.1 Farads, and that's just enough energy for a single charge of the HV cap. Assuming 50% conversion efficiency, and that we want 3 shots that's a 6 F capacitor. The least expensive capacitor I found with some margin over the 6 V working voltage and with that kind of capacitance was over $100, and 8 inches long.
Just to supply 20 J directly from a 6V battery in 1 second with 50% efficiency would mean a current draw of about 6.7 A. That's a lot of current, but it's something that a large battery can do.
The charging circuit in the flash will limit how quickly we can charge no matter how much power is available at the input. An easy way to see if the charging circuit is the limiting factor rather than the input power is to measure the voltage across the battery while the flash is charging. If the voltage remains close to the open circuit voltage of the battery, then it's the charging circuit that's limiting, not the battery. |
H: Why is my negative peak detector behaving poorly?
Background
I have an amplitude detector circuit which consists of positive and negative peak detectors fed into an instrumentation amplifier.
The purpose of the circuit is to output the amplitude of an AC square wave. The reason I have both positive and negative peak detectors is because the square wave is not symmetrical about 0V. There may be up to a 200 mV offset for a 12V peak-to-peak square wave. If I had an input that was known to be symmetrical, I would just measure the positive peak and double it.
The circuit mostly works as expected.
Problem
For a 200 kHz, 7 Vpp square wave, the positive peak detector is only ~1% off from the peak positive wave voltage indicated on my oscilloscope. However, the negative peak detector output is ~10% less (in magnitude) than the peak on the negative side of the wave, and has large offsets when inputs are small.
Below is some data I measured from the actual circuit with square waves of various amplitudes and offsets at 200kHz. V+peak is the peak positive voltage of the square wave at the input to the circuit. V-peak is minimum negative voltage of the square wave. V+out is the output of the positive peak detector. V-out is the output of the negative peak detector.
V+peak | V-peak | V+out | V-out |
0.22V 0.00V 0.22V 0.17V
2.16V -2.40V 2.15V -2.08V
3.66V 0.00V 3.63V 0.18V
3.48V -3.84V 3.48V -3.49V
Notice there's also a pretty extreme offset voltage from the negative peak detector on DC square waves (the ones that don't go below 0V).
My negative peak detector has exactly the same circuit as the positive detector (shown), except that the polarity of the diodes is reversed.
Circuit explanation
Initially, the capacitor is discharged (0V) by R11 and U3 is in negative saturation. D3 blocks current. D4's bias current is provided by U1 through the 47K resistor. This configuration exists to prevent the diodes' reverse leakage from draining C12 and reduces droop of the output signal.
If U3's non-inverting input exceeds the voltage of the capacitor, the output of U3 races up to a positive value and current flows through D3 and D4. The voltage drop of the diodes is negated due to the feedback voltage being after the drop. The capacitor charges until it reaches VIN or when VIN drops below it's the capacitor's voltage, at the time of which U3 goes back into negative saturation. The capacitor slowly discharges through the R11. This is a major source of droop on fast or low duty cycle signals since it will discharge some before the next wave peak.
U1 is a unity-gain output buffer that prevents the next stage from draining the capacitor.
For the negative peak follower, the same explanation holds, except that the input op amp can't charge the capacitor unless its output is negative in excess of the capacitor's charge voltage.
Here's the data sheet for the AD843: http://www.analog.com/static/imported-files/data_sheets/AD843.pdf
It has a high slew rate (250V/us) and output current (50 mA) and low offset voltage (1 mV).
Question
Why is my negative peak detector performing so poorly (offset voltage, droop) compared to the positive detector?
Am I missing some essential element in converting the positive peak detector circuit to a negative peak detector?
AI: There are several points in the AD843 datasheet that appear to be relevant.
I first spotted the "Overdrive Recovery" time (under the general category of "Frequency Response"). Note that the recovery time for positive overdrive (found in your negative peak detector) is significantly longer than the recovery time for negative overdrive (found in your positive peak detector). Half a microsecond when your pulse width is on the order of 2.5 µs (half-cycle @ 200 kHz) could be significant.
Second, the datasheet specifically mentions that the AD843 has trouble driving capacitive loads. Your 10 nF capacitor is more than an order of magnitude larger than any example load they mention in the datasheet.
Third, there is a peak detector circuit given in the datasheet. The topology is slightly different from yours, but more significantly, they use the AD843 in the output stage, but use an AD847 in the input stage "since the AD847 can drive an arbitrarily large value of capacitance". |
H: Precise timing with a PIC18 microcontroller?
I'm trying to write a software serial implementation and am having trouble with timing. I'm using Timer0 on a PIC18F242 and for some reason it does not seem to be very accurate.
I've been trying to debug the problem by toggling a pin on the microcontroller and watching the frequency on my oscilloscope. The oscilloscope shows that the period is greater than it should be, and I don't know why.
With my full code the period was something like 10us too long, if I remember correctly, but even with a very simple example, such as the one below, the timing is off.
Here is an example:
#include <p18f242.h>
// fuse configurations
#pragma config OSC = HSPLL
#pragma config OSCS = OFF
#pragma config PWRT = OFF
#pragma config BOR = OFF
#pragma config WDT = OFF
#pragma config LVP = OFF
#pragma config CP0 = OFF
// CALCULATIONS:
// 8Mhz crystal with PLL enabled
// FOSC = 4*8Mhz = 32MHz
// TOSC = 1/FOSC = 31.25ns
// TCY = 4*TOSC = 125 ns
// timer has 1:8 prescaler, therefore timer increments every 8*TOSC = 1us.
main(void)
{
// port configuration
TRISBbits.RB1 = 0; // make RB1 an output
// configure Timer0
T0CONbits.TMR0ON = 0; // disable (stop) the timer
T0CONbits.T08BIT = 0; // 16-bit timer
T0CONbits.T0CS = 0; // use internal instruction clock
T0CONbits.PSA = 0; // use prescaler (prescaler assigned below)
T0CONbits.T0PS0 = 0; // 010 = 1:8 prescaler
T0CONbits.T0PS1 = 1;
T0CONbits.T0PS2 = 0;
T0CONbits.TMR0ON = 1; // enable (start) the timer
while(1)
{
if(TMR0L >= 100)
{
PORTBbits.RB1 ^= 1;
// reset the timer
TMR0H = 0; // MUST SET TMR0H FIRST
TMR0L = 0;
}
}
}
My oscilloscope says the period of this signal is 204.0us, which means that the pin is toggling every 102.0us. If my oscilloscope is correct, then the pin is toggling 2us too late every time.
Interestingly, changing if(TMR0L >= 100) to if(TMR0L >= 102) results in the same period, but going below 100 or above 102 results in the period decreasing and increasing, respectively.
Why is this happening?
Also, as I mentioned, having additional code in the main loop seems to exacerbate the problem. Why would that be?
AI: If you want accurate timing, use interrupts (i.e. reset the timer value in it's interrupt routine).
As you have it it only checks the timer value once per loop, so if you add code into the loop the checks become spread out.
The interrupt will switch context as soon as the timer overflows, so it doesn;t matter how much code is in your loop then. |
H: Which is better for the 555, a smaller capacitor or a larger one?
As I understand it, there are many ways to combine two resistors and a capacitor to give the same time characteristics in a astable 555 setup.
My question is which is better, a larger capacitor or a smaller one? and does it effect power consumption?
AI: Well a larger capacitor needs more energy stored to trigger the threshold pin, this energy is just dumped when the output is low. A lower valued capacitor needs larger resistors for the same timing but waste less power. I'd say make the capacitor as small as possible while keeping the circuit functional to save power. Eventually the resistor needed will be too large compared to the 555 input resistance and you'll hit your timing limit for the small value capacitor.
An input pin on any device needs to have a large input resistance as to not disturb the point it is measuring, you can visualize this as a really large resistor connected to the pin and ground. This means that if you connect it to a point in the circuit with a high resistance value before it you'll get a voltage divider at that point. If you keep your resistors small enough this ought never to be a problem. Going higher will tend to degrade performance and could cause the unit from working completely.
For example the resistors above should be chosen to pass at least a certain amount of current to the 555. Examining the data sheet gives the minimum values:
Trigger current (pin 2): 1uA
Reset current (pin 4): 0.5mA
Threshold current (pin 6): 0.25uA
The values of your resistors will thus depend on the configuration of your circuit, operating voltage and these minimum currents. Don't worry too much about this, play around with your circuit, keep increasing the resistance for a specific capacitor value and when the circuit doesn't work as expected anymore you know you have to increase your capacitor value instead to get a longer delay. Or, if you're up for it, try to calculate the best values for your configuration. |
H: Microcontroller shutting down in etched circuit, but works as expected in breadboard circuit
I have a computer fan controller circuit which uses an microcontroller to convert an analog signal from a potentiometer to control the speed of an computer fan (PWM controlled) and indicate the rough speed percentage with 4 LEDs.
When I use my circuit on the breadboard it works perfectly, but when I use the etched circuit it flickers for a second or two then shuts down completely.
Background
Here is the circuit:
As you can see it's using a 12V supply and then a voltage regulator to supply the microcontroller with the needed 5V. Then I have the fan hooked up to the 12V supply and the control cable hooked up to the microcontroller.
When I'm using the circuit in the breadboard I connect the resistors and the potentiometer to the breadboard via the IC holder on the etched circuit to make sure there isn't something wrong with the components or soldering. Then I supply the microcontroller with 5V from a stabilized DC power supply.
Then I measure the 5V PWM signal that should go to the fan with a multimeter. Everything works like expected, the LEDs light up when I turn the potentiometer and the voltage measured goes up.
Here is what the circuit looks like in action from the breadboard. (I'm measuring the PWM output with the potentiometer on these images) 0 percent:
Around 50 percent (Yes, the code that lights the LEDs needs to be fine tuned :P)
100 percent!
So the only difference is essentially the supply. When I put my microcontroller on the circuit and connect my DC power supply with 12V it flickers and stops working after a second or two.
Here is what the circuit looks like in action in the circuit itself with 12V applied across the supply. It stays like this even if I turn the potentiometer. I have checked that the regulator is regulating successfully and that the microcontroller VCC pin has 5V applied.
What could be the problem?
This is the first circuit I have designed and etched, so no need to tell you that I'm a novice. The only thing I can come up with that would be a problem is that different supplies share the same ground. Is there something else that could be the problem?
AI: Is your circuit diagram complete? If so I miss the mandatory decoupling capacitors!
You don't mention the type of microcontroller you use, from the diagram I assume an 28-pin PIC like a 16F876 or 18F242 or the like. Such chips have two ground pins, which MUST both be connected to ground. You seem to use the chip's ground pins as a wire to connect your two grounds, which is not a good idea.
Does the chip have an internal reset and did you configure it? And idem for the oscillator? |
H: What are the disadvantages of using a diode bridge for DC polarity?
As far as I understand, diode bridges are mainly used to convert AC into DC, but one can also use them just to ensure an expected DC output polarity for arbitrary DC input polarity. I have some small energy devices (3V-5V, <1A) that require an expected polarity and I want to safely connect them to a power source that is likely to be used with different polarity. How do I find the right type of diode bridge and what disadvantages exist when using it? Given a safe span of input current, does the diode bridge just act like a simple resistor? If so, how high is its virtual resistance, so how much energy would I loose compared to ensuring right polarity by other means?
AI: The main problem with a diode bridge is the fact that you always have two diodes in series with your circuit, and this creates a voltage drop of about 1.4 V between the power source and the load.
The power loss is simply this voltage drop multiplied by the load current.
It also means that you cannot connect the negative side of the load, which you might ordinarily consider to be "ground", to any external ground, which might be connected to either side of the power source. |
H: Types of amplifier
Can briefly explain the difference of class A, B and C amplifier and their pros and cons ?
Besides, what is the application and example of circuit for each class amplifier ?
AI: Think of the final output stage of a power amplifier. It must be possible to actively drive the output high and low. This is usually done with some sort of variable pass element (transistor in practise) between the output and the high supply, and the output and the low supply. Very simplified, the final output stage conceptually looks like this:
where the proper control circuitry can be thought of as diddling the variable resistors as needed so that the output is driven to the desired voltage. In practise the pass elements are usually transistors and can look more like current sources or have other characteristics than pure resistance, but that doesn't matter for the discussion of amplifier classes. Whether they are variable current sources, variable resistances, or something else is actually indistiguishable because they are adjusted as necessary by using feedback to achieve the desired output voltage.
Class A
Consider the problem of how to use the two pass elements together. The simple conceptual solution might be to vary each one over its full range accross the output full range. This would be high quality since the output would naturally follow the desired level to a good extent even without feedback. For example, if both resistors are equal, then the output will be in the middle, when R1 is 1/4 of R2, then the output will be half way to V+. You get a nice proportional response over the whole range. This is basically a class A amplifier.
Now consider the drawback of this method. You realize that when you want to pull the output high, turning on R2 at all is just a waste of power. The current to the output has to flow thru R1, but any additional current that flows thru R2 only heats the resistors. For small signal amplifiers this is often not a big deal, and the control simplicity and the resulting high quality make class A worth it. However, when you're putting out 10s of watts into a low impedance load like a loudspeaker, the wasted power can be significant. It's not the cost of the power so much, but the cost of the infrastructure to deal with the heat in the pass elements.
Class B
So now you have the bright idea that you'll only use R1 to drive the output during the high part of the waveform and R2 during the low part. In each case, the other resistor is off or very high. Yes, that's more efficient, but it's also harder to control and doesn't as easily get you a nice proprotional output response without more feedback. Feedback can cover up some non-linearities in the final output circuit, but only to a extent and often at the cost of other hidden distortions, like intermodulation distortion. In particular the problem will be to exactly overlap turning one resistor off and starting to turn on the other as the output signal crosses 0. This is such a common and well known problem of class B amplifiers that it has it's own name, called crossover distortion.
Class AB
Your next bright idea might be to say you're willing to give up a little efficiency to keep both resistor on a little near the middle. Yes, that makes the handoff between driving the two resistors easier and helps with crossover distortion at the expense of a bit less efficiency. The more you do this, the more efficiency you give up, with the limiting case being you're back to a pure class A amplifier. Another way to look at class A is that the blending region extends over the whole output range. This partially on near the middle method is used sometimes and is called class AB.
Class C
Class C is something completely different and not applicable to audio amplifiers at all. Here is a simple concpetual example of a class C output stage:
The point here is that resonance is exploited to efficiently produce a signal of known frequency. The switch would normally be a transistor that is turned on hard for a small fraction of the output cycle. This "kicks" the tank circuit formed by C1 and L1, which then resonates on its own to make the rest of that output cycle until the process is repeated. This can be quite efficient. Note that none of the three components shown dissipate any power in the ideal case. In practise there will be losses, or course, particularly in the inevitable resistive component of the real inductor.
This circuit must be tuned for the particular single output frequency it is intended to produce. Note that C1 and L1 will only resonate together at one particular frequency. So class C is very efficient, but only when you want a single known frequency out. This is the case with commercial radio transmitters, for example, and the final output stage is often a class C amplifier or largely based on one.
Class D
You didn't ask, but class D is something you hear about a lot nowadays, and is becoming quite popular including for power audio use. Class D is essentially a switching power supply that can actively drive both high and low. There are two switches before the inductor, one that connects it to the positive supply and one that connects it to the negative supply. By carefully adjusting for each pulse what fraction of the time the high side switch is on and what fraction for the low side switch, you can make the output follow some desired signal. Of course for this to work, the switching frequency needs to be at least a few times higher than the highest frequency of interest in the output signal. Fortunately that is doable today with the fast transistors and control circuits available. Even "high fi" audio only goes to 20 kHz upper frequency. Switching power supplies routinely operate at 10x or more of that, so this is all doable. Note that just like for the class C case, none of the parts ideally dissipate any power. In parctise of course there are real losses, but class C is today the highest efficiency means to get a arbitrary power output signal, as long as it is band limited to a acceptable level. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.