Id
stringlengths
1
6
Tags
stringlengths
3
101
Answer
stringlengths
38
37.2k
Body
stringlengths
26
26.8k
Title
stringlengths
15
150
CreationDate
stringlengths
23
23
3062
|capacitor|capacitance|
<p>Well, maybe people rarely see this configuration; however, this trick could be used to create high-voltage bipolar capacitors. If you series-connect two equal value capacitors in series, cathode-to-cathode and use only the positive lead of each cap to connect to other part of the circuits. </p> <p>This trick are very often seen in audio equipments. </p> <p>My two cents.</p>
<p>Usually you either combine capacitors in parallel because you want to increase the total capacitance while fitting the components in a certain shape/position, or you just combine capacitors by buying a single capacitor of a larger value.</p> <p>Combining capacitors in series reduces the total capacitance, and isn't very common, but what are some possible uses for it? It shouldn't be used to increase the voltage rating, for instance, since you can't guarantee that the middle will be at half the DC voltage of the total, without using bleeder resistors.</p>
What are some reasons to connect capacitors in series?
2010-06-17T19:32:22.820
3065
|automotive|led|light|
<p>A point about LED's - most led have a very low reverse breakdown voltage, so a standard led may fail if connected the wrong way round on about 12 volts (Yes I know - car batteries are 13.8 approx, but can be anything from 10 to 16 V, with a lot of 'noise' on the supply)</p> <p>So to protect the LED from being put in the wrong way round use a standard diode...</p> <p>The high watt resistors are there to 'disable' the blown bulb detection circuit in some cars... (They are just across the socket to 'waste' power)</p> <p>Some cars will display a warning that a bulb is blown. To prevent this you must take about the current a bulb should take...</p> <p>if your Led's just took 20ma (0.02A) at 14v (0.28W) and the original bulb was 5W - around 357ma (0.357A) - a circuit that expected .36A seeing .02 would trigger an error...</p>
<p>I'm replacing the LED in a car tail-light. Naturally, it will run off 12V (battery) but the circuit I have uses just an LED and a 0.6w (440ohm) resistor. But the existing circuit includes two, larger resistors (the power ratings, that is, I assume are higher) and a diode. Can anyone tell me what functions these play in the circuit?</p> <p>Is the diode for protecting from reverse current, as I'd assume? (not for voltage drop or anything like that), if so, why would there be a risk of this?</p> <p>And why are the resistors so much larger, when the LED I put in should easily run from a 0.6 resistor? Would the existing LED be a higher wattage LED; It's just the same looking led, there's no heat-sink or anything.</p>
Car Tail light - why the extra components?
2010-06-17T20:18:41.480
3067
|dsp|microcontroller|microchip|pic|
<p>Yet another possible feature the MAC instruction can have is auto-incrementing the registers that point to multiplicands. I programmed a Zilog DSP that used the (16-bit fixed-point) Clarkspur core. It was a variation on Harvard architecture with three busses, letting it access three areas of memory simultaneously: Instruction memory, data ram bank 1, and data ram bank 2. With a data stream in one ram bank and coefficients in the other, one could do an FIR filter with one single-cycle instruction per MAC/pointer increment operation. In C the single instruction looks like:</p> <p>Accumulator += rambank1 [r1++] * rambank2 [r2++];</p> <p>And of course this instruction is repeated for each coefficient.</p> <p>Also not pointed out earlier, DSPs (at least the older ones I've used) are generally RISC architecture and are designed with many or most instructions executing in a single cycle (or in the same number of cycles). This allows the ability to program for deterministic interrupt response (a fixed clock count between the interrupt line going active and the first instruction in the ISR executed), whereas most other processors respond to interrupts in a variable number of clock cycles, depending on at what point in a multi-cycle instruction the interrupt occurs. The fixed execution time eliminates multiple-of-clock-time jitter in repetitive outputs.</p> <p>To the OP's comparison of the Microchip Pic and DSPic, it was my understanding when DSPic was introduced that it was mainly just a Pic with a MAC instruction and a few other added features, which can certainly speeds up a microcontroller doing signal processing functions, but (due to its lack of any of the other features discussed) it might be pushing the terminology to call it a DSP. The MSP430 is also available in versions with a hardware MAC, but no one calls THAT a DSP.</p> <p>I recall 10 to 15 years ago reading that mainstream processors from Intel were adding MAC and similar instruction to do "native" signal processing (instead of on expansion cards with dedicated DSP processors, which were common for audio production in the 1990s) - some inexpensive 56k dialup PC bus modems were just A/D and D/A converters, and relied on the main processor to do the modem signal encoding and decoding functions, so there was a demand for more efficient processor use right there. Media uses such as video editing/encoding/decoding as well as audio recording/production are greatly sped up by DSP-type instructions.</p>
<p>I understand that a DSP is optimized for digital signal processing, but I'm not sure how that impacts to the task of choosing an IC. Almost everything I do with a microcontroller involves the processing of digital signals!</p> <p>For example, let's compare the popular Microchip dsPIC30 or 33 DSP and their other 16-bit offering, the PIC24 general purpose microcontroller. The dsPIC and the PIC can be configured to have the same memory and speed, they have similar peripherial sets, similar A/D capability, pin counts, current draw, etc. The only major difference that appears on Digikey's listing is the location of the oscillator. I can't tell the difference by looking at the prices (or any other field, for that matter.)</p> <p>If I want to work with a couple of external sensors using various protocols (I2C, SPI, etc.), do some A/D conversions, store some data on some serial flash, respond to some buttons, and push data out to a character LCD and over an FT232 (a fairly generic embedded system), which chip should I use? It doesn't appear that the DSP will lag behind the PIC in any way, and it offers this mysterious "DSP Engine." My code always does math, and once in a while I need floating point or fractional numbers, but I don't know if I'll benefit from using a DSP.</p> <p>A more general comparison between another vendor's DSPs and microcontrollers would be equally useful; I'm just using these as a starting point for discussion.</p>
What is the difference between a DSP and a standard microcontroller?
2010-06-17T21:39:12.457
3083
|pic|tv|video|
<p>Did you turn it to channel 3? or do you have a composite input and need to select the correct video source setting on the TV/Monitor?</p>
<p>I'm trying to generate PAL tv signals using a PIC24FJ64GB002 using a similar method to the circuit described half way down <a href="http://www.micro-examples.com/public/microex-navig/doc/089-pic-pal-tv" rel="noreferrer">this page</a>. The only difference is that my circuit needs to run at 3v instead of 5v due to using a PIC24 so I've recalculated the necessary resistor values and the closest ones I can find seem to be 220 and 470 ohms.</p> <p>I'm connecting to the TV input via a scart lead connecting the video signal to pins 17 and 20 on the diagram on <a href="http://en.wikipedia.org/wiki/SCART" rel="noreferrer">this page</a>.</p> <p>But I get no picture at all on the TV. It might as well not be connected.</p> <p>I'm thinking one of three things could be wrong :-</p> <ol> <li>My timing is out. I've posted the diagram at the end of this post showing the timing on the two pins for my test and as far as I can tell I'm generating the correct sync timing and the other signal is just some stripes for testing. How accurate does the timing need to be? I'm using the timer interrupt on the PIC to start each line 64uS apart.</li> <li>I'm using the wrong resistors to mix the signal. Can someone check if I calculated the correct values to use at 3volts? How accurate do the voltage levels need to be? I chose the closest standard values, is this accurate enough?</li> <li>I'm connecting to the wrong inputs on my scart lead? Everything I've read shows this as being correct though...</li> </ol> <p>I am generating what I believe to be the correct frame sync pulses too. Although again, everything I've read seems to indicate that even if I get this wrong I should see <em>something</em> and as every line is the same loss of vertical sync shouldn't matter for this test?</p> <p>Anyway, any input and suggestions would be welcome.</p> <p><a href="http://this.domain.name/wp-content/uploads/2010/06/tv.png" rel="noreferrer">Signal timing http://this.domain.name/wp-content/uploads/2010/06/tv.png</a></p> <p><strong>Edit and additional question</strong></p> <p>If I want to use RGB signals on a scart it looks like I need to have 3 connections for R, G, B and one for the sync on the composite video pin. And then each one has it's own separate GND connection... Is there any reason I can't just connect those 4 together?</p>
Generating PAL tv signal using a PIC
2010-06-18T12:44:01.170
3086
|soldering|lcd|
<p>I was worried about it myself, but decided to bite the bullet and try it out. It's relatively easy and straightforward.</p> <p>I made the PCB pattern following the LCD data sheet for the cable terminal spacing and pitch. I made my pads a little longer so I could either solder on top of, or next to the cable if needed.</p> <p>The PCB came with enough tinning that I simply lined it up, and pressed each terminal down with the tip of my soldering iron. It melted right into the solder already on the pads. I added a little more solder to a few terminals that didn't have a nice meniscus from the cable to the PCB. If the PCB isn't pre tinned, then you might consider adding a <em>little</em> solder to each pad, then swiping some flux across all the pads. If you add too much solder you'll find that the terminals will short as the solder squishes under the cable.</p> <p>Also note that the terminals on the cable have small vias on the terminals themselves - if the solder draws up into them, it's a pretty easy and convenient way to know the connection is made.</p> <h1>Process</h1> <h3>Tin the pads if the PCB doesn't have any solder on the pads already</h3> <p><a href="http://www.flickr.com/photos/adavis/4715214542/" rel="noreferrer" title="Hot bar soldering without the hotbar by stienman, on Flickr"><img src="https://farm5.static.flickr.com/4068/4715214542_d3f55fec6b.jpg" width="500" height="333" alt="Hot bar soldering without the hotbar" /></a></p> <h3>Apply flux to pads, then use the adhesive on the cable, if any, to secure the cable in the right spot.</h3> <p><a href="http://www.flickr.com/photos/adavis/4715219626/" rel="noreferrer" title="Hot bar soldering without the hotbar by stienman, on Flickr"><img src="https://farm5.static.flickr.com/4028/4715219626_e8fbfc7ecd.jpg" width="500" height="333" alt="Hot bar soldering without the hotbar" /></a></p> <h3>Press the soldering iron into the joint so it touches both the contact and the pad, if possible (some cables don't have exposed contacts like this one), then press the soldering iron down on the cable contact itself. It should pick up a litle of the solder on the board and make a connection.</h3> <p><a href="http://www.flickr.com/photos/adavis/4714584859/" rel="noreferrer" title="Hot bar soldering without the hotbar by stienman, on Flickr"><img src="https://farm5.static.flickr.com/4020/4714584859_fd491eb956.jpg" width="500" height="333" alt="Hot bar soldering without the hotbar" /></a></p> <h3>For this cable I also added more solder so the connections would be very secure.</h3> <p><a href="http://www.flickr.com/photos/adavis/4715230416/" rel="noreferrer" title="Hot bar soldering without the hotbar by stienman, on Flickr"><img src="https://farm5.static.flickr.com/4026/4715230416_f1c712d200.jpg" width="500" height="333" alt="Hot bar soldering without the hotbar" /></a></p> <p>The images above link to a page where the full resolution is available. For reference, the board is 2.5&quot; wide, and the LCD I was attaching is the <a href="http://www.newhavendisplay.com/index.php?main_page=product_info&amp;cPath=1&amp;products_id=2602" rel="noreferrer">2.4&quot; TFT LCD</a> available from Newhaven Display International.</p>
<p>I've just ordered some sample LCD displays. The only model available for now is hot bar solder (instead of a regular connector).</p> <p>Do you have any experience soldering regular thin wires to this type of connector? It seems like a 25 mil pitch.</p>
Hot Bar Manual Solder
2010-06-18T18:09:12.547
3088
|encryption|microcontroller|
<p>Joby pointed me to the CC2430 as a device that can do AES. I went to <a href="http://www.ti.com/" rel="nofollow">TIs site</a> intrigued by this and did some research. TI also makes our transceiver for our frequency bands(CC1100) and the new <a href="http://www.ti.com/corp/docs/landing/cc430/index.htm" rel="nofollow">CC1100 merged with an MSP430 for a SoC</a> now has AES-128 built in.</p> <p>This saves us board space and was a planned change already, but this results in full support for AES-128 automatically. Completely internal encryption and decryption, which for our chip without Multiply or divide hardware took more than 10mS to complete on its own.</p>
<h2>Project</h2> <p>The system is effectively a sensor network that connects to a star topology routing network. The Identities of each node's identity must be kept secret from all listeners as the range of the RF transmission and relay may be on the order of tens of miles. Each sensor node has its own Identification number, as required by laws pertaining to our systems target deployment.</p> <p>This means that if someone is able to read the identifier on the node then the security has not value, so a side channel attack on our implementation is a waste of time, unless they can implement it from a long distance, but I do not believe our SPI will radiate that well when sandwiched between a power and ground layer.</p> <h2>Security Options</h2> <p>This question is asking for solutions to using AES-128. I will explain what I found in an answer that I was lead to directly by Joby Taffey. Thank you Joby. I was looking for off-chip low cost solutions that could speed up our system greatly, it ends up i missed something from my chip supplier.</p>
AES-128 Chip Solutions
2010-06-18T21:51:07.490
3092
|usb|sd|
<p>Check out <a href="http://en.wikibooks.org/wiki/Atmel_AVR#Firmware_Programming" rel="nofollow">http://en.wikibooks.org/wiki/Atmel_AVR#Firmware_Programming</a></p> <p>It lists many diferent scripting languages for the Atmel AVR including a minimal python call PyMite <a href="http://wiki.python.org/moin/PyMite" rel="nofollow">http://wiki.python.org/moin/PyMite</a> and <a href="http://code.google.com/p/python-on-a-chip/" rel="nofollow">http://code.google.com/p/python-on-a-chip/</a></p>
<p>Does anyone have some cool ideas for a use of a scripting language on an embedded system? I'm thinking about the <a href="http://www.eluaproject.net/" rel="nofollow">eLua</a> project specifically. </p> <p>Basically, you need a micro with at least 64k of RAM, 256k of Flash, the Newlib C library, and a gcc compiler, (AVR32, ARM7, Cortex-M3 are all supported right now among others), and you can send it (or program it to load) scripts. It doesn't need an OS, but it lets you use your micro (which is far too small for embedded Linux) much more like a general purpose computing device, by allowing programs not flashed into the program memory to be run.</p> <p>The current project has a number of example applications, but none of them seem to do anything that you can't do with a program burned into Flash. The big difference that I can see is that you can send each program separately, and run different programs without resetting. In addition, you can use it interactively (Change your program flow with your decisions at the keyboard, rather than having to code everything. </p> <p>How would you use such a device? Would you give it a keyboard and character LCD, and write your own scripts while it sat on your desk? Would you simply use the scripting language to simplify programming of more complex applications? (Like the games currently available on the project site?) Or would you do something completely different? I'm getting started with it and looking for project ideas.</p> <p><strong>Edit</strong>: You can send it programs over whatever protocol you want to use (UART, SPI/I2C etc., USB, Ethernet), load them from an SD card, whatever your chip supports. Just wanted to clarify that it didn't have to be in a reprogramming-friendly environment.</p> <p><strong>Edit2</strong>: Most of my projects are for my personal use, or for sharing with like-minded friends, not often for sale to the general public. I expect users of my projects to be interested in and familiar with embedded systems, and able to pick up the rudimentary use of a scripting language without too much trouble. I might use them around the house or in the car, or more likely in the shop as an aide to designing and debugging more new projects. I also might propose it to my boss at work, where we manufacture and design embedded systems. Or, I might use it on an engineering project for school.</p>
Embedded system scripting
2010-06-18T23:48:52.177
3093
|connector|
<p>The connector family you're looking for is quite tough to track down because it's made by many different companies under various brand names. The good news is that I've been using these in numbers for a long time and have done all the research.</p> <p>I think the one you're looking for, i.e. those cheap things often found connecting the power switch/HDD LED to a mainboard is called "Mini-PV". Mini-PV has had various owners over the years, i.e. DuPont Connector Systems, Berg Electronics, and is currently owned by FCI as "Mini PV Basics"</p> <p><strong>Buying Mini-PV</strong></p> <p>Mouser, Farnell, Digi-Key and the rest all stock Genuine Mini-PV (i.e. manufactured by FCI) but this often isn't particularly cost efficient.</p> <p>I'd recommend:</p> <ul> <li><p>eBay knock offs. Search for (DuPont connector) there's heaps up there. You may have to do a few purchases to get a set of decent quality terminals/housings but the expenditure will still be low.</p></li> <li><p>Reputable alternatives. Farnell sell some pretty good "own brand" Mini-PV knock-offs under the series "2226" - they're 100% mechanically compatible with the original FCI parts. The catalogue number for Farnell's own brand terminal is 1593529 (2226TG) <a href="http://uk.farnell.com/multicomp/2226tg/crimp-terminal-24-28awg/dp/1593529?Ntt=2226TG" rel="nofollow">http://uk.farnell.com/multicomp/2226tg/crimp-terminal-24-28awg/dp/1593529?Ntt=2226TG</a>.</p></li> <li><p>Heck. Just buy the original parts. I've noticed that the plastic in Genuine FCI connectors a lot more durable than the knock offs making them a lot easier to re-use, in particular, the tab which holds the terminal in is much less likely to snap off.</p></li> </ul> <p>The male terminal, which is very useful for breadboard work, is unlikely to be found in any catalogues because it wasn't ever officially part of the Mini-PV range, as it is not designed to be a wire-to-wire connector system. eBay looks to be the only option here at present.</p> <p><strong>Crimping Mini-PV</strong></p> <p>This is a bit of a tricky one. Unlike Molex terminals where you can fork out £200 for an amazing performing ergonomic tool, no such options exist for Mini-PV. There's a few tools out there, none particularly ideal for cost or practical reasons.</p> <ul> <li><p><strong>FCI HT-95 ($$$)</strong> The official way is with FCI's HT-95 (sometimes listed as HT-0095). This tool costs a bank balance busting £1300 (USD 1700). I own this tool, it's good, but is it £1300 good? I'm not sure sure about that. It's quite clumsy to use and is easy to break its jaws during crimping and this tends to cost £100+ to repair each time. For the average hobbyist, forget it.</p></li> <li><p><strong>HT208A &amp; HT213A ($$)</strong> These two tools are the historic official crimping tools and sometimes appear on eBay inexpensively. HT208A does larger wires (24AWG) and HT213A does fine wires (28AWG). I own both of them and if you can get one that doesn't have a busted jaw and is complete (i.e. has it's contact locator intact) then they're much better than HT-95 but repairing a busted jaw costs £250+. Overall though, I don't recommend either of these for casual use because finding a good one isn't easy.</p></li> <li><p><strong>Foehrenbach RCY21208 &amp; RCY21213 ($)</strong> I've never used either of these tools but they appear to be a sensible contemporary option for a hobbyist who's got a bit of spare cash and would be a good investment for someone who does a lot of Mini-PV. Expect to be stiffed €300ish for these tools. RCY21213 does finer (28AWG) wire and is the only one you'd likely need. RCY21208 does 24AWG wire which is pretty big stuff, overkill for most applications using this type of connector.</p></li> <li><p><strong>Engineer PA-09 (Cheap)</strong> By far the most inexpensive crimping tool. Its jaw isn't particularly suited to crimping Mini-PV contacts and it does a bit of a messy job but I suspect the average hobbyist isn't likely to mind very much. Although this tool isn't great for Mini-PV it's very useful for a lot of other contacts and is worth owning for Hobbyists on a budget.</p></li> <li><p><strong>Other options (?)</strong> There is another likely Chinese made tool out there which does most of the crimping of Mini-PV, I can tell because every contact I've examined is crimped identically but distinctively different to what I see come out of HT-95 and HT2xxA but thus far I have not managed to identify it.</p></li> </ul> <p><strong>Crimping quirks</strong> As the Male terminal is unofficial, none of the official crimping tools will accept one. It's not impossible to modify an offical tool (As I have done) to accept male terminals, but a far easier option is to use a cheap tool like PA-09 where you can crimp whatever you please.</p> <p><strong>Noteworthy compatible connector systems</strong></p> <p><strong>Molex CGRID III</strong> A series which is less common but close (Mates with Mini PV and is easy to obtain)</p> <p><a href="http://www.molex.com/molex/products/family?channel=products&amp;chanName=family&amp;key=cgrid_iii" rel="nofollow">http://www.molex.com/molex/products/family?channel=products&amp;chanName=family&amp;key=cgrid_iii</a></p> <p>I wouldn't recommend CGRID III because while they will mate with Mini-PV, the contacts and housings are a Molex design and are not interchangeable with Mini-PV i.e. you can't stuff CGRID III terminals in a Mini-PV housing and vice versa.</p> <p>Having said that though, CGRID III is a lot more robust and features a fantastic Molex branded crimp tool which like all Molex crimp tools, is a dream to use.</p> <p><strong>TE .100 AMPMODU</strong> These appear to be a very similar design to CGRID III but I wouldn't count on any terminal interchangeability with anything.</p> <p><strong>Even more options</strong></p> <p>All the big guys: AMP/Tyco/TE Connectivity, Amphenol, JST etc have all produced a plethora of 2.54mm pitch connectors over the years all of which mate with Mini-PV but these are even less common, more expensive and once again, you'll end up having contact/housing compatibility problems so I'd say stick with Mini-PV or Molex CGRID III.</p> <p>The crimp tools for the remaining options typically always run to four figures.</p>
<p>I've found it useful to have a bunch of 2.54mm headers laying around. They fit nicely into breadboards</p> <p><img src="https://mmccoo.com/clips/2010_06_18_16_002.jpg" alt="alt text"></p> <p>Now I'd like to use a connector to connect to them. Something like this:</p> <p><img src="https://mmccoo.com/clips/2010_06_18_16_001.jpg" alt="alt text"></p> <p>I'm not sure how to look for these in the catalogs. </p> <p>I see these in mouser <a href="http://www.mouser.com/ProductDetail/Molex/47054-1000/?qs=sGAEpiMZZMtsLRyDR9nM1ym23zbAtOmYHqQplao1K4Q%3d" rel="nofollow noreferrer">mouser part: 538-47054-1000</a> for $0.06 each. </p> <p>Or these <a href="http://www.mouser.com/ProductDetail/Tyco-Electronics-AMP/103688-7/?qs=sGAEpiMZZMtsLRyDR9nM1%2fNdx6mvyyyy8sxayqNrIYs%3d" rel="nofollow noreferrer">mouser part: 571-103688-7</a> for $0.50 each</p> <p>My questions:</p> <ol> <li>how do I shop for these in the catalogs?</li> <li>how do I know if the crimp terminators (what's the proper term) are included?</li> <li>If they're not included, how do I spec those?</li> <li>How do I actually connect these to my wires?</li> </ol>
2.54mm connector question
2010-06-19T00:04:48.170
3099
|project-management|
<p>Have you described your projects to the boss? Instead of worrying about process too much, just ask him to give you a couple days to work on it. You are a low-paid intern, so use this to your advantage. If you waste a couple of days on a project, the company hasn't wasted a senior engineer's salary on the idea. But be pretty sure you can get the project done on time before suggesting it, because your success will lead to further opportunities.</p> <p>It's OK to be enthusiastic as an intern. That's really what you were hired for, not experience or knowledge.</p>
<p>They keep me fairly busy at work, and I've got a number of cool projects. We don't have a <a href="http://en.wikipedia.org/wiki/Google#Innovation_Time_Off" rel="nofollow">Google 20% time</a> to work on our own ideas, and we have process improvement engineers and R&amp;D engineers who spend their entire careers working on and thinking up new ideas. I'm not a process engineer, an R&amp;D engineer, or a senior engineer with the freedom to choose or invent my own projects, but I've come up with some projects that I'd like to explore.</p> <p>How should I pursue this? I don't want to appear arrogant to my superiors, I don't want to tell R&amp;D what they should be working on, and I definitely can't just put off my assigned projects to work on what I want to work on. I would like to get payment and/or attribution for the ideas, but that's not as important as seeing it happen. I'd also like new ideas to happen with the support groups that we already have (I don't want to do someone else's job.)</p> <p>As far as I can tell, my options are:</p> <ol> <li>Submit the project to my superiors/R&amp;D.</li> <li>Make time in my schedule or work more hours to do the project at work.</li> <li>Work on the project at home. </li> </ol> <p>None of these seem to be ideal. </p> <p>I can submit the project to someone higher on the decision chain, but my ideas generally aren't necessary to the business or safe bets, like the ones that they are constantly receiving. I discuss many of them with my boss, and he generally thinks they're good ideas. Sometimes I have a solution for a pie-in-the-sky feature request that gets put off as too hard. I just don't want to go to the gurus and say "Look, why didn't you try this? You should spend the next couple weeks implementing it." I'm just an hourly intern.</p> <p>Working ahead isn't really an option because they keep a list of projects in my queue. When I get one done, I'm supposed to move onto the next highest priority, and I really can't just ignore that for my ideas.</p> <p>Working on it at home is possible, but then I lack the support chain that the rest of the group provides, have lesser tools, and might get into some issues with not being able to take stuff home. Additionally, I don't get paid for it this way, and this method also guarantees that it will take more time than if it was implemented at work.</p> <p>Has anyone else had similar struggles? I'm sure that most every engineer has ideas, and I'd like to hear about what you did to submit them to your company.</p> <p><strong>Edit:</strong> We have about 5,000 employees at <a href="http://www.gentex.com/" rel="nofollow">my company</a>. However, I work in the testing department with about 15 other people; it really doesn't feel very big. I personally know most of the people who have developed the projects that I want to work on. </p> <p><strong>Edit2:</strong> I've proposed my ideas to my boss, and he's been interested. I'd rather not just submit them to R&amp;D, as the devices and systems I want to work on would be familiar to myself and my department, but new to the R&amp;D guys. </p>
How to propose/work on a project for work
2010-06-19T20:03:14.487
3101
|network-interface|ethernet|
<p>A transceiver or MAU. Their availability is starting to be a bigger question now, I still have a few from my real computer days.</p>
<p>Does anyone know what's entailed in connecting a computer that has only an 'AUI' network interface into a modern LAN? By AUI port, I'm referring to one of those 15-pin D connector arrangements that used to be popular in the early 1990's. I know that establishing a network protocol will undoubtedly be a challenge in its own right, but that's beyond the scope of this question. At the moment, I just want to "get a link light" from it on one of my ethernet switches.</p> <p>I would almost swear I once saw a jury-rigged connector that had just four wires with pins crimped on them jammed into selected points on the 15-pin D, though I don't recall what these wires ran to, but I thought it was an RJ-45. Could easily be mistaken on that. Just b/c someone had something wired with an RJ-45 doesn't necessarily mean it was 10BaseT.</p> <p>Anyway, there are references to the AUI signal set being part of the IEEE 802.11 standard. Could it really be as simple as mapping a certain 4 of the 15 to the 1,2,3, and 6 of 10BaseT? Or could it be done with just a couple of line driver/receiver IC's?</p> <p>I know there are $30 commercial solutions to the problem, but I am loathe to invest even that much on the system in question, as it would already be on its way into the electronics recycling bin but for academic curiosity about the old interface.</p>
hacking an AUI network port
2010-06-19T23:37:25.180
3105
|microcontroller|pic|adc|
<p>You might not even need an op-amp. Some ADC's (like the MCP3304, see datasheet: <a href="http://ww1.microchip.com/downloads/en/DeviceDoc/21697e.pdf" rel="nofollow">http://ww1.microchip.com/downloads/en/DeviceDoc/21697e.pdf</a> have a built in differential mode, where the ADC returns the difference of two channels, which can be a negative number. If you tie one channel to ground (called pseudo-differential mode), the ADC can accept a negative input voltage on the other, and translate it into a negative number, all without needing a negative voltage.</p> <p>Of course, this only applies if your ADC supports this sort of thing. Many don't have differential mode at all.</p>
<p>I am working with a PIC micro-controller with inbuilt 10bit ADC and want to measure a voltage in the range of -1 to -3Volts.<br> I thought of using an op-amp in the inverting mode to make voltage positive and then feed it to the adc of the microcontroller however here I would have to power the opamp with a negative power supply, right?. I don't want to use a negative power supply at the moment and was wondering whether it was possible to achieve this configuration? Can you'll help out?</p>
How do I measure a negative voltage with a ADC?
2010-06-20T08:58:39.570
3113
|atmega|linux|avrdude|fuse-bits|
<p>Nope, your 0x63 setting on the lfuse byte has selected the internal 128kHz oscillator as the clock source. (bytes 3..0 are CKSEL, see table 7.1 on p.28 of the <a href="http://www.atmel.com/dyn/resources/prod_documents/doc8272.pdf" rel="nofollow">ATmega644 datasheet</a> where 0011 is 'Internal 128 kHz RC Oscillator'). This is nice and low power, but it means that your programmer likely isn't clocking itself slowly enough to program your device. I'm not familiar with either avrdude or the STK500, but this is where your problem is coming from.</p> <p>However, it will be difficult for you to brick your chip, because you've got the STK500, which can do high voltage programming and rescue it from most situations. As I've never used the device, I'll defer to the <a href="http://www.google.com/search?q=site%3Aavrfreaks.net+high+voltage+programming+fuses" rel="nofollow">many</a> <a href="http://www.google.com/search?hl=en&amp;q=site%3Aavrfreaks.net+fuse+settings" rel="nofollow">other</a> <a href="http://www.google.com/search?hl=en&amp;q=site%3Aavrfreaks.net+fuses+stk500" rel="nofollow">threads</a> where others have posted problems and solutions for AVR fuse settings. There's also one here on Chiphacker (see my comment.)</p> <p>Next time, <a href="http://www.engbedded.com/fusecalc/" rel="nofollow">this fuse setting calculator</a> is a nice resource. It's fantastic that you read the datasheet, and tried to calculate what you wanted yourself, but the tool makes it much easier. </p> <p>BTW, what were the fuses set to before you made the change?</p> <p><strong>Edit:</strong> Looks like the 'A' option just indicates that it's not a member of the "*<em>P</em>*ico Power" series, so that shouldn't make a difference.</p>
<p>I have been programming an ATMega644PA with avr-gcc and avrdude on linux for a little while with no problems. Well until I decided to change some fuses. I had been using the option for avrdude <code>-p ATMEGA644P</code> for programming the chip even though the chip is ATMega644P<b>A</b>.</p> <p>After reading the data sheet (and reading the fuses on the chip) I did the following</p> <pre><code>avrdude -v -c avrispmkII -p ATMEGA644P -P usb -U lfuse:w:0x63:m </code></pre> <p>The chip would no longer communicate. I realized after that the problem may have been that I set the bits for external clock rather than crystal oscillator but even with using an ATTiny to generate a 1MHz signal to the proper pin on my Mega644, I still get nothing.</p> <p>Any ideas as to why the chip is unresponsive? Could it be that using avrdude's definition for the P version of the chip rather than the PA version is the cause?</p> <p>And finally, What can I do to rescue my chip? Ive heard that it may be possible with High voltage programming or JTAG. Would I be able to do that with an STK500?</p>
ATMega644PA possibly bricked by setting fuses with avrdude
2010-06-20T21:30:38.440
3115
|jtag|boundary-scan|production-testing|
<p>I did some benchmarks of three tools (Goepel, Corelis, XJTAG) about 3 years ago with a custom board (FPGA, OMAP, various small ICs). We found that the XJTAG tools were by far superior to the Goepel or Corelis tools in terms of usability. I can also highly recommend their support. All three vendors were happy to provide the tools for this benchmark. I recommend doing the benchmark with your own board. It will be harder but you will see real-world problems and how they are handled.</p>
<p>I have to choose a tool for production testing of fairly dense PCB's with 4+ FPGAs 10+ DSPs, ethernet controllers and PCI controllers.. Does anyone have any experience with any of the tools available from GOEPEL, XJTAG, Jtag-technologies or if anyone know of any good open source alternatives? That is both the BS hardware controller and/or software.. </p>
Boundary scan developer and testing tools
2010-06-21T08:54:51.693
3117
|video|
<p>These are for the most part higher level then what you are asking for. </p> <p>There is a professor I know whom has put many <a href="http://www.youtube.com/user/kridnix" rel="nofollow">videos on youtube to teach about a range of concepts</a>.</p> <p>Some are about changing education, some are about engineering design, and some are about optics related concepts. Now, none of these may interest you, but he does one of the better explanations of a <a href="http://www.youtube.com/watch?v=ObklYbQaX24" rel="nofollow">Fourier</a> <a href="http://www.youtube.com/watch?v=QO3kgwYzpZg" rel="nofollow">transform</a>. Fourier links to the first, transform links to the second part, in case you have a hard time finding it.</p> <p>This professor is big on trying to make engineering education more available to students, and feels with good teaching almost anyone can learn the basics of very complicated subjects, as you see he does some basic maxwell's equations(very basic) and teaching many concepts related to his lasers class. Students build a working laser with a gain medium and mirror by the end of it.</p>
<p>Are there any interesting and graphical videos for learning electronic concepts, like basic principles of capacitor, inductor, resistor, transistor and other advanced concepts like digital electronics?</p> <p>I am mostly looking for animated videos which would teach me concepts and possibly their practical applications. I have been reading books but haven't made much progress.</p>
Learning videos for electronic concepts?
2010-06-21T10:01:07.200
3126
|arm|memory|
<p>The larger series of STM32 processors (32-bit Cortex-M3 core) has a FSMC, which is a Flexible Static Memory Controller. With this you is able to connect Flash, RAM, and other memory peripherals like LCD and such.</p> <p>I can recommend the STM32F103ZET6 as tcrosley also said, and you can get a development board including flash and sram on ebay for $68 - <a href="http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&amp;item=220619908411">http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&amp;item=220619908411</a></p>
<p>I just completed a project using the LPC2132 chip, but ran into problems with using up the whole 64kb of RAM. </p> <p>For my next project, I'd like to use something that can reference an external, much larger memory chip. What sort of ARM can do this and what do I need to do to get the two devices talking?</p>
What is a good choice for an ARM to interface with external memory?
2010-06-22T01:20:32.557
3130
|avr|
<p>You didn't specify if you need the same pin out because of a software issue or a hardware issue...</p> <p>If it is purely not being able to solder a chip to a board because of a different pin out and you have to figure something out, you can <a href="http://en.wikipedia.org/wiki/Point-to-point_construction#.27Dead_bug.27_construction" rel="nofollow">dead bug</a> the chip.</p>
<p>Until the 4kb upgrade to the ATtiny2313 is available, which AVRs can I substitute when the ATtiny2313 is too tiny?</p>
Which AVRs are pin-compatible with the ATtiny2313?
2010-06-22T13:34:48.660
3133
|lcd|
<p>Nokia 5110 LCDs can be found on ebay for less than $4 each in single quantity. Plenty of documentation available. I have used them with MSP430, PIC and AVR.</p>
<p>I'm looking for a (graphic) LCD to get started with. It doesn't need to be color. It doesn't need to be serial (but it should at least be multiplexed so I don't have to connect wires to each individual row/column). I don't care about the resolution as long as it's greater than about 40 pixels in both dimensions. Size should be > 1".</p> <p>It <em>must</em> be straightforward to use, have plenty of documentation (preferably even example code, but not necessary), and be easy to connect to (with &lt;30 I/O lines. &lt;18 would be great). And of course, I'd prefer something inexpensive ($20 max) ;-)</p> <p>Feel free to list more than one LCD per post. Try to include resolution, size, I/O lines and approximate cost. Bonus points if you provide a link to a supplier ;-)</p>
graphic LCD with the greatest ease_of_use:cost ratio
2010-06-23T03:25:10.277
3136
|stepper-motor|motor|
<p>I've no idea what torque a <strong>wall clock mechanism</strong> has, but I guess it will be rather low-ish. Prices equally low (from $5).</p>
<p>I am looking for some small and cheap stepper motors with &lt;10oz-in torque. Most of the steppers I can find from my regular sources/ebay are 60-1000oz-in which is far too much for my purposes (and will almost certainly push the cost up). Does anyone know of a good source for these types of motors ? Unfortunately I would like 6 (and potentially more) of them, so scrounging from old floppy drives is not really an option.</p>
Sourcing low torque/small stepper motors
2010-06-23T13:07:07.057
3139
|microcontroller|1-wire|
<p>The TI MSP430 was mentioned and I concur. I've used the <a href="http://www.ti.com/lit/ds/symlink/msp430f1101a.pdf" rel="nofollow noreferrer">MSP430F1101</a> running at a 32.768kHz crystal and powered from 3V which consumed less than 4\$\mu\$A. At 2.2V it would even be less. </p> <p>To power the microcontroller from the bus you only need a diode and a capacitor. The capacitor buffers the bus voltage, and the diode prevents a low level on the bus from discharging the capacitor. Choose a Schottky diode to have a minimum voltage drop. </p> <p><strong>Warning: dirty trick ahead!</strong><br> <a href="http://scanlime.org/2008/09/using-an-avr-as-an-rfid-tag/" rel="nofollow noreferrer">This gal</a> doesn't need the diode to parasitically power her microcontroller, and even the capacitor doesn't seem to be required. She uses a coil as RFID antenna on an I/O port, and the voltage across the coil powers the device through the clamping diodes. </p> <p><img src="https://i.stack.imgur.com/rp35y.png" alt="enter image description here"> </p> <p>I/O pins on logic ICs, including microcontrollers, have clamping diodes to protect them against overvoltage. If the input voltage is higher than \$V_{DD}\$ + 0.5V the power clamp diode will conduct and the overvoltage will be taken down to \$V_{DD}\$. Beth abuses the diode to power the controller from the I/O's high input level. And apparently her controller even keeps working without the capacitor. (On another prototype she did use capacitors for stability.)</p>
<p>I've seen Dallas' 1-wire sensors, they look great. But, I'd like to make some custom 1-wire slaves which can be parasitically powered (just ground + data).</p> <p>Can anyone recommend a low power microcontroller which is suitable for this?</p> <p>Does anyone have a sample circuit for how I would power an MCU from the 1-wire bus?</p>
1-wire parasitically powered microcontroller?
2010-06-23T14:43:18.730
3150
|avr|timer|
<p>See the datasheet for the ATtiny2313: <a href="http://www.atmel.com/dyn/resources/prod_documents/doc2543.PDF">http://www.atmel.com/dyn/resources/prod_documents/doc2543.PDF</a></p> <p>The priority of interrupts is determined by the order of the interrupt vectors. See page 46 for the list. The lower the number, the higher the priority. Since Timer/Counter0 Overflow has a lower number (7) than Timer/Counter0 Compare Match A (14), the overflow ISR will run first.</p>
<p>If an AVR's 8-bit timer compare register is 255 and the timer overflows (according to the datasheet, the compare interrupt happens on the next timer clock cycle) then both the overflow interrupt and the compare interrupt should be due at the same time. Which will be serviced first?</p>
On an AVR (ATtiny2313), which is serviced first when TIMER0_OVF and TIMER0_COMPA are due at the same time?
2010-06-24T11:50:34.893
3159
|soldering|flux|solder-paste|
<ol> <li>Please see <a href="https://electronics.stackexchange.com/questions/3159/diy-fluxes-with-ethanol-propanol-x-nol/3163#3163">XTL's answer</a>.</li> <li>The static user commented <a href="http://www.instructables.com/id/How-to-solder/" rel="nofollow noreferrer">here</a>: "There are times when addding additional rosin flux can be beneficial because is allows to solder to flow more readily with the less heating. For example when soldering connectors on coaxial cable."</li> <li>Probably, it depends on the flux type. You can find instructions to do your own flux <a href="http://www.instructables.com/id/Make-your-own-Eco-friendly-soldering-flux/step1/Go-Shopping/" rel="nofollow noreferrer">here</a>.</li> <li>Flux can be "non-corrosive, non-conductive, moisture and fungus resistant", according to <a href="http://www.mgchemicals.com/products/835.html" rel="nofollow noreferrer">the marketing of a rosin flux</a>.</li> <li>?</li> </ol>
<p>Got inrested in DIY fluxes by reply <a href="http://www.dealextreme.com/details.dx/sku.4697" rel="nofollow">here</a>.</p> <ol> <li>Can you substitute rosin-core wire with DIY flux and non-rosin-core-wire?</li> <li>How and where to actually use DIY fluxes if you have rosin-core wire?</li> <li>Which % of ethanol and rosin should be used with SMD components?</li> <li>Why to use a soldering flux? ( relates part 2)</li> <li>With which substance you can avoid fungi? (relates to part 3)</li> </ol>
DIY Fluxes with ethanol-propanol-x-nol
2010-06-25T11:33:37.600
3175
|fpga|
<p>To be honest, if your goal is to get video/pictures from a camera onto a FPGA-based device, a firewire camera is the wrong starting point. You probably should find a camera more suited to your purpose with an easier interface to use. This probably also has the advantage of being much smaller than an off-the-shelf camcorder.</p> <p>Wait, am I misunderstanding something? I just looked a bit at the link describing the board that has your FPGA on it, and it says it already has a camera built into it? (Omnivision OV5610 5.17 megapixel color CMOS image sensor array). Are you saying it's using Firewire for the on-board connection between the FPGA and the built in camera?</p>
<p>Hey guys I was referred here from another site and was hoping that someone could help me out.</p> <p>Some Background Information:</p> <p>I'm a 4th year EE student at Georgia Tech. A research team with the AE department came around to some of our classes and asked for help with their project for some of their more electronic stuff. I signed up and ended up on the FPGA team which has deteriorated to myself and one other guy, so we're really busy. My current task is to set up a camera to take and store pictures using the FPGA &amp; DSP on <a href="http://www.adaptiveflight.com/products_fcs20.html" rel="nofollow">this board</a>.</p> <p>I'm stuck using firewire due to the limitations of the camera and the restrictions on the number of pins that has been allocated to me, so in the last month or so I've been trying to build a link + host layer for a firewire interface with <a href="http://focus.ti.com/docs/prod/folders/print/tsb41ab3.html" rel="nofollow">this thing arbitrating</a> for me. I also have to use system verilog. Anyways, I've never used the language before and am having a hard time trying to create one from scratch. The firewire interface seems super complex and I've basically been told "hurry up" by the guys in charge of the project.</p> <p>Originally I had planned to use <a href="http://opencores.org/websvn,listing?repname=firewire&amp;path=%2Ffirewire%2Ftrunk%2Fbench%2Fverilog%2F#path_firewire_trunk_bench_verilog_" rel="nofollow">this project</a> from opencores.com but it's missing files and I gave up trying to repair it since I don't really know the language all that well, but it looks like I'm probably going to need to either figure out how to fix it or find something else that will work or else I won't be finished in time.</p> <p>In the top level file it includes a file called fw_link_defines.vh, which I don't have and doesn't seem to be anywhere else on the internet. It looks like it defines(?) three things, if that's what the ` is actually doing in statements like "pkt_type = `SELF_ID_PKT;", which wouldn't be too hard to fix, but there's also some weird thing called phy_ctrl which I thought was a structure or something but after looking on the internet it appears to be an "instantiation". I can't figure out what the heck that actually does. I've looked at a few tutorials but can't seem to find any good ones on them, all I've found is large tutorials with one paragraph that says "this is an instantiation, they are a real pain to work with" and don't really explain much.</p> <p><strong>(Start here for TL;DR)</strong></p> <p>Basically what I'm asking is that if anyone knows any other open FPGA projects that use firewire to talk to a device, or if anyone knows a good source to learn how to use instantiations. I've been having a real hard time with this and would be very grateful for any help you could give. Thanks guys.</p>
Using FPGA to interface with a camera via 1394/firewire
2010-06-26T07:16:16.480
3182
|arduino|lcd|
<p>It looks like this shield has 5 buttons attached to different value resistors on a single analogue pin. The sixth button is hardwired to reset. <a href="http://www.nuelectronics.com/download/projects/LCDshield_v1_1.pdf" rel="nofollow noreferrer">Here's the schematic</a>.</p> <p><a href="http://www.nuelectronics.com/estore/images/nustore/projects/lcd_schematics.jpg" rel="nofollow noreferrer">alt text http://www.nuelectronics.com/estore/images/nustore/projects/lcd_schematics.jpg</a></p> <p>The <a href="http://www.nuelectronics.com/download/projects/LCD4Bit_mod.zip" rel="nofollow noreferrer">sample code</a> has a lookup table to convert the ADC values to keys:</p> <pre><code>int adc_key_val[5] ={30, 150, 360, 535, 760 }; </code></pre> <p>If you're lucky, you might be able to spot two keys being pressed at the same time as a unique ADC reading.</p> <p>Try writing a short sketch to print the ADC value to the serial port, then experiment. See if you can find unique ranges of ADC values representing the key combinations you're interested in.</p> <p>To detect a press for a length of time, use the Arduino millis() function to record the time then compare. This is very similar to <a href="http://www.arduino.cc/en/Tutorial/Debounce" rel="nofollow noreferrer">debouncing a button</a>.</p>
<p>I'd like to detect two buttons being pressed together with the Arduino LCD shield. Does anyone have example code of handling multiple button events? I need an event when both the Up and Down buttons are pressed together for 2 seconds.</p> <p>The LCD Shield is the 16*2 HD44780 compatible LCD with WHITE characters &amp; BLUE backlight that has 6 buttons. I got it from <a href="http://www.hotsolder.co.uk/arduino-lcd-keypad-shield-233-p.asp" rel="nofollow">www.hotsolder.co.uk</a>.</p>
Arduino - Multiple button event with lcd shield
2010-06-28T15:24:24.337
3196
|arm|microcontroller|
<p>There's a detailed description in the STR91xF datasheet - it's complicated, but not as complicated as the ST libraries make it seem. Given the #defines and structs listed at the end, to turn on e.g. GPIO4:</p> <pre><code>SCU-&gt;PCGR1 |= __GPIO4; // switch the port on. SCU-&gt;PCGRO &amp;=~ (u32)__GPIO4; // reset the device SCU-&gt;PRR1 |= __GPIO4; // peripheral not held in Reset </code></pre> <p>Then, y'can set up the port using a combination of</p> <pre><code> GPIO4-&gt;DDR SCU-&gt;GPIOOUT[4] SCU-&gt;GPIOIN[4] SCU-&gt;GPIOTYPE[4] </code></pre> <p>(and GPIO4->DR[n] to set and read the pins)</p> <p>GPIOn->DDR is 8 bits, bits 7:0 corresponding to pins 7:0. any set bit makes its<br> corresponding pin an output, default is zero, all input.</p> <p>The SCU registers are also bit masks, as follows:</p> <p>GPIOTYPE[port_number] is 8 bits, with bit 7:0 corresponding to pin 7:0. Any set bits make their corresponding output pins open-collector. Default is all zero (push-pull)</p> <p>GPIOIN[port number] is 8 bits. Any set bit has the input routed to some or other internal peripheral input function, as detailed in a big table in the data sheet, depends on device. NOTE: Even when connected to an internal peripheral, you can still also read it as a general input. Defaul is all zero, plain general purpose input</p> <p>GPIOOUT[port number] is 16 bits, each pair of bits corresponding to a pin, so bits 14 and 15 control pin 7, bits 0 and 1 control pin 0. Zero means ordinary GPIO input, 1 is normal GPIO output, 2 and 3 are alternative outputs from internal peripherals. (See big table in STR9xx data sheet) </p> <p>So to set up GPIO4 so that pins 0 and 1 are outputs, with 0 being open collector, and the remaining pins are inputs, do:</p> <pre><code>GPIO4-&gt;DDR = 0x03; // 0 0 0 0 0 0 1 1 pins 0 and 1 are output SCU-&gt;GPIOOUT[4] = 0x0005; // 00 00 00 00 00 00 01 01 pins 0 and 1 are Alt1 output SCU-&gt;GPIOTYPE[4] = 0x01; // 0 0 0 0 0 0 0 1 pin 0 open collector SCU-&gt;GPIOIN[4] = 0x00; // no alternate inputs connected </code></pre> <p>To actually set/read port pins, STR9 has a memory mapped system where you mask pins by both address and value, so that you can write to just the pins you want without having to do too much ORing of arguments. E.g. </p> <pre><code>GPIO4-&gt;DR[GPIO_Pin_1 &lt;&lt; 2] = GPIO_Pin_1; //sets pin1 output to high. x = GPIO4-&gt;DR[GPIO_Pin_3 &lt;&lt; 2]; //reads pin3 y = GPIO4-&gt;DR[(GPIO_Pin_3 | GPIO_Pin_4) &lt;&lt; 2]; // reads pins 3 and 4 </code></pre> <p>and so on.</p> <p>The symbols used above boil down to:</p> <pre><code>#define __GPIO0 0x4000 #define __GPIO1 0x8000 #define __GPIO2 0x10000 #define __GPIO3 0x20000 #define __GPIO4 0x40000 #define __GPIO5 0x80000 #define __GPIO6 0x100000 #define __GPIO7 0x200000 #define __GPIO8 0x400000 #define __GPIO9 0x800000 typedef struct { vu32 CLKCNTR; vu32 PLLCONF; vu32 SYSSTATUS; vu32 PWRMNG; vu32 ITCMSK; vu32 PCGRO; vu32 PCGR1; vu32 PRR0; vu32 PRR1; vu32 MGR0; vu32 MGR1; vu32 PECGR0; vu32 PECGR1; vu32 SCR0; vu32 SCR1; vu32 SCR2; u32 EMPTY1; vu32 GPIOOUT[8]; vu32 GPIOIN[8]; vu32 GPIOTYPE[10]; vu32 GPIOEMI; vu32 WKUPSEL; u32 EMPTY2[2]; vu32 GPIOANA; } SCU_TypeDef; typedef struct { vu8 DR[1021]; /* Data Register */ vu32 DDR; /* Data Direction Register */ } GPIO_TypeDef; // #define AHB_BASE (0x58000000) // unbuffered #define AHB_BASE (0x48000000) // buffered // #define __APB1_BASE 0x5C000000 // unbuffered #define __APB1_BASE 0x4C000000 // buffered #define __SCU_BASE (__APB1_BASE + 0x2000) #define SCU ((SCU_TypeDef *)__SCU_BASE) #define GPIO0_OFFSET (0x00006000) #define GPIO0_OFFSET (0x00007000) // ... #define GPIO4_OFFSET (0x0000A000) #define GPIO4 (AHB_BASE + GPIO4_OFFSET) #define GPIO_Pin_None 0x00 #define GPIO_Pin_0 0x01 #define GPIO_Pin_1 0x02 #define GPIO_Pin_2 0x04 #define GPIO_Pin_3 0x08 #define GPIO_Pin_4 0x10 #define GPIO_Pin_5 0x20 #define GPIO_Pin_6 0x40 #define GPIO_Pin_7 0x80 #define GPIO_Pin_All 0xFF </code></pre>
<p>Because I am new to programming on microcontrollers coming from the C++ world, I have been studying on getting code running on a microcontroller board to work with many inputs and outputs.</p> <p>For the first project I am working on an ARM9 chip (STR912FAW44) with Rowley Crossworks for ARM to program my board. I understand that I have to setup port 7.3 to output mode to drive a LED. I also understand that the GPIO port has multiple modes on this pin, defaulting to GP Input. I also know the alternate output 1 configuration is GP Output.</p> <p>Now the manual for the chip says:</p> <blockquote> <p>There are up to 80 GPIO pins available on 10 I/O ports for 128-pin and 144-ball devices, and up to 40 GPIO pins on 5 I/O ports for 80-pin devices. Each and every GPIO pin by default (during and just after a reset condition) is in high-impedance input mode, and some GPIO pins are additionally routed to certain peripheral function inputs. CPU firmware may initialize GPIO pins to have alternate input or output functions as listed in Table 8.</p> </blockquote> <p>This sounds wonderful. The question is how can I get the port to accept a different function?</p> <p>I have sample code for a similar, but different board where the LED (easiest to test) is on port 9, but this does not work when adjusted to port 7 as I expected.</p> <p>Here is the sample:</p> <pre><code>void ctl_board_init(void) { // leds are connected to GPIO9.0-GPIO9.3 SCU_PCGR1 |= SCU_PCGR1_GPIO9_MASK; // turn on GPIO9 SCU_PRR1 |= SCU_PRR1_RST_GPIO9_MASK; GPIO9_DIR = 0x01; // select output direction } void ctl_board_on_button_pressed(CTL_ISR_FN_t buttonFn) { } void ctl_board_set_leds(unsigned v) { *((&amp;GPIO9_DATA)+(0x01&lt;&lt;2)) = v ? 0x01 : 0; } </code></pre> <p>The macros come from header files, but can anyone help me find reference to which bits I should set to drive GPIO port 7.3 as output?</p>
How to configure an ARM GPIO port (STR9) to an alternate function?
2010-06-29T13:59:24.940
3201
|wireless|sensor|
<p>I can't figure out the question here either, but I believe spread spectrum signaling is used to get around (narrow band) noise, increasing link reliability. It will, of course, create a broader spectrum of noise itself compared to sticking to a single channel. There should be a lot of decent material available on the subject and these specific methods.</p>
<p>Knowing that Bluetooth and ANT+ use FH-SS and ZigBee uses DS-SS, I would like to learn of the modulation technique's effects on a wireless point-to-point connection if I am implementing the wireless active sensor prototype (measurement sent from device to terminal, with the terminal sending back infrared LED intensity to the device to adjust the settings. It would be great to hear from you about it. Thanks in advance.</p>
Modulation technique's effect on Active Sensor
2010-06-29T23:24:43.703
3203
|microcontroller|rf|radio|
<p>It's 2018, and prices have come down signficantly. It's now possible to buy WiFi modules like the ESP8266 for <a href="https://www.digikey.com/product-detail/en/espressif-systems/ESP-WROOM-02/1904-1009-2-ND/8544297" rel="nofollow noreferrer">$2.82 to $2.26 each from reputable dealers</a>, or <a href="https://i.stack.imgur.com/sA9K8.png" rel="nofollow noreferrer">for $1.37 from unknown sources</a>.</p>
<p>What's the cheapest way to link a few microcontrollers wirelessly at low speeds over short distances.</p> <p>I'm looking to keep it ultra-cheap, use common discrete parts and keep it physically small. I don't care about bands and licensing so long as it works.</p> <p>802.15.4/ZigBee, Bluetooth and WiFi all require an expensive coprocessor, so aren't an option.</p> <p>Alternatively, are there very cheap radio modules available to hobbyists? The kind of things you find in car keyfobs and wireless thermometers, perhaps?</p> <p>Would building a simple transceiver on a homebrew PCB even be practical, or will I be plagued by tuning, interference and weirdy analogue stuff?</p> <p>Could something like <a href="http://tacashi.tripod.com/elctrncs/smplfmtr/smplfmtr.htm">this</a> be driven from a microcontroller? What about receive?</p>
What's the cheapest way to link a few microcontrollers wirelessly at low speeds over short distances
2010-06-30T00:28:35.583
3216
|arduino|wiring|
<p>It's definitely possible, though it will likely be slower than you'd like at transmitting camera images. Take a look at <a href="http://arduino.cc/en/Tutorial/Graph" rel="nofollow">this tutorial</a>, which describes how to send data over the serial port. If you can get that working, you just need to swap in the image data instead of the potentiometer reading in the tutorial, and write a .NET client that to render the images.</p> <p>(You might consider using <a href="http://processing.org/" rel="nofollow">Processing</a> for the rendering, rather than .NET.)</p>
<p>Firstly, I am new to EE.SE as well as to Arduino. I just figured out how to write code for the chip in Arduino. </p> <p>Well, I am connecting a camera on the board, which continuously sends some data. this data could be caught by the sketch that would be flashed on the board.</p> <p>My question was how could the output from the Arduino be received on my computer. Can it be done using a .NET based client on the desktop.</p>
Desktop client for arduino
2010-06-30T12:29:30.610
3217
|resistors|
<p>Wim is correct with his ideas but I wanted to say that in general placing nonlinear circuit elements in parallel or series will produce undefined behavior. Unless the two nonlinear elements are precisely matched (ie, their trip points, V-I characteristics, etc are within &lt;1% of each other) then there's no telling what will happen exactly. </p> <p>Also, are you using the term varistor here properly? It's not usually a VARiable ResISTOR (ie, a potentiometer or rheostat) it's a nonlinear voltage protection device that acts like a circuit breaker. If you're just working with a potentiometer or rheostat then you can add and subtract resistance in parallel or series to your heart's content and you'll get easily calculated behavior since everything combines linearly.</p>
<p>I can connect many resistor in parallel or series to get a final resistance I want in case when I have no necessary nominal out of the box.</p> <p>I wonder is there such trick that will allow me to easily change varistor's nominal. Say, originally I have a varistor that changes its resistance from 0 to 200 kilohm. Can I construct a simple circuit that will map the range to, for example, 0-10 kilohm?</p>
Can I adjust varistor range?
2010-06-30T12:36:46.713
3226
|arduino|bluetooth|
<p>I have designed a few boards that integrate an Atmel uC (328 and 644) with BlueGiga WT12A. The BlueGiga interfaces to the UART so you send and receive ASCII strings. If you are using a 328 based board you will need to multiplex the UART or use the NewSoftSerial to emulate a UART on the unused pins.</p> <p>I did the hardware design and the low-level software so I don't know the details of the Bluetooth communication. After I could demo that the uC paired with the phone my portion of the project was complete ;)</p> <p>Changing the name didn't require firmware changes. I sent a "SET BT NAME" command to change the name to show the device was pairing.</p>
<p>I was wondering if it is possible to add my own Bluetooth module (Widcomm or any other chip) to my existing Arduino board? The current board transmits serial data using USB. I know there is a BT version of Arduino available, but it seems to be out of my budget.</p> <p>If it is possible, then; 1. How do I integrate it to the board? 2. What changes would I need to do so that my board now transmits data via bluetooth? 3. Do I need to write any additional firmware for the BT chip? 4. If the BT chip comes with a built-in firmware, can I modify it? As-In I would like it to have a custom name and so on..</p> <p>Any help would be really appreciable.</p> <p>Thank You!</p>
Adding BT connectivity to Arduino
2010-06-30T15:49:48.270
3230
|fpga|arm|interface|
<p>From a practical design standpoint, the separate chips are a good idea. However, security concerns would either required encrypted communications on the bus, careful measures to make sure no important data goes over the bus, or using a single monolithic chip.</p> <p>There are other issues, too. FPGA's are usually programmed from Flash memory (except in some rare cases that use things like anti-fuses). You also have to worry about the application being eavesdropped on during configuration.</p> <p>Even after configuration, many FPGA's and other microcontrollers also have JTAG pins that can be used to read the program back out of the device, or inspect other aspects of the programming!</p>
<p>I have a design that uses an Altera Cyclone FPGA to implement a Physically Unclonable Function (PUF) and an ARM device to do cryptographic work and I/O with the PUF. The PUF is very large, and takes quite a bit of space (only about 1/4th will fit on the Cyclone)</p> <p>My question is, would I be best served by getting a large enough FPGA to include both the PUF and the ARM core or a smaller FPGA for the PUF and a second, external ARM chip? Can you provide some suggestions?</p> <p>If I used two chips, they would communicate with SPI. There is not a lot of communication between the two, nor does it need to be fast.</p>
What configuration should I use for a system that includes an ARM and an FPGA?
2010-06-30T17:07:55.883
3244
|heatsink|soldering|dip|surface-mount|
<p>Your worries are unjustified. The graph shows a typical temperature profile for reflow soldering. </p> <p><img src="https://i.stack.imgur.com/qnUyE.gif" alt="enter image description here"> </p> <p>Note that <em>all of the IC</em> is subjected to temperatures close to and above 200°C <em>for minutes</em>. Not one pin, all of them, and the IC's body as well. No pin-by-pin soldering can apply that much heat to the package.</p>
<p>I generally like to solder sockets to my boards, rather than the chip directly, but am now forced to solder the chips directly. I have several DIP and SMD components that this needs to be done with.</p> <p>I am concerned that the heat from soldering them might damage the chips so was wondering how I could heat sink them? Is this even necessary?</p> <p>It doesn't apply to me right now, but how is this done with other packages?</p>
What is the best way to heat sink a chip when soldering it on?
2010-07-01T12:46:54.793
3246
|arduino|dc-motor|motor|
<p>Do you need by-directional control of your DC motor? If that's the case, I would highly recommend the following circuit (even though you will use up one PWM pin for each direction, you will get more than enough current amplification from your power source that the Arduino cannot provide): <a href="http://imagebin.ca/img/CKdfPB6n.png" rel="nofollow noreferrer">alt text http://imagebin.ca/img/CKdfPB6n.png</a></p>
<p>This might be a simple, silly question, but I am wondering why I can't just connect a DC motor to an arduino board to have it running. One pin to the ground and the other to one of the PWM outputs.</p> <p>I just did the sweep tutorial for a servo motor <a href="http://arduino.cc/en/Tutorial/Sweep">http://arduino.cc/en/Tutorial/Sweep</a> and it works fine. I know that a servo has more electronics in there with pot providing feedback.</p> <p>From what I understand to drive even a small DC motor I would need more circuitry (an H bridge?) or another shield dedicated to driving motors. I can understand this if I was driving some relatively big DC motors.</p> <p>But I am trying to understand why a small DC motor with a ground and PWM input would not work. Especially for a brushed a motor like this one <a href="http://music.columbia.edu/~douglas/classes/motor_mania/DC_simple2.jpg">http://music.columbia.edu/~douglas/classes/motor_mania/DC_simple2.jpg</a></p> <p>Surely its just a matter of DC current passing through the wire. Is it the inductive charge building up in the coils that can cause reverse current back to the board thats the problem.</p> <p>Basically, from a conceptual point, given I have a ground and a voltage (albiet a pulsed one), what do I need to do it to make it drive a DC motor.</p>
DC Motor control with an Arduino
2010-07-01T13:10:03.980
3252
|heatsink|soldering|dip|surface-mount|heat-protection|
<p>You might not notice anything immediately wrong, but running a component up to molten solder temperatures is likely to short the device's life span. It only takes a couple of seconds to get serious amounts of heat into a part. (Try it with a disc ceramic capacitor some time; by the count of three, you'll see the surface of the cap go all shiny and wet looking as the coating melts!)</p> <p>As for protecting parts, this doesn't help for IC's or very small components, but if you want to protect discrete components that have wire leads, it's very easy to clip a small alligator clip on a lead, between the device and the solder point, to sink heat away from the device. This works well for small capacitors, low-wattage resistors, even TO-92 and TO-220 cased semiconductors.</p> <p>Along the same lines as alligator clips, you can use 'medical forceps' if you have those, or even a small pair of needle-nosed pliers with a rubber band wrapped to keep the jaws shut.</p>
<p>As a follow-up to <a href="https://electronics.stackexchange.com/questions/3244/what-is-the-best-way-to-heat-sink-a-chip-when-soldering-it-on">this question</a>, what kind of damage could a soldering iron do to an IC or other component if left on it for too long at too high a temperature? ESD damage can be subtle, for instance. Is overheating damage usually obvious/complete destruction? I've desoldered/resoldered things by just globbing on a lot of solder and heating it all up, probably using more heat than is recommended, but I've never noticed any damage.</p>
What kind of damage could a soldering iron do to a component?
2010-07-01T16:24:22.653
3260
|capacitor|programming|
<p>The most innovative implementation of digitally-controlled variable capacitance was done by none other than <a href="http://afrotechmods.com/cheap/capacitor/digitalcapacitor.htm" rel="nofollow">AfroTechMods</a>. I know - with a name like AfroTechMods he doesn't seem like he'd be on the level, but it's rather ingenious. </p> <p>In short: This method only works if one end of the variable capacitance needs to be tied to ground. You take several different values of capacitors and short one terminal of them all together - connect this to the point in the circuit where normally you'd connect the capacitor to ground. The other end of each capacitor gets connected to a digital I/O pin on a microcontroller. If you set the pin to sink current then it's the same as if that end of the capacitor was tied to ground. By changing the state of the pins that each capacitor is connected to you can essentially put one or more capacitors in parallel to achieve almost any value capacitance - controlled digitally. It's rather neat.</p>
<p>Anyone have any details on how to make a programmable capacitor? Is it some fancy op amp trick?</p> <p>EDIT: I suppose I should be more clear. The new iPhone 4 is having severe antenna problems, because the antenna is exposed to the user's touch, and some users are bridging two ends of the antenna while holding the phone, altering the capacitance of the antenna so significantly that calls get dropped with even 4 bars.</p> <p>Allegedly, the iPhone 4 also uses programmable capacitors, and there is some noise about whether the iPhone OS 4 will be able to tune the caps to compensate for the user's hand grip. When I heard this, I was not sure exactly how one might create a programmable capacitor...</p>
iPhone programmable caps
2010-07-01T20:28:25.097
3273
|arduino|wifly|wifi|arduino|
<p>Ok, more information here ( <a href="http://mcukits.com/2009/04/06/arduino-ethernet-shield-mega-hack/" rel="nofollow">http://mcukits.com/2009/04/06/arduino-ethernet-shield-mega-hack/</a> ). Even though this is for Ethernet, I have to do the same thing with the WiFly module and rewire the pins.</p>
<p>I bought a WiFly shield ( <a href="http://www.sparkfun.com/commerce/product_info.php?products_id=9367" rel="nofollow">http://www.sparkfun.com/commerce/product_info.php?products_id=9367</a> ) for my Arduino Mega board and am trying to hook it up. </p> <p>I tried the wireless talker tutorial which seem to be very popular <a href="http://www.sparkfun.com/commerce/tutorial_info.php?tutorials_id=158" rel="nofollow">http://www.sparkfun.com/commerce/tutorial_info.php?tutorials_id=158</a></p> <p>I tried running the first sketch, but it doesn't work. It just gives me a Bridge Locked up message. I tried changing the pin associations in the code as discussed in this post <a href="http://forum.sparkfun.com/viewtopic.php?f=13&amp;t=22067&amp;p=104343" rel="nofollow">http://forum.sparkfun.com/viewtopic.php?f=13&amp;t=22067&amp;p=104343</a> but again no joy.</p> <p>I tried the standard WiFly library that sparkfun ship from here ( <a href="http://sparkfun.com/Code/wifly/WiFly-20100519-023939.zip" rel="nofollow">http://sparkfun.com/Code/wifly/WiFly-20100519-023939.zip</a> ) I extracted the zip files, put them under the libraries directory of the IDE, fired up the IDE, started the example and tried to run it, again no go. I put my credentials in the credentials.h file, changed the pin associations in the Spi.h file (for CS, MOSI, MISO, SCK) as suggested above to 53,51,50,52 respectively. Again, no joy. The terminal window just sits there showing "WiFly Shield Terminal Routine". </p> <p>What am I doing wrong? Has anyone used the WiFly module by itself or with the Arduino mega board? Do I need to hook up the Mega's 50 - 12 pins to the WiFly shield somehow? There seems to be a similar discussion here with no resolution <a href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1270926864" rel="nofollow">http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1270926864</a></p> <p>PS: I am running this on Windows 7, 64 bit</p> <p>Any help would be greatly appreciated.</p>
Arduino Mega and Wifly shield
2010-07-02T04:16:34.027
3279
|arduino|bootloader|
<p>I'll give a slightly more theoretical answer; the other answers are quite good from a practical perspective. A bootloader is code that resides in a special segment of flash memory. Code that resides in that segment is allowed to execute Self-Programming Instructions, making it possible to modify flash memory (i.e. where user code resides) without a conventional programmer (i.e. In-System Programming ISP or High-Voltage Programming HVP) like the STK500 or AVRISP mkII.</p> <p>In principle, the UART Recieve Data Interrupt Service Routine (ISR) makes a function call into the bootloader code that copies the program image being sent serially into the user program space in flash memory. At startup, whatever program is on the chip starts running, but if appropriately formed serial data is received early on, the AVR goes into a sort of self-programming mode. There is some logic in the UART ISR that only defers to the bootloader code for a short period of time during startup. The details are a bit more complicated than that, but that's the basic idea. </p> <p>The beauty of this is that you can buy an Arduino, and nothing else, download the free Integrated Development Environment (IDE), and start writing Arduino Sketches (programs), and download them onto the AVR just like that, over USB no less thanks to the fancy little FTDI IC chip that's integrated into the Arduino board.</p>
<p>I am very new to embedded world. I had been till now working only on S/W</p> <p>Can anyone please explain me the use of the Arduino Bootloader? I want Arduino to perform some simple mathematics using some additional components that have to be put in to the chip. </p> <p>Do I necessarily need a bootloader?</p>
Arduino Bootloader
2010-07-02T12:40:29.067
3283
|microcontroller|communication|pcb|ground-loop|
<p>Thinking out of the box:<br> You could place a simple motor or a relay near controller, connect a usual thread to it and lay it to the second board, where you place a switch, connected to it's ground or it's VCC. (it could be a real wire -> single-wire signal transfer :D )<br> If those two boards are in optical visibility you could put IR transmitter-receiver.<br> ...something else...</p>
<p>On one board I have a microcontroller with one power supply and on another I have a Flip Flop with a separate power supply. I want to connect a pin of the microcontroller to the reset pin of the flip flop. Can I just put a wire accross or does it need more than that? I was going to do that but now I'm not sure that would work because it wouldn't be a complete circuit and the two boards may not have quite the same ground levels. The two boards have to have separate power supplies because the board with the DSP is premade and the power comes from the mains. Thanks</p>
Communication between microcontroller and separately powered PCB
2010-07-03T04:43:20.980
3286
|microcontroller|dsp|led|pins|current|
<p>If you google TMS320F2812, the 2nd link is to a PDF file tms320f2812.pdf; if you look in this document at table 6.2, "Recommended Operating Conditions", you can find the numbers you need. </p> <p>If you plan to connect the LED from the pin to ground (through a resistor, of course), so that a '1' output lights the LED, the number you want is Ioh, high-level output source current. Whereas if you plan to connect the LED instead to your +V supply, so '0' lights the LED, check Iol, low-level output sink current.</p> <p>Looking at the numbers, you can see values from 4mA to 8mA, but you should also take note that these are in the 'MAX' column, which means these are values you should not exceed. Now, 4mA is not very much current, typical current to light an LED can be 10 or 20mA, to establish useful brightness. Were it me, I would employ some kind of driver between the '2812 and the LEDs, and try to keep the current in/out of the '2812 I/O pins well under 2mA.</p>
<p>I'm using a TMS320F2812 and want to drive LEDs of some of the pins. I couldn't figure out what the safe levels of current were which could go in or come out of the IO pins from the datasheet. What is the safe range or how could I find out? What are normal values for these levels? Thanks.</p>
How much current can a microcontroller/DSP pin sink/source?
2010-07-03T07:41:56.473
3312
|measurement|wire|
<p>I am working on the same 3-wire-strain gauge. I am using 2 sets of the sensors to get a better results because I was experiencing same problem with you. Try to reverse the power polarity if you still cant get any values.</p>
<p>How do I connect/use a 3 Wire Digital Scale Strain Gauge Weight Sensor?</p> <p>I took it from an old weight meant for people. :)</p> <p>The wires are red, black and white.</p> <p>I found this, <a href="http://www.nerdkits.com/videos/weighscale/" rel="nofollow">http://www.nerdkits.com/videos/weighscale/</a> ,but they use a 4 wire.</p> <p>Thanks</p>
3 Wire Digital Scale Strain Gauge Weight Sensor
2010-07-06T12:27:26.950
3314
|pcb|layout|routing|
<blockquote> <p>The PCB vendors quote that they like traces down to 7 mil.</p> </blockquote> <p>No, it's not that they like it. It's just what they can support. So, for a particular board product, there is a limitation that trace and space must be 7mils or wider. Beyond that it's entirely up to you. So, as long as your spaces and traces are 7mils or more, you can use whatever grid you feel like using.</p> <p>State of the art PCB software supports multiple grids at different areas in the circuit, with different spacing and different angles, including dynamic grid that follows the last trace endpoint and direction. But in any case grids are only aids for manual routing. Automated or semi-automated routing works at whatever design rule trace and space is set, and it doesn't use a grid at all.</p>
<p>I have been using 10 mil trace with 10 mil spacing. The PCB vendors quote that they like traces down to 7 mil. But then I ran across a PDF showing how to fan out a QFP to get all the signals accessible. They use millimeters because the QFPs are packaged with 0.4mm or 0.6mm pitches.</p> <p>They also make an argument that using a 0.05mm grid approximates mils, but mm allows you to route buses in between the vias and pads.</p> <p>Should I be using mil or mm when I am routing a PCB?</p>
Do you layout in mil or mm?
2010-07-06T13:16:52.193
3329
|components|bom|
<p>You can create a custom Chrome search engine.</p> <ol> <li><p>go to Chrome settings</p> </li> <li><p>click search engine &gt; Manage search engines and site search</p> </li> <li><p>under Site Search, click Add</p> </li> <li><p>Enter</p> <p>Search engine: Digikey</p> <p>Shortcut: di</p> <p>URL: <a href="http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&amp;name=%s" rel="nofollow noreferrer">http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&amp;name=%s</a></p> </li> </ol> <p>To test:</p> <ol> <li>Open a new tab</li> <li>In address bar type di and press spacebar</li> <li>Enter desire part number</li> </ol> <p><a href="https://groovypost.com/howto/add-custom-search-engine-chrome" rel="nofollow noreferrer">https://groovypost.com/howto/add-custom-search-engine-chrome</a></p>
<p>How to automatically retrieve, given a Digi-Key part number, information such as Manufacturer, Manufacturer Part Number, Description, etc. Perhaps parsing the GET http respose to:</p> <p><a href="http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&amp;name=DK_PART_NUMBER">http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&amp;name=DK_PART_NUMBER</a></p> <p>(thanks to angryee for the correct parameters) </p> <p>Where DK_PART_NUMBER is the Digikey part number.</p> <p>Does anybody know if they have a web service or simply a better interface for this?</p> <hr> <p>After asking this question I decided to go ahead and write something that did some basic fetching from Digikey:</p> <pre><code>dk_pn = '587-1962-1-ND' from urllib import urlopen from sgmllib import SGMLParser headers = ['Digi-Key Part Number', 'Manufacturer', 'Manufacturer Part Number', 'Description', 'Lead Free Status / RoHS Status', 'Operating Temperature', 'Standard Package', 'Price Break', 'Unit Price', 'Extended Price'] class DK_Parser(SGMLParser): def reset(self): SGMLParser.reset(self) self.last_td = '' self.inside_th = False self.inside_td = False self.grab_data = False self.part_info = {} self.hdr_index = 0 self.row_hdrs = [] def start_tr(self, attrs): # row self.first_header_in_row = True def start_th(self, attrs): # header cell if self.first_header_in_row: self.first_header_in_row = False self.row_hdrs = [] self.hdr_index = 0 self.inside_th = True def end_th(self): self.inside_th = False def start_td(self, attrs): # data cell self.inside_td = True def end_td(self): self.inside_td = False self.hdr_index = self.hdr_index+1 def handle_data(self,text): text = text.strip() if self.inside_th: if text in headers: self.row_hdrs.append(text) self.last_td = '' self.grab_data = True else: self.grab_data = False elif self.inside_td and self.grab_data: if self.hdr_index: self.last_td = '' if self.hdr_index &lt; len(self.row_hdrs): self.last_td = self.last_td + text self.part_info[self.row_hdrs[self.hdr_index]] = self.last_td dk_url = 'http://search.digikey.com/scripts/DkSearch/dksus.dll' dk_params = '?Detail&amp;name=' sock = urlopen(dk_url + dk_params + dk_pn) parser = DK_Parser() parser.feed(sock.read()) sock.close() parser.close() for k,v in parser.part_info.items(): print k,":",v </code></pre> <p>Only the first data line of the the [price break/unit price/extended price] table is captured.</p>
How to retrieve part information from Digi-Key automatically
2010-07-07T20:18:16.323
3343
|embedded|
<p>Think twice before you become an embedded software engineer. I have had phases in my career. I have developed software the first 5 years, than move to sales/marketing, done that for 15 years, managed a 100+M$ business and now I am back to software. </p> <p>When I come back to software after 15 years, I remember why I left in the first place. It is hard. It needs concentration, several hundreds of lines of code touching each other and you all need to keep it in the memory. Embedded is particularly hard. </p> <p>You also need to understand yourself. If you are generally a smart guy, meticulous and patient you would make a great engineer. If you are missing any one of those you will be average at best. Think about that. If you are ultra smart and not patient, doesn't worth much because no matter how smart you are, good engineering takes patience and attention to detail.</p> <p>You also need to be comfortable looking at code hours at a time without talking. I observe that people with good social skills find this unbearable. </p> <p>If all this checks out, than read all those great books, do the exercises and you will make a great engineer.. Good luck</p>
<p>I'd like some tips for those who want to become a good embedded software developer or want to improve in this area.</p> <p>What should I need learn about hardware, software?</p> <p>Which books are most recommended? Blogs?</p> <p>In the end, how could I go from a beginner hobbyist to an excellent professional?</p>
How to become an embedded software developer?
2010-07-08T13:10:53.647
3348
|mosfet|switches|driver|
<p>If you want to calculate the gate current during switching you can use this formula:</p> <p>Ig = Q/t</p> <p>where Q is the gate charge in Coulomb (nC from the data sheet) and t is the switching time (in ns if you use nC).</p> <p>If you need to switch in 20 ns, a typical FET with a total gate charge of 50 nC will need 2.5A. You can find nimbler parts with gate charge below 10 nC. I prefer to use 2 BJTs in a totem configuration for driving MOSFETs instead of the expensive driver ICs.</p>
<p>There are dedicated &quot;MOSFET driver&quot; ICs available (ICL7667, Max622/626, TD340, IXD*404.)</p> <p>Some also control IGBTs.</p> <p>What is the practical purpose of these? Is it all about maximizing the switching speed (driving gate capacitance) or are there other motives?</p>
What is the purpose of "MOSFET driver" ICs
2010-07-08T13:53:00.077
3352
|components|relay|triac|
<p>You can combine them both. The power dissipated by SSRs is typically 13W at 10A, probably requiring a heatsink. But by using a mechanical relay you can reduce this to only occur for a few milliseconds whilst the relay is closing. Since the SSR is already on, the voltage across the relay contacts is very low, so no arcing occurs. You'll probably need a small microprocessor because the sequencing of the on/off signals needs to be correct. </p>
<p>What are the scenarios where Triacs can not replace a relay or vice-versa?</p>
Triac versus Relay
2010-07-08T14:11:26.030
3362
|compiler|arm7|
<p>Can you instead declare your variable as a union of a byte array and a long array?</p> <p>I don't know if this is any more "legal" than your original code without a careful reading of the spec but it might be worth looking into.</p>
<p>I'm having a problem working with the TI/Stellaris EK-LM3S6965 demo board and associated software, specifically the OLED display driver. My problem is not that it doesn't work, it's that it <em>mostly</em> works. Except for this one section:</p> <pre><code>// // Clear out the buffer used for sending bytes to the display. // *(unsigned long *)&amp;g_pucBuffer[0] = 0; //Line 438 *(unsigned long *)&amp;g_pucBuffer[4] = 0; //Line 439 </code></pre> <p>which causes gcc to complain:</p> <blockquote> <p>rit128x96x4.c:438: warning: dereferencing type-punned pointer will break strict-aliasing rules.</p> </blockquote> <p>The problem occurs because g_pucBuffer is declared as a character array: </p> <pre><code>//***************************************************************************** // // Buffer for storing sequences of command and data for the display. // //***************************************************************************** static unsigned char g_pucBuffer[8]; </code></pre> <p>but we're accessing it as a long (32-bit, 4 characters) and so clearing the array in 2 lines of code instead of 8. The uC is a 32-bit processor, so it should do this in 2 cycles after setup. It actually uses 4 instructions, instead of the possible 1 store-multiple instruction in 2 cycles, but at this point I'm more than happy with the compiler's performance (It's a fairly new architecture, and the compiler's only a few months old). </p> <p>But, when I write each byte sequentially to 0, </p> <pre><code>g_pucBuffer[0] = 0; g_pucBuffer[1] = 0; g_pucBuffer[2] = 0; g_pucBuffer[3] = 0; g_pucBuffer[4] = 0; g_pucBuffer[5] = 0; g_pucBuffer[6] = 0; g_pucBuffer[7] = 0; </code></pre> <p>it does each write as a single instruction. I know, it's 4 cycles, but I want to do this right, and I think I have a clever and safe piece of code. It's more a personal issue now. I've got full optimization turned on, but it can't figure out that I really just want this 64 bits to be 0 as simply as possible.</p> <p>However, what the warning wants me to do is access the variables as characters, because I'm crossing byte boundaries (Writing g_pucBuffer[0, 1, 2, and 3] in a single step). I know that they're dword aligned, I know that the code works in the original, but I want the warning to go away.</p> <p>How can I either cause gcc to ignore this specific cast/aliasing issue, or do it properly?</p>
Help fix or ignore aliasing warning in gcc
2010-07-09T00:30:31.560
3376
|measurement|impedance|resistance|noise|
<p>OK, I know how to do this now.</p> <p>There are 3 main sources of noise that need to be calculated:</p> <ul> <li>Thermal noise of the resistors themselves</li> <li>Voltage noise of the op-amp itself</li> <li>Current noise of the op-amp, which interacts with the resistors to produce a voltage noise</li> </ul> <p>So first, you want to find the equivalent resistance seen from the inputs of the op-amp looking outward into the circuit, with voltage sources (such as the op-amp output) set to 0 V (equivalent to converting them to short-circuits to ground). For this circuit: <span class="math-container">$$ R_\mathrm{eq}=(R_\mathrm{m}+R_\mathrm{s}+R_\mathrm{p})\|(R_\mathrm{f}+R_\mathrm{g}) $$</span></p> <p><a href="https://i.stack.imgur.com/kSgEx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kSgEx.png" alt="Virtual ohmmeter looking out into the circuit from the op-amp inputs"></a></p> <p>So for example, if Rs = 100 Ω, Rm = Rp = 1 kΩ, and Rf = Rg = 100 kΩ, then Req = 2.1 kΩ.</p> <p>To find the thermal noise of this equivalent resistance, use the <a href="https://en.wikipedia.org/wiki/Johnson%E2%80%93Nyquist_noise" rel="nofollow noreferrer">Johnson–Nyquist formula</a>: <span class="math-container">$$ v_\mathrm{n}={\sqrt {4k_{\text{B}}TR\Delta f}} $$</span> There are online calculators to do this for you:</p> <ul> <li><a href="http://www.sengpielaudio.com/calculator-noise.htm" rel="nofollow noreferrer">sengpielaudio.com</a></li> <li><a href="http://www.daycounter.com/Calculators/Thermal-Noise-Calculator.phtml" rel="nofollow noreferrer">Daycounter, Inc.</a></li> </ul> <p>For example, with Req = 2.1 kΩ, at 27 °C, with an audio bandwidth of 22 kHz, the resistors would contribute 0.87 μV<sub>RMS</sub> = −121 dBV input noise.</p> <p>Then find the voltage and current noise of the op-amp in the datasheet. Typically:</p> <ul> <li>If <span class="math-container">\$R_\mathrm{eq}\$</span> is small, you want a BJT-input op-amp, which has lower voltage noise (0.7-5 nV/√Hz), but higher current noise (500-4000 fA/√Hz).</li> <li>If <span class="math-container">\$R_\mathrm{eq}\$</span> is large, you want an FET-input op-amp, which has lower current noise (1-10 fA/√Hz), but higher voltage noise (3-15 nV/√Hz).</li> </ul> <p>To convert the spectral density <span class="math-container">\$\tilde v\$</span> (in nV/√Hz) to a voltage (in V<sub>RMS</sub>), you need to multiply it by the square root of the bandwidth: <span class="math-container">$$ v_\mathrm{RMS}=\tilde v \cdot \sqrt{\Delta f} $$</span> So for example, if the op-amp is a TLC071, with equivalent input noise voltage density of 7 nV/√Hz, the voltage noise of the op-amp contributes 7 nV/√Hz ⋅ √(22 kHz) = <a href="http://www.wolframalpha.com/input/?i=7nV/sqrt(Hz)*sqrt(22+kHz)+to+microvolt" rel="nofollow noreferrer">1.04 μV<sub>RMS</sub></a> = −120 dBV.</p> <p>The resistor noise and op-amp noise are similar levels, which means they'll combine to about 3 dB higher, or −117 dBV. To calculate their combination exactly, since they're uncorrelated, you need to use root sum squared: <span class="math-container">$$ v_\mathrm{total}=\sqrt{{v_\mathrm{R}}^2+{v_\mathrm{OP}}^2} $$</span> So √(0.87<sup>2</sup>+1.04<sup>2</sup>) = 1.36 μV<sub>RMS</sub> = −117 dBV, as estimated.</p> <p>The current noise is probably irrelevant for an FET-input op-amp, so we can skip to calculating the output noise: Just multiply the input noise by the gain of the amplifier. However, you need to multiply by the "<em>noise</em> gain", not the signal gain. <a href="https://electronics.stackexchange.com/a/282646/142">To find the noise gain of the amp</a>, convert your existing sources into short circuits and put a test voltage source right in series with the non-inverting input of the amp:</p> <p><a href="https://i.stack.imgur.com/YCkVR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YCkVR.png" alt="Differential amplifier with noise source in series with non-inverting input for calculating noise gain"></a></p> <p>So the op-amp will do whatever it takes for the inverting input to equal the non-inverting input. There will be one current path: <span class="math-container">$$ I=\frac{V_\mathrm{out}}{R_\mathrm{f}+R_\mathrm{m}+R_\mathrm{s}+R_\mathrm{p}+R_\mathrm{g}} $$</span> and this is related to <span class="math-container">\$V_\mathrm{t}\$</span> by: <span class="math-container">$$ V_\mathrm{t}=I(R_\mathrm{m}+R_\mathrm{s}+R_\mathrm{p}) $$</span> combining and solving: <span class="math-container">$$ \frac {V_\mathrm{out}}{V_\mathrm{t}} = \frac {R_\mathrm{f}+R_\mathrm{m}+R_\mathrm{s}+R_\mathrm{p}+R_\mathrm{g}}{R_\mathrm{m}+R_\mathrm{s}+R_\mathrm{p}} $$</span> So in our case, this is a noise gain of 96.2× = +39.7 dB, and our input noise of −117 dBV becomes −77 dBV at the output. (A TINA simulation gives 137.5 μV<sub>RMS</sub> = −77 dBV, for comparison.)</p> <h2>More detailed steps</h2> <p>There are several extra steps you can do to make your calculation more accurate:</p> <p>To calculate the effect of the op-amp's current noise, take the current noise and multiply it by the equivalent resistance calculated earlier. For the TLC071, this is 0.6 fA/√Hz. So, combined with <span class="math-container">\$R_\mathrm{eq}\$</span> of 2.1 kΩ, we get 0.00126 nV/√Hz. Obviously this is much smaller than the op-amp's voltage noise, so it will have no effect on the result in this example. In cases with large <span class="math-container">\$R_\mathrm{eq}\$</span>, it will have an effect. You can calculate it this way and combine it with the other sources as shown above: <span class="math-container">$$ v_\mathrm{total}=\sqrt{{v_\mathrm{R}}^2+{v_\mathrm{V}}^2+{v_\mathrm{I}}^2} $$</span> Also likely to have an effect is the bandwidth of your measurement equipment. The previous measurements assume a brickwall filter at 22 kHz, but brickwall filters can't exist in reality. You can correct for the fall-off of a real-life filter by calculating the equivalent noise bandwidth (ENBW). Here's a table of <a href="https://gist.github.com/endolith/7d2b2b08466976a95732" rel="nofollow noreferrer">ENBW Filter correction factors vs order</a>. See also <a href="https://electronics.stackexchange.com/questions/281155/why-are-there-two-sets-of-enbw-correction-factors">Why are there two sets of ENBW correction factors?</a></p> <p>In fact, voltage noise of the op-amp is not actually a constant. It varies with frequency, so is better written as <span class="math-container">\$\tilde v(f)\$</span>. You can calculate it more accurately with numerical integration. See <a href="https://electronics.stackexchange.com/a/280943/142">Noise and what does V/√Hz actually mean?</a></p>
<p>I <em>think</em> I know how to do this, but you can find a lot of different instructions and calculators online that contradict each other. I have yet to find a clear, concise procedure for calculating the self-noise of op-amp circuits (including thermal noise, shot noise, etc., but not including interference from external sources), and one of the sources many people cite apparently has <a href="http://e2e.ti.com/support/amplifiers/etc_amplifiers__other_linear/f/18/t/156728.aspx" rel="noreferrer">a number of errors</a>, so I'll ask it here and see who can explain it best.</p> <p>For example, how would you calculate the output noise of this circuit?</p> <p><img src="https://i.stack.imgur.com/zpJXg.png" alt="A differential op-amp circuit"></p> <p>Which noise sources do you include?</p> <ul> <li>Op-amp internal input voltage noise</li> <li>Op-amp internal input current noise</li> <li>Resistor thermal noise</li> <li>Op-amp output stage noise?</li> </ul> <p>How do you calculate each component's contribution? How do you combine the noise components together? What gain do you use to get the output noise from the input equivalent noise? How do you calculate the gain? Is it the same as the signal gain? What kind of simplifications and shortcuts can be made and how different will the result be from the real world?</p> <p>etc. etc. etc.</p>
How do you calculate the noise of an op-amp circuit?
2010-07-09T15:59:56.620
3386
|arm|cortex-m3|microcontroller|
<p>I would break out the USB pins - when you want to put your finished project into enclosure, you have to make your board positioned near the edge to make USB connector accessible from outside. You might want to put separate USB connector on the case and connect it to the board via cable.</p> <p>Think of the power - will your board get the power and redistribute it to peripherals or will it get it from outside exclusively?</p> <p>Think about 5V compatibility - will your peripherals work on 3.3V or will they need 5V? Might worth adding some voltage conversion scheme atleast for some pins.</p> <p>Buffering - somewhat related to voltage compatibility - will you be driving something on raher long cable? If yes, you might want to put in some buffer ic's that could work as voltage converters too.</p> <p>I'm working with microbuilder reference design board <a href="http://www.microbuilder.eu/projects/LPC1343ReferenceDesign/" rel="nofollow">http://www.microbuilder.eu/projects/LPC1343ReferenceDesign/</a> and these are my points from the experience with it. </p> <p>BTW, it has a nice one push button feature for entering programming mode, but be aware that you need a voltage monitor chip for it to work nicely, othervise it will enter programming mode every time you plug in the cable (which might be ok actually)</p>
<p>Have people here used the LPC1343 Cortex-M3 chip?</p> <p>I've built a few small circuits with PIC microcontrollers before but now I'm using an LPC1243 Cortex-3/ARM. I've been using an LPCXpresso prototype board which has worked very nicely but I want to build a proper PCB now for my circuit. I'm finding this chip a lot nicer to work with in software than PICs (Which i also like!)</p> <p>With the PICs my experience was that it was easy to forget something when building the hardware. For example a pin needed pulling low to disable low voltage programming on some pics or the chip wasn't programmable.</p> <p>My circuit is simply a 18x2 line LCD module connected to the chip which gets its input from a PC connected via a USB HID interface. I have it all working on the prototype board / breadboard.</p> <p>On the LPC1343 I plan to connect </p> <ul> <li>The power supply pins to power and decoupling capacitors</li> <li>The 12 MHZ crystal and capacitors.</li> <li>The 6 I/O pins I need to drive my hardware (An LCD module)</li> <li>The USB pins to a USB port via resistors and a pull up resistor</li> <li>Switches on the reset pin and the pin that enables the internal USB bootloader</li> </ul> <p>And that's all. My question is, are there any other pins I need to connect? It's important that I keep this as simple as possible as it's my first "hobby" project with the chip and frankly it's going to be hard enough to solder it without adding extra complexity (But I'm confident I can do it!)</p> <p>I guess I should post a schematic really, but have I missed anything obvious?</p>
Building a circuit with LPC1343
2010-07-09T17:32:45.980
3390
|batteries|voltage|voltage-regulator|
<p>Lithium batteries are occasionally marked 3.6 or 3.7 volts. More often 3.7 because it looks better. But it's a nominal marking and, as said, the real voltage goes from 4.2 (cutoff to prevent overcharge damage) to somewhere around 3 (cutoff to prevent deep discharge damage). So nickel (or alkaline) and lithium batteries will spend a lot of time in the same range, as it were.</p> <p>It should just work, presuming you take care of charging correctly. There may be a difference in how the battery (and the device!) behaves once the batteries are getting close to empty and how they age. I suppose this is a digital camera that will write to flash memory. That takes a certain voltage at some current. If the battery is too weak and dips when its loaded, the write might get interrupted with undefined results. But it all depends.</p> <p>If the device and its functioning is very important (you're taking the photo of a lifetime...) I wouldn't risk adding random variables like batteries it wasn't designed for. If it's for random use and will work better for you with the new batteries, I'd absolutely go for it.</p>
<p>I want to extend the use of a camera. The camera currently uses a special li-ion 3.7V 1000 mAh battery. I could grab a couple of those batteries, wire them up in parallel, and that'd work just fine. But if I didn't want to use those special batteries, would there be any problem using standard batteries? For example, could I wire up three AA 1.2V 2400mAh bats in serial to end up with a 3.6V 2400 mAh battery? </p> <p>Now my real question: Is the voltage difference (3.6V versus 3.7V) a problem, or is it close enough?</p> <p>Thanks.</p>
Close enough for voltages?
2010-07-09T18:46:28.660
3419
|arm|reset|
<p>reemrevnivek has the right idea, but there's a better way.</p> <pre><code>WDTC = 1024; // short timeout; we don't care (won't be using it) WDMOD = WDEN | WDRESET; // watchdog resets CPU WDFEED = 0xAA; // start ... WDFEED = 0x55; // ... watchdog. WDFEED = 0xAA; // start ... WDFEED = 0x00; // ... invalid WDFEED sequence causes instant reset. </code></pre> <p>That will give you an immediate reset without the need for waiting.</p> <p>Note that simply jumping to location 0 isn't the same as a real reset. Jumping to 0 doesn't reset any peripherals nor does it reset the ARM core's state. It may sound like I'm nitpicking here, but you can run into some very unusual and difficult to debug issues if you are expecting a reset and don't actually get one.</p>
<p>I'm curious? A watchdog timer could do this, but I would like to do it manually.</p>
Is it possible to reset NXP LPC2100 microcontroller from code
2010-07-12T10:48:55.843
3427
|parallel|port|c++|
<p>USB devices have no base address, they are not part of the address space of the CPU, much like a server on the internet is not part of your address space.</p> <p>And everything about USB to parallel adapters has been said in this tread already, they usually do not work for anything but printing.</p>
<p>I'm trying to use a parallel port from a computer as a form of cheap digital output to do various things (control motors, light LEDs, read limit switches, ect).</p> <p>I want to know how to control the 8 data pins on a parallel port using C++, however there's a catch. Since I'm using a modern computer with a modern OS, this presents a few problems.</p> <p>First of all, modern windows OS's don't allow direct access to parallel port pins, I must go through a driver. I have been pointed to using Inpout32 to do this, however the sample program compiled and ran properly but my attached hardware didn't respond. Another person has pointed me to using Windows API. I have searched the MSDN and found only mentions of the appropriate function but without some sample code, I'm lost (maybe I'm searching in the wrong places).</p> <p>The second problem is that my new computer doesn't have any parallel ports. I must use USB to parallel ports instead (cheap and direct from China, $5 each, shipping and taxes all included). The ports are recognized by the computer as IEEE-1284 controllers and the appropriate drivers were automatically installed and the computer reports the device as "working properly". From what i have seen online, there seems to be a wide variety of opinions on the usefulness of these USB to parallel port connectors. One person says it works perfectly fine like any regular parallel port soldered to the motherboard, another says it will work with some hardware hacks, one says it can write but not read, and finally another says it won't work at all because they are not designed to work the same way as "real" parallel ports.</p> <p>I have already done a great deal of research before coming here (sort of as a last resort I guess, StackOverflow didn't yield any answers even after applying a bounty). Pretty much all the information I found on programming parallel ports is outdated and assumes that you have either a parallel port on your motherboard, a pre-Windows-NT OS, or both.</p> <p>If anyone has any idea how to do this, would you please share it with me?</p> <p>Thanks,</p> <p>-Faken</p> <p>Note: I'm running Windows 7 x64 OS on a Core i7 860. I'm programming in C++ on Visual Studio 2008 pro. The USB to parallel port connectors are connected via USB 2.0 ports.</p>
Programming a parallel port as digital I/O
2010-07-12T22:57:40.417
3430
|microcontroller|led|led-driver|
<p>If you want to control the LED's individually, the only current sink driver I have found that can handle that much current is the <a href="http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/DATASHEET/CD00177556.pdf" rel="nofollow">STP04CM05XTTR</a>. I use it in my high power LED driver boards. For current sink drivers you have to make sure that the LED supply voltage is not much higher than the LED forward voltage, otherwise the driver will get too hot.</p> <p>I have written an article about controlling high power LED's with my ShiftPWM library <a href="http://www.elcojacobs.com/using-shiftpwm-to-control-350ma-high-power-leds/" rel="nofollow">here</a>.</p>
<p>I'm trying to put together a project with some bright LEDs but I'm not sure how to control them. Ideally I'd like to drive about 64 of these LEDs that have a forward current of 300mA and voltage drop of between 2.2V and 3.4V. I'm looking for something similar to the MAX7221 I think but one that can support these high currents. Does anyone have any ideas or experience with driving these kind of LEDs. I'd like to use arduino to control the driver.</p> <p>I came across the <a href="http://cds.linear.com/docs/Datasheet/3492fa.pdf" rel="nofollow noreferrer">LT3492</a>, would that work?</p>
LED Driver for 300mA LEDs
2010-07-12T23:34:22.440
3451
|pic|assembly|
<p>If you just want to save/restore the carry bit, and if you don't mind losing the value when you store it and trashing the saved value when you restore it, just use "rlf saved_carry,f" to save it and "rrf saved_carry,f" to restore it. No other registers or flags affected.</p> <p>If speed is of utmost importance and you need to save/set some other bit and restore it later (e.g. RP0), you can do something like:</p> <pre> Int_Entry: btfss STATUS,RP0 goto Version_with_RP0_clear bcf STATUS,RP0 do_interrupt_logic bsf STATUS,RP0 retfie Int_with_RP0_Clear: do_interrupt_logic bcf STATUS,RP0 ; If interrupt logic might have left it set retfie </pre> <p>That's a total of four cycles to not only save/restore RP0, but also set it to a known state for the ISR (if the branch is taken, RP0 is already in the correct state so there's no need to set it). If the interrupt logic wouldn't affect W or other flags (e.g. if it uses bsf/bcf/btfss/btfsc/incfsz/decfsz for just about everything) this logic can save four cycles versus saving W and status, clearing status, running the interrupt, and then restoring status and W. Such savings aren't important in a whole lot of cases, but may be very important if one is trying to e.g. use a TMR2 interrupt to do something every 50 cycles. Since TMR2IF is in a banked register, one has to clear RP0 to reset TMR2IF. If TMR2 is ticking every 50 cycles and the ISR would take 26 cycles with the improvement or 30 cycles without, saving those three cycles in the ISR could increase main-line CPU availability by 20%.</p>
<p>I want to save/restore the PIC's carry bit. I'm using the 16F628A.</p> <pre><code>SAVE_CARRY btfss STATUS, 0 goto CARRY_OFF CARRY_ON bsf carry, 0 return CARRY_OFF bcf carry, 0 return RESTORE_CARRY btfss carry, 0 goto RESTORE_CARRY_OFF RESTORE_CARRY_ON bsf STATUS, 0 return RESTORE_CARRY_OFF bcf STATUS, 0 return </code></pre> <p>There must be a better way. Is there?</p>
What's the most effective way to save/restore a PIC status bit
2010-07-13T15:08:47.033
3462
|spi|i2c|bus|serial|communication|
<p>Basically, you should choose between I2C and SPI. </p> <p>Regardless of which bus you use, you should consider the voltage level of your sensors and third party peripherials. You can do this by making your own converter with two MOSFETS (Only goes one way - Pick up/no change or down/no change; only a problem if you need to run your sensors at 3.3 and interface with 1.8 and 5V masters). See NXP's <a href="http://www.nxp.com/documents/application_note/AN10441.pdf" rel="nofollow">AN10441</a> [PDF]. This will also work for SPI (Just remove the pullups). You will need to add a line to your connector to establish a reference voltage (if you're not doing so already.)</p> <p>One downside of I2C is that you're limited to the slowest clock on the bus. If one sensor is only capable of 100kHz and you want to talk to your memory at 400kHz or 1MHz (both valid speeds), your slower sensor's behavior is unspecified. If you use SPI, the chip select line means that the slower sensor won't even be listening to what's on the bus, and you can run different speeds for different sensors.</p>
<p>I'm designing an embedded device that I would like to make interoperable with third party peripherals through a serial bus. Should I choose SPI, I²C, or some other bus? </p> <p>The peripherals will be pretty low bandwidth (some sensors that communicate over the bus, polled periodically) and most likely within a metre or less of the controller. The controller's sole task is to collect the sensor data, package it in some way, and then send it off to a wireless module via another bus (although the sensor bus could potentially be reused for this too).</p>
What is the most popular embedded serial bus?
2010-07-14T11:57:24.920
3472
|simulation|vhdl|verilog|hdl|
<p><a href="http://www.latticesemi.com/products/developmenthardware/developmentkits/xp2breviadevelopmentkit.cfm" rel="nofollow">Here's</a> a cheap FPGA development kit that may be right for you. However, I am not sure about the level of Open source tools that work with it. The vendor's toolkit chains are available for free download. I have heard that at the price point this kit is available for, it is worth going and getting it.</p>
<p>I have a course in Digital Design in this semester and just love it. Now I know that most of the work in embedded system and digital design is done on computer simulators first and then implemented using hardwares. So I was wondering how should I go about learning HDL. I have few questions</p> <ol> <li>What? I don't know what are the standards but would like to learn which is simple to pick up. I understand that most of the HDLs are designed for use with FPGAs I don't what that. </li> <li>How? Should I follow a text book with independent examples or should I embark upon a project like implementing a small system (may be something like traffic light control).</li> <li>Where? Where would I get the resources?</li> </ol>
How do I learn HDL
2010-07-14T16:53:45.100
3475
|microcontroller|
<p>Yes, it looks like the UBW32 would work fine for you, and the default firmware lets you control the I/O pins from your software on your PC.</p> <p>According to <a href="http://www.sparkfun.com/commerce/news.php?id=386" rel="nofollow">"how to bit bang SPI and parallel interfaces on an FT232R"</a>, you can apparently bit-bang 8 digital pins (possibly more?) on the FT232R controlled by software on your PC.</p> <p><a href="http://www.sparkfun.com/commerce/product_info.php?products_id=718" rel="nofollow">$15 Breakout Board for FT232RL</a></p> <p>It sounds like what you really want is a digital I/O interface; you neither need nor want a programmable microcontroller. If you only wanted 16 bits, I would go with a couple of FT232RL boards. However, it looks like a single $40 UBW32 looks like it will give you the 64 I/O you want for less cost than 8 of the FT232RL boards it would require to get 64 I/O.</p> <p>I'm finding that's becoming increasingly common -- it sometimes costs less to throw an entire microcontroller at a problem, even though it has a million "extra" transistors I'll never use on it, than to use a hard-wired solution.</p>
<p>I'm trying to find the best micro controller package for my computer programs to communicate with the real world. I am hoping for a large number of I/O pins (so far 64 digital is all i need, nothing fancy like analog and PWM) which an I can read and write directly by calling functions from my program running on my CPU. </p> <p>I don't want to download programs onto the micro controller itself to run, rather i would like something that simply plugs into my USB and gives me a bunch of CPU controlled I/O pins that i can control from my C++ programs.</p> <p>What would be the best micro controller package for me? I hope for something that is fairly inexpensive but future proof, as in it runs off USB and has 64-bit drivers for modern OS like Windows 7. Being able to interface more than one of these micro controllers with the same computer program would be a great bonus as well (future expansion).</p> <p>Edit: I don't need high sampling rates (maybe 10 Hz for reading inputs, 1 kHz for output signals) and most of the pins are used for output only. I am working with brand new computers (core i7 860) so even if the sampling is a bit inefficient or slow, it should still be ok (just have one thread dedicated to I/O and have the main program communicate with it).</p> <p>I also don't need all 64 I/O pins on a single micro controller package. If i can interface many micro controller packages at the same time, that would work too (actually it would be ideal to be able to interface many smaller micro controller packages, that means it's easy to expand).</p> <p>I've looked at this: <a href="http://www.schmalzhaus.com/UBW32/index.html">http://www.schmalzhaus.com/UBW32/index.html</a></p> <p>Has anyone had any experience with something like this? Any idea if it will work or not? The main concern is that it is the micro controller that is running the program, not my CPU.</p>
What microcontroller should I use?
2010-07-14T18:34:26.923
3488
|dsp|programming|ezdsp|
<p>I used an F2808 based ezDSP board, and it had an integrated USB JTAG programmer on the board. The parallel port interface on yours might also be connected to an integrated JTAG programmer, or if not, the Code Composer IDE is probably equipped to handle the details of the programming.</p> <p>Sorry I'm sketchy with the details, it's been a couple of years since I used it .. but look around on the Code Composer menus; somewhere there you should find the option to flash your project into the chip. In CCS 3.2, there was a dialog that could be brought up that listed all the flash banks, let you choose the .out image to flash, PLL multiplier value to use, etc. Device selection was on a nearby menu.</p> <p>Once you solve the flashing-the-chip problem, I do recall the biggest pain getting started was dealing with the linker ".cmd" files that set the memory layout for the project. When you write C apps for linux or windows, you don't have to deal with these, but when you get as close to the metal as 28xx's with Code Composer, you have to say exactly what block of physical memory is to be used for what program segment. The easy way to get past the complexities of the .cmd file, initially anyway, was to steal one out of the example projects. </p> <p>In fact, if your software has them, I'd recommend building and flashing one of the canned examples before setting out to write your own software. A search for 'examples' or 'samples' in the CCS install directory should turn them up.</p>
<p>I'm using an eZdsp board which has a TMS320f2812 chip on it. The board has a parallel port on it which is used to program it. I'm experienced with software but not at using microcontrollers or DSPs and don't know wher to begin with getting a simple program on, like to flash the built in LED on the board. I'm using windows 7 and have downloaded the latest code composer studio and have a parallel to parallel cable to connect from computer to board. So now what to get a program on there? Thanks</p>
How do you get a program onto an eZdsp board?
2010-07-14T23:29:17.117
3496
|programming|ezdsp|ti-ccstudio|
<p>I think it's an old unit, and would need to have a driver written for Windows 7. Very few, if any, systems running Windows 7 will even have a parallel port. The cheapest solution would be to use a Win XP system.</p>
<p>I'm trying to use a spectrum digital XDS510PP parallel port to jtag emulator to program an ezdsp board. It's not working and I don't see any problem except that it only supports up windows XP. Is it possible that it just can't work with windows 7? thanks</p>
XDS510PP-PLUS JTAG Emulator on windows 7
2010-07-15T07:17:07.597
3497
|arduino|c|serial|iphone|processing|
<p>Although I'm not familiar with Arduino programming, if you have a series of if statements like if(Serial.read() == 't') then I believe the first one probably is gobbling up the character from the serial port, and in then the next test if(Serial.read() == '1') the port will be empty and the character gone.</p> <p>Instead, you want to save the character in a variable, and then test the variable:</p> <p>ch = Serial.read(); if (ch == 't') ... else if (ch == '1') ...</p> <p>etc.</p>
<p>I have been trying to get this to work for a few days.</p> <p>What I have at the moment is TouchOSC installed on my iphone sending commands to a processing program, which in turn simplifies them and sends them off to my Arduino through serial.</p> <p>This is where my problem is. The commands get there and I can print them out easily enough. They arrive correctly. Format is t11 or t10 (t for toggle control, then # for id of control changed, the last # is on or off (1 or 0).</p> <p>Now when I try and break this down with if statements it never seems to work. I know the data is correct when it gets to the Arduino.</p> <p>I need to test if the first char is a 't' simple if statement</p> <pre><code>if(Serial.read() == 't') </code></pre> <p>before this i test if</p> <pre><code>Serial.available() </code></pre> <p>is true then through similar if statements I test if next is the number '1' or '2' for the control id, then if number is on or off, '1' or '2'.</p> <p>When I test this in Serial monitor or with real data off my phone never seems to get into the loops or will get it to one and not the other. Sometimes I can tweak it to get into all of them to switch the LED on, but then won't turn it off or vice-versa.</p> <p>Can anyone please give me an example of the logic that I need to use? I have also tried using switch statements for the ID doesn't seam to make much difference.</p>
Serial nested if statements (Not working)
2010-07-15T08:49:29.363
3506
|pcb|safety|
<p>I work for a college manufacturing circuits that students have designed. A splash of ferric/developer or acetone is fine as long as you wash it off straight away. Regarding fumes, I wear a respirator, faceshield, rubber gloves, wellies and overalls while etching. In the past I have been ill from ferric fumes and make sure I always wear the respirator these days. . Even with a powerful ventilation system in place.</p>
<p>I've been making a few hobbyist PCBs at home and note that the photoresist developer and ferric chloride etch solutions are both pretty nasty chemicals that come with all kinds of warnings.</p> <p>So I've been extremely careful</p> <ul> <li>Wearing safety goggles while dealing with them.</li> <li>Wearing disposable gloves at all times and throwing them away afterwards.</li> <li>Wearing old heavy clothes so that a splash won't immediately touch skin.</li> <li>Rinsing everything with large amounts of water afterwards.</li> </ul> <p>My question is just how much of this is needed and how "nasty" are the chemicals?</p> <p>I shall continue to wear goggles as they are no trouble and there seems no point risking eye damage however unlikely.</p> <p>But what about the rest? If I get a single drop of the photoresist developer or feric chloride on me (and wash it off quickly) is that likely to be a huge problem? If I've rinsed something badly and there is still a trace of diluted chemical on there is that harmful? For example I'm throwing away my disposable gloves every time. I don't believe I get significant amounts of either on there but I'm not taking any risks. I could always wash them and use them again but they are cheap so I don't. But what risk is there that a few drops were on there and didn't get entirely removed by washing and they touched my skin?</p> <p>I'm of course not looking for someone to say go ahead, it's fine :) I'm just looking to know what the risks actually are so I can be an appropriate level of careful rather than over the top careful which I am now, which frankly can be a pain.</p>
Safety of making PCBs
2010-07-15T11:16:14.420
3511
|esd|best-practice|corrosion|
<p>There are also ergonomic factors, human beings work best at 40% to 60% RH.</p>
<p>What is the best humidity level for an electronic shop? On one end of the scale, you will have problems from corrosion due to high humidity and condensation, but at the other end there will be serious problems from ESD.</p> <p>I've worked in shops at either extreme end of the scale, and would imagine the ideal level being around 50% relative humidity. Thoughts?</p>
Best humidity level for electronic shops?
2010-07-15T13:47:26.410
3518
|microcontroller|msp430|ide|ti-ccstudio|
<p>I just got one of those $4.30 MSP-EXP430G2 boards, and, having worked with both Eclipse and CCSv3 (the full license version), I also downloaded CCSv4, thinking that would be the path with the easiest learning curve.</p> <p>There may be some kind of tutorial on <a href="http://www.ti.com/launchpadwiki" rel="nofollow">the MSP430 launchpad wiki</a>, but I haven't found it yet. Ideally there should be a how-to that shows, starting from scratch, how to create a project and get it into the device. If I <em>do</em> find such a thing, I'll edit this post to try to include the correct link.</p>
<p>Does anyone have experience using CCSv4 to program for the MSP430 chips? I know msp-gcc is out there, and I'm sort of kicking myself for not using it, but at this point I'm stuck with CCSv4. I was drawn in by the fact that it was built on Eclipse, but I'm uninspired by the level of library/header file support that exists. I've had very little luck in even getting the UART to work correctly, and I won't even go into my struggles with printf. Does anyone have any advice on making the most of CCSv4 for MSP430 work? Maybe it's just me and I haven't tapped into some awesome resource yet... (I've already seen the MSP code examples provided by TI for my MSP430 family, and I've signed up on TI's e2e community...)</p>
Code Composer Studio v4 and MSP430 development
2010-07-15T15:45:30.540
3525
|arduino|oscilloscope|logic-analyzer|
<p>As far as logic analyzers go, I wrote a basic comparison of (relatively) inexpensive ones:</p> <p><a href="http://blog.davr.org/2010/03/16/comparison-of-logic-analyzers/" rel="nofollow">Comparison of PC-based logic analyzers</a></p> <p>One thing to note about sampling speed, a rule of thumb is you generally need at least 4x your data rate in order to get an accurate reading, and up to 10x is better. So if you want to monitor a 8MHz signal (which you can easily generate from an inexpensive AVR in SPI for example), you'd want a 32-80MHz sampling rate analyzer. This only applies when capturing in 'async' mode. If you are capturing in 'synchronous' mode (eg with a clock signal), then your sampling rate only needs to match the rate of the clock signal. So for example in that case, 8MHz synchronous sampling would be enough to capture a 8MHz SPI signal (since it has a dedicated clock signal).</p>
<p>I am a professional software developer who is used to the luxuries of integrated debuggers. For a while now, I have been experimenting with the Arduino platform. However, I find that attempting to interface with components like a Dallas DS1820 digital temperature sensor is like fumbling around in the dark.</p> <p>Assuming a loose budget of $200 or so, what kind of tools are there to help me visualize what's going on? I have looked at the Link Instruments MSO-19, but I honestly don't know a whole lot about the difference between an oscilloscope and a logic analyzer.</p> <p>How do I know that the device I buy will be capable of measuring the types of (simple) components I am using?</p>
Best tools to debug simple digital circuits?
2010-07-16T00:22:44.617
3530
|programming|ezdsp|ti-ccstudio|
<p>There is a device-specific library you have to include that defines the I/O devices as they are on your cpu, and another library that supplies the 'IQ math' routines. I don't have access to the CCSv3/ezDSP setup I worked with a year or two ago (long weekend!), but I think at least the IQ math library was IQmath.lib, or possibly IQmath.out; the F2808 in that project required including a file with a name something like ml28xx.out. Sorry I can't get these file names right until probably Monday evening, but if you search for ml28* and/or IQmath* in the C:\tidcs tree, you might be able to find them.</p> <p>On CCSv3, there was a dialog for compiler/linker options where you could name these libraries as part of your project. Not sure where these would be with the new Eclipse based CCSv4. Perhaps the eclipse way of right clicking the project name, and looking for 'build properties' would reveal the dialog you need.</p>
<p>I downloaded a program from texas instruments, PMSM3-2, which is made for code composer studio 3. I only have code composer 4, when attempting to build it I get the errors:</p> <pre><code>'Building target: C:/tidcs/DMC/c28/v32x/sys/PMSM3_2_281x/cIQmath/build/pmsm3_2.out' 'Invoking: Linker' "C:/Program Files/Texas Instruments/ccsv4/tools/compiler/c2000/bin/cl2000" -@ccsLinker.opt -o "C:/tidcs/DMC/c28/v32x/sys/PMSM3_2_281x/cIQmath/build/pmsm3_2.out" undefined first referenced symbol in file --------- ---------------- _DLOG_4CH_init C:/tidcs/DMC/c28/v32x/sys/PMSM3_2_281x/cIQmath/obj/pmsm3_2.obj _DLOG_4CH_update C:/tidcs/DMC/c28/v32x/sys/PMSM3_2_281x/cIQmath/obj/pmsm3_2.obj _F281X_EV1_DRIVE_Init C:/tidcs/DMC/c28/v32x/sys/PMSM3_2_281x/cIQmath/obj/pmsm3_2.obj _F281X_EV1_DRIVE_Update C:/tidcs/DMC/c28/v32x/sys/PMSM3_2_281x/cIQmath/obj/pmsm3_2.obj _F281X_EV1_PWM_Init C:/tidcs/DMC/c28/v32x/sys/PMSM3_2_281x/cIQmath/obj/pmsm3_2.obj _F281X_EV1_PWM_Update C:/tidcs/DMC/c28/v32x/sys/PMSM3_2_281x/cIQmath/obj/pmsm3_2.obj _F281X_EV1_QEP_Calc C:/tidcs/DMC/c28/v32x/sys/PMSM3_2_281x/cIQmath/obj/pmsm3_2.obj _F281X_EV1_QEP_Init C:/tidcs/DMC/c28/v32x/sys/PMSM3_2_281x/cIQmath/obj/pmsm3_2.obj _F281X_EV1_QEP_Isr C:/tidcs/DMC/c28/v32x/sys/PMSM3_2_281x/cIQmath/obj/pmsm3_2.obj _F281X_EV2_PWMDAC_Init C:/tidcs/DMC/c28/v32x/sys/PMSM3_2_281x/cIQmath/obj/pmsm3_2.obj _F281X_EV2_PWMDAC_Update C:/tidcs/DMC/c28/v32x/sys/PMSM3_2_281x/cIQmath/obj/pmsm3_2.obj _F281X_ileg2_dcbus_drv_init C:/tidcs/DMC/c28/v32x/sys/PMSM3_2_281x/cIQmath/obj/pmsm3_2.obj _F281X_ileg2_dcbus_drv_read C:/tidcs/DMC/c28/v32x/sys/PMSM3_2_281x/cIQmath/obj/pmsm3_2.obj _clarke_calc C:/tidcs/DMC/c28/v32x/sys/PMSM3_2_281x/cIQmath/obj/pmsm3_2.obj _ipark_calc C:/tidcs/DMC/c28/v32x/sys/PMSM3_2_281x/cIQmath/obj/pmsm3_2.obj _park_calc C:/tidcs/DMC/c28/v32x/sys/PMSM3_2_281x/cIQmath/obj/pmsm3_2.obj _phase_voltage_calc C:/tidcs/DMC/c28/v32x/sys/PMSM3_2_281x/cIQmath/obj/pmsm3_2.obj _pid_reg3_calc C:/tidcs/DMC/c28/v32x/sys/PMSM3_2_281x/cIQmath/obj/pmsm3_2.obj _rampgen_calc C:/tidcs/DMC/c28/v32x/sys/PMSM3_2_281x/cIQmath/obj/pmsm3_2.obj _rmp_cntl_calc C:/tidcs/DMC/c28/v32x/sys/PMSM3_2_281x/cIQmath/obj/pmsm3_2.obj _speed_est_calc C:/tidcs/DMC/c28/v32x/sys/PMSM3_2_281x/cIQmath/obj/pmsm3_2.obj _speed_frq_calc C:/tidcs/DMC/c28/v32x/sys/PMSM3_2_281x/cIQmath/obj/pmsm3_2.obj _speed_prd_calc C:/tidcs/DMC/c28/v32x/sys/PMSM3_2_281x/cIQmath/obj/pmsm3_2.obj _svgendq_calc C:/tidcs/DMC/c28/v32x/sys/PMSM3_2_281x/cIQmath/obj/pmsm3_2.obj error: unresolved symbols remain error: errors encountered during linking; "C:/tidcs/DMC/c28/v32x/sys/PMSM3_2_281x/cIQmath/build/pmsm3_2.out" not built &gt;&gt; Compilation failure </code></pre> <p>Is there something I need to change to make it work with ccs4?</p>
Unresolved symbols building a code composer 3 project in code composer 4
2010-07-16T02:31:33.343
3539
|capacitor|power-supply|
<p>ESR is the variation of resistance at different loads (current) and forced charge (current/frequency curves). thus with two or three (better) charge/discharge cycles and the angle-delta from their variations in capacitor "resistance" you can easily obtain the relative internal resistance. thus determine a coefficient called ESR which is the Z resistance at a multiple of charge/discharge speed cycles...</p>
<p>I am building a power supply circuit, and the switching regulator (<a href="http://www.st.com/resource/en/datasheet/l4963.pdf" rel="noreferrer">L4963</a>) calls for a low-<a href="https://en.wikipedia.org/wiki/Equivalent_series_resistance" rel="noreferrer">ESR</a> output capacitor. The capacitor in question is C3 of the evaluation board circuit.</p> <p><a href="https://i.stack.imgur.com/rh43I.png" rel="noreferrer"><img src="https://i.stack.imgur.com/rh43I.png" alt="Figure 26 from the STMicro L4963 datasheet"></a></p> <p>What does "low" mean? How low?</p> <p>Also, how do I find or calculate the ESR for <a href="http://nichicon-us.com/english/products/pdf/e-vr.pdf" rel="noreferrer">a capacitor</a> whose datasheet does not have a parameter called ESR?</p>
How to find the ESR of a capacitor
2010-07-16T14:08:42.863
3543
|serial|
<p>If you're just looking for a connector, how about something like <a href="http://www.jameco.com/webapp/wcs/stores/servlet/Product_10001_10001_1952839_-1" rel="nofollow">this one</a> ?</p>
<p>All I can find are adapters and gender changers. Where can I find one with actual leads I can solder?</p>
Need to purchase a Serial port that can be soldered to a motherboard
2010-07-16T19:05:07.290
3548
|usb|serial|uart|rs232|imu|
<p>If you are using their software, make sure to change your FTDI's VID/PID to match theirs. Otherwise their software won't recognize your custom serial converter</p>
<p>I'm trying to interface an <a href="http://xsens.com" rel="nofollow">XSens IMU</a> with my computer, and I'm running into interesting difficulties. The IMU has an RS232 connector that just uses the pins VCC, GND, TX, RX, nothing else. The SDK comes with it has a custom RS232-USB adapter that uses the FT232R and MAX3160, but apart from that it doesn't seem to do anything special.</p> <p>The manufacturer claims that the IMU uses standard RS232 (and I have no reason to doubt them), so, in order to save space (their converter is quite bulky), I am trying to use a <a href="http://www.littlebirdelectronics.com/products/FTDI-Basic-Breakout-%252d-5V.html" rel="nofollow">Sparkfun FTDI Basic Breakout 5V</a>. </p> <p>If I set all the COM settings the same (baudrate, parity, stop, etc), and I connect to the device, I do get data back, but it just seems like gibberish. I issue commands, the TX LED on the FTDI blink, the RX one too, and I get data, but it's nothing like what I am expecting.</p> <p>Can anyone think of any "gotchas" I may be missing? Is there a FooBar that needs to be connected to the DingDing to Actuate?</p>
Anything special I need to know about RS232 & FT232R?
2010-07-17T00:43:13.840
3555
|power-supply|
<p>If you have some power resistors already, it should be safe to load the power supply with them, starting with a fairly high resistance and slowly decreasing the resistance (increasing current) until you see the output voltage starting to drop too far below its nominal output. The output is probably rated for +/- 5% or 10%, so when the output falls below 90% of nominal voltage it's overloaded. You can go in small steps and plot a graph if you care about the details.</p> <p>If you change the resistance in too large a step you might go too far above the rated output, which could cause damage but is more likely to blow a fuse, so be careful of that, especially if the fuse doesn't look replaceable or you can't tell which component is the fuse.</p>
<p>I have a small PSU board out of a defunct DVD player that I'd like to use as a supply for my breadboards. It has two rails, +12 and +5 with two GND lines, but there's no current indication. My guess is that it's in the 500mA-1A range, but I really have no clue.   What's the best way to test it and determine a safe limit?   Also, if it requires a load in order to operate, should I just wire in a big resistor across +12 to ground? </p>
Power supply amperage
2010-07-17T03:33:58.303
3569
|pic|c|assembly|
<p>If you want a PIC16F628A to do something like</p> <pre><code>char vals = {22, 10, 34, 16}; int main(void){ char id = 0; while(1){ PORTB = vals[id]; id++; id = id &amp; 3; }; } </code></pre> <p>one option is to compile your C code with a C compiler. (When compiling for such chips, the compiler will use the FSR and INDF registers exactly as John Burton explained). My understanding is that SDCC is the only open-source C compiler that supports the PIC16F628A and other "14-bit" PICmicro chips.</p> <ul> <li>Tyler Montbriand. <a href="http://burningsmell.org/pic16f628/" rel="nofollow">"Programming the PIC16f628a with SDCC"</a></li> <li>Micah Carrick. <a href="http://www.micahcarrick.com/pic-c-programming-linux.html" rel="nofollow">"Programming PIC's in Linux using C with SDCC"</a></li> <li>Wikibooks: <a href="http://en.wikibooks.org/wiki/Embedded_Systems/PIC_Programming" rel="nofollow">"PIC programming"</a></li> </ul>
<p>On my 16F628A's I want to iterate of a predefined sequence of values. How do I do this?</p> <p>In C, I would do something like this:</p> <p>char vals = {22, 10, 34, 16};</p> <p>char id = 0;</p> <p>port = vals[id]; id++</p> <p>It's the 'vals[id]' that I haven't figured out.</p>
How do I do indirect addressing in PIC ASM?
2010-07-17T17:10:20.813
3574
|robotics|tools|cases|waterproof|
<p>I have seen some really interesting designs made from plastic cutting boards -- yes, cutting boards. They're tough, easy to cut/drill/shape and it's also pretty inexpensive. There is also polycaprolactone (goes by various names, but I got mine from a vendor selling it as ShapeLock) -- it's cheap, tough and drillable/fileable. It melts in boiling water and becomes tough when it cools, and has a similar feel to nylon. I'd be sure to keep anything that can get hot away from it though, or your 'bot will melt. :-)</p> <p>(edit: I forgot to mention that you can make sheets of it pretty easily too: <a href="http://letsmakerobots.com/node/4070" rel="nofollow">http://letsmakerobots.com/node/4070</a>)</p> <p>If you want metal, you'll probably want some angle iron of various gauges and sizes, at least for prototyping. I don't know if Meccano is still around, but I made some neat stuff out of that (and Lego too, of course). Aluminum flashing, a pop rivet gun, hacksaw and files. Try to score a small metal brake too for making nice straight folds, and maybe a sheet metal course at the community college to learn how to weld and grind correctly and safely. Try to make friends with the local panel shops, as they usually have enough scrap to keep a hobbyiest in excellent stock, as well as access to some of the bigger tools that you may want to use on occasion.</p> <p>An assortment of bosses, nuts, bolts, washers, screws and taps is probably going to be high on the list as well, along with your normal assortment of tools for working with these things. A dremel is very handy, as are various pliers, tweezers and such.</p> <p>Once you build a few prototypes you will know what you're after and can get plastic sheeting or metal stock laser-cut at various places online or if you're fortunate, locally. That really is the ultimate. Maybe take some time to learn how to build up pieces in Blender or a cheap/free 3D CAD package so you can just send the design files off and get back exactly what you're after.</p> <p>I haven't got any advice on waterproofing. I imagine starting with an already waterproof container of some kind and creating sealed ports would be the quickest method. I'd take a look at electric boat hobbyiest websites and see how they manage.</p>
<p>What is good stuff to quickly build small hobby robots? What sorts of tools do I need to work with those materials?</p> <p>Let's assume we already have the electronics parts listed at <a href="https://electronics.stackexchange.com/questions/3501/what-is-a-general-set-of-components-for-a-robotics-hacker">"What is a general set of components for a robotics hacker?"</a>, and focus on all the other parts and tools.</p> <ul> <li>material for <a href="http://reprap.org/wiki/Frame_material" rel="nofollow noreferrer">rigid frame</a> (what type?)</li> <li>material for outer skin (waterproof?) (what type?)</li> <li>wheels (what type?)</li> <li>legs and feet (what type?)</li> <li>gears and belts (what type?)</li> <li>attachment methods: nuts and bolts, glue, zip ties, etc.</li> </ul> <p>I'm looking for stuff like "Acrylic is nice, I recommend X thickness, you need Y to cut it to shape and Z to attach the pieces together" and "cardboard is nice for quick prototypes; you can make it waterproof using W".</p>
What are good materials and associated tools for a robotics hacker?
2010-07-17T21:40:00.740
3577
|speech|
<p>Radio Shack sells a <a href="http://www.radioshack.com/product/index.jsp?productId=2102855" rel="nofollow">9v Recording Module</a> that stores up to 20 seconds of audio and plays it back at the touch of a button. Cat # 276-1323, $10.99. Currently out of stock on-line, but might be available in stores.</p>
<p>I have seen many a toys using just discrete components and IC's to produce songs (with words and everything!). I want to gift someone a piece of electronic art in which I want to use such a circuit. Does anyone know of these? I don't think those toys use uControllers to produce speech so there has to be some cheap alternative. What can it be? Please suggest.</p> <p><strong>Edit</strong></p> <p>For anyone who reads this question afterwards, I found all the answers very much doable and these are great options. The reason I had marked Leon Heller's answer as my accepted answer is just that it was very very easy to do. And can be implemented using the cute little Attiny uControllers.</p>
Generating speech using ICs
2010-07-18T06:50:58.960
3595
|pic|microchip|microcontroller|
<p>To answer the first question I got to. If you have a device on SPI and after reading from it you are writing to UART.</p> <p>You cannot "miss" a message while writing to UART because if you are master on SPI the other device must wait for you. If it is a device that samples quickly and constantly you just have to ensure that you sample it more often then it will replace it's values. If it is a device that holds data for you in a buffer you should be able to switch back and forth easily.</p> <p>I am quite used to doing this action, at work We have a device with two communication channels. One channel has 5 different devices it can control, 4 on SPI, one on UART. The other channel has two. One on SPI, one on UART. The code is a bit more complex, as the firmware controllers for each device must ask for access to resources and receive them before doing anything, but the system still works perfectly.</p> <p>I would suggest you take a quick shot at just switching. You should be able to implement it fast enough.</p> <p>The other option is to make a software UART. This can be quite doable. It is called <a href="http://en.wikipedia.org/wiki/Bit-banging" rel="nofollow">bit-banging</a> normally and is very common practice if it is just for debug and not needed for a final product.</p> <p>I would suggest bit banging to be lazy. People often overlook bit-banging.</p>
<p>I asked this question over at stack overflow but found this in a few of the comments on some of the microchip questions, <a href="https://stackoverflow.com/questions/3276297/communicating-with-the-pic-16f913">https://stackoverflow.com/questions/3276297/communicating-with-the-pic-16f913</a></p> <p>Here is my issue, it appears that all the communication lines for the PIC 16F913 reside on the same set of pins, this is convenient in that I don't have to sacrifice GPIO pins just to do comms, however the problem I'm having now is if I'm using the SPI on the chip, how can I send information to the RS232?</p> <p>The reason this issue came up, is that I just bought a CAN bus chip that communicates over SPI, and I would really like to see the data on RS232, so I can see messages. (I really don't know much about CAN yet, so who knows if this even makes sense yet).</p> <p>Here are the options I see, and maybe someone else has better ideas that I'm just simply missing.</p> <p>Somehow setup a time scheme that will switch between SPI and RS232 every time I get data, -- This doesn't seem hard and should work, but supposing I don't want to miss a message, what if a message is written while I'm writing to RS232, is it possible I'll miss it?</p> <p>2.. I can always use SPI, but then build my own comm bus over 8 of the GPIO lines, to another PIC 16F913, using only the GPIO lines and then since the RS232 lines are free on the second PIC I can simply read the data and spit it out.</p> <p>-- This one is doable but now we're wasting 2 chips, AND all the GPIO lines,</p> <p>There has to be a better way. Or is there?</p> <p>Any help is greatly appreciated.</p> <p>I would like to also clarify, obviously one solution is using a completely different chip (which may in fact be what I end up doing, if I can get the 18F programmed), however, I'm interested in worst case scenario, in which I am limited in resources and only have some 913's, is the way described above the only way to do it with this chip, or is there a better way?</p>
Communicating with the Pic 16F913
2010-07-19T02:41:24.760
3599
|mosfet|
<p>For an N-Channel MOSFET, current is switched from drain to source. But a P-Channel MOSFET works in the opposite way - in a P-channel MOSFET, current is switched from source to drain. See <a href="http://www.irf.com/technical-info/appnotes/an-940.pdf" rel="noreferrer">this appnote</a> from IRF. Also, the anode of the integral body diode in a power MOSFET is connected to the source of an N-Channel, but the drain of a P-Channel. See this <a href="http://www.globalspec.com/reference/10393/121073/chapter-9-2-12-mosfet-rain-to-source-ldquo-body-rdquo-diode" rel="noreferrer">excerpt</a>.</p> <p>Basically, when you have a positive voltage connected to a load, and you want to switch it on and off, use an N-Channel MOSFET between the negative terminal and ground. Allow current to flow by applying a positive voltage that will saturate the transistor (10-12 for power MOSFETs, 3-5V for logic level). Turn it off by pulling the gate down to the source. </p> <p>When you have a load with the negative terminal grounded (which is usually preferable; don't muck with ground if at all possible!), and want to apply or remove a positive voltage, use a P-channel MOSFET. Pull its gate up to the source (which is connected to V+) to turn it off, or pull it to ground (through an open collector output if your logic signal is less than V+) to turn it on (So that Vg is 0, and Vs is, say, 12V, therefore Vgs is -12V). </p> <p>Depletion mode mosfets are less common, and usually only available in N-Channel. For N-Channel depletion mode, the gate must be pulled below the source (which is often ground). Stick with enhancement mode for most switching applications unless you need something strange.</p> <p>This schematic shows both (enhancement-mode) configurations: <img src="https://i.stack.imgur.com/SYTRX.png" alt="example circuit"> </p> <p>To identify the source and drain, look at the side which the arrow is connected to. This is the source. If you've got a physical component, a diode test on a meter is useful both for finding the switched current direction (Apply positive voltage to the terminal which the diode test identifies as negative) and for a basic test (not a guarantee) that the transistor isn't burned up. To differentiate between N-Channel and P-Channel, look at the symbol: N-Channel pointing iN. </p>
<p>With an N type MOSFET you let the current flow from the drain through the source when a high enough voltage is applied to the gate. With a P type MOSFET which direction is the current meant to flow? From the source through the drain or the other way around? thanks</p>
Basic p type MOSFET question
2010-07-19T09:19:55.187
3605
|opto-isolator|arduino|
<p>Ok.....so I've realized that an opto-isolator is not the best approach for this particular application!</p> <p>And.....as Andrew Kohlsmith and reemrevnivek pointed out - I could pulse width modulate the base of a transistor instead.... </p> <p>So I got some silicon npn epitaxial transistors (BD139) from the electronics store and gave them a go. It actually worked better than i thought - the volume control is nice and fine :)</p> <p>Here's the circuit I used in the end - </p> <p><img src="https://i39.servimg.com/u/f39/14/39/80/39/pictur10.png" alt="Da Circuit"></p> <p>Thanks for everyones help and suggestions!</p>
<p>I'm doing an Arduino based project using the PWM hooked up to a 0.5W 8Ω speaker in order to make various sounds, I want to implement a digital volume control and I thought about using another PWM output and an Opto-Isolator....would this be possible?</p> <p>And....if it is possible - could anyone recommend a suitable candidate? </p> <p>Cheers Chiphackers - Let me know if this is too vague :) </p> <p>Update - I've got the speaker connected directly to the PWM output without amplification - I'm using a couple of tactile switches to turn the volume up and down </p> <p>Here's the circuit (In Theory) - <img src="https://i39.servimg.com/u/f39/14/39/80/39/optoi10.png" alt="alt text"></p> <p>Here's some code too, I've got the PWM set to high speed and I'm using it to ramp the volume of the tones up and down -</p> <pre><code>///////////////////////////////////////////////////////////////////////////////////// // Configure PWM on pins 3 and 11 to run at maximum speed, rather than the default // ///////////////////////////////////////////////////////////////////////////////////// pinMode(3,OUTPUT); // speaker on pin 3 cli(); // disable interrupts while registers are configured bitSet(TCCR2A, WGM20); bitSet(TCCR2A, WGM21); // set Timer2 to fast PWM mode (doubles PWM frequency) bitSet(TCCR2B, CS20); bitClear(TCCR2B, CS21); bitClear(TCCR2B, CS22); sei(); // enable interrupts now that registers have been set ////////// Function for playing tones - void playTone(long tone, int duration) { prevMicros = micros(); while (micros() - prevMicros &lt; duration) { analogWrite(3, VOLUME); delayMicroseconds(tone); analogWrite(3, 0); delayMicroseconds(tone); } } </code></pre>
Opto-Isolator For Volume Control?
2010-07-19T14:08:23.073
3623
|ltspice|simulation|
<p>If you want to step through values for resistor values (example R):</p> <ol> <li>Set the value of resistor that you want to be variable, to be <code>{R}</code> (don't forget the curly brackets!)</li> <li>Click on <code>.op</code> (far right on the toolbar)</li> <li>Type: <code>.step param R 1 10k 1k</code> (steps from 1 to 10K in 1k increments)</li> </ol> <p>If you want to sweep the value of R in time, then it's not possible as the simulators will have convergence problems!</p>
<p>I want to simulate the load regulation of a power-supply. I'm sure I remember being able to vary the value of a resistor over the course of a simulation in LTspice, but I can't remember how. Anyone? </p>
LTspice: Vary a resistor's value over time
2010-07-20T01:07:56.640
3653
|avr|xmega|random-number|
<p><a href="http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=5485568&amp;tag=1" rel="nofollow">There is a paper</a> on how to achieve this with AVR hardware. It involves relying on clock jitter. Basically, you use a timer interrupt based off of one clock source to sample the lower bits of a separate timer which is clocked off a separate independent clock source. The two clocks will have some random jitter associated with them and the sampling will not be perfectly periodic.</p> <p>I did a small proof of concept of this on an STM32 microcontroller, code is <a href="https://github.com/JL2010/stm32_entropy" rel="nofollow">on github here</a>. It got some good results based on a set of randomization test suites.</p> <p>In my opinion, I think this is better than sampling a floating pin with an ADC which is extremely easy to attack (tie the pin to ground and your number isn't so random anymore!). I'm sure there's a way to manipulate a clock jitter based RNG, but it makes me feel a little bit better that I can do this purely based off of on-chip internal clock sources.</p>
<p>I've read an appnote from TI (<a href="http://www.ti.com/lit/an/slaa338/slaa338.pdf" rel="nofollow">slaa338</a>) that describes a technique for generating "for real" (as opposed to "pseudo") random numbers. It exploits the somewhat exotic clock subsystem of the MSP430 to achieve this goal. Does anyone know of a technique that can be implemented on an AVR (I'm interested in the XMega's in particular) for generating "for real" random numbers?</p>
AVR Random Number Generator
2010-07-21T17:14:59.947
3657
|msp430|
<p>It seems there are not any major ICEs available for the MSP430. I thought I had seen one, but cannot find it and find other places where people state there are not ICEs.</p> <p>If this is incorrect, please post. Tomorrow I am going to accept my answer if there is not one. I will always go back and switch to an answer that has a real solution to what I need.</p>
<p>Does anyone have any directions on what ICEs exist for MSP430s.</p> <p>I currently use the MSP430F148. I have others in use, and plan to switch to some higher end in the future.</p> <p>I would be interested in ICE or any other solutions people know of. We have some real time systems where power consumption is more important than speed(excluding the deadlines we must hit).</p> <p>If anyone needs clarity on the question, just pop it in the note and I will try to revise this.</p>
MSP430 In Circuit Emulator(ICE)
2010-07-21T18:42:21.617
3675
|voltage|
<p>It's the actual VCC that matters.</p> <p>Logic gates (and microprocessors) have a diode to VCC and a diode to GND at every input and output pin. (Except for a few chips that have a few "high-voltage tolerant" open-collector pins, as pingswept mentioned).</p> <p>If you externally drive an input higher than the actual VCC at the time, current will flow through that diode.</p> <ul> <li><p>As long as you limit the current through that diode below the maximum current listed in the datasheet, slight over-voltage won't do any permanent damage. However, even when limited to very small amounts of current, this is enough to disrupt analog circuits on the chip -- the digitized value from an ADC reading one analog input pin can be totally wrong when it is upset from a voltage slightly above VCC on some other pin.</p></li> <li><p>seemingly small currents through that diode can locally over-heat the region on the chip around that pin, destroying functionality associated with that pin. A person can spend days trying to figure out why his software <em>seems</em> like it mostly works OK, except for stuff connected to that one pin. (Guess how I know this?)</p></li> <li><p>slightly larger currents through that diode can overheat and destroy the entire chip.</p></li> </ul>
<p>What happens to a logic gate (besides magic smoke discharge) seeing a voltage greater than Vcc? Is it just because the gate was not designed to handle a higher voltage than the recommended Vcc, or is it also usually important to limit the voltage to the actual Vcc even if the chip works within a range of voltages?</p>
Why is it important not to exceed Vcc at the input to a logic gate?
2010-07-23T18:47:40.147
3679
|mosfet|voltage-regulator|
<p>A MOSFET is a single transistor that will be able to provide a regulated voltage if used inside of a whole voltage regulator circuit (or IC). To build a (linear) voltage regulator, one needs a pass element (regulated "valve", e.g. MOSFET or biolar transistor), a voltage reference and a circuit that compares the desired, regulated output voltage to the reference voltage and adjusts the pass element such that the output will remain in regulation.</p> <p>Thus, a MOSFET may act as one part inside of a voltage regulator.</p>
<p>I'm new to electronics and was wondering what was the difference between a Mosfet and a voltage regulator?</p>
Difference between Mosfet and Voltage Regulator?
2010-07-24T02:53:27.607
3683
|pic|frequency|c|pwm|microchip|
<p>I'm not sure about the PWM in a dsPIC but on a PIC16F1508, the documentation says that when the TMR2 reaches a reload cycle, it reloads the TMR2 register and then loads the PWMxDC registers into the actual duty cycle registers in the PWM hardware. i.e. The writing of the PWM duty cycle is automatically synchronized to the TMR2 reload. So when you write the duty cycle, it doesn't have an effect until the next duty cycle. This means that your change in duty cycle could be delayed by as much as one TMR2 reload cycle, but that is the only change you should see. Look in your documentation.</p>
<p>I'm trying to change the PWM output frequency roughly once a millisecond using a dsPIC33FJ256GP710, and I'm having mixed results. I first tried this: </p> <pre><code> #include &lt;p33fxxxx.h&gt; _FOSCSEL(FNOSC_PRIPLL); _FOSC(FCKSM_CSDCMD &amp; OSCIOFNC_OFF &amp; POSCMD_XT); _FWDT(FWDTEN_OFF); static unsigned int PWM_TABLE[7][2] = { {132, 66}, {131, 66}, {130, 65}, {129, 65}, {128, 64}, {127, 64}, {126, 63} // Compare, 50% duty }; static int curFreq = 0; int main(void) { int i; PLLFBD = 0x009E; // Set processor clock to 32 MHz (16 MIPS) CLKDIV = 0x0048; LATCbits.LATC1 = 0; // Make RC1 an output for a debug pin TRISCbits.TRISC1 = 0; LATDbits.LATD6 = 0; // Make RD6/OC7 an output (the PWM pin) TRISDbits.TRISD6 = 0; T2CONbits.TON = 0; // Disable Timer 2 OC7CONbits.OCM = 0b000; // Turn PWM mode off PR2 = PWM_TABLE[curFreq][0]; // Set PWM period OC7RS = PWM_TABLE[curFreq][1]; // Set PWM duty cycle OC7CONbits.OCM = 0b110; // Turn PWM mode on T2CONbits.TON = 1; // Enable Timer 2 while (1) { for (i = 0; i &lt; 3200; i++) {} // Delay roughly 1 ms curFreq = (curFreq + 1) % 7; // Bump to next frequency PR2 = PWM_TABLE[curFreq][0]; // Set PWM period OC7RS = PWM_TABLE[curFreq][1]; // Set PWM duty cycle LATCbits.LATC1 = !LATCbits.LATC1; // Toggle debug pin so we know what's happening } } </code></pre> <p>The result is that PWM drops out for about 4 ms at what looks to be a repeatable interval, roughly aligned with my debug pin toggle (in other words, when the code is messing with the period and duty cycle registers). I'll attach a photo of my scope trace. Channel 1 is PWM and channel 2 is the debug pin that's toggled when the code attempts to adjust the frequency.</p> <p>Anyway, I started thinking about timer rollovers, and I did some searching on a few forums. I came up with a few ideas based on a few posts I read. The best idea seemed to be to enable the Timer 2 interrupt, turn PWM mode off inside it, and only change the period and duty cycle registers inside the Timer 2 interrupt. So, I wrote this:</p> <pre><code> #include &lt;p33fxxxx.h&gt; _FOSCSEL(FNOSC_PRIPLL); _FOSC(FCKSM_CSDCMD &amp; OSCIOFNC_OFF &amp; POSCMD_XT); _FWDT(FWDTEN_OFF); static int curFreq = 0; static unsigned int PWM_TABLE[7][2] = { {132, 66}, {131, 66}, {130, 65}, {129, 65}, {128, 64}, {127, 64}, {126, 63} // Compare, duty }; int main(void) { int i, ipl; PLLFBD = 0x009E; // Set processor clock to 32 MHz (16 MIPS) CLKDIV = 0x0048; LATCbits.LATC1 = 0; // Make RC1 an output for a debug pin TRISCbits.TRISC1 = 0; LATDbits.LATD6 = 0; // Make RD6/OC7 an output (the PWM pin) TRISDbits.TRISD6 = 0; OC7CONbits.OCM = 0b000; // Turn PWM mode off OC7RS = PWM_TABLE[curFreq][1]; // Set PWM duty cycle PR2 = PWM_TABLE[curFreq][0]; // Set PWM period OC7CONbits.OCM = 0b110; // Turn PWM mode on T2CONbits.TON = 0; // Disable Timer 2 TMR2 = 0; // Clear Timer 2 register IPC1bits.T2IP = 1; // Set the Timer 2 interrupt priority level IFS0bits.T2IF = 0; // Clear the Timer 2 interrupt flag IEC0bits.T2IE = 1; // Enable the Timer 2 interrupt T2CONbits.TON = 1; // Enable Timer 2 while (1) { for (i = 0; i &lt; 1600; i++) {} // Delay roughly 1 ms SET_AND_SAVE_CPU_IPL(ipl, 2); // Lock out the Timer 2 interrupt curFreq = (curFreq + 1) % 7; // Bump to next frequency RESTORE_CPU_IPL(ipl); // Allow the Timer 2 interrupt LATCbits.LATC1 = !LATCbits.LATC1; // Toggle debug pin so we know what's happening } } void __attribute__((__interrupt__)) _T2Interrupt(void) { T2CONbits.TON = 0; // Disable Timer 2 TMR2 = 0; // Clear Timer 2 register OC7CONbits.OCM = 0b000; // Turn PWM mode off OC7RS = PWM_TABLE[curFreq][1]; // Set the new PWM duty cycle PR2 = PWM_TABLE[curFreq][0]; // Set the new PWM period OC7CONbits.OCM = 0b110; // Turn PWM mode on IFS0bits.T2IF = 0; // Clear the Timer 2 interrupt flag T2CONbits.TON = 1; // Enable Timer 2 } </code></pre> <p>This looks to be more stable as far as I can tell on my ancient scope, but now the waveform is no longer regularly-shaped (the duty cycle seems to be inexplicably inconsistent) and if I try hard enough I can convince myself that I still see a millisecond of PWM dropout when my scope is set to a 5 or 10 millsecond timebase. </p> <p>It's certainly better than it was, and I can continue to mess with it in the hopes of fixing the irregular waveform produced by the second bit of code, but my question is: </p> <p>Is there a "right" way to do this? Or at least a better way than the path I'm on? </p> <p>Any help would be thoroughly, thoroughly appreciated. </p> <p><a href="http://www.freeimagehosting.net/uploads/c132216a28.jpg" rel="noreferrer">Scope trace http://www.freeimagehosting.net/uploads/c132216a28.jpg</a></p>
How do I modulate PWM frequency in realtime with a Microchip dsPIC?
2010-07-24T15:20:45.247
3690
|boundary-scan|jtag|
<p>Another option would be NEBULA. We're using it not just for pins but for fpga user defined registers. It's free. Uses Xilinx and Intel/Altera USB cables. Uses 1149.1-2013 JTAG Tcl scripting language <a href="https://www.intellitech.com/ijtag" rel="nofollow noreferrer" title="iJTAG 1149.1-2013">Intellitech NEBULA for iJTAG 1149.1-2013</a></p>
<p>What inexpensive or free tools could you recommend to view and control pin states via JTAG boundary-scan?</p> <p>I'm aware of full-featured boundary-scan products that cost tens of thousands of dollars and used in manufacturing houses mainly. I want a simple inexpensive tool to occasionally check few suspected pins if they are soldered correctly; to light LEDs on a board without writing any firmware for MCU/CPLD/FPGA; to see if pressing a button on a board changes the appropriate pin state, etc.</p>
JTAG boundary-scan test software to view and control pin states
2010-07-25T20:06:49.573
3693
|power-supply|safety|adapter|ac-dc|ul|
<p>Any or all of UL CSA CE TUV ... certification is worthwhile IF GENUINE.<br> I have seen much Asian manufactured equipment which has had various certification marks attached with no prospect of there having been any related testing.</p> <p>"Provenance matters" - ie you can <em>usually</em> be confident of certification marks when purchasing certified equipment via a competent &amp; reputable large volume supplier with a good reputation and whose business is founded on professional customer service. Digikey qualifies for that. Sparkfun are trying hard and are good at what they do but I would not class them as qualifying. I'd still happily buy product from eg sparkfun, but I'd be discerning about things where safety mattered.<br> [I have no business interests in either supplier - I buy from Digikey occasionally. I don't think I've purchased from Sparkfun but would happily do so. I think enough of Digikey that if they sell a brand I'd consider it was probably an acceptable one to use, subject to specifications meeting need.]</p> <p>Note that brands of popular products will often be faked in the general market and that buying through a reputable supplier is usually but not always protection against this.</p> <p>If you are buying in any volume then pulling one apart to determine quality of construction is probably worthwhile. </p> <ul> <li><p>A genuinely certified product should pass the "looks OK" test with ease. </p></li> <li><p>Anything at all suspect almost certainly indicates a fake certification. </p></li> <li><p>Mains voltage clearances should be acceptable, mechanical construction and component mounting reasonable. </p></li> <li><p>Component ratings should be appropriate. Any electrolytics would ideally be 105C (not essential). </p></li> <li><p>Generally (but not always) a product with fake certification reeks of fakeness internally - but externally MAY look as real as any. </p></li> </ul> <p>A modern regulated power supply should meet voltage spec at rated maximum current without excessive heating. Simply loading one up with a (suitably rated) resistor to max load and letting it "set a while" is a good first check. Given any two or Power P, Volts V, Current I, then Resistance R for maximum load = </p> <ul> <li><p>V^2/P </p></li> <li><p>P/I^2 </p></li> <li><p>V/I </p></li> </ul> <hr> <p>Suppliers on these sites are more likely than average to offer reputable product:</p> <p><a href="http://www.findchips.com/" rel="nofollow">http://www.findchips.com/</a><br> <a href="http://www.eciaauthorized.com/" rel="nofollow">http://www.eciaauthorized.com/</a> </p> <p>Ones I've not yet tried but which seem OK at a glance. </p> <p><a href="https://octopart.com/" rel="nofollow">https://octopart.com/</a><br> <a href="http://www.oemsecrets.com/" rel="nofollow">http://www.oemsecrets.com/</a><br> <a href="http://www.digipart.com/" rel="nofollow">http://www.digipart.com/</a> </p> <hr> <p>REALLY fun places.<br> YM<strong>W</strong>V !!!! [You mileage <strong>WILL</strong> vary]:</p> <p><a href="http://www.ebay.com/" rel="nofollow">http://www.ebay.com/</a><br> www.alibaba.com<br> <a href="http://www.indiamart.com/" rel="nofollow">http://www.indiamart.com/</a> </p>
<p>I picked up a 9V switching DC adapter from SparkFun a while back, but I've been hesitant to use it because it doesn't have any of the usual "safety" approvals that you normally see on power adapters (UL listed, CSA approved, etc.)</p> <p>Is this just unfounded paranoia? Are there safety issues to think about when using a DC power adapter for a project that will run 24/7?</p>
Is it safe to use a DC power adapter that isn't UL Listed or CSA certified?
2010-07-25T22:52:16.427
3701
|power-supply|timer|microcontroller|delay|
<p>You could use a switchable regulator to supply power to the IC, and use an RC circuit to slowly pull the Enable pin into the On position when the button is pressed. After the regulator turns on, a transistor connected to the output holds the enable pin permanently in the on position?</p>
<p>I would like to make a circuit that turns on a power supply to a microcontroller after holding down a button for a period of time (say 2 seconds). To make matters slightly more complicated, if possible, I would like to use this button as an input also. The power off could come from another switch if need be.</p> <p>I was thinking of something like a latching RC circuit to an zener that switches a MOSFET on to allow power through. Ideally the solution would not consume power until the switch is pressed.</p> <p>Thanks for any help</p>
Delayed power supply startup
2010-07-26T09:30:59.173
3703
|linux|avr|debugwire|in-circuit|debugging|
<h2>enable debugwire</h2> <p>enable with avrdude (fuse for attiny88):</p> <pre><code>avrdude -c dragon_isp -P usb -p attiny88 -v -U hfuse:w:0xd9:m </code></pre> <h2>compilation</h2> <ul> <li>must be compiled with -ggdb or great (--gdb3) but doesn't seem to help with macros</li> <li><p>no optimisations</p> <p>COMPILE = $(GCC_PATH) -ggdb3 -Wall -Wextra $(OPTIMIZATION) -std=gnu11 -flto -mmcu=$(DEVICE) -DF_CPU=$(CLOCK)</p></li> </ul> <p>need main.hex and main.elf</p> <h2>debugging</h2> <p>start avarice:</p> <pre><code>avarice -g -w -P attiny88 :4242 </code></pre> <p>then start gdb:</p> <pre><code>avr-gdb main.elf </code></pre> <p>and connect:</p> <pre><code>target remote localhost:4242 </code></pre> <h2>breakpoints</h2> <p>only sw breakpoints with debugwire, so if need breakpoints use:</p> <pre><code>asm('break'); </code></pre> <h2>switch back to spi/icsp mode</h2> <p>NB. VTG/VCC pin (2 on header) must be connected to chip supply for this to work!</p> <pre><code>avrdude -c dragon_isp -P usb -p attiny88 -v -U hfuse:w:0xdd:m </code></pre>
<p>So, I have hooked up a ATtiny88, and am programming it with the Dragon AVR using ISP. I have also set up the build toolchain, using avrdude, and the gnu avr tools. Everything is working great.</p> <p>Now I would like to do in-circuit debugging using the advertised debugwire which is also connected to the ISP and which the dragon supports. But which tools do I use? I see there is a avr-gdb, but it seems that I needs some kind of simulator, however I would like to debug in-circuit on the real MCU. Is this possible?</p> <p>Thanks in advance.</p>
AVR debugwire in Linux
2010-07-26T10:57:17.863
3721
|atmega|avrdude|debugging|embedded|
<p>You are doing:</p> <pre><code>% avrdude -pm48 -cavrisp2 -Pusb -V -U flash:w:main.hex </code></pre> <p>You should be doing:</p> <pre><code>% avrdude -pm48pa -cavrisp2 -Pusb -V -U flash:w:main.hex </code></pre> <p>And in your edit 1 you are using the correct -p flag and it also seems to work. :)</p>
<p>Can i programm the atmega48pa with avrdude? I have problems with the signature ...</p> <pre><code>% avrdude -pm48 -cavrisp2 -Pusb -V -U flash:w:main.hex avrdude: AVR device initialized and ready to accept instructions Reading | ################################################## | 100% 0.01s avrdude: Device signature = 0x1e920a avrdude: Expected signature for ATMEGA48 is 1E 92 05 Double check chip, or use -F to override this check. avrdude done. Thank you. </code></pre> <p>I have add some new lines to the avrdude.conf in /etc -directory</p> <pre><code>[...] part id = "m48pa"; desc = "ATMEGA48PA"; has_debugwire = yes; flash_instr = 0xB6, 0x01, 0x11; eeprom_instr = 0xBD, 0xF2, 0xBD, 0xE1, 0xBB, 0xCF, 0xB4, 0x00, 0xBE, 0x01, 0xB6, 0x01, 0xBC, 0x00, 0xBB, 0xBF, 0x99, 0xF9, 0xBB, 0xAF; stk500_devcode = 0x59; signature = 0x1e 0x92 0x0a; [...] </code></pre> <p>but now i get a another error</p> <pre><code>avrdude: safemode: Verify error - unable to read lfuse properly. Programmer may not be reliable. </code></pre> <hr> <h3>Edit - 1</h3> <p>Here some debugging information with "-vvv":</p> <pre><code>% avrdude -pm48pa -cavrisp2 -Pusb -F -vvv -U flash:w:main.hex avrdude: Version 5.10, compiled on Apr 3 2010 at 18:48:10 Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/ Copyright (c) 2007-2009 Joerg Wunsch System wide configuration file is "/etc/avrdude.conf" User configuration file is "/home/silvio/.avrduderc" User configuration file does not exist or is not a regular file, skipping Using Port : usb Using Programmer : avrisp2 avrdude: usbdev_open(): Found AVRISP mkII, serno: 000200030996 avrdude: usbdev_open(): using read endpoint 0x82 avrdude: stk500v2_getsync(): found AVRISP mkII programmer AVR Part : ATMEGA48PA Chip Erase delay : 45000 us PAGEL : PD7 BS2 : PC2 RESET disposition : dedicated RETRY pulse : SCK serial program mode : yes parallel program mode : yes Timeout : 200 StabDelay : 100 CmdexeDelay : 25 SyncLoops : 32 ByteDelay : 0 PollIndex : 3 PollValue : 0x53 Memory Detail : Block Poll Page Polled Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- --------- eeprom 65 5 4 0 no 256 4 0 3600 3600 0xff 0xff Block Poll Page Polled Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- --------- flash 65 6 64 0 yes 4096 64 64 4500 4500 0x00 0x00 Block Poll Page Polled Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- --------- lfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00 Block Poll Page Polled Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- --------- hfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00 Block Poll Page Polled Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- --------- efuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00 Block Poll Page Polled Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- --------- lock 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00 Block Poll Page Polled Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- --------- calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00 Block Poll Page Polled Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- --------- signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00 Programmer Type : STK500V2 Description : Atmel AVR ISP mkII Programmer Model: AVRISP mkII Hardware Version: 1 Firmware Version Master : 1.10 Vtarget : 5.0 V SCK period : 100.37 us avrdude: AVR device initialized and ready to accept instructions Reading | ################################################## | 100% 0.02s avrdude: Device signature = 0x1e920a avrdude: safemode read 1, lfuse value: 62 avrdude: safemode read 2, lfuse value: 62 avrdude: safemode read 3, lfuse value: 62 avrdude: safemode: lfuse reads as 62 avrdude: safemode read 1, hfuse value: df avrdude: safemode read 2, hfuse value: df avrdude: safemode read 3, hfuse value: df avrdude: safemode: hfuse reads as DF avrdude: safemode read 1, efuse value: 1 avrdude: safemode read 2, efuse value: 1 avrdude: safemode read 3, efuse value: 1 avrdude: safemode: efuse reads as 1 avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed To disable this feature, specify the -D option. avrdude: erasing chip avrdude: reading input file "main.hex" avrdude: input file main.hex auto detected as Intel Hex avrdude: writing flash (2336 bytes): Writing | ################################################## | 100% 8.54s avrdude: 2336 bytes of flash written avrdude: verifying flash memory against main.hex: avrdude: load data flash data from input file main.hex: avrdude: input file main.hex auto detected as Intel Hex avrdude: input file main.hex contains 2336 bytes avrdude: reading on-chip flash data: Reading | ################################################## | 100% 8.26s avrdude: verifying ... avrdude: 2336 bytes of flash verified avrdude: safemode read 1, lfuse value: 62 avrdude: safemode read 2, lfuse value: 62 avrdude: safemode read 3, lfuse value: 62 avrdude: safemode: lfuse reads as 62 avrdude: safemode read 1, hfuse value: df avrdude: safemode read 2, hfuse value: df avrdude: safemode read 3, hfuse value: df avrdude: safemode: hfuse reads as DF avrdude: safemode read 1, efuse value: 1 avrdude: safemode read 2, efuse value: 1 avrdude: safemode read 3, efuse value: 1 avrdude: safemode: efuse reads as 1 avrdude: safemode: Fuses OK avrdude done. Thank you. </code></pre> <h3>Question</h3> <p>Can someone help me to flash a atmega48pa aith a avrispmkii</p>
avrdude and atmega48pa
2010-07-26T19:01:25.147
3734
|led|capacitor|blink|
<p>Diacs, tunnel diodes and gas filled discharge tubes, like a neon, work since they have at least one negative resistance region. In general, a reactance in parallel with a negative resistance will oscillate. Relaxation oscillators, produced by four-layer semiconductor devices, UJT, SCR, SCS, provide negative resistance for exploitation, which leads to the on and off switching points being different. The techs call it hysteresis, neons exhibit voltage hysteresis, tunnel diodes current hysteresis, diacs both, etc. Triacs have an unequal trigger point gate-to-M1 and gate-to-M2, which causes their asymmetric switching with excess harmonic generation. Using a diac in series with the gate almost fully fixes this, but only because it adds series negative resistance to overrule the asymmetric positive resistances G-M1 vs G-M2 before the point of no-return, with negative resistances adding giving double regenerative effect, which speeds the triac on. If a very careful design is done, then you can oscillate a triac using aDC supply and RC network...</p> <p>Hysteresis is also at the heart of a Schmitt trigger, which many interesting digital circuits exploit. The CMOS 4093 is a favourite chip for building various natty circuits...</p> <p>Of course, you could always use an LED with a flashing chip built in, like RS 585-387, 5 mm red at 80 cents each... </p>
<p>Is it possible to blink an LED using just a capacitor? (and maybe a resistor).</p> <p>For example, if I want to LED to blink once every 2 seconds. Is that possible?</p> <p>I know it can be done with a 555 as well as with a capacitor and transistor.</p>
Blink an LED with just a capacitor?
2010-07-27T06:52:09.723
3741
|arduino|.net-micro-framework|
<p>You could look at <a href="http://www.hpinfotech.ro/html/cvavr.htm" rel="nofollow">http://www.hpinfotech.ro/html/cvavr.htm</a> which is a nice easy to use IDE for the Atmel and write some C I have used this professionally and its very good, more like the level of convenience you get from IDE's like Visual Studio. I have Eclipse to be a bit clunky for Android development not as slick as a bought one.</p> <p>I have Netduino which I have implemented a Tricopter control system for fun, which is very much real-time and it works reliably, written in C# with Visual Studio 2010. The debugging on the device is generally excellent, I have it auto syncing data via wifi and I have a tiny HTTP server on the aircraft. </p>
<p>I've been messing around with Arduino for a while now, and I'm in the process of moving from beginner to intermediate. I'd like some opinions on the <a href="http://en.wikipedia.org/wiki/.NET_Micro_Framework" rel="nofollow">.NET Micro Framework</a>, in terms of performance and hardware availability.</p> <p>I'm a .NET programmer, but I've found <a href="http://en.wikipedia.org/wiki/Processing_%28programming_language%29" rel="nofollow">Processing</a> for Arduino to be pretty much zero friction... It's so close to C# that anything I want to do doesn't even require a trip to the documentation.</p> <p>Anyhow, which is better?</p>
Arduino / Processing versus .NET Micro Framework? Best language? Best hardware?
2010-07-27T15:18:16.540
3769
|gyro|
<p>Neither the part number nor the logos are familiar to me, and I'm assuming that you've already done the usual Google searches, tried to narrow it down by package size/pin count/axis count on distributor sites, and looked for the repair manual and replacement parts lists. If no one here recognizes it, the next (and possibly last) step is to try to contact the remnants of the manufacturer. </p> <p>What kind of info are you looking for? If it's analog (Plugged into ADC pins or buffers), you should be able to reconstruct what you need just by soldering on some test leads, powering it up, and waving it around. If it's over a digital interface, I wish you all the best of luck in deciphering the init sequence, command set, and data format. </p> <p>That said, unless you're trying to upgrade your hover toy, <strong>I think your needs will be better served by purchasing a new one with a known manufacturer, datasheet, and distributors.</strong> It's perfectly reasonable to pull off sturdy, easily identifiable parts (switches/buttons, potentiometers, LEDs, and connectors are generally the first things I reach for) but I would generally just leave unknown ICs, ESD/age sensitive, or highly variable parts where they sit.</p>
<p>Can anyone identify this gyro?</p> <p>It's from the guts of a (deceased) hovering toy and I'd like to find a datasheet.</p> <p><a href="http://www.hodgepig.org/gyro.png" rel="nofollow noreferrer">alt text http://www.hodgepig.org/gyro.png</a></p>
Can anyone identify this gyro?
2010-07-28T23:39:00.937
3776
|avr|avrdude|
<p>Summary of what I have found:</p> <p>The Raven boards as well as the Raven stick both contain 10-pin, 50-mil JTAG interfaces. The pins must be soldered on by the user but are also included in the evaluation kit. A 50-mil to 100-mil adapter allows connecting the JTAG interfaces to programmers.</p> <p>The Raven boards but not the Raven stick include 6-pin, 50-mil ISP interfaces. The pins for these must be soldered on as well but no 6-pin units are shipped with the evaluation set. However, as they are only header pins, the 10-pin units that ship with the evaluation set can be broken off to create 6-pin units. (See <a href="http://www.outsidetrains.com/raven/" rel="nofollow">link</a>, search for “ISP connectors”).</p> <p>The ISP interfaces on the Raven boards are faulty; VCC and GND are not connected for the 1284p MCU. Atmel has suggested a workaround by jumping those pins to the VCC and GND pins for the 3290p ISP header. (See <a href="http://code.rancidbacon.com/LearningAboutAtmelRZRAVEN" rel="nofollow">link</a>, search for “7 July 2008”).</p> <p>The Raven stick does not contain an ISP interface at all, however, clever hacking and soldering can change that. See <a href="http://www.outsidetrains.com/raven/" rel="nofollow">here</a> (search for “USB stick”) and <a href="http://ossmann.blogspot.com/2010/01/killerbee-on-budget.html" rel="nofollow">here</a> for more information.</p> <p>To summarize: it is possible to use a cheap ISP programmer with the Raven boards however it will require some extra soldering on the Raven boards in addition to adding the pins and it will also require quite a hack to the Raven stick. Nevertheless it is possible and has been done before.</p> <p>Which leaves with the recommended JTAG interface to program the Raven boards and stick. JTAG programmers can be expensive. The Atmel JTAGICE mkII programmer and debugger goes for around $300. Clones are cheaper, for example the Olimex AVRISP-500, and while the clones don’t allow debugging more importantly they do not support all AVR chips. The AVR Dragon goes for around $60 and supports JTAG albeit with its debugging capabilities artificially limited to the first 32kb of an application so as not to cannibalize sales of the higher end JTAG device. Nevertheless, I find the Dragon to be the best choice.</p>
<p>This <a href="https://stackoverflow.com/questions/2242817/how-do-i-program-an-avr-raven-with-linux-or-a-mac/2809748#2809748">post</a> answers the question of if it possible to program an Atmel AVR Raven board with avrdude or not. Yes, it is possible.</p> <p>My question is which programmers will work with the Atmel Raven + avrdude? I'm trying to avoid buying the $300+ AVR JTAGICE mkII. There are clones available for $50 (for example the <a href="http://www.olimex.com/dev/avr-isp500.html" rel="nofollow noreferrer">AVR-ISP500</a> from Olimex).</p> <p>Can anyone confirm having used a clone programmer with avrdude to program the Atmel Raven boards? Which programmer(s)?</p>
Which programmers work with the Atmel Raven boards?
2010-07-29T13:22:51.000
3780
|pcb|manufacturing|legal|
<p>There is a distinction between evaluation boards and reference designs. Manufacturers even provide Gerber files for the latter, so that they can be copied exactly.</p>
<p>On the one hand, PCB layouts are considered copyrighted information, and copying them verbatim is a bad idea for legal reasons.</p> <p>On the other hand, the PCB layout of an evaluation board is pretty much a reference design for how to Do It Right. </p> <p>Are there any issues with copying the eval board as closely as possible? I would assume that it's <em>meant</em> to be copied, as their primary goal is for you to keep buying their chips and not have problems with them, but I've never seen this specified anywhere and the datasheets and eval board manuals still have the standard "All Rights Reserved", etc.</p> <blockquote> <p>Reproduction of information in TI data books or data sheets is permissible only if reproduction is without alteration and is accompanied by all associated warranties, conditions, limitations, and notices. Reproduction of this information with alteration is an unfair and deceptive business practice. TI is not responsible or liable for such altered documentation.</p> </blockquote>
Copying evaluation board PCB layouts
2010-07-29T21:26:29.597
3784
|heatsink|
<p>I know this is an old thread, but I discovered it researching this subject and wanted to correct/add a couple of things. The formula to find the required thermal resistance of the heat sink given by jluciani is basically correct but is missing a term for the ambient temperature (Ta). The equation should be:</p> <p>Tj = (Rjc + Rcs + Rsa) * Pd +Ta</p> <p>Where Tj is the maximum target temperature of the junction. I will use 125 degC as the maximum temperature of the junction to allow a safety margin in the event the ambient temperature goes over the standard 25 degC. This gives:</p> <p>125 = (1.92 + 0.5 + Rsa) * 36 +25</p> <p>Rsa = (125-25)/36 - 1.92 - 0.5 = 0.3577 degC/W</p> <p>The next part to find the size of the aluminium plate required to achieve this low a thermal resistance is much more complicated, but this blog <a href="https://engineerdog.com/2014/09/09/free-resource-heat-sink-design-made-easy-with-one-equation/" rel="nofollow noreferrer">https://engineerdog.com/2014/09/09/free-resource-heat-sink-design-made-easy-with-one-equation/</a> gives a very simple rule of thumb aproximation given by:</p> <p>Area = (50/Rsa)^2 cm2</p> <p>Unfortunately this formula applies to passive heat sinks with fins and I believe the author made a typo and meant area = 50×(1/Rsa)^2. The fins make a big difference. After looking at the results of of this online calculator <a href="https://www.heatsinkcalculator.com/free-resources/flat-plate-heat-sink-calculator.html" rel="nofollow noreferrer">https://www.heatsinkcalculator.com/free-resources/flat-plate-heat-sink-calculator.html</a> and the data sheets from a range of passive heat manufacturers I did a bit of curve fitting and came up with this more comprehensive ball park formula:</p> <p>Area = (20*1/(1+flow)*1/(0.25+h)*1/Rsa)^2 cm2</p> <p>Where flow is any flow from a cooling fan in cfm and h is the height of any fins.</p> <p>For the situation in the OP there is no forced cooling so flow= 0 and there are no fins, so h = 0 and the formula simplifies to:</p> <p>Area = (80/Rsa)^2</p> <p>Given that we require a thermal resistance &lt;= 0.3577 the size of plate required to cool the transistor in the OP is:</p> <p>Area = (80/0.3577)^2</p> <pre><code> = (223.6 cm)^2 </code></pre> <p>This is probably too large to be practical.</p> <p>As Kevin Vermeer pointed out, this particular transistor in this service is not really suitable for passive cooling. However, a dramatic decrease in the heat sink size can be obtained by adding fins and a fairly modest cooling fan as shown by the chart at the bottom of this link <a href="https://www.designworldonline.com/how-to-select-a-suitable-heat-sink/#_" rel="nofollow noreferrer">https://www.designworldonline.com/how-to-select-a-suitable-heat-sink/#_</a></p> <p>Staying with a flat plate and adding a fairly good PC cooling fan of 100cfm air flow, the plate size could be reduced to:</p> <p>Area =(80/(0.3577*(1+100/8)))^2</p> <pre><code> =(16.56 cm)^2 </code></pre> <p>Extruded aluminium can be bought in long strips with fins and using such a finned plate with 3cm fins and no cooling fan would require a heatsink size of:</p> <p>Area = (20*1/(0.25+3)*1/0.3577)^2 </p> <pre><code> =(17.2 cm)^2 </code></pre> <p>Finally, combining forced cooling of 100cfm and 3cm fins gives:</p> <p>Area = (17.2/(1+100/8))^2</p> <pre><code> =(1.27 cm)^2 </code></pre> <p>Notes:</p> <p>Pressure drops and proximity of other hot components in the cabinet can reduce the efficiency.</p> <p>Dust ingress can insulate heat sinks and cause cooling fans to slow down and fail over time.</p> <p>Heat sinks that are much much larger than the contact area of the component they are cooling loose efficiency due to the distance the heat had to travel to spread to the extremities of the heat sink </p> <p>Follow the usual guidelines on ensuring good contact with component to be cooled using a thin layer of a suitable heat transfer compound between the contact surfaces.</p> <p>Results from this formula for extremely small or large heat sinks should be treated with suspicion. For example in the last result the cooling fan radius is much larger than the heat sink and so most of the airflow would not be flowing in close proximity to the fins and so the result is suspect. Otherwise, it is a pretty good approximation.</p> <p>Probable best to add 25 degrees to whatever you think the ambient air temperature is and deduct a 25 degrees margin of safety from the maximum target temperature of the component when carrying out the calculations, just to be on the safe side. </p> <p>Dont use this formula to design the cooling for a nuclear power station.</p>
<p>It's common for a lot of power circuits to bolt to a piece of aluminum flat stock. How large does the stock need to be?</p> <p>Say that I'm mounting a tip122. The worst case condition is for it to have a 24V drop at 3A and a 50% duty cycle. So it is dissipating 36W. </p> <p>Looking at the datasheet, at 35W, the max case temp is ~80C. Assume a 25deg ambient temperature.</p> <p>Temp drop = 35W * Tr = 55 delta or 1.57C/W for the plate.</p> <p>So how much surface area do I need to achieve that?</p> <p>Did I approach it correctly?</p>
How do I calculate the thermal resistance of aluminum flat stock
2010-07-30T05:04:42.390
3787
|datasheet|arm|
<p>The latest user manual for the LPC213x family can be downloaded <a href="http://ics.nxp.com/support/documents/microcontrollers/pdf/user.manual.lpc2131.lpc2132.lpc2134.lpc2136.lpc2138.pdf">here in PDF format</a>. </p> <p><strong>Note: This is rev 02 -- the URL posted by pingswept above (no fault of his own) is the earlier rev 01 version.</strong></p> <p><strong>Disclaimer:</strong> I consulted for NXP and the engineers inside the company are incredibly frustrated with the website organization at NXP.</p>
<p>I have searched high and low on Google for the user manual about the LPC2132 ARM chip. So far, all I have come up with is the ARM7TDMI manual and a short (41 pages) overview of the LPC2132 chip.</p> <p>However, I'm looking for a more detailed description of the various parts of the micro controller, such as register addresses and peripheral information. I have found several promising links, but the PDF documents appear to be broken</p> <p>Can anyone point me to the full length LPC2132 data sheet?</p>
Where can I find the in-depth LPC2132 datasheet?
2010-07-30T14:11:10.230
3796
|accelerometer|msp430|
<p>Check the accelerometer <a href="http://www.vti.fi/en/products/accelerometers/consumer_electronics/cma3000_series/" rel="nofollow">family datasheet</a> linked in the wiki:</p> <blockquote> <p><em>The acceleration data is presented in 2's complement format. At 0 g acceleration the output is ideally 0h.</em> [sic]</p> </blockquote> <p>You will of course see gravity as a steady roughly 1 G vector in the output. If you have the control center or another working grapher, rotating the watch will show which axes are being pulled and which way.</p> <p>If you've installed the <a href="http://processors.wiki.ti.com/index.php/EZ430-Chronos#Projects" rel="nofollow">TI control center</a>, you should also have the firmware sources for both the watch and the basestation. Reading these should tell you pretty exactly how the data is treated (almost not at all, some IIR filtering and periodical send when ACC is active). The basestation headers also contain info about the protocol between host and the basestation.</p> <p>The other programming samples may also be of some practical help.</p> <p>As for the "four extra bytes", I think your samples there are off sync. Looks like they are [4 5 6 0 1 2 3] Maybe you forgot to read the response for basestation start command or something. So the first three are from a previous request and the last four are from the current one and since you don't read all seven, the last three will come in at your next read etc. In correct order, the bytes are (IIRC): a start byte (0xff), command/response (0x06 = acc data follows), packet length (0x07 = seven bytes including these three), "return code" &amp;&amp; button state (0xff = no data), ax, ay, az. But you can find the real constants in one of the headers :)</p>
<p>I've been trying for an embaressing amount of time to figure out how to interpret the wireless accelerometer data from the <a href="http://processors.wiki.ti.com/index.php/EZ430-Chronos?DCMP=Chronos&amp;HQS=Other+PR+chronoswiki-pr" rel="nofollow">TI Chronos</a>. From my laptop with the usb-radio included, I read it into python basically following <a href="http://pastebin.com/f71ca7188" rel="nofollow">this</a> recepie, then I throw it into a pyglet application to display the 3D acceleration vector. Its read in as unsigned chars, but I can't make any sense of the data. Neither have I find it documented anywhere. Here is an example printout from holding the watch still, while rotating it among 1 axis smoothly.</p> <pre><code>[253 245 24 255 6 7 1] [ 0 241 20 255 6 7 255] [255 229 28 255 6 7 255] [255 229 25 255 6 7 255] [ 1 229 19 255 6 7 255] [249 224 21 255 6 7 255] [254 219 17 255 6 7 255] [255 218 11 255 6 7 1] [247 211 15 255 6 7 255] [251 209 10 255 6 7 255] [251 212 255 255 6 7 255] [243 194 16 255 6 7 255] [243 200 7 255 6 7 255] [247 197 3 255 6 7 1] [246 190 10 255 6 7 255] </code></pre> <p>Obviously the first 3 bytes are the accelerometer data, and also clearly the numbers needs to be signed somehow. But why aren't the force vectors smooth? It's more obvious in the opengl visualization, but even in the small dataset above, one can observe for instance jumping from 255 to 1 in no time. Finally I want to get actual Gs from the data, but for now I'll settle with getting a smooth force vector that seems somewhat coherent with the rotation of the watch. Bonus points if anybody knows what the last 4 bytes means. Hopefully this is a chiphacker type question.</p>
How to interpret TI Chronos watch accelerometer data
2010-07-30T21:58:59.763
3800
|arduino|motor|
<p>Since what you changed was the power supply, I'd look at the 5 V rail and the battery voltage and see what they're doing. If they were doing the same thing as the USB-supplied rail, your system would work.</p> <p>Here's a possibility: maybe the motor draws more current in one direction or the other. That makes the 9 V battery sag below the dropout voltage of the 7805 (around 7 V, I think?), which makes the output sag, which makes the Arduino freak out.</p>
<p>I am trying to build a simple motor controller for a 3v hobby motor ( <a href="http://www.radioshack.com/product/index.jsp?productId=2102828" rel="nofollow">http://www.radioshack.com/product/index.jsp?productId=2102828</a> ) that I picked up at Radio Shack. </p> <p>I am using the L293NE (Datasheet can be found at: <a href="http://focus.ti.com/lit/ds/symlink/l293.pdf" rel="nofollow">http://focus.ti.com/lit/ds/symlink/l293.pdf</a>) for the H Bridge and have the follow pins laid out</p> <pre><code>pin 1 -&gt; +5v pin 2 -&gt; arduino pin 2 pin 3 -&gt; motor + terminal pin 4 -&gt; ground pin 5 -&gt; ground pin 6 -&gt; Motor - terminal pin 7 -&gt; arduino pin 3 pin 8 -&gt; +5v pin 16 -&gt; +5v </code></pre> <p>I wrote a small program and when I hook everything up to the +5 and ground on the arduino Duemilanove board, both forward and reverse work great. </p> <p>Knowing I won't be able to use USB to supply power to the arduino once on my robot, I use a 9v battery and a 7805 Voltage regulator to bring this down to 5v. When I take the +5 from the 7805 to the arduino vin and connect the ground on the arduino to the ground on the breadboard, the motor will only work one way (say forwards) but not the other(say reverse). Any ideas?</p> <p>I've already verified with the multimeter that all the pins, in the pinout above, are still getting +5v </p> <p><strong>EDIT: Update #1</strong> : Grounding pins 9,10,12,13,15 doesn't make a difference. Also, the arduino doesn't freak out at any time while it is getting it's powered by the 7805. Switching the arduino back to usb power after being driven by the 7805, the motor works in both directions. Tells me the L293 is good. Looking into the possible current issues mentioned in the replies. </p> <p><strong>EDIT: Update #2</strong> : There was a question how I have the 7805 powering the arduino. I have two breadboards as it makes it easier to switch. Breadboard 1 (BB1) has just the 7805 on it where the power rails hook up to the 9v battery. Bread board 2 (BB2) has just the L293 on it. This way I can easily swap out the power supply (either BB1 or the arduino) without having to mess with circuit of the L293. With that said... From the +5v pin on the 7805, I feed that to the + power rail on BB2. I feed the -rail of the BB2 back to the - rail on BB1. To power the arduino, I just run a wire from the +rail of BB2 to Vin on the arduino board and run Ground on the arduino back to the - rail on BB2. </p>
Arduino Motor Control with L293NE
2010-07-31T02:12:23.800
3805
|soldering|
<p>Hand soldering. Heated surfaces must be clean to reduce surface tension.</p> <p>The tips should be cleaned daily with solder and sponge, keep tip on tight.</p> <p>Surface, if oxidized, must be cleaned (abrasive) and fluxed.</p> <p>If a large ground plane is connected to a solder joint or heat sink or shield.... then more heat is needed to reach the melting point.</p> <p>Applying small solder to the tip to make surface liquid reduces thermal resistance and speeds up component heating, and then apply more solder as required quickly.</p> <p>General purpose irons are 15-25&nbsp;W.</p> <p>Shields or large ground planes need more power or mass to tip to heat up the surface faster.</p>
<p>I am trying to make an LCD <a href="http://www.arduino.cc/en/Main/ArduinoShields" rel="noreferrer">shield</a> from my Arduino and am having problems trying to got the solder to stick to the Freetronics <a href="http://www.arduino.cc/playground/tutorials/protoshield" rel="noreferrer">protoshield</a> PCB. I have cleaned it as best I can. </p> <p>I am using a decent Proxxon soldering bolt with solder that has worked good for me in the past. How can I get it to stick?</p> <p>It won't bond to the PCB, only the wires.</p>
Solder won't stick
2010-07-31T05:36:50.893
3814
|led|uv|
<p><a href="http://www.ledengin.com/products/" rel="nofollow">LedEngin</a> manufactures a number of high-wattage LEDs and modules, including UV LEDs, targetting UV adhesive curing applications. Their primary distributor is <a href="http://www.mouser.com/LedEngin/" rel="nofollow">Mouser</a>. </p> <p>Their thermal pads are not electrically neutral, and must be isolated from the rest of the PCB. They do this for you if you buy one of their presoldered modules.</p> <p>Their datasheets contain relative intensity to current curves, rather than lumen to current curves, because lumens are a unit defined by the power of light perceived by the human eye, and UV light is imperceptible. Especially if you're trying to cure an adhesive, you're interested not in lumens, but rather in watts (of light) per square meter. This is only a small percentage of the electrical watts dissipated by the device, about 20% for 395nm UV LEDs, and as low as 5% for 365nm LEDs. For most LEDs, this "curve" is a fairly straight line, corresponding to, say, 20% of the total power dissipated for UV LEDs. </p> <p>Especially when working with high power LEDs, you'll also want to look at the temperature to radiant intensity curve. As the LED warms up, the intensity drops. A combination of the current and temperature curves into one would be a nice datasheet feature, but I haven't seen one.</p> <p>Safety notice:<br> I'm sure you know this, but looking at high-brightness UV or IR LEDs can harm your eyes, and UV LEDs will give you sunburn. Most UV LEDs will be in the UV-A spectrum from 320-400nm, and, while this spectrum is not as dangerous/cancerous as UV-B, it will still give you a tan or worse. You'll want sunglasses on your eyes (They don't have to be dark, just rated for UV), and sunscreen on your hands when experimenting with these. Setting up a webcam to continuously monitor your workbench so that you know for sure when the LED is on would also be a good idea.</p>
<p>I'm looking for some bright LEDs (in the range of 30-50 lumens, which I think means 2-3 W) for use in a piece of scientific equipment. Can anyone recommend an LED manufacturer that has not just powerful LEDs, but also particularly complete datasheets? I'm especially interested in a lumens/current curve.</p> <p>If it helps, I'm mostly interested in LEDs with wavelengths below 560 nm, i.e. green, blue, violet, and UV. If I could get all the LEDs from one manufacturer, that would be good. I'd prefer surface-mount LEDs, but it's not a strict requirement.</p>
Good high-lumen LED suppliers?
2010-07-31T23:29:17.560
3815
|xmega|avr|
<p>If you look at the device support for the STK500 in the AVR Studio Help you will see that the XMega isn't supported, you need an STK600. I'd use a Dragon, it's a lot cheaper and gives debugging as well as programming.</p>
<p>Can the STK500 program the XMEGA as it arrives from Atmel?</p>
Can the STK500 program an XMEGA?
2010-08-01T01:19:30.763
3816
|arduino|transistors|power-supply|power|wiring|
<p>You should be able to connect your arduino ground to the 24V ground, unless the power supplies are somehow referenced to one another. If one or the other or both of your supplies happens to be a battery, then you don't have a concern. If both supplies are transformer isolated AC supplies, you shouldn't have a problem. Even if both supplies tie their DC return side to the earth-ground lug of the AC mains, you should be ok.</p> <p>If you bridge the two grounds through a 10K resistor, and a DVM across that resistor shows anything more than a volt or so, your supplies probably aren't isolated enough to just connect the grounds.</p>
<p>I am working on an arduino project that uses transistor switches to power on high power leds that are powered by a separate 24 volt power supply. My issue is that I have two different grounds, making it difficult to bias the transistors. Can I just connect the arduino ground pin to my external power supply's ground or will this damage the board? How can I end up with just one ground? Thanks.</p>
Connecting arduino and separate power supply grounds
2010-08-01T01:40:56.390
3821
|diodes|stepper-motor|
<p>You can use 1N5822 schottky diode they're rated at 3Amp and as they are Schottky diode they do not have a stage from where they have to return.</p>
<p>Looking at the <a href="http://www.st.com/stonline/books/pdf/docs/1334.pdf" rel="nofollow">L297 datasheet</a>, it references the use of "fast 2A type diodes".</p> <p>What does that mean?</p> <p>Would a 1N4001 qualify? Given the application, I'm assuming that it needs to be a higher power part. Not sure about the "fast" part though. The 4001 datasheet doesn't say anything about that.</p>
What is a "fast 2A type" diode?
2010-08-01T17:37:23.100
3830
|electromagnetism|
<p>You need to build or buy something called an H-bridge. They are commonly used for motor control.</p>
<p>I'm trying to drive an electromagnet with a 556 timer in a push pull configuration. The magnet has to change polarity rather quickly and sharply about 10 to 20khz. The voltage also has to be variable, between 3 to 15 volts the current draw is in the range of 1amp. What I need is a way to amp the square waves, I was thinking of using a pair of relays driven by the 556 timer in the complimentary configuration that way I can feed through them a varying voltage independently without affecting the 556... Or am I going at this the wrong way? </p>
Driving an electromagnet with a 556 timer
2010-08-02T17:47:15.710
3834
|wireless|communication|
<p>If you're main interest is to get it up and running quickly, there is a bunch of USB-based digital I/O kits which include programming libraries to read/write the states of the pins. Unlike working with Arduino or other micro-boards, this means you only have to worry about programming the PC (versus having to write and debug the code running on the microcontroller board).</p> <p>It used to be that wiring inputs and outputs through a PC's joystick or parallel port was the way to go. But that was in the days of DOS and Windows up to about Windows 95. Since then, directly accessing the registers to get to the hardware has gotten progressively harder to do. That said, it's still do-able - you just will have to jump through programming hoops to get to those pins from your program. My ThinkPad's laptop dock, for example, has the legacy style parallel port, and it is still supported by the OS, should I decide to plug in a LaserJet II. :)</p>
<p>I am a novice at electronics hacking. I would like to know how I can make a circuit communicate with a PC. Take for example, a simple circuit, with one LED and a switch. The switch on the circuit however, is not used to control the LED. Pressing it communicates the present state of the LED. I have a program running on my computer, which has for an UI, a button and a graphic object; a black filled circle. </p> <ul> <li>I should be able to turn the LED on and off from my computer by clicking the button on the screen.</li> <li>Pressing the switch on the board, should communicate to the program the state of the LED. If the LED is on, the black circle should turn green, else it should turn black.</li> </ul> <p>This a hypothetical situation I have described to explain the problem. I am not looking for a solution to implement this thing, but want to know how this communication between my circuit and the computer can be achieved, in a simple, inexpensive way, over</p> <ol> <li>wire?</li> <li>wireless?</li> </ol> <p>And if you could suggest where I should look and what I should learn to get started with my electronics project, that would be of great help.</p>
What are the ways I can make my circuit communicate with a computer?
2010-08-03T04:39:42.693