Programming the Aus3D Z-Probe (Part 1)

One of the more interesting components in the Mark2 3D Printer is the Z probe, an IR probe designed to precisely measure the height of the bed for automatic bed-levelling.

This is the first product that I’ve been shipping that I’ve needed to program and test, and I’ve had some fun along the way trying to make the process faster.

The Z probe is built around an AVR ATtiny45, which can be programmed in-circuit through the SPI pins. If you’ve programmed an AVR before, or even an Arduino without a USB interface, you’re probably familiar with this setup.

ISP footprint as shown on the right. Image borrowed from SparkFun (don’t hurt me!)

I broke the pins out to a 3×2 header on the underside of the PCB, in the layout shown above. However, I decided not to go with standard pin headers for two reasons:

Firstly, they take up a fair amount of space. The Z probe is a relatively small PCB – I didn’t want to take up half of it with programming pins that would only be used once.

Secondly, my goal was that programming should be as quick as possible. While regular .1″ header pins would allow for a solid and reliable connection, having to plug and unplug them for each board being programmed was not something I wanted to do.

I did use regular .1″ headers on the prototype Z probe boards. I only assembled a half-dozen, and I had to repeatedly upload the firmware as I was getting everything tweaked and configured anyway. For a shipping product I was keen on something faster though.

Prototype Z Probe PCB
Prototype Z Probe PCB, with ISP header visible (and taking up a bit of space)

I recalled tutorials I’d seen from both SparkFun and Adafruit on how they often use pogo-pin test jigs for boards they need to program or test in bulk. This was my long-term goal, to have a process similar to this that I could use to quickly program these boards.

Pogo pins might let me use just pads on one side of the board, instead of the through-hole pads needed for pin headers.

Short-term, I need an easier way to program the board without developing a test-jig. Eventually I ran across the SparkFun ISP Pogo-pin adaptor, which looked like a good hand-held option to get me up and running.

sparkfunpogo

I played around with the pad layout for a while, and after a while I realised I needed at least a few of the pads to be through-hole, so that they’d keep the pogo-pins centred during programming.

I also decided that since I like a challenge, I’d put the ISP pads underneath the ATtiny45. The fact that this would make the board more compact may have also factored into my decision making, but I like to think it was the challenge thing.

zprobeisp

Playing around with it, I was able to leave all but two of the pads as through-hole, which should ensure that the pogo-pins stay pretty well centred. The holes are only 0.6mm diameter, so you’re not putting pin headers in there or anything like that – but it should be large enough to guide the pogo-pins.

The ISP pads being right underneath the IC also meant that routing the traces was a quick and easy job, and none of them have far to travel – which was nice.

I had the pre-production prototypes made up with this design, and it turned out looking pretty good:

Back of the finished Z probes. Programming pads are visible.
Back of the finished Z probes. Programming pads are visible.

This keeps the top of the board clean, and allowed the overall size of the device to stay where I wanted it to be.

No programming pads in sight. Excellent.
No programming pads in sight. Excellent.

Of course, now I had to actually try and program the boards. I assembled and used the SparkFun pogo pin adaptor, and it did it’s job really well. The only tricky thing was finding a way to hold the board in place, as the large electrolytic capacitor made it practically impossible to rest the board flat on a desk during programming.

The probe wants to run away, and I don't really blame it.
The probe wants to run away, and I don’t really blame it.

The quickest and easiest solution (for someone with a 3D printer anyway) was to print a small jig to hold the board in place during programming. Nothing fancy, just something that it would fit into and not have room to move around.

Programming Jig MK1
Programming Jig MK1

The probe sits comfortably and doesn’t wiggle around, the three contact points (two screw holes + capacitor) fixing it solidly in place. I included holes to mount the printed part to a block of wood in case it needed some weight to make it more useful, but I never found that to be necessary.

Suddenly, programming was much easier.
Suddenly, programming was much easier.

This jig helped things a lot, and I used this setup to program the first batch of boards we had. I kept thinking there were better options though, and I couldn’t get the test jigs used by Adafruit and SparkFun out of my head.

Eventually, my desire for an over-engineered system got the better of me, and another solution was born. Read on in Part 2!

Leave a Reply

Your email address will not be published. Required fields are marked *