text
stringlengths
83
79.5k
H: Understanding extra thermocouple voltage between computer and machinery I developed my own circuit board which reads temperature from a thermocouple. This board also plugs into a computer via USB and my software communicates with the firmware on the board. It's fairly simple. This is being used to record temperature readings from coffee roasters (here is an example). Sometimes, a voltage develops between the roaster and computer. What happens is that this voltage can be transmitted through the TC wire to the circuitry and throw off the temperature reading (since TCs work on the principle that the potential changes between the two wires as a function of temperature). I've gotten around this by using ungrounded thermocouples exclusively, which isolate the actual TC wires from the outside world. However, I'd really like to understand why this happens. I'm not an EE genius...I prototyped this board on an Arduino and paid a real EE to build and program the actual circuit. I'm simply confused about what is going on exactly, and how I can be sure to eliminate any stray potentials which can interfere with the temperature readings. AI: It sounds like you're describing a ground loop, also an obnoxious problem in audio applications. Even though your computer and roaster are presumably grounded, "ground" is not perfect. There are all sorts of high impedance paths between various ground points, and all sorts of effects, from mechanical triboelectric to electrochemical to stay fields from other conductors will cause small, subtle variations in the voltage. In short, it's total chaos, so you have to deal with it. In a coffee roaster I assume you have motors which are relatively noisy, and there might be an actual (very small) electrical current flowing out a vent, as all the rubbing and heat is bound to create charged particles.
H: Precise Resistance Measurement Techniques This question is inspired by some basic questions on resistors I've read here lately. What's the most accurate/precise technique for measuring the value of a resistor you can think of? What level of precision can be practically achieved? Can you repeatably measure a resistance to +/- 1 micro-ohm? +/- milli-ohm? Can you somehow distinguish between a resistor of a given value and equivalent series resistors? equivalent parallel resistors? Not to limit answers too much, but I'd be interested in using a microcontroller plus external circuitry to take the measurements. Sorry if this is too vague of a question, I struggled to narrow down the scope. I'm thinking of techniques that incorporate GPIO pins and onboard peripherals like ADC and Analog Comparators. AI: A common accurate method to resistance is the 4-point probe. The issue with a standard resistance measurement, using 2 probes, is that it uses the same contacts to deliver current and measure voltage. This means there is a voltage drop in the probes themselves (as well as contact resistance, but that isn't overcome with a 4-point). To get around this, 4 probes are used: 2 of them deliver current, the other two measure voltage. This is commonly done using expensive bench-type multimeters, but can also be performed with 2 decent multimeters, a current source, and a pocket calculator. Use the current source to drop a voltage across the resistor in question, and measure this current with one meter. Beware that meters have a burden voltage, and often cannot measure low currents accurately (Dave Jones makes the uCurrent to combat this). With the other meter measure voltage drop across the resistor. Calculate resistance with your calculator with Ohm's Law: R = V/I. This method will be limited by your current meter's burden voltage. You'll find that it will give resistance measurements slightly lower than if you simply measure with 1 meter alone. The 4-point probe technique is often used to characterize Si wafers, whose resistivity ranges from 10^12 to 10^18 Ωm!
H: How to determine which wire is which on a transformer? Let's say I have a transformer with 3 coils. When primary coil is connected to 230V, two secondaries output 12V. Wires are color coded, but I don't know what colors stand for and there is no information about that on manufacturer's website. Is there any relatively easy way to determine which wire is primary, which is secondary and which is start to the secondary and which is end of the secondary coil? AI: In a step-down transformer, the primary winding will have a higher resistance. The resistance will be low, but there should be a noticable difference unless you've got a really big transformer. If you're trying to identify what a winding is, then here are some notes: If 3 wires have continuity, then you probably have a center-tap winding (+, 0, -) If only 2 wires have continuity, then that is a simple winding. If 4 or more wires have continuity, then you have a multi-tap transformer winding. Transformer windings have a phase relationship, but it's typically not important for power supplies. Unless one of the wires has continuity to the transformer core, the polarity doesn't matter. A relatively safe way to test transformers is to hook up a small AC voltage (1-5VAC) and measure the voltages across the other windings.
H: Implementing my own ESC (electronic speed controller)? I have a project that uses an ESC to run a brushless motor (Hobbyist RC plane sized, 24 gram, 1300-1500 KV). I would like to experiment with eliminating the ESC and driving the motor with my own circuitry and control software. Are there any good tutorials or other starting points? (I realize it's more practical to just keep using my $8 ESC, but I'm interested in this as a learning exercise.) AI: Here is an introduction to electronic speed control systems: http://www.stefanv.com/electronics/escprimer.html Actual design depends on the type of motor you want to drive. A 300A high-torque gear motor is much different from those tiny featherweight propeller motors. At the heavy-duty end of the scale (300A) is something like this: Open Source Motor Control. All designs are online and there are a few articles explaining what the heck is going on. At the other end of the scale are small prop motors, like those in the MikroKopter.
H: How to release ice cubes out of a box? For a University project I have to build a small box containing ice cubes. The box is a shoe box, isolated with newspaper and aluminium foil, cooled by thermal packs. In this box I want to store ice cubes for about one to three hours. Now comes the tricky part: The ice cubes should drop out of the box, one after another, about every minute. I was thinking of a motor with an oval disk which opens a flap gate. The second idea was a small conveyor band which transports the cubes out. Are there better solutions than that? What minimum motor power do I need for this? How do I control the motor? It's a low-budget project, so the cheapest solution is the best. AI: These are hard questions to answer, not because the information you need is hard to come by, but because answering them in a straightforward way will keep you from learning how to do it yourself, which is presumably why you're going to college in the first place. On the other hand, it reasonable to say, "Look, I don't know how to do this, and there is no point in trying to reinvent motor control from first principles." So how about this for an answer that will get you started. You're trying to do a task where the motor will need to spin a little bit, then stop and wait, then repeat. Also, overall, this is a pretty low power task-- you're not trying to move a car or train. For this kind of low-power, intermittent duty task, I'd probably start with a small stepper motor, like you find in old disk drives or printers. You could also use a small DC motor, like you find in most motorized toys, but you'll probably need some clever ratcheting mechanism to make the intermittent motion you're after. In general, motor power is proportional to volume; you want a motor that is bigger than a grape and smaller than an apple. The next step is to google "stepper motor" and "dc motor controller." I'm afraid Wikipedia will be incomprehensible at this stage; I'd look for tutorials from robotics clubs or intro electronics sites. You might start with: http://www.doc.ic.ac.uk/~ih/doc/stepper/ http://www.seattlerobotics.org/encoder/200001/simplemotor.htm After that, since you say this is a low-budget project, I'd try to find something with a motor in it that you can reuse-- maybe the mechanism from an inkjet printer (stepper motor) or an RC car (DC motor). You might be able to reuse something without taking it apart-- like maybe you could just have the printer print a page once a minute, and the motion would pull on a string that somehow moved the ice. From there, draw a lot of pictures of what you want to build and try building some crappy prototypes out of cardboard, string, and paper. You'll learn faster by testing and failing than by trying to plan it all out in your head first. Good luck.
H: Where are the tutorial files for ISE WebPack? I've been trying to learn to use the ISE WebPack and the link they give in their documentation( http://bit.ly/fsy8iD page 11) points to http://www.xilinx.com/support/documentation/dt_ise12-3_tutorials.htm On that page I do not see any zip files or any tutorial files at all except for PDF files. Where do you get these files? AI: On my system they are here: C:\Xilinx\12.3\ISE_DS\ISE\ISEexamples The ones you mentioned can be downloaded as zip files from that web page. You want the ISE In-Depth Tutorial and the associated zip files. They are included amongst those that should already be on your system in the ISEExamples directory. I don't think that the hardware for that example is still available. If you get a Digilent Spartan 3 kit a similar alarm clock example can be downloaded from the Digilent web site. The best place to get questions about Xilinx software answered are the Xilinx forums.
H: Why do frequency synthesizers often use N/N+1 prescalers? Frequency synthesizers, like Analog's ADF411x often have prescalers in their PLL which divide by 16/17, 32/33 or 64/65? What's the 2^N+1 value used for? AI: A dual-modulus (fractional N) pre-scaler gives the PLL increased resolution, without compromising things like lock time and noise. See this app note.
H: Source for a ssop to dip adapter? I need a prototyping adapter for a ssop 24-pin package. Google turns up plenty of dip adapters for 5-7mm chips, but the chip I have is 3.9mm across the body and 6mm to the tips of the pins. Anyone know of source of a suitable adapter? Doesn't necessarily have to be a dip, just something solderable by humans. AI: Standard SSOP land pads should fit this device. 8.8mm from the extreme ends of the pads, width-wise, leaves 1.1mm on each side within which to solder, according to your 6mm measurement. The breakout board on Sparkfun's site looks like it has 1.5mm pads, but they just barely start at 6mm apart. These ones from Aries may be a better bet: http://www.arieselec.com/Web_Data_Sheets/18036/18036.htm http://www.arieselec.com/results.php?searchtype=3&partno=24-351000-10 http://www.arieselec.com/results.php?searchtype=3&partno=24-351000-11 http://www.arieselec.com/results.php?searchtype=3&partno=24-651000-10 http://www.arieselec.com/results.php?searchtype=3&partno=28-555000-00
H: MAX485 half duplex Atmega communication problem I want two atmega32s to communicate over a range of 1000ft, so I decided to use a serial wire for it. I know rs232 is not a good way to communicate over this large range, so I decided to use RS485 which is a balanced pair. For this I want to use MAX485 chips like these. Now I wrote all the code to use it and got it working for short wire communication with a battery powering my ATmegas (and the MAX485 chips) (I cannot produce the code here as it is for a company where I am just an intern, but as it works in short wire the code is not the problem). What the program basically does is, one atmega sends "Paresh" on serial, the other atmega receives it, does a strcmp if it is indeed recieved as "Paresh" it sends out "Mathur". If the first atmega receives "Mathur" it again sends paresh and the cycle continues. All this works just fine for serial mode, short wire and on a 6V battery. But as soon as I switch to a CAT-5 cable I get packet loss. I printed what ever one receives on an LCD and after a few cycles (and sometimes even for the first transfer) there is strange strings received. The problems are: It works for short wire but not a 30ft CAT-5 cable It works for 6V battery but not for 12 volt battery or a 12V adapter. It works for normal serial wire upto 10ft but not more than that. The things I have tried are: Added capacitors to fade out any ripples in the supply. (470uf caps). Increased delays between switching from transmit to receive modes ( _delay_ms(3); ). added caps to the supply to the modules. Adding 120ohm terminal resistance to both modules. What should I do? Please do no suggest any alternatives to the the thing, it would hurt the hacker in me. Why cannot I use an RS485 communication for exactly the purpose it was designed .i.e long distance communication over serial. Update 1: I used 120ohm terminal resistance. Update 2: I am on a 9600 baudrate. AI: In my [in]experience, 99% of serial communication errors are due to timing mismatches; the other* 99% is due to wiring hoopla. It works for short wire but not a 30ft CAT-5 cable It works for normal serial wire upto 10ft but not more than that. CAT-5 cable is twisted pair (also, all of what I have used is also shielded, but apparently this is not common); I assume the "normal serial wire" is two loose wires. As wiring gets longer, your nice digital rise times stretch out, effectively shrinking the available window for sampling incoming data. Twisted pair helps this a bit. What this really means is that your UART clock must be prescaled more accurately to the baud rate being used. System clocks for perfect USART communications should be multiples of 1.8432MHz. Short-range communications can tolerate a few percentage error, but as your sampling window shrinks it must be more accurate. What your prescaler (int), and baud error? prescaler = (int)(F_CPU / (USART_baudrate * 16) - 1) actual_baudrate = F_CPU / (prescaler * 16) baud_error = 100% * (1 - actual_baudrate / USART_baudrate) It works for 6V battery but not for 12 volt battery or a 12V adapter. This sounds fishy! This may be a completely different problem, perhaps causing your widget to reset due to a dirty supply or poor regulation. There are stability issues with LDO linear regulators and varying capacitive loads; there may be dissipation issues from a 12V supply; if one isn't using a LDO regulator, then a 6V battery will really be giving you 4.5V to 5V, and won't be well regulated. Power supply issues are in a class all their own, and must be rectified before peripherals can be effectively debugged. Other than this, there is always the issue with environmental interference, or EMI. RS-485 is made for this, but should be used with twisted pair[, shielded wire,] like the CAT-5 cable you've used. **(What, my math is wrong? Do you know who I am!? ;)*
H: Do I need an accurate clock for an accelerometer? I am working on a project where I want to get very accurate data from an accelerometer. I plan on sending my data over bluetooth to be interpreted by a computer. I am assuming that bluetooth will have some unknown delays that come from things such as how Windows handles the data. So, since the accelerometer data is time depended, would I be benefited by using a clock that can easily create time in some even divisor of seconds? Or possibly add a RTC? I would then be able to "time-stamp" my data before sending it over bluetooth. Is this worth it or am I just over thinking how accurate I can actually get my data to be? Clarification: I will be pulling in data based off of a timer interrupt. I am wondering if my timer needs to be something like 0.5ms. I would go ahead and "time-stamp" the messages I am sending so I know if I loose a message for some reason. Also, I am using a digital accelerometer, so I am not doing an ADC, instead I am getting the measurements over I2C. AI: It sounds like your measurements are already on an even interval controlled by your device, so you could simply add a serial number to each measurement or block of measurements to ensure that you don't lose one. This could be as simple as a single byte, which would have lower overhead than a full time stamp. While a dedicated RTC could provide very accurate time stamps, it would not necessarily make the timing of your measurements any more accurate unless you drive those samples off an interrupt from the RTC. What matters from a filtering standpoint is how low the jitter is on the sampling of the signal, not on receiving the data.
H: Is it important to keep components and traces on a PCB aligned to a grid? As in the title. I've just noticed in one of my PCB designs the components are not aligned to a grid and neither are the traces. It passes DRC, but I'm wondering if it will cause further problems. I'll be using standard PCB houses like PCBcart, SeeedStudio etc. AI: Ultimately, the grid your design actually uses is built into the Gerber file you export from your PCB tool. The files that I generate from Eagle are in inches, with either 3 or 4 digits to the right of the decimal place. That puts me on a 1 mil grid. When you're using parts with different units (Metric vs. Inches), you're bound to have some grid mis-alignment, but it will be very small. If your design uses the minimum spacing rules, it's possible some spacing violations may come up. In short, the only grid that really matters is the one you export your design to. Any other grid is for convenience.
H: I twisted a L200CV in Pentawatt package; what kind of damage can I expect? I was installing a heatsink which didn't quite fit and after installing it, I noticed that I've twisted the L200CV about 5° when looking from above the chip. What kind of damage, if any, can I expect? AI: If you bent the leads after the package was soldered in, the solder joints may have cracked. It is worth touching them up. Ensure you don't dry them out by using flux and a reasonable temperature. The regulator itself will be fine. Leads are meant to be bent.
H: Low pass audio filter design I want my Arduino project to listen to the ambient music and sync its light show output to the beat. It seems that doing BPM detection properly is fiendishly difficult in software, but if your music is sufficiently doofy in nature and you use a little bit of hardware you can cheat and get away with it. So my plan is to hook a mic/opamp breakout board to a simple 1st order passive low-pass filter and sample the input on an interrupt every 5ms or so. Audacity tells me a bass beat is around 15ms long, so every 5ms should be plenty to make sure I don't, er, "miss a beat". If my low-pass'd sample is over a volume threshold, I'll record the time since the last beat, do some kind of weighted average calculation over the past few samples and that will allow me to predict how many ms until the next beat (some other software trickery might be necessary to account for bass drops and breakbeats.) Firstly, do I have roughly the right idea? Secondly, can anyone tell me what order-of-magnitude values I'll need for the resistor and capacitor? I figure I want my cutoff frequency to be something like 500-1000Hz. I also gather the resistance of the rest of my circuit counts but I'm not sure where to measure that resistance across. A little fiddling with this tool gives me answers that look reasonable (500Hz = 330Ω/1uF) but I don't know enough to really know. An example schematic showing where I measure the resistance of the existing circuit and where the low pass filter goes in the context of the rest would be exceedingly helpful. AI: A fair share of the spectral content of most music is below 500-1000 Hz, and with a fairly weak first-order filter falloff of 6 dB/octave, your waveform will be relatively unaffected. A much higher-order filter would be required, preferably at a much lower cutoff (440 Hz is concert A, bass hits should be way below that), with envelope detection (a diode and cap). As you don't care about the actual fidelity of the audio, a passive filter should suffice, though the order required may significantly reduce your amplitude and reduce the effective resolution. Addendum: Just to reiterate other's concerns, the main problem of just filtering audio like this is that if you have some very loud hit (e.g. cymbal crash), it will still go through your LPF (low-pass filter) and give you spikes that you may interpret wrong. Another problem would be inability to cope with much dynamic range (music getting softer/louder); though you may be able to add some variable threshold. As you've correctly stated, this approach will work best with Techno, but that still might not be very good.
H: How should I select my crystal frequency? I have seen questions like this that talk about selecting a crystal for UART and I have seen questions like this that mention 32.768 kHz for RTC. But how do I decide the right crystal for my application. At this point I am not sure what UART baud I will be using, but it will be one of the standard one. It would be nice to be able to get semi-accurate time in milliseconds, but not a requirement. Intuitively I think going with the fastest crystal that my micro can use will give me the most flexibility, but is there something I am missing? Is there a "general-purpose" frequency that people use? AI: Honestly I could spend hours describing the different frequencies and why to use them, but someone already has! http://en.wikipedia.org/wiki/Crystal_oscillator_frequencies This table has a UART column to tell you what UART frequencies it divides to well. It also tells you when a frequency is a standard crystal for a specific comm system.
H: Arduino: is it worth it? I've played with AVRs before with my atmel development kit and have seen recently the use of Arduinos increasing. I have a few questions from users: Is it the same as using a microcontroller? Are there any restrictions with the use of the Arduino instead of using the microcontroller? I am interested in moving to them but also which should i get as there are so many to choose from. AI: The various Arduino boards use AVR micro-controllers. With the appropriate software, using the Arduino is the same as using any other micro-controller. However, the Arduino software doesn't support in-circuit debugging, which is available with other development software like Atmel's AVR Studio. You can use the Arduino hardware with AVR Studio and Atmel hardware tools like the Dragon programmer/debugger. The Arduino software supports downloading to the target via a bootloader. The Arduino web site and forums are very useful if you need help.
H: How do I convert 9 V DC to 5 V? What's a good way to reduce the output from a 9V battery to the 1.8V to 5V required by an ATmega328 controller? The context is a small robotics platform with low power requirements (very slow movement). AI: I would use a 7805 to get 5 volts simple circuit. Here is a image: idea: please make sure that caps are ceramic/polymer caps. The ceramic caps only have low ESR value. specially the right hand one.
H: System Modeling for Control Systems After taking classes in control theory as an undergraduate, I ended up not using them at all after I graduated. I've started to fix that by starting a hobby project in controls. My textbooks are pretty good references for the theory, but my biggest problem is that I have not found a good reference on determining system parameters in models. For example, say I have a temperature sensor located some distance away from a heating element, and on top of that it has some non-trivial amount of thermal mass. How should I model this non-ideality? And even after I've modeled the error function for the element, how do I determine the actual numerical coefficients from bench experiments? Does anyone here have any good textbooks or references to recommend? AI: I've also had this problem...even though I've done controls work for a living. My part of the controls work has been dealing with what the system identification guys give me, so I never developed that skill as well as I wanted. After a while, I've picked up a couple of additional books and relearned how to do it in some cases. The method that I use is by constructing lagrangian equations that describe the system. The lagrangian describes the kinetic and potential energy in a system. I've found that Control system design: An Introduction to state-space methods (cheap) actually has a decent reference for performing system identification. I recommend going through all of the examples and problems in chapter 2. Additionally, the thermal problem you describe can be handled by converting the components of the model to electrical equivalents. This can be found in the book or by doing a bit of googling.
H: Capacitor Sizes for 7805 Regulator It says in the datasheet these values in this picture: But I've also seen it with these values: So what values should i use or doesn't it matter? And its for when its first starting. AI: First Starting? Build it with either; it will work fine for you. The second option with the large capacitors and the extra small one is "more stable." Just build this, do not worry about why if you are just wanting to start your project. Let us know if something does not work. 100nF Use the values that are suggested in the datasheet. If you add capacitors a factor of 10 smaller (called decade capacitors) it will help with higher frequency noise (RF, or radio band noise), as an effects of the impedance of a capacitor. Feel free to add as many decade capacitors as you want, but you will not need them unless you start having FCC testing. They cannot hurt. 100uF When someone increases this they are allowing their circuit to pull power from the power source for longer. If you have a long power line this will act as a small tank of power. If you are going to have long power lines, or very inductive power lines, add this.
H: Board to board connections I am looking for connecters to connect two PCB boards together for prototyping. Can anyone recommend any models in particular. Features I am looking for are decent price available from some where like Farnell or RS Components in Australia 3 wire mainly doesn't need speacilized tools to make the connects standard pin spacing for prototyping board Also up to 10+ connections I have looked my self but there is hundreds of models and it's hard to work out how they make there connects Anyone recommend any models that they use? AI: I use these with standard headers for stacking boards. I buy the longer ones and cut them to size. For wire connections between boards I use these connectors with these terminals and these housings. The crimp tool is quite cheap.
H: How do components fail? How do components fail? General rules with an answer per component type would be valuable. We can work as a community to build up a single question that holds valuable information about how components fail. AI: Switches and pushbuttons: failure to make contact. What you've listed looks like the severity part of an FMEA (Failure Mode and Effect Analysis), at least at component level. While it's not impossible, it's a hell of a job to account for every possible component failure if your design has, say, over a hundred components. One failing component may cause an avalanche of other components failing. Most failures aren't subtle. You'll experience that adding components to cope with other components failing only adds complexity; you'll have to do an FMEA for these components as well! An alternative approach, FMEA-wise, may be to start from occurrences. What's the MTTF (Mean Time To Failure)? Most components are quite robust; tens of thousands of POH (power-on hours) are feasable. (A notable weaker component is the Al elco, but even there are solutions). Anyway, an IC usually doesn't short just like that. So, while component failure may be caused by aging, most failures are caused by external factors, like overvoltage on the grid, or user error like misconnecting. Try to reduce these risks. Power spikes may be handled by overvoltage protection diodes. Misconnection can be avoided by using different connectors so that they can't be switched. Color code wires and use matching colors on connectors. Bottom line: it may be more important to know why components fail than how they do.
H: Microcontroller support for Teletype I want to receive 5-bit serial words using a microcontroller's hardware UART at 45 Baud. This is the basic protocol for teletype machines. Since the baud rate is 45, I really want this done in hardware so that I am not spending all the processor time polling a pin, and for ease of programming. Are there microcontrollers that can do 5-bit serial data in hardware? Is there a reasonable hardware/software implementation that won't tie up the processor? AI: If you have sufficient intercharacter space (~3 extra stop bits), you could use the MCU UART port, as there isn't really a difference between an 8-bit character (0x00 through 0x1F) on a UART and a 5-bit character with 4 stop bits. Barring that, your best bet would be to use a level interrupt (pin change, etc) to detect the leading edge of the start bit, then configure a timer to interrupt you either once per bit or possibly a couple times so you can do some extra verification. 45 baud is really slow, so unless you're using upwards of 95% of the MCU time (or all it's peripherals), this shouldn't cause any problems. The Atmel AVR USART module supports 5-9 bit modes, so any (newer) ATtiny (e.g. ATtiny2313) or ATmega (e.g. ATmega328P) will allow you to do this in hardware, vastly simplifying your software, saving your time. The maximum clock divider you can apply to the UART on an AVR is 216, so if you have a clock of 16 MHz, the lowest rate it can run at is 244 bps with no system clock divider. If you use an ATmega, like on an Arduino, the clock prescale register (CLKPR, §8.12.2 in Atmega48/88/168/328 datasheet) can be used to slow down the system clock up to 256x at run-time, or simply program the CKDIV8 fuse to set the prescale register's default to 8. The real determining factor on what you should use is what else you're doing besides talking with the TTY. If you are going to plug this into a computer, you will want to reserve a (or the, if there's only 1) UART for communicating with the PC and do a software UART if required (as mentioned by everyone, this is near trivial at 45 bps). If you want to press a button and have the TTY do something, using the only UART for that would be fine.
H: Getting started with Altera FPGAs I am getting a Cyclone II-based Altera DE1 FPGA board to experiment with. I know a lot about programming, a bit about electronics and very little about FPGAs. What books or other resources would you recommend to someone like me to get started? AI: This book is based on Altera hardware and development tools. You need the fourth edition for the DE1.
H: Failed multimeter I have a cheap handheld multimeter that has stopped working. It basically behaves as if the leads weren't connected: the Vdc readout stays at zero, and the resistance readout stays at "1." I've checked the battery and have tested the leads with a bench meter. Now, before I chuck the meter in the bin (it's long overdue an upgrade anyway), is there anything else relatively obvious that may be worth checking? AI: A few more things to check: Broken wires in your test leads Broken test lead terminals (where you plug the leads in), they may have bent and broken Fuse (as Robert suggests) "Fuse": some thin traces on the board that may have acted like a fuse for you.
H: MPLAB linking error I am working with Invensense IMU3000 and a PIC18 microcontroller. I am migrating a library, written in MSVS2005, to MPLAB, doing the proper modifications to run on it.. the code itself provides just warnings, but when it comes to linking, I get this: Error - section '.idata_dmpDefault.o' can not fit the section. Section '.idata_dmpDefault.o' length=0x000004b0 What does it mean? AI: All the variables in the program take space, and you're using too much for the chip you're trying to compile it for. The program you're trying to compile needs 0x4B0 bytes (1200 in decimal), and you have something less than this. Figure out how much RAM space your PIC18 has. Make sure it matches what you're compiling against. There's possibly a linker definition file someplace defining the sizes of the various sections. Section IDATA is your current problem. Someone more familiar with MPLAB may be able to fill in details on what your actual constraints are and how to properly configure the compiler for your chip.
H: How do I interface with OBD-II? I've been tasked with interfacing with the on-board diagnostics of a vehicle. Some systems use 7V signalling, some use 5V signalling, some signal up to the battery voltage (which can be as high as 28 V on some bigger vehicles). I need some way to handle these high voltage inputs which may exceed my microcontroller's 5V rating. I was thinking of an optoisolated system but communications need to be bidirectional and fast (100kbits second maximum). As it's OBD-II, I'll need two channels; some vehicles use transmit and receive channels, while others use one channel for both transmit and receive. Are there any options for me to consider? AI: Maybe look at using an off the shelf chip solution such as the ELM327. This looks like it will handle all of the various voltage and protocol issues.
H: Netduino powerd by USB wall charger I have a IPhone wall charger. Can I plug my netduino into it to power it via USB? AI: Yep. I'm guessing you have this little gizmo and a random USB extension cable. Looking at the Netduino schematics you can clearly see that the USB input is fused, kinda buffered (can see current limiting op amp and RC PDN arrangement, if I'm reading it correctly), and regulated. The Apple product is supposed to output 5V; I didn't check to see which LDO the Netduino is using, but it'll likely have a drop ~0.3V, however there's a pass transistor as well which may bring that up a bit (maybe ~0.1V drop) -- looks like it may be on the fence between linear and saturation, though, so don't count on it. Surely the Netduino will be fine with a bit less than 5V.
H: Will these LEDs work for throwies? I'm going to try to build some throwies soon and am ordering some LEDs and other needed things for the task. It is my understanding that a CR2032 battery is 2.6-3.1 volts. Well, I have these LEDs picked out. 660 nm wavelength 1.85-2.5V Forward Voltage, at 20mA current Would this be ok to use without any resistors? I'm ok if LED life is shortened, but I definitely don't want for the LED to just light up and then be burnt out a second later. AI: Here is some interesting info on throwies from evilmadscientist.com [Connecting a 1.7 V LED directly to a CR2032] Wait-- 107 mA?!--‽ Yes, this is reproducible. (That is to say, we wasted used up another battery just because we didn't believe it either.) But holy cow anyway. "And they said this was safe?" There are a couple of legitimate concerns here. Lithium coin cells aren't designed to source nearly that much power-- and aren't lithium batteries a fire hazard? And why does my LED-- rated for 25 mA continuous current survive this? I've certainly seen enough LEDs destroyed by overcurrent, and this one was over 25 mA for ten minutes solid. But, and perhaps against my better judgement, I do believe that this actually is safe in practice. With all of the throwies and similar things out there -- don't forget the keychain flashlights -- they just don't seem to be exploding or catching on fire. (Breaking, falling apart, running out of photons, yes-- but those modes of failure are usually not as dangerous.) [...] So.... Do you need a resistor? No, not really. As we said, it seems to be reasonably safe without one. Should you use a resistor? Yeah you should, if you want a red, yellow, or orange LED to last more than a day or so. So you can solder a resistor in place, but that somewhat defeats the purpose of easy to assemble throwies. So to make it not a total pain-in-the rear to add resistors, here's a way to do it without soldering: just twist it. Source: http://www.evilmadscientist.com/article.php/throw
H: Need help debugging my project: Fuses popping like crazy, but I can't find the reason why I recently made a voltage and current controlled supply from a kit I found. It worked for about 15 minutes and then fuses started popping. Unfortunately, I have no idea why, because power supply worked for some time fine then and there were no changes to (just voltmeter connected all the time to output) it when fuse problems started. At first, I thought that some part overheated and malfunctioned, but everything felt cool. Next idea was that a piece of debris inside the box might have caused a short circuit somewhere. I carefully checked the box and didn't find anything which could have caused short circuit. Next thought was that maybe IC died. I already asked about that here, so I decided to separate circuit board and transformer and check transformer to make sure it was working correctly. So on one side I had PCB and on the other 50 VA transformer connected to a Graetz bridge rectifier. Here's the picture of the transformer part of the circuit. I connected ends of the rectifier to my multimeter and powered on the transformer and got around 25 V, as expected. A minute or two later, fuse died again. To me this looked very strange, because the rectifier wasn't actually connected to anything. Since I run out of required fuses, I decided to connect my multimeter in place of the fuse and see what's going on with current. At first, I connected it to 20 A range and saw that at the time I press the power switch, I get around 0.02 A. In less then a second, that falls to zero. I switched to milliamp scale and got same 20 mA. After power-cycling transformer again, the 200 mA fast multimeter fuse for milliamp scale died. By this time I was left only with a 10 A fuse, so I decided to do some testing with it. Since the original recommended fuses were of 315 mA fast type, I decided to be extra careful. I checked insides of the box again, checked both switches, all wires and as far as I can see, everything is working correctly. I turned the transformer on with 10 A fuse and did some voltage measurements. I get around 27 V when the ends are serially connected and around 13.5 V when I'm using only one end of the transformer. When measuring DC voltage at the rectifier, I get around 25 V for both secondary coils and around 13 V for one secondary coil. I also get around 9 V AC at the rectifier for both secondary coils and around 3.5 V AC for single secondary coil. I also noticed that when power switch is in OFF position, I get around 3 V AC at the rectifier input and around 3 V DC at the rectified output. These only disappear when I pull the power plug. After all this, I concluded that there must be something in the transformer/rectifier part of the circuit that is making fuses blow. Any ideas how to find out exactly what it is? Also, is the behavior of the rectifier normal and should I change the switch to double pole switch which would control both power lines? EDIT 1 I connected the PCB to the rectifier and turned it on with 10 A fuse. I'm running a small 9 V DC radio from the power source and it seems to be working correctly. Could it be that the recommended fuse current is wrong? The transformer's maximum output current is 2.1 A, so if I'm calculating correctly, maximum input current should be 230 mA. I used 315 mA fuses, so the should have survived full load on the transformer. IS there something I'm missing here? EDIT 2 Looks like the fuses could be blowing because of inrush current of the transformer. How would I solve that problem? One of the fuses I used and which blew was a slow acting fuse, so they aren't the solution. AI: A 50VA transformer will take about 0.21 Amps when correctly loaded (VA / Input voltage) So a fuse of about 1.5 x the input is suggested and should be Anti Surge (Usually marked T or TT - T stands for "träge" which is german for Lazy or slow) - so 315mA A/S or 400mA A/S If your fuses are vaporized and cover insides with remains of the wire - This indicates a major short... What type of transformer are you using - is it a toroidal - if so have you got a shorted turn (if you mount a toroidal transformer incorrectly you can add an extra winding which is shorted out - this is creates by mounting the transformer with a conductive clamp which is bolted down in the middle - if you are using a toroidal - try removing the clamp...) It is possible that you have a faulty diode in your bridge - I have seen diodes that measure OK when tested with a meter, but when either loaded, or subjected to a higher voltage, break down and become shorts, or leak - the easiest way to prove is to replace ALL the diodes, as I have found if one is faulty, it usually subjects others in the bridge to stress, which may make them more likely fail, and for the cost of 4 diodes of 1N400X or 1N540X - I usually use 1N4007 or 1N5408...
H: Datasheet for XC34064P wanted Usually Google guides me to http://www.alldatasheet.com/ or a similar site when I'm looking for a datasheet, but no such luck this time. The XC prefix reminds me of Xicor, but after being directed by Google to the Intersil site I couldn't find it there either. Does anyone have a datasheet for the XC34064P? AI: Found it as MC34064 at On Semiconductor.
H: LED Flame Emulation My wife bought these flameless candles. They have 3 LEDs in them that have a seemingly random flicker to them. (Get bright, fade out a bit, fade in a bit etc...). Since there are three when you see it through wax it looks like a flame flickering. Very cool. I though it would be a fun project to get back into electronics. I am a computer engineer but I fell into software - so while I understand concepts and how things work, I have no clue how to start this unless I got a pic chip or whatever people use now. Any suggestions? The simpler(cheaper) the better. I just need some general ideas to get me pointed in the right direction. What kind of circuits should I be looking at or does this need to be done with some kind of controller like a PIC? AI: Using a red/yellow or green/red bi-colour LED, you can also shift the 'flame' position. Flame flickering isn't random in the sense of white noise. You'll get good results if you drive it with a melody. The AVR Butterfly comes with Fur Elise preprogrammed, I believe. A fun way to experiment with this may be to build a classic crystal radio and have it drive an LED (would have to be powered to drive LED); or with a line out audio jack. Two more options are to capture the driver signal going to your consumer LEDs with an oscilloscope, or measure a candle's flicker with a photocell (photodiode). Putting together the little bits of analog buffering required to measure a candle's flicker accurately may be just what you need to get back in the spirit! Here are analog 'flicker' circuits. Many of them appear to be higher power. Parallax put together this How-To: Tricks and Treats with LEDs.
H: What are programmable logic ICs of different complexity used for? Programmable logic can be implemented in your widget in many different spectrums, from burning a few gates or using a MUX to the latest FPGA with built-in microcontroller and IO peripherals, not to mention ARM's PrimeCell GPIO or other, more specific examples. For what applications are the various levels of programmable logic device complexity used? Although the grouping appear to blend together near the extremes of their definitions, I think this is an acceptable list: PAL/PLA/GAL: Programmable Logic Array; appear to be listed as 'Embedded - PLDs' at Digikey, covering asynchronous 10/8 I/O (ATF16V8C) to 50MHz, 192 macrocell, (CY7C341B), and are mostly reprogrammable. CPLD: Complex Programmable Logic Device; Digikey lists them as such, available in 7.5ns 10 I/O (ATF750C) to 233 MHz, 428 I/O "CPLDs at FPGA Densities" (CY39100V484B). FPGA: Field-Programmable Gate Array; available in 58 I/O (XC2064) to 1023 I/O BGA beasts (EP1S80F1508C7N). FPGA with hard MCU: this is when an MCU is physically laid out in the FPGA IC, not emulated. Wikipedia quote: The difference between FPGAs and CPLDs is that FPGAs are internally based on Look-up tables (LUTs) whereas CPLDs form the logic functions with sea-of-gates (e.g. sum of products). CPLDs are meant for simpler designs while FPGAs are meant for more complex designs. In general, CPLDs are a good choice for wide combinational logic applications while FPGAs are more suitable for large state machines (i.e. microprocessors). This doesn't explain the difference between using a 233 MHz, 400 I/O CPLD and a comparable FPGA; or between a 192 macrocell PLD and a comparable CPLD. I can't grep reliable guidelines by which to narrow design options. Note that I don't currently have a specific application in mind, but have often wondered, "what would I use to do that?" I've received excellent advice off-site regarding specific requirements, but still think this question could benefit from some examples showing preference over one family of PLDs when another may have appeared to be equally or more suitable. AI: There's two criteria that you can use to evaluate a digital project that help you decide which part best matches your criteria. The first is design size/complexity - how much logic is involved. The second is the input and output requirements in terms of pin count. Speed can be factored in if you can estimate what your slowest function would be. The vendor tools (Altera Quartus II, Xilinx ISE, etc.) will help you once you get in the right ballpark. PAL/PLA/GAL: These are intended to replace a small to medium size circuits that you might normally implement as LSI logic chips (7400, 4000 series). These can offer better board layouts due to I/O remapping, and lots of simple logic functions. These chips contain non-volatile memory (or one time programmable fuses) and require no power-up configuration time. They may not contain data storage elements. CPLD: These are larger cousins of the PLA. The designs can be small state machines, or even a very simple microprocessor core. Most of the CPLD chips that I have seen do not have any on-chip SRAM, although the large Cypress CPLD you linked does. CPLDs are more likely to be re-programmable with flash memory, and they also do not require configuration time on power-up. FPGA: Unlike the CPLD, the logic blocks are based on SRAM instead of flash memory, resulting in faster logic operations. The major down-side with FPGAs is that since the configuration is stored in SRAM, every time the device is powered up the FPGA must load its programming into this SRAM. Depending on the size of your design and the speed of your non-volatile storage, this can cause a noticeable delay from power-on to fully functioning. Some FPGAs have on-chip flash for storing their data, but most use separate memory chips. FPGAs will often have hard-wired multipliers, PLLs, and other logic functions to improve computing speed. Large blocks of on-chip RAM is also available. You will also be able to use high-performance I/O specifications like LVDS, PCI, and PCI-Express. FPGA with Microprocessor Hard Core: I'm not familiar with these, but I would imagine that your design would center around the microcontroller programming, and the FPGA would augment the microcontroller. The parts you identified make it look like you would start your design with a microcontroller and a FPGA, and then combine the two into one chip/package. How to decide which is right for you: The best way is to have your code (Verilog/VHDL) finished, and then use the vendor's tools to try and fit it into the smallest part possible. I know Altera's tool lets you change programming targets fairly easily, so you could keep picking smaller FPGAs, and then smaller CPLDs until your design usage gets close to about 75%. If you require performance, then try to pick devices that have features (fast multipliers) that decrease the speed requirements of the logic. Again, the vendor tools will help you identify if you need to upgrade or if you can downgrade. Another factor of which part to use is ease-of-use. Using PAL/PLA/GAL logic is probably more effort than constructing the function using discrete logic gates (74HC*, 4000, etc). CPLDs typically require only a single supply voltage, and don't require additional circuitry. They are effectively stand-alone. FPGAs begin to use multiple power supplies for I/O and the logic core, complex I/O standards, separate program memory, multi-layer (>2) PCBs, and BGA packages. Steps to narrowing down your design requirements would include: Identify all inputs and outputs for your FPGA/CPLD. This is usually an easy part of the design stage. This way you know what package you're looking at, and how close you can cut it to that margin. Draw a block diagram of the internal logic. If your blocks look simple (each block would have a hand-full of logic gates and registers), then you probably can use a CPLD. If, however, your blocks have labels such as "Ethernet transciever", "PCI-Express x16 interface", "DDR2 Controller", or "h264 Encode/Decode", then you are almost certainly looking at a FPGA and using HDL. Look and see if your interfaces have special I/O requirements, such as special voltages, LVDS, DDR, or high speed SERDES. It's easier to get a chip that supports it than to get an additional translator chip. Example CPLD Applications: Multi-channel PWM with SPI interface I/O Expander CPU Address Space Decoding Clocks (Time keeping) Display Multiplexors Simple DSP Some simple programs can be converted into a CPLD design Example Hobbyist FPGA Applications: Small System-on-Chip (SoC) designs Video Complex protocol bridges Signal processing Encryption/Decryption Legacy system emulation Logic Analyzer/Pattern Generator For most hobbyist work, you'll be limited to relatively small FPGAs unless you want to solder BGA packages. I would choose between a large CPLD or a cheap FPGA, and the size/speed requirements would dictate which one I needed.
H: Help wanted with vacuum fluorescent display (VFD) In a box with old components I found a 16 character, 19-segment Futaba VFD: I would like to use it for "something" but I haven't the foggiest how to drive such a display. Even the filament is an unknown factor to me. The device dates at least from the early '90s. I guess at that time there were drivers for it, but I don't know if this kind of display is still being designed-in. Information about a driver would be nice, as would some schematic about the whole. (For example: What voltage does the filament require with respect to the driver voltages?) AI: VFDs are functionally equivalent to vacuum tubes. In fact, since some have an Control Grid to let the display be multiplexed, they can actually be used as a triode, and amplify a signal! To use a VFD, you have to have a basic understanding of how vacuum tubes work. Basically, a vacuum tube, has three components: The Filament (Also called the Cathode) The Grid The Plate (Also called the Anode) The filament is heated, which causes it to release electrons, a process called thermionic emission. Since electrons are negatively charged, if there is a nearby piece of metal with a electrical charge more positive then the electrons from the cathode, the electrons will be attracted to it, allowing a current to flow. The grid is positioned between the Anode and Cathode. If the grid is driven more negative than the cathode, it repels the electron cloud, which prevents any current from flowing. Since the grid is not heated, it does not emit any electrons itself. This forms the basis of every vacuum tube. A VFD is basically triode, except the anode is coated with phosphor. Therefore, when the the anode is more positive then the cathode, the free electrons in the cathode's electron cloud flow towards the anode, and in the process strike the phosphor, exciting it. This process is very similar (basically identical) to how CRT televisions work. Now, since your display has control grids (the rectangular mesh sections above the digits), there is another thing required to drive your VFD. Basically, it behaves very similar to a multiplexed display. Every segment in every display is connected in parallel. Therefore, if you leave all the control grids floating, any signal you drive the display with will be present on every character. By driving all the control grids but one more negative than the filament/cathode, only that digit will be active, since the control grids will prevent current from the cathode from reaching any of the other characters. VFDs use directly heated cathodes, so the cathode is easily visible. The three very fine horizontal wires running the entire width of the display are the cathode. I would guess that the filament probably takes about 2-6V at a hundred ma or so. It should NOT glow visibly at all. The anode voltage should probably be about 30-60v, and the grid a few V- (though I think driving the grid positive might also work, if it successfully depletes the available local electrons. I've only played with single digit VFD tubes without grids). Your best bet is to trace out the connections on the back of the unit, and try powering on a bench supply. The yellow traces you see on the rear-view are the internal electrical connections. You should be able to figure out the pinout from them. The pin on each end is almost definitely the filament connections. If you have a few bench power-supplies (three, though I think you could manage with two), you should be able to get at least part of the display to light up without too much trouble. Getting it to display useful numbers is another matter. It still easier then nixie tubes, though. Useful References: https://web.archive.org/web/20171201181958/http://ccgi.cjseymour.plus.com/elec/valves/valves.htm http://simple.wikipedia.org/wiki/Vacuum_tube http://en.wikipedia.org/wiki/Vacuum_tube http://en.wikipedia.org/wiki/Control_grid http://en.wikipedia.org/wiki/Triode http://en.wikipedia.org/wiki/Vacuum_fluorescent_display
H: Where is photodiode in the CD/DVD drives? Where is photodiode in the CD/DVD drives? What is his frequency response & sensetivity usuallY? I am going to try laser data transfer, but finding decent photodiode is my weak point. AI: I assume you're talking about the photodiode that is used to read the disk and not about the one for the IR remote control. This diode is buried below the lense of the laser assembly. Not sure if it will work for your intended purpose because it's a four-quadrant diode, i.e. it has four light-sensitive areas that are used to keep the laser in track.
H: What's the uA741's appeal? OK, so the uA741 is 42 years old now. For its time it may have been a great opamp; the requirements weren't as high as today, and there was far less competition. But I was wondering what's the 741's appeal today. it's slow. GBW 1MHz, slew rate < 0.5 V/us it's not low power, nor low voltage it doesn't have low bias current FET inputs it doesn't have rail-to-rail inputs or outputs it's not low noise many more modern opamps have comparable price Why is the 741 still used today? AI: It's an ideal op amp to learn the basics on due to its non-ideal nature. The first thing we learn is infinite input impedance, infinite gain, as well as a few other silly things. The 741 obeys none of these idealities, forcing students to learn the hard way how to cope. They see bandwidth limitations without using expensive oscillators or function generators; they see early saturation, nowhere near the rails, allowing the use of cheap multimeters. Many textbooks use the 741 as an example due to its ubiquitous availability and simple verification of non-idealities. Today, we can buy op-amps with mV offset and noise, 100s MHz bandwidth, nA leakage, etc.. One of the most time consuming part of a design is looking for parts, especially for the inexperienced. Academics aren't experienced design engineers, and will use the parts they know, as they have better things to do than look for parts (like write that grant application, right? :). This outdated part therefor gets introduced into new designs from copying legacy modular designs, and familiarity from instruction.
H: Ethernet Layout Guidelines I'm working on a DC jack powered Ethernet design and I've downloaded many Ethernet Layout guidelines from many semi vendors with varying recommendations. I've read app notes recommending almost every possible termination resistor position, for example. Placing termination resistors at the PHY, at the Magnetics, the TX at the PHY and the RX at the magnetics, and visa versa. The most popular seem to be at the PHY, and this seems to make the most sense. Ethernet uses balanced differential pairs, which are typically terminated at the extremes to filter any common mode noise injected into the transmission lines, and the RX / TX traces on the board constitute part of the transmission line (these are being run at 100 ohm impedance to match CAT5 cable impedance). The other controversy here is what to do with the ground plane. If this wasn't a DC jack powered app my life would be easier. Many app notes recommend no ground plane under the magnetics (which are built into the RJ45 connector in my case) to avoid coupling into the ground plane. But... that is exactly what I want. Better coupling into the ground plane then into the conformity testing antenna! A ground plane under the jack will help close the metal enclosure around the rest of the connector. I've read at least one example of anecdotal evidence on the net claiming better radiation performance with a solid ground plane in a DC jack application as opposed to a separate isolated Ethernet plane tied in with caps. So... I think I'm going to keep a solid plane under the RJ45 jack. Some papers also recommend no plane under the RX / TX pairs. I can't make my mind up about this. I want to avoid coupling any ground noise into the RX and TX pairs but my experience seems to be any ground plane splitting / opening is usually based on hocus pocus type thinking instead of sound physics. Does anyone here have any experience or suggestions related to Ethernet layout, specifically with regard to the RX / TX termination resistor placement and whether or not to use a ground plane under the RJ45 connector (with magnetics) as well as under the TX / RX pairs? Any suggestions greatly appreciated. AI: Look for application notes for your PHY and magnetics. The manufacturer would know best in regards to what works with their parts. Generally there is no ground/power or routing under the magnetics and try to avoid ground/power under the TX/RX pairs. If you can't route the whole trace without a ground/power plane under it, leave the plane under it. It is worse if you go over a break in the plane. For termination, check with manufacturers of the PHY and magnetics. Like you said, there are a few different schemes, the manufacturer should know best about their device. We follow what I described above at work and don't have any problems with ethernet.
H: Micro Controllers Supporting SATA Are there any micro-controllers which support writing data to large sized SATA disks? AI: SATA works at very high frequencies. If I look at this data connector sheet I basically see a TX/RX connection with differential signals because of the very high speed. 1.5Gbit of data would need to be proccesed, that's 1.5GHz signals. I've a feeling that it is a very high speed for a microcontroller to handle. My best bet for you is to get a SATA to PATA converter and work with the PATA interface instead. It lowers the speed you need to look at bits, because the data is offered in a parallel way. That's still the easier way to work with. I don't know whether you still want to use a microcontroller for that. I think a FPGA might become the better choice in such projects, but that depends on your goal.
H: Why are the pinouts of LPC21xx all over the place? I am working as a winter intern at a robotics company. My job is to assist the lead embedded developer in... whatever he wants my assistance in. About a week back, I was handed a NXP blueboard with LPC2148 on it. Although I loved the more processing power (compared to the ATmega32s I had been working on), I found something very odd about the ARM7 based controller. If you look at the pinout here you would notice that the port pins are just all over the place. In the AVR series everything is arranged cleanly with all the port pins together. Why is it not so in the LPC21xx? I cannot find any logic at all, they are not arranged by pin number or by functionality (like all the JTAG pins together). It seems like the designers just stacked the pins in a random form. Can any body please explain the reason behind this? AI: It will certainly be a consequence of how the chip is laid out internally, combined with the fact that it is fairly rare on microcontroller applications to need blocks of consecutive IO pins to make wide buses etc., so grouping together isn't a high priority and not worth spending additional silicon area on. Of course this logic breaks down somewhat on parts with external bus interfaces, making layout, particularly with QFPs something of a nightmare, but volume users will probably be using BGAs anyway to save space - I've always thought 208QFPs look a bit ridiculous..!
H: What are the functional differences between a digital sampling 'scope and a digital spectrum analyzer? I'm interested in measuring the spectral amplitudes / frequency content of RF frequencies up to 30 GHz. This can be done using a digital sampling oscilloscope (I'll call it a SO) with FFT or a digital spectrum analyzer (SA) [or a fantastic digital storage 'scope, noted below]. As I understand it, a SO samples the signals directly with known sample jitter, then recreates the signal using regression. A SA, on the other hand, first downconverts the high-frequency signal with a mixer, then samples. It would seem that a SA should deliver greater frequency resolution given comparable ADC sampling rates to the sampling oscilloscope. What are the limits of functionality of each type? How is one better than the other at spectral analysis? (They both rely on the FFT, right?) What makes either expensive? Unrelated POIs: 32 GHz Agilent, 120 GS/s Lecroy, 100 GS/s Tek, Gameboy SA. edit: There seems to be some confusion between digital storage 'scopes (DSOs) and digital sampling oscilloscopes (what I called SOs) -- they are not the same, although they both sample digitally. I've also updated the question. AI: Well, you're not going to be making RF measurements up to 30 GHz without spending a bunch of money, so either path is big bucks. Typically, Spectrum analyzers are used to do frequency domain measurements. You'll get a display of power vs frequency on the display. The controls in the SA are setup for relevant things, Center frequency, bandwidth, resolution bandwith, signal powers in dBm/dBc etc. Digital oscilloscopes don't directly have sampling rates to directly sample a 30 Ghz signal, so they'll undersample and assume that the signal repeats. probably a safe assumption, although with no front end filters built into them, you've got dynamic range issues, as well as aliasing concerns that aren't present in a Spectrum Analyzer. You won't directly get spectral plots out of a Digital oscilloscope, you'll need to do an FFT on that. Now, that opens up a can of worms. FFT bin width/windowing function selection, etc. All stuff that can be worked through, but another question to deal with. You won't get eye diagrams out of a spectrum analyzer, it's a useless measurement @ RF. That's a demodulated signal measurement. Ultimately, if you want time domain data, then use an oscilloscope. If you want Spectral information, use a spectrum analyzer.
H: When is it appropriate to use ferrite beads? In a lot of circuits, I've seen ferrite beads on the Vdd lines to microcontrollers. For my high speed dsPIC33F (80 MHz, 40 MIPS) microcontroller, should I have ferrite beads on the Vdd lines or should I not bother? The datasheet doesn't suggest using them. I'd like to limit EMI/RF interference, as the module will be used on a model plane and this type of interference could cause problems for the onboard radios. AI: To filter high frequency noise. Inductors' windings are capacitive at high frequency so they are effectively useless. If you're worried about your circuit affecting other circuits (or being affected by them), I would only filter the I/O and power entry to your module, so that conducted noise doesn't leave your module on the I/O and power lines, which can act like antennas and radiate the noise, or pick up noise from other modules. The other use, inside a module, is for sharing a voltage rail with sensitive analog components, such as an ADC with a micro. In the case of your PIC, it usually doesn't need such a thing.
H: How to implement a "rotary switch" like in audio equipment? for my current project I'm planning to use an input "device" like this in the photo (don't know its real name): It is used in a lot of musical instruments and it is like a potentiometer that can be rotated as many times as you want. I think it isn't read like an analog value. Can someone give me some hints? Thank you very much. AI: It's a rotary encoder. It has two outputs giving pulses in quadrature (see image), as to determine the way it's rotated. In the image you can see that the level of the B channel is low on the rising edge of the A channel if the knob is rotated clockwise, but high if rotated counterclockwise. Differences in models are the number of pulses per rotation, often between 15 and 20, and the number of channels. More than 2 channels are used to obtain the absolute position of the knob. E.g. 10 channels give 1024 unique codes per rotation. Gray coding is used. edit Another parameter is the detent. Detents are click-positions, which require a certain momentum to overcome. Some models have 2 detents per pulse, others don't have detents and rotate rather smoothly, so that it feels like a potmeter without stops. Further reading "Control Shaft Encoders" \$-\$ Circuit Cellar issue 250, May 2011, p.28 ff
H: soldering temperature/tip guides? I've got a Weller soldering station with settable temperature and interchangeable tips. Is there a table or general guidelines for temperatures and tips for different soldering tasks, such as: wire-wire, thick wire-wire, 20 gauge wire to PC board through-hole chip on PC board AI: Some soldering experts may disagree with me but I usually always use 750-800°F (400-425°C). It seems the biggest variable is the tip. For through hole and wire to wire I use a very big tip. I use a smaller tip for SMT. It has always seemed to me, for correct heat transfer, tip size is much more important than temperature. If you find yourself needing to hold the iron against your parts too long (more than a few seconds) I'd use a bigger tip. Wire to wire usually isn't as critical or easy to damage as ICs, usually just don't want to start melting the insulation. Following this method I've never burnt a chip to death. Killed them plenty of other ways though, and I'm definitely not a professional solderer.
H: How to interpret the output of a 3-pin computer fan speed sensor? I have a 3-pin 12 V computer fan and I want to interpret its speed sensor output. At the yellow wire I get something that looks like pulse-with modulation. How would I interpret the output without actually connecting the fan to a computer? AI: Brief background: The tachometer output comes from a Hall-effect sensor mounted on the motor driver PCB on the fan frame. One or more magnets embedded in the fan rotor hub activate the Hall-effect sensor as they pass by. The sensor is amplified, and eventually drives a logic circuit. The fans that I have seen use an open drain/open collector output. One (or more) pulse is generated every time the the fan rotor completes a revolution. The number of pulses counted in one minute is directly proportional to the RPM of the fan. In your fan's case, I think it would be reasonable to guess that there are two pulses generated for each revolution. With the frequency that you have measured, about 1500 RPM sounds right, given that you are running it at 10V (12V nominal) and the typical is 1800-2000 RPM. If you want a more visual approach, you can make a crude strobe tachometer using just a LED and resistor. Connect a LED (brighter is better) and an appropriate current-limiting resistor between power and the tachometer pin. If you mark one of the fan blades with something easy to see, like a sticker, you should be able to shine the LED on the fan blades and see the sticker illuminated in two places. You can use this technique to count the number of times the tachometer output goes low each rotation, and to approximate the duty cycle of the signal.
H: Analog Max Frequency Detector Circuit As a follow up to this question: How to sample audio at Nyquist frequency with MSP430F5438? What type of circuit would I use to generate something that a microcontroller could use to determine the max frequency of an input? I was thinking it would preferably provide a voltage that is lineally related to the frequency. The information provided by the frequency detector could then be used by the microcontroller to know what frequency it needed to be sampled at. Is there any ICs that do this? or any circuit that will do this? AI: I had two fleeting thoughts: One could use a crossover, which is an implementation of several bandpass filters, followed by power measurement in order to obtain a rough power spectral density. The highest frequency pass-band achieving a threshold would indicate maximum significant input frequency. If each crossover channel were input to trigger/comparator interrupt pins, some good debounce code may be able to take care of the rest. The crossover could be as simple as an array of diode detectors with RC filtering. Circuit complexity would be dependent on the bandwidth and resolution of the crossover. I'm sure we've all ooo'd & aaw'd at quality audio crossovers; diode detectors are very simple; RF range adds complications, but can use diode detectors as well. One could mix down the input frequency, followed by a LPF. Using a continous LO frequency, start at some minimum (~kHz) and increasing to a maximum expected frequency (20 kHz for audio), one could setup a trigger based on a threshold DC or low frequency output, or just record and compare over the entire range. I've never looked for a low frequency mixer, but it would be simple to make a crude one (diode bridge; Gilbert cell); RF mixer ICs are available. Both of these methods are inferior to oversampling, but much more fun. There are frequency-to-voltage conversion ICs (DigiKey: PMIC - V/F and F/V Converters, 1MHz max).
H: What type of battery to use? I Am currently looking for battery suggestions for use in one of my projects. My projects current consumption (calculated) is 360mA for the main rotor 2.5A stall Link (my exact part RK370SD-4045) 400mA for the Mbed uC tail motor ? unknown specs, N30 is the only part reference 3x servos Link unknown mA sensor 100mA or less Voltage has to be 7.2V to 12V What I would like to know is what are the pros and cons of each battery? This link gives some great info but i want real world recommendations and things I should look out for and any other pertinent information when selecting my new battery. Currently I have looked for batteries and have come to this conclusion, Lead Acid batteries are not a choice in this project, which leaves me with Li-ion batteries, Li-Po, Nimh, NiCd. The original battery was a 9.6V 650mAh Nimh battery and the helicopter had about 20 mins of flight time with the original equipment. AI: For hobby flight applications, lithium polymer ("Lipo's") generally offers the best performance from a weight-to-power or weight-to-energy ratio. Compared with the theoretical energy density of most cells, Lipo's are quite close as they usually lack the steel casing of most other chemistries. Their downside is a somewhat fussy nature about how they are charged (you must use a Lithium battery charger) and discharged (going below a certain voltage can severely damage the cells, turning them into a potential fire hazard when recharged), and their poor mechanical robustness, due to the aforementioned lack of a steel case. An additional potential negative in using lithium batteries with a NiMH-designed circuit is that their voltage varies dramatically over their discharge curve, from up to 4.4 V when charging down to 3 V when fully discharged. To fall within a 7.2 to 12 V input, a 2 or 3-cell Lipo should work. They are usually charged at 4.3-4.4 V/cell, so a 3-cell's open-circuit voltage may be above 12 V. If the upper limit you cite is absolute, you would be stuck with a 2-cell Lipo, which will drift well below the lower limit. So if you're looking for an upgrade from NiMH, Lipo is the way to go. Respect their hazards and they will provide much entertainment.
H: Can you harvest electrical energy from the air? I found a website recently about harvesting energy from the air, and I am wondering if someone could tell me why the following wouldn't work? Their "generator" is supposed to make electricity from the ionosphere (not UV, X-Ray, etc). Some claim it can knock out your electric bill totally (a bigger version, not this example). From what I understand, this is possible (it was discovered by Nikola Tesla), however this diagram doesn't look like it would work. Any help would be appreciated. An example from the website: You need: (4) 1N34 germanium diodes (2) 100 µF 50 V electrolytic capacitors 0.2 µF 50 V ceramic capacitors Here is the electrical diagram they provide: And they claimed to power a cell phone with it. I am not sure what kind of antenna to use. While this seems like a sham, I just found this website recently and am looking for more info on the physics behind it. Perhaps Teslo's patent explains things better, so here it is: Patent 685958.pdf Found something: Here is a page that explains it. Nikola Tesla free energy: unraveling Greatest Secret AI: To address the original question of "Is Nikola Tesla's free energy discovery...", Tesla never created a "free energy device". One of his noted ideas, however, was a system to intentionally transmit power wirelessly. Power companies don't intentionally radiate energy (as it's a pure loss for them). As an aside, Nikola Tesla was one of the first true electrical engineers, taking arcane, hard-to-understand forces and turning them into marketable solutions. While there is no doubt he was brilliant, this revolutionary engineer would quickly tell you that if you wanted to harvest naturally occurring electrical fields (not those he intentionally radiated) it would take an antenna (or an array of them) on a truly grand scale. Regarding the document you linked: Chapter 4 - Tesla's Radiant Energy Device This chapter discusses a patent by Tesla which discusses using either the photoelectric effect via "ultra-violet light [...] and Roentgen rays [X-rays]" to generate a positive charge by ejecting electrons, or cathodic rays to capture electrons and generate a negative charge. While you might be able to use the photoelectric effect from solar UV on metals, with great care, you are going to derive an extraordinary small current, certainly far less than you would get with a photovoltaic (solar) cell. PV cells use the photoelectric effect, but within a semiconductor. Chapter 5 - The Tesla Coil Tesla coils are essentially antennas that can radiate and receive a great deal of power. In order to actually capture an appreciable amount, much, much more must be broadcast on the particular wavelength that the coil is tuned to. Because they are tuned, they cannot capture broadband noise
H: is the resistance in ten meters of copper wire too high to use in a circuit powered by AA batteries? I have a wireless security system at home, and the wireless node is too far from the receiver. I was thinking that I could splice about 10 extra meters of wire into the existing line to move the node close enough to the receiver. From my university days, I remember the I = V / R equation, meaning that with a fixed voltage (from the two AA batteries), if I increase the resistance, the current that gets through will be smaller - possibly not enough to power the wireless node. How do I determine the resistance of the wire? Is there a standard calculation I can use? I haven't picked up the wire yet, so I can use another type of wire and a small gauge if that would help. AI: 24 AWG wire is 30.2 milliohms per foot. 10 meters is 32.8 feet so 10 meters of 24 AWG wire is 990 milliohms. But you actually have twice that, because the current goes from the battery and back. So 2 ohms for wire resistance. AA batteries have a series resistance of about 0.5 ohms new, and more as they age, so the circuit is probably happy with a little series resistance. If the wireless transmitter draws a peak of 100 mA (a guess) the voltage will dip an extra 0.2 V because of the wiring resistance. I think it would work better with 18 AWG wire, which has about 1/4th the resistance of 24 AWG.
H: Calculate Current out of Function Generator I couldn't find an equation for this on Google/Wikipedia, but does the frequency of a function generator (we'll say that it's a sine wave) impact the current output. Example, if I had a 5 volt source and applied it to a 10 ohm load at 50Hz what would be the current seen by the load? Thanks, AI: Ideally the function generator is a perfect voltage source for any load. A 5V 50Hz sine wave has the form V(t) = 5*sin(2*pi*50Hz*t) [V]. V = IR, giving I(t) = 0.5*sin(2*pi*50Hz*t), or a 0.5A-peak, 50Hz sine wave. It looks like your linked device behaves this way. The source and load will be in phase so long as the impedance is real (no inductors, capacitors, etc.).
H: Beginning arm cortex Ax hardware development Where can one find information on how to put together a minimal linux bootable board based on the cortex A family (like the beagleboard)? Programming information is plentyfull, but hardware knowledge appear more arcane. I'm especially curious about: What external components are needed and why. Why dev boards seems to end up around 200$, even though I could get an omap3517 for 15$? What kind of equipment is needed to create prototypes around a chip such as the omap3517? AI: I've been blogging about the Linux board I've been working on starting here and continuing here. I started thinking I would use a Cortex A8, but eventually settled on the Atmel AT91SAM9G20. To try to answer your other questions: You can see the components I used in my schematic, but I don't know of a more general explanation of why each is necessary. The processor is only about 10-20% of the total cost of parts. Assembly is another $4-40, depending on the quantity built. I suspect the profit margin is 30-50%. Depending on the package, the OMAP3517 BGA package has either a 1 mm or 0.65 mm ball pitch. Generally, below 0.8 mm pitch, you need to X-ray at least some fraction of the finished boards to check for errors. (Just for the record, the OMAP3517 1 mm packages aren't actually available yet.) If you have other, more specific questions, I'd be glad to try to answer them.
H: What's the difference between a "Switching Regulator" and a "UBEC" I want to regulate the voltage from a battery down to 5v to power an Arduino and a Wi-Fi webcam. I’m not too keen on a linear regulator as a lot of power is wasted, so that’s led me to look at switching regulators. I’ve also stumbled on UBECs, which seem to do a similar thing. The two components I am looking at are these: Dimension Engineering Switching 5V Regulator 1A Hobbywing 3amp UBEC What's the main difference between these? Is either one more suitable for my purposes? My load will be under 1A. AI: A UBEC (Ultimate Battery Elimination Circuit) is basically a step-down voltage regulator. I feel that the jargon deserves a bit of explanation and history, so here goes: In hobbyist grade remote control cars/planes/boats/etc. the electronics (receiver, speed controller, servos) need a power source. With engine powered craft, a small 6V battery pack was used to power the electronics. When electric motors became more popular, people wanted to use the large motor battery packs to power the low-power electronics. Typically, the electronic speed controller absorbed this function, and it became known as a Battery Elimination Circuit (BEC). With battery packs usually in the 9V-11V range, the electronics would probably need 5-6V to be happy. Evidently there has been a push to use higher voltage battery packs (10V-25V), probably to take advantage of the brush-less motors. As a result, if the servos draw any appreciable current, a linear regulator would burn a lot of power. Obviously, when your flight/driving time is based on how efficiently you use your battery, a linear regulator is not what you want. Ultimate Battery Elimination Circuits are basically separate regulators (usually switch-mode) that deliver 5V-6V at hopefully high efficiency. Now for the comparison. Your parts basically have two different end-use requirements. The Dimension Engineering product tries to match the form factor of a common linear regulator (7805). It would probably integrate better with any finished PCB you would make, and has a metal shell which hopefully shields EMI. The Hobbywing regulator is a more cost-conscious physical design, with a bit better efficiency spec. Honestly they're pretty much the same thing, so you could probably go with the cheaper one (Hobbywing).
H: Best way of making a trip-wire type device? I'm wanting to make a type of electronic "trip wire". My basic idea is to have like a laser and basically when the laser is interrupted then it sends some signal to a microprocessor. I'm not tied to a laser but it was the first thing that comes to mind. The attributes it needs to have is it needs to be only like a "wire"(as in, it doesn't detect motion anywhere but head on) and it needs to be low power(like run for a few days at least off of 2 AAs). Also, an actual wire is out of the question because it needs to be capable of being "reset" after a certain time out(of say 1 second or so) The range it needs to work with is only 5 or 10 feet though. Also, it's not possible to have two parts to this device like a typical laser-photodiode setup. This needs to be contained all in one (preferably small) package. What is my best bet with this? I was thinking maybe super-sonic sound like this but I think there would probably be a better way. So basically what I have in mind for the device is like when you first set it up, you "calibrate" it for a certain distance. So for instance if there is a wall five feet in front of it, then this device would work if there was anything that came head-on with it in 5 feet. And etc. AI: There are multiple options for such a thing. Ultra sonic sonar PIR sensor, used in security systems Your best bet I think is to use a PIR sensor like this one.
H: Testing a video transmitter for video bandwidth I need to test the bandwidth of a variety of video transmitters to figure out the maximum resolution I can safely output without losing detail. To this end, I came up with a solution using a TV pattern generator to generate a proper PAL or NTSC video signal with colour bars or with just blackness, and a 10 MHz signal generator, to generate a pixel clock. However, the 10 MHz signal generator is too expensive for a student like me - about £300 here. The TV pattern generator is only £75, which I can afford. I need a way to generate an adjustable square wave signal from 5 MHz to about 12 MHz, synchronised with a video signal. The frequency doesn't have to be precise, because I can verify it with an oscilloscope. I just need to see the point at which a typical video TX can handle no more pixels, because I have the opportunity to make a high resolution on screen display - but it doesn't matter if no-one can see the pixels! AI: It's not hard to make a oscillator of a few MHz. In fact, I've done it by accident many times. Use the VCO from a 74HC4046. Supply the chip with power, and setup a pot to feed the VCO input. If the VCO isn't a strong enough square wave, feed the output through a few stages of 74HC14 to square it up. If you really need a phase lock with the video signal, you can phase lock this against the sync output of an LM1881. Use phase detector II in the '4046 and add your own dividers according to how many pixels you want in a line. With all this said, surely the vendor of the video transmitter has a spec for the video bandwidth it will support? Also, NTSC kinda defines its own bandwidth requirements. From Wikipedia:
H: Op amp Adder circuit and positive voltages Reading questions on converting negative voltages to positive ones it has left me with a question that I can't seem to work out. The circuit looks like this: But you only have the one going to the inverting input. My question is: When inputting a positive voltage it doesn't change/very slightly change. So do you have to implement something else for when the voltage is positive? EDIT: Image borrowed from Kortuk's answer here R ___ .------|___|----. | | | | | | | VCC | | + | R | | | ___ | |\| | Input -|___|----------o-------|-\ | Output | >----o---- .------|+/ | |/| | | === === GND GND AI: Your first image has an implicit positive and negative power supply, which allows the output to swing above and below the reference voltage (ground). If you assume an ideal op-amp (usually reasonable for these circuits), then the inverting output is a virtual ground - it is driven to the same voltage as the non-inverting input. The current through the feedback resistor (Rf) must be equal to the sum of the currents flowing through the input resistors (R0, R1, Rn...). \$ \dfrac{V_0 - V_{ref}}{R_0} + \dfrac{V_1 - V_{ref}}{R_1} + \dfrac{V_2 - V_{ref}}{R_2} = \dfrac{V_{ref} - V_{out}}{R_f} \$ To make the math easy, lets make Rin=R0=R1=R2. The output voltage becomes: \$ V_{out} = \dfrac{-R_f (V_0 + V_1 + V_2 - 3 \cdot V_{ref})}{R_{in}} + V_{ref} \$ In the first example, Vref=Ground=0V, which simplifies the equations a bit. If (V0+V1+V2) > 0, then Vout will be negative. If Vout can't be negative, due to a lack of a negative rail or negative voltage headroom, then the circuit stops functioning as intended. Nothing explicity requires you to have a negative rail, and single-supply operation is usually desirable for its simplicity. In order to get the expected signal swing, you need to set Vref to some value between VDD and Ground. A pair of resistors acting as a voltage divider will work, or a poteniometer would allow you to adjust the reference voltage. In the context of this question, the object was to measure voltages that were always below your ground reference, without having a negative power supply. In that case, a reference voltage of 0 would be OK because the output voltage would never need to swing below the negative rail.
H: What's needed to get 100 mA from a USB port? I'm trying to build a stereo speaker system for use on a laptop. I want to keep it as simple as possible, so I'm thinking of using laptop's audio output to for the audio signal and a USB port for power. As far as I know, each port should be able to provide 100 mA for devices. Is there any need to signal to the computer that I'm going to try to draw 100 mA, or is it acceptable to just connect the device? Also, how stabilized and filtered is USB power? I'm thinking of using TDA7053A to drive the speakers and its minimum voltage is 4.5 V. If that doesn't work, I'd use two TDA7052 amplifiers, but I'd like to keep number of parts as low as possible. As for power consumption, I already have a small radio which uses one 50 Ω speaker and a TDA7052 and it uses at most 25 mA, so even with two of those speakers, I should have lots of power to spare with a maximum supply current of 100 mA. AI: I haven't experimented with USB power, but this analysis seems to point to it working just fine. At 100ma all tested devices remain above 4.5v. I believe you can just connect to the port... you can test this simply by plugging in a USB cable and checking the pins on the other end with a multimeter. Here's the full USB spec and here's all other docs from usb.org
H: Advice on cleaning up 5VDC from a wall-wart Assumption: I think it's generally true that commercially available AC/DC wall-worts can be expected to be pretty noisy (e.g. you can't count on much better than 5% stability). Background: I'm dorking around with an RF application right now, and I hypothesize that some significant subset of my headaches is coming from powering my RF receiver with 5VDC coming directly from an AC/DC wall-wart (i.e. no RF choke, no regulator, nothing). Question: What's the simplest way (e.g. fewest parts) and cheapest mechanism for converting the "angry" 5VDC off a wall-wort into a "happy" 5VDC for my RF receiver? I think the other subsystems are more tolerant to noisy power. Aside: I wish I could give more definitive characterization of the noise coming out of the wall-wart, but sadly I am sans o-scope. Edit1: In response to the request for more detail on parts being used: Wall-Wart RF Receiver AI: I have never had noise problems with wall warts, but then again, I never trust power supplies either and always add at least minimal filtering on my boards. I usually add a 10 - 47uF electrolytic in parallel with a 0.1uF cap at the power inlet "just in case." This has never failed to clean up any ripple or spikiness from wallwarts. Is the power supply regulated? Have you verified that the voltage is really 5V?
H: Using MLX90614 OR is I2C and SMBus compatible? I am trying to use a Melexis MLX90614 with Atmega8. I have failed in all my attempts till now. I tried sending this sequence slave address(as 0x00 and 0x5A) --> opcode to read SMBus address --> data byte high --> data byte low I get a slave address NACK for both SMBus addresses. Is it because I am using an I2C library? I understand we have to give a PEC also, but as the Slave address is NACK'd I don't think the sensor is responding to my commands. I tried using the write opcode and got ACK's for that. So the communication is ok. Can anyone tell me what kind of problem may be here? Also how would one generate a PEC for SMBus protocol? I looked at this code and it just sends 0x00 and 0x07 over i2c to fetch two bytes of temperature. How can that be possible? In the datasheet it is specifically mentioned how to read one word and how to write one word. How can this be bypassed? AI: Theoretically I2C and SMBUS are essentially compatible as long as you are operating at 100kHz bus speed. The datasheet on page 15 (7.4.3.1.1) suggests to read a register you (as a master) have to do: Start SLA+W (slave acks) Command (slave acks) Repeated Start SLA+R (slave acks) READ data byte low (you ack) READ data byte high (you ack) READ PEC (you ack) STOP The appropriate SLA is 0x5A. Just like with I2C, you will need pullup resistors on the SCK and SDA lines (3.3kOhm should be fine). Command value will depend on what you are trying to do as described on page 16 (7.4.6). Reality (?) However, there is a paragraph (7.4.1) on page 13 that says: In order to provide access to any device or to assign an address to a SD before it is connected to the bus system, the communication must start with zero SA followed by low RWB bit. When this command is sent from the MD, the MLX90614 will always respond and will ignore the internal chip code information. ... now that is a vague description of a specialization of the protocol at best, but it appears to be what the github code is exploiting. If one is to believe the github code, it is actually illustrating an undocumented protocol behavior. Namely: START SLA(0)+W (slave acks) Command(7) (slave acks) (writes to the RAM read-address register the value 7 = TOBJ1?) STOP START SLA(0)+R (slave acks) READ low byte (master acks) READ high byte (master acks) READ pec (master nacks) STOP I've seen this "flavor" of I2C interaction before, but I'm with you that it's not described that way in the datasheet. Sidenote on PEC As for "how you generate the PEC" it's described on page 14 at the bottom of the page: The PEC calculation includes all bits except the START, REPEATED START, STOP, ACK, and NACK bits. The PEC is a CRC-8 with polynomial X8+X2+X1+1. The Most Significant Bit of every byte is transferred first. Basically it's CRC-8-CCITT (see wikipedia) - implementations exist, just google for it, or post a separate question about CRC...
H: Interfacing microcontroller and mains via a relay I am thinking of starting a project where I will need to interface a microcontroller output and mains for a lighting system. My question is about relays. I have found this one. And I am wondering will it be ok to put 230v through the switch of the relay? Also what am I looking for in the data sheet to tell me what is the maximum voltage that the switch will take? AI: The relay is a good one for resistive loads like incandescent lamps. The AgSnO2 contacts can handle higher inrush currents than AgNi. Note that all given currents refer to cos(\$\phi\$) = 1, i.e. fully resistive loads. If you want to switch reactive loads like fluorescent lamps you're limited to a fraction of the given maximum current. You also want a safety margin for the inrush when switching a cold incandescent lamp when the voltage is maximum. Your 10 A then become 1 A. Since a 60 W bulb draws 0.25 A at 230 V you should be able to switch up to 4 lamps with 1 relay. edit Forget I mentioned incandescent lamps. I was in the supermarket today and I needed a replacement bulb. While in the past there was an offer of at least 30 or 40 different incandescent bulbs in all sizes and shapes today they were all gone! Same variety in CFL (compact fluorescent), so that's no problem, but I didn't think the incandescent effectively would be gone before 1st January 2011. Anyway, for your relay. Relays like the resistive load of an incandescent bulb much better that the reactive load of a (compact) fluorescent lamp. While in theory you should derate the relay further for the changed load, in practice CFLs are only 20% the power of incandescent lamps, so your load will remain within the limits set earlier: you should still be able to switch 4 CFLs with 1 relay.
H: Sizing a trace on a PCB to carry 2.5 amps I need a trace on my PCB to carry up to 2.5 amps (average) current, with 5-6 amp spikes (it's going to a switch mode power supply.) How wide should the traces be? I've got a trade off between reliability and size, as the product is space constrained. Any tips would be appreciated. AI: After doing a quick google of "PCB Current Calculator", I found a PCB Current Calculator based on IPC-2152. It bases the width of the track on how much of a temperature rise the trace is allowed to have. It's nice in that it shows how much power you waste through your trace. I would design for your worst-case RMS current, since it's going to be a periodic signal. If you use 2 oz/ft2 copper instead of the standard 1 oz/ft2 copper, you won't need as wide of a trace to achieve the same resistance. For example, allowing for a 10 oC rise, you can get away with these numbers at 3 A with no copper plane nearby: 177 mil (4.50 mm) on 1/2 oz/ft2 copper 89 mil (2.26 mm) on 1 oz/ft2 (35µm) copper 47 mil (1.19 mm) on 2 oz/ft2 (70µm) copper Note: IPC-2221 (The standard used in the original answer) uses old measured values for its design charts, and these charts are implemented in many calculators. As best as I can tell, this data was claimed to be 50 years old, which makes IPC-ML-910 (1968) a possible source. As @AlcubierreDrive pointed out, a new standard, IPC-2152, contains new measured data, and presumably is more accurate. More importantly, a comparison of IPC-2221 values gives the following result for trace widths: IPC-2221 (internal) > IPC-2152 > IPC-2221 (external). Actual numbers for the example above (1oz copper) are IPC-2152: 89 mil IPC-2221 (internal): 143 mil (+60%) IPC-2221 (external): 55 mil (-38%) Also note that the original numbers in this answer were based on the IPC-2221 internal calculations, which will provide a conservative estimate for all values.
H: Monitoring two serial lines at the same time First this is the setup: (please note that one of the grounds is not connected, both FTDIs working properly) Now, I have used PuTTY to look at these two serial streams, both exchanging data at 9600 bauds, but my problem is logging the activity time-wise. I've also tried some serial monitors that I found on the tubes, but the time resolution is in seconds. Is there a tool for monitoring these two streams at the same time? If there is not, I should program one myself in Processing (it will take less time in this language I suppose). PS: the ultimate goal of this is to replace the remote device (an actual wired remote) with a little MCU like the ATtiny85 or ATtiny2313 with a simulated input. PS2: I only have these two FTDIs, an analog oscilloscope and a multimeter. AI: If you're on a 32bit Windows OS, I would recommend using PortMon. It goes down to the millisecond at least. It might even be microsecond resolution. I've used it a lot in the past with great success. In your particular case, you will put each FTDI chip on its own serial port. Then in PortMon, simply select the ports you want to monitor from the pulldown menu. Both sets of data get logged at high resolution, and you can even add filters to reduce the amount of data. For serial protocol monitoring, I add the include filter IRP_MJ*.
H: How do I protect SD card against unexpected power failures? I am working on a device that uses the Microchip MDDFS library to store data to an SD card. The logger will log data at a maximum rate of 1 entry (56bytes) every minute. The problem is the device may lose power at any time, potentially in the middle of a write sequence. I am wondering what is the best way to protect my data against corruption. I have found that if the file is open when the power is lost, all data that was written to the file after the last file-close is lost. I don't know if the same holds true if power is lost in the middle of the write sequence. Since the write procedure doesn't happen very frequently I could open the file, write the data, and then close the file, every time data is logged. Would this approach damage the sd card over time? Another approach could be to keep the file open but after every 10 or 50 writes I could close the file and then re-open it. I could also buffer data in memory, then flush the data occasionally maybe after a kbyte or so. The last idea I had was, in my circuit, I could add a large capacitor that would provide power to my pic/sd card long enough after the power is disconnected to quickly close the file. The problem with this approach is that the time it takes to close the file and/or save data is very inconsistent. From my understanding, this time can very depending on the current place in a flash page that the file is in. Anyways, what would you guys suggest? AI: A few things can happen when you write data to a file. I'm going to describe the sequence that needs to happen for data to be safe, not necessarily library calls. When you're writing, and adding on to the end of the file (normal write mode), you read the last block of the file into memory, modify it with your write data, and then write the whole block back to the SD card. If the block is full, then a new block must be found in the File Allocation Table (FAT). After finding a new block, the FAT must be updated, which is a read-modify-write cycle. If we're done with the file, then we need to update the file attributes (such as file length) in the root directory, which causes another read-modify-write cycle. Minimizing your write time Make sure that the file is already holding your data when you write a sector. If you start out with a large file and overwrite the data instead of appending the data, the data will be safe as soon as the SD card sector write is finished. You can eliminate one to two read-modify-write cycles that way. My start-up code would write 0's to a file in sector increments until the SD card is full, and then rewind to the beginning of the file. Make the size of your data entries such that an integer number of entries fit in a sector. I would bump up your entries to 64 bytes. While this is less efficient, it will prevent you from needing to read-modify-write two sectors. Create a variant of the FSwrite function that allows you to write whole sectors. If you keep the whole sector in SRAM, then your cycle goes from "read-modify-write" to "modify-write" Keep your PIC and SD power on as long as possible Big capacitors are good. 470uF should give you more than enough power to finish a write cycle. Make sure your power source won't suck the power out of your back-up capacitor! Add a diode if necessary. Know when you're out of power A big power supply cap will give you 10ms or more to wrap things up with a SD card, but don't press your luck. Use a pin on your microcontroller to see if your power source is still good, and don't start a write if your source is dead.
H: What is an eFuse I heard in a recent presentation that the XBox 360 uses an eFuse to prevent users from reverting back to prior boot/firmware image. What is an eFuse and how do they work? AI: It's an irreversible part of the chip which is "burnt" out (without causing damage to the rest of the chip) and is usually a single configuration bit. The bit (and subsequent bits) might control something like software version, or whether the Xbox supports 1080p, or whether you can play certain region discs... Pretty much anything you can imagine. Like a one time programmable read only memory. They are a concern because it effectively allows a manufacturer to obsolete a product remotely without any consent from the owner. That's the paranoid view, anyway.
H: Which op-amp for audio? I understand that the NE5532 is an evergreen in audio applications. Which other op-amps would you consider for preamp, filter and other high fidelity audio applications? AI: edit: What are important parameters in audio op-amps? First there's noise. All components have some level of noise and there are several types of noise. While noise levels can be very low our ears are very sensitive to it. Noise is expressed in \$V/\sqrt{Hz}\$. That's a strange unit, but can easily be explained. Noise has a continuous spectrum and is defined as power over a specific bandwidth \$W/Hz\$. To get the voltage (in a specific load) you take the square root of that. Next there's distortion. Probably the most published parameter is harmonic distortion, and it's the one manufacturers draw the most attention on. The reason is simple: it's relatively easy to obtain spectacular-looking figures like 0.01%. But these figures are rather meaningless, because the weakest link, the speaker, often adds several procent harmonic distortion extra, and our ears aren't that sensitive to it. Then transient intermodulation distortion (TIM) is far worse. It occurs when a higher frequency component modulates a lower frequency, and because their product creates non-harmonic frequencies this is much more audible. TIM was discovered rather recently because measurements were originally done with single sine waves, and then this kind of distortion can't occur. High slew rate op-amps have low TIM levels. Despite being much more annoying than harmonic distortion TIM levels are hardly published, because it's harder to get the same fancy looking figures as for harmonic distortion. Bandwidth is also important. Op-amps have a gain-bandwidth product (GBW) which indicates that the bandwidth depends on the amplification; a higher gain (amplification) results in a lower bandwidth. GBW is closely related to slew-rate, and you want to have a much wider bandwidth than the 20Hz-20kHz of audio to get high slew-rate values. I've found a few interesting parts at Analog Devices: [OP275](http://www.analog.com/static/imported-files/data_sheets/OP275.pdf): very low noise (\$5nV/\sqrt{Hz}\$), high slew rate and low distortion [AD823](http://www.analog.com/static/imported-files/data_sheets/AD823.pdf): comparable specs, a bit higher noise edit Looks like I have to answer my own question... :-) I read somewhere that the LME series is National Semiconductor's selection of high performance, high fidelity devices. You find the lot of them on National's site; there's too many to list here.
H: How much current does an FPGA consume, anyway? I'm in the R&D stages of a V4 of my project, which may replace the high-speed DSP with an FPGA. I was looking at this FPGA, because it is cheap: XC3S50A (about £6.50/each.) I think I can probably fit the project onto there, with one concern. I can't find anywhere in the datasheet about how much current it will consume. Is it a fixed amount, or does it vary, depending on how much logic I am using? Is there a quiescent current draw by it, when no logic is in use? What about the current draw by its clocks/PLLs? I've looked through the datasheet - it has many characteristics, but these ones in particular don't seem to be mentioned. AI: It varies hugely with clock rate, exactly what is being clocked internally, and I/O usage. It is sufficiently hard to determine that most FPGA softare has a utility to estimate current draw of a design given the external clock/data rates, however it will need a lot of detailed info to give a reliable estimate, so the easiest option is often to just build it & measure, or load a comparable design into a devboard and measure that.
H: Reading PDF through FPGA I am a newbie in FPGA world, working out on Verilog these days. I have thought of a couple of Projects for my FinalYearProject at my college. One of them is Handheld Ebook Reader. Well, I will workout the other things required, what i am most concerned about is, How am i going to read a pdf file through FPGA. Well, in the project, i will be interfacing a MicroSD card module with FPGA, the FPGA would read the file from pdf and would display it on LCD, interfacing with LCD wouldnt be a big problem as i have got a couple of good resources for that, interfacing the memory card module too. But the thought that has been troubling me in choosing this project is, how am I going to read PDF. I may work on the pdf which has texts only, i wont work on images, on the other hand if i plan to work on images as well, i will have to do a lot of work for several tasks, say for zooming in and others. Kindly help me on this. Plus, i am pretty keen about this task. Kindly tell me if this can be done more easily with microcontroller. I have a little bit of experience working with them. AI: First of all you need to determine what you're going to do with the PDF. If you're displaying it, you'll need some memory for the frame buffer, and a way to interface with the display. That should be your primary concern. Then, start thinking about rendering the PDF itself. As PDFs are essentially compressed PostScript of one form or another with embedded fonts, you can divide your tasks into some major elements: part of the FPGA to load data from SD card or other media including file system access part of the FPGA to decompress chunks of data, or to accelerate this process part of the FPGA to decompress image data (JPEG, PNG, etc.) and copy to memory part of the FPGA to decode/execute PostScript part of the FPGA to figure out what needs to be displayed (such as the current page); this could be simple bounding logic or complex scaling logic handling a variety of different display modes a floating point unit for the floating point coordinates in PostScript an integer ALU several "GPU" engines which render primitives from the PostScript engine (ideally, in parallel) e.g. draw line, draw polygon, ... a font engine or two to render fonts (this will likely be very complex as you will need to support complex features like hinting and antialiasing.) a display interface and memory interface a UI controller of some kind, perhaps implementing copy/paste, selections, menus, etc. Ideally the engines 1-5 would be pipelined to get maximum throughput. You'll be looking at a big FPGA to do all of this. You could probably do this on a CPU, but if you realllly want to do it on an FPGA, this is probably the route to take.
H: Help understanding SPI and Arduino I Have started making my 1st PCB, as per my other question (Located Here) and have been looking at the datasheet for the MAX7219CNG and studying the library to run it on an Arduino (Located Here) Now my question is from what I can see in the library, there is a method called spiTransfer that sends the data to the IC to turn on and off the various LEDs. This is done by shifting data containing opcode and data bits. The opcodes are at the top of the .cpp file. For example #define OP_SHUTDOWN 12 I can't find where the related information is in the datasheet to say that 12 = Shutdown. Am i reading the datasheet wrong or understanding the library wrong. I want to learn how to read a datasheet and implement code to run an IC with out relying on code written by others. And guidance would be great thanks AI: That's because it's in the datasheet in hex. :-) Page 7, table 2. I'd have written the define as #define OP_SHUTDOWN 0x0C to be consistent with the datasheet…
H: Can I run traces through "No Connection" pins? Several ICs are manufactured in packages with more pins than it supports. For example, the LM317 in an SO8 package has 4 VOUT pins and 2 N/C (no connection) pins. I often want to run traces through N/C pins to ease routing, but wonder if it would make them give up the ghost. If it exists, what is the standard or rule by which manufacturers follow concerning the electrical characteristics of N/C pins? Or do I have to scour the datasheet / do my own testing every time? AI: It's a grey area. Some manufacturers tell you that's used for calibrating. Some manufacturers even will tell that you that certain pin has a function, only used by them for calibrating. Some tell you only not to connect it, or just say it's an unconnected pin.. You can't know for sure. The datasheet is information the manufacturer want to tell to you about using the device, but it might not be everything. I recommended you do not connect them. If you get some generic IC from a different manufacturer or even batch the behaviour might be different. If you're engineering a project, you don't want to throw in unpredictability. You would have to test every single batch before you're going to use that particular batch. It depends on whatever you want to do that.
H: slick way of muxing power+NTSC video over RG59/RG136? I've got a few NTSC security cameras I'd like to set up around the perimeter of the house. They output standard NTSC video and require 12V for power. I was hoping to power them and take video off the same cable, but I haven't been able to figure out a slick way to do it yet. Structured cable isn't all that expensive but if I could stick with standard RG59 or RG136 I think that'd be best. Unfortunately it's not like injecting power into RF signals; NTSC video sits around 1Vp-p and has high frequency components to it so it's not as simple as just using a DC blocking cap. Has anyone done something like this before and what kind of success have you had? AI: How did you get your Nintendo to display on a TV without baseband inputs? You used an RF modulator. So set up an RF modulator at the camera, then the normal DC block capacitor will work. It shouldn't be too hard to find an NTSC demodulator for the other end.
H: What type of cable do I use to connect to the power pins on RF equipment? I'm using several pieces of equipment from Minicircuits, namely an amplifier and a bias-T. Each of them have a strange power connector - it looks like a small metal post with a disk on the top, or a bare wire that sticks out of insulation. See example image below: I'd like to find cables that properly attach to this. Any input? AI: The ones with turned ridges are simple solder terminals - quite often screwing directly into the housing for a ground connection. The plain ones (especially if they appear to be a wire potted in glass with a hex head surrounding them) are quite likely to be feedthrough capacitors, used for power or control signals. Normally you would solder 22 gauge +/- stranded wire (or heavier if high current) onto them. It goes best if you pre-tin both the terminal and the wire, especially for the ground terminals screwed into the housing which may take quite a bit of heat. We used to use individual pin contacts from 2mm molex connectors in heatshrink on feedthroughs in the lab, but always directly soldered wires on shipping builds.
H: Can a 2-prong AC/DC converter switch polarity based on inverting the plug? I got an electrical engineering degree 15 years ago that I barely use. Although I bought a fairly fancy multimeter, I will freely admit to having only a vague recollection of what I did back then... which was mostly discrete math and signal processing (as opposed to circuits). A friend of mine who has a lot more real-world "electrician" experience was trying to figure out what was wrong with some cameras he owned. They were powered by cheap wall-warts and failing. We were trying to check these power supplies to make sure they were working, as we didn't know if the problem was with the power or the camera. Sure enough, some of the supplies were dead. We tried to substitute in some switchable supplies to get them working. In the process, I noted with the multimeter that the polarity was different on the switchable supply from the adapters we were trying to replace. As we were plugging in these 2-prong plugs haphazardly into 3-prong outlets, I wondered out loud if we might have the plugs in upside-down. He looked at me condescendingly and said "Oh, I see. You have a degree in this, do you?" Well firstly, it's been 15 years, and secondly...while he may know a lot about being an electrician I know about the diode bridge inside the stupid wall wart. And yes, diodes can tell the difference between electron source and electron sink. But if the power is an AC sine wave then it spends as much time in an up cycle as down cycle and so the decision about polarity is in the circuit post-rectification, etc. (So it was; to change the polarity on the adapter you just changed the terminals on the plug once it had been converted to DC, not before. Fine.) But the hypothetical question kept nagging me. Given that one of the terminals is ostensibly true ground, would it be possible to build an AC/DC converter whose DC polarity would flip based on which way you plugged it in (and I'm talking about no connection to 3rd prong)? Do such things exist? AI: No way. Given just a differential, just a pair of connections, there's no way for a circuit to tell which is which. If you had access to phase information about the grid, you might be able to do it, but as the mains frequency isn't terribly constant, you would not be able to rely on predicting this. Your device would have to get information about the present phase angle of the mains from someplace. However, if you do have a real earth-ground reference from some place, you could build a circuit to look at the voltage of each supply line with respect to ground. One will be a small drop below the full 120 (or whatever the local mains supply) whereas the other will be slightly above ground. (Neutral return current vs your neutral run's resistance). This would just let you know which leg was 'hot', and you could swap your output polarity accordingly. A Second Thought If the power supply has only four connections with the world, two from the mains plug, and two to output the DC, there's no way I can think of that you could deterministically set output polarity based on plug orientation. BUT if you're willing to make your otherwise simple supply a lot more complex, you could conceivably make it so that if you pulled the plug and flipped it, and plugged it back in straight away, the output would flip. Here's the idea: You stuff some kind of micro-controller in the box, that monitors the line voltage, and determines when rising-crossing-zero (or some other phase point) happens on one of the legs. You'd have to reference this to the midpoint of the two supply legs via a voltage divider. The micro could then anticipate when the next such phase point would occur. Now you'd also have to put some kind of super-cap in the box and pick a low power micro that could live off the super-cap long enough for the user to flip the plug. When power comes back, either the anticipated phase change happens when you expect, or half-way between. Half-way between means the user flipped the plug, so your micro flips the output polarity. Of course, that still would be problematic. If the thing had been unplugged for a while, the micro would be dead, and you'd have to make an assumption about what the output polarity should be. Finding a micro that could last maybe 10 seconds on a cap's worth power while actively chugging away could be easier said than done. Last and not least, this would really only be a novelty gadget.
H: DALLAS DS1220AB Non-volatile SRAM from 20 years ago --- reusable? The DALLAS DS1220ABs that I have were mostly manufactured in 1992 and 1993, I have a bunch of pulls. The datasheet speaks of a "lithium" battery inside (not "lithium-ion"). Do people here think that applying GND and VCC would recharge the "lithium" battery inside to make these chips quite usable, or is that just not the way it works? (for e.g. http://cgi.ebay.com/Dallas-DS1220AB-200-16K-NonVolatile-SRAM-/170576839051) AI: The batteries are not rechargeable and the modules are designed to be replaced when they fail, not recharged. I know this because the modules are quite popular in old HP digitising oscilloscopes, of which I own one. After about 20 years the battery hits minimum voltage and calibration as well as some settings get reset back to defaults. I have heard of people having success with removing the battery from the package and replacing it, although I am not sure how well this would actually work. Applying a voltage to Vcc will not serve to charge the battery: this is because there is protection circuitry built into the module such that it does not recharge the non-rechargeable cell and damage the cell in the process.
H: Cheap 1" LCD suitable for use with microcontroller? What cheap LCD pixel displays are available which are 1" or smaller which could be interfaced to a microcontroller? (AVR, PIC24, etc.) I'd like to make an interactive keyfob. The important factor is small size, 1.5"^2 maximum. I've seen small colour displays in LCD keychains which look ideal - but, it looks as though they use some custom controller logic which only talks USB. Something like these 16x16 monochrome LCDs would be ok, if I could find a display controllable with SPI (this device has a custom epoxied blob). http://img.skitch.com/20090406-8dargu3hrnwdnfpgdu35k3tu78.jpg Any ideas? AI: A guy named Rossum (known for the world's smallest, cheapest game console [prev url]) did a nice job of reviewing and reverse engineering lots of cheap LCD displays [prev url]. In his latest post he reverse engineered an iPod Nano 2g display [prev url].
H: What should be on a DVT (Design Verification Test) checklist? Despite doing a Google search and finding this from Avanthon Engineering (link now dead, see archive.org), I haven't found a good checklist. Theirs is more for board bring up than making sure a design really works before it goes to production. I'm thinking of checks such as Check at high/low voltage Check at high/low temperature Check more than one unit Check signal integrity on clocks and other critical signals In this case the design is an analog one. But since I mainly do digital designs, suggestions there are welcome. I have a mental checklist, but I'm sure I could use a written one. AI: A DVT should cover everything you promise to your customer in the data sheet. Ideally, you also have made a spec long before you've written the data sheet, and the spec may even have more details than the data sheet because you don't want all the little things to be published. When you do the DVT, you test each and every parameter you specified before or while you designed the gadget. It's as simple (and as much work) as this.
H: FPGA, first steps Well this is a continuation of my question on FPGA over here. I finally selected a Digilent Atlys with a Spartan 6 FPGA, I don't have any prior experience of FPGA's although I have done some amount of work with micro-controllers. I spent the last few days reading through data sheets of the FPGA, and I think it would be a good choice to start off with Verilog. I couldn't find any code examples though and even the data sheets are not newbie friendly. I want to do some hand's on programming, simulation, synthesis now and this is what I want to do Generate an odd frequency, say 54Mhz from the FPGA (it runs on a 100Mhz clock) and route it to one of the pins. I would probably have to use the DCM or PLL for this, but no idea how to start here? Implement some sort of I2C read write from the FPGA. What I'm looking for is a reference, possibly an online one or a book that gives me code examples and description of each of the hardware components available inside the FPGA, like DCM's, slices, clb's etc. I guess that should get me started into the world of FPGA's. AI: Code Examples Hop over to OpenCores and you will find dozens of open source projects. There are many written in Verilog and cover the gamut from I/O devices through to processors. Also, do not forget the many Application Notes available from Xilinx. They are very helpful with their own devices. Design Flow Pick up a book or two on design flow so that you get an overview on the steps involved in FPGA design. In summary, they will involve: Design entry - in your case, Verilog. Functional simulation - using various tools. Synthesis - in your case, using the Xilinx ISE tools. Simulation - to verify your post-synthesis design because some aspects of Verilog are not synthesisable. Place & Route - using the Xilinx ISE tools. Implementation - downloading the design onto the FPGA. Testing. FPGA Components As for using the FPGA components, there are different ways to use them. But assuming that you are using a Verilog design entry, you can either infer or instantiate the different components. Inference generally involves getting the synthesis tool to pick the best components to use based on the functionality that you require. The best example of this would be to design an adder. By doing q <= a + b or q = a + b you can infer an adder. Both will infer the adder but there is a difference in when you use the blocking/non-blocking syntax. Instantiation generally involves calling the exact library component in code. Some components just cannot be easily inferred in code - such as the DCM. You can use the ISE tools and examples to learn more about this. The actual list of components themselves are provided by Xilinx in the Libraries Guide. Protip The best way to learn this is actually to experiment with short bits of code and run them through the ISE synthesis to see what it spits out. There are also plenty of examples in the ISE toolset itself.
H: Connect 230V AC 50Hz to oscilloscope this is a noob question but here it is: How can i connect an osciloscope to the 230V mains power line to see the voltage sine wave ? - what schematic do i need - how safe is it ? AI: Use a transformer (12V, say), it will be much safer even if your scope will handle the mains voltage. That particular scope will probably be damaged, DO NOT connect it to the mains! 230 V is the rms voltage, the peak voltage is 230 * 1.412 V.
H: Oscilloscope Bandwidth, what's it all about? This question popped up to me a few moments ago. I was measuring what is intended to be a 50Mhz square wave of level 0 to 2.5, however what I saw on the screen is a sine wave that was centered around 1.2V and level of 0.5 to 2.0V, the frequency was 4MHz. I checked up my oscilloscopes datasheet and it showed that the bandwidth was 10MHz with a sampling rate of 50 MS/s. I'm wondering what these figures are all about. Are they a measure of the upper frequency limit an oscilloscope can measure? Is this oscilloscope capable of measuring 50Mhz at all? AI: System bandwidth is a combination of probe bandwidth and oscilloscope input bandwidth. Each can be approximated by an RC lowpass circuit, which means delays add geometrically: t_system^2 = (t_probe^2 + t_scope^2) f_system = 1/sqrt((1/f_probe)^2 + (1/f_scope)^2) This means that a 10MHz 'scope with 60MHz probes can measure sinusoids of frequency 9.86MHz with -3dB (100*10^{-3/20}%) attenuation. When measuring digital pulse trains it's not so much the periodicity that matters, but the rise and fall times, as they contain the high-frequency information. Rise times can be approximated mathematically by an RC rise or a Gaussian rise, and are defined as the time for the signal to go from 10% of the difference between low voltage (logical 0) and high voltage (logical 1), to 90% of the difference. For example, in a 5V/0V system, it is defined as the time to get from 0.1*5V=0.5V to 0.9*5V=4.5V. With these constraints and some fancy math, one can work out that each type of characteristic rise time has frequency content up to about 0.34/t_rise for Gaussian and 0.35/t_rise for RC. (I use 0.35/t_rise for no good reason and will do so for the rest of this answer.) This information works the other way, too: a particular system bandwidth is only able to measure rise times up to 0.35/f_system; in your case, 35 to 40 nanoseconds. You're seeing something similar to a sine wave because that is what the analog front-end is letting through. Aliasing is a digital sampling artifact, and is also in effect in your measurement (aren't you lucky!). Here's a borrowed image from WP: As the analog front-end is only letting rise times 35ns to 40ns through, the ADC sampling bridge sees something like an attenuated 50MHz sine wave, but it's only sampling at 50MS/s, so it can only read sinusoids below 25MHz. Many 'scopes have an antialiasing filter (LPF) at this point, which would attenuate frequencies above 0.5 times the sample rate (Shannon-Nyquist sampling criteria). Your scope doesn't seem to have this filter, though, as the peak-to-peak voltage is still fairly high. What model is it? After the sampling bridge the data gets shoved into a few DSP processes, one of which is called decimation and cardinal spans, which further reduces sample rate and bandwidths in order to better display and analyze it (especially helpful for FFT calculation). The data is further massaged such that it doesn't display frequencies above ~0.4 times the sample rate, called a guard band. I would have expected you to see a ~20MHz sinusoid -- do you have averaging (5-point) turned on? EDIT: I'll stick my neck out and guess that your oscilloscope has digital antialiasing, using decimation and cardinal spans, which basically means a digital LPF then resampling of an interpolated path. The DSP program sees a 20MHz signal, so it decimates it until it is below 10MHz. Why 4MHz and not closer to 10MHz? "Cardinal span" means halving the bandwidth, and decimation is often by a power of two as well. Some integer power of 2 or a simple fraction of it resulted in a 4MHz sinusoid being spat out instead of ~20MHz. This is why I say every enthusiast needs an analog 'scope. :) EDIT2: Since this is getting so many views, I'd better correct the above embarrassingly thin conclusion. EDIT2: The particular tool you liked to can use undersampling, for which a windowing analog BPF input is required for antialiasing, which this tool doesn't seem to have, so it must only have a LPF, restricting it to sinusoids of less than 25MHz even when using equiv. time sampling. Although I also suspect the quality of the analog side, the digital side likely does not do the aforementioned DSP algorithms, instead streaming data or transferring one capture at a time for brute force number crunching on a PC. 50MS/s and 8-bit word lengths means this is generating ~48MB/s of raw data -- far too much to stream over USB despite its theoretical 60MB/s limit (practical limit is 30MB/s-40MB/s), nevermind the packetizing overhead, so there is some decimation right out of the box to reduce this. Working with 35MB/s gives ~37MS/s sample rate, pointing to a theoretical measurement limit of 18MHz, or 20ns rise time, when streaming, though it is likely lower as 35MB/s is amazing (but possible!). The manual indicates a Block Mode exists for capturing data at 50MB/s 'til the internal 8k memory (cough) is full (160us), then sending it to the computer at a leisurely pace. I would assume that the difficulties encountered in designing a quality analog input were partially overcome by oversampling by 2X (extra half-bit accuracy), giving an effective sample rate of 25MS/s, maximum frequency 12.5MHz, and a 10% guard band ((0.5*25-10)/25), all of which could be reduced in the hand-tool itself. In conclusion, I'm not sure why you're seeing a 4MHz sinusoid as there are ways for this to happen, but would want to make the same measurement in Block Mode then analyze the data with a third-party program. I have always been hard on PC-based oscilloscopes, but this one seems to have decent inputs...
H: Reliability of servos I am building an RC aircraft, 10kg weight range. It is supposed to perform long flights (20km+), so reliability is my main concern, mainly on servos controlling Flight control surfaces. How reliability is maintained on RC planes? I am afraid if any flight control surface servo would be jammed while manouvering, crash would be quite horrible :-) AI: Get the most reliable servos (and other gear) you can in the first place and over spec the servos and their attachments greatly so any mechanical stickyness can be forced out of the way. If you are still not convinced that you have enough reliability, then look into how commercial airliners get higher reliability: Have multiple batteries, all of them feeding the bus though diodes, so that if one battery craps out it will not bring down the others. Split control surfaces and use independent servos to control each, mixed so each control surface is held below 25% authority in normal operations, that way you can count on being able to counter a stuck surface with the one left operational, just by switching off the excursion limit and accepting a lot of drag. Fuse each servo at the central controller, so it cannot bring down the power bus if it shorts out. Use servos which can report back their position and other data, like motor current like: http://www.openservo.com/ so the flight controller can detect stuck servos and try to fix the problem or at least let you know. Run all servos from a controller that is able to power down individual servos, so if one servo goes nuts, then it can be turned off and allowed to weather vane. Stick a complete autopilot with GPS and IMU in the plane (see: ArduPilot), to take it back to the launch site, if the radio craps out. In the end I doubt any of those enhancements would do a lot of good in practice as all the redundancy will also add complexity and thus new sources of errors, just look at all the problems Airbus had getting their flight systems debugged. ... but I bet a whole lot of fun could be had building all of that redundancy.
H: Touchscreen Performance (iPhone, iPad, Android, Nexus S, etc.) Who makes the touch screens for the iPhone or Android devices? Specifically I'm wondering what the sampling rate is for dragging, etc. that gives these devices such smooth touch and drag performance. Also is there a common standard of measurement for touch screen performance? How do you quantify a touch screens drag performance? AI: All but the cheapest phones and tablets are using capacitive sensors rather than resistive ones. But I think a lot of the user experience is not with the touch screen itself, but rather with the graphics engine and the software stack driving it. For example, a first generation android phone like the G1 is probably a faster processor than the first generation iphone was, but flipping through an image gallery on the original iphone was much smoother because they put a lot more thought into engineering a system where that could be done efficiently.
H: Choosing Configuration Jumpers - Solder bridges, 0-ohm resistors, DIP switches, pin jumpers I'm working on a development board, and need to let users set some configurations. It will be used by students and engineers who are trying to build circuits on a breadboard; I'm not dealing with consumers. Usually, the settings will stay the same, but it's possible that every new project could use a different configuration. I will be dedicating some pins to interfaces like USB and Ethernet, but I'd like to give users the option of using those pins for a different purpose. Some kind of configuration will be required. The options I've considered so far are: Solder bridges: Either 0603 resistor packages to allow 0-ohm resistors to be used, or nearby pads for a solder blob. Pros: Cheapest option possible Smallest PCB area required No accidental changes Customizable by soldering directly to pad Cons: Requires soldering iron to make changes Possible to damage board with repeated soldering/desoldering 0-ohm resistors require having those parts on hand. DIP switches: Tiny mechanical switches in an IC package. Pros: Easiest to change Fairly durable Cons: Most expensive option by far Might be changed by accident Large area on PCB Lowest current of the options Hard to make changes to PCB Pin Jumpers Removable Jumpers for .1" headers like those found on PC motherboards and drives. Pros: Less expensive than DIP switches Easy to make changes to PCB Good balance between easy-to-change and semi-permanent Easy to see configuration Cons: Large PCB area required Tallest profile; usually .5" or so required vertically Jumpers might be lost Electronic Bus Switching Use FETs or a bus switching IC like the TI 74CBT series, and control with an EEPROM/microcontroller. Suggested by Brian Carlton. Pros: Small PCB area Configurable in software Can put both to High-Z or connected Cons: Requires another couple ICs; medium cost. Less current than other options Has real resistance Can now confuse hardware bugs with software bugs and vice versa The solder bridge option makes me worry about weakening the pad with repeated resoldering and delaminating it from the PCB. How many times can a good soldering tech change a part on 1-ounce copper with an ENIG finish? Would covering the edges of the pad with soldermask and adding thermal reliefs (for adhesion, not heatsinking) on several sides of the pad increase the durability? Am I missing anything? What configuration methods do you like to use on a dev board? AI: For straight-up development boards (for your internal use), I go with a solder jumper or put two back-to-back (3 pads) to make an SPDT switch (here's a footprint I use). If it's small enough, it's fast to both close and open with a touch of solder or desolder braid. Using an actual resistor makes it much more difficult to rework with a standard iron. If this is a product (as in, the Atmel STK500 development board is a product), you should use something like jumpers or DIP switches, because you don't want some dumb user poking around your board with a 1000°F iron. I'd tend towards DIP switches if you have more options or you are going to put it in an enclosure, otherwise jumpers would be cheaper. The main question should be "is this something that will be changed as part of normal use?" If the answer is yes, requiring a soldering iron and skills is inappropriate. If it's something that an end user might modify 1-5 times (or preferably someone skilled, e.g. a lab tech), a solder jumper might be OK.
H: A better power supply for microcontroller circuits I've been playing around with PIC microcontrollers for a while now, and have had a fair bit of success, however I sometimes get unexplained resets and sometimes need to cycle the power a few times to get my device to start working. I think this is down to my simplistic PSU. I normally throw together a mains transformer, bridge rectifier, linear regulator and a few capacitors. Does anyone have a circuit diagram of a better more efficient PSU that is easy to build on stripboard and doesn't cost too much? AI: What is REALLY important is to have 0.01-1uF ceramic capacitor soldered right on the power pins of every digital IC in your circuit no matter what is the power source. So I belive even your current PSU will be fine if you add ceramic caps where needed. Linear regulators provide very stable power, so you should be good with what you have now (unless it is oscilating - might happen if ESR of caps does not match regulator requirements - usually happens on LDO regulators rarely). In my projects I use USB as my main power source. It gives you stable 5v and it does have current limiter. You can ether get it from your PC(should be careful a little) or from tiny mains adaptors which have USB output. Then you use your linear regulator if you need less then 5V.
H: LCD parallel interfaces I might not be able to find an LCD with a 24 bit parallel interface, which is what my controller requires. I have seen 18 bit parallel interfaces, though. I assume that I could really just use the lower 6 bits of each color and not use the other two bits per color channel. All I would have to do is make sure that my color palettes are adjusted accordingly, right? AI: You can do this without issue. However, you want to use the Upper (e.g. MSBs) of the digital output, discard the least significant bits. Otherwise, you will get all sorts of interesting effects. (for instance, a gradient would be "Multiplied", in that a simple span from black to red would repeat twice, provided you're discarding the MSB of the signal). I currently have a similar project, which uses a 16 bit graphics controller, with a 18 bit LCD. In this case, you connect the 16 bit interface to the MSBs of the LCD, and ground the additional LSBs. What you are proposing is simply the inverse. Note: I've always thought of the MSBs as being "Upper" - This may simply be a terminology disconnect. Anyways, MSB and LSB are a far better way to describe the bus.
H: Testing an Audio Power Amp with Paralleled Transistors A question concerning my current repair project of an audio amp that uses big (600 W) but otherwise rather classic complementary output stages: I assume when testing an audio power amp with 6 pairs of paralleled npn/pnp transistors, it is o.k. to assemble just 1 pair while testing as long as you have no significant output load connected. The advantage would be that, while testing, I would not blow as many of the precius MJ15022/23 transistors I have available as spare parts. In what ways (if any) will the bias current circuit be affected? Any problems I may not have considered but may be important for this repair technique? Any other really good tricks for fixing big amps? Once I am closer to finishing the repair: Does 10...15 mA of bias current per transitor branch sound like a good number to you? AI: 1 bank of 6 at a time ok. Bias not affected significantly. 10-15 mA plausible.
H: Buck converter with feedback loop According to this site in a buck converter with voltage mode control the duty cycle is set directly by comparing a voltage ramp to an error voltage. I agree with that. But this is where my headache starts: If Vo < Vref, then Ierr is positive - increase V(10) and the PWM duty cycle. If Vo > Vref, then Ierr is negative - decrease V(10) and the PWM duty cycle. If Vo ~ Vref, then Ierr is close to zero - maintain V(10) and the PWM duty cycle where Vo is the output voltage and Vref is the reference voltage. Well, the first two lines are ok for me, but i can't imagine how the duty cycle is maintained, when Vo ~ Vref. My assumption here is, that when Vo ~ Vref holds, then the duty cycle should be set to 50% and not maintained. Or am i missing something here? Regards Macs AI: When Vo is not the correct value (Ierr != 0) the duty cycle has to be adjusted. If Vo approaches Vref the adjustments become smaller until there's the point where Vo = Vref, and no adjustments are necessary anymore. If you would change the duty cycle to 50% at that point, Vo will no longer be equal to Vref. Besides, if your duty cycle would always be 50% for the correct Vo, then there wouldn't be any regulation, would it? You would just set it to 50, and that would be that.
H: How long can I leave components in a breadboard? In school, I was told not to leave components in a breadboard for extended periods of time. However, this length of time was never quantified. The reasoning was that the contacts would eventually lose their "springiness"; at some point later in time, you'd be debugging issues with a circuit, only to find out that the contacts were bad. I have no idea if this is really true, or if breadboards are now made so well that it's not an issue. I have some nice ones, but in the end they seem to use the same narrow white piece that everyone else uses. I've got some prototypes put together that I don't want to take apart yet, and I also don't know when I'll get back to it. My mbed board has now taken a back seat to the Netduino that I just received. :) AI: Here's a picture of a board which had some headers forced into it which were too large, damaging the contacts: The outer rows of the Sharpie'd area make intermittent contact, so we avoid the whole section. Notice that some of the numbers are rubbed off, and also notice the burnt spot at the top of the picture where something burned up. The breadboard still has two other middle sections, and this section is only 20 rows tall, so that leaves 172 good rows. On a university budget, that doesn't merit replacing the board. If you are demonstrating breadboarded circuits to a client, you should probably replace the whole thing. By the way, this board is at least 8 years old, and still works fine except for the indicated area. I've only been around it for three years, but no one has had any problems with it that I've heard of.
H: Breadboard Dimensions for making DIP PCB I'm working on a development board which will mount on a solderless breadboard. It uses a 100 pin TQFP IC and Ethernet jack, among other things, so it would be a nightmare to get it to fit on a single section of breadboard at only 1.1" wide, and I'd like it to be big enough for users to make some edits. I'd also like to be able to plug into power distribution rails on the breadboard (like the Sparkfun Breadboard Power Supply). However, after comparing my breadboard with a few friends and coworkers, I see that there are a number of differences in layout. I hope that I can accommodate some if not all of these differences by including multiple places to mount the headers for various breadboards. Here's a dimensioned diagram so we're all on the same page. Imagine that there are two full strips side by side (one mostly off to the left), with power rails on both sides. [Whoops! I forgot the horizontal dimension between B and C. Let's call it E, since I don't have the source for this image anymore.] 1. What are the dimensions of popular, currently manufactured/used breadboards? In addition to the measurements in the diagram I'd like to know the following: 2. Is there an electrical discontinuity between the top and of the power rails? (If so, is measurement '3' different at this location?) 3. What is the configuration of the breadboard? Using the convention that P is a two-column power strip and M is a middle section (rows of connections with a gap for DIP ICs in the center), my breadboard looks like: PMPPMPPMP 4. How many rows are in the breadboard middle section and power sections? Mine has 64 pairs of 5-pin rows in the middle and 10 5x2 blocks. 5. Any other discrepancies I missed which would affect PCB layout? AI: Given the lack of actual measurements thus far, I've decided to upload some measurements of my own. I used a ruler and a magnifier because I don't have anything more accurate, but I verified the measurements by pulling some pins out of a .1" header and test fitting it in the measurements indicated. | BB | A | B | C | D | E | 1 | 2 | 3 | 4 | R4 | |-----|----|----|----|----|----|----|----|----|----|----| | Top | .3-| .1 | .4 | .3 | .3 | .2-| .4 | .2 | .2 | 0 | | 2nd | NA | .1 | .4 | .3 | .3 | .2 | .4 | .2 | .3 | inf| | 3rd | .2+| .15| .4 | .3 | .3 | .2 | .4 | .2 | .3 | inf| | Bot | .3-| .1 | .4 | .3 | .3 | .2-| .4 | .2 | .2 | 0 | A measurement like .3- means that it was slightly smaller than .3, but not .25 or .3. Measurement 4 is the distance between the center two power rails (notice that it's different on the middle 2), and R4 is the resistance between the top and bottom of the measurement. The breadboards I used are shown in the following picture, numbered 1 (on the bottom) to 4. The one on top of the stack is from RSR, the next is a couple old 3M Super Strips. I think that the third might be a Twin Industries model, but I don't know that. It and the bottom one were purchased by my school and the guys who would know where they're from don't get back until Monday. I'd love to have some Twin Industries, Parallax, Global Specialties, Sparkfun, Seeedstudio, and Adafruit measurements. I'm about ready to just email all of those manufacturers and ask them to take some calipers out to the warehouse, but I feel bad asking for that kind of a favor without intending to buy one of them.
H: How viable is it to just use 1% resistors and calibrate out the error? At the moment, I use 0.1% resistors to get accurate voltage measurement through a voltage divider. However, the cost is high, so I was thinking of using 0.5% or 1% resistors and calibrating out the error in software by using a precision voltage reference during production. Has anyone done this successfully? What pitfalls might I encounter? AI: So you've got: R_x R_fixed Vcc -----^v^v^----+----^v^v^------- Gnd | | +--- V_sensed --- ADC input Rx is some unknown resistance (probably a sensor of some kind). And you're using R_fixed at 0.1% right now in order to effectively calculate R_x, but you want to use a cheaper fixed resistor with a lower tolerance of perhaps 1%. In doing so you want to perform some kind of calibration during production to correct for the increased error, is that right? The way you end up doing this is putting an byte in EEPROM (or some other non-volatile memory) that acts as an "offset" in your calculation, and it's a perfectly viable thing to do. The thing is it's going to cost you some time during production to do the calibration activity. In order to do the calibration, you'll need one of those 0.1% resistors (call it R_cal) of nominally comparable value to your 1% resistor to substitute into the circuit for R_x. Measuring V_sensed, you can infer more precisely the value of R_fixed (i.e. to something like 0.2%). If R_cal and R_fixed are nominally the same value, you would expect V_sensed to be equal to Vcc / 2. You would store the measured deviation from Vcc / 2 as a calibration offset byte, and always add it to V_sensed as perceived by your ADC. The pitfall, as I see it, is that there is a bunch of work involved in doing the measurement and subsequently in storing the value. Another thing to consider as a pitfall is that temperature can play a role in causing a resistance to deviate from it's nominal value, so you'll want a reasonably well temperature controlled calibration environment. Finally don't forget to use calibrated measurement equipment, as that's another potential source of additive error. One last pitfall I can think of is that the calibration byte should be stored in units of the lsb of your ADC (so if you have a 12-bit ADC, units of calibration offset byte should be "Vcc/2^12 Volts"). Edit If you are using two fixed resistors to divide a large voltage down to a lower scale as follows: R1_fixed R2_fixed V_in -----^v^v^----+----^v^v^------- Gnd | | +--- V_sensed --- ADC input Re-edited Section So now you want to use a precision voltage reference (call it V_cal) to stimulate V_in during a calibration step in production. What you've got there is in theory: V_sensed = V_predicted = V_cal * R2_fixed / (R1_fixed + R2_fixed) = V_cal * slope_fixed But what you've got in reality is: V_sensed = V_measured = V_cal * R2_actual / (R1_actual + R2_actual) = V_cal * slope_actual In effect you have a different transfer function slope in reality than what you would predict from the resistor values. The deviation from the predicted divider transfer function will be linear with respect to the input voltage, and you can safely assume that 0V in will give you 0V out, so making one precision voltage reference measurement should give you enough information to characterize this linear scale factor. Namely: V_measured / V_predicted = slope_fixed / slope_actual slope_actual = slope_fixed * V_measured / V_predicted And you would use slope_actual as your calibrated value to determine the voltage in as a function of the voltage measured. below courtesy of @markrages To get the actual slope sensitivity to resistor values requires partial differentiation:
H: Difference between thin film and thick film precision surface mount resistors I'm using some 0.1% precision 10k and 150k resistors. They are thin film 0603 surface mount. For a lot more, there are also thick film types. Fundamentally and practically, what is the difference between these two? Thin film example Thick film example AI: Thick film resistors are screen printed; the alumina substrate is metalized then a resistive paste is deposited on top of the terminals. It is later trimmed, coated, metalized on the edges, and plated. Thin film (or metal film) resistors have said film vacuum deposited, allowing for a much more uniform and controlled resistive element. They then undergo similar finishing steps to trim, coat, and metalize the edges. As a result, thick film resistors are generally cheaper than their thin film counterparts, but the tolerance and temperature coefficients one can get out of thin film resistors are generally better. Depending on the materials used, there is plenty of overlap between the two, but all things equal, thin film offer better performance for a cost premium. Vishay has a decent app-note (PDF) on this.
H: Convert fan-in-2 fan-out-3 NAND gates to FO4 This question is about gate delay in VLSI (microchips). (Yes, it is a CMOS) Every digital chip consists of 2 kinds of elements, Register Logic (trigger or latch stations) and combination logic (between the registers, does the actual computation). Most chips can be expressed as http://en.wikipedia.org/wiki/Register_transfer_level which describes logic and registers. The maximal clock frequency of microchip is determined (limited) by the delay of the slowest combination path. This delay depends from kind of elements, used in it. The most popular metric of this critical delay is FO4 http://en.wikipedia.org/wiki/FO4 or Fan-out of 4: process independent delay metric used in digital CMOS technologies. It is counted as chain of length N of NOT gates. Each gate have output power enough to drive 4-fold more powerful inverter (according to wiki). I get this metric as tree of inverters with N levels, where each inverter drives 4 same inverters. Tree looks like http://www.mathworks.com/help/toolbox/wavelet/ug/wptreed2.gif but with NOT gates (transistors) at nodes. (better description is at http://www.realworldtech.com/page.cfm?ArticleID=RWT081502231107 ) So, the any modern processor have a metric FO4, which can be equal to 14, or 20 or 40. If the processor have small FO4, it can have more frequency, than a processor with large FO4 at the same silicon technology. I have a metric for critical path of some chip, expressed in terms of fan-in-2 and fan-out-3: 18 fan-in-2 fan-out-3 NAND gates How can I convert this to FO4? (Fan-out of 4) I want to compare this chip with modern CPUs. FO4 will give me a clear way to check, how fast the chip can be on technology of modern CPU. Update: There is a book which says: This fan-out-of-four (FO4) inverter delay, t_4, is a good estimate of the delay of typical logic gate (fan-in=2) driving a typical load (fan-out=2) over relatively short wires. So, Fan-in=2 and Fan-out=3 is close to 2/2 or to FO4. For the first estimation I will use this 18 fi2/fo3 as equal to 18 FO4. AI: According to David Harris's presentation for eve224a course: (slides 6-11 and 47) Delay d = f+p = g*h+p Where d is process-independent delay, f is effort delay (stage effect), p is parasitic delay, g is logical effort, h is electrical effort (fanout; h = C_out/C_in) In the Wikipedia article "Logical Effort" there are some examples too: Delay in an inverter. By definition, the logical effort g of an inverter is 1 Delay in NAND and NOR gates. The logical effort of a two-input NAND gate is calculated to be g = 4/3 For NOT gate with FO1 (driving the same NOT gate): g=1; h=1; p=1; so d = 1*1 + 1 = 2 For NOT gate with FO4 (the FO4 metric itself): g=1; h=4 (Cout is 4 times more than Cin); p=1 so d = 1*4+1 =5 (the same result is at page 20 of books "Logical Effort: Designing Fast CMOS Circuits", draft from 1998) 1 FO4 delay is equal to 5 process-independent units (defined by harris, slide 6) For NAND gate with two inputs (p=2) which drives the same: g=4/3; h=1; p=2; d= 4/3 * 1 + 2 = 10/3 = 3,3 (a 1.5 times slower than NOT with FO1, but faster than NOT FO4) For NAND gate asked by me - 2 inputs which drives 3 same NANDs: g=4/3; h=3; p=2; d= (some magic inside) 4/3 * 3 + 2 = 6 So Delay of 1 FO4 gate is equal to 5/6 delay of NAND (2-in, 3 FO). The last problem is to convert chain delay of 18 NANDs to chain delay of FO4. (slide 41 of harris) Hmm.. seems I need only to multiply 18 NANDs delay with 6/5... 21,6 FO4. Thanks!
H: Emitter Follower Output I cannot afford a function generator and oscope right now, so I'm trying to learn analog electronics with Spice (MacSpice, to be specific). Below is the Spice model for a simple emitter-follower circuit. Vcc is 15V, and the input at the base is a 5V 60Hz sine wave with a 0V DC offset. R1 sits between the transistor base and the sine input, and R2 sits between the transistor emitter and ground. The output at the emitter has me a bit puzzled and I would appreciate it if anyone has an explanation for the behavior. * Simple Emitter Follower Vcc 3 0 DC 15 Vin 1 0 SIN(0 5 60) dc 0 R1 1 2 270 R2 4 0 3.3k Q1 3 2 4 generic .model generic npn .control tran 1ms 60ms plot v(1) v(4) .endc .end The output of the transient analysis plot command is below. I was surprised by this output. As expected, there is a slight voltage drop in the amplitude due to the base-emitter junction of the NPN. However, the output is clipped and does not swing below zero. What would I need to do to catch the negative part of the sine wave? AI: You need to connect R2 to a negative supply voltage with enough headroom for your signal, or bias the input waveform so that it doesn't clip. The output voltage an emitter-follower is usually V_out = V_in - 0.7V, but there are bounds on where this function works. For the expected behavior, VCC + 0.7V > V_in > VEE + 0.7V must be maintained, where VEE is your negative supply. In your case, VEE is equal to 0V since you don't have a negative supply. When your input voltage swings below 0.7V, the transistor turns off, and your output stays at the negative voltage rail. Modify these lines to add in a negative power supply. R2 4 5 3.3k Vee 0 5 DC 15 Modify this line to bias the sine wave for the existing circuit. Vin 1 0 SIN(7.5 5 60) dc 0
H: Microchip PIC18 matrix routines I'm using a Microchip PIC18 and I need to use matrices in my code. I know DSPIC do have matrix libraries, that simplifies the implementation. Does anybody know whether any is available also for the 18 family (my present PIC18 embeds an hw multiplier)? Thank you all! AI: If you're just using simple, fixed size matrices like 2x2 or 3x3 affine transforms, it's not very difficult to implement them yourself. That link shows how to compute the determinant and inverse of a matrix. Multiplication, addition, etc. are much easier. In fact, the Cairo source code, a drawing library, has GPL/LGPL/MPL licensed code for dealing with matrices (2D affine only): cairo-matrix.c
H: Free RF Simulation Software What free tools are there to simulate RF circuits? AI: For normal lumped circuits, your favorite version of spice will work fine. For analyzing matching networks, I've used gsmc. For analyzing a layout and extracting parasitics and computing fields, I dunno. It's usually easier to just build the circuit and see what happens.
H: How were the first microprocessors programmed? This has just dawned on me that if you're writing an operating system then what are you writing it on? I ask this as I am reading a microprocessor fundamentals book from 1980 and this question popped in to my head: How was the first microprocessor chip programmed? The answer may be obvious but its bugging me. AI: I will take your question literally and discuss mostly microprocessors, not computers in general. All computers have some sort of machine code. An instruction consists of an opcode and one or more operands. For example, the ADD instruction for the Intel 4004 (the very first microprocessor) was encoded as 1000RRRR where 1000 is the opcode for ADD and RRRR represented a register number. The very first computer programs were written by hand, hand-encoding the 1's and 0's to create a program in machine language. This is then programmed into the chip. The first microprocessors used ROM (Read-Only Memory); this was later replaced by EPROM (Erasable Programmable ROM, which was erased with UV light); now programs are usually programmed into EEPROM ("Electrically...-EPROM", which can be erased on-chip), or specifically Flash memory. Most microprocessors can now run programs out of RAM (this is pretty much standard for everything but microcontrollers), but there has to be a way of loading the program into RAM in the first place. As Joby Taffey pointed out in his answer, this was done with toggle switches for the Altair 8080, which was powered by an Intel 8080 (which followed the 4004 and 8008). In your PC, there is a bit of ROM called the BIOS which is used to start up the computer, and load the OS into RAM. Machine language gets tedious real fast, so assembler programs were developed that take a mnemonic assembler language and translate it, usually one line of assembly code per instruction, into machine code. So instead of 10000001, one would write ADD R1. But the very first assembler had to be written in machine code. Then it could be rewritten in its own assembler code, and the machine-language version used to assemble it the first time. After that, the program could assemble itself. This is called bootstrapping and is done with compilers too -- they are typically first written in assembler (or another high-level language), and then rewritten in their own language and compiled with the original compiler until the compiler can compile itself. Since the first microprocessor was developed long after mainframes and minicomputers were around, and the 4004 wasn't really suited to running an assembler anyway, Intel probably wrote a cross-assembler that ran on one of its large computers, and translated the assembly code for the 4004 into a binary image that could be programmed into the ROM's. Once again, this is a common technique used to port compilers to a new platform (called cross-compiling).
H: Signal triangulation I want to be able to determine the location of an object that will be moving around in a rectangle about 15" X 10" The location must be accurate to within about 1/4" and be measured at least 100 times per second. The first idea I had for accomplishing this is to have the object transmit a pulse signal every 10ms and have a receiver in each corner wired to a micro controller and measure the difference in time between when each receiver gets the signal to triangulate it's source. My first thought was to use IR receivers and transmitters, but I would have no idea how to do the triangulation with signals that move so fast. So then my second thought was to use sound. I would want to transmit at a frequency above the human hearing range. And it seems to me that higher hertz = greater accuracy. The speed of sound is about 13,400 inches per second. So that means to get 1/4" resolution, I would need 56kHz or higher. First off, I've never dealt with sounds above the human hearing range. This will probably be on for periods of about an hour, and may be just a few feet away from ears. As long as I use low power, is there any way that this could be a hazard? Secondly, what kind of speakers are capable of transmitting 56kHz? And similarly, what kind of microphones could pick up 56kHz? Other methods of triangulation would also be appreciated. AI: About RF: The idea is to cast let's say 100Mhz signal and measure phase shift between received signals in different points. Then you'll be able to calculate the location. Measuring time difference directly could be tricky, as you will need 0.1ns or better accuracy (1ns = 30cm in air). Piezo-emitters are very capable going into sub-Mhz sound range. Nearly any mic(probably except coal one) can receive 50-100Khz sound with proper amplification. Safety is usually not a problem as long as you are under-1W range, and I doubt you would need more than 0.01 :-) RF way is way harder to implement but I belive more reliable.
H: Basic Training for working with 120V AC I'm planning to build a digitally-controlled light dimmer circuit. I'm not trained in electrical engineering, and I don't want to do something that an electrician would immediately recognize as dangerous and stupid. Please suggest a reasonable home set up for prototyping circuits involving 120V AC power. AI: As far as lab equipment goes, a 1:1 safety transformer (AC mains : AC mains) is worth a lot. They aren't cheap, but I would not want to work without one. Mine is home-built and uses two 250 W transformers back-to-back. The trick of the 1:1 transformer is this: Current from its secondary winding can only go back to the other end of this exact winding. As long as you touch any circuit connected to the 1:1 transformer with one hand only, you are safe because the current from your finger can not go anywhere. You are a bit like a bird on a wire. A regular wall outlet is referenced to earth, just like you are when standing on the floor: In a fault, current from the live pin of the outlet runs through you, the floor and to earth, which is equal to the other end (neutral) of the wall outlet. Keep in mind that current always needs a loop to flow in: Any energy that comes from the transformer can go back to this transformer only, and can not go anywhere else, especially not to the ground via your body.
H: Ceramic caps and applied voltage I'm using a 22u 6.3V X5R 0805 ceramic capacitor to filter out a 3.3V supply (for a buck converter.) I've heard that applied voltage has an effect on the capacitance of certain ceramic caps; a higher voltage causes a reduction in capacitance. How true is this? Would it decrease too much as to not work as a suitable filter cap? I think 10-15u is probably the minimum for it to remain stable, although the ripple will probably increase at lower capacitance. Any ideas? AI: This page has the following table: So, if the 22uF is a 20% tolerance part such that is may actually be 17.6uF (-20%), and it is really 15uF (-15%) due to heating, it may be reduced to ~10.5uF (-30%) near its tolerance or ~14uF (-5%) near its operating point. To reduce the effect, use a higher breakdown value capacitor. Although this webpage tests much higher breakdown voltage ceramics, the results are illustrative: This part, the 08056D226MAT2A by AVX, states that it meets its tolerance tested at 0.5 VRMS, not close to its breakdown: For Cap > 10 μF, 0.5Vrms @ 120Hz It also mentions that capacitance may change up to 12.5% over its load life, 7.5% due to soldering thermal shock, and 12% due to flexure fissures (cracks). Info tidbit: The term X5R means it is composed of a class 2 dielectric (ie: ceramic) that will maintain its capacitance to within 15% (18.7uF - 25.3uF) over a temperature range -55oC to 85oC. Something that may interest you, though it has more to do with the final application than the question -- the great 'pedia also mentions: Due to its piezoelectric properties, they are subject to microphonics. ... And the previously linked page: High-K ceramic capacitors can show significant piezoelectric effects; if you tap them they will produce a voltage spike. This is caused by the barium titanate, the main material in high K ceramics. The higher the K, the stronger this affect.
H: What does input capacitance mean on an oscilloscope? My oscilloscope is rated: 1Mohm || 12pF. It's a 100 MHz oscilloscope. However, I don't get the point of the capacitance. If I set my probe on 10X (it's switchable), then it inserts 9Mohm in series. Now we've created an RC filter with -3dB break point of: ~1.473 kHz, and yet, I get higher bandwidth with 10X probes and I certainly don't get a 1.4 kHz bandwidth limiter! What am I missing? Also, I was simulating the circuit on a circuit simulator. With no probe resistance a 10pF cap conducts 1A at 100 MHz, which would be massive loading compared to the 1 Mohm impedence. AI: Like pretty much all real circuits, oscilloscope inputs have a parasitic capacitance. No matter how small you made it by good design, it would still affect RF signal acquisition, except maybe for a defined 50 Ω connection and attenuation directly at the scope's input, for which case, with the numbers from your question - $$f_{-3dB} = \frac{1}{2\pi \cdot R_{in,\ scope} \cdot C_{in,\ scope}} = \frac{1}{2\pi \cdot 50 \;\Omega \cdot 12 \;pF} = 256 \;MHz $$ Or even higher, if we would make the scope's input impedance Cin, scope smaller. Usually, though, we don't want to load the circuit under test with a defined 50 Ω connection because most circuits under test will have any impedance but 50 Ω (like your signal generator's output would, because it is specifically designed for impedance-matched 50 Ω systems). So what can be done with a capacitance that can't be eliminated? It was chosen to use it in a clever way in the probe-and-scope combination. So clever, actually, that any unknown capacitance that may be caused by probe cables and other things in your connection can be compensated just like the scope's input capacitance, and all of them become don't-cares for most cases of practical measurement applications. The 1:10 probe has an internal resistor of 9 MΩ and, in parallel, an internal capacitor of [1/9 * Cin, scope]. It is adjustable because the probe doesn't know the exact capacitance of the particular scope it is connected to. With the capacitor in the probe properly adjusted, you have not only a resistive divider for the DC part of the signal (9 MΩ at the probe vs. 1 MΩ in the scope), but also a capacitive divider for the higher-frequency AC part of the signal (1.33 pF at the probe vs. 12 pF in the scope, using your numbers), and the combination works beautifully up to or beyond, say, 500 MHz. Also, you get the advantage of inserting not 1 MΩ and 12 pF into your circuit when probing, but 9 MΩ + 1 MΩ = 10 MΩ and [the series equivalent of 12 pF and (12 pF / 9)] = 1.2 pF Link to the source of the picture: Here. What the picture in the link doesn't show and what we have neglected so far is the capacitance of the probe's cable, this would just add to the capacitance at the scope's input and can also be compensated for when turning the variable cap in the probe. Using a 1:10 probe, the probe's small capacitance is in series with the scope's larger input capacitance. The total capacitance (approx. 1.2 pF) is in parallel to the point of your circuit that you are probing. Connecting the scope directly to the circuit, e.g. with just a straight BNC cable, you are indeed putting the entire input capacitance of the scope in parallel to what you are measuring - maybe loading your circuit under test so much that it will not work any more while being measured. At best, it might still work somehow, but the picture on your scope will show results far off the real waveforms in your circuit under test. It would be possible to build scopes with a much smaller input capacitance - but then, there would be no way compensating the probe's cable capacitance with a small variable capacitor near the probe tip. After all, the 12 pF at the scope's input have been put there on purpose, to make the scope work well together with a good probe. One last note: Using 1:100 probes, you load your circuit even less. In lack of an active probe with a really small capacitance at the tip, a 1:100 probe can be used in cases where even 1.2 pF would be too much load on your circuit - provided the signal is large enough that you still see something after the probe's 1:100 attenuation.
H: Stepper Motor Control Timing I have a question regarding stepper motor control while using the TCP/IP stack. In the past I have used a timer for my stepper motor control. I set the period of a timer to the required time between pulses and then I change the motor phase outputs as needed in the timer tick ISR. In the cases where I have done this my stepper was moving at a maximum rate of around 400 pulses per second which means the interrupt was occurring every 2.5 milliseconds. And I was using USB for communication to the host. I am now working on a new product which will use the TCP/IP stack to communicate with a PC over Ethernet. It will also be communicating with other devices via SPI and UART modules. This new device must be capable of operating a stepper up to 2000 pulses per second which means the interrupt may be firing every .5 milliseconds if I use the same timer/ISR approach to drive the stepper. The stepper is turned on and off based on commands received from the host, so communication with the host and operation of the motor need to occur harmoniously and simultaneously. If the stepper speed varies slightly that would not be a problem but it is not ideal. Also, if the stepper were to pause for say a 30ms in the middle of it's move that WOULD not be acceptable. I am considering using a PIC24F with the instruction clock speed of 16MHz (32Mhz/2 using the internal FRC+PLL) for this project. Do you think that the interrupts for the stepper will disrupt the Ethernet communication or vise-versa? Is there a better way of doing this? I have considered using a separate PIC for the stepper control and then I could send that pic target position commands or halt commands to start and stop the movement but that would add another firmware into the mix and complicate things all around. AI: As Nick T mentioned, TCP/IP is unfiltered and non-deterministic. You said you want to also interface with SPI and UART devices, and previous versions used USB. These are difficult to do in real time, and probably require significant code space. On the other hand, you want real-time control of your stepper motors, which requires deterministic execution and rapid interrupts but not a lot of program space. While you said you wanted to avoid using a separate microcontroller because it would complicate things, this is a perfect example of when you need a co-processor, and I believe that it would make things simpler in the end. You can develop simple stepper motor controller firmware that run on small, cheap microcontrollers. Design (or discover) a protocol that can use a communication bus available in hardware on whatever controller you choose. I'd recommend SPI for this (on a different channel than the device you mentioned in your question; your master should have two SPI peripherals), you don't want to mess with address conflicts given the small number of controllers you'll have. Don't do anything with this controller but run the stepper according to the data it receives over the protocol. You can probably buy something that does this already. The goal is to be able to treat this as a hardware peripheral. Then, you can develop USB or Ethernet controllers that will plug into these devices. You will have flexibility in the host protocols (Need to use RS485 this time? No problem!), you can use different numbers of motors, and you have greater modularity for designing, testing, debugging, repairing, and replacing. The only reasons I'd try to implement something like this in a single controller would be extreme cost/size restrictions, and/or a lack of hardware modules (like PWM? Did I miss something?) that could do this without interrupting the host processor.
H: Bit position to bitmask conversion using MPASM directives I'm writing firmware for a PIC16F877A in assembler, and I want to set some constants at the top of my source code to indicate which port is used for what, so that if needed I can easily change all the i/o pins around by changing the constant values and recompiling. Like this: O_LEDS EQU PORTA CONSTANT O_RED = RA1 CONSTANT O_GREEN = RA2 CONSTANT O_BLUE = RA3 In my code, I need a bitmask to represent the ports I'm using. My question is, how can I write an expression using assembler directives to calculate the bitmask? Using my example above: O_RED = 1 O_GREEN = 2 O_BLUE = 3 and the bitmask I want is: movlw b'00001110' If there was a to the power of operator, I could do something like this: movlw (2 ^ O_RED) | (2 ^ O_GREEN) | (2 ^ O_BLUE) but ^ in MPASM is a Bitwise exclusive OR, not to the power of. Can anyone think of another way to do this? AI: I haven't used MPASM before, but does this work? movlw (1 << O_RED) | (1 << O_GREEN) | (1 << O_BLUE) Shifting to the left doubles a number. 1 << x == 2x
H: Switching 120V AC with Digital Logic on Isolated Power Supply Context: A digital phase-controlled light dimmer system. 120V AC mains I use an isolating transformer (and rectifying circuit) to generate +12V and +5V DC rails. I want to use reverse phase control (I've read that this produces less EM noise), so I'm looking to switch the AC mains using 2 Power MOSFETS (e.g. FDB14N30) with the source pins connected together. In order to put the MOSFETs into the "on" state, I need to raise Vgs to 10V-30V, but in order to do this, I think I need to hook up the MOSFET source pins to my isolated ground rail, and the gate pins to my +12V switching signal. By doing this, have I defeated the whole purpose of an isolated power supply, in terms of danger of death and damage to components? AI: If you want to maintain isolation (I assume you have some legitimate reason for it beyond it being "good", i.e. user-accessible low-voltage electronics) and still drive your floating MOSFETs, you could generate a gate voltage with a full-wave rectifier and a shunt regulator, then switch it using a standard optoisolator. The drive current will be incredibly low if you're only switching at 60 Hz, so your regulator's Iq can also be quite low.
H: How do I shift voltage levels? I want to use an RF12B to communicate over radio with an Arduino, but the transceiver is rated at 3.3 V. I hear I need to use a voltage level shifter, but what do these look like and where can I find a schematic to help me hook it up? AI: It depends what direction the signals are going to. If the 5 V device is going to drive a signal on the 3.3 V device, use a simple resistor division. If the 3.3 V device is going to drive a signal on the 5 V device, you could use two inverters with the last stage tied to 5 V. However, this requires four resistors and two transistors, which is quite an expense. You could also try out the implementation as shown in Sparkfun's breakbout board. If the signal is bidirectional (I²C), maybe something in this appnote on page 10 will work (seems similar to what Sparkfun is using).
H: PCB copper thickness with small pitch SMT components I typically use 2 ounce copper as rule for all my PCBs. On a recent board I am using a 0.5mm pitch, relatively large micro, and noticed the pads aren't very flat. Assembly went fine with the protos, but I'm wondering if 1 once copper would provide for a flatter landing service. Does anyone have any experience with using 1 and 2 ounce copper with small pitch devices and/or any advice on assembly reliability related to copper thickness for such devices? AI: Unless you need high-current capability, 1 oz is the default thisckness. Line definition can be impaired with increased thickness, so only use when necessary.
H: Voltage input for charging NiMH Batteries I have 12 AAA NiMH batteries(1000mAH and 1.2V per battery) and I want to know what is the optimum voltage for charging them. I am using a simple Constant Current charger(LM317 and 68 Ohm Resistor(R in the circuit diagram). But i'm unsure on what the input voltage needs to be. My circuit doesn't have the diode. AI: A constant current source adjusts its output voltage with the load in order to maintain a constant current. V = IR // holy s*#% it's Ohm's Law NiMH batteries are fickle fiends to charge, exhibiting temperature-dependent changes in charge and discharge curves. They also don't have a float voltage, so constant voltage charging doesn't work, as you've likely discovered. Energizer has some recommendations regarding charge times: Typically a moderate rate (2 to 3 hour) smart charger is preferred for NiMH batteries. The batteries are protected from overcharge by the smart charger circuitry. Extremely fast charging (less than 1 hour) can impact battery cycle life and should be limited to an as needed basis. Slow overnight timer based chargers are also acceptable and can be an economical alternative to smart chargers. A charger that applies a 0.1 C rate for 12 to 14 hours is well suited for NiMH batteries. Finally a maintenance (or trickle) charge rate of less than 0.025 C (C/40) is recommended. The use of very small trickle charges is preferred to reduce the negative effects of overcharging. AAA NiMH batteries have a capacity of 850mAh [varies by manufacturer], so charging with a rate of C/2 to C/3 can be done with a constant current of... 850mAh / (2 to 3 hours) = 283mA to 425mA An overnight, C/12 trickle charge can be done with a constant current of 71mA. This page mentions that: Modern cells have an oxygen recycling catalyst which prevents damage to the battery on overcharge, but this recycling cannot keep up if the charge rate is over C/10. The recommended maintenance charge rate of C/40 can be done with... 850mAh / h / 40 = 21mA Smart Chargers Listed are charging techniques from Energizer, Duracell, and Powerstream: ΔV charging: charge at recommended constant current until the cell reaches a peak voltage and decreases (eg. -15mV). This technique is accurate enough to safely charge at C/2 to C/3 (283mA to 425mA). dT/dt charging: monitor cell temperature to both limit maximum temperature and look for characteristic heating rate. This technique may be used in conjunction with ΔV charge termination to more precisely monitor and terminate the process, allowing the use of higher currents (C/1 to C/2, or 425mA to 850mA). Soft start: If the temperature is above 40 degrees C or below zero degrees C start with a C/10 charge. If the discharged battery voltage is less than 1.0 Volts/cell start with a C/10 charge. If the discharged battery voltage is above 1.29 V/cell start with a C/10 charge. 1.78V maximum: a single cell must never exceed this. But what does it all mean!? The input voltage to your LM317 constant current circuit must be enough to support the voltage drop across the regulator and resistor (1.47Ω), drive the required current, and exceed the maximum cell voltage. To source C/1 or 850mA to a AAA NiMH battery, whose internal resistance is at most around 120mΩ, requires (120mΩ + 1.47Ω) * 850mA + 1.2V + 1.78V = 4.3315V. I recommend at least 2V more to reduce the effects of source irregularities like regulation and noise and account for other circuit losses (like that diode you don't have yet). If you're charging 4 cells in series as your diagram indicates, you'll need at least 9.978V (ie: 12V+); 25.034V (27V+) for 12 in series, though I would worry about uneven charging.