text
stringlengths 83
79.5k
|
|---|
H: How can I maintain a fix voltage until my battery is almost dead?
I am experimenting with a simple circuit. I have an Arduino board, a proto-board and an IR sensor (that uses electricity from the Arduino board). I use a 9V battery to feed the Arduino.
My problem is that when the voltage in the battery drops to about 6V, the sensor and the Arduino board don't work anymore. I suspect that is because the voltage used for the logic (since the sensor is fed from the Arduino board (3.3V pin)), is not enough for both components.
I'd like to be able to use an electronic component to stabilize the voltage coming out from the battery while preserving the same voltage for the board and the sensor, 'till the battery dies. Would a capacitor do that for me? If not, what should I use instead?
Thanks.
AI: A battery's voltage naturally drops as it discharges. To get a stable voltage out of it, you want a voltage regulator. Voltage regulators come in two flavors, linear and switching. If you want the output voltage of the regulator to ever be higher than the battery voltage, you need a switching regulator. You'll also get higher efficiency that way, so your battery should last longer.
Now, in your specific case, you really need to look at the input voltage spec for your Arduino board. If it says it can handle 6-9 volts, or something like that, then an external regulator's not going to help. The board is already doing the best it can. To make it last longer, you'd need to parallel more batteries.
|
H: Finalize project: How to go from breadboard to a semi-permanent circuit
I'm tinkering with Raspberry Pi, and envision a few small applications that will require external circuits. I find the breadboard setup to be a bit too fragile for long-term use, but I'm not sure how to make it more permanent without making a custom PCB, which seems like overkill.
Here's a crude breadboard to connect an I2C temperature sensor -- which can be redone as a cable and some heat-shrink tubing, but my next project will have a few more components.
One option seems like a few drops of glue in strategic places on the breadboard, but this seems a bit clunky.
Is there an option between breadboard and PCB?
AI: Yes, in fact there are some viable prototyping methods between breadboard and custom PCB. I think you're looking for a STRIPBOARD, which is a board with holes every 0.1", and copper patterns that tie some of the holes together in patterns that accommodate solder connections while allowing DIP chips to be placed without shorting.
From the wikipedia entry on stripboards:
This shows the back side of a stripboard, where all the soldering is going on.
Many people advise to skip the breadboard stage and move right to these methods, as they're more reliable.
Lastly, don't rule out PCB's -- they can be done at about $5 per square inch in prototyping quantities if you have two or three weeks.
|
H: Altium update from schematic - delete and add component constantly
When I issue an engineering change order to update my PCB from the schematic window, 2 components are always deleted and added every time. How can I stop this?
AI: Have a look at Project->Component Links, and read this.
|
H: Using a pulse-width modulated signal to possibly reverse polarity
I'm trying to help an artist control a simple DC motor using a single signal. The signal is a digital output, 0/5V, and the motor runs with max 36V. The motor needs to run forwards and backwards. There is only 1 digital output available per motor.
I know how to generate a PWM signal, and wire it up to a transistor (with resistor at the base) so that the motor spins slowly or quickly, that much is working. We have a simple circuit for motor speed in one direction.
Also thanks to this site I just learned about H-bridges and found a few good pages on using 4 transistors to switch a motor's polarity.
My thought was to have the output signal be pulse width modulated 0% = full reverse, to 35% = slow reverse, and 65% = slow forward, to 100% = full forward.
To make that control the motor, I think about splitting the signal into two isolated parts. I "smooth" one part and use it as a "direction control" signal, low=reverse, high=forward. The other original PWM signal just modulates the power, for speed control.
I can't get it working in my circuit simulator. First problem is that my "smoother" is a filtered rectifier, and it always produces the same output voltage regardless of the duty cycle, which makes sense, because the diode bridge just converts everything to the same voltage. The second problem I have is how to make the "low" parts of the duty cycle make the motor run "fast" when it is in reverse- pretty sure I can fix that with a NOT gate and another transistor, but it feels like there must be a more elegant way. The fewer parts in this design, the better.
(Main problem is that I'm in over my head. Haven't built any circuits in 20+ years.)
The question is- how would you make this work, using a 36V power supply and some components to convert a 0-100% 5V PWM signal into a -36V to +36V PWM power source?
FYI, We do have the option of just buying a second microcontroller, which would give us more output pins, which would let us use one pin for a "forward" signal, and another for "reverse." It's just frustrating me that I can't make the single-signal idea work.
AI: If you have an H-bridge controller that can switch cleanly at a PWM frequency which is sufficiently fast relative to the motor's inductance (the lower the inductance, the faster the PWM must be), driving it with a waveform that's 60% forward and 40% reverse will be a good way to drive it forward at 20% speed; 40% forward 60% reverse will be a good way to drive it backward at 20% speed. If both conditions above are met, driving a motor in this fashion will give a speed response which is much more linear than PWM'ing between driven and "open-circuit", and will also be more energy-efficient. Additionally, trying to drive the motor at a speed which is somewhat slower than it's presently turning will provide regenerative braking [i.e. allow motor energy to be fed reasonably nicely into the supply].
The important thing to note is that running the PWM too fast for the H-bridge controller may waste energy in the H-bridge controller; running it too slow for the motor inductance will increase the amount of energy wasted in the motor. If the PWM is much too slow, driving the motor at half speed may use many times more energy than trying to run it at full speed. If, however, the motor is driven with a fast PWM and the H-bridge can handle it, efficiency may be very good; a stalled motor driven at 75% forward 25% reverse will have about half the torque as would one driven at 100% forward, but will only take about a quarter of the power [about 75% of the time, it will draw about half as much current from the supply as it would if on 100%, and the other 25% of the time it return that same amount of current].
|
H: What's the purpose of this ground connection circuit?
I inherited a power supply circuit design from another engineer, and he used a ground connection method I am not familiar with:
The input comes from an external isolated 48 V AC/DC power brick. The outputs supply several boards within a single enclosure.
My question is about the diode connection between the negative input terminal and the load-side ground.
The effects I see from this are
Isolation provided by the DC/DC converters is negated.
Negative input terminal will be held within about +/- 0.5 V of the load-side ground.
Current might or might not be able to pass freely between the negative supply terminal and load-side ground, depending how the input common mode drifts relative to the circuit ground.
Some other notes about this system:
The load-side ground is connected to chassis.
Reverse-connection protection on the input is provided by other components not shown here.
Several of these systems might be connected in parallel to the same 48 V source.
The question is, what was the design intent of adding the diode connection?.
AI: This is a trick for clipping away small voltage noise coming into a device via the ground line (e.g. ground loop noise) while still providing a ground connection.
As long as neither diode is forward-biased, the ground is effectively lifted. It's like a voltage-controlled ground lift switch. The switch stays closed against small noises which don't exceed the forward voltage in either polarity.
If there is a fault in the device which causes current to be dumped into the ground, then one of the diodes will spring into action and carry the current. The only problem there is that the diode needs to handle that current without melting.
The "Ebtech Hum X" is rumored to use the same trick.
|
H: Choosing the right controller family: AVR? DSP? ARM?
I'm a developer of the "brain" part of the switch-mode power-supplies.
Now I'm on AVRs, but I'd like to develop my self to more advanced processors.
Switch-mode power supplies are the devices with lots of processes taking place within fractions of microsecond so with ARVs I used the corresponding PWM controller ICs. DSP and, probably ARMs will be able to provide direct driving of the switch gates and high-speed data acquisition.
My opinion that ARM is the right stuff. But I know nothing about this wide varied devices. How to choose the right device? Is there enough information on the web? Are the dev.tools so advanced as for AVRs?
Please bless me to move to the ARM-based developing :)
AI: If you are planning to use ARM devices for switched mode power supplies, then I would suggest taking a look at the Cortex M0 and Cortex M3 devices. These are commonly used in switched power applications and are available from numerous vendors including big players such as ST and NXP.
Both these devices typically have the following features that make them suitable for switched power applications: onboard timers, which are useful for generating PWM waveforms, analog comparators, which are useful for responding to fast current signals, ADC converters, and DAC converters. Compared to a typical AVR, the 32 bit architecture offers more raw processing power.
The main difference between the Cortex M0 and M3 is the computing power. The M0 is considered to be an entry level device. I am using this M0 from ST and it is more than sufficient for a voltage control application. A good way of getting started would be to use a demo board such as this. If you need to do current control, which requires more computional power, consider using a Cortex M3.
Concerning toolchains, there are many to choose from. If you don't need more than 32k, then a good place to start is with the MDK-ARM Microcontroller Development Kit from Keil. It is free for up to 32k, which is often more than enough. Other toolchains worth looking at are:
LPCXpresso. For Philips ARM devices, this IDE has a free edition that allows code sizes of 256k to be compiled.
GNU ARM Eclipse. This is free but can be tricky to get up and running.
|
H: How is debugging build implemented in VHDL?
I come from C background and am being introduced to VHDL. I read about the syntax and the concurrency/consecutiveness of actions.
Now I am getting to wonder how are development-only features implemented. Things like assert() and #ifndef NDEBUG LOG_MSG_UART("99 bottles of beer").
The scenario, that I am thinking of, is this. Let us have a development board with an FPGA and several debugging headers. Various signals are output to those debug headers for measurement with an oscilloscope or logic analyzer. In the release version, there will be no such headers. How does one write the code so that they can easily switch between the Release and Debug builds?
An idiomatic example would help a lot.
AI: In VHDL, the basic ASSERT statement is used to ensure that when you are simulating, you catch all those conditions. Simulation is one step of the debugging process, which is most software-like, as you have access to everything within the design.
You can also (with access to sufficiently high-calibre tools) use PSL to write more complex assertions which can involve timings as well as simple conditionals.
Once you have simulated to your satisfaction, if you need to debug the real hardware, then you can use the following tools:
embedded logic analyser (Xilinx: Chipscope, Altera: SignalTap) - you build this in at compile time and can then trigger and monitor signals. The signals are captured in real-time to internal memory, so there is a limit on how many and for how long, but it does give excellent visibility. It can be time-consuming though as each time you change your mind about the setup, you have to rebuild the FPGA (which is a process measured in tens of minutes or even hours, depending ont he complexity of the design)
spare pins - with or without LEDs. Bring out critical internal signals and monitor them with an oscilloscope and logic analyser. Again, rebuild each time you change it. This can also be done more dynamically in Xilinx-land with the FPGA editor, so you can make relatively quick updates to the bitstream, if you can find the signal you want within the optimised netlist!
As Brian pointed out, you will also need an oscilloscope (and potentially logic analyser) to debug the external interfaces - checking the timing etc.
Regarding the issue of having "debug" and "release" builds, that is not handled in a "standard" way (unlike in the software world). The behaviour would not be wildly different in most cases: As the FPGA is very deterministic, you don't lose speed by having debug logic in there (or if you do, it still meets the required spec, as otherwise you couldn't debug the chip!). You do end up with more logic than you need, but again, it has to fit int he device you have (unless you are planning to downsize for release, but given the step ups in device size, you'd need a lot of debug logic for that to be worthwhile!).
Also note that (as far as I've heard) no-one build with different optimiser settings for debug vs. release, which can make finding the signals you want tricky, so you have to add attributes to them to stop them being as optimised as they otherwise would be, which is good as the rest of the design gets optimised. Not so good that you have to rebuild to change the attributes. (At least there's plenty of time for keeping your documentation up-to-date while you wait for the builds :)
If you do want to do this then I would suggest a couple of ways:
Have a boolean generic on the top level instance - it can default to debugging off, and you can override it on the command-line/from the GUI of your synthesiser.
Have a boolean constant in a package that you use in your main code - select between the two modes by editing this file
With the first option, only the top-level can see the state of the debug status (unless you pass it down the hierarchy, but that can get nasty quickly as you usually need to pass the debug signals back up then too!).
With the second, any entity can get at the debug constant, and make use of it - again you need to pass signals up the tree.
You can use the boolean in an if..generate..else generate to instantiate the logic you want (or don;t want) depending on the "mode".
|
H: MOSFET driven LED AVR blinker circuit exibits flakey behavior
The following circuit, built on a prototypeboard/stripboard, sometimes fails to operate: it is dead to the world. No output regardless of the input. I originally thought that some of the soldered connections were flakey (on the basis of the fact that touching the the board would seem to cause the circuit to go dead or back alive), however, after checking the prototype board again, I couldn't find much of anything out of the ordinary, other than the resistance between Vcc and Gnd being 7.?? mega ohms. I am wondering now if there is some mistake in the circuit design/logic?
The input is either 0V or 12V, and is connected to the uC via optocoupler. The uC listens for the input, and flashes the various leds while the input is 12V and turns them off when input goes back to 0V. Full code:
#include <avr/io.h>
#include <util/delay.h>
#include <avr/interrupt.h>
#include <avr/cpufunc.h>
#include <avr/sleep.h>
volatile uint8_t useless = 0;
ISR(INT0_vect) {
useless ^= 0xFF;
}
int main(void) {
// Using PCINT0 as low-level interrupt
MCUCR &= ~ ( (1<<ISC01)|(1<<ISC00) ); // low level interrupt on INT0
GIMSK = 1 << INT0; // enable INT0 interrupt
#define OUTPUTA 4
#define OUTPUTB 3
#define INPUT 1
DDRB= 0x00|(1<<OUTPUTA)|(1<<OUTPUTB);
PORTB=0;
sei(); // enable interrupts
_NOP();
while (1) {
if ( (PINB && (1<<INPUT)) == 0 ) {
PORTB |= (1<<OUTPUTA)|(1<<OUTPUTB);
while ( (PINB & (1<<INPUT)) == 0) {
_delay_ms(170);
PORTB^= (1<<OUTPUTA);
}
PORTB &= ~ ( (1<<OUTPUTA)|(1<<OUTPUTB) );
}
if (1) {
// Go to sleep
MCUCR |= 1<<SE;
MCUCR = MCUCR && ~( (1<<SM1)|(1<<SM1) ) | (1<<SM1)|(0<<SM1);
sleep_cpu();
// Wake up here
MCUCR &= ~(1<<SE);
}
My current best idea is to replce the 74HC14N (my apologies the Schmitt trigger is that, and not 74LS14), and the size of the smaller bypass cap (the circuit is powered by a 2-3A wallwart and there is quite a few LEDs)
EDIT: Fixed schematic vis-a-vis optocoupler output (thanks Peter Benett)
EDIT2 Fixed schematic to show that reset pin is tied to Vcc (thanks geometrikal)
AI: You seem to have a confusion between the bitwise AND operator & and the logic AND operator &&
For example this line in your code
if ( (PINB && (1<<INPUT)) == 0 )
doesn't become true only when bit1 of portB becomes high but when any of the bits is high. That happens because (1<<INPUT) is >0 so is always true and that leaves the check on PINB, it will be true with 0x01 or 0x02 or 0x03... 0xff
The correct way to check the state of PB1 is
if ( (PINB & (1<<INPUT)) == 0 )
Another place you use the wrong operator is
MCUCR = MCUCR && ~( (1<<SM1)|(1<<SM1) ) | (1<<SM1)|(0<<SM1);
That results to either 0 or 1, what you should use is
MCUCR = MCUCR & ~( (1<<SM1)|(1<<SM1) ) | (1<<SM1)|(0<<SM1);
Coming to your actual circuit, what is the need for 74LS14?
All you need is to enable the internal pull-up for PB1 and connect the opto transistor collector to the port pin to pull it down when active.
You can just wire it like
And as for the code, something like
// change the following clock frequency depending on the clock you use
#define F_CPU 9600000UL // 9.6 MHz`
#include <avr/io.h>
#include <util/delay.h>
#include <avr/interrupt.h>
//#include <avr/cpufunc.h>
#include <avr/sleep.h>
#define OUTPUTA 4
#define OUTPUTB 3
#define INPUT 1
volatile uint8_t useless = 0;
volatile uint8_t flashing_enable = 0;
ISR(INT0_vect)
{
if((PINB & (1 << INPUT)) == 0)
{
flashing_enable = 1; // set flashing flag
PORTB |= (1 << OUTPUTA) | (1 << OUTPUTB); // turn on both leds
}
else
{
flashing_enable = 0; // clear flashing flag
}
}
int main(void)
{
DDRB = 0x00 | (1 << OUTPUTA) | (1 << OUTPUTB);
PORTB = (1 << INPUT); // enable pullup
// External Interrupt(s) initialization
// INT0: On
// INT0 Mode: Any change
// Interrupt on any change on pins PCINT0-5: Off
GIMSK = (1 << INT0) | (0 << PCIE);
MCUCR = (0 << ISC01) | (1 << ISC00);
GIFR = (1 << INTF0) | (0 << PCIF);
GIFR = (0 << INTF0) | (1 << PCIF);
sei(); // enable interrupts
while(1)
{
if(flashing_enable)
{
_delay_ms(170);
PORTB ^= (1 << OUTPUTA);
}
else
{
PORTB &= ~((1 << OUTPUTA) | (1 << OUTPUTB));
}
}
}
I have used single leds just to show the generic connection scheme. I have also omitted the capacitors, add them in your actual hardware.
|
H: Have I routed this PCB correctly per the schematic
This is my first PCB for production, and I'm not sure if I've correctly routed it. Mostly I'm concerned about trace running from pin 5 of IC1 to C3/C4 and how that picks up the +5V, which I've routed going anti-clockwise from the bottom of the board. Should I leave it there (between C3 and C2) or should I move it to the left (between R1 and C4) or does it make a difference?
edit
so based on the comments I had a few problems. I've fixed the mixed up pins on the MOSFET, shortened/fattend the traces, and routed a few things across the back layer and added the ground plane there. I've kept the curved traces, because I'm a freak and I don't care :) Original question still in mind, does the PCB match the schematic?:
AI: It's not ideal. Fatter traces will help. Consider using a 0-ohm jumper or two to improve the layout -- single-sided layouts are often a bit of a challenge (and a trade-off). Your clearance to the copper pour is quite small- especially to the pads.. Usually for manufacturability you want that bigger than the trace-trace and pad-trace clearance (because there is so much of it). Maybe you can push the parts closer together or use a 2 layer board.
Below are observations are on the schematic, not the mapping of schematic to layout.
The MOSFET symbol does not match the pin names so that part is wrong - the drain is grounded assuming the part has the standard SOT-23 layout, and you really want the source to be grounded.
Okay, after your edit that doesn't look too bad. You could fatten up the traces going to the capacitors a bit more.
One slightly subtle thing- you might want to partially slice the ground plane just below the conductor going to the capacitive input so it's only connected to the rest of the plane on the right side, back near the chip. That's because it could wobble around quite a bit relative to the chip ground when the MOSFET switches, and that could get coupled into the input.
It would be nice to fix the schematic symbol for the MOSFET and the rubberband lines, but as far as I can see it shouldn't affect functionality.
|
H: NMOS FET with a negative drain
I'm trying to create a switch between a -15V and +15V supply using a gate signal of 0V to +3V.
With the positive-going Gate voltage, I tried an NMOS FET. This works as expected with a drain of +10V but with a drain of -10V the FET just acts like a diode, dropping only 0.6V across itself or nothing.
Is there any transistor suitable for this application or must Vg always lie between Vd and Vs? Also, I'm also trying to keep the circuitry as minimal as possible.
Edit:
To further explain my problem: I need to discharge a capacitor at a specific time (when an IC turns off) clamping it to ground, otherwise other voltage lines held up by capacitors begin to leak into it causing havoc (specifically the negative voltage line). Obviously this shouldn't be allowed to happen however the leakage problem is currently out of my control hence why I'm trying to come up with a fix just in case I'm stuck with it.
Also, the level of the GPIO control signal can be active-high or active-low.
I've had some joy by using a single JFET but it's not as good as a MOSFET as the JFET conducts more than a MOSFET when it's "off". I'll take a look at level-shifting.
simulate this circuit – Schematic created using CircuitLab
The line I'm trying to deal with "VCOM" actually travels between -15V and +15V during it's normal operation and ends at 0V. However, as I explained above, it won't stay at 0V after it's operation which is why I'm trying to crowbar it to ground on demand.
AI: All MOSFETs inherently have a body diode between source and drain. This diode is reversed biased under normal usage, but if you put the drain at a lower potential than the source on an N-channel FET, you will, as you have discovered, forward-bias this diode.
simulate this circuit – Schematic created using CircuitLab
More on the body diode: MOSFET: Why the drain and source are different?
You will have to find a way to place the MOSFET in your circuit such that the drain is at a higher potential than the source. Or, you can use a P-channel MOSFET, where the drain must be at a lower potential than the source.
Either way, you will likely need some sort of level-shifting circuit to translate your 0V-3V logic input to whatever levels are required by the MOSFET arrangement you select. This can be as simple as another transistor (usually a cheap BJT) and a resistor, or a complicated arrangement designed to switch the MOSFET at very high speeds which might include dozens of components and maybe even additional voltage supplies. It all depends on your application.
|
H: PIC32 act as Host or as Device
i have a board with a PIC32MX450F256L. Now i want to:
Connect an USB Stick(as Device) to the PICs(as Host) USB Port(micro-B)
Connect a Laptop(as Host) to the PICs(as Device) USB Port(micro-B)
Recognize as which Role the PIC have to work.
I just have the one USB micro-B Port.
USB Sticks will get connected via a Adapter from USB Typ A(female) to micro-B(male).
The Laptop via a normal Cable from USB Typ A(male) to micro-B(male)
Is this possible? Do i have to use USB OTG? Or just a Dual Role? Which is the best practise?
with kind regards
mvollmer
AI: If you want to have only one connector, go with OTG.
Dual role is for when you have separate A and B connectors for host and device functionality.
|
H: How to add subtract two signals?
The question is:
Two signals have to be subtracted from each other. You want to have a very high input resistance and an overall transfer functiON of Uout=2*(U1-U2).
Draw a suitable circuit diagram. The resistors of your circuit have tolerance of +-10%, futhermore U2=0, U1=5V. Calculate and plot the output signals.
Answer: I got the diagram from my friend.
That's the diagram that he senT me, But I don't understand. I got why he used the first opamp but what is it with the second? Can somebody explain me?
AI: The second op amp inverts the output of the first. It's not really needed; rather you should swap U1 and U2.
For high input impedance, try this one:
simulate this circuit – Schematic created using CircuitLab
If the R's have all the same value, you should get a gain of 2.
|
H: Changing the polarity of electromagnet using H-Bridge
I have made an electromagnet using copper coil of 1.0 mm diameter, iron core of 2 cm dia & 8 cm length for my project. Supplied voltage is 12 VDC and current it consumes is 9.0 Amp. It has 1.5 Ohm resistance. I want to change the polarity of electromagnet like pulsing. I have to control e-magnet pulsing through arduino uno.
I learned H-Bridge is a way to do it. What h-bridge should i use for this amount of current and voltage? What precautions should i take when connecting the H-Bridge to arduino if any? Any other things related to doing changing polarity of e-magnet if pointed out will be of great help for me.
AI: Firstly, do you need to alternate the polarity rapidly? Rapid switching of 9A through an inductive load such as an electromagnet requires some care.
If not, the easiest solution is probably to use a pre-built H-bridge driver module designed for a single DC brushed motor, such as this one, which has as a 5V interface suitable for an Arduino. Similar things (often less well designed/documented) are available cheaply on ebay.
|
H: Basic Embedded Firmware testing essentials and Software Test plan
I am trying to make an embedded product, but I'm new to firmware testing and want to make sure I don't miss anything. What are the things that need to be checked for its firmware performance?
Proper watchdog timer is one thing to be checked. Flash/RAM usage could be another. What else needs to be checked for making sure the product has "good" firmware?
I mostly deal with PICs and C compilers.
AI: Some of these are more idiot-checks of the code than actual testing procedures, but they're good to do anyway.
Make sure you have good specs. If you have clear specs for every possible variable that matters for your project, testing should just be a matter of comparing against the spec. It never is, but it's a nice goal. One thing that sometimes gets left out of specs is response time. If your system does as its told, but it takes a second instead of a millisecond, you still don't have a good system.
Test each individual piece of the firmware separately. Make sure the
A/D converters work, make sure the lights turn on as commanded, make
sure each input works, make sure each output works, make sure the
timers work. Then start worrying about how it all works together.
It's almost certain the firmware won't work on the first pass, and
you'll have to break it down into pieces anyway. Best to start there.
Turn the board on and off many dozens times and make sure everything
starts up properly on a consistent basis. Probably a good idea to
watch all the power rails on a scope and make sure all the regulators
start up. Do this with every possible combination of inputs and power
supplies. This tests both your hardware and your software.
Expose the unit to EMI/RFI noise. I typically take an AC hipot tester
and short it to itself to generate high-voltage low-current sparks.
Wreaks havoc on circuits lacking noise immunity. (Plus, dragging the
sparks along the chassis makes you feel like a tiny version of
Emperor Palpatine. But maybe that's just me.) This tests both your
hardware and your software.
Look for all possible cases of division or modulus by a variable.
Make sure you can never, ever divide or mod by a variable that could
possibly be set to zero.
Look for all pointers, and make sure that none of the thousand things
you can do wrong with pointers can possibly happen.
Look for all arrays, and make sure you can never run off the end of
the array.
Look for all instances of what you intended to be comparison (==) and
make sure they're not assignment (=). A helpful regexp for this would
be: (.+ = .+)
Look for any occasions of EEPROM writes, and make sure to thoroughly
test those cases. EEPROM is slow, so multiple EEPROM writes in
series might slow down other time-critical processes. This could
simply trip your watchdog timer and cause a reset, or (in the case of
a switching power supply) this could cause an explosion because your
outputs didn't get updated properly.
If you're using any interrupts at all, try not to unless absolutely
necessary. They increase the number of possible unexpected code
interactions dramatically. If you have to use interrupts, consider
what happens if the interrupt happens at every possible point in the
execution of your program. Also, consider every possible nesting of
interrupts, or just disable nested interrupts so you don't have to
worry about it.
|
H: What is the following MOSFET circuit good for?
Context: I'm studying basic electronics at an undergraduate level.
One of the questions in past exams was to explain the usefulness of the following MOSFET wiring. Judging from the picture I assume that the question refers to the fact that Vo is wired back to the gate of the MOSFET.
I skimmed through my book and the closest thing I could find was under the paragraph "reference voltages and current sources", but it hardly mentioned anything. Would anyone be so kind as to explain things a little bit ? What's so special about the above circuit and what exactly does a reference circuit do ?
I googled "reference circuit" and got the following from Wikipedia:
"A reference circuit is a hypothetical electric circuit of specified
equivalent length and configuration, and having a defined transmission
characteristic or characteristics, used primarily as a reference for
measuring the performance of other, i.e., real, circuits or as a guide
for planning and engineering of circuits and networks".
Is this relevant to my case ?
I tried to solve the circuit given \$K=1.5mA/V^2, V_T=2V, R=10KΩ\$. I came up with the following two equations:
\$I_D = K(V_{GS}-V_T)^2=K(V_G-V_S-V_T)^2=K(V_0-V_T)^2\$, since the gate and Vo are short-circuited. The second equation is \$V_o = 20 - I_D R=20-10I_D\$.
Therefore combining the two equations, I get: \$(20-V_o)/10=1.5(V_o-2)^2\$. From this equation I get \$V_0=\{0.87, 3.03\}\$, accepting the \$V_o = 3.03\$ so that \$V_{GS} = V_G = V_o = 3.03 > V_T = 2\$.
A colleague of mine though calculated \$V_o=9V\$. Does anyone see where I'm mistaken ?
Another colleague pointed me at this link [pdf] with a MOSFET diode-connected circuit whose description paragraph sheds some light.
AI: Consider the equivalent BJT circuit, which may be more familiar:
simulate this circuit – Schematic created using CircuitLab
This holds provided the input voltage is >0.65V, with of course some variation based on temperature, output current, manufacturing variation, etc. However, as a first approximation this circuit outputs a constant 0.65V.
The MOSFET circuit is no different, but instead of the 0.65V from a forward-biased silicon PN junction, we get the threshold voltage of the MOSFET. This parameter varies between models of MOSFETs, but is usually some volts. If the output voltage, which is also the gate voltage, is above the threshold voltage, the MOSFET turns on more, shunting more current to ground, increasing the current through the resistor, lowering the ouput/gate voltage such that an equilibrium is reached:
$$ V_{GS} = V_{out} \approx V_{GS(th)} $$
This sort of circuit would be useful as a reference voltage, for example, to implement a voltage regulator, because the output voltage is relatively unaffected by the input voltage. A single transistor such as this isn't necessarily a good voltage regulator on its own, but it could be the basis for something better. A good regulator starts with a reference such as this which might vary based on other parameters (output current, supply voltage, temperature), then isolating or compensating for those parameters from the reference.
|
H: Correctly printing from SystemVerilog DPI
I have some verilog VPI code that I'm porting to use SystemVerilog DPI, to be run in Modelsim and Verilator.
In VPI, I use vpi_printf() for debugging and status information. This doesn't work when running the DPI in Verilator. Should I just be using regular printf() instead?
(This feels like it ought to be a simple question, but good SystemVerilog examples seem to be scarce)
AI: DPI doesn't have special print commands. You can use regular C printf() or std::cout << "Your Message Here" << std::end. Some reasonable tutorials can be found with your preferred search engine with [systemverilog dpi] as your search term.
If you want to be lazy, you can keep #include <vpi_user.h> in your DPI files to keep using vpi_printf()
Alternatively, have your DPI call a SV function. With this method, adding the simulator's time-stamp is possible. Example:
my_sv.sv:
// ...
export "DPI-C" function dpi_print;
function void dpi_print(input string msg);
$display("%t :: %s", $time, msg);
endfunction : dpi_print
// ...
my_dpi.c :
#include <stdlib.h>
#include <stdio.h>
#include "svdpi.h"
...
extern dpi_print(const char* msg);
....
int some_c_func( /* ... */ ) {
// ...
dpi_print("message");
// ...
}
|
H: How to power Arduino Pro Mini via VCC pin (12v input)
According to the Arduino Pro Mini spec it has Input Voltage of 5 - 12 V (5V model). Is it possible to input 12v by using any method other than usb? If so are there any downsides/limitations?
AI: If you want to feed 12v to the board then you should use the raw input which feeds the onboard regulator input and will step down the voltage to 5v (vcc).
You should not connect any voltage >5v to Vcc or USB directly
The location of the raw input pin on the board is
|
H: How to join high current wiring?
I need to join 4 wires together: a 6 gauge wire, two 10 gauge wires and a 22 gauge wire. The 6 gauge wire is the current source, the two 10 gauge wires will draw a continuous current of up to 30A and the 22 gauge wire about 20 mA. I need to do that twice - one for each leg of a 208/240v circuit. This is for an electric vehicle charging application.
I have been using a large size wire nut for this, but twice now it has failed due to overheating.
Left to my own devices, my next attempt would be with a split bolt, but then I'm going to need to wrap it all in a mile of electrical tape.
This is all going to be inside of a sealed chassis. The chassis will be portable, but all of the wires will have strain relief at the chassis entrance.
AI: Look for a "power distribution terminal block" or a "terminal bus bar." These are designed to land wires of various sizes and secure with a terminal screw, like the grounding terminals in your circuit breaker panel. Obviously you will need to ensure that the block or strip is insulated from other circuits as appropriate.
You may want to add crimp terminals/space lugs on the ends of your wires.
Terminal bus bar, left; spade lug, right.
|
H: Fuse configuration AVR dude for external 12MHZ crystal in Atmega 168
I have 2 microcontrollers (Atmega 168PA-PU). So far I have run the following program in one of them (say mc1). Now when I run the same code in the other one it gives erroneous results. Someone suggested that the inbuilt RC oscillators give +/- 10% error in system frequency and that is enough to throw the device out of balance. So I have decided to use external 12MHz oscillator crystal and connect them to XTAL1 (pin 9) and XTAL2(pin 10) with 22pF capacitors (ceramic). I burn my programs with avrdude. What is the appropriate fuse setting I should use? The AVR fuse calculator confused me even further.
AI: PS: I am a newbie so i am sharing whatever i have learned, if there is any mistake please let me know so that in future i can rectify myself.
Yeah you are right internal RC oscillator is not perfect...The clock varies with temperature and the power supply voltage.So it is better to use external crystal oscillator that won't drift with the temperature and if you want to use 12Mhz crystal then you should go for full swing crystal option.
Clocks sources usually need a little bit of time to warm up and start giving us a reliable signal when the micro controller is turned on. This is called the start-up time. To play it safe,you should go for the maximum start-up time to give the clock as much time as it needs to get up to speed. Actually, the max start-up time is only a few milliseconds anyway! So to be safe you should go for a Start-up Time of 16K CK and an Additional Delay of 65ms.
If you are using avrdude then i found it most helpful to use AVR fuse calculator for avrdude commands and the link is--
http://www.engbedded.com/fusecalc/ .Whatever argument is generated in the AVR fuse calculator you should copy and paste after this argument(iff you are using USBASP device with avrdude otherwise you have to use commands according to your device)...
avrdude -c usbasp -p m168
e.g. for your case you may use this command...
avrdude -c usbasp -p m168 -U lfuse:w:0xf7:m -U hfuse:w:0xdf:m -U efuse:w:0xf9:m
In case of any problem with the efuse you can omit that and write only
avrdude -c usbasp -p m168 -U lfuse:w:0xf7:m -U hfuse:w:0xdf:m
You may find this tutorial helpful..http://www.ladyada.net/learn/avr/fuses.html and also go through Clock section of your micro-controller's datasheet.
Let me know if there is any more doubt.
|
H: Why does connecting a high-current device to my digital circuit cause weird behavior?
I have a
arduino
microcontroller
other digital thing
and when I connect a
motor
pump
heater
other high current thing
I experience
weird ADC measurements
reboots
crashes
errors in digital communication
other unexpected behavior
My power supply is properly sized to power all these devices. I don't have an oscilloscope so I can't see much what's actually happening in the circuit. What's a likely cause?
AI: Without details it is impossible to give a specific answer. Look at these things closely:
Grounding. This is exactly the symptom you get from a poor overall grounding strategy. Without a block diagram showing power and grounds of everything connected, it's impossible to give specific advice. However, carefully visualize all the ground return currents, and consider that any current on a ground conductor will cause a ground offset.
Local decoupling. Make sure there is a 1 µF or so ceramic cap as close as possible between each pair of power and ground pins of each chip. These connections need to be short, because even a little series inductance significantly reduces their effectiveness.
Power supply surge capability. Make sure there is enough bulk reservoir capacitance on the power supply to handle transients for whatever time it takes for the power supply itself to catch up and deliver more current.
Inductive catch diodes. Make really sure that any possible inductive load, which includes any external load, has a reverse polarity diode across it. For voltages up to 50-100 V or so, these should be Schottky because of their high speed. This applies to loads driven by DC. Since they are always driven with one polarity, the diode can safely short out the other polarity. As Tut pointed out in a comment, for AC loads, more complicated snubber and/or clipping circuits need to be used.
|
H: What is meant by logic high or low
In a circuit involving integrated circuits, the documentation for the ic often states that if a pin is in logic 1 or high the circuit will behave in one way, and if the circuit is in logic 0 or low the circuit will behave in another way. One example i found was experimenting with the 4029 CMOS Counter ic http://www.intersil.com/content/dam/Intersil/documents/fn33/fn3304.pdf on the up/down and dec/bin pins. What i don't understand, is what the pin that is set either high or low should be connected to i would assume it would be the positive supply voltage, the negative supply voltage, or neither, but i can't seem to figure out which one.
AI: The bottom of page 7-799 of the linked datasheet gives the thresholds for low and high input voltages given a couple of different supply voltages. As long as the voltage on the input is at most/least that value when referenced to ground the input is considered low/high regardless of what you tie it to.
|
H: How important is the temperature stability for gain - setting resistors?
When two resistors are used to set a gain of an opamp, do I need to care about their temperature stability, provided resistors are from the same series, same manufacturer? Let's say my circuit will operate over temperature range of 85 degrees C and the gain of amplifier is 100.
AI: As Andy said, read the data sheets carefully, and understand how TCR is specified.
Like many specs, it's sort of a lie. A TCR of, say, +/-5ppm/°C is a slope and you might expect if the slope of the Resistance-Temperature curve is guaranteed to have a magnitude of be less than 5ppm/°C, the slope of that curve would be guaranteed to not exceed that magnitude. That's not quite true. What the spec means is that the largest average TCR over one or more intervals is less than the limit. Most precision resistors have parabolic or S-shaped TCR curves, not linear, so there can be significant differences. It's important to know the interval(s) that they are using, and how that fits into your requirements.
Typically parts that are made similarly will have similar TCRs, but it's not good engineering to depend on that, though it doesn't hurt to take it into account to make things typically better than they have to be (Philip Crosby might disagree if he were alive, but if it's free, or close to free, it may be worth doing).
If you need really close matching, but perhaps don't care as much about total resistance, you can buy arrays. Be careful when using parametric search engines-- for example Digikey would probably cause you to ignore the excellent LTC5400 part- which has a horrible tolerance of 7.5% or 15% and a mediocre total resistance TCR of +/-25ppm/°C, but the matching is actually pretty good (+/-0.01%) and the TCR of the ratio is +/-1ppm/°C maximum. Other manufacturers such as Vishay have networks with superb performance.
As a final step if you can't quite get the needed performance even with the finest resistors you can afford, you may be able to characterize the drift and correct it (as I recently had to do for a micro-Kelvin temperature measurement system).
A less pessimistic estimate of errors is Total error = \$\sqrt{\sum{{error_i}^2}}\$, but it assumes a gaussian distribution, and is a probability, not a guarantee, so I think most Engineers prefer to use worst-case values where resistors happen to be at the extremes of their guaranteed values (perhaps the best ones were selected out of the distribution!).
You may find that some circuit configurations are better than others that perform the same function, so a sensitivity analysis can be useful in evaluating your error budget.
It's also useful to lay out resistors in such a way as they don't see temperature gradients and they track temperature. See "common centroid layout". Sometimes we even route out bits from the PCB to thermally isolate sensitive bits of the PCB, leaving only small connecting strips.
|
H: Why does a weakened 9V battery show lower voltage but a weakened 1.5V battery doesn't?
This is a curiosity question. The batteries tested were Duracell coppertop alkaline batteries.
Recently, my bass guitar was acting weird and it was caused by a weak 9V battery. I checked the voltage and it was like 6.5V or something crazy low. Now, if I check a C 1.5V battery when it's weak, its voltage is relatively high. I think I measured the weak C at 1.42V.
I forgot to check the 9V while under load and I wasn't able to measure the voltages of the C battery under load b/c all the devices I could find needed the cover closed for it to work.
In any case, why does a 9V drop that much when it's weak but a 1.5V doesn't?
AI: A ""typical"" ""1.5v"" Alkaline C ""Battery"" is a single Cell (so not really a battery), ranging from ~1.6v at full charge, averaging 1.5v to 1.3v for most of it's life, eventually rapidly dropping to ~0.9/0.8v.
A ""typical"" ""9v"" Alkaline Battery (notice, no quotes) is composed of multiple 1.5v cells in series. So even in a perfect scenario, where all 6 cells discharge at an equal rate, the lower voltage of each cell is multiplied. The same drop from 1.5v to 1.4v (under load) for a C battery would mean 0.1v * 6 or 0.6v for a 9v Battery.
THEN we have the problem that a 9v battery is designed for higher voltage and a long life via low current draw. A C battery, on the other hand, is designed for high current draw and higher capacity. For comparison, a typical 9v is ~400mAh while a C is ~8000mAh. That is 20 times the capacity. The tradeoff? Lower voltage, higher weight and size.
For clarification, electrical semantics dictate that A Battery is a device consisting of multiple cells, while a cell is a device that converts chemical to electrical energy.
And this ALL varies based on manufacturer and quality of the battery and battery chemistry. Some Alkaline 9Vs are composed of AAAA batteries, while other's have fat stack types inside. Carbon Zinc are weaker, Lithium stronger, etc etc.
|
H: Use of global variables in Embedded Systems
I started writing firmware for my product and I'm a rookie here. I went through many articles about not using global variables or functions. Is there any limit for using global variables in an 8 bit system or is it a complete 'No-No'. How should I use global variables in my system or should I completely avoid them?
I would like to take valuable advice from you guys on this topic to make my firmware more compact.
AI: You can use global variables successfully, as long as you keep in mind @Phil's guidelines.
However, here are some nice ways to avoid their issues without making the compiled code less compact.
Use local static variables for persistent state that you only want to access inside one
function.
#include <stdint.h>
void skipper()
{
static uint8_t skip_initial_cycles = 5;
if (skip_initial_cycles > 0) {
skip_initial_cycles -= 1;
return;
}
/* ... */
}
Use a struct to keep related variables together, to make it clearer where they should be
used and where not.
struct machine_state {
uint8_t level;
uint8_t error_code;
} machine_state;
struct led_state {
uint8_t red;
uint8_t green;
uint8_t blue;
} led_state;
void machine_change_state()
{
machine_state.level += 1;
/* ... */
/* We can easily remember not to use led_state in this function. */
}
void machine_set_io()
{
switch (machine_state.level) {
case 1:
PIN_MACHINE_IO_A = 1;
/* ... */
}
}
Use global static variables to make the variables visible only within the current C file. This prevents accidental access by code in other files due to naming conflicts.
/* time_machine.c */
static uint8_t current_time;
/* ... */
/* delay.c */
static uint8_t current_time; /* A completely separate variable for this C file only. */
/* ... */
As a final note, if you are modifying a global variable within an interrupt routine and reading it elsewhere:
Mark the variable volatile.
Make sure it is atomic for the CPU (i.e. 8-bit for an 8-bit CPU).
OR
Use a locking mechanism to protect access to the variable.
|
H: LED lights behave strangely, why?
I have connected 10 LEDs in series, the LEDs have a current rating: 20 mA which is 0.02 A and forward Voltage: 2V.
My power supply provides me with: 5V DC 2A
By using the formula down below:
$$R = \frac{vs-vf}{i} = 5 - \frac{2}{20} = 150 \Omega$$
I can see that LEDs need 150 ohm.
Which is in total \$10*150 = 1500\Omega\$
I connected: 1 k resistor, 2 x 150 ohm resistor and 2 x 100 ohm resistor which is a total of: 1500 ohm.
But the 10 LEDs dont turn on, what's wrong?
I can still turn 3-4 LEDs with or without the resistors.
Try to explain this down below please:
I tried to connect a single green led by itself without a resistor. It turned orange which is a sign that it needs a resistor.
Then I connected 150 ohm resistor to the led and it became green. I then changed the resistor value from 150 ohm to 1 k ohm, but it did not change the brightness of the led, it still the same green, no fading in brightness.
I tried to change the value to 33k ohm, it faded in brightness, but I can still see some greenish brightness in the LED.
What's wrong? Why is the LED responding like that to the resistor's value? I mean 1k ohm is much more then 150 ohm but it worked the same.
P.S.: I bought the resistors from China via eBay.
AI: Here is the forward conduction characteristic of a typical LED: -
At 2V forward voltage the LED consumes 20mA and is quite bright. At 1.8V forward voltage the current has fallen to 5mA and the LED will be somewhat dimmer than the 20mA scenario. At 1.6V the LED is taking almost zero current and below this voltage it is doubtful that it illuminates at all.
If you have 10 similar LEDs in series, to obtain a forward current of 20mA requires a forward voltage of 20V.
If you are happy with a forward current of 5mA then 18 volts is all that is needed. And, if your power supply is (say) 20V, a series resistor is needed that drops 2 volts at 5mA therefore its resistance will be about \$\dfrac{2V}{5mA}\$ = 400 ohms.
If you have a limited supply voltage, you can wire the LEDs in parallel banks or use a boost converter to lift your 5V to about 20 volts. The CAT4238 device from Motorola can do this: -
|
H: IC 555 timer to provide oscillation for high amp electromagnet
I am using a self-built electromagnet in my project that consumes 9.0 amps at supplied voltage of 12 VDC. I don't mind even if amps goes high. The power supply I am using can provide up to 30 amps. I have to experiment with providing an oscillating power supply to electromagnet.
I want to use IC 555 timer for that purpose. But IC 555 timers that I searched appear to have output 200 mA. Is there any 555 timer that provides high current what I need OR is it possible to use same 555 timer with some external equipment for that. Any sources or tutorial for that will also be very helpful.
AI: No, there is not a 555 timer that can drive 9 amperes. However, a 555 can drive a transistor which can drive 9A.
|
H: Join the microphone and audio lines from a headset for recording
Question
What are the steps required to join the microphone and audio lines from a typical cell phone headset into one line so that the audio can be recorded by a standard voice recorder using the microphone and/or line-in input?
Practical use
The practical use for this is for the purpose of recording cell phone conversations with the use of a headset.
In Depth
Intuitively, I would just splice all the lines together. However, this approach seems to have the problem of creating an echo from the mic line to the audio line. I've also heard that it could blow some circuits in the phone, audio recorder or both.
It seems that the job of "splicing: these lines together without interfering with the call is more complex, requiring the use of some components to make it work correctly.
Here is a device that I found on Ebay that does exactly this:
I purchased a similar device off Ebay that has its own headset attached and cracked it open:
Here is a close up of the cracked open part. It does not look very complex, but I'm not sure exactly what it is doing:
(Other side:)
AI: What are the steps required to join the microphone and audio lines from a typical cell phone headset into one line so that the audio can be recorded by a standard voice recorder using the microphone and/or line-in input?
In this context "audio line" means a signal level & output impedance intended to drive a typical pair of earphones. I'll assume mono rather than stereo.
I'd guess the processing steps may be not entirely unlike the following:
for mic-in (could be entirely passive?)
Attenuate the headphone signal to mic levels
mix audio signals
buffer output
for line-in (choose either pro or consumer level)
amplify the microphone signal to line-level.
amplify or attenuate earphone signal to line-level
mix audio signals
buffer output
By buffer output I mean set the appropriate output impedance.
For stereo, you'd typically split the mic signal and mix equally into left and right channels.
For recording conversations you might want separate automatic gain control (AGC) for each side of the conversation. Since conversations are mostly half-duplex I guess you mostly only need one AGC element.
|
H: I need a basic primer on interpreting vacuum tube datasheets
I am building a prop for a film that needs to have a bunch of glowing vacuum tubes on it. Unfortunately, beyond basic "valve theory", I'm not finding a lot of information about how to interpret the datasheets.
Very simply, what I need to figure out is how to safely make a bunch of tubes glow. I don't have the tubes I've not designed the circuit because I'm mystified by the datasheets. Whether I make a circuit and fit tubes to IT, or whether I buy tubes and design a circuit around THEM is irrelevant at this time. Until I can interpret the datasheets, either option is impossible.
Consider: this ECC81 tube datasheet. Heating voltage is 6.3V, current is 300mA and under the "Typical Operating Characteristics", the anode voltage is 100V at 3mA. Looking at the pin configuration and notes (on this particular datasheet at least), I can't make heads or tails of how to read it. It looks to me, for instance, like pins 4 & 5 get the heater current (f), but then what the heck is pin 9 (fc) ? Further, it looks like pin 6 is the anode input (a), but what's pin 1, designated by a'?
With my limited knowledge, I'd send 6.3V to pins 4 & 5 and watch the healthy glow. MMy gut-level reaction though, is that's only half a circuit. So what's the other half? I would think I'd need to somehow draw off of the cathode and dissipate that power somehow...but when all I want is the glow, where does the back half of the circuit lead to? Am I making any sense here? Part of this is that I'm not quite sure I'm asking the right questions. Help!
AI: As Dave said, you don't have to actually run the tube in a real circuit to get the visual effect. All you have to do is power up the heaters.
Your particular tube actually is two tubes in one package and has two heaters. Each heater is 6.3 V. You can put 12.6 V accross pins 4 and 5, or 6.3 V accross both pins 9-4 and 9-5. In the latter case, you connect one side of the 6.3 V supply to pin 9, and both pins 4 and 5 to the other side.
Don't worry about the exact voltage that much. These things were intended to be run directly from a 6.3 V output winding of a power transformer. It will be OK with variations of this 6.3 V due to input line voltage variations. Get a "6.3 V" transformer intended to run from whatever power you have in your location and the tube will be fine.
You do have to make sure the transformer is rated for the total current of all the heaters together. For example, if you are powering 5 heaters that all take 6.3 V at 300 mA, then the tranformer output must be rated for at least 1.5 A.
|
H: Novice question: what are attributes in VHDL?
What is the difference between constants and attributes in VHDL?
I know that both can be declared and later assigned value inside the instatination. There are some pre-defined attributes. Attributes are accessed with '. Both attributes and constants are seen only in their parent namespace i.e. where they are declared.
When is each used?
More specifically, I am trying to understand this code:
Entity TOP is
generic (
DMA_BUFF_SZ_BYTES :natural:= 1024; -- buffer size in bytes
DATA_SZ :natural:=16
);
port
(
n_flaga :in std_logic -- tx buffer is full
);
attribute syn_debug :boolean;
attribute syn_debug of debug,
n_flaga :signal is true;
End TOP;
What would those attributes be for? The name syn_debug is not used anywhere else in the project.
AI: Constants stand alone : you can create them of any type with any valid value for that type. A typical use is the DRY principle : name a quantity once (by declaring a constant) and reuse the named constant wherever you need the quantity. Makes understanding and especially maintenance easier.
VHDL Attributes are always attributes of something. While you can declare your own attributes and attach them to objects, most use is of predefined attributes, whose values are taken directly from the attached object.
So if you are handed an array you can determine its first and last indices, its length, or its range (the datatype used to index it), and so on without having to pass a bunch of other numbers around. Or worse, read the whole thing to find the first NUL character in it!
So for example the range attribute gives the type of the index variable, and you can write functions like
procedure foo (a : array (integer range <>) of integer) is
begin
for i in a'range loop
a(i) := ...
end loop;
end foo;
and it correctly iterates over any array you can pass it as a parameter.
For more than this sketch, get a good VHDL book such as Ashenden's "Designer's Guide to VHDL"
EDIT: A common use of user-created attributes is to attach new, uh, attributes to an object. In the example the new attribute is a boolean, and only the two named objects (signals in this case) carry it.
In this case, the attributes are probably documented in the synthesis tool manual (they are specific to that tool), and the tool will treat any signals carrying that attribute in a special manner; at a guess, preserving those signals and keeping their original name attached, so that they are easier to find in the compiled design. See also "Chipscope" an embedded logic analysis tool, mentioned in Martin's answer to your other question. I would expect Chipscope to find these signals easily.
This is important because synthesis tools are usually aggressive optimisers; if the signal was provably unused or a duplicate of another signal, it would be deleted altogether without the attribute.
|
H: Power Resistor in Eagle
I'm making a PCB in Eagle. First I found my components, and now I have to put them in Eagle so I can draw the actual board.
Now the problem is, I have found this power resistor (I need 0.5 Ohm dissipating at least 4.5W. This one dissipates more, but is apparantly the cheapest I could choose from).
As you can see, there is no CAD design associated with this component. In the datasheet there is a recommended pad layout, but this would mean that the resistor is layed down on the pcb, whilst al other transistors that might need a heat sink are placed vertical on the PCB.
So my question is - how must I orient this component (horizontal/vertical/doesn't matter), and how an I find a CAD design to add this to Eagle?
AI: TO-263 is a SMT package and lays flat on the board, with the metal back soldered to a copper pour with optional vias large enough to dissipate the heat generated by the device.
You are unlikely to find this exact component in Eagle. Take the TO-263 layout from another component and use it to create this component in your library. Add the copper pour on your PCB layout, not the component.
|
H: Home Built Hybrid EV Battery Charge current limiting
I have a hybrid EV that I'm working on which uses 2 48V DC motors with a maximum load of 300 Amps each, for a total maximum load of 600A. I have 2 alternators running off a gas engine generating 125 amps each wired in parallel for a total static current of 250A. I want to use a battery system to pull the remaining 350A in short bursts of power. I've sourced a 100Ah 48V Li-ion pack in order to supply the necessary current.
My issue that I run into is that I want the alternators to charge the batteries when they're not being fully drawn, but the charge current for the batteries shouldn't exceed .5C, or 50A, so it's not an easy alternator -> battery -> motor-controller setup.
So, what do I need in order to connect all these components together in order to have the system I'm looking for?
AI: Many vehicle designs have a single bus that carries the current to the three systems. Using mosfets, or in the simple case - diodes, you can switch current onto the bus, or shunt it off into the system you're dealing with. Typically in a dumb system the bus is kept at voltage within a certain range, but that voltage is allowed to move up and down within that range, and each system acts differently based on the bus voltage.
Taking each system one at a time:
Alternators
The alternators attempt to keep the voltage at, say, 52V. As long as it's at or near 52V, they regulate their current output so the bus stays between, say, 50 and 52. When the voltage is below 50V, they run full tilt at 250A to get it back up there. That's their only job, since they never take current from the bus.
Motors
The motors don't care about the bus voltage. The throttle shunts current from the bus to the motors, and the bus voltage drops if the other systems aren't adding current quickly enough.
Batteries
The batteries are the more complicated system. If the bus voltage is 50V or higher, they take current from the bus, and charge the batteries. Just activate the 0.5A charger when the bus voltage is above 50V. 50V is the signal that the alternators have excess capacity, and the batteries can charge. They do not put any current onto the bus.
If the voltage is 48V to 50V, the batteries disconnect themselves from the bus if they aren't already supplying current. If they are supplying current, they continue to do so, trying to keep the bus voltage above 48V, but below 50V.
If the voltage is under 48V, the batteries start trying to force current onto the bus, keeping it between 48V and 50V.
The batteries only do this, of course, until they run to about 50% of their capacity, then they stop supplying current to extend the life of the batteries.
Result
When the motors draw no current, the alternators are running on a light load, charging the batteries.
When the motors are drawing 250A or less, the alternators are running at full load, and the batteries are disconnected.
When the motors are drawing over 250A, the alternators are running at full load, and the batteries are fully connected to the bus, pushing as much current as they have left onto the bus.
Reality
This system has its faults. If the battery-->bus or alternator-->bus regulators aren't happy with each other, you'll end up with system oscillation which might not be easily resolved.
Most modern systems use active elements and a single bus controller that tells each system what to do. This controller knows how much current the motor is commanding, and tells each subsystem how much current to supply, while monitoring other bus and system vitals to prevent overvoltage, overcurrent, and overtemperature violations.
But with careful design and tuning, the dumb system can work, and works well. An advantage is that the system can handle more devices either providing or using current without having to specifically communicate with a central controller. If you add solar panels, or a cabin cooling system, they hook directly to the bus with a little logic that turns them on or off depending on the bus voltage. On a central bus system you will likely have to reprogram the central controller and may even have to have these devices communicate with it so it doesn't accidentally discharge the batteries when it believes it is in a charge state, for instance.
|
H: Can I input a square wave LO into a mixer?
I would like to downconvert a signal at 169.55MHz (10khz bandwidth) into an IF of 20.4MHz.
For that purpose, I need a local oscillator of 149.15MHz or 189.95MHz.
But... of course, I cannot find a crystal at these frequencies (at least I think I don't have the budget for a custom Xtal. But I might be wrong on that point. I have no idea.) and I have to find another way.
I decided to try to generate one of my LO frequencies from a PLL. But most of the PLL have a CMOS or other kind of logic output, not sine waves. This is especially true when the output of the PLL IC is post scaled. This approach is convenient, because it's easy and low cost to design such a PLL with an integrated, high speed, VCO (such as the ADF4351). That VCO runs at frequencies around 1GHz, is divided and output using a logic driver (here differential at 0dBm).
My question is: can I inject the logic signal from the PLL at the input of my mixer? That signal has a lot of harmonics (only the odd harmonics, in theory.. right?) Or do I need to low pass filter that LO at the input of the mixer?
I have computed that none of the LO harmonics, mixed with the input signal (or harmonics of it) falls into my 20.4 IF band pass filter. But is it enough? Do I have to expect another issue related to this?
I would feel very confident to inject a "as clean as possible" sine into my mixer, but not a square wave...
AI: Yes, a square wave can be fine. When you mix, you get the sum and the difference of the frequency components from each input. The square wave consists of the fundamental and all the odd harmonics, so you need to do some filtering somewhere, of course.
The Softrock Ensamble RXTX is a simple direct conversion HF transceiver which makes a good example. There's a schematic on that page (a pretty bad one, but hey, you get what you pay for). U3 generates a square wave of a programmable frequency. U5 splits this into two quadrature clocks, QSD CLK 1 and 2. These find their way to U10, which is the mixer. It's not much more than a couple of analog switches. The output of the mixer goes to a couple of simple amplifiers and then to the audio input of a computer.
It's notable that this design wouldn't work with anything but square waves for the LO. U10 is an analog switch, with digital inputs to determine the state of the switches. It's not an ideal multiplier. If you fed it with a sine wave, the gain of the input transistors in U10 would make it a square wave anyway. This isn't true of all mixers, but here it is.
The filtering on this radio happens between the antenna and the mixer. The filters strip out all the harmonics above the band the kit was built for. Were this not done, then the LO frequency, plus all of its odd harmonics, would be aliased down to baseband. However, all those odd harmonics don't exist in the signal coming from the antenna after the filter, so there's no problem1.
You can also use this to your advantage. There's another kit in the same family, the Softrock RX Lite II, which when built for 20m or 30m, samples at a lower harmonic. That is, the LO is actually 1/3rd of what it would otherwise be, and it's the harmonic of that square wave input to the LO that actually mixes the signal down. Again, filtering removes out-of-band signals between the antenna and the mixer.
Given your difficulty in finding a suitable crystal, maybe this is good for you. If you can find one that is at 1/3rd of the desired frequency, you could make that work, with appropriate filtering.
1: provided, of course, that you don't have some really strong signal near one of these harmonics that can find its way in despite the filtering. It could be an issue if you lived right next to a broadcast station or you had to deploy this radio in a high-RF environment. It's an inexpensive hobbyist kit, not professional equipment.
|
H: Powering a USB Host with MCP1253 Charge Pump
I'm a SW head trying to design a circuit that can switch 5V to a USB Port for embedded Host Operation and switch it off for USB Device operation. Microchip have a few schematics which show the use of their MCP1253 Charge pump for this.
Obviously they know what they're doing but looking at the specs for this device it can supply 150mA of Output current. That seems very light weight for USB Host? In addition it provides a regulated output power but since my input Voltage would be 5V power rail of the board I'm not sure I need a regulator. Obviously I'm missing something.
I'd be very grateful if somebody could explain why this is used to power USB Host at such low current.
AI: A USB 2.0 host is only guaranteed to be able to supply 100mA (one unit load) without negotiation, so 150mA is just fine to allow any device to enumerate (in theory).
Of course there are all kinds of things that people could plug into a USB port that don't honor the specification and draw hundreds of mA, so some customers might be disappointed that their coffee cup warmer and 4,000 RPM USB LED fan doesn't work.
Some compliant devices ("low power") will operate from a single 100mA maximum unit load. Some devices "high power) require more than 100mA to operate, and such devices (if compliant) would enumerate but probably would not be able to operate properly with the 150mA limit. I believe external powered hubs are always less than one unit load.
Anyway, obviously you can't design a circuit until you determine the requirements such as the maximum number of unit loads you are going to allow for, how compliant to the standard you're going to be etc.
As far as compliance goes, battery powered Root Port hubs are allowed to limit their supply current to one unit load (100mA) and still be compliant. That's called a "low power" port. Otherwise, you have to be prepared to pony up to five unit loads (0.5A) upon polite request.
|
H: Isolating concentric coils
Due to space constraint, I wanted to set up two coils over each other. (So one coil is wound on a spool, then I want to wind the other coil over it (not necessarily touching it.))
However as it will cause them to effect each other (as it behaves like a transformer), I was looking for a solution to isolate the two.
Do you guys have any suggestions to achieve the same?
AI: You can't eat that cake then suddenly discover it's still there. The two coils couple magnetically so any ac signal on one will be transferred to the other albeit in a smaller amount depending on turns ratio, coupling factor and loading.
If you want to isolate them then move them apart or set up a high frequency field and run one coil like a metal detector - because it will be tuned it will largely ignore the impulse to drive the projectile and only modulate the RF field as the projectile moves. Far more complex but do-able if you know how.
|
H: MCP23017 Failing After Several Minutes?
I just bought an MCP23017 port expander and hooked it up to my an Arduino card. I used the sample code to turn on four LEDs when the program launches. Works great, except that after several minutes all the LEDs switch off and won't come back on until I actually power down the entire card and plug it back in (hitting reset won't cut it). I've checked and rechecked and everything else looks fine. Is it possible I've got a bad I2C chip?
AI: How is the hardware configured? Do you know how much current the LEDs are drawing? The datasheet says each pin can source or sink 25mA. That is reasonable for a typical, indicator LED, but you could be pushing it. Plus, the max current into Vdd is 125mA. It could be possible that the chip is shutting down the outputs until a hard reset to prevent overheating. If you are using transistors for the LEDs, it wouldn't matter. However, I'd be interested to see if you only used a couple LEDs and increased the series resistance for each such that they drew less current if that would fix the issue or not.
Edit
Pull the RESET pin up to 5V with a 10kΩ resistor. If not, it will just be floating. Once it drops below a certain threshold, it will reset the port expander.
|
H: L7809CV increasing voltage from 3V to 9V
I just got a voltage regulator and I was playing with it in a simple DC circuit. My Source is 3.25V, the OUT pin on the voltage regulator (L7809CV) shows 2.25. My confusion starts with the 1V drop in the energy. I'm not sure I understand how this works very well. If my voltage regulator is a 9V isn't it suppose to take in a lower voltage and increase it up to 9V ? I know the L7809CV is a linear regulator. Do all linear regulators drop voltage? Would I need a booster to increase the voltage instead, or this very one can be set up to work as a booster? Another question, what happens when the voltage in my source drops to (say) 200mV, would the voltage regulator be able to maintain the same 2.5V output until the battery is almost dead? I am not sure how to make sense of the information presented in the data sheet. Thanks much
AI: 78xx series are linear regulators, the input should be about 2v - 2.5v higher than the output voltage (please read below). For 7809 the input should be about 11v - 11.5v (again read below)
The dropout is given in the datasheet of 78xx, it shows a typical voltage drop of 2v and a max drop of 2.5v (note that this is from a 7805)
The specs for 7809A are the following:
And for 7809C the following
As you can see in the red rectangle there is only the typical value of 2v shown (no max voltage drop), but I think we can assume the same 2.5v as for 7805. Furthermore the voltage range (green rectangular) and yellow rectangle for which the datasheet shows the output voltage spec (blue rectangular) uses a range with 10.6 or 11.5v minimum input depending on the "A" or "C" type.
I think we should design circuits based on the worse case scenario so it is better to use the max drop of 2.5v rather than the typical of 2v, so we should feed the regulator with 11.5v minimum just to stay cleat of troubles.
To boost the voltage you'll need a switching regulator used in a boost configuration.
The minimum input voltage specs depend on the specific implementations, as long as the circuit works withing proper input range the 200mv drop will not affect the output
|
H: Harmonics are bad... But how bad?
In power systems, there are rules and regulations stating what levels of harmonic distortion is acceptable. One example I've seen for voltage distortion is: THD < 8%, single component harmonic <5%. These values are (hopefully) not random numbers.
From Schneider Electric:
Harmonics are unwanted currents that overload wiring and transformers,
creating heat and, in extreme cases, fire. These currents are harmful
to equipment. They weaken the reliability and shorten the life
expectancy of equipment exposed to the distortion
For induction machines, negative sequence harmonic currents will also cause a negative torque, which of course isn't good.
My question is: How bad is it, really? What can the consequences be if the total harmonic voltage distortion is 10% instead of 8%, if the 7th harmonic is 6% or if the negative 5th harmonic current is 10%. The reason why I ask is: Reducing harmonics does not come for free, is it really worth it in all cases? I know I have to adhere to the regulations, but assuming there were no regulations, what then?
Does anyone have any experience in this area?
Update
I forgot to mention the following in the question: The system I'm studying is not connected to the main grid. It has its own generators, UPS-system and all other necessary infrastructure. The operator and the owner of the system is the same company. The specific regulations I'm mentioning are for such isolated systems, not systems connected to the main grid (could for instance be a vessel).
Update 2
If you have your own power grid, and all the equipment is your own (thus you would need to take all the costs of installation, maintenance etc), then why are there limits and not guidelines when it comes to harmonics? I understand why there are rules regarding for instance short-circuit levels, arc-flash hazard etc. etc.
I also understand regulations regarding voltage drops, as this may lead to motors stalling, loss of excitation and more, I just don't get why there are strict regulations when it comes to harmonics.
How much damage can it do?
AI: Note: I am not an expert in harmonics.
It's valid to ask why the harmonics levels are set to the exact level they are.
I am currently reading AS 61000.3.6 (internationally, IEC 61000.3.6) which is about the nitty-gritty details of how the utilities calculate the harmonics emission limits for MV/HV/EHV customers.
Basically, it goes like this:
Compatibility levels: Equipment is designed to tolerate / be immune to harmonic distortion up to some level, the compatibility level. If we can keep the power system harmonic levels below the compatibility levels, the equipment will work. (The compatibility levels are defined in IEC 61000.2.2 and IEC 61000.2.12.)
The harmonic effects being controlled are long-term effects (overheating of cables, motors, transfomers, capacitors, etc.) over a period of minutes, and short-term effects on electronic devices over a period of seconds.
Planning levels: If we keep the amount of harmonic emissions at 'Timbuktu substation' to '10 units' or less, we will meet the compatibility levels. (IEC 61000.3.6 goes into detail about how to calculate '10 units'.)
Apportionment of planning level to individual customers: Bob's Factory is using '5 units' of power, out of '10 units' available at 'Timbuktu substation'. We will allow Bob's Factory to emit a maximum of '5 units' of harmonics.
The key point is that the objective of the harmonics emission limits is to ensure that the compatibility limits aren't violated.
If each customer respects the harmonics emission limit assigned to them, then the harmonics emission level of the system as a whole will be less than the compatibility level, and everyone's equipment will work. If you exceed your emissions limit, you'll probably bugger it up for everyone.
EDIT:
You ask why there are limits on harmonics, even within your own islanded installation, where you won't be affecting other customers.
From Schneider's Cahier Technique 199 Power Quality we have the following list of negative effects from harmonics:
From Schneider's Cahier Technique No. 152, Harmonic disturbances in networks, and their treatment, we have a few more effects not mentioned above:
2.1 Instantaneous effects
Harmonic voltages can disturb controllers used in electronic systems.
They can, for example, affect thyristor switching conditions by
displacing the zero-crossing of the voltage wave (see IEC 146-2 and
Schneider Electric "Cahier Technique" n°141).
...
Interference on communication and control circuits (telephone, control and monitoring)
Disturbances are observed when communication or control circuits are
run along side power distribution circuits carrying distorted
currents...
Some of these effects might be severe. For example, if harmonics were so bad as to cause interference on a critical control circuit, causing maloperation of that circuit, that would be bad regardless of its effect (or not) on other customers.
So, from this perspective, the limits are there to force you to consider electromagnetic compatibility with vulnerable equipment in your own installation.
Anecdotally, dirty power supplies cause all kinds of intermittent and hard-to-find issues.
My boss told me a story about how they installed a plant full of VSD's (VVVF drives) with no harmonic filtering. The problem was that substations would trip on earth fault (?) seemingly at random when drives were started up - including substations on the far side of the plant to the VSD being started!
Eventually it was determined that the relays were mal-operating due to harmonic currents. From memory, the harmonic current were flowing through the entire plant via earth paths, including structural metalwork and metal cable trays, which is why a VSD on one side of the plant was able to affect a substation on the other side. The electrical paths had to be broken up by replacing some sections of metal tray with plastic trays, and so on.
In the end the problem was only solved after an expensive course of rectification works was performed. Again, the limits are there to ensure that you have to consider harmonics from the start, so this doesn't happen to you!
|
H: Why superposition theorem fails here?
I have a simple circuit consisting of 2 ideal voltages sources (each 5V) parallel to a resistor of 5 ohms. The current along the resistor is 1A, right? But by applying the superposition principle (i.e. considering individual sources), I am not getting this result. Am I doing some blunder?
AI: Ideal circuits with two voltage sources in parallel lead to contradiction, unless they are equal and can be simply replaced with a single one. Note that potentials \$ \varphi_1 \$ and \$ \varphi_2 \$ in your circuit must be equal, since there is no impedance of any kind between them, nor do ideal voltage sources have any internal resistance:
In your case, luckily, these sources produce the same voltage, so the simplest thing to do is to simply remove one of them from the circuit. If you had two ideal sources of a different voltage in parallel, that would lead to contradiction.
In a real circuit, connecting two sources in parallel would lead to a circuit with a very small, but still non-zero resistance between them, which would result in one of the sources (the one with a slightly lower voltage) actually sinking current, but the current through the 5 ohm resistor would only depend on the voltage of the right source.
If you want to put some actual numbers, you can try something like this:
Note that if the sources are again ideal and have completely equal voltages, there will still be no current flowing through the tiny resistance between them, but you should be able to apply the superposition principle.
For a circuit like this, the mesh current method should provide the simplest solution and show that the current through the resistor only depends on the right source.
|
H: Simple LP filter - calculate cutoff frequency
If I am correct to calculate cutoff frequency in this LP filter I have to sum up the impedance of resistor and capacitor, right?
simulate this circuit – Schematic created using CircuitLab
So:
$$
Z_1=R_1\\
Z_2 = \frac{Z_{R2}*Z_{C1}}{Z_{R2}+Z_{C1}}
$$
My result is about 80 kHz but correct answer is 230 kHz. Who is wrong? :)
AI: $$
Z_{bot} = \frac{R2 \cdot \frac{1}{s \ C1}}{R2 + \frac{1}{s \ C1}} = \frac{R2}{1 + s \ C1 R2}$$
$$Z_{top} = R1$$
So
$$Gain = \frac{\frac{R2}{1 + s \ C1 R2}}{R1 + \frac{R2}{1 + s \ C1 R2}}= \frac{R2}{R1 + R2 + s C1 R1 R2} = \frac{R2}{R1+R2} \cdot \frac{1}{1 + s \ \frac{C1 R1 R2}{R1+R2}}$$
Filter thus as a pole when $$s \frac{C1 R1 R2}{R1+R2} = 1$$
Let $$s = 2 \pi f \Rightarrow f = \frac{1}{2 \pi} \cdot \frac{R1 + R2}{C1 R1 R2} = \frac{1}{2 \pi} \cdot \frac{2.2k \Omega + 2.8k \Omega}{560pF\cdot 2.2k \Omega \cdot 2.8k \Omega} \approx 230.69 kHz$$
|
H: How did I survive a short hand-to-hand 230V shock?
About 5-10 years ago (can't remember when exactly), my father asked me to unplug a lawn mower from an ungrounded power outlet with no sunken part (the kind which had been outlawed by the EU for a few years by then). The outlet was in a corner, somewhat inaccessible due to a computer desk, so I reached over from the side of the desk and outlet (not the front) in a really clumsy way and tried to unplug it even more clumsily by trying to push my fingers between the plug and the socket. I had my other hand against the nearby wall corner, and all of a sudden I felt a current go through my arms and chest, from the outlet, through my left hand and arm, over to my right hand and arm, and into the wall.
After about a second, I managed to get my fingers from between the plug and the shock stopped. I had only 2 fingers in there, one against each rod, and apart from being impressed by the event and having an afterfeeling in my chest for about 15 minutes afterwards, I didn't notice any harm from the event. I can still work, cycle recreationally for a few hours, exert myself with moving stuff and life live like I'm used to in general. The only thing which might be a consequence is that I sometimes have a minor pain for 10 seconds or so in my chest muscles, but those are sporadically and not related to any particular activities, so I don't know if it is related.
Thing is, I always read and heard that such jolts are lethal. The surge didn't last long, but it passed right through my chest and wasn't mitigated in any way by any kind of barrier. And you often hear about people being killed by testing batteries with their tongue, which are only a fraction of the power of a domestic grid. How did I survive this incident?
In case it's relevant: I was around 16 years, a normally built male with no particular muscles or fat layers, in Belgium.
AI: First
And you often hear about people being killed by testing batteries with their tongue,
The chances of such reports being true are close to zero.
I have never heard of such a report that is reputable or traceable to source*.
I cannot think of a mechanism that would make doing this likely to be fatal.
I do not recommend that others do this without advice from their attorney, GP, surgeon, insurer and spouse., BUT, I have 'tested batteries with my tongue' probably hundreds of times in my lifetime at voltages up to 9V / PP3 batteries. The sensation is 'interesting but nothing like the sort of effects I have experienced from more substantial and life threatening electric shocks.
Electrocution by AC mains:
See references at end.
Short: You usually need to pass a certain amount of current through your heart muscle long enough to cause fibrillation of the heart. The trigger point is inexact and will vary widely with circumstance and person. Many people receive severe mains electric shocks and survive with little or no apparent damage. Others receive what may appear lesser shocks and die. Luck and more is involved and not doing it is the best protection.
I have read accident reports of people who died due to a finger to finger shock while unplugging a cord from a mains socket. There was probably a secondary path to earth through the body as well.
Longer:
Death from electric shock from mains AC at residential voltage levels (say 100 VAC - 240 VAC range) is usually caused by fibrillation of the heart. Current passing through the heart interferes with the natural pace making cycle and the heart goes into an oscillatory mode that does not support pumping. It usually takes a current of look_it_up mA for a period around a certain criticaL heart timing parameter. The details are not as important as is knowing that you want to keep current away from your heart or, if possible, away from your body.
I have had probably dozens of AC mains shocks over a long lifetime - some severe, most less so. I've also managed a hand to hand 1200 VDC shock (not at all recommended) and one RF kick from a 100W + voice triggered transmitter ("hey - look, the aerial is disconn ... AGH!!!")
I've made an increasing habit of trying REALLY hard to avoid mains shocks and I can't now remember the last time I had one. The odd very high impedance tickle is known to happen from time to time - but as these are a step on the path to too much current they too are avoided.
Ground fault interrupters / GFI = Earth leak circuit breakers / ELCB are designed to detect leakage of current from a circuit to ground and to then terminate the power supply in less time than the critical period. Say around 10 mS from memory. I purposefully tripped an ELCB with my body long ago to see what it felt like. Back of hand contact as below. The shock was substantial and painful even though it lasted only for a few mS.
A major problem with electric shock is that the body's muscles tend to contract under current frow and the victim may grip the live item and not be able to release their grip. This effect can occur at as low s 12V DC under "ideal" conditions. (Such as eg standing in salt water holding a metal fish spear and a LED lantern powered by 12V and mounted on hand held metal pole. A friend did this and a fault caused a return path via the fish spear and water and their legs and they report having their hands clamped on the spear and being unable o release it. ) DC is worse than AC for this but AC can be every bit as bad as is requried to be fatal.
If you ever MUST touch something which may be "live" then I've seen it recommended that the back of the hand or fingers be used so that if the muscles contract the limb will contract away from the conductor and will; not instead grasp it. This is in fact the precaution that I have taken personally for many years but see your attorney surgeon etc as above and take this as comment and not advice.
Electric shock - OSU
Hyperphysics page - Electric Shock
Wikipedia Ventricular fibrillation
Wikipedia - Electric shock - magnitude says:
The minimum current a human can feel depends on the current type (AC or DC) and frequency.
A person can feel at least 1 mA (rms) of AC at 60 Hz, while at least 5 mA for DC.
At around 10 milliamperes, AC current passing through the arm of a 68 kg (150 lb) human can cause powerful muscle contractions; the victim is unable to voluntarily control muscles and cannot release an electrified object.[3] This is known as the "let go threshold" and is a criterion for shock hazard in electrical regulations.
The current may, if it is high enough, cause tissue damage or fibrillation which leads to cardiac arrest;
more than 30 mA[4] of AC (rms, 60 Hz) or 300 – 500 mA of DC can cause fibrillation.[5][6]
A sustained electric shock from AC at 120 V, 60 Hz is an especially dangerous source of ventricular fibrillation because it usually exceeds the let-go threshold, while not delivering enough initial energy to propel the person away from the source.
However, the potential seriousness of the shock depends on paths through the body that the currents take.[5] If the voltage is less than 200 V, then the human skin, more precisely the stratum corneum, is the main contributor to the impedance of the body in the case of a macroshock—the passing of current between two contact points on the skin. The characteristics of the skin are non-linear however.
If the voltage is above 450–600 V, then dielectric breakdown of the skin occurs.[7]
The protection offered by the skin is lowered by perspiration, and this is accelerated if electricity causes muscles to contract above the let-go threshold for a sustained period of time.[5]
If an electrical circuit is established by electrodes introduced in the body, bypassing the skin, then the potential for lethality is much higher if a circuit through the heart is established.
This is known as a microshock. Currents of only 10 µA can be sufficient to cause fibrillation in this case.
Added - March 2016.
A reader mentioned a report of a man being killed using a multimeter on an Ohms range and pushing the probe tips through his skin into his body so the current flowed through his core resistance of (it says) around 100 Ohms.
It is essentially certain that this account is fabricated
(and most "Darwin award" stories are. I'd be genuinely pleased to know of a reputable link to the original claimed report of ant reputable report where this happened.
Note that it is substantially different to connect to a 9V powered Ohm meter than to directly contact a 9V battery's terminals.
Battery across the tongue - my assessment above stands.
Battery hand to hand with probes/contacts pushed through skin into body core !!! - Ouch! - I'd not recommend it ir do it purposefully. Death may be possible, but seems unlikely. 12V across chest near heart using sharp tipped probes HAS caused death. (Reference not to hand). However ....
An Ohm meter even on a low Ohms range is designed to provide a voltage such that at zero Ohms external load the meter is just delivered full current.
An example of a Simpson 260 meter as claimed to be used by the cited report.
There are a range of model 260 Simpson meters but all seem to be 20,000 Ohms per volt meters meaning it needs I = V /R = 1V/ 20,000 Ohm = 50 uA of current to achieve full scale deflection. The original 1930's model had a 50 uA movement and all others since also seem to have had. This is typical of this class and age of meter.
While the designers MAY arrange for 100 uA or 1 mA of full scale current to flow on low Ohms with probes shorted, the odds of it being designed to deliver 100 MA or even 10 mA in such conditions is minimal.
Questionable 1999 Darwin Award report
Simpson model 260 multimeter as reported to have been used:
Original 1930's model 260 - even this had a 50 uA movement.
260 series 2
Simpson 260.com
260 9SP
260 AFP-xx
260 SR
Legion
___________________________________________________________
Added 2020:
This chart (source shown on right hand margin of image) shows combinations of time-current which may cause various effects, ranging from perception through death.
I'd err on the low side when deciding what might be harmful.
Note that (Ventricular) fibrillation usually kills if not reverted promptly.
The orange AC4-1 zone suggests a 5% to 50% chance of fibrillation.
The suggested boundary conditions for potentially lethal AC4-1 include
50 mA for 1 second, or
100 mA for 500 ms, or
200 mA for 250 ms, or
500 mA for 50 mS.
The lowest current suggested to possibly cause death is about 30 mA (for > 5s).
Aim for lower or none of any of these examples.
|
H: How does a series capacitor affect a square-wave on-off signal?
This question refers to the book Make electronic's experiment 18.
I have included a picture below.
R7,R9,R10,R12: 1K
R8: 2K2
R11: 330K
C1: 100uF
C2: 68uF
C3,C4,C6: 0.1uF
C5: 10uF
S1,S2,S3: tactile switches
IC5,IC6,IC7: 555 timers
IC1: 4026 counter
quote from the book:
When the output from IC7 goes from positive to negative, it will trigger the reset of IC6, flipping its output negative, which allow the count to begin
The capacitor C4 communicates the sudden change from positive to negative, but the reset of the time it blocks the steady voltage from IC7 so that it won't interfere with IC6
My question: How does IC6's pin 4 get negative voltage or grounded? I thought C4 would only accumulates positive current from IC7's pin 3 and release it to IC6's pin 4.
I thought the capacitor should be hold fixed to connect one pin to positive, and another to negative. From what i can see the IC7's pin 3 is switching from positive current and then to ground on one of the pin of C4.
Thank you
AI: How does IC6's pin 4 get negative voltage or grounded?
If pin 3 is high (+5V) and C4 is discharged, both sides of C4 are high (+5V), The right hand side of C4 is held high by R10. The left hand side is held high by pin 3. There is 0V across C4.
If pin 3 goes low (-5V), C4 cannot instantaneously charge from 0V to 10V so taking it's left hand side down to -5V takes the right hand side to -5V. This -5V is seen at pin4 on IC6.
R10 then slowly charges C4 bringing the voltage at it's right hand side towards +5V.
The circuit would function the same if I arbitrarily changed the labels +5V and -5V to, for example, +10V and 0V (or GND). In which case you might or might not want to replace the word "negative" with something else.
Do you mean if one pin of C4 is grounded, then the other pin of C4 would suck current from this pin as well?
No, See the "Differentiator" example in this tutorial
No current needs to flow through or across the capacitor because the voltage across it is initially unchanged. If the voltage with respect to a fixed reference point (ground) at the left hand is changed, the same change will be seen at the right hand side. No current need flow. Subsequently there are changes but these involve external flows of current.
|
H: Can the discharge when plugging a laptop to a power outlet can do any harm?
In this question the OP ask if (s)he should connect a power source into a power outlet first or into the laptop first. While the question has been closed, i think there is a very valid point to consider:
When I plug a laptop power adapter into the laptop first and only then into a power outlet, there is a big, visible and audiable discharge. I've been using several power sources and they all behave the same.
Can this discharge be harmful in any way? For example, can it overload the power source or damage the electrical contacts or the outlet? Or even get transferred through the power source to the laptop?
Returning back to the linked question: For many years I've been following the general principle to first plug a power source into a device and then to the power outlet, because the power source should shield the device from any jitter caused by plugging it in. (However I'm not a specialist and this could be completely wrong.) But seeing and hearing this discharge every time makes me a bit uneasy.
AI: The spark is just the capacitor in the input stage after the rectifier charging up. That is common for a switching power supply, unless the designer put extra effort towards limiting that inrush current.
This can not overload the power supply, it just charges up to normal operating conditions. The input capacitor can't get more voltage than the outlet provides. Can the spark erode the contacts? Maybe, I don't know (these aren't exactly flimsy contacts), but my feeling is that you would face mechanical failure from all the plugging long before that could even become a concern.
The reason that you don't see and hear a spark without the laptop connected could simply be that it is too short and weak when it is only charging that capacitor. The connected laptop, on the other hand, might immediately draw enough current from the outlet through the supply to maintain the spark until the plug is fully connected.
|
H: Connect in-built microphone in webcam through USB
I recently repurposed a webcam from a HP laptop to make it USB webcam. I was able to connect the webcam to USB. It also has an in-built microphone, and I dont know how to make it usable.
The webcam had 6 connections - D+, D-, Power (5V), GND, L, R. I connected D+, D-, Power & GND to corresponding wires in a USB and got the webcam working. Now I'm left with 2 wires - which is L & R for the mic. I don't know how to connect this to the same USB wire or a different USB. I read somewhere that, these integrated microphones use the same GND as the webcam. Other than that, I have no clue. Seeking help from the experts. The webcam is one of those from Silicon Motion Inc, used in DV4 series of HP Pavilion Notebook PCs.
AI: Most likely it's not designed to go into any USB cable - it's designed to go into the MIC input of the laptop's sound card. So you'll need to connect it to a sound card to use with a computer.
|
H: Control relay from sensor output when LOW is 0.2V
I used this circuit as a reference to drive a relay from the digital output of an arduino. This circuit worked as expected.
simulate this circuit – Schematic created using CircuitLab
Instead of controlling the 2N2222 with the arduino, I then tried to control it with the Panasonic EKMC1601112 motion sensor. The results were not good: I noticed that the output kept flickering on and off, even with no one in the room. I measured the output of the sensor and found that it was 5V when "on" and about 0.1V - 0.2V when "off".
I have several questions about this.
1) I'm assuming that 0.1V is enough to turn the 2N2222 on, which causes the flickering behavior. Does that sound right?
2) I know I can run the output of the motion sensor into the arduino (and I eventually will do that) but how can I adjust the existing circuit? Is the issue proper transistor biasing?
3) If I'm reading the AtMega328 data sheet correctly, when powered by 5V it recognizes a "low" signal up to 0.3V. So I should be fine if I use a digital input. What is normally done...is that "good enough" or would you do something to lower the voltage that appears at the AtMega input?
I'm assuming that the problem totally goes away if I connect the sensor to an analog input on the arduino. And again I may do that, but I really would like to understand the other issues involved.
AI: There is a basic digital wiring diagram in page 11 of the datasheet you have linked
There is a note (and the specs table has this too) that the sensor can only source 100uA, so you need to use a high value resistor for the base, something like 100k which will sink about 43uA (assuming 5v supply) and a resistor from base to ground in the range of 1000K or so.
As a load in the collector you should place a resistor of about 10K-100K (I would say 47k).
This will still not solve the hysteresis problem, the transistor will turn on/off rapidly when the sensor detects motion.
One solution for that is to feed a pin of your mcu from the collector of the transistor, detect the change and apply the delay in software.
The other solution is the circuit provided in the same page of the datasheet that uses a timer to add delay
|
H: op-amp replacement
I am trying to built this current source, but he LM107 seems to be discontinued, what opamp could I replace it with? I dont know much about opamps and there are so many choices.
Any maybe an opinion on updating the other components as well would be nice, they seem hard to find.
AI: The lazy approach would be: -
You can find all their integrated current sources here
|
H: Band-pass filter confusion
I'm having trouble understanding the concept of a Band-pass filter.
Not, that I have the following signal (in the frequency domain):
What I essentially need to do is remove the noise and only keep the highest frequency points (i.e. between 60-80 on the x axis) whilst removing the low frequencies. For this I need to use a band-pass filter, but, in order to implement such (coding project) should I:
1) use a low-pass filter AND
2) use a high-pass filter
If so, how would I therefore determine the cut off points to cut at in the signal?
AI: If you want a head start on trying various filters, this site is excellent for that. I picked the RLC band-pass filter and tweaked the values to give 70kHz centre frequency: -
I chose 70kHz because your graph was centred at "70" and I took a wild guess that you meant 70kHz but it won't make a difference if it's 70MHz BUT 70Hz requires something different entirely because the inductance would be too big - you'd need to use op-amp filters.
Anyway, at about 60k and 80k the response to an input signal will be about 6dB (half amplitude) down. There are plenty of filters to choose from so good luck in your hunting.
|
H: High value resistors in optical slave trigger? Why?
In a commercial optical trigger, for triggering flash units remotely using the on camera flash, there are two very high 30 Mohm resistors in series. Why such a circuit would need resistors so big? This trigger works well with old flash units that have an high sync voltage (up to, and sometimes in excess of, 300 V when the flash fires) or newer flash units usable with digital cameras that stay in the range of 2-6 V (but also slave triggers built from the simplest circuits that have only a photodiode and an SCR work with both if the SCR can take an high voltage)
In series with a photodiode they would be too big, as a divider they would leave nothing to the circuit to trigger the strobe... What am I missing? I cant understand their function or benefit... (and I don't have one at hand to break apart)
I attached two pictures, the first shows two slaves, same brand, same circuit, one is built-in in an hotshoe adapter the other has a plug at the back for connection to other adapters, cables or directly to the flash unit. The circuit has a photodiode, SCR, 4.7 k resistor, 400 V 0.047 capacitor, and two 30 Mohm resistors that can be seen soldered in series! I suppose the 4.7 k resistor and the capacitor are the RC to filter ambient light. The resistors are very visible in the closeup picture of the peanut slave. Triggering happens when the SCR shorts the negative rail of the flash unit and the positive center pin of the flash unit.
AI: It's measuring the voltage on the high voltage supply, so any loading will drain the flash battery.
300VDC through 30M\$\Omega\$ is actually quite a large current (\$10\mu\$A), and would represent several mA being continuously sucked from the flash battery when the HV converter is operating.
|
H: What is the correct way to handle inrush currents from a DC/DC converter with short-circuit protection?
I have been using CUI VESD2-S24-D12 to generate 24V to run a circuit board. That regulator has been EOL'd with the recommended replacement being PEM2-S24-D12. The two are effectively identical except that the PEM2 has continuous short-circuit protection, which I would typically consider an advantage.
However, this poses a problem. My circuit board has an LCD module that draws a brief (~5mS) inrush current of several hundred milliamps. My previous regulator would handle that just fine. The new one, however, current limits itself, so the output voltage crashes and it won't bring the display board up.
I see two obvious fixes. One, find a new regulator that's not current limited. Two, add some active circuitry so that my regulator first charges a cap before the actual load gets connected to the output of the regulator. The cap should handle the startup current, keeping the voltage from collapsing.
My question is, is that the most reasonable approach to solving my problem? Is there a standard, canonical, or otherwise "correct" way of handling this situation?
AI: Either of your solutions sound entirely reasonable. There are some power supervisory chips that could handle the turn-on delay. For example, the inexpensive ADMxxxx series:-
\$ \overline{ENOUT}\$ on the ADM1087 is an open-drain output that could directly drive a P-channel MOSFET gate (with a pullup resistor) and source connected to +12 to give you a high-side switch. You only need to select the delay time (by a capacitor) the threshold (by a voltage divider pair of resistors) and give it a low voltage supply voltage such as 3.3V.
If the DC-DC cannot handle the capacitive load that is required for reliable starting (most have limits specified in the data sheet, sometimes as low as 200uF), then this is a scheme that I've used before in much more demanding situations. It requires two switches (or to use an enable line on the load). The Big Fat Capacitor (BFC) charges through R1 and when the voltage across Q1 is sufficiently low (as determined by a supervisory circuit such as the ADMxxx measuring the voltage and time), both switches close, shorting R1 and supplying power to the load. R1 sees some high dissipation potentially, so a pulse-rated resistor is called for.
simulate this circuit – Schematic created using CircuitLab
In some cases, you may be able to replace Q1 with a diode and/or Q2 with an enable line on the load circuitry, so only the supervisory circuit (to drive the enable line), a resistor and a capacitor are required.
In other cases where mains voltage and hefty capacitors are involved, wirewound resistors and mechanical relays or Solid State Relays (SSRs) can be used, but the concept is the same at the kW level.
NTC surge eliminators can be used in such (mains power) situations, however they drop voltage, waste power and are not reliable at their task (the capacitors can discharge faster than the NTC cools, then you get a huge surge if the power blips momentarily). They'll also not work well if your circuit needs a surge to get going, they will cause harm by giving it a voltage that is ramped up rather than a sharp startup.
Of course if you can find a DC-DC that can reliably handle the startup surge, that will be simpler, but guaranteeing that may not be that easy (testing over temperature perhaps with two displays attached) and you might want to protect the DC-DC with a polyfuse.
|
H: High speed communications on a lower speed controler
I am new to electronics, I'm trying to get my head around this concept.
As I understand it, on any processor, you will be able to switch an output on or off, at a rate no faster than the speed of that processor. So a 8Mhz chip could (ideally) switch an input on or off at a rate of 8 million times a second.
HDMI 2.0 specification calls for a transmission rate of up to 18 Gbit/s. How is this possible without an 18Gzh processor?
AI: Such fast outputs are never handled directly by a processor. That would be called "bit banging" and is really only practical for bit rates that are a small fraction of the CPU instruction cycle rate (note that a chip with an 8MHz external clock might internally run at 2MHz or 200MHz instruction rate).
Instead there are peripherals that are dedicated arrangements of gates, flip-flops and registers that are used to serialize data, perhaps directly from memory (DMA = direct memory access). There may be an internal memory bus dedicated just to getting data out of a frame buffer at that rate. In the case of HDMI there would likely be a dedicated graphic processor (GPU) optimized for video processing.
In the case of the Broadcom BCM2835 SOC used in the Raspberry PI, the GPU is a VideoCore 4 ARM1176. It would be nice to see the internals of such a chip, but Broadcom holds the cards close to the chest, and an NDA and a substantiated intent to use a substantial volume of chips is the price of entry.
|
H: Output waveform for this circuit
Can someone explain the behaviour and the output(at B) for the following circuit?
What I think is that, C will charge and at one point stop conducting. So at B it will be HIGH output at that instant and till it charges.
Now after it is fully charged, it will discharge throught R, so the output should decrease with a slope to 0,and this should repeat. I am not sure if this is right.
Can someone please confirm that?
I tried building the circuit, but the rise and fall happens only once. Can someone explain why would it not repeat itself?
simulate this circuit – Schematic created using CircuitLab
AI: No, as the voltage across the capacitor increases the voltage across the resistor will fall from 5V to 0V. At that point current stops flowing and the voltages remain constant...forever.
EDIT: For the capacitor to discharge you need a resistive path from one terminal of the capacitor to the other (without the 5V source in series). There's just no path to discharge the capacitor. I don't know how to explain it more simply.
|
H: difference between a DC motor and gear motor
Isnt DC motor the same as gear motor? Because what is the use of dc motor without gears?
AI: A DC motor is not the same as a "gear motor" - a "gear motor" may be an AC or DC motor coupled with a gearbox or transmission. A gear motor adds mechanical gears to alter the speed/torque of the motor for an application. Usually such an addition is to reduce speed and increase torque. A DC motor without gears is useful in many applications, for example the simple fan. Contrast that with the motor that operates the turntable in your microwave, a gearbox there reduces the speed so your food isn't thrown against the interior wall.
For more information, check the Wikipedia on DC Motor.
|
H: What is the correct way to interface 3.3v logic with the PS_ON# 5v signal on a standard PC power Supply?
The PS_ON# line of a standard ATX PC power supply needs to be pulled to ground to turn the supply on. The signals on an ATX supply are 5v logic according to the standard. I'm trying to re-purpose an old PC power supply and I need to control it with a 3.3v logic device (GPIO on a Raspberry Pi). What would be the right way to connect the PS_ON# signal to the 3.3v pin so I can use it to turn the power supply on and off.
I've tried a resistor voltage divider but that didn't work because it always pulls the signal low and I'm afraid that hooking the 5v PS_ON# directly to the pin will fry the 3.3v chip. Is there an easy way to do this that I'm missing or do I need a special part to deal with the difference in voltages?
AI: Use a NPN transistor. PS_ON to a 1k resistor at the collector, 1k resistor at the base, emitter to ground. Voltage at the base can be different than the collector.
Update: Further research shows the PS_ON tends to have a pull-up resistor to 5vsb. In that case, adding a 1k to the collector creates a resistor divider. If too high a ratio, then the input signal might not cross to a Input Voltage Low. You can size down the resistor, or omit it.
|
H: Sporadic Clock Signals from Momentary Switch
I'm having trouble using a NO momentary switch to send clock edges to a J-Kbar flip flop, specifically the TI CD74AC109E(datasheet).
I have a switch between +5V and the clock pin, and also added a 10k\$\Omega\$ pulldown to the clock pin, so it stays at 0V while the switch is open.
However, when I close the switch, the output responds sporadically; I have the flip flop hooked up so it toggles the Q and Qbar outputs on every high edge on the clock pin, but it doesn't always do that.
I realize that this might be caused by the lack of debouncing for the switch, but as the switch isn't a tactile switch (doesn't go click click when pressed), and the sporadic behavior occurs even when I depress the switch (open it), which makes me think it might be a different problem.
Does anyone have any suggestions as to why this might be happening?
P.S. YouTube video demonstrating the issue I have. I've hooked up an LED to the Q pin to show the output.
AI: All mechanical switches have the potential to bounce, and most do at least some of the time.
That's exactly what is happening. You need to add a debounce circuit. The easiest way is something like this:
simulate this circuit – Schematic created using CircuitLab
The RC slows the switch transition down, and the Schmitt trigger gate cleans it up so there is only one transition each way, thanks to the hysteresis.
|
H: ARM9 vs ARM11 performance?
This may be a loaded question, but is there a general understanding of the performance increase per clock between ARM9 and ARM11? Say, for a math-heavy function (FFT)?
Thanks!
AI: I think you should look at this link. It compares ARM9, ARM11 ARM Cortex A8, Xscale & Atom processors based on floating point multiplication, memory bandwidth, context switching time, sysstem call performance, process forking, etc.
Hope this will help you.:)
|
H: LED PCB bulb - how much cooling do they need, what is their maximum temperature
I am building a SAD (Seasonal Affective Disorder) light box - its a super bright light.
The specs of the LEDs I am using:
50W Warm White LED IC High Power Outdoor Flood Light Lamp Bulb Beads Chip DIY
Lighting color: warm white
Color temperature: 3000K
Beam angle: 120 degree
Working voltage: DC 32-34V
Working current: 1500mA
Power: 50W
Luminous flux: 3800LM
Size: 52 x 46mm
Although these specs don't specify the maximum temperature they can handle prior to failure, what temperatures can LEDs typically withstand?
As a ball park figure I can tell you an Intel CPU is recommended to stay below 70°C but can handle upto 100°C at most - but I don't know what the thresholds for LEDs are!
I'm using a coolermaster i30 on a 150x150mm copper plate to cool 9 of these LEDs, the i30 is supposed to be able to "cool to 320Watts", which I would assume means it can keep a 320 Watt CPU below 70°C
AI: It depends how long you want them to last. The hotter they are, the faster they die; the cooler they are, the longer they last.
Parts from reputable suppliers will have temperature specifications tied to lifetimes, and they will also have thermal resistance specified - cooling the plate to 70C does not mean the active area of the LED would be at 70C... - based purely on the specs (and lack of specs) I'm guessing these are more casually sourced (direct from China via ebay, perhaps?) and may already be quality control rejects to take that path.
You should shoot for a lower temperature at the plate. And turn it over if you want the heat pipes to work.
Some better specified ones I have to play with spec an absolute maximum junction temperature of 125C, but that's at a point where they are severely derated and about to expire. Maximum current allowed starts to drop at 65C ambient, which is a good indication that they should be operating below that temperature in a well-designed fixture. A somewhat higher end one I also have to play with increases the max junction to 150C. But every step from the junction to ambient has thermal resistance, and that raises the junction temperature relative to ambient temperature. Aside from shorter life, high temperatures also reduce LED light output.
|
H: Attaching Load to Source on Mosfet
I need to control an LED with a N-channel mosfet, but need the cathode to be connected to ground. I learned to do it this way:
but when I tried to connect it differently to keep the cathode of the LED grounded like this, there was a big voltage drop across the mosfet for some reason:
Exactly why does this happen? Would I be correct in thinking that using a P-channel mosfet would serve my purpose?
AI: Would I be correct in thinking that using a P-channel mosfet would
serve my purpose?
Yes, you would be absolutely right.
Since MOSFET's are turned on by applying a voltage between Source and Gate, the diode in your second image acts as that very voltage drop that is stolen from your Source-Gate potential. That pretty much means, that the transistor is no longer turned on by the full battery voltage, but rather \$V_{bat}-V_{diode}\$.
What you are looking for is what's called a high-side switch. This usually requires a P-channel MOSFET.
simulate this circuit – Schematic created using CircuitLab
|
H: Using Arduino to program at89s51
I want to program at89s52, and on the internet there are many tutorials on how it is usually done, but almost all of them use the RS232 output from the computer, which I don't have.
The only resource that actually implements it in another manner that I found is the usbasp page. This is something I would by default do, but I would like input from users who have experience programming the 8051 first.
1) Is it possible to implement device programming with an arduino? If so, is it feasible? I'm not entirely familiar with how exactly the SPI programming works, but it is something I am interest in learning. The idea is that I look at the datasheet, find out exactly what needs to be done, and use an SPI library for the arduino.
2) If 1) is too impractical and/or unreliable, should I go ahead and proceed with the USBasp project? I've read somewhere that on newer version of windows, this process is unreliable. So, what are your experiences with USBasp, to those who have done something similar in the past?
3) Any other suggestions or recommendations to upload a program onto the chip?
AI: The AT89S51 is an 8051 architecture microcontroller, not an AVR architecture microcontroller like the Arduino and (as normally expected by) it's ecosystem of programmers.
However
The AT89S51 supports serial programming using an SPI interface (MISO,MOSI,SCK,Reset)
People claim to have used avrdude (and progasp172) to program an AT89S51 (ref)
If I am right, any Arduino running the ArduinoISP sketch should be usable, in conjunction with avrdude, to program an AT89S51.
Probably not very many people have tried this.
There are numerous inexpensive ISP programmers that are known to avrdude or which emulate a programmer known to avrdude. For example, I've used both an Arduino and a bus-pirate to program a bare ATtiny85 on a breadboard. An unrelated but useful description here
That leaves you with the job of generating a binary file for your target microcontroller.
|
H: Do mobile phones lower their radiation if connected to WIFI
Suppose you have a phone you use for surfing, but the coverage is poor. As far as I know, that means it would have to increase its signal strength to max, quite possibly to a signal strength much stronger han a WIFI access-point.
Now suppose the mobile was connected to a WIFI close to it, the communicaiton with the mobile tower should be eliminated with regards to internet traffic and hence the mobile would no longer need to increase its signal to max.
However, the mobile would still need to be in contact with its tower to take incoming calls and text messages. So my question is if routing a mobile internet traffic through WIFI would make a mobile lessen its signal strength or amount? (A least compared to when surfing.) I imagine this behavior may also be dependent on he mobile phone model, but if anyone happens to know, it would be great.
(The one who gave this a minus one - could you please explain where this question would be better to post to get an answer?)
AI: If you're far from the tower, the phone will turn its GSM/3G TX power up regardless of whether it's on wifi or not.
However, if it's on wifi, then the only GSM/3G transmission that will happen at that high power is the periodic commuication to remind the tower where the phone is. The TX will be turned off almost all the time.
|
H: USB Design Standpoint: On-Chip USB vs. Dedicated Chip
Soon enough, I will be facing a decision on implementing USB into one of our products. At first, I though that programming USB device and host drivers won't be that much of a problem, but it seems I was dead wrong.
A few days ago, I stumbled upon some pretty cool FTDI chips, that provide an interface which I can connect to easily on both ends. And since the additional price ($2) for such little QFN is not an issue, I am seriously considering this option.
They also provide some pretty cool host-side WHQL-signed drivers that we can(?) use. Namely, it is 1. VCP (Virtual Com Port) driver, 2. D2XX driver, providing a DLL based application-USB interface.
My question is, can anybody direct me either way? That is - will I make my life an order of magnitude easier by using an FTDI chip, or will I run into some wall that I'm not seeing right now?
Thanks for sharing any experience.
AI: If your existing microcontroller doesn't have USB support (and good example drivers), and it can't easily be changed to one, and your volume is small enough that it's not worth saving the $2, then the FTDI chips are a very good solution.
|
H: Regarding Passive Probes 1:1 and 10:1
I have a few questions regarding reduction of capacitive loading of oscilloscopes probes and cables in case of 10:1 probes compared to 1:1 probes. I am basing my research on these links:
Wikipedia: Oscilloscope - Basic types of sweep (addresses probes)
Wikipedia: Test probe (addresses passive probes)
Zone.ni.com: Probes
In the first link, it reads -
a one meter direct (1X) coaxial probe will load a circuit with a capacitance of about 110 pF and a resistance of 1 MΩ.
Since the oscilloscope has 1MΩ||\$C_{inp}\$ (range up to 20pF), and coaxial cable will add 90pF/m, this will add capacitive load and reduce the bandwidth of measured signals.
Attenuator probes (10:1) will have 9MΩ||C (tunable) with the same circuit (again, probe capacitance is added in parallel and OSc input [1MΩ|20pF]). This attenuates the signal but increases the probe bandwidth to observe the high speed signals, if
$$Rp \times Cp = R_{osc} \times (C_{osc} + C_{lumped\,cable\,capacitance} ) $$
I didn't understand how the attenuator probe will present more bandwidth because 10:1 probe will also have the same cable capacitance (90pF/m), which is not reduced.
How will this balancing increase the probe bandwidth and reduce loading on measured signal?
I've not been able to simulate and see the actual effect on measured signal spectrum.
I have calculated that the impedances in parallel branches Z1 = R1||C1, Z2 = R2||C2||C3, and Z2/(Z1+Z3) should be 0.1.
I used Micro-CAP10 evaluation copy to simulate it, but I am getting weird results if I plot this quantity (Z2/Z1+Z2). I don't know what results CircuitLab would give.
Below is the equivalent schematic I used in Micro-CAP10.
simulate this circuit – Schematic created using CircuitLab
Edit:
The equivalent circuit is like 10MΩ shunted with ~14pF. So, the equivalent load on measured signal is reduced to 14pF. But it's not clear to me how one arrives to this equivalent circuit. Is there anyway to find the equivalent circuit of a more complex RC?
AI: You need to establish that the ratio of series resistor to scope input resistance is the same for the capacitors. If series resistor is 10x bigger than scope resistance then series cap needs to be one tenth of cable and input capacitance. If using microcap look at the spectrum of Vout and it should be flat.
|
H: Can I2C Master Stretch the clock?
The I2C manual by NXP allows Clock Stretching (holding SCL low) by slave devices in order to have the master wait for them to process data, interrupts and the like. This is all fine and well, although not having a timeout seems questionable.
Now, I wonder whether a master controller can use the same method for example when waiting for the host processor to provide/collect data. For simplicity I only consider a single master setup, although it should not matter.
Edit: For the sake of clarity I am concerned about cases in which during a multi-byte transfer the host processor is not able to provide/collect data to/from the master controller. Issuing a STOP and possibly resetting the slave's state machine (auto-increment counters, 32-bit internal registers, etc.) is not feasible.
AI: Being the master the clock generator, it's in fact reducing the clock frequency by its own, contrary to a slave, that has the clock generated by the master, but wants to signal the master to hold it.
According to Wikipedia:
Although the master may also hold the SCL line low for as long as it desires, the term
"clock stretching" is normally used only when slaves do it.
But
To ensure a minimum bus throughput, SMBus places limits on how far clocks may be
stretched. Hosts and slaves adhering to those limits cannot block access to the bus for > more than a short time, which is not a guarantee made by pure I²C systems.
So, when using clock stretching be sure the devices support it, as for trademark reasons I2C is implemented as other names and has not all features. But that is more a concern for slave devices.
|
H: Need help installing a capacitor
Ok here's the problem. I have a power antenna in my car. The antenna goes up when a voltage is supplied to the voltage sensor in the antenna and goes down when the voltage is removed. I used this fact to install a switch allowing me to listen to CD's without deploying the antenna.
The problem is: Whenever I start the car when the radio is on, the voltage drop is enough so the sensor registers a loss of signal and begins to withdraw the antenna into the car only to redeploy three seconds later when the car is running and the voltage returns to normal. This is hell on the gears and the torque switch. My plan is to install a capacitor in the signal circuit so that the voltage sensor no longer registers a temporary loss of signal when the car is started but will still withdraw the antenna (after a bleed time ) when the car is off or the switch is turned off.
Two questions: Since I need about a 10 second bleed time how big a cap do I need? And I install the cap in parallel across the signal leads, correct?
\$Update\$
Got it done tested, soldered, boxed and installed it works great!!! Thanks to @Davetweed AND @RedGrittybrick for your help and insight.
AI: In order to pick a capacitor for this application, you're going to need to know two things:
How much current does the antenna mechanism draw from the control signal when it is active? Call this I.
How low can the voltage drop on the control signal before the antenna starts to retract? Call this Vmin.
You have already stated that the hold time required is 10 seconds. Call this t.
We'll call the nominal voltage of the battery (when not cranking) Vsupply.
Therefore, the charge required on the capacitor is
$$\Delta Q = I\cdot t$$
The amount of voltage drop we can tolerate is
$$\Delta V = V_{supply} - V_{min}$$
Therefore, the minimum capacitance required is
$$C = \frac{\Delta Q}{\Delta V}$$
You should probably go with 2× this minimum value, in order to allow for variations in Vsupply and I under different operating conditions.
Finally, you're going to want to put a diode between the radio and the capacitor in order to keep the capacitor from discharging back through the radio.
|
H: Wirelessly power multiple LEDs with antenna?
I'm working on a project that requires me to build an antenna and I'm not very experienced with wireless transmission. Here is an overview of my project: Four parking spots for cars with pressure plates that produce roughly 4 or 5 volts when a car is parked in a spot. (this is small scale - think model car size) Since the 4 volts indicate that a car is parked, we want to send that signal to the entrance of the parking lot that lights up an LED indicating the spot is taken. The distance between each spot and the entrance would be roughly 3 feet max. There would be a LED for each spot
We were thinking of using an oscillator to convert the voltage to a signal that can be transmitted through an antenna. Something like this: https://www.sparkfun.com/products/9089
I did more research and found this chip that supposedly converts voltage to frequency and frequency to voltage which would be perfect for this project (again, I'm not experienced with wireless transmission - this could be wishful thinking)
We wanted to use a microchip antenna so we can solder on a PCB. Here's an antenna example: https://www.sparkfun.com/products/144
So would we need a receiving antenna with the same Hz as the transmitting antenna? I'm assuming I could solder the receiving antenna to the frequency input, or is that completely wrong?
I assume we would need a different frequency for each parking spot sensor so the corresponding LED would light up. Does that sound correct?
My main questions if you guys can't answer the few in the paragraph before is this:
What antenna (or antennas if I need multiple ones) would I look for to transmit the converted voltage/frequency
Would I need extra parts to help transmit the frequency and receive it?
Thank you for your patience and your expertise, every bit of knowledge helps and I appreciate any input. Thank you!
AI: The oscillator modules from Sparkfun you are linking to are not meant for RF transmission. You need a transmitter/receiver pair for each parking spot, assuming you are mimicking a system that would have distances of more than 3 feet. A Sparkfun module that you might look at is: RF Link Transmitter - 434MHz WRL-10534. In a simple minded system you could use transmitter/receiver pairs with four different frequencies. If all there spots were close to each other but far from the entrance, you could use one transmitter/receiver pair with different codes for the spots.
In the title of the question you use the phrase "power multiple LEDs". I assume you are not literally powering the LEDs, but signaling them.
For the very short distance in your model, I do not think much of an antenna would be needed.
|
H: How to measure high power LED temperature?
I have a 100W LED module that I believe is overheating due to the heatsink being too small. I use a piece of anodised aluminium from an old fanless PSU. It's only 300g so far too small for 100W led so I added 120mm fan. I still feel it gets far too hot. I have an IR thermometer and it shows temperatures over 120C after a few minutes when measuring the led itself and 40C for the metal part of the led. Thermal grease in between but the led is not firmly fixed to the heatsink.
I am planning on using arduino with a basic temperature sensor to control cooling fan based on temperature and dim the led if it overheats. What is the correct way of measuring the temperature of the led and at what part of the led?
Here's the LED:
AI: Best way of measuring the junction temperature of an LED is by placing a thermocouple at the heat pad (or if the LED doesn't have a heat pad pin, get as close as you can to the anode pin). Secure the thermocouple using some type of thermally conductive epoxy/glue. Light up the LED and wait...
Read this and this for more information.
|
H: Calculate BJT Amplifier amplification
I want to calculate the amplification of the following amplifier.
I used the re model.
I do the calculation this way..
So, in my case:
So according to my calculation the amplification factor is 39.4.
Here's the problem.
When the input signal has amplitude of 0.01v, the output wave swings from 3.54v to 2.01v
Thus an amplification of (3.54 - 2.01)/0.01 = 153 (not even near what I have calculated.)
What am I doing wrong?
Ps:re value is multiplied by 2, because, I think with an Ie of only 0.48mA, the junction is in the knee region, where the resistance is more.
AI: What am I doing wrong?
(1) You're dividing the output peak-to-peak voltage by the input peak voltage. When you say the input has an amplitude of 0.01V, that is the peak value. So, your actual voltage gain is half of what you came up with - 76.5 versus 153
(2) I don't believe the factor of 2 for your calculation of \$r_e\$ is appropriate. If you use the typical
$$r_e = \frac{26mV}{0.48mA} = 54.2 \Omega$$
instead, the calculated gain, ignoring the capacitor impedance, becomes
$$|A_v| \approx \frac{4400}{54.2} = 81.2 $$
which is close to the 76.5 value I believe your actual gain is.
Including the capacitor impedance, the gain is
$$|A_v| = |\frac{4400}{54.2 - j3.18}| = 81.0 $$
so the capacitor impedance is almost insignificant.
|
H: Circuit Wizard NE555 astable circuit weirdness
I am trying to understand the NE555 IC in astable mode, I prototyped a circuit using "Circuit Wizard" student edition as shown in this video http://www.youtube.com/watch?v=SX01x1z7fTY at 05:36 (screenshot below) but strangely my version doesn't go in astable mode but only flashes once.
It seems like pin 7 never discharges the condensator (I tried varying the resistance but it has no effect, what is strange is that my circuit is identical to the one on the video).
Below the youtube version and mine, one flashes the other not. Do I have to set some weird setting in Circuit Wizard or is it some bug in my version?
EDIT: the dots in red, blue, green and purple is where I have put the probes and the logical levels are superimposed below the circuit.
AI: It looks like you have a dead short across R2 — the connection "dots" at either end are a giveaway. Remove the extraneous wire, and it should start working.
|
H: How does a flyback diode work?
In a previous question I posted to the exchange I asked for some instructions on trying to variable speed control a motor. Someone suggested utilizing PWM from my Arduino to open and close a Darlington pair to control speed. I wired it up and ended up frying my darlington pair. I am afraid that I screwed up something with the flyback diode... I am not certain. I am not sure where to trouble shoot what I did wrong. The transistors and flyback diode were very hot to the touch.
What kind of ratings and type of diode should I look for when looking to eliminate flyback voltage from a 18 VDC, 1.5 motor? How would I wire this correctly when using PWM from an Arduino to control a transistor pair?
I am a very new hobbyist and am having trouble wrapping my head around this issue.
AI: Diode was probably inserted backwards around the motor - the purpose of the diode is to bleed a current spike from the motor's inductance, which flows opposite direction.
The diode has a line/bar that indicates the cathode - this side needs to be connected to + side of the motor.
You might need to replace the darlington and diode, unfortunately.
|
H: How to convert 6V AC to 5V DC
I'm looking to convert 6v AC (.5A) to 5v DC for use in charging a phone via USB. idealy a relatively inexpensive pre existing solution would be perfect, but I've been unable to find anything like that online so I'm curious how I might go about building my own. Would this be a PWM circuit? a transformer? what is the easiest and most cost effective solution.
AI: You need two basic blocks, one to convert the AC voltage to DC and another to step down and regulate the resulting DC voltage.
To rectify the AC to a DC you need a full bridge with a smoothing capacitor
image source
In the output of this you'll get about 6v x 1.414 ~ 8.44v - 1.4v = 7v (the 1.4v drop is caused by the bridge diodes), then you only need to connect a regulator to step this down to 5v.
One option is a linear regulator like LM7805 (note that it needs about 7-7.5v in the input so it may be a bad choice). The schematic in this case looks like the following
If the input voltage is not high enough then you should use low dropout regulator like LM1117 that needs just 6.2v input for 5v output.
Both the mentioned models are linear regulator, what this means is that they vary their series resistance in accordance with the load in order to keep a constant output voltage. Because of that working principle they dissipate the excess power as heat, that power is the product of input/output voltage difference and load current.
A more efficient option is a switching regulator that has a different principle and operates as a fast switch that changes the duty cycle in order to keep the output voltage constant.
An example of such a regulator is LM2596. The specific device needs 7v min for 5v output and the circuit looks like
You can use either solution (as long as the input of the regulator is withing specs).
|
H: Voltages in loop not summing up to zero
I have a basic series RC circuit with the following values.
Source: cos(2000pi*t)
Resistor: 1000ohm
Capacitor: 0.01uF
Upon measuring the voltages across each individual component I found that they are not adding up to zero. Is this supposed to be happening or perhaps I'm doing something wrong?
These are the numbers I'm getting with the multimeter.
Source RMS: 702 mV
Resistor RMS: 358 mV
Capacitor RMS: .88mV
For the life of me I can't see why I'm getting ridiculous numbers like this.
AI: This is expected: RMS values will never add up to zero. It is the instantaneous voltage that adds up to zero. Also clear because RMS values are never negative (by definition!).
To put it slightly different: You need to take into account the relative phases of the voltages. Note, that even then, it will add up to zero only if the signals are ideally sinusoidal. That for example implies that noise needs to be negligible.
Hint: you have to measure with an oscilloscope (with a differential probe!)
EDIT: Ok, here is the behavior when you know the phase. It is the in-phase, and quadrature components that add up to zero.
The I and Q compoenents are given by
Urms_inphase = Urms * cos(phi)
and
Urms_quadrature = Urms * sin(phi)
So if you add up Urms_inphase or Urms_quadrature it will equal zero. (Provided you have sinusoidal signals!). It also shows why you have to know the phase phi of each voltage.
|
H: Measure voltage and amperage drawn by an Arduino?
so I'm in a green engineering class in high school, and my friend and I have been tasked with a special project, measuring the amount of power drawn by an arduino so that we can determine the energy efficiency of each person's project (automated model homes).
My plan is to run the DC wall power supply through a circuit that will determine the voltage and amperage drawn by the arduino from the DC wall power supply, and then output the power to the Arduino (where it was going originally. The big problem here is that I don't know the equivalent resistance of the Arduino, because it varies as the Arduino does different things (turns on motors, blinks lights, etc.).
As the output of this ammeter/voltmeter circuit I would like to have two leads that output an analog voltage that correlate to amperage and voltage, which I can then read from Arduino code.
The code is not the problem here (duh, this is an EE site), I just don't know enough about circuits to make an ammeter that has an analog output.
For voltage, I thought about just running the positive of the power supply to an analog pin with a 5MOhm resistor in between. Would this work?
AI: The best way to do this would be like a real multimeter/ammeter measures current. Put a very low value shunt resistor (<1 ohm) in series with the DC power supply (cut the connection and connect it back together through a resistor). The only thing you have to watch out for in this scenario is that the higher your load, the greater the voltage drop across the shunt.
So, using Ohm's law:
V = IR
Assuming a 20 mA load through a 1 ohm shunt:
V = .02A * 1 ohm = .02mV
So, with a 20 mA load, the shunt drops 20mV. As you can see, using a 1 ohm shunt is particularly convenient because the voltage drop equals the current (20mA results in 20mV drop).
The Arduino has a voltage regulator on board, so as long as the voltage at the Arduino stays above about 6 volts everything should be fine. Keep in mind that this method measures ALL of the current used by the Arduino, including inefficiencies of the linear regulators and the current usage of the AVRs. However, for a rough figure of current consumption this is fine. Remember that power consumption will be the current through the shunt times the wall supply voltage (minus the voltage drop across the shunt, but that will probably be negligible). Since your wall supply voltage is known, you only need a lead showing current.
The fact that you're trying to measure this with an Arduino complicates the issue. You need a common ground between the DC power supply and your measuring Arduino. Depending on the Arduino's power source (if you connect both Arduinos to USB), that means you cannot just choose the more negative lead on the shunt to be ground (doing so would cause a short and probably some smoke). This means you need to design a differential amplifier using an Op-Amp.
This is fairly simple, but I highly recommend you simply use a multimeter to measure the voltage drop across the shunt. This will be both easier to implement and more accurate.
|
H: FET electrostatic damage
I have read that electrostatic charges produced by human body can be as high as up to a several thousand volts.
How exactly damage of transistors happens
MOSFET NPN
Electrostatic voltage applied to the drain or source thus causing a reverse biasing of either PN junction with a voltage > breakdown voltage
BJT NPN
Electrostatic voltage applied to emitter or collector thus causing collector-base or emitter-base be in a reverse bias with a voltage > breakdown voltage
Am I correct?
Then, why FETs are subjects to be damaged in particular. I often hear about protection against electrostatics for FETs, but for BJT not so often, and not in mention for diodes, also very rare, although they are also PN junction devices.
AI: At the moment of discharge, there is current flowing from the charged object, through the transistor, and finally to ground or other lower potential.
Ohm's law is in effect here, and the higher the resistance, the higher will be the voltage observed across the two terminals of the "device under destruction".
FET's have a very high resistance on their gate lead. For MOS FET's, that resistance is extremely high. A BJT has a much lower resistance, although, when you are dealing with static discharge, there's no assurance you won't blow that up as well.
As a side effect, BJT circuits usually have relatively small resistors across their terminals to bias the device, and that will limit the IR drop even further.
|
H: Analog-Digital Conversion Clock Prescaling - ATmega328P
I am trying to use the ADC on an ATmega328P clocked at 16 MHz. The datasheet mentions the typical ADC clock frequency range as being from 50 kHz to 200 kHz.
By default, the successive approximation circuitry requires an input clock frequency between 50
kHz and 200 kHz to get maximum resolution. If a lower resolution than 10 bits is needed, the
input clock frequency to the ADC can be higher than 200 kHz to get a higher sample rate.
The ADC module contains a prescaler, which generates an acceptable ADC clock frequency
from any CPU frequency above 100 kHz. The prescaling is set by the ADPS bits in ADCSRA.
The prescaler starts counting from the moment the ADC is switched on by setting the ADEN bit
in ADCSRA. The prescaler keeps running for as long as the ADEN bit is set, and is continuously
reset when ADEN is low.
The prescalers for the ADC clock range from 2 to 128. As I understand it, for remaining 'in the spec' I'd probably require a prescaler of more that 80 i.e. 128.
However, the ADC works for all clock frequencies from CLK/128 up to CLK/4 but not on CLK/2 i.e 8 MHz where it just returns 0x3FF (it is a 10-bit ADC) for all conversions. Is it just because I am running the ADC beyond its recommended maximum or is it something else I need to know about?
ATmega328P Datasheet
AI: It quite clearly says in the data sheet that the ADC clock should not exceed 1MHz. If you break the rules, the behavior is undefined.
It might work, it might not work, it might work only when the moon is full and the temperature is more than 23.7°C or whatever.
Obviously, if your clock is 16MHz, you should not use a lower divider than 16.
|
H: bright LED on IO-Pin without additional transistor (PIC 12F)
I want to drive an 40 mA LED on a single I/O-Port:
I've forgot to draw the LED in the right version but i hope you get the idea. So my actual question:
Since my PIC 12F isn't able to drive currents above 20 mA I may use the right circuit for supplying that current. But by using voltage/current directly from my source it may also be possible to achive the same with fewer parts - at least i think it is...
So what's my error in reasoning? is it possible to use the left circuit without problems?
Thanks in advance.
EDIT:
Additional (maybe dumb) Question - what's wrong about the following:
I could manage to make a second port available...
2nd and Last Edit:
It's possible as mentioned here (german) - since I/O Ports are rare i may try using a FET anyway, thanks for all the answers
AI: There's no error in your logic, you can't safely supply a directly attached LED with more current than the IO pin can safely sink or source.
End of story. Full stop.
Using a FET instead of a BJT would mean one fewer parts (base current limiter not needed).
|
H: Need to close or open a circuit (and keep it that way) with magnet
I need to build a circuit that closes when it detects the passing of a magnetic card.
It should open again when the card passes again.
So I need a simple magnetic reed (like this one). And some kind of switch component that closes when it detects a current pulse from the magnetic reed (right?).
Can someone tell me what kind of component I should use?
AI: You could use reed switch output to toggle a flip-flop such as a 74LV74.
Simply connect the /Q output to the D input and the clock input to the debounce circuit output. /CLR and /PRE must be tied high (along with any other unused inputs from the other half of the chip).
The Q output will go high and low alternately each time the switch opens. It will not start up in any particular state, to do that requires a bit more circuitry and the use of the /CLR or the /PRE input.
Do not substitute a flip-flop that does not have a schmitt trigger clock input or you may get false operation.
|
H: dimensional analysis of the Shannon-Hartley theorem
In the infamous Shannon-Hartley theorem the bandwidth of the channel is measured in Hz (Hertz) but the channel capacity is measured in bps (bits per second). So, either I'm missing something obvious or there's a dimensional mismatch in the equation.. Can somebody please help me understand?
AI: In the equation:
$$C = B \cdot log_2 (1 + \frac{S}{N})$$
The B represents the bandwidth in Hz, and the log2(1 + S/N) represents the "information density" that you can achieve as a result of the signal to noise ratio. This expression has units of "bits/cycle", but this is rarely stated explicitly, since it's technically a dimensionless quantity. It's basically a measure of how many distinct signalling states (e.g., voltage levels) you can reliably distinguish at the receiver, given the noise level in the channel.
So, if bandwidth has units of Hz, or cycles/second, and the rest has units of bits/cycle, you end up with bits/second.
|
H: What is special about camera flash capacitors?
Capacitor manufacturers offer capacitor series that are specifically targeted on camera flash applications. For example, Rubycon has the FW series, and NCC has the PH series. These have working voltages of about 300V to 330V and a typical capacitance of 100μF to 150μF, so at first glance these seem to be standard high-voltage electrolytic capacitors. Nevertheless, they are designated for camera flash applications.
What makes these capacitors particularly suitable in terms of ESR, construction, etc. ?
AI: Camera flash capacitors are constructed to have low resistance, and more importantly, low inductance, so that they can deliver their energy to the flash tube as quickly as possible — which means achieving a fast risetime on the pulse of current. The internal connections are also made more robust in order to avoid localized heating as a result of the high current.
|
H: 68 series CPU vs 80 series CPU
I'm reading a lot of LCD driver data sheets at the moment and they often have multiple interfaces (serial, 8-bit, 16-bit, etc...).
They are also often also split into two sections "80 series CPU" and "68 series CPU" but I can't find any information on what that actually means.
What is the difference and how do I identify which is appropriate for my application (Ateml AVRs).
AI: The Intel 8080 family of processors used a parallel bus that, among other things, had separate strobes for read and write cycles.
The Motorola 6800 family of processors used a parallel bus that had a single R/W line to indicate whether a cycle was read or write, and a separate E (enable) strobe to indicate that a cycle was occurring.
It's trivial to convert between the two schemes (either way) with a few gates, but it was a big deal at the time that LCD controllers could connect to either style of bus without "glue" logic.
On a modern microcontroller, you're pretty much bit-banging the interface with GPIO pins anyway, so it's an arbitrary choice as to which style of bus you prefer to implement.
|
H: MIMO with STBC example - How to derive SNR?
Conosider 2 x 2 MIMO system with the channel matrix H :
$$
H = \begin{bmatrix}
1&1/2\\
0&\sqrt{3}/2
\end{bmatrix},
$$
and transmit signal matrix S :
$$
S = \begin{bmatrix}
s_1&-s_2^*\\
s_2&s_1^*
\end{bmatrix}.
$$
Let the total transmit power be P, and the noise power be \$\sigma^2\$.
How can I derive SNR after STBC demodulation?
I think that this problem is related to the formula
$$
\text{output SNR} = \max_{w_t , w_r} \frac{E[|w_r^H H w_t s|^2]}{E[|w_r^H n|^2]} = \frac{|u^H H v|^2 P}{\sigma^2 |u|^2} = \frac{\lambda P}{\sigma^2}.
$$
But I cannot understand what the formula
$$
\max_{u,v} |u^H H v|^2
$$
means. Because there is no explanation of the matrix u and v..
AI: Maybe, you should check if all squares are correct in your post (in present form it makes no sense to me). The following will be consistently without squares, but you can add them everywhere. I will still be correct.
\$u\$ and \$v\$ are vectors. The expression \$\text{max}_{u}\frac{| u^H H u|}{|u|^2}\$ refers to the maximum value of the expression \$\frac{| u^H H u|}{|u|^2}\$ when arbitrary vectors \$u\$ are inserted. This is also known as the Rayleight quotient (see wikipedia).
Note, that \$\text{max}_{u,v}\frac{| u^H H v|}{|u||v|}\$ (with different vectors) is the same as the above, because the maximum of the inner term will be attained when \$u\$ and \$v\$ are equal (this argument needs, I think, that the channel matrix is physical, i.e. is positive definite).
Luckily, there is a simplification for the Rayleight-Quotient: It equals the largest eigenvalus of the matrix $H$. This is most likely the value \$\lambda\$ what occurs in the last term.
Sidenote: in MIMO often eigenvalues or singular values of the channel matrix occur.
|
H: Building a SMT footprint for a MSOP
I'm putting together a board and it's requiring a footprint for a 16 lead Plastic MSOP.
Usually I try to dig around and find a manufactures recommended footprint and try to stick with that. I figure they're building their parts and should generally know what will work best for a footprint (or Layout).
Anyway I came across a 16 MSOP package from Linear: data sheet (The package and associated footprint I wasn to use is on page 22)
Anyway as I'm sitting there crunching the numbers double checking the width on the part it gives 5.23mm. Now I always try to double check so I subtracted .889mm (twice for both the pads) so I should be left with something close to the 3.2-3.45mm dimension for the distacts between the inside edges of the pads.
Well usually when I do this things check out and I feel confident the footprint is correct. However in this circumstance I didn't end up with that dimension.
Now here's where all my confusion (OCD) kicks in.
I don't believe I can make the footprint work with it's given dimensions.
"5.23 mm MIN" is saying I have to make the outside of the pads be at least 5.23mm long.
"3.23-3.45 mm" is saying the inside spacing between the two rows of pads can very
".889 +/- .127mm" is saying the pads themselves can very that much but probably no more right?
However if I take the smallest inside spacing and add it to the smallest pads spacing I can't get 5.23 mm.
((smallest pad distance) *2 + (smallest inside diameter) = total width for part.
((.889 - .127)*2 + (3.2) ) = 4.724
Not 5.23mm!
(As a side note I also noticed that right above the recommended pad layout they point you to the packaging page for the latest version of their footprints and the footprint there is close. Except they've changed the 5.23mm to 5.1mm. Closer to that 4.724 mm I get when I calculate it but still not exactly there)
So which one of these rules should I break for this given footprint?
AI: So if you make the outside 5.25mm (more than the minimum), make the pads 1.0 mm, which is 0.111 longer than nominal, you get an inside dimension of 3.25, which is within the allowable range.
I don't see the problem.
|
H: Track 3D Position with an Accelerometer
I'm trying to build a piece of hardware with an accelerometer that could track the approximate 3D position of an object. The accelerometer would not be rotating, so a gyroscope shouldn't need to be accounted for. I would like to know if anyone has any suggestions for a specific accelerometer. Does anybody have suggestions for a quality accelerometer?
Also, does the project sound doable? Could an accelerometer accurately detect the position of an object? This would all be on a small scale; specifically the tracking of one's finger. A GPS wouldn't work in this situation, as the movement would only be moved about in around a 2'x2'x2' field.
Thanks.
AI: To get a position from pure accelerometer data, you need to integrate it twice over time. First integral gives you velocity, second gives you position.
The problem you run into is called integration error. This error gets larger and larger over time. And it gets much worse when you're integrating twice.
And what's more, for integration, you need input conditions, that is - you need to know position and velocity of the object at the moment you start the measurement.
So in the end, you may be able to track the direction of movement, you could measure the position during the first second of time or so. But it will be far from accurate, and you will need to assume you're starting from a stand still.
I suggest looking at positional measurement, rather than acceleration. Such as optical, magnetic, sound, etc.
|
H: Connect audio output to recording device
I am working with the 9V sound recording module from Radio Shack. It comes with an electret mic, but I am trying to figure out how to connect headphone output or computer line out output to the mic wires (if possible)
Link to device on Radio Shack's Web site
When in recording mode, the voltage to the mic seems to be about 3.3 volts.
Is there a circuit to make this connection and have sound files 'played' to the sound module from an mp3 player, for example?
AI: Manual here such as it is.
Disconnect microphone wires AFTER noting which wire goes where.
A photo that is detailed enough and sharp enough to allow you to tell is a good idea.
Putting a copy of the photo on disk somewhere with a file name that tells you where it is "is wise"
Emailing a copy to yourself using a persistent online email account (eg gmail and many more) with key words in the message and subject line is overkill and latterly often welcome.
Connect 2 wires to where mic went with a 100 uF electrolytic cap in one wire.
Try connecting phone or line audio source to the above input - start with volume turned down, and turn up progressively while listening to result.
If level is far too high add two resistors to form an attenuator. Value shown below are a start - abut 11:1 attenuation.
Attentuation = R2/(R1+r2) if capacitor impedance is small compared to resistor values.
Making values too low (eg 10 Ohm, 1 Ohm) loads input excessively and capacotor impedance may be too high. .
Making values too high eg 1 megOhm/100k causes impedance matching problems at recorder.
R1 and R2 could be a single eg 10k potentiometer with output at wiper.
simulate this circuit – Schematic created using CircuitLab
|
H: JTAG Bus Length
Could anyone tell me if JTAG requires to have the same bus(wire) length for TDI, TDO, TMS, and TCK?
AI: Although you should pay attention to the datasheet and general signal integrity issues with the signals, no, they don't have to be exactly the same length.
Many programmers allow you to slow down the clock rate if you are having issues anyway - just make sure you read the literature for whatever it is you are designing for.
|
H: DC-DC Step-Down (buck) converter 5V 10A 50watt, not understand how to size the supply
I have a 5V 10A 50WATT DC step-down converter: http://www.powerstream.com/dc-24V-5V.htm
I'm just not understanding how to size the power supply needed to drive this converter at max power.
I have an iGo 15-24V 6.5A 100W Max (130W peak) powersupply. Is that going to be sufficient to drive the step-down converter when it's under max load itself?
Am I understanding correctly, that if I have a 50WATT load, it is always going to need a minimum of 50WATT of power regardless of what voltage is driving it? I understand there will be a loss of efficiency in the step-down, so what's a rule of thumb (10%-100%) for gauging the necessary capacity on the supply.
Or am I missing something fundamental?
AI: Essentially
Power In * Efficiency = Power Out
Since we know Power Out (50W) and Efficiency (~84% in decimal 0.84), we can rearrange this.
Power Out / Efficiency = Power In
50W / .84 = Power In
50W / .84 = 59.53W
So if Efficiency and Power Out are fixed, you only need 59.53 Watts in. In a perfect circuit. At 18v minimum, that is 3.33 Amps, and all three (Power, Voltage, Current) are well within the provided iGo's supply specs. Hope you have a 18v~24v tip for the iGo, unless you have one with a voltage selection switch.
|
H: Difficulty solving op amp problem
simulate this circuit – Schematic created using CircuitLab
I am attempting to solve the above circuit for V0. Current and Voltage variables are from me. Thus far I've used KCL to say that $$i_3 = i_2 + i_1$$ and by ideal op amp function, $$ V_1 = 1V $$ $$V_3 = 2V $$
From there I say that $$ \frac{-1}{10k} + i_2 = \frac{2-V_0}{40k} $$
But that doesn't really get me any closer to finding V0, what am I missing?
AI: Try solving for V2 first, since it does not depend on the right-hand amplifier.
Once you have that, you can easily solve for Vo.
|
H: Op amp circuit for logrithm calculation?
How does one design an op amp circuit which calculates the logarithm of the incoming voltage? I.E. if \$V_{in}\$ is the voltage at the input of the circuit and \$V_{out}\$ is the voltage at the output of the circuit, then the relationship between the two should be
$$
V_{out}=\log_{10}\left(\frac{V_{in}}{V_{ref}}\right),
$$
where \$V_{ref}\$ is some reference voltage such as 1 V.
AI: For a BJT, \$V_{BE} \approx\$ \$V_T \cdot ln(\$ \$ I_c \over I_S\$), where \$V_T = \$\$k \cdot T\over q\$, and \$I_S \$ is a transistor characteristic (saturation current).
So, it's a matter of scaling to get what you're asking for.
Recall that \$log_{10}(x)\$ = \$ ln(x)\over ln(10) \$.
The devil is in the details, however, and both \$I_S\$ and \$ V_T\$ are temperature dependent, so compensation is required, perhaps with a temperature-dependent resistance.
See this answer.
|
H: How do I find a short in an unpopulated 4-layer PCB?
I have a 4-layer PCB, designed in Eagle CAD 6.5. The stack-up is:
Signal
GND (ground)
DVDD (digital power)
Signal
GND and DVDD are solid planes, with vias connecting them to layers 1 and 4.
I have 4 PCBs. Three PCBs are bare - unpopulated, fresh from the fabricator.
In the bare boards (and the assembled one) there is a short between GND and DVDD. It could be a manufacturing defect, but since all 4 boards are bad, it's more likely it is a design problem.
I've manually examined the gerbers in gerbv to see if there are vias that connect to both GND and DVDD, but did not see any. But there are a lot of vias, so I could have missed one.
I've done an Electrical Rule Check (ERC) and Design Rule Check (DRC) - to look for problems. I get no unapproved errors. I've examined all the approved errors to look for problems - there are no overlaps.
How do I find the source of the short circuit?
AI: Do you have any unplated holes or slots in the PCB's? I've previously specified some unplated holes on a similar layer stack, and found that the supposedly unplated holes were in fact plated and the plating was creating a short between the power and ground planes. A round file and a few minutes work quickly sorted the problem out.
|
H: Understanding solution to op amp in first order circuit
http://www.scribd.com/doc/33828848/Fundamentals-of-Electric-Circuits-Alexander-Sadiku-Chapter-07-Solution-Manual
Problem 67:
I'm working on a homework assignment and have solved all of the problems successfully except this one, so I checked the above link to see if i couldn't work out my error, but I'm missing it.
When I solved, I saw that it was a follower, so set my V(t) to be 5, and v->INF to be 0, since the cap should be drained by the time the sun explodes. Safe bet. Then I said that the Req for the capacitor at t>0 was 20 kohms, so the time constant is $$20 * 10^3 * 1 * 10^{-6} = 20/1000 = 20 mS$$
Given $$v(t) = V(inf) + [V(0) - V(inf)]e^{t/T}$$
I get $$v(t) = 5e^{-50t}$$
The solution is using Kirchoff's Current Law to find ... something? it also multiplies by the unit step function for reasons I fail to comprehend...
What am I missing?
AI: it also multiplies by the unit step function for reasons I fail to
comprehend...
The problem asks that you give the solution for \$t \gt 0\$ but that still doesn't quite explain the presence of \$u(t)\$ in the solution. I think you would be fine if you don't have the \$u(t)\$ term as long as you indicate the solution is for \$t \gt 0\$.
The solution is using Kirchoff's Current Law to find ... something?
To find the voltage at node 1, the common connection of the three resistors. Knowing \$v_1\$ allows you to find the current through the capacitor via the series resistor thus
$$i_C = \frac{v_1 - v_O}{R}$$
You now have the voltage across and the current through the capacitor so, using the capacitor equation
$$C \frac{dv_O}{dt} = i_C = \frac{v_1 - v_0}{R}$$
you can write the differential equation to solve for \$v_O(t)\$
Now, you can go directly to the solution for a 1st order RC circuit if you know the time constant and, for that, you must find the equivalent resistance of the circuit connected to the capacitor.
The twist here is that you have a dependent source to deal with - the output of the opamp - so you must be careful in setting up the calculation for the equivalent resistance.
It's straightforward to show that the equivalent resistance is \$3R\$
|
H: LEDs flash briefly, but don't stay on
I've soldered a DC power pigtail to a string of 5V LED lights. When I connect the pigtail to the appropriate power source all of the lights flash very brightly and briefly just as the male end goes into the female, but then turn off once the male end has gone the slightest bit further into the female.
I've tried holding the male at the very tip of the female opening, but even then the LEDs only flash. I can't find the sweet spot where the LEDs stay on. Probably for the best, as I suspect I'm doing something wrong and that's causing the LEDs to behave this way. I can't figure out what, though, because I successfully turned on a Raspberry Pi using the same pigtail and power adapter, and didn't experience any of the problems that I have with these LEDs.
The pigtail I'm using strangely has the red and black swapped - that is, the red wire is negative and the black is positive.
These are the lights I'm using:
http://www.amazon.com/gp/product/B00B4UKG2W/ref=oh_details_o09_s00_i00?ie=UTF8&psc=1
They're individually addressable RGB, and the DI wire is not connected. I'm just connecting without the DI. Surely the DI doesn't need to be connected? There are five wires to connect: Two positive, two negative, and the fifth the DI. Presumably this is so one can connect without using the DI at all.
I'm very much a beginner at circuitry, but I really want to get this project working. I'm excitedly learning. I've searched, but haven't been able to find anyone else experiencing this problem, much less a solution.
AI: The controller chip datasheet isn't entirely clear, except for the mention of "Built-in electric reset circuit and power lost reset circuit", but it looks like it's designed to turn off the LEDs after power-up until it receives valid data.
You need to hook this kind of string up to a controller that sends serial data on the DI line to turn on each LED — actually, three color levels for each LED.
The behavior you're seeing with no DI connection is perfectly normal.
If you want a string of lights that just comes on when power is applied, then you need to get one that doesn't have the "individually addressable" feature.
|
H: Minimum input voltage for this Transistor circuit
I have a circuit below, which I am using in a Coil Gun to amplify a pulse which is generated when a projectile passes close to a coil. I was able to get it to work, however I had the question of what is the maximum voltage that I can pass as an input to this circuit(at the microphone pin)?
My guess is that it would be just maximum ratings of the transistor from the datasheet, but is there anything else that might effect that value?
AI: It's pretty clear that the circuit is designed for a supply voltage of around 9V (the quiescent voltage at the output is about 4V), which means that the quiescent current through the first stage is about 375 µA.
Also, the common-base configuration of the first stage is intended to work with low-impedance sources (such as when a speaker is used as a microphone), so the input signal level is best described in terms of current, rather than voltage.
It should be obvious that if the input signal exceeds ±375 µA, the input stage will begin to distort the waveform, since the first stage will be forced into cutoff. The actual voltage swing that this represents depends on the actual impedance of the signal source. For example, if the source impedance really is 8Ω, then the maximum voltage swing would be about ±3 mV.
|
H: Can I use constant current LED driver as input to Buck regulator?
I have an 100W constant current LED driver that I bought in error but maybe I can use it in another way. I want to use 3 buck regulators to pwm control each individual color of 90W RGB LED. Can I input constant current supply to a buck regulator (will use 30W max per channel)?
Constant current driver is rated as 8~12V while buck regulator is rated at 9-48V, will this cause any issues especially when PWM is used?
AI: You can't force a constant current into a buck regulator. Think about it. Where would the extra power not used by the final load go?
So this question is really about what the constant current supply will do under low load, and if that is something the buck regulator can handle. What does the constant current supply do when open? If it goes to its maximum output voltage, and the voltage is less than the 48 V the buck regulator can handle, then all should be fine. If it shuts down or occasionally retries with pulses, then it won't work.
As often, the solution is to read the datasheets.
|
H: What PWM frequency to use on SMPS
Just to give a little back ground on the project - I am currently building a buck converter linked up to 2 * 250W solar panels in parallel, then use an MPPT algorithum to track the max power. I will be using a TI Stellaris microcontroller to control the PWM, and will be using a synchronous buck topology with possibly a multiphase design to reduce the current through each mosfet (as well as lower output ripple).
The question relates to which is the best frequency to use for a buck converter?
How to determine the best frequency?
I have experimented with 15-24kHz on a synchronous buck circuit already, and am aware most smps designs use 50kHz and upwards.
My aim is to make the system as efficient as possible, and I seem to remember reading somewhere that lower PWM frequencies are more efficient, but cannot seem to find any literature on this after extensive searches online.
Any input would be appreciated, and if there is source information you can point me to even better.
AI: There are many sources of loss in a SMPS. Here are just two:
switching losses
Each time the "switch" (usually a MOSFET) changes from on to off, it spends some time in a state between. During this time, there is simultaneously significant current in the device, and significant voltage across it. As \$P=IE\$, this means the MOSFET is wasting input electrical energy to warm itself.
To minimize these losses, you want to switch as little as possible. The lower the frequency, the less often you switch, and the lower the switching losses.
resistive losses in the inductor
A real inductor has resistance, and will experience losses according to Joule's law: \$P=I^2 R\$. The current in this inductor is not constant: it grows when it is storing input energy, and it decreases as it is releasing that stored energy to the output.
Clearly, the point of the SMPS is to deliver current to the load, so we can not eliminate this current. However, we do have a choice of the shape of that current. The output filter (often as simple as a capacitor) means we can have high current ripple in the inductor and still get a steady output voltage. However, if there is high current ripple, there must necessarily be times where the inductor current is much more than the current required by the load. Since losses are proportional to the square of current, this means our losses are higher when there is current ripple, compared to the case when there is no current ripple.
To minimize these losses, you want the switching frequency as high as possible, as this will minimize the current ripple.
conclusion:
If the "best" frequency is one that has minimal losses, then the best switching frequency is the optimal balance between multiple kinds of loss. These are not the only kinds of loss. To determine the best frequency, you will have to perform a careful analysis of all the potential losses in your specific SMPS, determine how those losses change as frequency, then solve that system of equations for a minimum loss.
|
H: Current in the legs of a MOSFET
I'm currently doing an assignment and I've been asked to find the maximum power dissipation in a MOSFET. I've been told that this is equal to the the current through the MOSFET times the voltage across it
\$P=I_D(V_D-V_S)\$
simulate this circuit – Schematic created using CircuitLab
Where \$V_D\$ is 26V and \$V_S\$ is variable from 0 to 15V. My only problem is i'm not sure what the relation is for the current? I've so far assumed the current through the drain is equal to the current through the source.
The lowest value of \$R_L\$ is 22.7 ohms and the highest is 10,000 ohms. My initial calculation gave me roughly 15W using the lowest value for \$R_L\$. Is this anywhere close or is there a relationship i'm missing?
AI: First of all, the comment in the schematic is incorrect. If the input voltage varies from 0 to 5V, the output will vary 0 to 20V, since the circuit overall has a gain of 4 (not 3).
But to answer the question, the maximum power dissipated in the MOSFET will occur at the point where the MOSFET and the load have equal voltage (half the supply voltage) across them. (To derive this formally, write the equation that gives MOSFET power as a function of output voltage, then solve for the point where the derivative is zero.) With a supply of 26V, this would mean that each device has 13V across it. Since this makes the current through the 22.7Ω resistor 0.573A, the power dissipated in each device is 13V × 0.573A = 7.44W.
|
H: Why AC points on PCB are separated by a hole
I want to find out why, in professional PCB's, they separate between the AC (220 VAC) points on the PCB with a hole in the PCB:
Is it for more isolation between the AC lines?
Is leaving a distance between the two AC input points on the PCB not sufficient?
I'm making a board that needs to stay connected to AC permanently, and I'm using a Varistor for more protection from AC spikes, is this hole urgently required for me to make?
Here are images for the hole I mean:
AI: Yes, it's for a sort of clearance.
Depending on the voltage and the environment (eg. dust, humidity) for safety (and safety agency approvals) you may need clearance across surfaces that is in the 8mm or even greater range. That's inconvenient in a 2-dimensional design like a PCB (on a barrier strip or switch, you can have a 3D barrier between terminals that increases the clearance across the surface).
The name for the linear clearance distance on the surface is "creepage" distance.
|
H: Arduino all input pins same value
Here's the situation:
I have an Arduino mega 2560 and I'm trying to analogRead from 2 different pins.
code:
void setup()
{
pinMode(A0, INPUT);
pinMode(A15, INPUT);
Serial.begin(9600);
}
void loop()
{
Serial.print("0:");
Serial.print(analogRead(A0));
Serial.print(" 15:");
Serial.println(analogRead(A15));
}
The voltage I'm trying to measure is arduino 3.3V supply connected directly to the ADC input pin and the result I get varies depending on the connection of the inputs:
Both inputs floating:
A0: 376, A15: 376
A0 connected, A15 floating:
A0: 771, A15: 655
A0 floating, A15 connected:
A0: 409, A15: 696
A0 connected, A15 connected:
A0: 782, A15: 780
What is the cause of this fluctuation?
AI: As user alexan_e said in the comments, you've got these problems because your analog input pins are floating.
Never leave any input pin floating if possible. With digital I/O this could lead to increased power consumption. This problem does not show up with analog I/O, nevertheless you will run into other troubles like the one you described. Have a glance of this question to see other reasons to avoid letting input pins floating.
What I suggest you is to all your inputs, especially the ones you care about, have a path to a known voltage through some resistance—often, a pull-down resistor is the answer, but that typically depends of what you're trying to achieve. How big is this resistor depends of the impedance of the driving circuit and noise, but usually something between 10K and 1M ohms; lower values are good for noise, higher values is good for maximizing input impedance and low frequency response for AC-coupled circuits.
|
H: What exactly fries the chip when you invert power supply?
From my own experience, burning microcontrollers is quite easy. Put the 5V at ground, GND at VCC and in an instant your chip is burned.
What exactly goes on internally that causes it to stop functioning entirely? For instance, if I were magically able to open a chip and rearrange all its semiconductor connections and fix it, where exactly would I need to look, and what would I need to do?
If this is chip-specific, please choose any that could answer my question or give me an idea at least.
AI: Most commercial IC circuits are isolated from the substrate material by a reverse-biased P-N junction (including CMOS parts). The substrate is usually tied to the voltage expected to be most negative.
If it isn't, then that junction becomes forward biased and can conduct a great deal of current, melting metal or heating the junction to the point where it no longer acts as a diode. That is typically at a voltage of about 0.6V, but the IC makers play it safe usually by telling you not to go lower than -0.3V.
(referring to the below diagram, but not shown, the substrate would be tied to pin 5)
Most CMOS parts have another twist that if part of the chip has a normal Vdd and another part sees a big negative current it will trigger a big parasitic SCR that is a side effect of the structure, then the device's power supply draws a large current which causes overheating, melting etc. if the current is not externally limited. That is called latch-up.
|
H: Transistor Placement?
When using a 2222 or 3904 NPN-type transistor to switch a simple LED, is it better to place it inline with the negative or positive rail of the load (LED)?
Also, which rail is best when working with darlington transistors or MOSFETs for high powered loads?
AI: N-type devices (NPN BJTs, NMOSFETs) are for low-side (negative supply) switching. P-type devices (PNP BJTs, PMOSFETs) are for high-side (positive supply) switching. That's not to say that they couldn't be used for the other, but there are additional voltage level concerns to take into consideration when doing so.
|
H: 555 timer multivibrator charge and discharge
With this kind of connection I expect 555 to run as a multivibrator.
As far as I understand the discharge of the capacitor should be via R2, while charge of the capacitor via R3 and D1. => discharge slope should not depend on R3.
However,
I've got 3 different discharge slopes, for 3 different values of R3
Moreover, when R3 = 0, it seems as not a multivibrator anymore with constant voltage across the capacitor equals supply voltage.
Could anyone please explain, why discharge slope depend on R3, and why when R3 = 0, capacitor holds constant charge and does not discharge at all.
AI: The discharge slope, or output low time, only depends on R3 when R3 is too low. It's also worth noting that R1 and R3 in your schematic form an equivalent resistance. Is there a reason they are separate? Is R1 fixed and R3 a pot in practice? If not, you can just use one resistor.
From the wikipedia article, "Particularly with bipolar 555s, low values of \$R_1\$ must be avoided so that the output stays saturated near zero volts during discharge, as assumed by the above equation. Otherwise the output low time will be greater than calculated above."
In normal operation, the voltage drop inside the 555 timer's discharge pin is fixed while the capacitor is discharging. The bulk of the voltage drop is across the R1||R3 resistance. Thus, the discharge pin is at nearly 0V and the capacitor discharges at the normal rate. However, when the R1||R3 resistance is too low, there is less voltage drop across these resistors and more internal to the timer. Then, the discharge pin is no longer near 0V and the capacitor takes longer to discharge. When R3 = 0, the same thing is happening, just to an extreme. There is theoretically no voltage drop across R3||R1. Instead all the voltage drop from Vcc to GND is internal to the 555 timer. Thus, the capacitor is simply held at about Vcc.
As the other suggested, it's good to look at the internals of the 555 timer to understand what is really going on. I've had to do the same in the past. These java applets are a good way to play around with circuit and see what is really going on.
http://falstad.com/circuit/e-555int.html - 555 Internals
http://falstad.com/circuit/e-555square.html - Astable Multivibrator
|
H: PIC32 stops getting interrupts
I have a PIC32MX, and I'm using the UART interface to communicate with an external device. When I first start up the PIC, I am properly able to get interrupts on UART1 whenever I receive a byte of data. However, after a short period of time(<1 minute) I will stop getting UART interrupts. Here's the basic sekeleton of code that I'm using to test this:
void DelayUs(unsigned int delay) {
unsigned int int_status;
while (delay--) {
int_status = INTDisableInterrupts();
OpenCoreTimer(SYS_FREQ / 2000000);
INTRestoreInterrupts(int_status);
mCTClearIntFlag();
while (!mCTGetIntFlag());
}
mCTClearIntFlag();
}
extern "C"{
void __ISR(_UART_1_VECTOR, ipl2) IntUart1Handler(void) {
// Is this an RX interrupt?
if (INTGetFlag(INT_U1RX)) {
uint8_t data = (UARTGetData(UART1)).data8bit;
// Clear the RX interrupt Flag
INTClearFlag(INT_U1RX);
}
// We don't care about TX interrupt
if (INTGetFlag(INT_U1TX)) {
INTClearFlag(INT_U1TX);
}
}
}
main(){
UARTConfigure(UART1, UART_ENABLE_PINS_TX_RX_ONLY );
UARTSetFifoMode(UART1, UART_INTERRUPT_ON_TX_NOT_FULL |UART_INTERRUPT_ON_RX_NOT_EMPTY);
UARTSetLineControl(UART1, UART_DATA_SIZE_8_BITS | UART_PARITY_NONE | UART_STOP_BITS_1);
UARTSetDataRate(UART1, GetPeripheralClock(), 16660);
UARTEnable(UART1, UART_ENABLE_FLAGS(UART_PERIPHERAL | UART_RX | UART_TX));
// Configure UART RX Interrupt
INTEnable(INT_SOURCE_UART_RX( UART1 ), INT_ENABLED);
INTSetVectorPriority(INT_VECTOR_UART( UART1 ), INT_PRIORITY_LEVEL_2);
INTSetVectorSubPriority(INT_VECTOR_UART( UART1 ), INT_SUB_PRIORITY_LEVEL_0);
//set up the output and input pins for UART1
TRISBbits.TRISB7 = 0; //RB7 = TX
TRISBbits.TRISB6 = 1; //RB6 = RX
RPB7Rbits.RPB7R = 1; //RPB7 = U1TX
U1RXRbits.U1RXR = 1; //RPB6 = U1RX
// we can turn on interrupts now
INTConfigureSystem(INT_SYSTEM_CONFIG_MULT_VECTOR);
INTEnableInterrupts();
while (1) {
// Do work here...
DelayUs(100); //wait .1mS until next ping
//This is in reality ~200 uS
}
}
I'm testing to see if I'm still getting interrupts by setting a breakpoint in the ISR using MPLABX and an ICD3. I can trigger incoming data into the PIC. When everything is working fine, I can set/remove the breakpoint in the ISR, but after a certain point the ISR does not get triggered anymore.
I think that what could be happening is that I'm getting a TX interrupt when I am delaying my main loop as part of the DelayUs function. Could that happen? Is there anything else that could cause the interrupt to stop firing?
AI: Quick thought. When you are disabling the interrupts in your DelayUs, you may be filling the FIFO on the RX buffer. After that point, the interrupt may not be triggered because the buffer is full. Look into the receive buffer overflow interrupt.
|
H: Internal fmax of FPGA program
When I compile my project in QUARTUS, it provides me with information about "internal fmax"
Info: Clock 'clk' has Internal fmax of 39.37 MHz between source register <...> (period= 25.4 ns)
What does it mean exactly? Won't my program work on a frequency higher than fmax? I've seen a working project that runned on 50 MHz and had internal fmax of only 12.99 MHz. Should I care about it? Can I optimize it?
AI: There is no simple answer to your question.
Basically, the tool is telling you that it has identified the longest path between any two registers in your design as having a total path delay of 25.4 ns, including register propagation delay and setup times. Note that 1/25.4 ns = 39.37 MHz.
There are any number of reasons that the design might actually run faster than this. First of all, this is a worst-case estimate over process, voltage and temperature extremes. Secondly, the path that the tool has identified may in fact be a "multi-cycle path" — one that doesn't need to propagate in a single clock cycle.
Yes, you can optimize your design. The first thing you need to do is read up on applying timing constraints to your design. Doing this will allow the synthesis tool to pick options that are more likely to meet your constraints. This is a broad topic with many subtleties, but one basic thing you can do is tell the toolchain what you need the clock period to be, rather than letting it tell you what it thinks it is. The synthesis tool will do its best to meet your requirement, and if it can't, it will tell you exactly where the problem is.
|
H: Using a FTDI to USB adapter with a raspberry pi and a roomba
I'd like to control a Roomba 560 using its 8-pin mini din SCI port. I've seen other people do this successfully but I'm still unclear on how exactly to go about this. I was planning on using an USB to FTDI adapter, which is officially supported by the pi, and somehow wiring the pins to corresponding values. Would this cable work? And after getting it wired up, how would I control it?
AI: According to the webpage you referenced, the Roomba has a 5v interface. The cable you linked to is a 3.3v cable. They claim that it will work fine, and it appears to 5v tolerant to receive, but there's no guarantee that the Roomba will accept the 3.3v logic signals as valid. It depends on what transistor technology is used by the Roomba input and I'd give it 50/50 chance it would work with that cable (there's also the chance that it's on the edge and it works one day but not the next.)
However, you don't need to take the chance. This cable is a proper 5v FTDI and would cleanly interface between the Pi and the Roomba:
https://www.sparkfun.com/products/9718
Just connect the Tx from the Roomba to the Rx of the Pi and vice-versa for the other Tx/Rx pair. Then make sure they share a ground through the pin as well. The remainder of the article describes how the author hijacked the 18 volt Roomba power supply to regulate it to a 5 volt for use by the Raspberry Pi.
Once you get it connected, start to read this manual:
http://www.irobot.com/images/consumer/hacker/Roomba_SCI_Spec_Manual.pdf
How you interface depends on what programming language you want to use. I recommend Python, and if so, install Pyserial (http://pyserial.sourceforge.net/) on the Rasp Pi. Then you can use import serial and ser = serial.Serial('/dev/ttyUSB1') to open a connection to the robot. (You might need something other than /dev/ttyUSB1) Then you can send individual bytes to the robot using ser.write(chr(numeric_byte_to_send)) where you replace numeric_byte_to_send with whatever integer you want.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.