PCB Design with KiCAD

It is pretty incredible that you can find a written or1 video tutorial on virtually any topic to learn anything.  Today, I’m particularly thankful to Shawn Hymel, Sparkfun, and Digi-Key for putting together their Intro to KiCAD video series on printed circuit board design.

This series took me from knowing nothing at all about PCB layout and design to ordering my very first board through OSHPark.  My first design isn’t anything amazing – it was basically a breakout board for an ATTiny85 to make it easier to build small projects. 

My first ATTiny hacked tap light was a mess.  I soldered wires directly to the microcontroller making it a real pain to update. ((I ask you – is this the work of a sane man?)) I soon realized my mistake and soldered an 8-pin socket in its place so I could reprogram the chip easily.

This is the alternative to a custom PCB – a rat’s nest of wires soldered to a chip

Mercifully, Shawn’s tutorial series got me up and running very quickly.  This post is not meant to be a tutorial for KiCAD, but more like a “lab notebook” for the workflow to create a board.  If you haven’t built a board yet, go check out Shawn’s series and follow along in KiCAD.  If you are a novice like me, you might find these notes helpful:

Eeschema

  • If you launch Eeschema separately from KiCAD, you can save different versions of a schematic.  Keeping old versions of design files is hugely helpful to me and if you launch KiCAD directly, the option to save different file names and versions is not available!
  • The keyboard shortcuts in Eeschema are great.  With just a few, it’s possible to really get around quickly.
    • “Shift-A” and left click to place parts 
    • “M” to move parts
    • “R” to rotate parts
  • It is necessary to add “PWR_FLAG” to both the power and ground lines.
  • Double check your connections work by clicking on the bug icon. 
  • Assign the parts you intend to use to match up with the symbols using the “Assign PCB footprints” icon.
  • Save your work and “Generate netlist” to have something the Pcbnew will be able to work with.

Pcbnew

  • First configure the Design Rules by going to Setup -> Design Rules.  Shawn pulled these KiCAD Design Rules from the OSHPark.com website.  KiCAD has apparently changed a little since the version used on the OSHPark website, but the settings are easy enough to identify and change.
    • Net Classes Editor
      • Clearance: 0.01.  Track Width: 0.01.  Via Dia: 0.03.  Via Drill: 0.015.  uVia Dia: 0.03.  uVia Drill: 0.015.  Diff Pair Width: default.  Diff Pair Gap: default.
      Global Design Rules
      • Minimum track width: 0.006.  Minimum via diameter: 0.027.  Minimum via drill: 0.013Custom Track Widths: Track 1: 0.03
  • Read netlist” to bring your design over from Eeschema.
  • Placing parts and drawing lines gets a lot easier when you fine tune the Grid.  I started with 5.00 mils at first, then smaller figures to place smaller parts and features.
  • Once the parts are arranged in Pcbnew, connect the ground and power lines using 30 mil traces and everything else using 10 mil traces.
  • Create the outline for the board cutout by clicking on “Edge.Cuts” and drawing with the “Add graphic lines” tool.  Starting with my second board, I began cutting the corners off, so that they were a little nicer to hold and 
  • Label things on the “F.SilkS” and “B.SilkS” layers using the “Add text”‘ button.  Since my boards are so small, I wanted the text to be a fair bit smaller than the default settings.  I edited the text settings by going to Setup -> Text and Drawings.  
    • Copper text thickness:  0.007.  Text height:  0.035.  Text width:  0.035.
  • Create a copper pour with Place -> Zone, then choose “F.Cu”2 and “GND”.3 and draw a box around your board.  Then repeat for the “B.Cu” and “GND.”

Again, I’m a total newbie at circuit design.  If I got something wildly wrong, please let me know.  :)

  1. More frequently these days []
  2. Front copper []
  3. Ground, natch []

Regex: Back reference and Self reference in Regular Expressions

This is going to be a very short and niche post.

Sometimes I have to use regular expression or “regex” searches to parse a bunch of text, but I can’t remember how to use the search function to find a particular sequence of character and then reuse those found characters in the text I’m trying to replace it with.  In Notepad++, this would be done as follows:

  • Search string:   (7//*[0-9]*[0-9])\r\n
    • This will find all entries with “7/3” or “7/14” or similar digits with a line return afterwards
  • Replace string:  \1/2018;
    • This will replace those entries with “7/3/2018;” and “7/14/2018;”, respectively

The trick here is that the first set of search information is collected together within a set of parenthesis, which are then referenced back by the “\1”.  If you forget the parenthesis, the “\1” term won’t “know” what it’s supposed to be repeating.

Like I said, very niche.

[SOLVED] Google Pixel stuck in a boot loop after update and full storage

If your Google Pixel is stuck displaying the “G” and forever looping through a boot screen, Google’s support will tell you there is no hope and you’ll either have to do a complete factory reset and data wipe of your phone or send it in so they can do it for you.  However, if you are adventurous or have nothing to lose, there may still be hope.

I’m not saying this will work for you, or that you should even try what worked for me.  But, if you’re as desperate as I was, you would try absolutely anything to get your photos back.1

While out of town on vacation, away from WiFi and cell carrier internet access, I took a lot of photos and a few short videos.  My phone, a lowly Google Pixel with just 32GB2 of storage ran out of space.  It claimed it was at “100%” usage of storage with only a few dozen megabytes of space left.  I leaped into action, right there on the beach, deleting some large documents and ZIP files I had downloaded and then asked the Google Photos app to “Free Up Space.”  Pats on the back!  Job well done!

Except the Pixel had other ideas.  I reached into my pocket later to pull out the phone and take a picture to discover that it was on the white boot screen with the colorful Google “G” logo and a light gray “progress” bar undulating underneath it.  I thought this might be due to the phone overheat and put the phone away.  When I pulled it out later, I found the phone was still showing the same white boot screen.  I don’t know what caused this problem.  I don’t know if it was the Android system update from a few days ago, the storage being mostly full, possibly being too warm from being in my pocket, or what.

I tried everything I could think of and everything I could find to no avail:

  • I was unable to boot the phone into anything resembling active status, not even the last measure of “Safe Mode.”
  • I could boot the phone into “Recovery Mode” which looks like the Google Android robot lying on its back with a front panel open and some text underneath.  However, attempts to “Start”, “Reboot”, and use “Recovery Mode” were all unsuccessful.
  • I tried following the recommendations of the mysterious “Techno Bill” on the Pixel Google Groups to install ADB and Fastboot and then apply a Rescue OTA to the Pixel.
    • If nothing else, this one possibility gave me hope that I could still interact with my phone, somewhat.  I was careful to try out the specific OTA3 for my phone.  As you navigate the various menus in the Recovery screens for Android, you’ll need to take note of the version of Android you’ve got – so you can place the same version over it.
    • As best as I understand this fix, you’re basically overwriting a possibly damaged or corrupted operating system with a shiny new factory fresh version – and that doing so leaves your data intact.
  • The thing that gave me the most hope was this post by Mac_DG on Reddit.  Basically, they said, “If you can get there [the Google recovery screen], and it’s a software problem everything is fixable.”
  • I even spent 43 minutes4 chatting5 with Google’s Pixel support team member, Marlene.  She was sympathetic, but assured me in no uncertain terms that my data was lost forever.  My options were to send my phone to Google or take it to a repair facility for a diagnostic.

Finally, after much searching, I found this thread on Google’s product forum where someone named Jintoku described an identical problem to mine – and someone named Kara Alexander described an identical problem … and a solution suggested by Samuel Cooksey!  If you think you’ve got the same problem – nearly full storage, frozen or looping “G” screen, and unable to enter Safe Mode, it is absolutely worth your time scrolling through this thread to see if this solution may work for you.  It is also worthwhile reading through Jintoku’s conversation with Google’s representatives to see how hard they tried not to do a factory reset on the phone – and just how certain the Google representative was that this was the only possible solution short of outright replacement of the phone.

I will not duplicate the efforts of Techno Bill, Jintoku, Kara Alexander, Samuel Cooksey, and Mac_DG by repeating everything they’ve already said.  Rather, you may use any of the above links from my search to follow along and, hopefully, set you on the correct path.  If you would prefer a condensed guide, with links, I hope this will help:

  1. Follow Techno Bill’s guide on installing ADB and Fastboot.
    1. If you’re on Windows, you either need to follow Techno Bill’s guide on updating your computer’s “Path” or, if you’re a little more comfortable doing so, you can skip steps 1-8 and instead open the command prompt and type
      1. “SET PATH=%PATH%;c:\adb”
      2. The benefit of doing it this way is that you don’t have to permanently add this path to your operating system, it’s a lot faster and easier than Techno Bill’s method, and you don’t have to restart your computer
  2. Download the Developer Beta Preview OTA for your phone6 .
    1. It almost goes without saying that with words like “Developer”, “Beta”, and “Preview” in the title, this version of the Android operating system isn’t for the faint of heart.  If you don’t know what you’re doing or, like me, don’t have anything to lose, you shouldn’t be trying this.
  3. Follow Techno Bill’s guide to “sideload” the Rescue OTA to the Pixel.

If this blog post, that I write as my phone is running the Photos application right now to back up my vacation photos, saves even one person’s data, I will be an incredibly happy person.

  1. After all, what’s the worst damage I could do?  In a worst case scenario, the phone would still be unresponsive or bricked permanently []
  2. !!! []
  3. I believe this refers to an “over the air” operating system update []
  4. I was emailed the chat logs after the session ended []
  5. Since I had no phone, natch []
  6. Pixel, Pixel XL, Pixel 2, Pixel 2 XL []

How to Back Up Files from Google Drive with a Supervised User

Google, why have you failed me?
Google, why have you failed me?

Google suddenly discontinued/crippled their Google Supervised User program in January of 2018.  This was a fantastic program which allowed parents to set up a Google account for a child on a Chromebook and monitor and control access to the internet.  Unfortunately, the “manage user page” redirects you a page “Supervised Users can’t be created or edited.”  Sure, there’s Google Family Link – but that only works for Android and mobile devices.

This means the Chromebook we bought for our daughter and which she’s been using for about a year now, is borderline useless.  How useless?

Imagine using a modern computer (or even a phone or tablet!) without the ability to copy, cut and paste.  No being able to visit any new sites, since I can’t edit her access to whitelist the website.  You can’t copy, move, or drag-and-drop the files from Google Drive to the internal microSD card or a flash drive.

And, as I discovered today, no being able to download files out of the Supervised User’s Google Drive account, since Google’s ability to zip the files is crippled.1  Since my daughter’s account had hundreds of files, it was beginning to look like my only option was to download each file individually, one after the other.

If you find yourself in a similar predicament, here’s how you can back up your Supervised User’s account out of Google Drive:

  1. Create a new empty folder with a catchy name like “20180528 Backup”
  2. Select all other files in their Google Drive
  3. Tap the trackpad with two fingers2 and select “Move”
  4. Move all the files into your newly created folder
  5. Select the newly created folder
  6. Tap the trackpad with two fingers3 and select “Share”
  7. Share that folder from the Supervised User with yourself (probably by typing in your email)4
  8. Open up Google Drive in your web browser on a completely different, non-Chromebook device
  9. Click on the icon that looks like two people and is labeled, “Shared with me”
  10. You should see the previously named folder under the documents recently shared with you
  11. Right click on the folder and click on “Download.”  It will take some time as Google zips the folder and all the documents in all the sub-folders into a file
  12. When prompted, save the file to your computer

I got through this with the usual trial and error.  I really hope it’s helpful to someone else some day.

  1. You can download a single file at a time – but not more than one at a time []
  2. This is the Chromebook version of a “right click” []
  3. Again, the Chromebook “right click” []
  4. You may get a warning that you won’t receive a confirmation email – don’t worry about it []

ProfileMaker thoughts…

Looking at Dave’s Profileinator seems really well suited to a stepper extruder.  However, he also suggests adding a “Flow Fudge Factor.”  I just use this set to 1.0, so I’m not sure if I’m using it correctly.

Flow Fudge Factor: I have to enter 1.0 into the flow rate to get 2.0 RPMs on the extruder.. I got tired of doing this math so I added flow fudge factor and set it to 0.5. This doesn’t change the volume calculations – it just modifies the flow rate on the table. If you have a MK4/MK5 extruder with a DC motor, start this at 127.5 to get the PWM value to use

In any case, it looks like by multiplying it by 127.5 you can get the required flowrate for a DC motor.  In printing with a DC motor, I never wanted to drop the speed below 255, because the DC motor had such a small range of speeds.  I could print between about 230 – 255.  Given this, I can understand why so many others, probably using a DC motor, would rather pick their flowrate as 255 and then determine the proper feedrates.

ReplicatorG v0023 error

“This should never happen, deltaX in addValueSegmentToPixelTable in euclidean is 0.”

And, really, this is just one of MANY such errors.

Also, Marty was kind enough to slice it up in Zaggo’s Pleasant 3D software.  He took a look at the OpenSCAD code and didn’t see anything nasty in there.

I dunno.  Do you?

Argh.

I spent WAY too long this morning working on a post here…  got ready to hit print…  and was told by WordPress the post no longer existed.  Even better?  Every post and page on the entire site was gone.  Even better?  MySQL said the posts table had crashed.

I use a plugin that backs up this website regularly, so it wouldn’t have been tragic – just painful.  However the post I spent the morning working on was totally gone.  I was able to repair the posts table using the MySQL repair function, but that post was GONE.

That sucks.

Chess set: 1/4 complete

I’ve been working on printing a chess set today.

Yesterday I was troubleshooting my automated build platform.  I could use it reasonably well as a heated build platform, but the automated part was not working so well.  The main issues I was having were the thermistor only registered 255, the automated build platform only ran backwards1 , and the extrusion would not stick to the conveyor belt.

Believe me, some of these issues were incredibly dumb.  No worries, I’ll fill you in on the extent of my ignorance soon enough.  It’s not like I’ve got a finite supply, right?

I took out the automated build platform conveyor belt – and lost one of the little plastic bushings in the process.  I’m pretty sure I can rig a serviceable facsimile, but my printer has been down so much lately that I just want to actually PRINT things.  I’ll work on fixing up the automated build platform and troubleshooting it later.

So far I have, in black ABS, 8x pawns, 2x knights, 2x rooks, and am in the process of printing a bishop right now.  (I know that’s more than 1/4 of the way done – but I was 1/4 of the way when I started this post).

Default Series Title

  1. WTF? []

Working on my automated build platform

I had some technical trouble with my automated build platform today.  (Yesterday?  Last night?  It all blurs.  :) )

I’ve fixed some problems and found others.

Right now I think there may be a slight kink in my filament spindle box.  The extruder motor kept running but no plastic came out in one build job.  I can successfully print using the ABP as a heated build platform – but it is only really successful with single print tasks.  More than that and it screws up the raft.

I’m tempted to lightly sand the automated build platform belt to see if that helps.  If not, a friend suggested using blue painter’s tape on the platform.  I’ll try the tape first tomorrow.