Hacker News new | past | comments | ask | show | jobs | submit login
Lessons from Running a Small-Scale Electronics Factory in My Guest Bedroom (spun.io)
446 points by DominoTree on Jan 2, 2019 | hide | past | favorite | 47 comments

If you're going to produce a reasonable-sized batch of anything electronic, I'd strongly recommend:

a) doing some reading on design for manufacturing

b) getting some quotes for PCB assembly services and

c) considering factory-programmed microcontrollers

At quantity 200, you could have simple boards like these assembled for about a buck a piece. Microchip will program 200 PIC or Atmel microcontrollers from the factory for about 20 cents each with a $29 setup fee. Unless you're willing to work for a very low hourly rate, you should probably take advantage of someone else's economies of scale.



I didn't realize assembly/programming services were that cheap and I'll definitely consider them for final runs of things in the future if it's a decent quantity like this. I'm just a hobbyist and I enjoy putting these things together, and most of the time it's just a handful of boards at once anyways so it's not a big deal.

The real issue was that I had ended up cutting a lot of corners to try and get things done in time, particularly with regards to testing. Definitely a major lesson learned.

The MCUs didn't take long to program with a ZIF socket, but once they were baked onto boards and I was finding bugs that needed to be fixed, that's where it really turned into a pain doing it over SPI.

After all of that, I still ended up having to bodge 2 connections on all of the final boards after all was said and done (which was the 5th or 6th board revision after I did small test runs to play with things and fix issues)

Check out CircuitHub they make it really easy to iterate on a design and get an instant quote on cost to build it. Really nice automated interface for quoting takes almost all the design parameters directly out of your design files. Makes traditional quoting interfaces feel like the stone age. They are doing for PCBA what OSHPark did for small batch PCB ordering.

They have some competition but CircuitHub is my go to. Others to check out are...




[0] https://circuithub.com/

>The real issue was that I had ended up cutting a lot of corners to try and get things done in time, particularly with regards to testing. Definitely a major lesson learned.

Haste makes waste, measure twice and cut once. It's one of the hardest lessons to properly internalise - bodges and firmware changes can be hugely time-consuming, so it nearly always makes sense to absolutely nail your prototype before moving to production.

Congrats on a cool project.

i.e., waterfall really does make sense when you're dealing with hardware.

I want to push back on this notion a little bit. I think non-waterfall is plenty fine for hardware development. If you structure your product development cycle as a series of (design, build, test, feedback) steps, you get that valuable feedback much earlier than later.

One/one-hundred-off prototypes are expensive but nothing beats the information gained from soldering a board, plugging in connectors, and programming chips directly. You'll do these steps at the end of a waterfall process anyways, and I'd say they're more expensive to alter then. When a problem is found, deciding to bodge wire two pads is the high-cost, low-risk solution to problems found late in the game. Discovering the problem early, fixing it in the schematic, and testing during your next prototype cycle is cheaper during production and risk is mitigated because you're still going to be testing before you ship.

Of course, this is all very much propaganda, and not all shops would follow this idealistic scenario, but I don't think hardware is any more waterfall than anything else.

Electronics DFM is one of those things that's really, really hard to learn. Most of the resources out there are lacking; they're either really basic stuff, really advanced stuff, or just plain incomprehensible. I am only aware of two ways to learn it that actually work:

1. In-person reviews with an expert. Offline reviews can be useful for getting a design out, but to understand the problem space, you need a back-and-forth conversation. Sample conversation that's easy in person but very hard over email: "Why not do it this way?" "Well, that would work, and it's a good solution a lot of the time, but you have this thing over here which makes this other approach a lot better...."

2. The hard way: sometimes there's just no substitute for experience.

At quantity 200, I think contract assemblers make a lot of sense (but do shop around: the economics of this particular supply chain can get weird), but factory-programmed parts really don't. Maybe if your firmware is final final I'd advise a client of mine to do it, but in any case where you're going to want a later firmware update, the best ROI is going to come from getting the debug port hardware perfect. That means the right connector (standard pinout, standard part, from a good quality manufacturer), level shifters where appropriate, pull-up and pull-down resistors, and all the rest. (Making sure this stuff was all explicitly spelled out on our review checklist was one of the first things I did when arriving at my current employer, and it's saved us and our clients a lot of money!)

Electronics DFM is one of those things that's really, really hard to learn

Seeed Studio guide to DFM.[1]


It’s a great guide - but there are two main limitations.

First, this is the DFM guide specifically for Seeed. Every factory will have a different set of specs depending on equipment (assembly, test, and inspection, and familiarity of operating personnel), throughout requirements, yield requirements and price points, rework allowance, and so on.

Second, these typically assume for wide tolerances. Operating environment or design may necessitate relaxing some parameters in order to allow others to tighten (aka the tolerance stack up).

Dealing with both cases effectively in volume production is what requires experience beyond the manufacturer provided DFM guide.

Someone who learns this guide inside and out will be able to DFM with Seeed but not necessarily anyone else.

More generally, the DFM guidelines for ceramic RF materials would be wildly different than for Kapton flex connectors or for standard FR4 material.

The guide is pretty solid, kudos to Seeed, I've used them for a 4-layer PCB and was very happy with the result.

Even if some things are different across CM's, the guide at least provides an awareness of the main issues for the target audience (amateurs or people getting their feet wet) for which these things are "unknown unknowns." If someone were to follow Seeed's guidelines, they would be in a good position to adapt their stuff for a different CM as long as they're receptive to feedback and the CM is willing to review it.

Absolutely true!

It's not hard if you're doing some Arduino-level IoT thing where the signals are slow and the density isn't that high. If you're designing fast electronics with RF components, you need to be an EE anyway.

Are there any GitLab/GitHub repos or wikis our there people can help edit to document design for electronics manufacturing?

Plugging my own thing: It is not a lot, but I have been compiling a design checklist for electronics design since summer.

Right now it is a tool for myself and my work, which puts a priority on being comprehensive; but the licensing is liberal and I’m open to input.


Simple things do not need to be documented. And heavy ones are something like trade secrets. There is low probability, that somebody might share their trade secrets with you. There are checklists from fpga vendors for pcb design: https://www.xilinx.com/support/documentation/user_guides/ug4... Chance, that you will produce the boards for systems with fpga by yourself, is very low.

Maybe Arduino?

It's not worth programming at factory IMHO unless you have extremely high volume. On a small scale, firmware is the most likely thing you're going to cock up. Between the parts being programmed and arriving, you're one FW revision up potentially. Best to build a programming header into the design and load before packing. You can load test jig firmware in before as well then.

Also some bottom rung assemblers you don't want to trust with your production firmware!

For me, 200 boards:

1. JLCPCB board + parts + assembly service. 2. Final assembly (non placeable parts) yourself. 3. Load firmware in and test via own test/programming jig. 4. Pack and send.

Out of curiosity, who do you usually use for your assembly service? I've ordered boards from JLCPCB, but only ever done assembly myself. Can you typically send your JLCPCB orders straight to the assembly house? Would love to hear more about the process of using an assembly service.

I haven't done it for a few years. Used a local service here in the UK for it who don't exist any more.

Production engineering is a thing, and it's almost a separate domain to basic electronic design. There are production shops in China that will take almost any design, build it, package it, and deliver it, for a short run of >250 units or so - often for less than the cost of buying the parts and doing all the assembly at home.

It's still not quite trivial, but it's not exactly hard now for small designers to go circuit -> Amazon without ever having to do any assembly at all.

> At quantity 200, you could have simple boards like these assembled for about a buck a piece.

I don't think PCB assembly would be that cheap, especially for a board with lots of SMT components. What I understand is that SMT manufacturing has a high startup cost, you need to supply the factory with full tapes of parts, and the factory needs to program the assembly line, often a factory is reluctant to take any offer below tens thousand boards because its high overhead. Even for service providers specialized in prototyping then, I don't see many provide QFN and BGA packages as options.

What have I missed here?

In recent years, Chinese firms have drastically reduced the cost of short-run PCB manufacturing and assembly. They generally accept re-reeled or cut tape parts and some offer a turnkey sourcing service - you provide the BOM, they do the rest.

I just requested some quotes for assembly of 200 boards with a single-side load of 25 SMT parts, of which one is a BGA. The cheapest quote was ALLPCB at $1.09 per board, followed by PCBWay at $1.33 per board. That price includes setup and testing.

No transaction involving Chinese outsourcing is without risk and you need to do your homework, but it is no longer the case that DIY assembly is your only option.


Does the price include the parts too ?

Reading the "Add proper programming and debugging interfaces" section it sounds like the author might have been using factory burned uCs. They definitely burned the chips before assembly at least.

I highly recommend that people try to have a board made before they go about trying to build the entire thing by hand in a home pcb factory. The cost has come down a ton over the years on using actual Quick turn fabs.

Depending upon your turn time you can get boards made for say $20-50 for say a 4-6 layer board. For assembly —- that is really the expensive part. Basically can be hundreds of dollars per board for complex boards. But there is zero way you are going to build a complex board on your own at home. Toaster oven style? I mean honestly unless the board is pretty simple it’s basically close to just hitting the button on a slot machine. Burn some money and maybe you win maybe you don’t. Best bet is to start small — like one micro plus some passives and solder all the components onto the board yourself. Once you determine your board is good then build up from that. Lots of SW folks are not used to spending money to prototype something — they still click the “still evaluating” button on winrar for like 10 years solid. So yea hw takes a bit of guts to click the buy button and wait and hope for the best.. my advice just do it! Definitely my personal phrase there..

> click the buy button and wait and hope for the best.. my advice just do it!

Speaking from experience as a sw guy, the "hit buy and pray" approach should be preceded by as many desk-checks as are humanly possible. For example: Use the design verification features in your CAD program. Print the PCB onto paper, place all the components on it to check for component clearances and orientations (no-one would lay out a connector upside down, would they?)

I think I got that last idea from one of Robert Feranec's DFM tips, lots of good ideas there: https://www.youtube.com/playlist?list=PLXvLToQzgzddPKq_txEXN...

> The first step was to forcibly disable 1) the display, 2) the radio, and 3) the flash chip from using the SPI bus by adding three jumper wires to tie their CE pins to VCC.

A couple of things I found helpful.

Use a standard connector for in circuit programming. It just makes developing and debugging so much easier. Being able to easily swap parts of a development setup to see if the problem follows a piece of hardware will save your hair.

For AVR's where the programming interface is shared with the SPI Bus, always put pull ups on the chip selects for SPI's bus parts. As you learned those parts can fight the programmer if you reset the processor while they are holding the bus.

Also for AVR's I've seen mis-programming set the fuses to a clock setting that isn't supported by the hardware. Like programming an very low speed clock or an external clock when there is none. On our test jigs we resorted to injecting a 1MHZ clock on the xtal input pin when programming. Providing for this will be it easy to recover bricked board.

Having a command line interface for running tests is really really helpful. Use one of those USB to serial adaptors by FDDI. I found USB kind of sucks because plugging and unplugging USB ports a lot seems to often confuse OS. I've seen the US just give up on a USB port that it thinks is hosed. Either that or the drive gets messed. And you need to reboot. Using serial solves that problem.

And for small runs of boards try designing a simple loopback teststand. Just loop IO back through the test stand and use the host uP to run the tests.

C#/.net gets a lot of hate, but works really well to drive a single device under test. That allows you to slap together a simple GUI based test that you can offload onto someone else. You don't need anything but the programmer and a USB to serial adapter. You can shell out to run AVRDude.

Consider barcodes and barcode readers to keep track of boards. Failing that invest in QC tags.

Making test points for all your testable functions and aligning them to a stripboard really simplified making a testing jig. You can solder some pogo pins to the strip board and just press each board to your jig to program/test it.

Also, I've found renumbering passives to keep the same values in contiguous groups to simplify hand prototyping. You end up having dozens of 0.1uF for example and it's nice to knock them all out instead of switching between different components

For hand assembly I usually break out all of the components into little iFixIt project trays and print out labels that correspond to the board, but when there are a bunch of components with the same value, I just put the value on the label instead, and use highlighters on to point them out on printouts so I don't spend forever hunting where to place them. Then, I just go one by one down each spot in each tray until I've populated a board, then I throw it in the oven and start on the next.



That is a nice idea, thank you!

When numbering components, my favorite approach is to group designators by subcircuit. That means one circuit (say, an op-amp circuit) might have U41, R41-R46, C41-C43, and Q41; the next circuit would have U51-U52, R51-54, C51-59, and L51. You get the idea. That way, not only is PCB to schematic lookup made easy (and I find that's the one most in need of optimization), but on a good layout, a subcircuit will be laid out together, so you get PCB designator locality for free! The exception to this is decoupling capacitors; if I'm assembling by hand, I'll usually put them at the end of the list (so, continuing my previous example, they might be C60-C81, if there were only five subcircuits). I only bother with this for hand assembly, though; robots don't care.

We do things a bit like that - we break things up in the schematic by page (between one and a couple of sub-circuits per page), and then the designator is page number plus a sequential ID. So you might have C405 (4th cap on page 4) or C847, etc.

We don’t print designators on silkscreen, so it’s not really a problem with the length (e.g when you get over 10 pages and have a five or more digit long designator. With a page that is subclassed you might have one like R1208B for example!)

Just two weeks ago Bunnie also posted a good article on test jigs for electronic equipment: https://www.bunniestudios.com/blog/?p=5450

Echos many of the important lessons learned in this piece.

I worked with foxconn on one of those type of test jig for a tablet type of product before. They are custom make for the PCB, but very nice to have. You can reprogram the PCB in about 1 minute, the PCB is is perfectly align to the Jig and the test pins line up with the JTAG and you can program EEPROM, or EMMC it from the JTAG software.

This was actually a surprisingly actionable list of suggestions... thanks!

Also in this commentary are good pointers. Hope someone can come out to talk about how to make their 100-200 boards and the mistakes or good things to lean.

Yeah, I loved that! Seeing an article with actual actionable things is so rare and so great.

Oh shit I got one of these! Awesome to see what work went into it, I've been thinking of making my own badge next year!

As far as numbering components goes, we typically will number all the components on page 1 in the 100 series, page 2 the 200 series, etc. So the first resistor on page 1 will be R100, the 2nd R101, and so on. And it is good to have the components numbered such that related ones are in the same range.

On a large design, this makes it much easier to find the right section.

When not too constrained by size and particularly for prototyping, I tend to use short descriptive names that are not too hard to decode. For example you could use Cby* for bypass capacitors, or maybe if you have a series of LEDs, then you could have Dr, Dg, Db* depending on their color, and similarly Rr, Rg, Rb* for their respective resistors, or Rpi* for I2C pull-up resistors, etc.

Sure you could have a look a the traces to find those out, but it's not always straightforward.

This makes a big difference when debugging boards IMO. For example now if you see that your blue LED is too bright again (as is usually the case ;)), you can just look for Rb* and fix it without the schematic.

In mature markets, such as the EU and US, there are extensive requirements behind the FCC and CE marks. While no third party approvals are necessary, the requirements are still there. Especially the radio noise requirements can be difficult. How do you go about solving and documenting these?

The three viable solutions are:

- sell it as a "kit" or "component", something that doesn't stand on its own; these don't need approval

- stick the CE mark on there and rely on nobody checking it. This does leave you open to future legal action, but it's quite rare.

- stay out of the market entirely and abandon the field to Chinese postal vendors who will never be held accountable

(same goes for WEEE registration in the EU)

Lining up the 0.1in grid is a great lesson I wish had been learned by the Arduino inventor. I'd like to name them but it's unclear to me who to credit for an otherwise very useful board.

Has anyone had experience with Fritzing.org or something like BotFactory for low rate production like this?

BotFactory: https://www.botfactory.co

Friends Don't Let Friends Use Fritzing.*

KiCAD offers a free open-source EDA package that won't limit you after you learn how to draw your first electrical schematics or layout a PCB.

(Disclaimer: Fritzing is a perfectly fine project for someone's first introduction to electronics. Eg. Blinking an LED with an arduino. It quickly runs into limitations because of it's use of point to point wiring on pictographic components)

The infamous rucas. ~~

Basically TDD

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact