Learning through Failure: KiCad Edition

So this isn’t the post I thought I’d be writing tonight. Flushed with success after neatly soldering 66 resistors to a my new PCB last night with the help of my resistor bending guide, I thought I’d be showing some shots of my new LED display board in action. After all, this isn’t the first PCB I’ve designed and had made. It is the second – but the first (subject of an upcoming post) was perfect first time out. So I’m an old pro, right?

Oh well. This is how we learn. After getting all of the connectors and the first 14-segment display soldered on, I thought I’d give it a quick sanity test. And immediately I found several problems. There was a dead pin, multiple segments lighting when only one pin was powered (x2), and in one case, a green segment appearing yellow – a pretty good sign that the segment was getting power that was bypassing the current-limiting resistor. I hopefully scanned my soldering work with a magnifier, looking for solder bridges and bad solder joints. Sadly, my soldering looked great, which meant that the issue was probably the board.

Only, this wasn’t the first problem I’d found with the board. First I noticed that the mounting holes (or “Non-plated through holes”) were too small for the fasteners I’d planned to use. Next, while mounting the LED displays for soldering, I’d discovered that the holes for the 14-segment displays were a little too close together – about 1/20 of an inch. KiCad, amazing, open-source, frustrating KiCad, didn’t have a footprint for the Kingbright display I’m using, so I built my own. I chose not to align one of the pins on the origin, as I needed to model the center-line of the display to ensure the board was aligned with the 7-segment displays correctly, as the 14-segment displays are larger than the 7-segment displays. I modeled the part using the measurements in the datasheet, but this meant that the pins were at an unusual offset from the origin. Apparently I had the spacing grid too large, and so when I checked the distance between pads using the hover/press-space-to-reset-the measuring-tool/hover-over-point-two method, it reported 0.300″ because it was snapping to my grid sizing, even though the pads were not aligned with the visible grid and the actual distance was around 0.256″. When this occurred, I decided to take a page from the “cut it large and kick it into place” school of engineering, and bent the pins a bit and pushed. It worked well enough to proceed, and I made a mental note to fix the footprint in Rev 2.

Which brings us back to the probable trace routing issue I’d found earlier. After (visually) eliminating bad solder joints, I had to suspect my board. Since OSH Park sells boards in sets of 3 copies, I had an unpopulated board at hand. With the multimeter set to continuity (a.k.a “annoying beep”) mode and the board layout on the computer for reference, I started probing, and immediately discovered problems. Like the following.

Note the highlighted traces in each. Don’t look like the belong, do they? That’s because they don’t. Sure I should have caught them, and one of them looks familiar; I thought I’d found and removed it. But I probably got overzealous with the undo button at some point. Also, with a long board (7.5″ x 0.95″) in KiCad, there’s a lot of zooming in and out, and it can be easy to miss small details. However, overlooking small mistakes wasn’t my big mistake, it was forgetting to run DRC – the Design Rule Checker. For all of it’s flaws, KiCad has a built in tool that looks for these kinds of issues. When I ran it today, it found both of the above errors, plus others. In the end, I’ve been unable to fix all of the issues with a hobby knife and hookup wire, so looks like I’ll be designing and ordering Rev 2.

So the big takeaways:

  1. After you’ve finished designing your board in PCBNew (KiCad’s PCB layout tool), run DRC (Tools->DRC->Start DRC), and fix anything you find. Ok, ready to send it to fab? No you aren’t, go run DRC again. Be sure you get a completely clean bill of health before proceeding.
  2. When designing your own footprints, double-and-triple-check your dimensions. These are physical dimensions determining where through-holes or solder pads will be located, so “Measure twice, Cut once” applies. Change the grid spacing to something really small. Use a small mils spacing if your part has pin spacing in fractional inches, as most through-hole parts do. Use a small fractional-mm spacing if your pins are laid out in metric dimensions. Now check them again. You can print out your PCB layout and inspect it that way, even laying parts on it, though this isn’t foolproof- I did just that and still missed the 0.05″ error in my pin spacing.
  3. Mistakes happen. When you fail, spend some time figuring out why. Talk about it with some one (or write about it) and figure out how you can avoid those and similar mistakes in the futures. Then go give it another whirl.

Functional Print – Resistor Bending Guide

Over the past 6 months or so, I’ve started to use Reddit on regular basis. One of my favorite recent finds is the r/functionalprint subreddit, which features practical items made with a 3D printer. Contrast this with r/3dprinting, which features lots of calibration prints, printer upgrades (many themselves 3D printed), hardware and software reviews, folks asking for help, etc. r/3dprinting is a great subreddit with lots of helpful folks, but it’s mostly about the practice of printing, and not about what we print. r/functionalprint, on the other hand, is about useful things made with a 3d printer. It reminds me that having a 3d printer isn’t just about having a 3d printer, it’s about all the things such a device enables.

I’ve had my printer now for nearly a year. It has gotten a fair amount of use, but it has also set unused for months at a time. Often, it has printed its own upgrades parts, or calibration cubes, or other objects focused on making the printer better. But once the printer is all dialed in, then what? Aside from a stretch of playing with 3D printed terrain for tabletop gaming (more on that in the future), I’ve really on focused on the practice of printing, and not the rest.

So here’s something that I designed (Fusion 360) and printed on my Monoprice Maker Select V2 last night:

It’s a Resistor Bending Guide. A what? Well, I’ve recently designed a through-hole Display board PCB for another project (more on that in the future) which I had made at OSH Park. It contains several 14- and 7-segment LED displays, so it needs a number of current-limiting resistors. The ones I spec’ed are quite small, and trying to bend the legs at just the right places to get them to sit nicely on the board was quite a chore, so I designed this as a template for bending them to size. The first one was twice as tall, but the other dimensions weren’t quite right, so I made it shorter for faster prints while iterating; once I had the rest of the dimensions correct, I found that the shorter guide was perfect for pre-trimming the leads to a shorter length before inserting into the PCB. Here are some action shots to show you what I’m talking about.

Tiny little resistors.

The divot in the top of the widget is just the right size to hold the resistor body.

Just fold the legs over to get the correct spacing for the holes on the PCB. The bottom of the tool is a perfect place to trim the leads.

Here’s one that’s been bent and trimmed, and is all ready for the PCB.

And here it is, at home on the PCB. With 66 per board times 2 boards, plus a different display board that will need a similar number, this little tool will save more time than the ~hour it took me to design, print, and iterate it. Quite functional, that.

Finally, here’s a closeup of the design in Fusion 360. The detail is a bit finer than my printer can reliably reproduce, hence some iterating, but it gets the job done.

And now for something completely different

So, it’s been nearly 5 years since I’ve posted here. And even that 2012 post was an outlier. You’ve got to go back about 9 years to find more than 3 posts in a calendar year. But you know what? I hate navel-gazing, why I do-or-don’t blog posts. Things got busy, life moved on, and I had neither the time nor the inclination to write a blog. But i kept it around, checked the oil level and tire pressure from time to time, and figured it’d always be here if I wanted it. And look, here it is. Cool.

Over the past year or so, I’ve found a little more free time, and I’ve had some other interests kindled/rekindled. I’ve been slowly pursuing an interest in electronics, one that started when I was a kid. I purchased a 3D printer and started learning a bit about 3D modeling. I’ve gotten very interested in metalworking, though I’ve had not time or space to pursue that just yet. And I’ve tried to take on some projects just for the sake of having something fun to pursue, while maybe learning something in the bargain. As a result, I’ve been thinking a lot about writing about these projects. And so here we are.

For a while, I was convinced that I wanted a new blog for my electronics/3d-printing/maker-tinker-whatever projects, especially given how old and dated the rest of the content is around here. Maybe a new path under the main jclark.org domain. But I soon realized that I was making excuses not to write, instead of writing. So tonight, while waiting on several iterations of a little 3D-printed tool that I designed to print (more later), I figured out how to log in here again, made sure all the latest software updates are installed, and even moved the whole site to SSL (Free cert from Let’s Encrypt, and dead simple setup via Dreamhost). The design may be a bit dated – this just isn’t how websites look in 2017 – but I built this theme, and I like it, so it stays. At least for now. And I may yet add jclark.org/make or suchlike as an alternate in to some of this content, but maybe I won’t. The point for now is that I’m writing again. So that’s it for the housekeeping, next post is content. I’ve got a few things in progress, and a list of more projects to work on in the future.

P.S. If you are a long-ago reader who just never unsubscribed in your RSS reader (I said “Long ago”!), and you were surprised to hear a voice from the past, thanks for keeping me around/forgetting to unsubscribe. Hope you’ll find whatever I put here worth staying subscribed for a while longer. I still consume a lot of my daily info via RSS (via Feedbin on the big screen and Reeder on iOS) and it’s always a nice surprise to see a long-silent feed come to life. Hope you agree.

Google Chrome does not honor Cookie Blocking for Youtube.com

UPDATE: Chrome will correctly block youtube (and other cookies). Thanks to Mike West at Google for taking the time to leave a comment outlining the fix. The crux of the issue is that a literal pattern like I was using ( youtube.com ) will only match the literal domain “youtube.com”. To match all sub-domains, you need to use a wildcard, although the syntax is non-obvious (to me). The correct pattern is [*.]youtube.com. Interestingly, if you try to use *.youtube.com, the field turns red and you cannot save the pattern, which is what led me to try youtube.com. I have also updated my article on HOWTO prevent youtube from tracking your gmail-credentials.

Here’s the original post:

A few (wow, 10?) months ago, I posted instructions for preventing youtube from tracking your gmail credentials, which amounts to blocking youtube from setting cookies in your browser, and removing any existing youtube cookies. However, I’ve noticed that every so often, youtube once again identifies me by my GMail account, and I have to clear the cookies again, even though I am still blocking all cookies matching “youtube.com”.

I finally decided to investigate, and it appears that Chrome is not honoring my blocked cookies settings at all. Clear all cookies prevents youtube from identifying my GMail account, until I click on a youtube link in an email in GMail, and then the cookie is set and I’m identified until I clear it (don’t log out of youtube, you will be logged out of GMail too). For reference, my Chrome version is currently 20.0.1132.57, and is “Up to date” as of this writing, but I have been having this issue for some time.

Steps to reproduce:

  1. Close any open windows/tabs for youtube.com
  2. Open Settings, Advanced Settings; under Privacy click “Content Settings…”
  3. Click “Content Settings…”
  4. Under Cookies make sure the “allow local data to be set (recommended)” is selected.
  5. Click “Manage exceptions…”
  6. in the box “Add a new hostname pattern”, enter “youtube.com” (without quotes); set the behavior dropdown to “block”, and click ok.
  7. You are returned to the Content Settings dialog; click “All cookies and site data…”
  8. in the “Search Cookies” box (top right), type “youtube” (no quotes).
  9. If the list contains any cookies, click “Remove all”.
  10. Close the cookie dialog, content settings dialog, and the settings tab.
  11. Navigate to youtube.com
  12. Return to settings, advanced settings, content settings, All cookies and site data
  13. Search again for “youtube” (no quotes). You will see cookies from youtube. If you return to youtube and watch some videos, and then search again, you will have more cookies, plus “local storage”.

Just because youtube is a google property is no reason for Chrome to not honor my cookie settings. I don’t know if that is the case; I don’t know if Chrome ignores all cookie blocking settings, but this is a case I discovered and can reproduce. I submitted a bug report (essentially the same as this post) via Chrome’s “report an issue” feature. We’ll see if it gets addressed; I’ll post an update if I hear directly from Google.

HOWTO Prevent YouTube from Tracking your GMail Credentials

Updated 21 Jul 2012 to correct the cookie pattern syntax for Chrome.

I have recently noticed that when I visit a page on youtube, the top-right corner shows that I am logged in by my email address. Because I use Google Apps for Business (neĆ© Google Apps for Domains) to manage my email, and because Google recently insisted I merge all of my Google accounts, I also see a banner at the top of the page warning “This account is managed by jclark.org” with a link for more info.

What this means is that Google can track all of the videos I watch on YouTube and associate them with my GMail account. And I expect that goes for YouTube viedos embedded on other sites as well Because I value my privacy, I don’t want that behavior; that’s the primary reason I have never signed up for a YouTube account. Logging out of YouTube has an undesirable side-effect: I am immediately logged out GMail and Google Reader as well. One solution is to use separate browsers, however, I prefer to run a single browser for efficiency, and viewing any page with an embedded YouTube video in my GMail browser would tack me, even if I then use another browser to view it.

I have found a simple solution: do not allow youtube.com to receive or store cookies on my browser. This also required removing any existing youtube.com cookies already stored by the browser. This has the side effect that I cannot log in to YouTube at all, however, that is acceptable to me since I don’t have, and do not want, a YouTube account.

Here are the steps I took in Chrome:

  1. Close any open youtube.com pages.
  2. Using the wrench icon, open Preferences
  3. In the “Under the Hood” tab, in the Privacy section, click “Content Settings…”
  4. Under Cookies, the current setting should say “Allow local data to be set (recommended),” or possibly “Allow local data to be set for the current session only”. If you have another setting, you probably already take a more active role in managing your cookies, and should not need these directions.
  5. Under Cookies, click “Manage Exceptions…”
  6. Under “Hostname Pattern” type “[*.]youtube.com” (no quotes) and change the Behavior dropdown to “Block”. Close the dialog.
  7. You are returned to “Content Settings”; under Cookies click “All Cookies and Site Data…”
  8. In the search box, type “youtube” (no quotes). The list of sites’ cookies will be filtered to URLs containing “youtube”; in my case, it was all URLs ending in youtube.com. Click “Remove All”.
  9. Close preferences. Browse to YouTube, you should now see a “Sign In” link in the upper right corner. Confirm that you are still logged in to GMail.
  10. Profit! Well, a little more Privacy, at any rate.