text
stringlengths
83
79.5k
H: What does "process" mean in PVT? For timing analysers, FPGA operating conditions are sometimes know as "PVT", which stands for "Process, Voltage and Temperature". While voltage and temperature are self explanatory, what does process mean in the context of FPGA operating conditions? AI: "Process" in this case refers to the manufacturing process at the plant where they make the FPGA. It's a measure of the statistical variability of the physical characteristics from chip-to-chip as they come off the line. This includes everything from mask alignment to etching times to doping levels. These things affect electrical parameters such as sheet and contact resistance, actual transistor gains and thresholds and parasitic capacitances. These kinds of variations are unavoidable, and the P in PVT is an attempt to account for their effects in the timing analysis. The idea is to make the analysis conservative enough so that your design will work reliably despite these variations.
H: USB micro B receptacle has 6 mounting tabs. How many do I actually need to ground? This USB micro B has 6 mounting tabs. If I ground none or only 1 of them, will it ruin the signal? There is a pad for the signal ground that is separate from the mounting tabs. Fyi USB 2.0 has a max signal rate of 400 Mbps, and an effective payload throughput of up to 35 Mbps, according to Wikipedia. Is there a general best practice for lazy / layout-confined people to decide how many mounting tabs have to be grounded for a tens-of-megabits connector? If I only ground one of the tabs, should it be the one closest to the board edge (i.e. to the cable)? Thanks! AI: I think normally you don't ground the USB shield on the device side. Instead, you should connect your shield to the chassis/other shielding components, and connect your PCB ground to the USB ground. Between the USB ground and shield you can add a 1Mohm resistor in parallel with a 4.7nF ceramic capacitor. References: Cyprus Semiconductor: Common USB Development Mistakes Atmel: USB Hardware Design Considerations edit: did a little more digging, and for higher speed connections it seems like you do tie the shield to ground? I'm not entirely positive about this. How To connect USB connector shield
H: Are all voltage reference ICs able to sink as well as source current? I'm looking at the REF30xx series of precision voltage references from TI. The datasheet lists a maximum output current of 25mA. Every specification and figure on the datasheet (e.g. load regulation on pages 3 and 5) shows only positive output current (0-25mA). This concerns me, because datasheets for other devices such as op-amps tend to have bipolar current ranges (-25 to 25 mA) and figures either have an axis that goes negative for output current or else shows absolute output current (using +/- mA). Can I expect these voltage reference ICs to operate correctly in a circuit that requires them to sink as well as source current? If not, can someone recommend a buffer circuit that won't ruin the low-noise characteristics of the reference voltage? AI: Most references are designed either to source current (series references) or sink current (shunt references), not both. For your part, this characteristic is made explicit in the load regulation spec on pg. 3. Load regulation is only guaranteed for 0 < Iload < 25 mA. If your current sinking requirements are fairly small, you consider could using some pre-loading (e.g. add an additional load that ensures the reference is always sourcing current even though the "real" load is also sourcing current). If the current you need to source/sink is too great, or if the power efficiency for a pre-load circuit is not acceptable, then you could consider using a buffer. The buffer amplifier will need to have low thermal drift and low offset voltage (e.g. comparable or less than the allowed drift/error in your reference voltage). Of course you also want low noise and gain-of-1 stability. You might end up using an instrumentation amp instead of an op-amp to get these characteristics. For example, the AD620 is kind of the "old standby" when it comes to low drift and low offset voltage amplifiers. If you haven't used an in-amp before, be sure to read the data sheet thoroughly before building your circuit. You don't just hook them up like they are op-amps.
H: Possible to reliably run USB over a non-standard USB cable? I'm planning on building a device for my car that sits somewhere in the rain tray or behind the dashboard. It will use automotive connectors so that things are sealed, easily connected and disconnected, etc. I plan on having it be controllable/configurable over USB, but I still want the unit to be sealed. How feasible would it be to run the USB connection through the normal pins of the sealed connectors? It would be regular stranded conductors in the 18-20ga range, and I'd probably have to bundle, twist, shield and heat shrink them myself. Is this a reasonable approach or is there something better I should be looking at... some specialized USB connector or something? AI: I would recommend using proper sealed usb connectors. Molex makes some. They will be much more reliable than making your own. If you don't like the molex ones, searching for "IP67 usb" brings up several alternatives. http://www.molex.com/molex/products/family?key=industrial_usb_type_a_and_b_plugs_and_receptacles&channel=products&chanName=family&pageTitle=Introduction&parentKey=sealed_connectors#overview
H: Identify a cylinder or thick washer for bolts It must be obvious to you but I can't figure out the name of that part which I need to replace. It's added to the bolts that hold the PCB to the case so as to create a large enough gap between the two. It's basically a metal cylinder. AI: I've heard them called standoffs and spacers. McMaster-Carr seems to make the distinction between if they're threaded (standoffs) or not (spacers).
H: Initial experiments with an oscilloscope So I finally have access to an oscilloscope, after wanting to use one for a very long time. Now that I am in university, I can use the lab equipment. So my first question is, what should I do with this new found resource? Are there any experiments which you all suggest I should try as an introduction to this tool? Thanks, I hope this question is not too vague. AI: The first thing I would do is read some literature on how scopes work. Tektronix has a good white paper called XYZs of Oscilloscopes. Next, you should hook up a function generator and figure out how the different display controls work. This includes the Y scale [Volts] and the X scale [Time]. Once you feel comfortable with those get comfortable using the triggers. Triggers allow you to capture a waveform at a certain point based on your trigger settings. As an example, you may set the trigger to start capturing a waveform once it sees a rising edge at 300mV. If you are on single capture in "normal" (not auto) mode it will freeze that waveform on the screen until you push a button to capture another one! Being able to use triggers is something many new engineers don't master, effectively making scopes useless to them. Get good at them and you will be teaching the rest of the class!
H: Voltage Controlled Oscillators I want to know how to calculate the gain of a VCO. I've looked online and see that there exists a formula $$K_{VCO} = \dfrac{f_1-f_2}{V_1-V_2}$$ but it would seem that this result would give outrageously high gain values. For examples, for a VCO operating the MHz region, would it be realistic to see that the VCO gain value be in the range of millions as well? (This assuming that I would believe the control voltage value is in the range of 1-10 volts. Is there another way I can calculate this value? It just seems unreasonable to me to get such a huge gain factor. EDIT/ADD-ON: As an add-on example, assume I had some data for a VCO, and I used a "curve/equation fit" and the resulting equation is of the form y = mx+b. Is Kvco is this case still equal to 'm'? AI: The formula you pasted is correct and makes perfect sense. It's purely descriptive. This gain formula is a simple way of describing the VCO by its voltage input and frequency ranges. A VCO operating within the MHz range, powered by 10V will have a huge gain. For every volt on its input, the output will rise by millions of Hertz. Unless you of course design a high frequency VCO with a very fine-tuned output (e.g. from 100MHz to 100.01MHz).
H: Using an open-collector output from one IC to trigger a level change on the input pin of another IC? So my problem is simple: I have an IC that provides an output pin to alert you when some condition is met. The output pin is open-collector, high-impedance when active. I want to monitor this output on another IC (a microcontroller, specifically). Is this as simple as having a pull-up on the output so when it's "on"... the level goes low and I just monitor for the high-to-low transition? I feel like I'm overthinking this, but it's not immediately setting off a light-bulb in my head. AI: Yes, all you have to do is to add a pull-up resistor to the open-collector output, provided that the other IC input doesn't need much current it will be OK. The typical value for the pull-up resistor is 10 K.
H: Is it advisable to stay stick to Arduino IDE? Is it better to move to AVR studio (or any other better alternative?) over the Arduino IDE. Feel like it's so simple and childish. I need to know the experts idea and choice.. AI: A huge advantage of using e.g. AVR Studio is the ability to use all the libraries made for ATmega168/328 before the dawn of Arduino. FFT libraries, libraries for using some obscure IC you have purchased, rudimentary digital filters, and many more can be found on AVRfreaks and hundreds of other hobby sites. You can also write more efficient code if you learn how to utilize standard AVR libraries and study the microcontroller's datasheet (or tutorials). For simple applications, arduino code is easy to write and debug. However, sometimes you want to control the timing more efficiently. AnalogRead() needs 100µs to execute. That corresponds to 10ksps (thousands of samples per second). You can easily pump that to 70ksps if you access low-level code for the ATmega168/328. You can do all of that in the Arduino IDE, of course, but at some point your projects might become too complex, and you will want to write your own libraries with faster functions. AVR Studio might be more suited for that. Also, if you ever want to program any AVR chip other than those offered by Arduino, you will need a programmer and a different IDE. Small projects that use 1kB of code can be done on an ATtiny. You can buy a dozen of those for the price of a single ATmega328. Those chips are cheap and have most of Arduino's capabilities: I2C, SPI, ADC. You can even find libraries that add a USB HID interface! No serial drivers or anything! Personally, I first write code in the Arduino IDE, without code optimization. If it works, that code can be easily transcribed into standard C++ libraries and made more efficient.
H: Capsense behind glass Is it possible to make a capsense sensor that works through a sheet of glass? I have a working capsense sensor on one of these PSoC development boards: The buttons work fine, but when I put a sheet of glass on top, they don't work. Do I need to bond the buttons to the back of the glass to make this work? If so, do I need to use a particular type of glue? AI: Since the capacitance change will be much smaller due to the extra distance, you will need to set the sensing algorithm up accordingly for the new setup. You can get an idea of things by displaying the sense value for pressed/not pressed on the LCD with and without the glass. Then you can tune the thresholds, averaging, filtering, etc (e.g. a longer integration period is better for confirming the smaller change, but makes the response time slower) I imagine Cypress should have an app note on doing all this, Microchip have a few decent ones too if they don't have much (how useful depends on how the Cypress peripherals function, though they are likely to be very similar)
H: "USB is also a serial communication method" is this true? I'll repeat the title. Is it true that USB is also a serial communication method ? (a bit confused, someone told me @ facebook :D) AI: Most wired communication nowadyas is serial, and so is USB. Serial just means that bits are transferred one after another in time, so that you only need one wire (two if you want to do it differential, like in USB). Expensive term: Time Division Multiplex, compared to Space Division Multiplex, where different bits use different physical wires in parallel. Remember the old IDE hard disks, floppy drives and SCSI devices for instance and the flat cables they used. Serial has the advantage of smaller and cheaper connectors and cable, but needs a much higher bandwidth than parallel. Nevertheless at high speeds also parallel communication may be timing sensitive if there are delay differences between the different lines, so that all signals may not arrive simultaneously.
H: 5V-tolerant ARM We have a legacy 5V system that makes heavy use of analog sensors and various other 5V digital IOs. We're looking at moving to an ARM MCU to bring this design in line with our newer systems which are all Cortex-M3 based. I would prefer to stay with a 5V MCU so I don't lose accuracy on the ADC inputs and so I won't have to run an extra 3.3V power supply. I've been searching for 5V compatible ARM MCUs and only found the FM3 series from Fujitsu, which it seems like almost no one stocks. My questions are: Is it worth it to continue attempting to use a 5V micro or should we move to voltage-dividers for the ADC and level shifters/transistors for the digital IO? Does anyone have experience with the Fujitsu FM3 line? Are there any other 5V compatible ARM microcontrollers out there? AI: A dual 3.3V/5V power supply + level shifters will cost you more than they're worth. Resistor dividers will get you 3.3 V levels cheap, but you'll need the level shifters to go to a logic 5 V. 74HCTxx buffers will do this cheap, but they're extra space on your PCB. For the ADC it would mean a 3.6 dB higher noise level. If this is not acceptable you can probably decrease the value by better decoupling, which still will be a cheaper solution. I would go for a 3.3 V only system.
H: Inverting the logic of the inhibit pin on TI PTR08100W I'm using this TI PTR08100W switching regulatator, and want to use the inhibit pin to keep it turned off except when I am holding down a switch. According to the datasheet: The Inhibit pin is an open-collector/drain-negative logic input that is referenced to GND. Applying a low-level ground signal to this input disables the module's output. When the Inhibit control is active, the input current drawn by the regulator is significantly reduced. If the Inhibit pin is left open-circuit, the module will produce an output voltage whenever a valid input source is applied. And indeed, connecting it to ground turns off the output. But I want it to default to off when the button is not pressed. Of course, the simplest solution (and the one I use right now) is to use a normally closed pushbutton switch. But that has a couple downsides: Normally closed switches aren't as common, so I'm a bit limited in my selection of switches. I've yet to find tiny tactile buttons that come in normally closed, for example. Most switches when they wear out tend to fail open, which would turn the power on, and I want the device to fail safely with power being turned off. So how can I have it default to inhibited, and turn on when pressing a normally open switch? AI: I think your assessment that there are fewer N.C. type switches is somewhat short sighted. It is true that most TACT type switches are indeed N.O. type but many other switch types offer Form C type contact arrangements that offer both N.C. and N.O. on the same part. If the input voltage on your regulator is always present you can leverage that to your advantage with some simple additional circuitry to provide the inversion logic that you require for use of a N.O. type switch. Here is how to connect it up. Use an NPN transistor with its emitter connected to GND. Tie the collector to the inhibit pin on the regulator chip. Then connect a resistor from the base of the NPN to the input voltage supply rail. A 10K resistor may be a suitable value. Finally connect the N.O. tact switch between the base and GND. A small signal type transistor such as a 2N3904 is probably the best type to use. Pressing the switch turns off the NPN which in turn frees the GND connection at the inhibit input.
H: Mixed signal PCB layout for PSoC I am developing a PCB for an analogue sensing application. It uses the internal ADC on a PSoC3. As usual, the application is very space constrained (11mm x 21mm), so I have had to make some compromises in the PCB layout which I would not have done on a larger PCB. The board is supplied by regulated 6v, and contains two 5v linear regulators. An MCP1702 for the digital supply, and an MIC5205 for the analogue supply. The board is sensing five A1324 Hall effect sensors. Each Hall effect output signal is filtered by a 100nF + 1k RC filter. One sensor is on the PCB itself (bottom right). The other 4 plug into the right hand 6-pin connector. The chip is acting as an SPI slave, but ADC samples are always taken between SPI transactions, so the SPI should not interfere with the analogue signals. Sadly, I am still seeing some noise (about 1.5 LSB at 12-bits) on the analogue signals, and I wonder if there is anything I could have done differently in the layout to improve it. Please open the image in a new tab to see it in higher resolution. Added: Other PCB designs I have done using the MCP3208, and the same dual 5v supplies, same sensors, and same RC filters have achieved no noticeable noise at 12 bits. The ADC on the PSoC3 is a delta sigma type. This version of the PSoC is limited to 12 bits, but another part number has a 16-bit ADC (although with a lower sample rate). I do care about the noise, and would really like to push it a bit further towards 12 ENOB. The reason is not accuracy, but velocity measurement. Currently this level of noise is making it impossible to do accurate position and velocity control on a robot. Added: Schematic. Sorry it's a bit cramped, but you can just about read the values. AI: You'll always have some noise on an ADC, especially SA (Successive Approximation) types on the microcontroller die. Sigma-delta perform better for Gaussian noise, as they integrate it. Don't expect 12 ENOB from a 12-bit ADC. The controller's noise is a reason why most microcontrollers don't give you a higher resolution than 10 bit, and the AVR offers the possibility to stop the microcontroller during the ADC's acquisition, which should confirm that at least some of the noise comes from the controller. But the question is: do you care? 1.5 bit of noise on a 12-bit ADC still leaves you more than 10 bits, or better than 0.1 %. How accurate is your Hall sensor? Other components in the circuit? edit You seem to use the PSoC's internal oscillator, since I don't see any crystal on the schematic. It looks OK: you have the proper decoupling. Apart from the internal clock the only high speed part in the circuit seems to be the SPI, but you say that this will be silent during measurements. The rest of the board is DC or probably relatively low frequent like the Hall effect sensors. And it's a Damn Small™, which also helps: shorter traces will pick up less noise. Sure I could nitpick about the MCP1702, which I would rotate 90° CCW so that the output capacitor can be placed even closer to the pins, but that won't solve the problems. I only see one change in the layout which might improve your S/N ratio: In the datasheet split analog and digital ground planes are suggested for "Optimal Analog Performance" (page 10). For the rest: it's a small board like I said, that means short traces and decoupling within a few mm. So I would like to have another look at the noise's source. Prime suspect is the PSoC's clock. The PSoC can run a very low supply voltage, and that would reduce its noise. Of course it would help much if VDDA has to be lowered as well, but I didn't read anywhere in the datasheet that VDDA shouldn't be higher than VDDD. Next, the ADC. On page 55 of the datasheet it says 66 dB SINAD, that's 11 bits, close to what you get now. The A1324 datasheet gives us 7 mVpp noise on a quiescent voltage of 2.5 V. That's also far less than the 72 dB S/N ratio which 12-bit could give you. You may improve this a little bit with extra filtering. You mention the better performance of the MCP3208, but that's an ADC away from the microcontroller, and that may explain how an SA ADC can do better than a sigma-delta with the same resolution. So, the options I see: lower the digital power supply voltage and split analog and digital grounds.
H: replacement soldering iron tips? I have a soldering iron which allows the use of exchange-able tips, however I am unable to get certain tip types for my iron. Can I get a tip designed for a different iron if I match both the wattage rating and barrel size? It's a 50W iron with temperature control. AI: The answer to your questions is a 99% yes, possibly no in very rare cases such as if your iron is a specialist type that uses inductive heating or other less common method innolving specialist tips (in which case you can still probably get some clone tips) Anyway, my experience with this is a positive one - the most extreme case was ages ago when we didn't have enough soldering stations here with irons/tips for some SMD prototyping (different fittings) I used a couple of Pace hoof/micro-wave tips I had lying around with an el-cheapo iron for drag soldering TQFP ICs for a day or two until a more permanent solution arrived. The tip didn't even fit that well (it was a nasty little 35W thing with a screw to hold the tip in) but it got hot enough and the results were very good. Apart from that I've used various tips from eBay (Hakko/clone/? types) that fit my very common size of Hakko-clone iron. As Mark mentions, as long as the fitting dimensions are correct (and the size/mass isn't radically different) then all is well. So don't worry if it doesn't say "for use with ", just make sure it will fit okay. As mentioned above make sure it's not some specialist tip with some kind of heating element inside (although you will probably be put off by the price before you get to the point of checking this...) As suggested, taking a few pictures and posting measurements may help get you some recommendations on suitable tips and where to source them.
H: What is this strange long wire for in a single induction cooking unit? Tonight I dismantled one of those single induction hobs: Inside there were two PCBs. The incoming mains was wired to the top left PCB, while the other contained all the low voltage components, plus some more high voltage parts. There are two white wires connecting the two PCBs. One is short, as you would expect. The other is much longer, and part of it is covered in heat proof braid, and is held down by a loop of metal. What is the reason for this piece of wire being so much longer and covered in heatproof braid? AI: My guess is that there is a thermistor or other heat sensor under the braid. This sensor could be used as a safety device to prevent a fire if the temperature gets too high. It might even just be a thermal link that melts if it gets too hot and removes power from the hob.
H: Output filters for power supply design I am trying to develop a design for a power supply. At the output of my design is a diode rectifier with a capacitive filter output. I've been told that I should expect to see an ESR of zero or something along those lines in my frequency response, but I'm not quite sure what that typically looks like or what that would look like in my frequency response. Does the filter create a zero and how can I calculate the location of the zero? How would I know there is no additional poles added to my response as well? Is there some way I can simulate this to see what it looks like? I can provide you a general schematic of the rectifier and output capacitor filter (this is the same as my design): AI: Your output filter response should basically be the 20 dB/decade response of the capacitor. The ESR zero will depend on the number and type of capacitors you're using. It's the natural corner frequency formed by the effective ESR and total capacitance: \$ F_z = \dfrac{1}{2 \pi \times R_{esr} \times C_{out}} \$ The gain slope will swing more positive at the zero, and you'll see the phase changing as well. You can easily use a free SPICE simulator like LTSpice IV to model the output precisely (with ESRs, ESLs, etc.) and generate a Bode plot.
H: Are capacitors and inductors capable of absorbing positive power? A resistor is capable of absorbing positive power. Why wouldn't this be true for capacitors and inductors? AI: An ideal resistor dissipates (converts into heat) electrical power. They are not capable of delivering power. Capacitors and inductors both are capable of absorbing and delivering (positive) power. When power is absorbed by an ideal capacitor, all of it is stored in the form of an electric field. Likewise, all of the power absorbed by an ideal inductor is stored in the form of a magnetic field. These devices can deliver this stored energy, but cannot produce energy. Real capacitors and inductors, however, are not ideal, and will dissipate some power due to imperfections within the device (leakage within a capacitor, for example). This is why in simulations, capacitors and inductors will sometimes have very complex models to attempt to simulate real-world behavior (such as a leakage within a capacitor, which can be modeled simply with a high-resistance resistor in parallel with the capacitor).
H: L298 H-Bridge not working I have an L298 H-Bridge, but I cannot, for the life of me, get it to work. I have connected Vss to +5v, GND to ground, Input 2 to +5v, Enable A to +5v, Input 1 to ground, Vs to +5v, Output 2 to a motor terminal, Output 1 to the other motor terminal, and Current Sensing A to ground. The motor will not spin. I lack a volt meter at present (very short term, I usually do have one), so I tried tasting the wires. There is no electrical tang whatsoever (power supply does taste tangy, so that's not the problem!) This is the simplest circuit I could think of to test this thing and it will not work. Please help me! AI: It is always an immensely good idea [tm] to provide a datasheet linklike this What you describe SOUNDS OK. Do you have protection diodes? Without them it may have switched once and then shuffled off its mortal coil*. (*=made magic smoke, visible or not).
H: How to feed laptop + bulb with solar energy? I reside in Kathmandu where the current power supply is so weak one has to face between 8 to 18 h power cut per day. In order to work, I need to have continuous supply of energy for my laptop and a bulb a night. I have looked into this Q&A already and found some answers, some of which are too broad or assume I know something about electronics. In spite of my interest, I have always been very bad with electronics: I need please a case-specific and for-dummy answer. I own a Dell Vostro 1510 laptop, which will run all day long (let's assume 24 hours as I need to download data from a slow Internet connection), and I will use an energy saving bulb to light up my desk at night. From what I understand, I need a solar panel, connecting into a power controller, connecting into a battery, connecting into an inverter. How do I find out what solar panel I need? (A local store which I don't really trust, proposed I buy their most expensive model, a 60W panel) I am concerned about the battery too, in term of efficiency and environmental impact. What are my options? AI: The suggested 60 Watt panel will not be too small for you. You will also need battery storage. If at all possible run the laptop or laptop charger directly off the battery. Use of an inverter adds extra inefficincies. For (almost) best possible efficiency you may be able to supply battery power to the Vostro's actual battery connections. You need somebody who know what they are doing to do this as laptop destruction is made easier by playing in this way. To work out PV (photovoltaic) panel Wattage needed you need to know how much solar insolation is available. The marvellous Gaisma site for Kathmandhu says that the average daily sunshine hours by month, January to December are 3.42 January 3.93 February ... 4.69 5.37 5.96 5.64 5.02 4.51 4.52 4.73 3.96 3.44 December. I use the term SSH or Sunshine-Hours for what they call kWh/m2/day. One standard sun = 1000 W/m^2 or 1 kW/m^2 so in 1 hour you get 1 kWh/m^2. So in a day which has 4.5 hours of EQUIVALENT full sun you get 4.5 kWh/m^2/day. So in September in Kathmandu you get 4.52 kWh/m^2/day./ Solar panels are rated in output in one standard sun at 25 degree C with light spectrum of AM1.5. AM1.5 is the spectrum that you get from sunlight when it has passed through 1.5 x as much air mass as it would have if the sun shone directly down (eg equator at midday). You don't need to worry much about that except to note that at high lattitudes you'll get more losses at some spectral points (such as deep blue, near UV) due to longer average air paths. And at high altitudes (such as Kathmandu) you'll get less losses for eg blue. SO to work out what energy per day you'll get from a panel in good condition and which is optimally pointed relative to the sun you take the max power wattage rating = Wmp and multiply it by the sunshine hours (or kWh/m^2) from gaisma for your location and month. If the panel gets hot (as happens) output will drop somewhat. (Maybe 10%). A panel fixed in one position but optimised for lattitude and time of year will get perhaps 70% - 90% of absolute peak achievable output. In Summer you will probably get less of max possible as the sun swings through more than 180 degrees during the day (240 degrees in Kathmandu in June) and a fixed panel doesn't work well when the sun is behind it :-) - or even at +/- 90 degrees to the direction it's facing. Most of the energy occurs during the middle of the day so it's probably not worth chasing every last bit. SO How much energy can you get? If you have N SSH/day and a panel is rate at Wmp = W Watts then energy per day max = Watts x hours = W x N Watt hours. If you want to equipment for H hours per day then the energy provided by the panel will be spread over H hours so the load you can operate for H hours from a panel of Wmp = W and SSh = N = energy from panel / H = W x N / H Watts load Finally, some of the energy from the panel will be lost when stored in a battery and some of the battery energy will be lost in converting it to drive the load. If you specify the overall ratio. k = (Energy into load)/(Energy from panel) = end to end energy efficiency (0 - 1) Energy into load = Energy from panel - losses into battery - losses out of battery. then you get Load wattage able to be operated for H hours per day from panel of Wattage Wmp with N SSH = N hours/day of full sun equivalent Load Watts = Wmp x SSH x k /H or by rearranging Required panel Watts = Wmp = Load_Watts x H /SSH /k Example: (1) Given 60 Wmp panel and 5 SSH and k = 0.66, what load can I run for 8 hours / day? Load Watts = Wmp x SSH x k /H x = 60 x 5 x 0.66 /8 = 25 Watts continuous for 8 hours from a 60 Watt panel. (2) Given a 20 Watt load and 10 hours/day operation, in mid winter with SSH = 3.4 hours/day, what size panel is needed. Required panel Watts = Wmp = Load_Watts x H /SSH /k = 20 W x 10h /3.4 / 0.66 = 88 Watt panel These are best case figures. Non tracking of the sun adds 10% - 20%. Hot panels, dirty panels, worse than assumed matching of panel to battery or battery losses etc lead to larger panels or smaller loads or less hours of operation. Calculating k I used "k" as a measure of panel rated power to actual delivered power. (Actually energy_out/energy_in but power and energy are somewhat interchangeable here to make what is being said clearer. Power is NOT equal to energy and usually using one term in place of the other is both "plain wrong" and also misleading as a bonus. Details follow but - PV panel Wmp is rated at optimum V & I.. When loaded below this point I will increase slightly as V drops. A nominal 12V panel is usually rate at Vmp = 18V !. For lead acid you need about 14.4V max on battery for equalisation. Most output is taken at 12 - 12.5 Volt. Even if your panel was optimised to work at 14.4V then if battery output is at 12.5V average the efficiency = 12.5/14.4 =~ 87%. Add a diode with 0.6V drop (low) and you get 83%. *Panel to battery * The battery will not store all input energy - some will be lost in secondary cheimcal reactions, resistive losses etc. Losses will be a greater percentage of input energy at higher charge rates as voltage drop from R_internal will be a greater % or V_vbattery. and as capacity approaches 100% (as Vin and Vo/c diverge due to chemical and other processes. A lead acid A Lithium Ferro Phosphate battery has a 99%+ current charge efficiency (no side reactions - what you input is what you get out - and this **improves with use. A Lithium Ion cell will probably be similar but tbd. a lead acid battery is good by many standards - over 90% at slow rates of charge over much of range. NimH is worse than lead acid. Stated and achieved rates both vary widely but as good as 85% may be achieved and much worse can be managed under heavy charging and worse again close to full capacity. NiCd may be similar to NimH. Overall panel to battery with voltage mismatch (say 80%-85%) and battery acceptance losses (say 85% overall for lead acid leads to say 0.85 x 0.85 = 0.66 - 0.75 range. Battery in to battery out. A say 12V lead acid battery will charge at from 12V or less (0 capacity) to 13.8V terminal voltage (float) or 14.4V on boost for equalisation. Say mean charge voltage = 13V. Vout to load depends on C rate but is say 12.5 to 12V. Not much capacity below 12V and best unused if longer cycle life wanted. Say Vout = 12.25V average. So Energy out/ Energy stored = ~~ 12.25/13 = 0.94. Probably 90%-95% in practice. Battery to load: Energy actually delivered to load wrt energy out of battery depends greatly on what is in the path. Run a light bulb and what you see is what you get (literally) + heat. Run an LED or a number of them and it deep-ends muchly on your driver. A good buck converter may give 99-95% efficiency input to load. A not unusual one may give 80%-90% and less is known. A boost converter will usually be slightly less efficient than a buck converter with equal effort but say 85% mean with 80%-90% reasonably typical. With great care and choice of LEDs and battery technology you can get 90-95% for most of LED drive and very close to 100% across part of the range. Fine details of that may be available from me as a paid consultancy :-) - or buy one of my lights in due course :-). If you are running eg a Dell Vostro [tm] - from a 12V battery via a 12VDC to 110 VAC or 230 VAC inverter and then using a Dell switching power supply to provide typically 110/230 VAC to 19VDC to the Dell which then charges the internal battery via a buck converter and then uses a switching regulator to provide internal voltages. then you shouldn't be !!! :-) If you figures even say 85% D C-AC, 85% AC-DC, 85% DC19V-> 85% say LiIon charge then you get 0.85 x 0.85 x 0.85 = 61% efficiency. The internal battery to internal voltages follows this. Far far better is to store the panel energy at a voltage that falls in the Dell battery voltage range and apply this voltage at the battery terminals (NOT the charge input terminals) of thr Dell. You save about 40% energy losses or get about 100/60 = 1.66x as long run time. Thats as effective as getting a 100W panel for the price of a 60W panel AQND not having to pay for any extra batt5ery capacity. Obviously you want the supply you feed to the Dell internals to be as stable as the battery would have been (preferably better in some cases). If you allow eg the Dell Vbattery input to rise to the PV panel full sun unloaded output of 20V+ then you may be needing a new PC. Simple means can protect against this. Overall: If you accept the above figures then overall you get PV Wmp x 0.7 Panel out to battery out x 0.7 say if you go DC-AC-DC as you shouldn't. So k = say 0.5 with a mains inverter and say 0.7 if you use battery DC direct into laptop battery terminals. The 2nd is possibly a bit generous - say use 0.66 for starters. In summary - with a mains inverter you need twice as much PV Watts as you may expect from load calculations. With direct feed to laptop battery you need 50% more PV watts than you may expect. PV to LiIon direct: With due care you may be able to feed the PV panel voltage directly to a suitable LiIon charger that charges the laptop battery directly. End results could be reasonably good. Laptop internal charger use? : Your laptop MAY have such charger built in. Or not. If so this could be a very efficient way to operate. Some modern laptops with a 19V charger spec will not run at much under 18V and some demand nearly the full rated current to operate. eg a 19V 4A power pack may not work if under 3A is available. However - others may work from 19V down to near 12V and MAY be tolerant if current is less than may be desired. This probably works with laptops with 3 cell batteries of about 13.8V full voltage (14.5V up needed) or 3ScP arrangements (3/6/9) or 2 cell laptops (rare) with Vbattery = 8.4V max or 2SxP arrangements (2 4 6 8 ...). 4 cells in series (Vmax = 16.8V) and 4SxP arrangements 4 8 12) probably want 18V or more to charge. I have a HP netbook that originally has a 4 cell 4S battery. I bought an "extra capacity" battery and was surprised to see it had 6 cells in a 3S2P arrangement so that terminal voltage was lower. The internal charger and power supply was equally happy with either arrangement. Whether a D ell will allow 4S or 3S arrangements and lower Vin is TBD. I am told of laptops that will charge from 12V. Many won't. Such laptops will have an internal buck-boost chargers and so allow 3SxP or even 4SxP batteries with 12 Volts in. It's good luck if you have one. Rushing - hopefully will come back and tide up later.
H: Voltage/Amperage load rating I'm a newbie when it comes to electricity, and this has been bugging me since like 9th grade when I first learned about V/I/R/P combinations, and to this day I still can't wrap my head around the concept. I understand about the mathematical formulas, but what I'm having trouble with is the meaning of V/I when it comes to wiring things. I'm thinking of starting a small project wiring up a solar panel to computer fans just to learn about this. Solar panel is rated at DC 6V/1W Fans are rated at DC 12V/160mA What do these rating mean? Does this mean that the fans can only operate if the source voltage is 12V? What if the source is under-voltage like 6V? Will the fans not power on at all? What if the source is over-voltage like 120V? Will the fans start catching fire? What if the source is just slightly over/under like 13V or 4V? If my solar panel is rated at 6V/1W (~160mA max), and I connect four fans in parallel, which means each fan will receive ~40mA, does this mean that the fan will not spin? Or will the fans spin at 1/4th of the speed? Lastly, if my solar panel is only 6V, and fans are operatable at 12V, does this mean that I have to connect two solar panel serially? Can I put a resistor between the panel and fans to increase it to 12V? AI: How a device will respond to the wrong voltage will depend much on the type of device. A resistor for instance getting half the voltage will dissipate 1/4 the power, and that's it. For motors like the fan it's different. A slightly lower voltage, like 10 V, will probably not be a problem, but at 6 V it may not start. Same here: it only get 1/4 of the required power, and that may be insufficient to get it going. But it may run if you would hand-start it. 120 V will kill it. Final. It's 100 times the rated power and it will burn, possible burst open with a small explosion and some smoke. A slightly higher voltage than rated for won't do too much harm, but I would avoid it, again for the same reason: power is proportional to voltage squared, so 10 % higher voltage will give 20 % higher power, and since much of the load is resistive it will get hotter. If your solar panel can supply 160 mA, and you would connect four 160 mA loads in parallel to it it would get overloaded and the output voltage would sag. For small load changes the graph shows that the voltage won't vary very much, but at 4\$\times\$ overload you'll be in the higher part of the graph where the voltage will decrease quickly with increasing current. The fans would get too little voltage and due to the limited current won't spin. If you need 12 V and have 6 V solar panels then placing two of them in series is indeed the right thing to do.
H: AC, DC, what else? Aside from alternating current and direct current we already know, do you still other type of current flow? Also, is it for that type of current flow to exist? or there are only 2 types of current flow in this universe (ac,dc) AI: In the DC/AC class there's nothing else. The criterion is frequency, and that can be zero (DC) or non-zero (AC). Current is displacement of electrical charge, and that can be in different forms: electrons carry a negative charge, but cations for example a positive charge, so cations going the same direction as electrons will have a current with reverse polarity. That's another way to look at different kinds of current, but has nothing to do with the frequency. So it's just AC and DC.
H: Importance of constant collector current (BJT) I was reading these notes and I have a couple of questions. What is the importance of the constant collector current in varying voltages across collector and emitter? How does it really relate/help amplification? Also, why don't we want a varying collector current? What is so important in the linear region? AI: For most "amplification" applications with a BJT, the collector current does vary. In fact that is usually the output of a BJT amplifier, although often a resistor is used to convert this varying current to a varying voltage. BJTs have the property that the collector current is largely independent of the collector voltage over a wide part of the operating range. This can be useful in making current sources/sinks or to send a current signal to a different part of the circuit that is referenced to a varying voltage from the BJT. In the current source/sink application the collector current is intended to be constant, but otherwise most of the time it is the collector current that is deliberately varied by the circuit as a function of the input. I can't guess where you got the strange idea from that in general we don't want collector current to vary. Provide a reference and maybe we can explain why in that particular case collector current should be constant (if that is even true). Added in response to link in comment below: That is just a rough plot of how a BJT responds with collector current as a function of collector to emitter voltage with presumably a constant base current. It is not showing how a BJT is used in a circuit or makes any comments about what we want a BJT to do. It is simply telling us what a BJT does. While that plot is correct enough at the rough level of detail it is showing, it is not saying collector current isn't varied in a circuit or that constant collector current is desirable somehow. One important characteristic of a BJT it is not showing is how the collector current varies as a function of base current. The plot is presumably at a single fixed base current, although that is not explicitly stated. Here is a more illuminating plot (copied from http://www.physics.csbsju.edu/trace/NPN.CC.html): Each trace on this plot is at a different base current. In this case the base currents go from 10 µA to 80 µA in steps of 10 µA. The result from the lowest base current is at the bottom and the highest at the top. What you should really be doing is flipping this around in your mind. Given the plots show what a BJT does (whether you think it is desirable or not), how can you use these characteristics in a circuit to achieve a goal? Start by looking at a simple common emitter amplifier. There are various configurations a BJT can be used in a circuit, but the common emitter amplifier is probably the most conceptually obvious, performs a clearly useful function, and is used a lot. Sometimes there is a lot of stuff around the transistor to obscure how it is used in a circuit. Most of that is usually to set the DC operating point in the right place. However, the main characteristic of a common emitter amplifier is that the input signal is fed into the base such that is causes small changes in base current. By the nature of how a BJT works as can be seen in the graph above, this causes larger changes in the collector current. That is then harnessed to make the output signal in the form required by whatever is downstream. Often we want a voltage out, so putting a resistor in series with the collector causes a varying voltage accross the resistor as a function of the varying collector current. You can look up common emitter amplifier yourself to get a lot more detail on this. Another common BJT topology is the emitter follower. There is also common base and others that you will see less and that may not be as obvious without more careful thinking. If you plan to design circuits with BJTs, it's a good idea to learn these, why they work, and what they are good for.
H: What's passive about the passive sign convention? I've heard and read about the passive sign convention, but don't really understand its meaning and importance in solving electric circuits. Is this because of conventional current which flows opposite electrons or is it something else? AI: The passive sign convention is necessary to determine whether a circuit element is dissipating power, like a resistor, or providing power to the circuit. To calculate an element's power using P=VI you have to measure the voltage across the element. Suppose you use a voltmeter and you connect the red lead to one terminal of the element and the black lead to the other terminal...by doing this you have designated the terminal with the red lead as the posiitive "+" terminal. The passive sign convention says that you must measure the current entering the positive terminal and multiply by the voltage measurement to calculate the element's power. If the result is positive the element is dissipating power, if it is negative the element is supplying power to the circuit. Of course, the choice of where to put the red lead is arbitrary. But if you reverse the connections and measure the current into the other terminal, then the signs of both the current and voltage will change and their product will still have the same sign. If current is actually flowing out of a terminal then the equivalent current flowing in to the terminal is a negative value.
H: Collector current in linear region We all know that when the transistor is in its linear or active region, collector current does not increase further. At this point, the base collector junction is reverse bias. But how come there is still a collectr current flowing given the fact that the B-C junction is reversed biased. Isnt it when a diode is in reverse bias, it blocks current, but how come in this setup above, there is still collector current?? Also why does the current doesn't increase any further? AI: Your question is about the fundamental operation of a BJT. Surely there is much written about that out there. Briefly, C-B-E is a sandwich of three semiconductors of opposite polarity doping. However, what makes a BJT more than just two diodes in series pointing in opposite directions is that the base region is so thin that the depletion region of each junction extends to the other junction. The collector is still within reach of the emitter, if it weren't for the base region in between with all its carriers depleted. A little bit of externally applied base current injects carriers into the base region, which now allows current to flow accross it between collector and emitter. Due to a whole bunch of semiconductor physics you should look up elsewhere, a few carriers in the base go a long way. This is where the transistor gets its gain from. You inject a few carriers into the base (provide a small base current) and that lets a lot of carriers conduct (allows a larger current to flow) accross the otherwise depleted base region between collector and emitter.
H: Output Impedance of a Digital Output In High-Speed Digital Design, Dr. Johnson illustrates an example of calculating the output impedance of an IC (page 48.). He uses VOL of 0.15 V and VOH of 4.32 V (@ Vcc = 4.5 V) with an Io of 4 mA to compute a typical low state output resistance of 37 Ohm and 45 Ohm for the high state. In both calculations the current was 4 mA. My question is, is this result only valid for a current draw of 4 mA? How would I utilize this calcuation in the real world? For example, I'm using NC7WZ16 buffer but plan on putting a series/source terminator at the output. But before I decide on the value of the source resistor I need to know the output impedence of the chip. The datasheet lists this at a Vcc of 3V: VOL (typ.) = 0.16V @ Io = 16mA. This gives as Rout as 10 Ohm. But, again, is this result only valid for Io of 16 mA? In a typical design today the inputs are very impedance and so I believe that the current draw will be minimal. Similarly, for the high-state, the impedance is ((3-2.75)/16mA) = 15 Ohm. So does the output impedance change with current draw or does it stay the same and I can utilize the above results? AI: The output impedance varies a bit with current, but only slightly, so you can use the value given in the datasheet for higher currents too. (Note that the 160 mV is a typical value, and that the value may be as high as 400 mV. Then the impedance will be 25 Ω, so it's not precise anyway.) This graph is from the ATmega64 datasheet, and shows output voltage versus sourced current. If the output resistance would be constant we would have straight lines. They're slightly curved, but the difference in resistance is far less than the tolerance given in the datasheet.
H: What problems could occur when chaining 40 shift registers? I'm planning on chaining together 40 x 74HC595 shift registers. The whole chain of 74HC595s will be controlled by a 5 V microcontroller, which will generate the SDI, CLOCK & LATCH signals. Each shift register and the microcontroller will have its own PCB, as illustrated in the diagram below: Because of mechanical constrains, the distance between each shift register will be of about 30 cm (12 in), so the control signals will travel along a distance of aprox. 12 m (40 ft). Besides that, the whole system will be mounted in a very noisy environment (near fluorescent lights, mains wires etc.) My concern is that the control signals will be very noisy and the shift registers might output the wrong things. I was thinking of: Using a buffer IC on each board, to buffer the control signals. Which one would you recommend? Using shielded cables between the boards for the signals Lowering the CLOCK frequency as much as possible. I only need to update the registers' content a few times a day. Are the above solutions a good thing to do? What else can I do to keep the (potential) noise in the signal wires to a minimum? AI: Use Schmitt-trigger buffers at the inputs of each board. They will clean up the signals so that any noise won't give false pulses on the clock, for instance. The 74LVC3G17 is a triple non-inverting buffer. Also, pass the buffered signals to the next board. Otherwise all inputs would be parallel and you may exceed the fan-out of the driving microcontroller (I'm especially thinking of the total capacitive load). The daisy chain of clock and latch signals will give a ripple delay throughout the chain, but the data will do so as well, and you plan to go for low speed anyway.
H: Separating the Grounds for 2 Chips I am working on a design that requires Two Chips - Energy measuring chip (for analogue measurement) and a MCU (for connecting to a communication peripherals, and connected to a PC.) Both Chips is to be powered by a 3.3V DC supply. But the ground for both chip has to be different. How can I possibly go about that? Please refer to page 3 of ADE7878 Eval Board Power supplies. I intend to use a SMPS for this design. Thanks a lot. AI: In a production design, you would use an isolated DC-DC converter to transfer power from the microprocessor domain to the metering domain. You can purchase these as pre-built modules from any number of vendors. Make sure that the isolation rating of the converter is sufficient for the mains voltages you're dealing with. For prototyping, two separate AC-input power supplies can be used.
H: Troubleshooting why ADuM4160's internal regulator gives 5 V instead of 3.3 V The problem I have with my ADuM4160 circuit is that I'm getting 5 V from VDD2 pin while getting roughly 3.3 V on pin VDD1. Have I blown the chip? It doesn't make sense for the VDD2 to be the same voltage as what I am feeding to the VBUS pin, right? Could it be the bypass capacitors I am using? The datasheet says they should be low-ESR, but I'm unsure where to get them from. Most capacitors that I have found are SMD. I'm using cheap eBay-sourced ceramic capacitors. The author of the circuit told me to check my supply for oscillations, but I'm unsure how. I do have a digital 40 MHz scope. The only difference in my circuit is that the downlink is powered by my do-it-yourself LM338 power supply. Since my device has its own supply I don't need the switch-mode regulator. BTW, the VDD1 and VDD2 are the outputs of internal regulators. I'm testing this on a breadboard: Here's an image of what I see on the VBUS2 pin which is coming from my LM338 PSU. I assume that this is normal and nothing to worry about, right? I don't see anything like the following when I turn up the volts per division. I can really see the oscillations when I turn the time base higher. I see something similar on the VDD2 pin as well. AI: The datasheet says that the \$V_{DD1}\$ and \$V_{DD2}\$ behaviour is the same: if \$V_{BUSx}\$ is connected to 5V, the signal at \$V_{DDx}\$ should be the 3.3V output of the LDO. If \$V_{BUSx}\$ is 3.3V, directly connect \$V_{BUSx}\$ and \$V_{DDx}\$ together. Ceramic capacitors are by nature low-ESR, and using a linear regulator to feed the \$V_{BUSx}\$ signals should be fine. You should scope all the \$V_{BUSx}\$ and \$V_{DDx}\$ signals with a short-ground probe, AC-coupled with bandwidth limiting turned on to see if there are any disturbances in the bus voltages (ballpark: anything in excess of 1% of the DC level may be trouble). Check multiple time scales (10s of ms, 10s of ns, etc.). Some ceramic decoupling capacitors (100nF or so) close to the IC on the \$V_{BUSx}\$ voltage pins wouldn't hurt.
H: What does "net current" mean? I am sorry if this sounds to be a silly question. Maybe I am having trouble interpreting the expression in english since it is not my first language. I would like to know what the expression "net current" means. Example of usage: "KCL states that no net current can flow into a node". AI: I would like to know what the expression "net current" means. It's similar to the notion of "net force". If you consider all the forces acting on an object, the net force is simply the vector sum - it's the resultant force. Similarly, the "vector" sum of currents (in is positive, out is negative) gives the net current into the node. (If you reverse the sign convention above, you get the net current out of the node.) KCL simply says that the net current into (or out of) a node is zero. As an analogy, think of a bank account. Cash deposits in to the account are positive, cash withdrawals out of the account are negative. The net money in to the account is just the "vector" sum of deposits and withdrawals. If "KCL" applied to this bank account, the net money in to the account would be zero which means that whatever amount is deposited is also withdrawn.
H: Comparing A to Kwh, can it be done? I have read this page: How to convert amps to kilowatts I often purchase electricity from a supplier to power computing equipment within a data centre. Some sell me 10 amps, some sell me 2.16 kWh. When they say 10A, they essentially mean I can draw up to 10A of power (at a usual 240v, single phase AC), continuously, each month (as I am billed monthly). If I purchase 2.16kWh, that means constantly, for a whole month (again it comes from 240v single phase AC feed). So even though that article linked above states you can not compare amps [*1] and kWh directly, as long as I am using them in the same frame of reference (i.e. the single phase, 240v), can I directly compare them when making my supplier price comparisons for those selling to me as 10A and those selling to me 2.16kWh (assuming they are both providing 240v single AC feeds [*2]) ? [*1] I understand that amps are an instantaneous snap shot of current, so in this scenario I am really talking about continuous amp hours [*2] All throughout I have assume a generic power factor of 0.9, just in case you wondered about my dodgy maths :) AI: "10 amps" and "2.16 kilowatt-hours" are not the same units and can't be directly converted. An amp is current, a kWh is energy. However, "10 amps at 240 volts for 1 month" is energy. Google will happily convert the units, if you ask it "(10 amps * 240 volts * 1 month) in kwh": 1,753 kWh. Coming from the other direction, since kWh is energy, it doesn't make sense to talk about using 2.16 kWh "constantly, for a whole month". 2.16 kWh represents the total energy usage, not a rate of power consumption. You could use 2.16 kWh up in a minute or in a month or a year.
H: What is meant by relative voltage? Suppose you have a circuit ,you are told that the voltage at point 2 relative to point 1 is -90V, the voltage across R2 is -30V and V0 is 200V. What is the meaning of voltage at 2 relative to 1? Does it mean the potential difference between 2 and 1 as in (voltage at point 2) - (voltage at point 1) or is it vice versa? Does voltage at a point relative to another mean a voltage drop between those two? And what roles do the negative voltages at either points play? AI: Voltage is always relative. When you just hold one probe of your DMM to the + of a battery, for instance it will display 0 V, like it's saying "this is nothing, what do I have to compare it with?". Any circuit should have a ground (yours hasn't). Ground is your reference everything else is compared to. Usually that's the negative terminal of the power supply. It's only by calling ground 0 V that the supply's +12 V makes sense: it's 12 V higher than ground. If you measure 2.7 V in your circuit the "referenced to ground" is implied, unless indicated otherwise. That's the case when you say "relative to X", then you don't use ground as a reference, but the voltage at X. For DC normal arithmetic applies: if A is +5 V relative to ground and B = +12 V relative to ground then A is -7 V relative to B.
H: Multiplexing two 7-Segment displays (Ghosting issues) I am currently working on a simple scoreboard using two 7 segment displays, a shift register (74HC595N), two PNP transistors (2N3906) and an arduino uno. Each 7 segment display is common anode, however one display is Blue with a forward voltage of ~3.3V, the other display is Red and has a forward voltage of ~2V. I am using 220 Ohm current limiting resistors in series with the shift register and the cathodes of the LEDs. (I suspect this might be part of my problem as each display has a different voltage drop across the LEDs.) I am attempting to multiplex the displays however I am experiencing issues with ghosting. I am using timer1 on the arduino in order to facilitate this behavior. I have set up the timer with the following code: // Setup TIMER2 /* First disable the timer overflow interrupt while we're configuring */ TIMSK2 &= ~(1<<TOIE2); /* Configure timer2 in normal mode (pure counting, no PWM etc.) */ TCCR2A &= ~((1<<WGM21) | (1<<WGM20)); TCCR2B &= ~(1<<WGM22); /* Select clock source: internal I/O clock */ ASSR &= ~(1<<AS2); /* Disable Compare Match A interrupt enable (only want overflow) */ TIMSK2 &= ~(1<<OCIE2A); /* Now configure the prescaler to CPU clock divided by 128 */ TCCR2B |= (1<<CS22) | (1<<CS20); // Set bits TCCR2B &= ~(1<<CS21); // Clear bit /* We need to calculate a proper value to load the timer counter. * The following loads the value 131 into the Timer 2 counter register * The math behind this is: * (CPU frequency) / (prescaler value) = 125000 Hz = 8us. * (desired period) / 8us = 125. * MAX(uint8) + 1 - 125 = 131; */ /* Save value globally for later reload in ISR */ tcnt2 = 5; /* Finally load end enable the timer */ TCNT2 = tcnt2; TIMSK2 |= (1<<TOIE2); On timer overflow the following function executes: ISR(TIMER2_OVF_vect){ // Turn off the active display if(active_display == 0){ digitalWrite(BLUETRANS, LOW); } else{ digitalWrite(REDTRANS, LOW); } delayMicroseconds(1000); // Toggle Display active_display ^= 1; // Shift out screen bits if(active_display == 0){ displayDigit(blueByte); } else{ displayDigit(redByte); } // Turn display back on if(active_display == 0){ digitalWrite(BLUETRANS, HIGH); } else{ digitalWrite(REDTRANS, HIGH); } // Reload the timer TCNT2 = tcnt2; } I do not fully understand the use of Timer2, so any help there would be appreciated as well. I understand that the timer counts up until the specified overflow value and then executes the ISR. However, my attempts at reducing the refresh rate of the two displays seems to make my program un responsive. I believe I am correctly multiplexing the display: Turn off active display Shift bits into the shift register for other display Turn on other display Unfortunately I cannot seem to reduce the ghosting in the red display (the ghosting does not seem to occur in the blue display). Any help would be greatly appreciated! I understand that I may not have included all relevant information, so ask and you shall receive! Thanks! EDIT 1 Thanks to Justing I now have a much better grasp on how Timer2 works on the Arduino. Thank you for that. Unfortunately even at 60 Hz I can see a significant ghosting effect, along with a nasty, noticeable flashing as it alternates between the displays. With my new knowledge of Timer1 I was able to successfully increase the refresh rate up to 244Hz. My current circuit follows this basic design: As stated previously my current limiting resistors are 220 Ohms. Could the differing forward voltages between the BLUE 7-seg display and the RED 7-seg display be causing this ghosting issue? Again, the only digit experiencing this issue is the RED display, the display with the lower forward voltage (2V [red] vs 3V [blue]). If this is indeed the cause would using an additional 8 resistors for the second display fix this issue? I was hoping I could get away with fewer resistors to save myself some soldering in the future but if it fixes this display issue then it would be worth it. Any more ideas guys? Thanks! EDIT 2 I am posting my displayDigit function: void displayDigit(byte screen){ // Shift data into the shift register digitalWrite(latchPin, 0); // LATCH LOW TO SHIFT shiftOut(dataPin, clockPin, MSBFIRST, screen); digitalWrite(latchPin, 1); // ENABLE SHIFTED BITS } EDIT 3 Could my 2N3906 PNP transistors be to blame? It seems to me that while the transistors allow the display to turn on very quickly, turning them off occurs much slower. Allowing the red digit to "see" the previous digits value. However, this does not explain why there is no ghosting on the Blue display. Can I easily "pull-up" the anode of the display with a resistor to aid the transistor in its "off" state? "Off" here is technically Vcc (5V) because of the Common Anode design. The display operates when the anode is pulled to ground. FINAL EDIT My thanks go out to Myforwik for providing the most succinct and also the most helpful answer to my question. My ISR now looks like this: ISR(TIMER2_OVF_vect){ // Turn off the active display if(active_display == 0){ digitalWrite(BLUETRANS, HIGH); } else{ digitalWrite(REDTRANS, HIGH); } delayMicroseconds(1000); // Toggle Display active_display ^= 1; // Shift out screen bits if(active_display == 0){ displayDigit(blueByte); } else{ displayDigit(redByte); } // Turn display back on if(active_display == 0){ digitalWrite(BLUETRANS, LOW); } else{ digitalWrite(REDTRANS, LOW); } // Reload the timer TCNT2 = tcnt2; } It turns out that I was overlooking some of the most fundamental parts of my code. Both screens were on at any given instant, plaguing me with this ghosting issue which wasn't really a ghosting issue at all. Many thanks to justing who provided possibly the best explanation I have ever seen on how to set up the timer on the Arduino. Mike DeSimone and Oli Glaser also helped a great deal when it came to troubleshooting my circuit. I cannot express to you guys how much I appreciate your help! While my actual issue was extremely basic, I hope all of the responses found on this page can be of use to someone, somewhere in the future! Thanks again! AI: The problem is you have on and off mixed up. The pnp transistor will be at cutoff when the output is high, not low. So you are turning both of your displays on during the 1000us wait.
H: Transmitting pulses via RS485 I will have an IR led / photo transistor based reflective sensor, measuring rotation speed of a wheel, producing pulses using a comparator with hysteresis. The pulses will be counted by micro-controller. The problem is, the sensor has to be ~20m away from micro-controller and a big induction motor might be near the cable. So, I thought - what if I put a couple of RS485 transceivers on both ends of a cable, drive a Driver Input pin on the sensor side and connect Receiver Output to the micro-controller external interrupt pin? Is this a proper solution to my problem? AI: Yes that will work fine. Technically, it's RS-422 if the transmission is one-way, with the driver always enabled like this. Be sure to put a termination resistor across the receiver input pins.
H: Gyro for Arduino [Background] I've assembled a quadrocopter and now I'm going to design a flight controller for it, using Arduino. I can not use any of flight controllers, which you can buy in the store, only hand-made. So, I really want to find the EASIEST hardware solution for it. [/Background] The only gyro I've found at local stores is digital LSM303 DLH. But I doubt hardly about one thing. At my local store it's being sold in QFN package. I've found this gyro being sold with a breakout board. I don't get it, why are there some other components on it? Can I just connect wires from the chip to arduino and read the values? Or maybe you can advice some other gyro? AI: The components on the L3G4200D breakout board you linked to are: 2 I2C pullup resistors (which you need for I2C) 2 decoupling capacitors, which you need for providing proper power to the chip a PLL low-pass filter, which is required for this gyro So this breakout board already is the minimal solution you can get for this chip. And since most (if not all) gyros you can get are in leadless packages with (typically) a 0.5mm pitch, you don't really want to solder wires to them manually. Using a breakout board is way better, and you get mounting holes for free :) (Dave Jones demonstrated in this EEVBlog episode how to do this with an accelerometer, if you really want to)
H: USB cable as +5v vcc source Possible Duplicate: Powering a breadboard with USB I was wondering if it is possible to cut open a usb cable, and use its "sub" wires to get its 5v power and gnd. I am currently doing a digital circuit school project, and would like to power my bread board (protoboard) using the vcc and gnd of the usb. Is this possible? I have read that the usb cable has atleast 4 wires, red for +5v and brown for gnd. AI: Yes, you can do that, but wouldn't it be neater to leave the cable as is and use a USB socket or plug? Then you just connect the 2 power pins to your circuit. This plug allows you to enter a common USB cable, and go on from there, connecting wires to just the +5V and ground. Then you're no longer constrained by the limited length of USB cables. If you do want to cut the cable then usually red is +5 V and black (not brown) is ground, but measure the voltage on the wires to be sure. Make sure that the data wires D+ and D- (usually green and white) are left open. Note that USB 2 only allows you 100 mA, and a 10 µF capacitance.
H: "is not declared" error in Verilog I created a simple 8-3 encoder module (called encoder8to3) to replace a few repeated instances of Verilog code. I then tried to use the module in levers2.v. I get the following error when I run a Verilog test file: ERROR:HDLCompiler:69 - "C:/Documents and Settings/me/xilinx projects/wQCBG/levers2.v" Line 132: is not declared. I see all sorts of examples of how to create modules, but not many on how to use the ones that are created. All I find are snippets of the use and not the declaration. Will someone tell me how to properly declare encoder8to3 in levers2 please? EDIT - codez, levers2, pared down. module levers2( input [7:0] LL, input [7:0] RL, output reg [10:0] DIVISOR, output reg TD_ANY_MARK, output reg TD_NUMBERS, output reg TD_ONE_MARK, output reg TD_DONT_DISENGAGE, output reg FAULT ); (snip) reg [7:0] x; always @(LL, RL) begin (snip) FAULT <= 0; /* encoder8to3(LL, x, FAULT); (snip) The encoder module itself is: module encoder8to3( input [7:0] A, output reg [2:0] B, output reg F ); always @(A) begin F <= 0; if (A[0]) B <= 0; else if (A[1]) B <= 1; else if (A[2]) B <= 2; else if (A[3]) B <= 3; else if (A[4]) B <= 4; else if (A[5]) B <= 5; else if (A[6]) B <= 6; else if (A[7]) B <= 7; else F <= 1; end endmodule I'm learning, and I'm just having some trouble with Verilog syntax. So somehow, I need to tell levers2 (the first piece of code) where to find encoder8to3 or perhaps, like c, just warn the compiler that the module will eventually be used. AI: You need to give the instance a name (see below) It also looks like you may be trying to declare it in an always block, this won't work. Declare it outside any blocks (e.g. at the top of the module) Also, using the "connection by name" (or named association) method of instantiation rather than "connection by order" (or positional association) is less prone to accidental errors from getting the order wrong, especially with modules with many ports. So the instantiation for connection by name would be encoder8to3 enc_instance (.A(LL), .B(x), .F(FAULT)); With this method it could be written like this and still be correctly connected: encoder8to3 enc_instance (.A(LL), .F(FAULT), .B(x)); Whereas using: encoder8to3 enc_instance (LL, FAULT, x); would connect B to FAULT and F to x. Here's a reasonable pdf on modules and instantiating them. I agree good Verilog tutorials are quite thin on the ground (compared to something like C) so starting out can be a bit bewildering. If you can find a copy at a reasonable price, I do highly recommend the Pong Chu book "FPGA Prototyping with Verilog Examples" I mentioned in my answer to your other question, as well as the focus on synthesis I mentioned, it goes through everything you need to start writing decent code, and is very clear and concise. There is also a google mailing list for Verilog you might find of use, and fpga4fun has some good tutorials and a forum. And of course there is here :-) EDIT - about where to declare the module: The instantiation only connects the ports together, so where you declare it (outside a block) doesn't matter. If you want to do something with this module inside the always block use some intermediate logic. Create a couple of registers, use the always block to manipulate them as desired, then tie these to the instantiated module ports (in the instantiation). The way you have it at the moment, the instantiated module can be seen as in parallel with your module rather than inside it, as it just connects directly to the inputs and output of the module. Have a look at the RTL schematic to see what is being generated by the code (under synthesis in the design tab)
H: Need a device that can take single input and covert to a keyboard key press on USB Let me explain what I'm doing currently. We have made a finger heart rate monitor, each time your heart pulses a transistor is switched on via its base. The collector and emitter of the transistor are then wired to a dismantled USB keyboard. The wires are wired to the P key on the keyboard. Each time your heart pulses the letter P on the keyboard is pressed. While this works its large, fragile and ugly. Anyone know of a pre-made USB device that can simulate a key press from our heart rate monitor? AI: What you're looking for is a "keyboard encoder" or "keyboard emulator", such as these. They also used to use the term "keyboard wedge" for this sort of thing, but nowadays that term seems to be used exclusively in the context of point-of-sale barcode and credit card scanners.
H: Is this a good design for MOSFET H-Bridge? I have been looking around trying to design a simple but working H-Bridge for an RC car motor (12V and 2~3A). This bridge will be driven from a microcontroller and need to be fast to support PWM. So based on my readings, Power MOSFET are the best choice when it comes to fast switching and low resistance. So I am going to buy P and N channel power MOSFETs that are rated at 24V+ and 6A+, Logic Level, have low RDSon, and fast switching. Is there anything else that I should consider? Ok so on to the H-bridge design: Since my MCU will be running at 5V, there will be a problem with turning the P-channel MOSFET off, since Vgs needs to be at 12V+ to totally turn off. I see that many websites are solving this problem by using an NPN transistor to drive the P-channel FET. I know this should work, however, the slow switching speed of the BJT will dominate my fast switching FET! So why not use an N-channel FET to drive the P-channel FET like what I have in this design? Is this bad or wrong design? Is there any problem that I am not seeing? Also, will the reversed diode built in these FET be enough to handle the noise which is caused by stopping (or maybe reversing) the inductive load of my motor? Or do I still need to have a real flyback diodes to protect the circuit? To explain the schematic: Q3 & Q6 are the low side N-channel transistors Q1 & Q4 are the high side P-channel transistors, and Q2 & Q5 are the N-channel transistors that drive those P-channel (pull the voltage down to GND). R2 & R4 are pull up resistors to keep the P-channel turned off. R1 & R3 are current limiters to protect the MCU, (not sure if they are needed with MOSFETs, since they don't draw much current!) PWM 1 & 2 are coming from a 5V MCU. Vcc is 12V AI: I'm not sure why you think BJTs are significantly slower than power MOSFETs; that's certainly not an inherent characteristic. But there's nothing wrong with using FETs if that's what you prefer. And MOSFET gates do indeed need significant amounts of current, especially if you want to switch them quickly, to charge and discharge the gate capacitance — sometimes up to a few amps! Your 10K gate resistors are going to significantly slow down your transitions. Normally, you'd use resistors of just 100Ω or so in series with the gates, for stability. If you really want fast switching, you should use special-purpose gate-driver ICs between the PWM output of the MCU and the power MOSFETs. For example, International Rectifier has a wide range of driver chips, and there are versions that handle the details of the high-side drive for the P-channel FETs for you. Additional: How fast do you want the FETs to switch? Each time one switches on or off, it's going to dissipate a pulse of energy during the transition, and the shorter you can make this, the better. This pulse, multiplied by the PWM cycle frequency, is one component of the average power the FET needs to dissipate — often the dominant component. Other components include the on-state power (ID2 × RDS(ON) multiplied by the PWM duty cycle) and any energy dumped into the body diode in the off state. One simple way to model the switching losses is to assume that the instantaneous power is roughly a triangular waveform whose peak is (VCC/2)×(ID/2) and whose base is equal to the transition time TRISE or TFALL. The area of these two triangles is the total switching energy dissipated during each full PWM cycle: (TRISE + TFALL) × VCC × ID / 8. Multiply this by the PWM cycle frequency to get the average switching-loss power. The main thing that dominates the rise and fall times is how fast you can move the gate charge on and off the gate of the MOSFET. A typical medium-size MOSFET might have a total gate charge on the order of 50-100 nC. If you want to move that charge in, say, 1 µs, you need a gate driver capable of at least 50-100 mA. If you want it to switch twice as fast, you need twice the current. If we plug in all the numbers for your design, we get: 12V × 3A × 2µs / 8 × 32kHz = 0.288 W (per MOSFET). If we assume RDS(ON) of 20mΩ and a duty cycle of 50%, then the I2R losses will be 3A2 × 0.02Ω × 0.5 = 90 mW (again, per MOSFET). Together, the two active FETs at any given moment are going to be dissipating about 2/3 watt of power because of the switching. Ultimately, it's a tradeoff between how efficient you want the circuit to be and how much effort you want to put into optimizing it.
H: Why V rms instead of V average? I'm looking at an equation for average power in a signal $$ p_{avg} = \frac{1}{R} v_{rms}^2 $$ and wondering why it isn't $$ p_{avg} = \frac{1}{R} |v|_{avg}^2 $$ AI: Simple: the average of a sine is zero. Power is proportional to voltage squared: \$ P = \dfrac{V^2}{R} \$ so to get average power you calculate average voltage squared. That's what the RMS refers to: Root Mean Square: take the square root of the average (mean) of the squared voltage. You have to take the square root to get the dimension of a voltage again, since you first squared it. This graph shows the difference between the two. The purple curve is the sine squared, the yellowish line the absolute value. The RMS value is \$\sqrt{2}/2\$ (i.e. \$\frac{1}{\sqrt{2}}\$), or about 0.71, the average value is \$2/\pi\$, or about 0.64, a difference of 10 %. RMS gives you the equivalent DC voltage for the same power. If you would measure the resistor's temperature as a measure of dissipated energy you'll see that it's the same as for a DC voltage of 0.71 V, not 0.64 V. edit Measuring average voltage is cheaper than measuring RMS voltage however, and that's what cheaper DMMs do. They presume the signal is a sine wave, measure the rectified average and multiply the result by 1.11 (0.71/0.64) to get the RMS value. But the factor 1.11 is only valid for sinewaves. For other signals the ratio will be different. That ratio got a name: it's called the signal's form factor. For a 10 % duty cycle PWM signal the form factor will be \$1/\sqrt{10}\$, or about 0.316. That's a lot less than the sine's 1.11. DMMs which are not "True RMS" will give large errors for non-sinusoidal waveforms.
H: usb2 specification - is it backwards compatible Say I had usb port on my motherboard that only supports low speed devices, will full speed/ high speed devices not work on the low speed ports but at a lower speed? AI: In general, no. There really is no such thing as a low-speed-only host port; it would violate the USB standard. But even if such a thing did exist, the USB protocol does not support having a host negotiate a device down from full speed to low speed.
H: NTE2013 base inputs I have an NTE2013 which I want to use with an Arduino. I may be driving the base pins directly off of the Arduino or perhaps off of a 74HC595. Should I use resistors between the outputs and the base inputs to the NTE2013 to limit current? If so, about what resistor value ranges would work best? AI: The NTE2013 has the base current-limiting resistors (2700Ω) built in. You can connect its inputs directly to the '595 outputs.
H: Energy conversion from Electrical to Mechanical I have a requirement where I have to design a very small device capable of pulling in and out a small piston through a feedback.I know it can be done using motor but AFAIK I need higher voltage and current which is not possible through, in my case,a button cell rated 1.5 V. Here I seek your suggestion, is there any other effective solution to convert electrical energy to mechanical energy.I thought about an electric spark to initiate some chemical reaction(like in automobile) but it was complete failure as I needed to generate high voltage.Thanks for your help. AI: Look at piezo linear actuators. They work at relatively low energy rate, slow speed, low torgue, accurate movement in range of few mm. With correct driver the motor will consume very low power
H: RANDOM command in PBASIC I'm trying to use the random command in PBASIC and I'm not sure how it works. I'm using a PICAXE-08 Proto Board Kit, and the chip specifically is a PICAXE-08M2. Here is the code I'm using: symbol randnum = w0 RANDOM randnum randnum = randnum // 2 FOR action = 1 TO 5 IF randnum > 0 THEN LOW led_red PAUSE 500 HIGH led_red PAUSE 500 ELSE SOUND buzzer,(100, 100) PAUSE 500 ENDIF NEXT action (Perhaps due to assembly mistakes, the LED's HIGH corresponds to LOW and vice-versa). First of all, I expected to put the RANDOM randnum command within the for loop, but if I do this, the loop count becomes incorrect. Instead of 5 actions, I get only 2. The second problem is that I'm expecting randnum to be either 0 or 1, so that 50% of the time the LED is lit and 50% of the time the buzzer sounds. However, the LED is lighting 100% of the time, even across multiple trials. Obviously, randnum is never 0. However, according to documentation, RANDOM should give the variable a value between 0 and 65535, inclusive. What is the issue here? AI: The RANDOM command doesn't simply generate a random number for you; what it's actually doing is taking whatever value is already in the variable and transforming it in a pseudorandom way. In other words, the variable you give it is the internal state of the random number generator. You must not modify that variable in any other way if you want the generated numbers to be as random as possible. When you set randnum = randnum // 2, you are forcing it to be either 0 or 1. It would seem that when the RANDOM command sees a value of 1, it generates a new number that is odd, so you once again set randnum to 1. What you need to do is use a second variable to hold the binary result: RANDOM randnum randbit = randnum // 2 (I can't explain the problem with the loop count changing; that would seem to be a separate issue.)
H: High Quality Free PCB Software Download is there any high quality PCB software that's free for download? I am trying to design a mother board, and want to be sure of the circuitry. Is there any PCB software that if you order your design it takes your design and manufactures it for you? Thanks. AI: There are many open-source computer/motherboard projects that provide PCB layout output files (called Gerber files) for no cost on their websites. Search for Gerber files specific to the board you are seeking. Example open-source projects include Raspberry Pi, Beagonebone, Beagleboard, and a host of others; Google them. If you send this set of Gerber files, usually around 8 specific ones out of them, to a PCB manufacturer, they will make the PCB for you. If you need to do this in low quantities (thus reduced cost), you can try a service like BatchPcb or Seeedstudio; there are many others. You would still need to have the PCB assembled, meaning have the parts/ICs soldered on to the PCB. You can either do this manually yourself if you have a good soldering iron and a hot air gun (although some of the ICs such as in the Raspberry Pi are difficult/impossible to hand-solder), or you can have assembly houses do it for you. It is indeed true that the Gerber files can be sent out for manufacturing without any editing on your part; HOWEVER, without SOME knowledge of how PCB design/layout works, you would have trouble assembling/soldering the PCB and/or getting it to work. So unless you have professional experience on your side, you may want to start with learning layout for a more basic PCB first and soldering, then jump to this after a few months.
H: Using CMOS IC in a TTL circuit Is it safe to use a CMOS IC? For instance I'll be using a CD4017 in this circuit: http://www.555-timer-circuits.com/police-lights.html Will it still function correctly? Any further modifications needed? AI: No, that's not guaranteed to work. TTL low level outputs are no problem, but the high level may be as low as 2.7 V, and that's too low for a CMOS high level input. Instead of a CD4000 series device I would use a function and pin compatible 74HCT4017. 74HC is High-speed CMOS (HCMOS), which is the technology most used today, the CD4000 CMOS is really outdated. 74HCT is the same, but with TTL compatible I/O (hence the "T"). Further reading Logic signal voltage levels
H: How to split Analog and Digital GND planes for a TQFN device This question is in reference to Mixed signal PCB layout for PSoC. If I am using a microcontroller which has separate analog and digital supply inputs and GNDs, what should do with the grounds? Should I connect all GND pins (both analog and digital) to the thermal pad? Or should I only connect the digital GNDs to the thermal pad and connect the analog GND to its own GND plane? AI: Sorry, my bad. I posted this image from the CY8C32 datasheet into my answer to the other question: but didn't copy the caption. "Figure 2-8. Example PCB Layout for 100-pin TQFP Part for Optimal Analog Performance". This is for the TQFP100 part, which doesn't have the thermal pad, and doesn't apply to the QFN48 you're using. For parts with a thermal pad the split makes no sense, and you should connect the thermal pad to digital ground. The center pad on the QFN package should be connected to digital ground (VSSD) for best mechanical, thermal, and electrical performance. If not connected to ground, it should be electrically floated and not connected to any other signal. (page 6) Note that when you use a thermal pad on your PCB that you shouldn't apply solder paste all over it, but use a windowed stencil to avoid the IC being pushed up by the solder paste: "The solder paste pattern area should cover 35 % of the solder land area. When printing solder paste on the exposed die pad solder land, the solder paste dot area should cover no more than 20 % of this solder land area. Furthermore, the paste should be printed away from the solder land edges. This is illustrated in Figure 9; the solder paste pattern area lies within the boundary indicated by the red line and it is divided by the entire solder land area." (from here) Further reading CY8C32 datasheet HVQFN application information, NXP application note
H: Motherboard and BIOS I am fairly new to building computers, and I am starting out with the mother board. What are the parts I need to build a motherboard? Also, how can you reprogram your BIOS? AI: If you're new to it you can't design your own PC's motherboard. Despite their low cost motherboards are pretty advanced electronics. A common EDA tool like Eagle is not fit for the job, where you need to take transmission lines, matched impedances and matched trace lengths into account. A typical PC motherboard may have more than 10 layers. Having made one will cost you more than a PC from the shop around the corner. So you want to make it right first time. So you want simulation tools. Cost: several 10k, up to 100k dollars. You can't prototype a > 100 MHz PC motherboard on a breadboard, it simply won't work. Besides, all the required components are SMD, many BGA. Further reading How to build a motherboard
H: circuit for multimeter without a ic or a timer like ic741 or 555 timer hey i need to make a multi meter on a bread board without ic or timers. which measures current, voltage, resistance and also inductance . can any show me a circuit which will work . i tried some but all have ic or timers . some circuits i tried http://homemadecircuitsandschematics.blogspot.in/2011/12/make-workbench-multimeter-with-ic-741.html AI: Given an ammeter with full scale current I and internal resistance R. VOLTAGE It will act as a voltmeter if resistance if inserted in series. When the voltage drives the current to full scale that voltage will be the full scale voltage. So - \$V_{fs}=I_{fs}\times R_{total} = I_{fs} \times R_{meter}+R_{series}\$ or, rearranging: \$R_{series}=\dfrac{V_{fs}}{I_{fs}}-R_{meter}\$ eg given a 50 uA meter with a 1000 Ohm resistance, make a 20 VDC full scale meter. \$R_{series}=\dfrac{V_{fs}}{I_{fs}}-R_{meter}=\dfrac{20}{50\times 10^{-6}}-1000 = 400,000 - 1000 = 399,000Ω = 399KΩ\$ In this case the meter resistance is irrelevant as it will have minimal effect on accuracy. Note that for 1 Volt, \$R_{fs}=\dfrac{V_{fs}}{I_{fs}}=\dfrac{1}{50 \times 10^{-6}}=20,000\$. SO a 50 µA ammeter produces what was called when such things were common, a "20,000 Ω per Volt" Volt meter. To make a multimeter, just add \$20,000\times V_{fullscale} Ω\$ for each range. eg for ranges of 1 V, 10 V, 100 V the series resistors are 20 KΩ, 200 KΩ, 2 MΩ. CURRENT If we use the same 50 µA, 1000 Ω meter we can divert current around it so that more current must flow to make the meter read full scale. If we place an \$R_{sh}\$ resistor in parallel with the meter, then at full scale, if 50 µA flows through the 1000 Ω meter then \$\dfrac{1000}{R_{sh}}\times 50 µA\$ will flow through the shunt resistor. So total current = \$I_{fs}=I_{meter}+\dfrac{R_{meter}}{R_{sh}} \times I_{meter}=I_{meter}\times \left( 1+\dfrac{R_{meter}}{R_{sh}}\right)\$ \$I_{fs}=I_{meter}\times \dfrac{R_{sh} + R_{meter}}{R_{sh}}\$ or rearranging: \$R_{sh}=\dfrac{R_{meter}\times I_{meter}}{I_{fs}-I_{meter}}\$ So eg to make a 100 mA meter with our 50 uA meter we see \$R_{sh}=\dfrac{R_{meter} \times I_{meter}}{I_{fs}-I_{meter}}=\dfrac{1000\times (50\times 10^{-6})}{0.100 - 0.000050}=\dfrac{0.050}{0.099950}=0.500250Ω\$ or close enough to 0.500 Ω. In the above when \$I_{fs}\$ >> \$I_{meter}\$ the \$(I_{fs}-I_{meter})\$ term can be simplified to \$I_{fs}\$ so \$R_{sh}=\dfrac{R_{meter}\times I_{meter}}{I_{fs}}\$ which makes a large amount of sense if you look at it long enough. So in th above case \$R_{sh}=1000\times \dfrac{50 µA}{100 mA}=1000\times \dfrac{1}{2000}=0.5Ω\$ as expected. So a Multimeter has ranges which switch shunts across the meter which are 1 \$N^{th}\$ of the meter resistance for \$I_{fs}=N\times I_{meter}\$. RESISTANCE: Look at the resistanmce scales on a non electronic analog ohmmeter. Note how they are compressed in a non linear manner. The Ohmmeter is an ammeter with the scale calibrated to suit. See ammeter above for method. INDUCTANCE Harder. Can be done BUT electronic make it FAR easier. Lets have some useful feedback from you before we wade into such things.
H: Learn C programming before start learning Microcontroller/Embedded Systems Possible Duplicate: How to become an embedded software developer? I want to know whether it is mandatory to learn C/C++ programming before start learning Microcontroller or the Embedded Systems. If yes, why do I need C to start with? AI: By definition of "mandatory", of course not. How advantageous it would be very much has to do with what your personal goals are. I suggest that many people who work with microcontrollers work in C, many of the libraries and drivers you can track down will be in C, and many of the discussions you'll find or take part in when you need a bit of help will be in C. For me, that's enough of a reason right there, before any considerations of C vs assembler vs any other language can even start up. If you don't embrace C at least a little, you're cutting yourself off from many resources.
H: What is the name of this springy type oscilloscope probe accessory? Exactly what it says on the tin. How is this pictured accessory called? The obvious place to look for a name would be the probe manual, but it looks like they decided to add the accessory to the package after making the manual, since it's not on the component list. AI: It's a "Probe tip ground clip" (or something very similar like the examples below) An example of it being named as such is here. It's called "Probe tip ground" here. It is also called a "Probe tip spring adapter" here. Whatever it's exact name, I think the main thing is to have "tip" in there, as it differentiates from the standard ground clip by implying the clip is used at the probe tip. Basically, it's function is to shorten the ground lead, as this lowers inductance and enables higher frequency signals to be displayed accurately. Try it with a very fast rising signal, and compare it to using the normal ground clip and you will see the difference. A common mistake is using the wrong setup to probe a signal and then assume the fault is with the signal, when it's really issues caused by the setup. The way to use it is like the following picture, touch the ground wire to the IC ground pin, and the probe tip touches the pin you wish to probe: When designing your board, you can add dedicated test points to make getting to the signals easier. You can even add on board probe tip adapters (available from any decent distributor) if you have enough space. For a detailed discussion of scope probes the Tektronix ABCs of Probes is good reading. Here is a diagram from the above link showing the effects of different ground lead lengths on a fast rising signal:
H: Simulating an automotive load dump with a bank of charged capacitors? I've been working on a data logging device that will eventually go into my personal vehicle. I've scoured the interwebs and built what, in theory, should be a fairly stout power supply capable to handle fast transients and undervoltage and the fabled load dump. My problem is, though... I want to actually test the power supply. In previous questions that I've asked related to the design of the power supply portion, I've been told that the "right way" to simulate a load dump is with a proper, preofessional testing device. I'm curious, though... what's stopping me from rigging up something that is "close enough"? My idea is simply this: get a low-voltage DC power source, such as an old PC power supply. Get a DC-DC converter to step that 12V up to something in the 80V range. Assemble a bank of capacitors to get me in the neighborhood of a theoretical 12V load dump.. which from what I can tell is in the hundreds of joules range. Once charged, simply connect it to the battery input of the device - which wouldn't be connected to an actual power source lest I want to potentially screw that power source up - and see if explodes, and if not, see if it works normally afterwards. Does this sound like the dumbest idea you've ever heard? Is it a somewhat decent idea that simply needs a lot of planning and number checking to in order to work roughly as intended? AI: A load dump is what happens to an automobile electrical system when a large load (such as the headlights) switches off. The problem is that the charging system (primarily the alternator) has significant inductance, and any attempt to rapidly reduce the current draw results in an "inductive kick" that creates a large voltage spike on the 12V bus. This kick is the same phenomenon used to create the spark in the ignition system, just a different manifestation of it. The point is, any equipment that's attached to the 12V bus needs to be able to withstand these occasional 100-200V voltage spikes without damage. Since load dump is primarily an inductive phenomenon, it would probably be easier to simulate it that way, too. You don't really need to simulate the full energy of an actual automotive load dump; you just need to create the same voltage waveform across the supply terminals of your device. Put a largish inductor (L1, on the order of 1H, perhaps the primary of a large power transformer) in series with your device (i.e., connect the device to the power supply through the inductor). This represents the inductance of the automobile charging system. Put a few µF of capacitance (C1) across (in parallel with) your device; this represents the distributed capacitance of the automobile wiring, and helps to limit the risetime of the load dump event. Make sure this capacitor is rated for a few hundred volts. Put a 120Ω resistor (R1) in parallel with your device, too. This represents other static loads within the automobile, and will set an upper limit on the peak voltage that the load dump creates. (This resistor will be drawing 100 mA and dissipating 1.2W.) Now, connect a low-value, high-power resistor (R2) across your device, in series with a switch (SW1). This represents the load that is going to get "dumped". The value of the resistor should be such that the DC current doesn't exceed the power supply's capability, and you can adjust the value of the resistor to change the current with respect to the value of the inductor to dump a specific amount of energy (0.5×I2×L). For example, if your inductor is 1H and your resistor is 12Ω (@ 12W), you'll be drawing 1A, and the stored energy will be 0.5 Joules. Close the switch to "charge up" the inductor, then open it — there's your simulated load dump event. With these resistor values, the peak voltage will be on the order of 100-120V. You can use different combinations of resistor values to simulate different kinds of events. The ratio of R1 to R2 approximately determines the peak voltage of the spike (relative to the power supply voltage). Scale both resistors downward to simulate higher-current (higher-energy) events. Make the capacitor smaller to get faster risetimes; 1H and 1µF resonate at 160Hz, which gives you a fairly leisurely 1.5ms risetime (1/4 cycle). For example, changing C1 to 0.01µF would give you a risetime of about 150µs.
H: How can I achieve very bright light? I'm not sure if this is right site for this, but couldn't find better. I've been given an task to create something that has light intensity like police beacon. I need it to be cheap, so I'm looking at dealextreme.com LED emitters , but there aren't any good user experience videos. I don't know if the LEDs are right for this and how should I pick right one from these LEDs. AI: Maximising brightness: Brightness is a function of amount of light and area illuminated. More light = more brightness. Less area = more brightness. So For more light obtain as many lumens as you can afford. For less illuminated area use LEDs with low "radiation angle" or "cone angle". Lenses: If that is not bright enough you can use a lens or reflector. Many companies provide lenses for LEDs. Deal Extreme have a range here Effect of colour: Note also that brightness is related to eye response to colour - yukky yellow green is about the best colour for optimum eye perceived brightness - but if you want a specific colour this is not much help in optimising brightness. Related: Mind plasticity add on for the ever young: Lime Green is close - Lime Green Fire Engine from here - BUT more recent studies suggest that familiarity is more important than visibility for emergency vehicles.
H: Verify Truth Table: Switches and LED I got a digital design problem. My final implementation of the circuit program didn't achieve the required criteria, so I brought my problem and my works here to be suggested by you if I mis-manipulated any details. Logic System: Binary--1,0. Issue after Simulation and Test on Circuit Board: LED lighted up at the begining without any switches were turned ON. (Would it make sense?) Problem Statement: Use 4 switches A, B, C, D to control a LED. LED is ON if the following conditions are satisfied, D and B turn ON, or A turns OFF while C turns ON, or A and B turn ON and the rest turn OFF, or C and D turn OFF, or all switches turn ON. End of Problem Statement. Notations and Circuit Combinations we use: AND gate: · (dot) OR gate: + "Not/Invert something": ~ SOP: Sum of Products POS: Product of Sums SOP and POS are equivilant to each other. My works: True Table based on the 5 criteria ON:1, OFF:0. Collection of LED results is {1011111110001101}. I can handle operating the software part, but I really want to check with you guys if I use POS method and based on the 5 criteria given in the problem, whether or not my true table is correct. Please help me to point out my blind spots. Thanks AI: Going by the problem definition directly: D and B turn ON: B•D A turns OFF while C turns ON: ~A•C A and B turn ON and the rest turn OFF: This condition is already covered by condition 4. C and D turn OFF: ~C•~D all switches turn ON: This condition is already covered by 1. So your final function is: B•D + ~A•C + ~C•~D 3 ands, 2 ors.
H: Identifying an irreducible circuit? How would you go about identifying an irreducible circuit? By irreducible, I mean combining resistors whether in series or in parallel to reduce the circuit. AI: From the perspective of two given terminals in a circuit (e.g. output signal and ground), any linear circuit can be reduced to a Thevenin equivalent, which only consist of a single voltage source and a single resistor. Wikipedia has a fairly decent article with good examples: http://en.wikipedia.org/wiki/Thevenins_theorem
H: equivalent load resistance I have the following circuit I am having some trouble determining the relationships between Iac, Io and Iacpk. I'm not quite seeing how the final equation for Iac was determined, specifically the factor of (2/π) and Iacpk. Thanks. AI: The output current value cited is the average current of a sine wave, which mathemagically is two over pi times the peak value. This can be proven by integrating I * sin(x) from zero to pi, multiplying by 2 to mimic the rectification (both peaks in the same direction) and dividing by 2 * pi since we're dealing with a whole AC cycle, and we get our 2 over pi factor. EDIT: A derivation (calculus = rusty, apologizes for glaring errors) \$ I_o = 2\dfrac{\int\limits_{0}^{\pi}{I_{ac}}^{pk}\cdot \textrm{sin}(x) \textrm{d}x}{2\pi} \$ \$ I_o = 2\dfrac{{I_{ac}}^{pk}\cdot \Big(-\textrm{cos}(\pi) - \big(-\textrm{cos}(0)\big)\Big)}{2\pi}\$ \$ I_o = 2\dfrac{{I_{ac}}^{pk}\cdot \Big(-(-1) + (1)\Big)}{2\pi}\$ \$ I_o = 2\dfrac{2{I_{ac}}^{pk}}{2\pi}\$ \$ I_o = \dfrac{2{I_{ac}}^{pk}}{\pi}\$
H: Non-conductive pads in datasheet? I'm designing a device which has a DM3CS-SF microSD connector and in the recommended land-pattern for the datasheet they have areas labeled as "Non-conducting traces". What am I suppose to do with these areas? Are these keep-out areas where I shouldn't route anything on the same layer, or do I need to provide a trace with solder mask on them (so that they can't get soldered/electrically connected to the connector)? AI: They actually say "No conducting traces". It means that metal parts of the connector (may) touch the PCB in those areas, and conductive traces may be shorted by them. In practice it means no routing there, not even with a solder resist over the traces. Solder resist does not guarantee electrical insulation.
H: Why does changing an 'add' to a logical or devour 7 CPLD macrocells? I have a design that's synthesizing to about 50 macrocells. I have this section of code: module levers2( input [2:0] LL, input [2:0] RL, output reg [10:0] DIVISOR, output reg FAULT ); reg [10:0] grid[0:63]; wire [5:0] tmp = (LL<<3)+RL; (snip) tmp is for all intents, an address line. I have two 3-bit input lines and I'm combining them to make a 6-bit address line. So I shift LL by three bits and add RL. When I synthesize, I get a 47 macrocell result. However, if I change the operator to a logical or: wire [5:0] tmp = (LL<<3) | RL; The design synthesizes to 54 macrocells. That's 7 macrocells lost for what?! I would think a bitwise or would be efficient and easy, much easier than an add which has the extra baggage of the carry. Can anyone shed some light on what's going on? EDIT --- I determined it was using more macrocells by using ISE's reporting mechanism. I also tried a few different things (but not the concatenation operator mentioned below) and everything added 7 macrocells except for the 'add'. I was happy that the behavior was consistent. As a side note, I added a single 3-input OR to my top-level schematic and fed it three signals (fault outputs) from different modules. This added 9 macrocells. You can bet I found a new way when I saw that, heh. AI: If all you want to do is combine two smaller arrays into a larger array of signals then it's best to use the concatenation operator: wire [5:0] tmp = {LL, RL}; With the above, wire[5:3] will be connected to LL, and wire[2:0] will be connected to RL You can use it in any order like: wire[5:0] tmp = {RL, LL]; Or even: wire[5:0] tmp = {LL[0], RL, LL[2:1]; (you can see how this can be used to shift/rotate signals) Still, I'm not sure why changing to the OR should use another 7 macrocells, it's possibly (probably) because the synthesis tool is inferring an adder with the + operator and the CPLD has an adder cell that it can use, as opposed to making the adder from a few gates. How did you determine this? Did you check the technology schematic to see what's being created? To help discover exactly what's happening, seeing the rest of your modules code would be helpful (also I can try it in ISE here) EDIT - out of curiosity I wrote a small test module using the relevant bit of the above code. I tried synthesising (with default settings) for a Spartan-3A and the XC264A CPLD, with the + or the|. Both terms produced identical results for the Spartan and the CPLD, both in the technology viewer and the place and route macrocell usage report. With this information, it looks like it must be something to do with the rest of the design and possibly the synthesis tool settings (optimisation, etc). The snippet above should just concatenate the two smaller signals into one larger one, so no logic should be necessary.
H: The best stack-up possible with a four-layer PCB? I'm designing a 4 layer PCB and I know that the standard stack-up is Signals GND VCC Signals (GND and VCC can be switched depending on the layer with more signals) The problem is, I don't really want to connect all ground pins through vias, there are just too many of them. Maybe because I'm not used to 4 layer PCBs, anyway, I've read a tip by Henry W. Ott about a different stack-up GND Signals Signals GND (Where the power is being routed with wide traces on the signal planes.) According to him, this is the best stack-up possible with a four-layer PCB, for the following reasons: Signal layers are adjacent to ground planes. Signal layers are tightly coupled (close) to their adjacent planes. The ground planes can act as shields for the inner signal layers. (I think this requires stitching.) Multiple ground planes lower the ground (reference plane) impedance of the board and reduce the common-mode radiation. (I don't really understand this one.) One problem is cross-talk, but I really don't have any signals in the third layer, so I don't think that cross-talk will be an issue with this stack-up. Am I correct in my assumption? Note: The highest frequency is 48MHz and there's a WiFi module on the board, too. AI: You will hate yourself if you do stack up number two ;) Maybe that's harsh but it's a going to be a PITA reworking a board with all internal signals. Don't be afraid of vias either. Let's address some of your questions: 1.Signal layers are adjacent to ground planes. Stop thinking about ground planes, and think more about reference planes. A signal running over a reference plane, whose voltage happens to be at VCC will still return over that reference plane. So the argument that somehow having your signal run over GND and not VCC is better is basically invalid. 2.Signal layers are tightly coupled (close) to their adjacent planes. See number one I think the misunderstanding about only GND planes offering a return path leads to this misconception. What you want to do is keep your signals close to their reference planes, and at a constant correct impedance. 3.The ground planes can act as shields for the inner signal layers. (I think this requires stitching ??) Yeah you could try to make a cage like this I guess, for your board you'll get better results keeping your trace to plane height as low as possible. 4.Multiple ground planes lower the ground (reference plane) impedance of the board and reduce the common-mode radiation. (don't really understand this one) I think you've taken this to mean the more gnd planes I have the better, which is not really the case. This sounds like a broken rule of thumb to me. My recommendation for your board based only on what you've told me is to do the following: Signal Layer (thin maybe 4-5mil FR4) GND (main FR-4 thickness, maybe 52 mil more or less depending on your final thickness) VCC (thin maybe 4-5mil FR4) Signal Layer Make sure you decouple properly. Then if you really want to get into this go to amazon and buy either Dr. Johnson's High Speed Digital Design: A Handbook of Black Magic, or maybe Eric Bogatin's Signal and Power Integrity - Simplified. Read it love, live it :) Their websites have great information as well. Good luck!
H: Using AVR reset pin as ADC I am using an ATTINY13 for a toy application. It simply blinks LEDs in specific patterns. I decided to add a "speed control" using a potentiometer but the only pin I had left is the reset pin. I've created a voltage divider and padded it with 330 ohm resistors, and things seem to work just fine on a breadboard. After reading up a bit on using the reset pin for ADC, it seems that some people advise that you cannot program the AVR again. I haven't had this problem, but I am also not doing in-system programming. The code I am using to enable ADC0 on pin 1 (PB5) is as follows: DDRB = 0b00001000; ADCSRA = 0b11100111; ADMUX = 0b00100000; My question is: Why is this working? I would like to know a little bit more before proceeding with PCB manufacture. Is it just dumb luck so far? I assume because reset never "sees" ground, the micro never resets spontaneously in circuit, but I'm unclear as to how I've managed to use the reset pin for ADC without disabling flash reprogramming. Note: I currently am using a DIP-8 version of the chip in a socket, which I relocate to a programmer to change parameters. I will switch to a SOIC version for production. Other: The 6-pin header connects to some Charlieplexed LED's AI: The reset disable fuse does just that - disables the reset function of the associated pin. If you set that fuse, there is no way to reset the device except: Power Cycle Watchdog Timer Expiration In-Circuit Serial Programming (also known as ICSP), I believe, relies on resetting the device by way of the Reset pin, and so you will not be able to reprogram the device once this fuse is set using ICSP. There is more than one way to reprogram an AVR though. If the device supports High Voltage Serial or Parallel programming (HVSP or HVPP) that's always an option. Or if you can include a bootloader on the chip (which can be done with an ATtiny85 for example, not sure about the ATtiny13), that can work too. That being said, the datasheet section 24.3.3 has the following excerpts: Special combinations of fuse bits will lock the device for further programming effectively turning it into an OTP device. The following combinations of settings/fuse bits will cause this effect: 128 kHz internal oscillator (CKSEL[1..0] = 11), shortest start-up time (SUT[1..0] = 00), Debugwire enabled (DWEN = 0) or Reset disabled RSTDISBL = 0. 9.6 MHz internal oscillator (CKSEL[1..0] = 10), shortest start-up time (SUT[1..0] = 00), Debugwire enabled (DWEN = 0) or Reset disabled RSTDISBL = 0. 4.8 MHz internal oscillator (CKSEL[1..0] = 01), shortest start-up time (SUT[1..0] = 00), Debugwire enabled (DWEN = 0) or Reset disabled RSTDISBL = 0. If you have no intention of supporting in circuit programming, you can safely program once then set the reset disable fuse and use the pin's alternate function. You do not want to leave the reset function enabled in production unless you don't care about your device resetting in arbitrary ways. Basically if the pin is "low" for a given period of time, it will reset, end of story. Per the datasheet Table 18-4, the range of possible threshold values for external reset to trip is 0.2*Vcc to 0.9*Vcc... you maybe just be getting lucky with devices that are closer to 0.2*Vcc.
H: Lighting up an old vacuum tube Does anybody know how to light up a vacuum tube? I have about 9 of them and only 1 I can see the name. It is a 12DT8. Is it possible to find the heater without the datasheet by using a multimeter etc... And if so, is it possible to power it with a DC battery? I am not trying to operate it for complex electronics, I just want to light them up for decorational purposes. I got these from a 1950's radio, if that's any helpful info. AI: You can use AC or DC voltage to power the filament of a vacuum tube. The filament will glow when powered up which is what you are referring to as "lighting up". So a battery is fine. The voltage required by a particular tube is given by the initial digits in the part number. Thus your 12dt8 requires 12 volts to light up the filament. Most tubes that were used in radio and television sets used either 6 or 12 volts although many other voltages were used. You will need to determine which pins are connected to the filament. A tube manual or a web search should provide this information. Since you don't intend to actual use the tube in a circuit, you could just try different combinations of the pins until the filament glows.
H: What values of resistor and capacitor to use for AVR reset pin isolation? Background... I'm a newbie to AVR applications. I recently built two ATTINY13-based circuits (glorified LED blinkers) which worked correctly (independently) on the breadboard. When I combined them on a solder perfboard with a shared power supply, things went haywire. After much investigation, it appeared they were constantly resetting. I had left pin 1 (reset) of each micro un-connected. I researched proper ways of handling the reset pin and from this implemented the following: Added a 100uF electrolytic capacitor in parallel with the power supply to help with any potential current draw the power supply would be too "slow" to deal with. Added a 4.7K resistor from VCC to RESET Added a 0.1uF ceramic capacitor from GND to RESET These steps solved the problem completely. The question: The page I linked above is providing advice when doing ISP (in-system programming) which I am not doing (yet). (I'm programming the micros separately with no other components connected to them.) I've seen several different values of capacitor (10nF, 0.1uF, etc.) and resistor (4.7K, 10K, etc.) and am not sure what factors alter these values. Can anyone shed some light on how reset pin isolation works, and how to calculate component values to use? Can you explain what values to use if there is no in-system programming header? AI: Atmel AVR042: AVR Hardware Design Considerations tell us that the capacitor on the reset pin is not necessary. Personally I think it's overkill. There is no reason for you to continue making dozens of AVR circuits, each and every one with that redundant capacitor. As for the reset pullup resistor: The reset line has an internal pull-up resistor, but if the environment is noisy it can be insufficient and reset can therefore occur sporadically. Refer to datasheet for value of pull-up resistor on specific devices. Connecting the RESET so that it is possible to enter both high-voltage programming and ordinary low level reset can be achieved by applying a pull-up resistor to the RESET line. This pull-up resistor makes sure that reset does not go low unintended. The pull-up resistor can in theory be of any size, but if the Atmel®AVR® should be programmed from e.g. STK500/AVRISP the pull-up should not be so strong that the programmer cannot activate RESET by draw the RESET line low. The recommended pull-up resistor is 4.7kΩ or larger when using STK500 for programming. For debugWIRE to function properly, the pull-up must not be smaller than 10kΩ. If you take a look at professional products that incorporate the AVR micros, such as the Arduino, its numerous clones, dozens of dev kits, you'll find that most use a 4.7kΩ or 10kΩ resistor. And particularily for your ATtiny13, its datasheet specifies that the pullup should ideally range [20kΩ, 80kΩ].
H: VCD files - flatten busses to individual nodes I was wondering if its possible to flatten all of the busses in a VCD file such that there will be a separate value change recorded for each bit - rather than a cumulative recording of the following syntax: b<value> <identifier> My goal is to count the number of transitions that occur after each timestamp recorded. If all busses were flattened, this would be straight-forward since it would simply be the number of value changes listed. However, these vector changes instead of bit changes complicate the issue. You would need to keep a record of the previous state of the vector in order to determine exactly how many bits in the vector transitioned. Any other suggestions to fix the problem are welcome, any help is appreciated! -k AI: It is possible to flatten such a bus programmatically. Instead of writing $var wire 8 # data $end You will have to declare (in this case) 8 single variables $var wire 1 $ data0 $end $var wire 1 % data1 $end $var wire 1 & data2 $end [...] And then you can convert each change into separate lines: b10000001 # Will turn to: (knowing the last state being b01100001) 1$ 0% 0& So you will have to parse and rewrite the VCD file using you favourite programming language.
H: What microprocessor for experimentation? I harbor a secret fantasy (oops, not so secret anymore) to build a simple computer from scratch. I'm looking for an easy-to-use microprocessor to start with. I know about the usual suspects such as the 6502, 68000, 8086, Z80, etc. But I'm wondering if something better is out there. Here's my wish list: Must have: Low clock rate (4-25 MHz) No more than 40-60 pins, preferably in DIP configuration Ability to address around 64KB of memory, but up to 1MB or so would be good Stored-program architecture (not read-only instruction space) (Edit: this rules out most low-end microcontrollers, like the PIC and AVR) Flat memory model, not banked or segmented like the 8086 Would like, but not necessary to have: RISCy instruction set (load-store) General-purpose registers Assortment of TTL I/O pins Built-in flash ROM What microprocessor or microcontroller would you suggest that's relatively easy to wire up and get the first ROM routines written for? My goal is to get a simple Forth (or similar) system going. Just to say I did it. Edit: After doing a bit of research, I think something like the ARM7 would suit me. It comes with a non-trivial amount of flash and SRAM to play with -- sometimes as much as 256K flash and 64K SRAM -- along with digital I/O, ADC, serial I/O, and more. Here's one: the STR711 ARM development board. AI: I agree that ARM is the way to go for 32-bit microcontrollers. ARM is ubiquitous and its assembly language can be used across a broad range of microcontroller families. ARM also has good support from the GCC toolchain. The ARM7TDMI chip architecture has dominated the 32-bit mcu space the last 5 years and the ARM Cortex-M3 is the emerging replacement. The Cortex-M3 does have a Harvard architecture (separate instruction and data address spaces), but I don't feel that's a limitation. Micromint has a solid reputation, and they offer a Cortex-M3 board with configurable options for a decent price. However, if you really need DIP configuration, I've had success with the mbed Now, the next thing is languages. You mentioned FORTH. I also recommend Python-on-a-Chip and eLua as powerful, easy to learn languages that work on this size target platform. eLua is more fully developed but has larger resource requirements than Python-on-a-Chip. Full disclosure: I'm the author of the PyMite VM used in Python-on-a-Chip. So, if your goal is to make your own language, I fully understand the joy of that exercise.
H: Send GPS coordinates via VHF I want to set up a system such that wherever a user of VHF presses the PTT button the coordinates from a GPS receiver will transmited to receiver and stored in a computer. Is that possible ? Where should I look around for something like that? AI: For transmitting data across a VHF or similar radio link you're going to either need a radio modem or to build one yourself to convert the data bits into tones that can be passed across the link. While you could, in theory, use an modem device designed for telephone line use (minus the telephone line interface circuitry), a device designed specifically for radio use such as the CMX469A (from CML Microcircuits) would be a much better device, this application note should provide the basis for the system you've described.
H: Center tap split supply question Lest's say that I have the following setup: a split supply (using two voltage regulators: a positive and a negative one) connected to a center tapped transformer (12-0-12). The output of the transformer is rectified. The center tap is the COMMON of the circuit. Except for the actual values the setup would be exactly the same as this one: Please ignore the values. It is just to make a better picture about the setup. I have two questions: In this setup, in order for everything to work properly, the current consumed by the positive rail should be approximately the same as the current consumed by the negative rail? Or it does not matter if one rail consumes less current than the other one. For example if the positive rail will consume 3Amps and the negative rail only 20mA will there be any problem? Will there be any noise induced in the circuit? Or any other bad things? :) How about if the transformer will have this setup: 12-0-5, so that on the negative rail a lower voltage will be used. Will it work properly? Or the two voltages of the transformer should be symmetrical? AI: The load currents do not need to be balanced. If they're not, it just means that there will be increased current in the center tap (ground return). The transformer needs to be symmetrical. Both halves of the transformer supply power to both regulators, on alternate half-cycles. However, it is not necessary for the regulators to have the same DC output voltages. They can indeed be different, but just be aware that the one with the lower output voltage will be dissipating more power for any given load current, since the input voltage is the same going into both regulators.
H: FPGA programming, where to begin I'm a software developer (C, C++, objective-c, java ...) and I am interested in learning to program FPGAs. Now the question may appear simple to you but please do take time to help me on this one as I'm kind of stuck right now. My company has asked me to get familiar with the technology and work on a lattice product. My question is where to start? After some research I found that I could choose between VHDL and Verilog, I have never used any of them. Is there any specialist who could suggest me where should I begin? Learn a language, learn about the hardware components and then lattice product? Or directly start with Lattice product (as I read that programming methods are very different between FPGA vendors)? AI: Digital design does not have a lot in common with software development (maybe except that Verilog syntax looks a bit like C language but it just looks). Thus it is very hard to answer this type of question adequately. But as a guy who walked a path from software development to hardware design I'll give it a shot. Looking back at myself, here is how I would have advised myself back then if I knew what I know now: Start from scratch Forget everything about software development. Especially programming languages. Those principles do not apply in digital design. It probably would be easy for a guy who designed a CPU to program it in assembler or even C, but an assembler programmer won't be able to design a CPU. On your learning path do not tend to solve what seem to be an easy problem with your existing knowledge from software. One of the classic examples is a "for loop". Even though you can write a for loop in, say, verilog — it serves a different purposes. It is mainly used for code generation. It may also be a for loop as software developers see it, but it won't be good for anything but simulation (i.e. you won't be able to program FPGA like that). So for every task you want to tackle, don't think you know how to do it, do a research instead — check books, examples, ask more experienced people etc. Learn hardware and HDL language The most popular HDL languages are Verilog and VHDL. There are also vendor-specific ones like AHDL (Altera HDL). Since those languages are used to describe hardware components, they are all pretty much used to express the same thing in a similar fashions but with a different syntax. Some people recommend learning Verilog because it looks like C. Yes, its syntax is a mix of C and Ada but it doesn't make it easy for a software developer to lean. In fact, I think it may even make it worse because there will be a temptation to write C in Verilog. That's a good recipe for having a very bad time. Having that in mind, I'd recommend staring from the VHDL. Though Verilog is also OK as long as the above is taken into account. One important thing to keep in mind is that you must understand what you are expressing with that language. What kind of hardware is being "described" and how it works. For that reason, I'd recommend you get yourself some book on electronics in general and a good book like this one — HDL Chip Design (aka as a blue book). Get a simulator Before you start doing anything in hardware and use any Vendor-specific features etc., get yourself a simulator. I was starting with a Verilog, and used Icarus Verilog along with GTK Wave. Those are free open-source projects. Run examples you see in books, practice by designing your own circuits to get some taste of it. Get a development board When you feel like going forward, get a development board. If you know that your employer wants to go with Lattice, then get Lattice board. The programming methods are very similar, but there are details that are different. For example, different tools, different options, different interfaces. Usually, if you have experience with one vendor, it is not hard to switch. But you probably want to avoid this extra learning curve. I'd also make sure that the board comes with components that you are planning to use or is extendable. For example, if you want to do design a network device like a router, make sure the board has Ethernet PHY or it can be extended through, say, HSMC connector, etc. Boards usually come with a good reference, user guide and design examples. Study them. Read books You will need to read books. In my case, I had no friends who knew digital design, and this site wasn't very helpful either because of one simple thing — I didn't even know how to phrase my question. All I could come up with was like "Uhm, guys, there is a thing dcfifo and I heard something about clock domain crossing challenges, what is it and why my design doesn't work?". I personally started with these: Advanced Digital Design with the Verilog HDL. 100 Power Tips for FPGA Developers Advanced FPGA Design - Architecture, Implementation and Optimization. FPGA vendors have a lot of cookbooks with best practices. Study them along with reference designs. Here is one from Altera, for example. Come back with more specific questions While you go through your books, simulate a design, blink some LEDs on your development board, you would, most likely, have a lot of questions. Make sure you don't see an answer to those on the next page of the book or online (i.e. in the Lattice-specific forum) before asking them here.
H: If I change the hardware/chipset of a USB product, should I change idProduct or bcdDevice? The product looks outwardly the same, with the same model number, but the USB brains have been completely replaced, and the circuitry's been modified to fit them. The operating system needs to see different IDs in order to keep the drivers separate, right? But should I change the PID/idProduct, or should I change the bdcDevice? I'm assuming the real life consequences may be different from what the USB standard intended. idProduct Product ID (assigned by the manufacturer) bcdDevice Device release number in binary-coded decimal; silicon revision increments this value 0xJJMN for version JJ.M.N (JJ – major version number, M – minor version number, N – sub-minor version number) Hardware Semantic Versioning suggests the major version number should be changed, at least. AI: Change bcdDevice only, idProduct is for a new product but bcdDevice id is for the version number for USB device. This will work any OS incl. Windows XP or latest, and any Linux based OS. Linux kernel have this prop. and you can find this out by this link: http://lkml.indiana.edu/hypermail/linux/kernel/1205.0/02259.html
H: Wiring Considerations for numerous LED's I'm working on a hobby project where I'm going to need to wire up 40-80 (not sure exactly how many yet) LED's of various colors. Only 10-20 of them are going to be on at a time. This is going to be a hobby project and I'm by no means an electrician so I don't have the knowledge/skill or need for a highly technical highly redundant solution. This project is a prop; it's not small but it's not very big either so space is going to be a consideration. There are going to be 4 sets of LED's and only one set can be on at a time. Currently my plan is to use an Arduino board and some transistors along with a battery back from a RC car/helicopter/etc to power the LED's and insure that only one set is on at a time. Now for the questions: What considerations are there as far as wiring the groups of LED's up in Series vs Parallel? Being a small scale hobby project does it really make a difference either way? I read in another post on the site about a similar topic that it was recommended to use a current limiter. Is that something I should consider as well? As I said the power source will most likely be a battery pack from a hobby RC (LiPo or whatever they are currently making them out of). Are those consistent or will there be enough variation in the voltage/current that I need to find a way to mitigate the differences? If you have any other things I really need to consider for this project please feel free to note them so I can do some research. Please note when you respond that I'm not going to understand complex electrical diagrams or formulas. If the answer is pretty complex you might need to just point me in the direction of some reference material and let me research it. Also if you suggest using current limiters or any other specific pieces of equipment a link to any electrical website's part page for one of them would be appreciated. That will help me confirm I'm looking for the right thing when I get around to buying one. AI: Since you say you don't want a highly technical solution, then I suggest you simply buy a ready made LED strip. This way you don't have to worry about current limiting (which is absolutely needed), it's done for you. eBay sell thousands of these, but probably the best place to get them is Adafruit - their RGB Strips are likely to be half decent (they sell other versions too, have a browse), and they have a good tutorial on using them. Wiring Diagram Below is an example of wiring (from the tutorial above) using an N-Channel power MOSFET such as the STP16NF06 (gate pin 1, drain pin2, source pin 3):
H: Why is LED lighting up despite Supply voltage < Forward voltage I have an LED which has specified Typical forward voltage of 3.5V and Maximum forward voltage 3.9V. I applied 3.3V across it with a 300 Ohm resistor in series. Why did it light up? I am wondering if I can pick this LED as a reliable choice for my design (which as noted runs at 3.3V supply across the board). My thinking: The LED datasheet has a curve of Forward voltage vs current (I'm also confused why they put Forward current on the Y-axis instead of X, given that current is what one would vary here). Anyway, the curve shows a decrease in the forward voltage at smaller currents; perhaps this is the explanation? Here is the downloadable PDF datasheet for this LED (it's a tricolor LED and in this question, I was referring to the specs for Blue and Green). AI: You are correct - the forward voltage depends on the forward current. The forward voltage you see in the table of typical values is for a current of 20mA, which is too high when all 3 colors are used at the same time (footnote two in the absolute ratings table on page 3 - 15mA is the maximum in that case). When you look at diagram 2 in the data sheet, you can see the relation between forward voltage and forward current. What you see here is that for a forward voltage of 3.3V, a forward current of 20mA can be expected. With 3V, it would be 8mA. A higher resistor value doesn't make this more reliable, it just makes the LED darker. You want to have the resistor as small as possible. The resistor should be only large enough to drop the forward voltage to about 3.1V with a current of 15mA - this would mean a value of about 13.3 Ohms (the one for the red LED needs to be larger, though). Whether this LED is usable for you depends on the brightness you need. If you don't need it to light up fully (or you use a version with higher intensity, see page 4), it would work. If you want to be sure you can use the full intensity, you need to use another one. Olin is right - the variation between batches can also mean that some are brighter than others. To ensure a uniform brightness, you need to control the current flowing through the LEDs.
H: mc1322x on Contiki-os, development environment I want to ask if there is ready to run Virtual Machine image anyone to develop on mc1322x microchip on Contiki-os. Why I ask is this, I'm dealing with this for 3 weeks, and what I advance to take is nothing. Is there anyone who is experienced in contiki-os - mc1322x agreement? AI: Start with Instant Contiki. For specifics on using the mc1322x with Instant Contiki, see this page. There is a mc1322x mailing list where things like Contiki are occasionally discussed.
H: What use are the transistors in this (LM317 based) power supply circuit? I am looking to do a small bench power supply project and am studying various designs based around a LM317. Basic I know but I still seem to manage to have have some questions. Fig 22 on page 8 of the datasheet shows a design I am trying to understand. I've tried to redraw the schematic too, shown below. I understand that the adjustment pins are tied to -10 v to allow the output voltage to go down to 0 v. As I understand this is because of the voltage drop across the LM317. However I do not understand the function of the transistor. If I am reading the schematic correctly they are N channel depletion type MOSFETs. This would mean there should be a path from drain to sink (-10 v) unless a voltage difference exists between source and gate. Given the gate does not appear in the schematic so I guess is not tied to anything so is floating, does this hold some significance? It would appear to me that current is free to flow from drain to source in the current state, so what is the the use of the transistors? AI: Actual data sheet circuit is as shown at end of this answer. Note that gate is connected to source in each case, not floating. Note that the transistors are depletion mode JFETs which behave somewhat differently than MOSFETs or any enhancement mode FET would in this application. Q1 and Q2 are both obsolete parts which will be hard to find and expensive if found. There are other ways to do the same job - see below. 2n3822 data sheet here Q1, Q2 are depletion mode J-FETs. When the gate is connected to source they are ON and need gate to be driven -ve relative to source to be turned off. When connected as shown they form a constant current source. It is more important that the current is approximately constant than that the current be an exact value. This is fortunate as for eg the 2N3822 the zero gate voltage drain current is specified as 2 mA minimum and 10 mA maximum. (See datasheet page 1) LM317(1) acts as a variable current limit. Q1 provides a constant current to the 1k//(D1+D2) string. Operation of the circuit is described by figure 23 on page 9 of the datasheet - see below. Q1 can be replaced by any constant current source circuit that works with the available voltage and which will provide below -1.25V at the bottom of D2. Accuracy and actual current are not especially critical. LM317(2) acts as a controlled voltage source. Here Q2 constant current is usually sunk by D3 + D4 which act as a negative voltage reference of 2 x diode drop or about - 1.2V to allow the wiper of potentiometer "adjust 2" to be pulled below ground by that much if desired to allow Vout of LM317(2) to reach ground.
H: Circuit to assign hardware addresses I'm designing a system with a master board and a variable number of identical daughter boards that I would like to connect in a chain. The master board contains a microcontroller but the daughter boards don't contain anything intelligent. The master board will only connect to one daughter board, and each daughter board will be able to connect to a next daughter board. I'd like to figure out a way for the master board to be able to detect how many boards are connected to it, and be able to send signals to each board depending on where that board is in the chain. Does anyone have a good idea for this? The simpler the better. AI: The simplest way to create a generic "board select" signal is to create a distributed shift register, as shown below. This is similar to what you do when you use a 74xx595 as an I/O expander, and also similar to how JTAG works. The microcontroller can select any one (or even more than one) daughter board by shifting the appropriate pattern of ones and zeros into the flip-flops. Each daughtercard also has an open-collector transistor that pulls down on an ACK line whenever it is selected. This allows the microcontroller to count how many daughtercards are present, by shifting a single one into the first card, and then counting how many clocks it takes for the ACK line to go high. Note that the ACK line may not be necessary if you have some other means of determining that a board is selected, such as seeing whether it responds to a SPI bus cycle. Note also that if you need an active-low board select signal, just use the not-Q output of the flip-flop. This scheme does not need any sort of loopback on the last daughtercard.
H: Linear Circuit Analysis: Source Transformation * source transformation is just a combining and rearranging voltage or current sources. I don't think its a universal term. and I'm stuck. any hint? AI: Now solving the circuit using mesh analysis:- For Left Loop:- 160 Im +200 Im+120 (Im-Is) = 24 .....eq (1) For Right Loop:- 120 (Is-Im) + 190 Is = 36 + Vs .....eq (2) => Since Is = 0.25A & putting in eq(1) Im= 9/80 = 112.5 mA => Vs = 28 V
H: Print a PCB layout several times in the same sheet at once in Proteus How can I replicate my layout so I can print several of them in the same sheet without having to do it manually (printing one layout each time and setting its position relative to the previous printing)? In this layout example, the sheet has room for nine of them. PS: as the image shows, I'm using Proteus/Ares version 6.9. AI: Panelisation (which it what you're trying to do) isn't possible in the printer output. However, Ares does have a panelisation mode, and if you use that to create your multiple copies the printer mode will output them all just fine. It is a bit of a roundabout way of doing things (intended for manufacture rather than printing, one presumes), but this it how you do it: Export the design as gerber output. Use the Gerber viewer mode to view the gerber output. Make sure you tick the panelization mode option. Use block copy to copy the layout how you want it, then... Output to the printer as you were doing before.
H: How to store audio data for AVR project? I see a lot of projects for AVR-based audio players that use an SD card to store the audio data. In fact, I am currently doing the very same thing on an Arduino and its Wave Shield, which has an SD card reader. However, I'd like to develop a device that stores the sound on onboard EEPROM or Flash memory rather than a removable medium. The current files are 16-bit mono 22Khz PCM WAV's and altogether require 620 kilobytes. I'm not sure what to look for in memory chips. I know I'll need sufficient storage per the above requirements. The device won't record nor alter the data, so additional capacity is unnecessary. Obviously I want to select the lowest-cost solution that will still meet the requirements: Must store at least 620 KB Will need to be fast enough to support 16-bit 22Khz 1-channel playback Compatible with AVR microcontrollers Can be write-once Must retain data without power Preferably SMD package but through-hole is acceptable Some general tips on adding and using flash (or other types) of memory would be greatly appreciated! AI: I would recommend that you look at the modern SPI FLASH type parts. Winbond is one manufacturer that makes a nice range of parts that would be perfect for deployment in the SPI hardware interface on your AVR. Digikey stocks the Winbond parts that are available in capacities as follows: 1 MByte for 0.50$ USD http://www.digikey.com/product-detail/en/W25Q80BVSSIG/W25Q80BVSSIG-ND/2202664 2 MByte for 0.74$ USD http://www.digikey.com/product-detail/en/W25Q16BVSSIG/W25Q16BVSSIG-ND/2208449 8 MByte for 3.01$ USD http://www.digikey.com/product-detail/en/W25Q64DWSSIG/W25Q64DWSSIG-ND/3008691 Other sizes are made but not currently in stock. These parts are very easy to add into a circuit. The SPI port pins SPI_CLK, SPI_MOSI and SPI_MISO connect directly to three pins on the SPI Flash. +3.3V and GND are suitable power for the part and make sure to add a 0.1uF bypass capacitor across the chip power pins. The remaining pins /HOLD and /WP can be simply pulled up to 3.3V via 10K resistors. For SPI FLASH parts such as these you also have to support a /CS pin to the part. You cannot just tie this to GND as the part is designed to reset the command state machine when you drive the /CS pin high so as to get ready for the next command. SPI FLASH parts such as these are accessed in blocks of data. The types I linked to here support block sizes of 4K bytes which are initially addressed in the read/write commands via a multi-byte address included in the commands. In your application it would not be necessary to have a RAM buffer to load a whole read block into. You could start the read of a SPI FLASH block and then read out a few bytes at a time and feed those to your audio player hardware. Each time you cross the 4K boundary you can send the command again to address to the next block. It is however possible to send a command to start at some particular block and then as long as you hold the /CS pin low and continue to supply clocks it is possible to sequentially read out the whole memory part if need be. Note that these parts support reading and writing in the single bit wide legacy modes which is presumably the way you would use them with the AVR. They also support reading and writing in 2-bit and 4-bit modes for super high speed data transfer modes but those modes require a SPI controller capable of dealing with the wider dual and quad serial data modes.
H: How is wristwatch with 10 years battery life possible? Turns out Casio offers a handful of wristwatches with "10 year battery life". The claim is that thanks to "an advanced technology" the battery life in those watches is extended to ten years. Now if you look at different models you see that they are rather complicated hence likely energy consuming - for example, AW-80-1AV model has both a liquid crystal display and hands and also it has LED illumination and a sound alarm. I first thought that maybe the battery is the key. Model AW-80-1AV runs on CR2025. Energizer CR2025 datasheet specifies that this battery has nominal output voltage of 3 volts and nominal capacity of 163 mAh, so it stores 0,489 volt-ampere-hours of energy. For comparison, typical basic model of Swatch run about three years on Renata silver oxide 390 (SR1130SW) battery that has nominal output voltage of 1,55 volts and nominal capacity of 60 mAh and so stores 0,093 volt-ampere-hours of energy. So CR2025 stores about five times more energy, but the basic model of Swatch only has hands - no digital display, no illumination, no alarm, so it likely consumes less energy. There clearly must be something more than a bigger battery that makes 10 years battery life possible. How is 10 years battery life possible in a rather energy consuming wristwatch? AI: 10 years =~ 87650 hours. 1 uA drain will require 87.75 mAh in 10 years. With som shelf life degradation that's close enough to = 10 mAh / uA / year or = 100 mAh / uA / 10 years So your cited 163 mAh battery will supply 1.63 uA mean. Pushing technology, size and luck may get you to say 5 uA mean. There are 86400 seconds/day. There are 1440 minutes/day. You will find that eg alarm use is much restricted in the allowable use to get 10 years. If 1 uA of the drain is for alarm use then you get 24 uA.hr/day or 86400 uA.seconds or 86 mA.seconds. That's about 240 mW seconds at 3 V. Or say 5 x 50 mW x 1 second burst/day. An LED can provide ample lighting at 1 mA. Use it 5 times/day x 1 second = 5 mA.sec = 5000 uA.sec or "only" 5000/86400 = 0.06 uA mean drain. Increase as desired and allowed. Can you run a time keeping IC on say 1 uA? Probably yes. So overall it all falls in the area of "notionally possible if really really really clever and careful". Casio can be expected to be quite clever by now. Note that if any sort of energy harvesting is being used then all bets are on. Harvesting a uA or few sounds doable. REAL WORLD EXAMPLE: There are many others. In September 2012 user Hli commented: An EFM32, which is an ARM Cortex M3 MCU, can run on about 1.45µA while driving a LCD (550nA for the LCD, and 900nA for running the RTC and keeping its RAM). So a chip keeping only time should be capable to run on much less than that The link he then provided is now broken, so: EFM32 "Gecko" family are M0+, M3, M4 ARm Cortex microcontrollers from Silabs Silabs EFM32 search Wonder Gecko EFM32™ Wonder Gecko 32-bit ARM® Cortex®-M4 Microcontroller Silicon Labs’ EFM32™ Wonder Gecko 32-bit microcontroller (MCU) family includes 60 devices based on the ARM® Cortex®-M4 core, which provides a full DSP instruction set and includes a hardware FPU for faster computation performance. Wonder Gecko MCUs feature up to 256 kB of flash memory, 32 kB of RAM and CPU speeds up to 48 MHz. The MCUs incorporate highly differentiated Gecko technology to minimize energy consumption, including a flexible range of standby and sleep modes, intelligent peripherals that allow designers to implement many functions without CPU wake-up and ultra-low standby current. With the lowest active and standby power consumption, the Wonder Gecko is the world's most energy friendly Cortex-M4 MCU. Other xxx-Gecko variants M0+, M3, M4 Digikey listings of "Gecko" - legion Lowest cost in 100's with LCD EFM32TG822F32-QFP48T$US2.03/100 Digikey Lowest power useful mode with RTC running - EM2 - deep sleep In EM2 the high frequency oscillator is turned off, but with the 32.768 kHz oscillator running, selected low energy peripherals (LCD, RTC, LETIMER, PCNT, LEUART, I 2C, LESENSE, OPAMP, WDOG and ACMP) are still available. This gives a high degree of autonomous operation with a current consumption as low as 1.0 µA with RTC enabled. Power-on Reset, Brown-out Detection and full RAM and CPU retention is also included. EM1 - sleep In EM1, the CPU is sleeping and the power consumption is only 51 µA/MHz. All peripherals, including DMA, PRS and memory system, are still available EM0 - running In EM0, the CPU is running and consuming as little as 150 µA/MHz, when running code from flash. All peripherals can be active. So running in EM0 for 1 ms/s adds 0.15 uA to the EM2 standby load. Overall, operating in EM2 at around 1 uA mean plus EM0 as required would allow the 10 years / 163 mAh example target to be met. ___________________________________ Energy harvesting: Vibration and motion may well be possible energy sources. A silicon solar PV/solar panel seems viable. Very roughly power available is 150 Watts/m^2 at 1 sun = 100,000 lux. A 10mm x 10mm "panel" at 10 lux at those ratings would provide ~= 150 Watt x (0.01m x 0.01m) x 10lux/100000lux = 15 microWatt. 10 lux is dim roomlight - at the level where colour fades into monochrome. Dim! If that level of sensitivity can be maintained at such low light levels (as it quite possibly can with other 'chemistries') the light powering looks viable.
H: Where can I get WirelessHART systems? The only system I have found is from DUST Networks (aquired by Linear), but no other implementations. Is it possible to implement the architecture on other microcontrollers? I want to program a microcontroller with HART and communication to my external sensors, and not buy a finished box. AI: The Hart Communication Foundation has a list of all registered HART members: http://www.hartcommproduct.com/inventory2/index.php?action=listcat&search=search...&tec=2&cat=&mem=&x=24&y=15
H: Why are lightbulbs considered resistive load? A lightbulb (a plain old incandescent lamp) is typically brought up as an example of resistive load. Yet the filament is actually made of several feet of very thin wire cleverly coiled to form a filament which is about one inch long. Clearly coiling the wire this way makes the filament more or less similar to an inductor. Yet lightbulbs are not considered inductive load. Why are lightbulbs considered resistive load with a filament made of coiled wire? AI: The reactance at 50 or 60 Hz is simply negligible. According to this calculator a coil of 100 turns 1 mm diameter, 25 mm long is 0.04 µH. At 50 Hz that's 12 µΩ. A 60 W bulb at 230 V has a resistance of 880 Ω, then the 12 µΩ is only 0.014 ppm of that, and the cos(φ) = 0.999999999999999902. Shall we say "1"? The filament isn't coiled to add reactance, but to increase the resistance, by making the filament longer. Higher power bulbs don't need the higher resistance, and therefore often don't have a coiled filament. The alternative for increasing resistance would be to decrease the filament's diameter, but then it would become too fragile.
H: Specify include path in Quartus II I'm compiling Verilog using the Quartus II for the Altera platform. In my Verilog, I have a Verilog header global.vh, and Quartus II cannot find it: Error (10054): Verilog HDL File I/O error: can't open Verilog Design File "global.vh" Is there a way to specify an "include path" for Verilog header files in Quartus II? (Note that the header file can be found when placed in the root directory for the Quartus II project.) AI: Altera recommends that you use the SEARCH_PATH assignment to define the project libraries. You can have multiple SEARCH_PATH assignments. However, you can specify only one source directory for each SEARCH_PATH assignment. For example: set_global_assignment -name SEARCH_PATH "../other_dir/library1" set_global_assignment -name SEARCH_PATH "../other_dir/library2" set_global_assignment -name SEARCH_PATH "../other_dir/library3" Please refer to Managing Quartus II Projects document for more details.
H: Specify exact pin locations on FPGA I have an Altera Cyclone IV FPGA, and I use the Quartus II software as the compiler. In the "PinPlanner" it is possible to specify groups of pins (e.g. data buses). For each group, an I/O bank and an I/O standard (e.g. LVDS) can be specified. Then, the fitter (place and route) provides specific "Fitter Locations", specifying a precise pin for each individual wire. Is there a way to specify the precise pin locations before the fitter attempts to fit the pins within each bank for me? Can this be done in the Pin lanner? AI: There are two ways of specifying PIN assignment — you can either use PinPlanner or set_location_assignment to specify the PIN along with set_instance_assignment to specify the IO standard. I recommend you read I/O Management documentation from Altera. But here are few examples: These are location assignments for 1 GbE RGMII Ethernet Interface: set_location_assignment PIN_D25 -to eth_tx_clk set_location_assignment PIN_V6 -to eth_rx_clk set_location_assignment PIN_D17 -to eth_rx_c set_location_assignment PIN_G20 -to eth_tx_c set_location_assignment PIN_M20 -to eth_reset_n set_location_assignment PIN_E21 -to eth_rx_q[0] set_location_assignment PIN_E24 -to eth_rx_q[1] set_location_assignment PIN_E22 -to eth_rx_q[2] set_location_assignment PIN_F24 -to eth_rx_q[3] set_location_assignment PIN_J20 -to eth_tx_q[0] set_location_assignment PIN_C25 -to eth_tx_q[1] set_location_assignment PIN_G22 -to eth_tx_q[2] set_location_assignment PIN_G21 -to eth_tx_q[3] set_instance_assignment -name IO_STANDARD "2.5 V" -to eth_rx_c set_instance_assignment -name IO_STANDARD "2.5 V" -to eth_tx_c set_instance_assignment -name IO_STANDARD "2.5 V" -to eth_tx_clk set_instance_assignment -name IO_STANDARD "2.5 V" -to eth_rx_clk set_instance_assignment -name IO_STANDARD "2.5 V" -to eth_rx_q set_instance_assignment -name IO_STANDARD "2.5 V" -to eth_reset_n set_instance_assignment -name IO_STANDARD "2.5 V" -to eth_tx_q And here is an LVDS clock input to FPGA: set_instance_assignment -name IO_STANDARD LVDS -to in_clk_100 set_location_assignment PIN_AJ19 -to in_clk_100 set_location_assignment PIN_AK19 -to "in_clk_100(n)" Hope it helps. Good Luck!
H: On high voltage power lines, what is "residual power"? In a television show, high voltage power company workers were helping an animal to safety which climbed up a tower carrying high voltage power lines. The commentator said that though the power was shutdown but still the 'residual power' will be fatal to the rescuers and animal. If that is correct, what is residual power? How it becomes residual? Or is it just a myth? Does it some how relate to static electricity? I had attempted to search Google and this site for the answer and could not find any. AI: Transmission lines can be modeled as some inductance per unit length and some capacitance to ground per unit length with some resistance to account for losses. The equations to model this behavior can be found in these lecture notes. The "residual power" is the stored electric charge in the capacitive section of the transmission line. This is a potentially dangerous charge that exists even after the power has been removed. Similar to the charge found in the capacitors in old TV sets and the flash section of cameras. The amount of time it takes for the charge to decay depends on atmospheric conditions (mainly humidity): The decay time of residual DC charge in a 500kV transmission line had once been measured during five fine and dry days of winter season. The results showed a large scattering without depending on the simultaneously observed weather conditions, such as temperature or relative humidity. Then the authors have performed an additional experiment in a laboratory to discuss the factors that affect the residual dc charge leakage in a dry condition focusing on the moisture in the air and the dusts floating in the atmosphere. It is shown that absolute humidity alone decides the decay time without scattering under clean and calm condition. The floating dusts blown up by the wind, however, reduce the decay time and bring a large scattering. The dusts should be a charge carrier moving freely in the atmosphere.
H: How to disable a single op-amp in dual packaging? I am using a dual op-amp package in a circuit, however I only need to use one. Is there anyway to disable the other op-amp so it doesn't inject electrical noise in my circuitboard? I think grounding the positive input and setting the op-amp into unity gain might be best, but I am not certain. AI: A unity gain buffer is what this article also suggests. Quote: The best thing to do with a surplus op-amp it is to use it. There are lots of places in an analog circuit where a buffer amplifier may improve performance - and a unity gain buffer uses no extra components. Grounding the non-inverting input is fine if you have a dual power supply. If you use a single supply you better set the input to Vcc/2 with a resistor divider: (from the same article)
H: Which is pin 2 on a Harwin Datamate connector? The datasheet for M80-6651042 Harwin Datamate connector shows us which pin is pin 1. But which is pin 2? Is it the one to the left, or the one below? Is there a standard direction that pin numbering always goes in for dial row connectors? AI: By far, most connectors of this type put the odd-numbered pins on one side and the even-numbered pins on the other, so the answer would be that pin 2 is below pin 1 in this drawing. The reason for this is that this type of connector is often used in conjuction with ribbon cable, and this makes the numbering in the cable sequential. However, I have seen rare exceptions to this, where pins 1 to N/2 went down one side, and the rest down the other. If you can see the board silkscreen, see if there are any clues indicating whether this might be the case. If you are designing a new board with this connector, of course, the final answer is entirely up to you.
H: Possible to tap a PLL signal as a clock for multiple devices We have an oscillator providing a clock signal for an MCU. It has oscillator in and out pins: XTAL-IN and XTAL-OUT. We'd like to use the same clock signal as a digital clock input to another MCU. Can I simply tap the XTAL-IN signal and use that directly as the input to the other MCU, or will this interfere with the PLL? AI: This can be done but it requires extremely careful analysis to make it work reliably. You should generally tap your signal off the XTAL-OUT (a.k.a X2) pin as this is the output of the on chip oscillator circuit and drives a higher signal amplitude and the driver will have lower node impedance. This is particularly important if the XTAL-IN (a.k.a X1) and XTAL-OUT pins are connected to an actual crystal. Added capacitance, particularly at X1 pin, can change the operating frequency of the oscillator circuit or prevent it from starting up reliably. Tapping either the X1 or X2 pins requires consideration that these are analogue signals and do not normally traverse between full digital logic levels. The tap circuit load needs to be high impedance and needs to be able to translate the low level analog signals to the type of signal needed for the load at the next circuit in line. If you instead are driving the XTAL-IN pin with some type of external oscillator device it may already be providing a full logic swing signal. In that case the external device may very well be quite capable of driving to the XTAL-IN pins of multiple MCUs with no problems at all.
H: What's wrong with this casting in C code for AVR? I defined two variables: uint8_t a[2]; uint16_t b; Next I want to use a as variable of type uint16_t, e. g. b = (uint16_t)a; But this is wrong! My programs doesn't works correctly with such code. All is OK when I replace b to uint8_t b[2] and use elementwise operations. Why? AI: a is a pointer to an array of bytes. If you cast it to a uint16_t and assign it to b, then b will contain the address of the base of the array (where it is stored) in SRAM. If you want to treat the two bytes of the array a as an integer, then use a union as suggested by user14284, but be aware that the union will represent the byte array in the memory byte ordering of the architecture (in AVR that would be little-endian, which means byte 0 is the least significant byte). The way to write that in code is: union{ uint8_t a[2]; uint16_t b; } x; x.b[0] = 0x35; x.b[1] = 0x4A; // by virtue of the above two assignments x.a == 0x4A35 // is true Another way to do this without using a union is to cast a to a uint16_t pointer and then dereference it like so: uint8_t a[2] = {0x35, 0x4A}; uint16_t b = *((uint16_t *) a); b == 0x4A35; // because AVR is little endian If you are using the buffer to store big endian data (e.g. network byte order), then you'll need to byte-swap to use either of these techniques. A way to do that without any branches or temporary variables is: uint8_t a[2] = {0x35, 0x4A}; a[0] ^= a[1]; a[1] ^= a[0]; a[0] ^= a[1]; a[0] == 0x4A; // true a[1] == 0x35; // true Incidentally this is not an AVR or even an embedded-only problem. Application level networking code written for PCs typically calls functions called htonl, htons (host to network, 32- and 16-bit variants) and ntohl, ntohs (network to host, 32- and 16-bit variants) whose implementations are target architecture dependent as to whether they swap the bytes or not (under the assumption that bytes as transmitted 'on the wire' are always big-endian when they are part of multi-byte words).
H: Which 3.3V I/O standard should I use? I am using the Altera Quartus II PinPlanner to enter all my pin details for my FPGA design. Some of the pins are connected to the SPI configuration bus of this ADC. As can be seen on page 8, the 3 pins SCLK, SDATA, and SEN must be driven at 3.3V. Now the pin planner gives me three different 3.3V options: 3.3V LVCMOS 3.3V LVTTL 3.3V PCML Which of these I/O standards should I use for my ADC? AI: Whenever you see a VIH specification of 2.4 V and VIL of 0.8 V — i.e., fixed voltages, not a fraction of the supply voltage — that's LVTTL.
H: real time clck -RTC DS 1307- to Arduino I am trying to connect the ds1307 to Arduino to get the the time on the LCD and I used this circuit in my project and I tried the example code in the library but it didn't work. What could the problem be? the code: #include <Wire.h> #include "RTClib.h" RTC_DS1307 RTC; void setup () { Serial.begin(57600); Wire.begin(); RTC.begin(); if (! RTC.isrunning()) { Serial.println("RTC is NOT running!"); // following line sets the RTC to the date & time this sketch was compiled //RTC.adjust(DateTime(__DATE__, __TIME__)); } } void loop () { DateTime now = RTC.now(); Serial.print(now.year(), DEC); Serial.print('/'); Serial.print(now.month(), DEC); Serial.print('/'); Serial.print(now.day(), DEC); Serial.print(' '); Serial.print(now.hour(), DEC); Serial.print(':'); Serial.print(now.minute(), DEC); Serial.print(':'); Serial.print(now.second(), DEC); Serial.println(); Serial.print(" since 1970 = "); Serial.print(now.unixtime()); Serial.print("s = "); Serial.print(now.unixtime() / 86400L); Serial.println("d"); // calculate a date which is 7 days and 30 seconds into the future DateTime future (now.unixtime() + 7 * 86400L + 30); Serial.print(" now + 7d + 30s: "); Serial.print(future.year(), DEC); Serial.print('/'); Serial.print(future.month(), DEC); Serial.print('/'); Serial.print(future.day(), DEC); Serial.print(' '); Serial.print(future.hour(), DEC); Serial.print(':'); Serial.print(future.minute(), DEC); Serial.print(':'); Serial.print(future.second(), DEC); Serial.println(); Serial.println(); delay(3000); } ============================ AI: It won't work if there are no pullups on the lines, because I2C uses an open drain bus. Add a 2.2kΩ resistor (can be anything between this and 10kΩ, a lower value is better for long lines and higher clock speed) from SCL to +5V and also another one from SDA to +5V (so one between DS1307 pins 5 and 8, another one between pins 6 and 8) . The resistors (marked Rp) are shown below: If you need the square wave out, you will also need a pullup on this too, details are in the datasheet.
H: Are there any dangers to consider when replacing a permanent AA NiMH battery? The battery in my electric razor has failed to charge for several years. It does not turn on unless I leave it plugged in for 20 minutes and it turns off immediately if I unplug it. To save some money, save the world, and have some fun... I decided to take it apart instead of throwing it away. Inside I found a black NiMH battery without much of a description. Is it safe to replace this with any old NiMH battery with any mAh capacity? The electric razor seems to work fine with the new battery... but charging it might be an issue if it is made specifically for the built in battery. The charger says the output is 15v DC at 420mA. Is there anything I should consider in replacing this battery? Edit: I let the bad battery charge for an hour. It got up to 1.46 volts. After half an hour of letting it sit, its now at 1.39 volts. I measured voltage of the batteries as they were attached and detached from the charger. The good battery is charged to 1.41 volts and goes to 1.42 volts when attached. The bad battery is charged at 1.39 volts and goes to 1.4 volts when attached. I did something dangerous and discharged the bad battery with a paper clip. It's now at 1.21 volts and the voltage went to 1.33 while attached to the charger. In any case, the voltage is in the right range for the new battery. I'm still not sure if its doing smart charging since it seems logical that the voltage difference will become less as it gets closer to the chargers voltage. When I disconnect the battery and just measure the voltage across the battery connectors inside the razor, it measures .05 volts (while making a high pitched ringing noise). I'm guessing its doing some sort of smart charging if I haven't broken it yet. AI: I very seldom disagree with Olin technically. In this case there may be special circumstances which make part of his advice correct in general but specifically wrong in this case. As he notes, first it is necessary to establish the voltage across the battery to ensure it is in fact a single cell and not a number in series. As you say that the razor operates OK on the new battery then it is extremely likely that the old one is also a single cell. 15 VDC at 420 mA sounds just plain wrong. The voltage is high by a factor of about ten times, so maybe it's 1.5V. For a 2300 mAh cell the 420 mA would be C/(2300/420) ~= C/5. This is an OK charging rate BUT if the charging is not COMPLETELY terminated when the cell is charged the cell will "cook" in short order. For capacities up to 1500 mAh, maybe 1800 mAh NimH calls had special arrangements (chemicals and structures) which allowed recomination of Hydrogen when "gassing" occurred when a cell was left on charge when fully charged. This allowed manufcxaturers to specify a trickle-charge rate of say C/10 (230 mA for a 2300 mAh cell). At or below this rate the cell could be left on charge indefinitely with little or no damage. HOWEVER as the typical battery capacity arms-race occurred and capacities were pushed up to 2100 2300 many_lies 2500 2600 all_lies ... mAh the manufacturers looked for more space to fit active material into. Something had to go, and it was the gas recombination mechanism. Modern NimH cells above about 2000 mAh from reputable manufacturers have data sheet advice of the form: - Do not trickle charge at all! or Trickle charge at no more than C/20 or whatever for some_very_small_period or Can be trickle charged at <= C/100 on a good day downhill with the wind behind you. Any battery manufacturer whose data sheet says ... 2500 mAh ... trickle charge at <= C/10 can be safely shunned as a source of supply for all future time. SO when Olin says " ... In that case, the highest capacity battery is best since it will be abused less at the same current." - this is good advice in the general case BUT not so when using NimH where the charger is badly behaved. In such cases use of an older style 1500 mAh cell would probably [tm] give a much longer life. However - IF the charger really is a true 1.5V charger and if this is tightly controlled (rather than edging upwards as load current drops, then it MAY be OK. At say C/10 the terminal voltage of a NimH cell at room temperature at the end of charge will be ~= 1.45 V. 1.4 is safer and 1.5 is a bit high. Actual value varies slightly with manufacturer. Temperature much above 25C vary this voltage BUT also are best avoided. Higher charge rate lead to higher voltage st end of charge. SO - measure charger output. If it is 1.5V and no more your battery may last OK. If it rises to > 1.5V at light loads you MAY be able to load it down with a suitable resistor. But using a 1500 mAh cell is probably wise. Added: The 1.46 Volts after 4 hours sounds very good. That's 420 x 4 = 1680 mAh BUT the 1.46 volts sounds like a fully charged cell so presumably the cell was partially or filly charged originally. Try an overnight charge - if it's still at 1.46V they seem likely to have done a reasonable job of charge control. If you are able to measure the battery current on charge at the end of an overnight charge you will be able to tell if it is trickle charging. This can be accomplished by eg a battery interceptor / continuity break insulator against the +ve battery terminal and add a conductor on either side and take wires out to an ammeter. OR locate the battery externally and bring out two wires to it via an ammeter. Here's an example of a battery interceptor, From here = http://www.instructables.com/id/Remote-Power-Control-For-Battery-Powered-Devices/
H: What is a reasonable ohmage measurement for a microphone on a PC headset? I've taken apart my PC audio headset, because the microphone stopped working. This random website seems to imply that most microphones for PC headsets are "low impedance" between 150 and 300 ohms. After taking out the pickup unit, I find it is measuring at 850 ohms. I realize this is a simple resistance measurement, but I seem to recall that worked for debugging whether a DC motor was working. I was hoping it might also be an indicator of microphone health. What is a reasonable ohmage measurement for a microphone on a PC headset? At what ohmage would the microphone be considered broken? Update: Hmmm I'm seeing this page per the gracious Google, so maybe that answers my question. Perhaps most tiny pickups are actually classified as "Medium Impedance". AI: Although the method you link to may work in some cases for some microphones, it's definitely not a foolproof method of telling whether a microphone is faulty or not. For example, if we take the claim from the article: High Impedance If the microphone is measuring at a very high impedance, such as several MΩ, the microphone is definitely bad. It is reading a high impedance because there is a broken connection in it from the positive to negative terminal and the open path creates a very high resistance, since it's open. The microphone shown is an electret, which is a type of condenser microphone. The actual microphone element for a typical working condenser has a DC resistance of >>10MΩ (probably in the GΩ range - there is a reason why you measured much less than this which we will get to in a moment) It's AC impedance is much lower as it's basically a capacitor, and a capacitors impedance lowers with rising frequency, being infinite at DC (for an ideal cap, read very high for the real world) So obviously measuring a high resistance with a condenser element is not going to tell you whether the mic is faulty or not. It would not work with a crystal microphone either, and possible other more exotic types not metioned here. With mic elements like these, a low impedance would actually signal a fault. However, if the microphone is a dynamic (coil) or ribbon element, this approach would work, as there is a DC path through the element. So why did you measure a low impedance? This brings me on to the other thing to be aware of, that you have to be sure what it is you are measuring. Complete microphones are rarely just the element, they have circuitry that may completely mask any characteristics of the element. Also, the impedance will be different when measured at DC or AC - since a microphone is an AC device, the AC measurement is probably more important than the DC to test more thoroughly. Typical electret capsule internal circuitry example: Now when you measure the impedance at the left two points (the pins of the capsule) you get an impedance of around 1kΩ, which is not the mic elements impedance, it is the JFET drain to source impedance (marked 'D' and 'S') This JFET is a small transistor, used as an impedance converter (very high as mentioned above, to low) which means it amplifies the tiny current from the element itself (it also amplifies the voltage a bit). This has various benefits. The impedance is not static (can vary from a few Ω to many MΩ depending on gate source bias, although used like this it will only vary over a smallish range) and also depends on which way round you probe it - I just checked with a capsule here and got 2kΩ one way and 1kΩ the other. However with no sound the transistor should be biased partially on so you read it as a lowish resistance. The preferred way would be red probe to the + lead. Here is a picture of an open electret capsule with the electret diaphragm (shiny flat round thing in middle): And here with the diaphragm and backplate (flat round thing with holes) removed to show the JFET (black thing with 3 leads): Having said this, if you measure directly at the element and are certain no other components are in parallel and affected measurements then a very high or very low measurement will likely mean a fault. If this capsule was part of a microphone and you measured at the right hand two points on the above diagram, then the DC measurement would be very high, but the AC low. So hopefully you can see how important it is to know what/where you are measuring, and testing microphone operation is not always as simple as measuring DC resistance.
H: How to effectively generate random number with PICAXE 08M2? I'm wondering how to effectively generate random numbers with my PICAXE 08M2. The following is my code: ; Inputs symbol push_red = C.1 ; In 1 symbol push_buzzer = C.3; In 3 ; Outputs symbol buzzer = C.2; Out 2 symbol led_red = C.4; symbol action = b0 symbol randnum = w5; symbol randbit = w6; main: FOR action = 1 TO 5 RANDOM randnum LET randbit = randnum // 10 IF randnum > 4 THEN PAUSE 500 low led_red pause 500 high led_red ELSE SOUND buzzer,(100, 100) ENDIF NEXT action SOUND buzzer,(120, 200) Even though I'm generating a new random number with every loop, the result is always the same: LEDs light up, no sound generated. I've read some articles about dividing randnum by an appropriate number, but not sure how that works. AI: Like Dave says: you're using the wrong variable in the IF statement. IF randnum > 4 THEN should be IF randbit > 4 THEN As I understand from another question randnum is in the range 0..65535, then the probability that it's less than 5 is less than 1 in 10 000. So if you repeat the test a lot of times you'll hear the buzzer once or twice, but those chances are slim for a loop executed only 5 times.
H: Why don't wires have to be "covered" when making an inductor? Possible Duplicate: Why aren't solenoid/electromagnet windings insulated? Looking at some pictures of inductors, such as this one: (source: ddmcdn.com) The wires don't seem to be covered with a layer that prevents current from simply flowing from one wire to the next, all the way down. What keeps the electric current going in loops, rather than just flowing straight down the coil and producing no magnetic field? AI: They are actually covered, it's just a very thin transparent coating so it's hard to tell (if you take a knife and scrape the wire you will see the coating flake off and the slightly different colour copper underneath). This type of wire is called magnet wire. It does come in various colours:
H: bluetooth earphone with usb I have a Sony bluetooth earphone. It has a usb terminal, which I thought it was only for the purpose of charging power. But when I connected it to a computer, it seems like it is detected as a usb device, not just taking power from the computer. What is the purpose of it being designed to be detected as a usb device? I am planning to replace the usb terminal (mini B female) to usb A male so that I can charge power to it without cable. If I only connect V+ and V- and ignore Data+ and Data-, would I lose some function? AI: Most likely the data connection is for firmware upgrades, since 100mA is usually more than adequate for charging purposes for a Bluetooth earpiece. If you feel confident that the device is secure and working properly then you can go ahead and leave the data lines floating.
H: DECFSZ won't work on PIC16LF1823 I have a problem while trying to do a Delay on a PIC16LF1823. My program tries to toggle some bits on PORTC for 30ms. I did a simple Delay based on the decrement of a variable; however, each time the PIC execute the Delay it gets stuck on the Delay subroutine forever. I have tried everything and I traced the problem to the DECFSZ instruction (If it is removed the bits toggle without the delay and the program executes normally). Is this a known issue? Or, Am I doing something wrong? My configuration: 31kHz Internal Oscillator. Using MPLAB X and MPASM v5.46. I hope anyone can point me in the right direction; I have been trying to fix this for a week now. Thanks, Here's my code: INCLUDE "P16F1823.inc" ; CONFIG1 __CONFIG _CONFIG1, _FOSC_INTOSC & _WDTE_NSLEEP & _PWRTE_OFF & _MCLRE_OFF & _CP_OFF & _CPD_OFF & _BOREN_ON & _CLKOUTEN_OFF & _IESO_OFF & _FCMEN_OFF ; CONFIG2 __CONFIG _CONFIG2, _WRT_OFF & _PLLEN_OFF & _STVREN_ON & _BORV_LO & _LVP_ON org 0x00 GOTO Start org 0x04 GOTO Interrupt #Define LCK 0x01 #Define LTC 0x04 #Define RLS 0x05 IOA EQU B'00000011' IOC EQU B'00000000' IOP EQU B'00000011' ION EQU B'00000010' INT EQU B'10001000' OSC EQU B'00000000' OPT EQU B'11010000' CBLOCK d1 ENDC ;;;;;;;;;;;;;;;;;; ;;INITIALIZATION;; ;;;;;;;;;;;;;;;;;; Start BANKSEL PORTA CLRF PORTA BANKSEL LATA CLRF LATA BANKSEL ANSELA CLRF ANSELA BANKSEL TRISA MOVLW IOA MOVWF TRISA BANKSEL PORTC CLRF PORTC BANKSEL LATC CLRF LATC BANKSEL ANSELC CLRF ANSELC BANKSEL TRISC MOVLW IOC MOVWF TRISC BANKSEL OSCCON MOVLW OSC MOVWF OSCCON BANKSEL OPTION_REG MOVLW OPT MOVWF OPTION_REG BANKSEL INTCON MOVLW INT MOVWF INTCON BANKSEL IOCAP MOVLW IOP MOVWF IOCAP BANKSEL IOCAN MOVLW ION MOVWF IOCAN CLRF BSR ;;;;;;;;;;;;;;;;;; ;; MAIN PROGRAM ;; ;;;;;;;;;;;;;;;;;; Loop CALL Toggle GOTO Loop ;;;;;;;;;;;;;;;;;; ;; INTERRUPTS ;; ;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;; ;; SUBROUTINES ;; ;;;;;;;;;;;;;;;;;; Toggle ;; LATCH ;; CLRWDT BSF PORTC,LTC CALL Delay30ms BCF PORTC,LTC ;; WAIT ;; CALL Delay30ms ;;RELEASE;; BSF PORTC,RLS CALL Delay30ms BCF PORTC,RLS ;; EXIT ;; RETURN Delay30ms MOVLW 0x4C MOVWF d1 D30Loop CLRWDT DECFSZ d1, f GOTO D30Loop RETURN ;;;;;;;;;;;;;;;;;; ;;END OF PROGRAM;; ;;;;;;;;;;;;;;;;;; END AI: CBLOCK needs a value, otherwise it will be zero, and the variable won't be in in RAM. Set it to 0x20, which puts it at the start of the General Purpose RAM block. I can't see anything wrong with your delay routine and it worked OK when I simulated it to make sure, with CBLOCK set to 0x20. Remove the CLRWDT instruction and disable the WDT. Put d1 res 1 at the end of your program if you want to use Olin's preferred technique.
H: switch debouncing - would toggle switch still bounce I'm having the classic debouncing headache with the Arduino. The switch is meant to turn an led on and off. So if I use a toggle button (SPDT) would it still bounce? Maybe it won't since it not a push button. How much more would it cost to use toggle? It's just that it's a project I've been asked to do for my local Fabrication lab. AI: Most SPST switch or pushbutton will bounce, because there are only two states: contact closed (for instance low level) and contact open (high level through a pull-up resistor). This may seem obvious, but it's that hesitation when opening/closing that causes the bounce; just once is enough to make a toggle not work. You can debounce the switch with a capacitor, but since you're using it with a microcontroller it's cheaper to do it in software. I usually have a 32 ms (software) timer for keypad scans, and only accept a state change if it persists during two consecutive scans. That means you'll have a delay of maximum 64 ms, but since the button will be manually operated you won't notice such a short delay. You mention a SPDT button, and that's the best solution if you want to do it in hardware. But frankly, I see no reason for not doing it in software, and you'll have much more choice in SPST buttons than in SPDT buttons. If you want a button which hardly bounces then I can recommend the Alps SKQG tact switch which with the devices I tested had an initial bounce of less than 10 ns.
H: What is the I/O standard for the PCIe data lines? I am entering the pin information of my FPGA design using the Altera Quartus II PinPlanner. One of the components of my design is PCIe, and I am having troubles understanding the "I/O standard" associated with the PCIe data pins (one rx and tx for each PCIe lane). This website claims that the PCIe lines are LVDS. However, looking at the example given for my FPGA devkit (which contains PCIe) I see that they are using either 1.5-V PCML or 2.5V I/O standards, not LVDS. What is the I/O standard associated to the PCIe data line? Could the Altera Cyclone IV require a PCIe I/O standard that is somehow different from the PCIe electrical specifications? AI: Did You try typing "PCI Express" in Google and give it a shot to feel lucky, huh? Wiki clearly says: At the electrical level, each lane consists of two unidirectional LVDS or PCML pairs at 2.525 Gbit/s. http://en.wikipedia.org/wiki/PCI_Express
H: Voltage divider for Xbee's ADC - what resistor values? I have an analog sensor which outputs a value in range 0-3V depending on soil moisture. The Xbee's ADC requires a value between 0 and 1.2V. I was thinking about using a simple voltage divider: Where R1 would be twice as large as R2 thus giving me effective 1/3 voltage division. The part I do not get is what size resistors should I choose? While keeping in with the resistor ratio, I have tried a small resistor value first - around 100ohm for the R1. This did not give me any reading on my Xbee. Then I found an online tutorial for a different type of sensor (LM335) where they used 100Kohm for the same one and I found this to seemingly work a bit better in my case, giving me varied reading according to varying soil moisture. How can I calculate what would the best resistor sizes for this application? Some information about the rest of the circuit: My power supply is 5V and the is powered directly from it, the Xbee also has a voltage regulator to bring it down to its required 3.3V (active XBBO). Grounds are connected. EDIT After bit of trial and error, I have determined the sensor website must be wrong because the moisture sensor behaves as it would have 10kΩ resistance (impedance) - I was able to half its voltage by simply using another 10kΩ resistor connected to the ground (and third it using two of those resistors). All the measurements seem to be working just fine so I may get away without using the amplifier. Either way, it would be useful to know what the parameters of Xbee's ADC are as the voltage requirements are different compared to the Series 1 which makes me reluctant to simply assume that the information is the same. Anyway, that brings me to the basic question again - knowing the sensor impedance and other parameters of the circuit, how do I determine what resistor sizes would be a good match? Lastly, thank you all very much for your input and help so far! AI: According to the product details, the output impedance is 100kΩ, so 100Ω would almost completely short the signal. To get 1.2V from 3V, you need a ratio of 1.2 / 3 = 0.4 Assuming a steady 100kΩ output impedance, you will need a single 66.6kΩ resistor from the sensors output to ground to divide the range down as necessary: 3V * (66.6 / 166.6) = 1.2V Looking at the xBee datasheet, the ADC input impedance is only 10kΩ, so an signal impedance of ~40kΩ (which is what you would have with the above) is not ideal, and you may lose accuracy. Ideally, the best thing would probably be to use an simple non-inverting opamp placed in between this and the xBee ADC input to buffer the signal.
H: Arduino Uno replace with Atmega8 Can I take out the Atmage328 and replace with a Atega8 for programing instead of trying to program using a breadboard? AI: Atmega8 has a smaller memory but should be a pin-compatible replacement to the Atmega328 for most purposes. Note, however, that the Atmega8 does have a smaller memory, and also a few registers are different, so some might not work, but most common ones should work just fine. In terms of the Arduino environment, you'll need to do two things: First burn the corresponding Arduino bootloader (the one named "Arduino NG or older w/ ATmega8" in the Arduino IDE) onto your Atmega8 chip. To burn the bootloader onto the Atmega8 chip, you'll have to either use an AVR/ICSP programmer or use another Arduino board as the ISP. And when you are uploading sketches, be sure to select the correct board (again, the one named "Arduino NG or older w/ ATmega8") from the menu in the Arduino IDE. EDIT: Read these documents to understand how to use a second Arduino as an ISP (In-circuit Serial Programmer) in order to burn the bootloader onto a new chip: First, and Second, and Third
H: Do I need to solder on my DE2 board to replace a broken segment? I've already posted a question here about this when I realized that all things were not right with my Altera DE2 board: Is this display broken or is it a bug? After verifying that the segment indeed is broken, I contacted Altera who could send me new segments that they mean should be able to replace the faulty part. But how do I replace a segment? Do I need to do soldering? When I turn around the board and look at it, it looks like the segments are soldered and that the only way to repair my board is if I do soldering and solder on a new part. Is this operation too risky, what alterantives do I have? Did I understand correct that I must solder? Details: ---------- Forwarded message ---------- From: Niklas R Date: Thu, Sep 13, 2012 at 1:01 PM Subject: Re: Broken segment of a new DE2 display? To: Cc: , F Lundevall Thank you very much Gina. Maybe I have another question how to mount the parts when it arrives, and therefore I might contact you again with a question when the parts have arrived. I wonder if I must solder the new display or how the new display will mount to the board. Sincerely, Niklas On Thu, Sep 13, 2012 at 9:38 AM, Terasic - Gina Tai wrote: Dear Niklas, The parts have been shipped today (09/13) via DHL Tracking#1959119923. It usually takes about 3 business days for the delivery. Feel free to contact us again if you need any further assistance. Thank you & have a nice day! Gina Gina Tai Sales Department Not satisfied with our customer service? Send your feedback to us at 2012/9/12 下午 07:08, Niklas R 提到: Thank you. My details are Niklas Rosencrantz Styrmansg 47a 114 60 Stockholm Sweden Phone On Wed, Sep 12, 2012 at 12:25 PM, Terasic - Gina Tai wrote: Dear Niklas, No worry, I'll send 5pcs x LCD segments for you to replace the broken parts. Please provide your shipping information, including a valid contact phone#, thank you! Gina Gina Tai Sales Department Not satisfied with our customer service? Send your feedback to us at 於 2012/9/11 下午 10:56, Niklas R 提到: Thank you for the reply. It seems that segment E of HEX 3 is broken after I performed additional tests. This is a new DE2 board bought from Altera in August via my university program kth.se and the board has no signs of damage but segment E of HEX 3 display is not working: Can it be repaired or replaced or can you suggest a solution? Thank you Niklas Rosencrantz Styrmansg 47a 114 60 Stockholm Sweden On Tue, Sep 11, 2012 at 12:59 PM, Terasic Support Team wrote: Dear Niklas, There is a tool- control panel provided in the CD-ROM, please use it to test the function of the 7-segment displays on board. And feedback us the result. If it really exsits the problem onto the segment, please contact our sales team for a solution, thank you. Free to contact us if you have any other inquiry. Best Regards Amy Zhou Amy Zhou Technical Support Department Not satisfied with our customer service? Send your feedback to us at Niklas Rosencrantz 写道: Hello I bought a new DE2 board via myUniversity program (kth.se) Now I wonder about a technicality that I've written to the forum and asked about http://www.alteraforum.com/forum/showthread.php?t=37522 Is this display broken or is it a bug? It looks like a segment E on the display is not working and that this is a broken segment: That is in segment E where is says 9 there should be an 8 and I can't get that segment to light no matter what tests or programs I run. Is this something you can help me with, is my new DE2 card broken, was it a bad solder / joint that has gone up during transport or is this - unlikely as it may seem - a software bug? I think everything seems that segment E in one of the displays is broken and I wonder what can be done about it - fix it, replace and/or buy new part or new board? Thank you Niklas Rosencrantz Update With an experienced engineer I looked at the board and the engineer almost immediately said that we should handle it over to some expert and since the board is about new the warranty should handle this and I should bring the board in to where I bought it so that is what we are going to do. Because if I solder it myself I must destroy the warrant of the product which was bought as late as in august from Altera in Taiwan via their Stockholm office in Kista. Update 2 I now got a complete replacement board from Altera but it's the "better" DE2-115 so now my old.sof file won't work anymore... AI: Looking at this picture of the board it looks like the displays are soldered to the board. Desoldering PTH parts from plated-through holes can be painful: you have to be sure that all the solder is removed from all the holes, and the plating-through doesn't exactly help. The best thing you could do is try to borrow a desoldering station, where you can heat the two rows of pins simultaneously, and then pull the display. Then use a desoldering suction pump to make sure all holes are open before inserting the new display. If you can't get a desoldering station you'll have to use the suction pump and desoldering braid to remove the solder from the holes. In case one or more pins won't give, use a more drastic approach: cut the defective display so that you can remove the pins one by one, but make sure that you don't damage the PCB's copper when cutting. Success!
H: Basic schematic help I'm trying to design a lighting circuit for an indoor garden, and I'm not understanding things that seem like they're really basic, so I need some help. The schematic I'm referencing is: I have a 24V input source which I'd like to limit to 20V. LA is a series array of LEDs such that the total voltage drop across the series is ~19.8V. R1 and Z1 are designed to limit the circuit to 20V. The portion of the circuit after that (the area above the "Repeat 14x" label) is a constant-current circuit as adapted from this instructable, and will be repeated a total of 14 times. Each of those will draw approximately 0.02A. My confusion stems from the presence of RA and ZA, that, in tweak 3 of the constant current instructable, limits the input to the gate of QB to about 5V. Doesn't it also limit the entire circuit to 5V, including the drop across the LED array? RB was calculated to be 27 ohm 1/4 W from the formulas provided in the constant current instructable; do I only need QA, QB, and RB in the circuit, and then connect the gate of QB and collector of QA to the R1/Z1 circuit? Device value specifics: R1 - 140 ohm, 1/4 watt resistor Z1 - 20V 1W zener diode RA - 100k ohm, 1/4 watt resistor ZA - 4.7V 500mW zener diode QA - NPN transistor (Fairchild 2N5088BU) QB - N-channel MOSFET (Infineon IPP057N06N3 G) LA - 6x3.2V LED in series (e.g Cree C512A-WNS) RB - 27 ohm, 1/4 watt resistor AI: R1 and D1 will not limit the voltage to 20V. The resistor would need to be in series with the +24V supply rail for this to happen. In any case, why do you want to limit the voltage to 20V if you are limiting the current through the resistors? The current limiting circuit will adjust the voltage across the resistors to the same value either way. ZA and RA just limit the gate voltage to 5V (or not - I didn't look at the values, Steven is right there), in case you want to interface with a microcontroller according to the Instructable. The only effect this will have on the current limiting is setting an upper limit to the MOSFET turn on (which may be a good thing, but not necessary) The circuit will limit the current through the LEDs just fine like this. To show what happens with the circuit over a range of supply voltages, here is a quick circuit I created, without the unnecessary bits: Simulation: I set the current for around 20mA using 0.7V / 0.02A = 35Ω. The X axis is V+ (the supply voltage) being swept from 10V to 30V. The green trace is the voltage across the 3 LEDs, and the blue trace is the current through them. You can see how once the voltage rises high above the LEDs combined Vf, any further increase has very little effect on the voltage across them or current through them (less than 1mA variance over 20V)