Building for production: gotchas? - Page 1
Forum section: electronics / beginners

author: Chris_77
author_rank: Contributor
timestamp: July 08, 2017, 04:25:48 pm
content: Greetings.I'm wanting to build a production PCB with a printed plastic enclosure box, 328P-PU microprocessor, and some assorted components.Are there any production gotchas that I should be aware of, or that any of you have run into AFTER your device went out to the field? Thus far, I'm looking at this feature-set:Field-upgradeable: I'll probably make a header for ICSP pins, a header at the edge of the box, and a ribbon cable connecting the two. My plan is to key it by making a 2x4 grid (ICSP is 2x3) and blocking one of the pins. That would stop a user from plugging this in backwards.Quasi-modular: I'm looking to offer several different builds of the base unit. I _think_ the way to go about doing this is to build a "base" PCB with header pins and use corresponding headers on the expansion boards and ribbon cables.5V->3.3V conversion: this is a USB device. I'm looking at using an LD111733 with appropriate capacitors to run the components off of 3.3V.Decoupling caps on every IC: I've several ICs. The Atmel, a 74HC14 (for hardware debounce), a MAX7219 to drive LCD displays. I've effectively read that you want decoupling caps on every IC, and I'll eat the extra $0.30 in parts (it's a pretty niche device, so it'll be a short-run kind of thing where if I sell 100 units, that will far exceed my expectations). Is this a good move?Supply chain: for prototyping, "supply chain" means "go to Shenzhen sellers on eBay, buy 10 pieces of component X, and then test them as I can and write them off as "bench" or "alpha" units, not to be used for production. Am I missing something obvious here, or is this a reasonable way to segment my build between "playing around" and "I have to stand behind this unit for 1 year, let's pick the higher-quality components from Digikey, Mouser, etc."?It has (obviously) been years and years since I last touched electronics. I remember enough to possibly smoke an IC, enough tonotsmoke an LED, and not quite enough to really feel like I'm tuning a circuit--even a simple one--for really robust behavior. I'm prone to over-engineering, and here this is good: I stand behind what I build, have never build anything for pay, and want people to end up really happy with their device that lasts years and years.

author: sokoloff
author_rank: Super Contributor
timestamp: July 08, 2017, 04:39:54 pm
content: I would not omit the Vcc caps. If your buttons are not driving microcontroller interrupts, why not just debounce in software on the micro and save the $0.20 by eliminating the 74'14?If field upgradability is an uncommon use case, but something you want to support, leave unpopulated space on the PCB for end users to add their own headers (or use pogo pins). Headers are not cheap to include as they are generally hand-placed. Same story on the upgradability. It seems like you're designing a lot of "what if" into the product, which will work against your BOM and assembly costs.Lastly, sure you need the 328P-PA? What about a TQFN part (cheaper part plus a smaller, cheaper PCB)? What about a smaller AVR?

author: Chris_77
author_rank: Contributor
timestamp: July 08, 2017, 04:52:50 pm
content: Quote from: sokoloff on July 08, 2017, 04:39:54 pmI am looking at driving microcontroller interrupts by the buttons, indeed.You're right about the BOM being driven up by edge-case desires. It may well be more reasonable for me to offer cross-shipping of a new IC and have the user socket the new chip and ship the old one back to me. I'm looking to keep the user out of the case as much as possible, but you are probably right in that there's a reason why firmware updates aren't readily-permitted on most COTS devices.I've looked at the footprint. Ultimately, you're probably correct in going TQFN, but for a solid alpha/beta-level proof-of-concept, I'm looking to go through-hole with pins I can readily solder (I'm old and don't have a good setup). For this, the DIP package seemed like a good place to start (as they'll also fit on a breadboard for prototyping), and I've got those on-hand, so...And ultimately, though I wanted to keep everything in-house and do etching, etc. myself, I likely should push the Gerber files to a PCB house and buy lots of 10-20 boards. The prices on small-runs are actually quite good, I've read you get a great solder-mask, and I know of no good way for me to make vias myself. For a 2-sided board, sending out seems a good way to go, which is a way of me saying that in the long term, you're probably right--TQFN won't matter if I'm not the one doing the soldering.

author: sokoloff
author_rank: Super Contributor
timestamp: July 08, 2017, 05:04:26 pm
content: You can definitely prototype with the DIP part as that's super-convenient. Just when you go to the point of making a custom PCB, the advantage of the DIP part mostly goes away IMO and entirely goes away (and becomes negative) when you go to a contract manufacturer for 100 parts.

author: stj
author_rank: Super Contributor
timestamp: July 08, 2017, 05:22:16 pm
content: make sure it's RoHS compliant and marked as such, if you intend to export it.infact i'm not even sure you could make it in china if it wasnt - they have stronger reg's than Europe!

author: T3sl4co1l
author_rank: Super Contributor
timestamp: July 08, 2017, 08:24:34 pm
content: Qty 100 is still prototype stage.Don't bother optimizing much of anything.Tim

author: mariush
author_rank: Super Contributor
timestamp: July 08, 2017, 09:15:02 pm
content: Field-upgradeable: I'll probably make a header for ICSP pins, a header at the edge of the box, and a ribbon cable connecting the two. My plan is to key it by making a 2x4 grid (ICSP is 2x3) and blocking one of the pins. That would stop a user from plugging this in backwards.You could probably just use a custom connector that uses 2mm or 1.50mm 1.27mm between pins instead of 2.54mm , or one that comes with keyed shroud. This way user will be unlikely to plug any cable it finds around yet could still solder some wires in the holes if you don't populate the connector.For example, look at JST ZH :https://www.digikey.com/product-detail/en/jst-sales-america-inc/B6B-ZR(LF)(SN)/455-1661-ND/926568You can buy ready made cables cheaply as well (for example ZH series is compatible with the ZR series cables) :https://www.digikey.com/product-detail/en/jst-sales-america-inc/A06ZR06ZR28H51B/455-3035-ND/6009411Quasi-modular: I'm looking to offer several different builds of the base unit. I _think_ the way to go about doing this is to build a "base" PCB with header pins and use corresponding headers on the expansion boards and ribbon cables.In that case you may want to look into a microcontroller with pins that can be rearranged for specific purposes for better/easier layout.5V->3.3V conversion: this is a USB device. I'm looking at using an LD111733 with appropriate capacitors to run the components off of 3.3V.Do more research and pick some regulator that is more flexible and isn't so picky about what capacitors you use. For example LD1117 and 1117 series in general is known for requiring capacitors with esr above some threshold on the output (electrolytic capacitors are often suggested). Just spend a couple more cents on a ldo that can work fine with basic ceramic capacitors, or you could just use a micro that can work fine with 5v.Decoupling caps on every IC: I've several ICs. The Atmel, a 74HC14 (for hardware debounce), a MAX7219 to drive LCD displays. I've effectively read that you want decoupling caps on every IC, and I'll eat the extra $0.30 in parts (it's a pretty niche device, so it'll be a short-run kind of thing where if I sell 100 units, that will far exceed my expectations). Is this a good move?You could do a sort of semi-hardware debouncing by just using a RC filter on each button. Pick resistor and ceramic capacitor in such a way that it takes a few ns/ms for the voltage to raise/go down enough to hit the micro's threshold and switch from LO to HIGH or the other waySeehttps://learn.digilentinc.com/Documents/258orhttp://www.eng.utah.edu/~cs5780/debouncing.pdfCeramic capacitors and ceramic resistors you buy in rolls of 2500-5000 and they're pennies. , certainly cheaper than a whole separate IC which would also require power and consume power constantly.. and if space is an issue you could even go with resistor networks for such purpose.This semi-hardware debouncing plus some minimal filtering in the micro could be enough to save you the need for an extra debouncing chip.max7219 is a LED digit display, not a LCD driver as far as i'm aware. I'd say stay away from Maxim parts as they're way too expensive and you may have surprises like not being able to buy them in quantity you want, or you may have to wait long times for them.Genuine ICs are also expensive at around 9$ a piece, or around 6$ if you buy 100.It's just a stupid 8 x 8 led driver, with the only plus that you just send it 8 digits and it does the conversion from digits to segments and does that multiplexing thing turning on segments.In the amount of space this chip would use you could literally use a 1-2$ 16-24 .. even 32 channel led driver and - if you want to reproduce this chip's functionality - you can have a 8-10-12 pin micro that just receives the digits from your main micro , determines which segments need to be turned on or off for each digit, and shifts the data into the led driver and also does the multiplexing thingex1.85$ per 100 for 24 channel driver :https://www.digikey.com/product-detail/en/issi-integrated-silicon-solution-inc/IS31FL3737-QFLS4-TR/706-1511-1-ND/62019821.65$ per 100 for 24 channels :https://www.digikey.com/product-detail/en/stmicroelectronics/LED2472GQTR/497-14236-1-ND/45522281.18$ per 100 for 16 channels :https://www.digikey.com/product-detail/en/texas-instruments/TLC5929DBQR/296-28974-1-ND/2682903For prototyping you could just as well hit digikey, farnell, mouser etc you won't be bankrupt by spending a few dollars more ordering small quantities.

author: wraper
author_rank: Unknown
timestamp: July 08, 2017, 09:42:36 pm
content: 100n SMT capacitors for decoupling barely cost anything, like 0.1+ cent when bought in a full reel. Assembling when outsourced will do cost however. Debouncing buttons in hardware is counterproductive, additional expenses and inferior to decent software debounce.

author: wraper
author_rank: Unknown
timestamp: July 08, 2017, 09:48:02 pm
content: Quote from: mariush on July 08, 2017, 09:15:02 pmYep, they are very expensive. Or 100% counterfeit if sourced in China for cheaper price.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: July 08, 2017, 10:43:04 pm
content: Quote from: wraper on July 08, 2017, 09:42:36 pmLike to see software debounce a random-MHz RF field.(No, RFI isn't quite the same as normal contact bounce. But the idea is the same: reduce the frequency response to the switch. Indeed, it's a linear filtering problem, and therefore in the domain of the traditional "analog filter - ADC - DSP filter" approach. Yes, linear even if you're only looking at an on-or-off bit -- that's just quantization noise.)Which is another thing important to get right in production: EMC susceptibility and emissions. It's very easy to miss these issues in a quick design. It's also very expensive to get right, whether it's by hiring an expert to get it right the first time, or by spending all-too-much time at the lab, poking at your thing until it passes. Of course, if your device is just for lab use only, you can skip much of the expense; but you can't escape the underlying reason for that testing: don't be surprised if you have customers come back frustrated by random errors in noisy environments. Or worse, customers not coming back at all!Tim

author: Chris_77
author_rank: Contributor
timestamp: July 09, 2017, 10:31:25 am
content: Thank you for all the replies and information thus far!I want to assure everyone: I don't have ego tied into this design. If I have something wrong, point it out, I won't be upset.I'm entering into this with Beginner's Mind and (mostly) Beginner's Knowledge. With the frustrating bit that I used to know some theory and application, but that was many moons ago and never with production stuff where EMF noise would really enter into anything. And armed with full-on EE Lab scopes and so forth. Alas, I changed undergraduate majors and decided I wanted that information out of my head. That, coupled with long lean years, has made me have to really think about things I used to do automatically.I like solving problems, and there are LOADS to solve here.I'll probably ask this in-depth over on the Arduino forums,but I'm a bit curious now how one would get a bootloader onto their microcontroller that is soldered to the board (e.g. in the TQFPpackage). I'll have to look at Nick Gammon's pages again, but I'm not sure if that step can be done via ICSP low-voltage programming. How is this done in professional installations? ICs get solder-flowed on, then a panel of boards goes into a jig/bed of nails configuration for testing and programming? I'm also not sure if programming can be done over 3.3V. This is something I'll have to run down.looking around tells me that I can use ICSP for burning the bootloader as well as code. I have run into significant issues with burning the bootloader and code; I'm trying to use a CH340G-based USB connector once I have completed burning the bootloader (which seems to work). I was waiting for caps to come in and I think they've arrived. Also, I'll just try at 3.3V; the worst that will happen is nothing, and it sure seems like this should work at 3.3V as the IC is rated from 2.7-5.5V IIRC. What makes this supremely frustrating for me is that many sites out there build schematics that are wrong and shouldn't work (according to the datasheet), and yet they do.Keep the great comments coming!

author: sokoloff
author_rank: Super Contributor
timestamp: July 09, 2017, 10:51:33 am
content: Quote from: Chris_77 on July 09, 2017, 10:31:25 amMe too. That's one thing that appeals about electronics: there's way more than I could ever solve, so I'll never run out...Quote from: Chris_77 on July 09, 2017, 10:31:25 amYes. (Or in super-high volume they can be pre-programmed before soldering.)Also keep in mind that the Arduino bootloader is only there for convenience of the Arduino IDE. It is not necessary to have the Arduino bootloader to use an AVR in an end product (and in fact is undesirable IMO, as it takes up space and  slows the boot of the device to allow for reprogramming by the Arduino IDE).

author: wraper
author_rank: Unknown
timestamp: July 09, 2017, 01:15:59 pm
content: Quote from: T3sl4co1l on July 08, 2017, 10:43:04 pmIf there is a high RF interference, like in mobile phones, then EMI filtering is used on button inputs,EXAMPLE. But it's not a replacement for debounce, and debounce is not a replacement for EMI filtering as well.

author: Chris_77
author_rank: Contributor
timestamp: July 09, 2017, 03:43:02 pm
content: Quote from: sokoloff on July 09, 2017, 10:51:33 amYou're absolutely correct about the Arduino IDE. I have Atmel Studio installed and ready to go, but I want to make use of some "safety-nets" first WRT setting fuses, testing code, and so on.Later, I may well make the move to Atmel Studio, but for now I'll take the performance hit and space hit of using the Arduino IDE and its bootloader. The desire to move to POC as soon as I can is strong!

author: Chris_77
author_rank: Contributor
timestamp: July 09, 2017, 04:44:29 pm
content: Quote from: mariush on July 08, 2017, 09:15:02 pmWow. THANK YOU for the recommendations, links, parts, alternatives... There's a lot to digest here.Your information about the Maxim7219 is particularly interesting/alarming/useful. As you know, they're a 64-bit LED driver; which means 8 7-segment digits (I'm actually driving 7-segment digits). They have two advantages I was looking at: one, they multiplex across LEDs so you end up using one resistor for your block of displays (a good thing); two, they make use of SPI and can be chained together. So for four pins, I can drive all the 7-segment LED digits I will need.But knowing that they can come in, genuine and in bulk, at $6/part... that's a really expensive component.I'm looking at the datasheets for the parts you've linked. I have some work to do, clearly! On first glance, I think I'd need to define a pin-map (e.g. define 0, 1, 2...9) for this IC. I see these work over SPI, so certainly once I'm out of the prototype stage, it's going to be well worth-it to put some work into making a "bitmask font" and lowering the BOM cost. Or I could ... throw BCD at it, starting withthis sheet?I also have to admit: the package scares me. Packages like that strike me as starting to move beyond what I may be able to create in a toaster oven with a temperature control.Looking at the far end, since I'm building for PRODUCTION and am framing this for PRODUCTION, I might want to take some pre-orders and make sure I can get 100 units worth of interest before buying Digi-Tape reels and such, and at that point, I might just have the PCB house do the reflow. The total cost of reflowing, components, etc. may well be lower at the 100-unit mark than going through-hole or even SMD with TFQP. I think you have this one right.

author: Fredderic
author_rank: Regular Contributor
timestamp: July 10, 2017, 11:03:21 am
content: I just want to ask, how the <insert expletive here> do you find these alternative chips?!?Not too long ago, I went on the hunt for an 5x8 matrix/7-seg LED driver with per-LED intensity. Turned up the MAX7219's (8x8 mono), and the TLC5940 (1x16 intensity), both of which I have right here in nice breadboardable DIP. But after stabbing at it for three days, I found basically nothing else between those and a bunch of absolutely massive Cypress parts going at $30+ each, and designed to drive positively horrendous numbers of LED's (some complete with such things as chained scrolling of 6-frame animations).All I wanted, was a little 5x8 matrix (four digits, and some extra indicators) with per-segment intensity control (that's the show-stopper). My current driving method, is hanging them straight off the IO pins of a ?C, with naught but a couple column resistors (would have been better putting the resistors on the rows, I suppose, but didn't have enough of the right value in my little baggie). But I need to reclaim three pins, so been hunting for a chip to take it's place. (This isn't aimed at production, so slapping in a coupla-$ chip's fine, though a single chip that costs more than the board driving it, and for 70% capacity I'll never actually use, in a decidedly beginner un-friendly package… well, maybe not so much…) Then I ran across a "backpack" for one of those pre-fab 8x8 LED arrays, which had a pair of chips that totally and utterly didn't show up on my radar; one was an analog driver (I can forgive the all-knowing Google that one, coz I hate that pesky analog stuff too), the other was called by some other weird name, though I'm pretty sure it should have shown up in at least one of my searches!But noooo… There is something deathly wrong with my Google-fu, and/or perhaps also be a case of the Google-bubble strikes again? Soooo… I'm wanting to know… Does finding chips suitable to a job actually get easier with practice? Or does one just have to rely on experience and much head-banging to teach you to put in a bunch of weird archaic mystical search terms that you're expected to magically know will for some unfathomable reason yield positive results?

author: T3sl4co1l
author_rank: Super Contributor
timestamp: July 10, 2017, 11:30:08 am
content: You may be trying too hard. Take the easy way out!- If you can do it with an MCU, you can do it with an MCU and a regular IO expander. Saves GPIO pins, probably uses a USART or other interface channel, and will need a few more clock cycles to do things like pack data and run the USART.- Don't look for an overly specific LED driver. Try looking for more general purpose things. You might get something that's little more than an IO expander beefed up for row and column drive duty. In which case, you'll have to animate it in software still. But that handles more hardware.- If you need to unload the animation duties, you may be SOL unless you can find one of those special thingys. But... suppose you program another MCU dedicated for that function? MCUs are cheaper than those special LED drivers...Tim

author: stj
author_rank: Super Contributor
timestamp: July 10, 2017, 12:23:02 pm
content: maybe these???http://www.ebay.co.uk/itm/142336377912

author: klunkerbus
author_rank: Unknown
timestamp: July 10, 2017, 12:42:16 pm
content: As a pin-compatible alternative to the MAX7219, AMS has the AS1106 and AS1107 chips. Still pricey, but last time I purchased a few they were around $1 USD less than the Maxim parts.

author: dmills
author_rank: Super Contributor
timestamp: July 10, 2017, 12:52:54 pm
content: That sort of job is why small flash based FPGAs exist, cost effective once you add some mosfets to drive the current, and you can often hide a load of other glue logic in them.This is particularly useful when you need things like shaft encoders that are a pain to deal with in a micro plus IO expander scenario, but are very easy to convert to an on chip counter in the fpga fabric, then just read (and reset) the count periodically from the micro, no need for multi kHz interrupt rates any more.Regards, Dan.

author: sokoloff
author_rank: Super Contributor
timestamp: July 10, 2017, 01:00:32 pm
content: Quote from: dmills on July 10, 2017, 12:52:54 pmInteresting. Any beginner-friendly parts or series that you'd recommend?

author: dmills
author_rank: Super Contributor
timestamp: July 10, 2017, 03:41:17 pm
content: Some of the smaller Altera Max10s come in QFP, so somewhat possible to mount, and if you pick the right one you can get away with a single 3.3V supply, which beats the all too common 1v1,1v2,1v8,2v5..... thing that so often happens with FPGAS.Lattice is another possibility but they seem to do physically small as their USP which tends to mean BGA.Both companies offer internal flash, which is nice because it means they are almost instant on. Of course configuring the things tends to feel disturbingly like software dev (It isn't, but it feels that way).Both companies offer free software tools but the downloads are HUGE, Alteras offering comes with a free somewhat cut down Modelsim that is worth having.Both options have somewhat scary datasheets, just the nature of highly configurable parts.