Front:
Back:
Front:
Back:
The news has been filled with hate and anger lately. My normal sources of information are overflowing with it, and it makes the world seem like a terrible place.
This weekend I went to the Verona Public Library on a tour. My friend was so proud of it and wanted to show it off. I’ve been a fan of the Dane county libraries, but what I saw at this one was inspirational. If you want to skip to the point of the post, it is this: libraries are where we should be putting our tax dollars and attention. The community building, the learning, the understanding, the savings: the Verona Public Library represents who the average American is and what they do and care about, and how deep down we’re all loving people who just want to live a decent life and pursue interests like raising children and fantasy football.
Everything about this library is finely tuned to be awesome. The building is gorgeous and spacious. On walking in there is a book return with an automatic sorting machine that reads the tag and deposits the book into a specific bin for shelving. I know this because it’s behind a huge glass window that shows it off. Also near the entrance is a section for Wisconsin authors, popular new releases, and books for sale. My friend showed me where she votes, and the table that had all the appropriate documents for filing taxes. There was a computer lab, a reading room with a fireplace and all the latest magazines and newspapers. We walked by a giant shelf full of holds for people to pick up the books they had reserved online. The movies section rivaled Netflix (maybe not in volume, but definitely in the number of quality films, and many that weren’t available to stream). For adults, this place had everything, and if they didn’t have it, you could use the inter-library loan program and get it delivered there.
Then we went in the kids section. It was chaos, but perfectly organized for it. A giant castle in the center had little nooks for reading, and play areas distributed around the giant room were loci for congregating kids, with seats around them for parents to rest and mingle. There were piles of toys and books. The books were organized by ages and categories, and so many of the categories were really powerful and important, like bodies, Jewish, military family, countries like Pakistan, Iran, Korea, and Vietnam, and parents were reading to their kids from seats all over.
THAT’s what this country is and should be about. Teaching our kids about other cultures, learning about ourselves and others, and sharing resources. The place was safe and full of people who cared and weren’t afraid of other people and who understood the value and benefits of the library.
As we left, we checked out at the kiosk, where we were able choose our language to start the process. We chose pirate, because how freaking awesome is it that pirate is an available language at a kiosk? I still get a little choked up thinking about the library. There was so much love in that place. So much intellect and opportunity and community. That’s who we are as people, not this crap on the news every day.
I had the honor of presenting at Nerd Nite Madison in January of 2017. Here’s my talk:
In the world of electronics assembly, parts are really small, quantities are really large, and equipment is really expensive. The process of putting all the components onto circuit boards thousands of times per hour with really high accuracy is challenging, but tools are getting easier and cheaper every day.
At my job (Quietyme), we’re doing our own circuit board assembly. We had to purchase some equipment, like a pick and place, which for $5000 automates the process of taking the small components off of reels and putting the components on the circuit board. We also have a stencil screenprinter and a reflow oven (toaster oven). Total investment so far has been under $6000.
The most recent tool to add to our arsenal is an Automated Optical Inspector. The purpose of the AOI is to examine the circuit board to find defects in the assembly process. Sometimes a component doesn’t solder on correctly, or there is a bridge where there shouldn’t be. These need to be found and fixed before they are programmed and used. We had been doing it manually with just visual inspection, but that was tedious and not very accurate, especially after the 100th board.
I had been reading into OpenCV and decided I’d give it a shot. The idea was to take a regular webcam, point it at the circuit board, do some image analysis to figure out if there were parts that didn’t match a “good” board, and highlight those so that a full inspection by a human wouldn’t be necessary. After a little bit of playing, I realized it could work. I designed a holder and laser cut it out of acrylic, then glued it together. It was pretty slick. With the threaded rod I could raise the camera up until the PCB occupied the entire field of view, so no pixels were wasted. I wanted consistent even bright light, so I added a bunch of white LED strips. I immediately noticed a problem with hot spots, so I added a layer of acrylic with a diffuser (a piece of paper glued to it). Finally, I glued the bottom of the enclosure to the base. The PCB was designed for the enclosure, so it was a perfect holder that would consistently keep it in the same place.
The camera is a 720p Microsoft LifeCam that I had laying around. In the next version I’ll upgrade to a better camera. The LED strips are just 12V white LEDs.
Now the software. I used the OpenCV CV2 python library, and ran it both on my main dev computer (Linux Mint), and my test laptop (Win XP (shut up)). The older computer was definitely slower, and setting up OpenCV in windows is a pain, but I made it work.
The first step is to get the video stream from the camera and display it. Fairly simple. Then I experimented with diffing against a known good board. The idea was that by subtracting the video from a good image, only the differences would be visible. This is good in theory, but it didn’t work at all in practice:
This is way too busy to think about and try to analyze to find poorly placed components. It wasn’t going to work.
The next idea was to mask out anything we didn’t care about. There are unpopulated components on this board, and we don’t care about the silkscreen or the outside edges. There’s no point showing them to the user. So I created a black and white mask:
This mask is displayed over the top of the video stream, so that the operator only has to look at the unmasked parts to evaluate the board. Like so (note that this is an intentionally sabotaged PCB which has bridges, tombstones, and misaligned components that I put in to test the pattern matching):
Great! Now the work is already a lot simpler. From here I wrote a quick routine that would zoom in on the Zigbee chip to digitally and show a 4x zoomed chip to look for bridges. So no pattern matching yet and we’ve already significantly improved the inspection process and reduced eye strain.
The next step was adding in the pattern matching. The idea is to use the OpenCV template matching feature to identify components that are correctly soldered and use those as a template, then when the video stream sees those templates matched it’ll draw a black box over the component indicating that it doesn’t need to be examined. So the above image after pattern matching should look like this:
Bam! Now we’ve gone from having to inspect a full board to just having to check over a few components! In reality it ends up not matching perfectly so we usually see a few extra components that are just fine, but it’s better than having the threshold too low and accidentally blocking out bad joints.
So how does the setup process work? By drawing boxes! In the python application, just drag a box around the component you want to use as a good template, and it will create an image and store it and use it as a template from then on. I started by first looking over the entire video stream for each template, with the idea that a capacitor in one place might look like a capacitor somewhere else. This was a dumb idea and slowed down the system to unusable. Then I got the idea to save the image coordinates as the filename, and only look within a certain bit of slop within that area for that template. That got me back up to near real time processing of the feed. It also allowed me to have multiple good templates for a single component to bump up the likelihood of matching without sacrificing the threshold of matching. So it ends up working pretty well. Here are some examples of component templates:
So to summarize, I’ve put a few hours of time (<20), a webcam, and some hardware into this, and I’ve got a functional AOI to add to our assembly line. It’s really only useful for small circuit boards, and a single camera that doesn’t move definitely has limitations, but it’s really a testament to the awesomeness of OpenCV for making this so easy.
It should be noted that a cheap AOI can be had for $20k, and the ones used in some factories sell for over $100k. Mine is by no means competitive with theirs, and couldn’t find nearly as many types of faults on as large a board. They move the camera around and look at solder quality using colored lights and blah blah blah. But for the price of a webcam, some acrylic, an LED strip, and a few hours of time, this is a pretty big step.
Want the code? Here ya go: AOI Python code
Yep, I haven’t updated in a while. So what happened in the last year?
And now you’re caught up. 🙂
A couple months ago I applied for a program in its first year for hardware startup companies. Called HAXLR8R, the goal of the program is to make manufacturing in China more accessible to startups by providing workspace and tools and mentors and experts to ten teams for three months in Shenzhen. After those three months, the participants spend a week in San Francisco and give a demo to investors.
I found out recently that I was accepted for my project on the Portable Electronic Scoreboard. I’ve been working on this project for a while, and now is a good time to go to China because I need to take it to production, and this is a great way to do it.
Over the next few months I’ll be updating a new blog that I created called Engineer In Shenzhen, which will have personal posts about what I’m going through, and advice and articles for other people who are interested in the process and what it takes to work in China and outsource manufacturing.
If you want a postcard, make sure I have a current address for you. I’ll try to keep everyone updated with progress as I can.
It occurred to me that a lot of people may be out of the loop with what has been and will be happening over the next while. Here’s a short description of the plan:
Erin is going to graduate school in Madison, WI, and I am moving with her.
On July 31 our apartment lease in Richland expired. On August 15 our apartment lease in Madison begins. For the two weeks in between, we are house-sitting for a friend and storing our stuff in their garage. On August 15 we pack everything up again and begin our 3 day trek across the nation, putting us in Madison on the 17th. We’ll live there for a couple years while she gets a Masters in GIS (Geographic Information Systems).
In anticipation of this move and change in lifestyle, I’ve made quite a few changes already. A few days ago I sold my car; its useful life had was ending and was getting to a point where it would need more and more maintenance and repairs. Since I work from home, and Erin will be taking public transportation in Madison, and parking is expensive, it made sense to only keep her car. In January, I left my job at PNNL to start my own business. I was subcontracting back to the lab for a few months after that to retain some stable income as I built up my own business. I am currently freelancing a little (and open to new work if you have leads), but also working on the portable electronic scoreboard and an automated dog-sitting application. When we move I’ll continue working on them; in fact changing my location doesn’t change a thing about how I do my work other than that my office will soon have better windows.
The hazop chapter is drawing to a close and the next adventure begins shortly.
It’s been four months since I started on my own. The first weeks were a whirlwind of applications and registrations, some of which are still in process. I’ve been building up projects, finding my niche, and getting used to and developing my processes.
In the beginning I started by reading a lot of books; everything from business law to marketing to general advice on working from home. I feel like I’m getting an MBA by fire, but the stakes are a lot higher than being in school.
Here’s an overview of what I’ve done in the last four months:
On the other end of the business, I’ve been involved with quite a few projects:
Between learning about and getting used to owning a business, my own projects, and my contract work, I’ve been pretty busy with WYZGYZ. I’m not discouraged, though I have had a couple rough days and some tough decisions to make. Rather, I’m excited that I’m doing this, and I have high hopes for what it will become.
It has been long overdue, but I’ve finally taken a giant step in my career. 1/11/11 was my last day working at Pacific Northwest National Laboratory. I have left to start my own business, and I’m very excited about it. The last few days have been a flurry of paperwork, but I’m making progress and getting to a point where I can finally start talking about it. Assuming all my paperwork goes through in the next couple days, I’ll officially own my startup: WYZGYZ (pronounced ‘wise guys’).
I’ve always had a love/hate relationship with PNNL when I was there. I really appreciated the opportunity to start working on challenging projects and contributing to publications and leading-edge research right out of university. I have many conference and journal papers and presentations, and even a few patent applications through the lab. I’ve gotten the chance to work with influential people at the top of their careers, and travel around the United States to meet and work with dozens of others on some pretty fantastic projects. I’ve learned a lot and become a pretty good software developer. For my first job out of school, the lab was perfect for me.
But there were things that bothered me about the lab; things which ultimately made me decide to leave. First among them was my inability to pursue my personal ideas. It’s ok to own my brain when I’m being paid for it, but there were things I wanted to do that just couldn’t be done while I was an employee at the lab. Second was bureaucracy. Working in a government lab was frustratingly slow, and many times I saw my ideas ground down and starved because they couldn’t get traction or took too long to get funding. The red tape machine is formidable and to me seemed counterproductive to innovation and progress. Finally, there was impact. Over the course of my tenure at the lab, I wrote a lot of software. Much of it was research software that was used for a prototype or a demo, shown to the client, and archived. In the latter half of my tenure I worked on software that did get used, sometimes in some pretty exciting ways, but never beyond a couple hundred users. It seemed like I would never be able to develop a product that could get through all the barriers to find use in the general community and have a meaningful impact on thousands or millions of people. Publications required approvals, and even posting to bulletin boards was regarded with skepticism. For a national resource, it seemed too closed-off.
WYZGYZ is my shot at building a business that has the things I liked about the lab and addresses the things I didn’t like.We’ve also been sponsored by Carlson Knives, so check his products and let us know what you think, .
My company will have three parts: contracting, products, and research. Contracting will allow me to work for clients and generate stable income. Products will allow me to develop my ideas into products that I can market and sell. Research will allow me to explore ideas and either turn them into products or publish them to the community.
Everything is in the very beginning stages, but I have a plan, I have all the resources I need, and I have a lot of hope and motivation and skill to make this work.
This is a shining example of a highly productive Sunday afternoon. I separated the marshmallows out of the cereal. Then I threw away the cereal. Then I ate the marshmallows. That’s a normal sheet of paper to get a sense of scale.
For what it’s worth, the cereal was stale and wasn’t going to get eaten anyway.