AtTiny412 General Purpose Blinky Board and UPDI Programming

In the 2020 season of Fab Academy, we are encouraged to use new chips (as opposed to the Attiny 84/85 chips). The new chips the lab got were AtTiny 412. This is a tiny 8-pin chip is pretty neat. Here’s my old design which was an EagleCAD Board file. It is based on Neil’s design for the AtTiny412 (Go here), ctrl+f for Attiny412 and look at his “board” link) board but I moved the LED to Digital Pin 0 (which is PA6 in Atmel speak – pin 2 from the top left) of the chip. My new design used KiCAD and is available here.

Here’s the layout of my board:

BOM:

  • AtTiny412
  • LED
  • 499Ω resistor
  • 4.9kΩ resistor
  • 6-pin SMT header (FTDI)
  • 2x 2×2 SMT header (Optional, general purpose for connecting other stuff to)

Once the board was made I needed a programmer. The new chips use UPDI instead of ISP protocol. There are two easy ways of making a cheap programmer for this. One is simple software but complex hardware (Arduino-based) and the other is simple hardware and complicated software (python upload/downloader). I tried them both to see what I could simplify about them.

First, mill the board. With this, I experimented with a lacquer finish as a soldermask it came out pretty well actually.

Complex hardware, simple software (Arduino):

First I installed the megaTinyCore library into Arduino.

Followed these instructions to make a UDPI programmer out of an arduino. Here’s a board you I designed that you can fab yourself for this project. Simply download the jtag2UDPI sketch to an arduino board to make it a programmer. You’ll need to connect up a 4.7k resistor from Digital Pin 6 to go to the AtTiny412 board to program.  Additionally, if you can’t disconnect the the DTR line from the serial chip to the reset pin of the arduino, just add a large capacitor from the reset pin to ground. The capacitor acts like a tiny battery and when the DTR pin on the FTDI chip drops voltage to 0 to reset the arduino (typically how it works when using the arduino software) the capacitor will keep the voltage high so the jtag2UPDI won’t reset in the middle of trying to program the AtTiny chip.

This is a stupid simple solution that costs very very little. You can get an arduino board for $2 online and add a resistor and capacitor to make it a programmer and you’re done. This is the way to go. The issue is that Fab academy wants you to actually build your own programmer.  I’ll revisit this in another post soon…

Once you’ve built the programmer, change your chip in the Arduino software to the AtTiny412 and change the Programmer to “jtag2UPDI”  then load up Blink example and change the led_pin to pin 0 (if you are using my board design).  When you click program, all should go well.

Simple Hardware Complex Software:

This solution uses just a USB serial chip (FTDI or similar) and only 1 resistor.  No additional arudino required. Neil encouraged in week 2 Instructors meeting to build his FTDI-based UDP programmer and use PyUDPI (See under “hardware” if you search for “UPDI” here). Basically you use a simple USB to serial converter chip (FTDI chip or similar) and all the hard work is done on the software side. The setup for PyUDPI is a lot of overhead when you can just get it working directly in arduino using the jtag2UDPI linked above.

The first board Fab academy recommends is hello.serial-UPDI.FT230X assumes you have an FTDI board. This only provides a resistor and two connectors. One connector accepts the FTDI 6-pin header and the other is the 1 pin and Gnd signal to program the AtTiny. Of course this one is WAY too easy to build…

The second board under “hardware” on that page (hello.USB-UPDI.FT230X)  is an actual FTDI board, exactly like you could buy. The FTDI chip has smaller pin pitch than the ones we typically do in FabLab so he recommended using the heated desoldering iron.

The workflow will be to use Arduino (because why not?) or any other compiler to generate the hex file, then use the PyUDPI python script to send the hex file to the AtTiny chip manually.

Since this used Python 3 and the terminal, I didn’t want to mess around with windows paths and all that disastrous junk. I installed it in an osboxes.org virtualbox linux installation inside my windows machine and tunneled access to the USB device to it.

  1. First install Python 3 (NOT python 2!) if you don’t already have it. Open a terminal and check
    $ python3 --version

    If not installed, then install it:

    $ sudo apt-get update
    $ sudo apt-get install python3.6
  2. Install pip 3  (Tom Dubick says – python since version 3.2 comes with PIP)
  3. Then install the dependencies for PyUPDI with this line
    pip3 install intelhex pylint pyserial
  4. Download and unzip the pyUPDI project from here (Click the “clone or download” green button and download a zip (you need the whole thing so just unzip the whole folder).
  5. Plug in a 3.3v FTDI chip (Convert a 5v version to 3.3 volts shown here)
  6. Open Arduino and load up the blink example. Change the LED pin to 0 since that’s what my board uses. Save the file to the Desktop. Export a compiled Binary from the Sketch menu in Arduino. Sketch—?Export compiled Binary This will save the .hex file in the Arduino project folder. (You saved this to the Desktop like I told you to right?) Otherwise you’ll be digging through temp files to find it.
  7. Open a terminal window inside the pyUDPI folder (or navigate to it). Open a terminal and download to the board using the following command:
    sudo python3 pyupdi.py -d tiny412 -c /dev/ttyUSB0 -b 115200 -f Blink.ino.hex -v

Where /dev/ttyUSB* is the path to the FTDI port and Blink.ino.hex is your file’s name.

Board:

Tweaked the design of Neil’s Blinky board. I changed the pinout of his board to use Pin 0. You can see the pinouts of the new chips:

 

Image source: https://github.com/SpenceKonde/megaTinyCore/blob/master/megaavr/extras/ATtiny_x12.md

Other new chip pinouts available in uncropped image:

Tom Dubick added the following resource which is great as well: https://npk-stn.ru/2019/07/19/simple_programming_attiny414_via_updi/?lang=en

Digital Caliper Power Cable

The worse thing about digital calipers are those stupid-small batteries that don’t last 5 minutes and don’t stay in too well.  Sometimes you lose the battery cover then you’re really screwed.  To find a workable solution to this issue, I googles and saw a bunch of 3D printed solutions for data cables on these calipers.  I decided that I didn’t care much for the data part, but to 3D print a connector just for this seemed a waste of time. Sure, you can find some Dupont connectors to 3D print, but is it worth it? I set about a different way.

I happen to have a large number of servo connector cables from my quadcopters days. It just so happens that one of these female 3-pin dupont connectors fit perfectly in the caliper’s data slot. And if you used male wires, bent them backwards and shoved them in the data connector slot, it holds tight and provides a great connection for the power rails.

First, get a stabby thing and take the dupont connectors off some single-wire connectors (red and black are a good choice for colors).

tools

Capture

Take out all 3 female connectors form a servo cable and shove the male wires on the two ends of the servo connector as shown. Next you want to be careful and bend the male wires around the edge. You have to make sure your orientation is correct for the pins as they need to line up red with the (+) terminal and black with the Gnd otherwise you’ll be making a new cable—ask me how I know…   I did this in 2 stages since the pins are fragile. I slowly bent them against a tabletop to 90 degrees. Assessed their quality and angles and bent the remaining excess to 180 degrees

bend90degrees 

 

When done you should have something that looks like this:

180degrees

 

Plug it into the data port and you should have good connectivity with the power rails. It is a tight interference fit.  final Product

 

I’ve considered adding this to a AAA or AAAA battery pack I could mount on top or the back of the calipers. I’m pretty busy so that might not happen. If it does, I’ll post my janky design here though.

DIY Card Scraper From Old Credit Cards

image Credit card companies such as Chase and  American Express have been adding metal to their cards as a gimmick. I had a few old credit cards that have metal piece inside them. Sometimes when you get a new one, the card company sends you an envelope to return the old ones in for recycling, or they suggest you use tin snips to destroy them.  I found a better use.

In woodworking, many times in order to get a nice smooth surface, you might use a card scraper, which is just a thin steel card with sharp edges. You hold it roughly perpendicular to the surface of the wood and draw along the surface perpendicular to the flat side of the card.  This shaves a very thin layer off the top of the wood.

You could buy some card scrapers, but since I had these extra credit cards, I tried to make some myself. I attempted a few different methods to remove the plastic form both sides of the cards. Firstly, went in brute force and pulled the plastic off both sides. As the edges of these cards are sharp without the plastic, I gave myself a pretty good gash in my thumb. This is not a great method. 

For the second card, I attempted to melt the plastic with acetone…. which didn’t fully work and made a nasty, stinky mess.

The third attempt, I went in the garage and used a little torch to heat up the plastic on the card.  Once I saw that it could work, I stopped.  I recommend doing this completely outside with the garage door shut.  Of course use some pliers to hold the card.  This method could work well, but just be sure not to heat the metal until it changes color. You can then clean off the melted plastic blobs with a flame retardant sacrificial rag.

The end results work great!  I also punched out the tiny SIM card in mine, but you can leave it in. It is potted with clear epoxy so you can see the chip and gold connection wires on the back side if you leave it in which is pretty cool.

Simple Tissue Box DIY Christmas Presents

Each year, Jess and I make crafts as Christmas gifts for family members.  This year, our first idea was too hard (as is typical) but we had another project we had wanted to do as well that worked out great!.

Firstly, we got some wooden Tissue Box covers.

emptyBox

The next step was to get a gel stain. We reused the same stain we used for our ukulele project which goes a long way.

We then used our KNK Zing vinyl cutter to cut a vinyl sticker Jess designed as a template to help up print a design on the boxes.  We placed our clear transfer paper on the box and drew the outside dimensions to help us align the design.

 

tempalte3template

When placing this on the actual box, it helps to hold it up to the light so you can see the edge of the box well.

lightlight2

When we ran out of large pieces, we cut the designs on scrap vinyl and pieced it together on the transfer paper. Here’s an example:

tempalte 4

 

Once we had all the templates set up. We removed the clear transfer vinyl and used a dark gel stain and a foam brush to blot the stencil.

staining

This was left for about an hour to dry until tacky and then we removed the stencils.

weeding

We then left the stain to dry completely overnight.

before

We finished the boxes with a light coat of white gel stain. The trick is to paint it on with the foam brush, then wipe off excess with a nice paper towel (This brand of paper towels are best for these kinds of crafts as they don’t leave any fuzzy mess behind).  Do this technique to all sides of the box, even if they don’t have a stain design.  This gives a rustic whitewashed look that still shows the figure in the wood a bit and evens out the design overall, making it look completely finished and cohesive.

Wipe on:

afterPaint

and wipe off:

wipe

Telescope Counterweights

For some time now I’ve been interested in astrophotography, but my camera hanging off the back of my scope was too heavy for the clutch. The camera just weighted everything down. The solution is to add weights to the tube. You can buy a super expensive kit, but why do that when you can slap together a junky version yourself for much cheaper?

I ordered 24” of Mini T-track  which can fit a 1/4” bolt head.  When it arrived, I measured (by eye) the mini t-track against the side of my scope. I cut it leaving a short piece (which will be used later) and the actual weight section.  I marked the two holes where the screws on the tube were. These are the screws that will hold the t-track to the tube. I actually drilled with two bits.  One just the right size for the screws to pass through, and then I used another larger bit to remove the material from the top of the T-track and countersink the screws a bit. What isn’t shown below is a larger hole made in the top of the T-track so that I can easily add or remove weights without having to take the track off the tube.

rail1

I unscrewed the two bolts from my scope tube along the bottom. The whole time praying I don’t get any nasties in the tube during this escapade…

scopeHOle

As for the weights, I used some 2” long 1/4” bolts and a 100 pack of 1.5” fender washers as weights.

I honestly didn’t count or measure the weights out, I just made a couple larger stacks of washers and a couple shorter ones. I used standard 1/4″ nuts as lock nuts to hold them on, though I wish I would have sprung for a cheap T-track knob set like this one which would make them easier to move around with one hand while I’m aiming and wrestling with the scope..

weights1

That little left-over piece of T track was great for a top-mount for a camera. I drilled a hole in the middle for the tube screw and added a great little folding tilt mount for a camera.

top1

I used a really short 1” long 1/4” bolt to mount it.

top2        top3

Now I can put a camera on top as well as having a camera at prime focus of the scope. This can be used as a guide camera with a tracking program like PHD2 or another DSLR to take some additional wider-angled and less zoomed pics.

UPDATE: to make the weights not look so janky, I added thumbknobs and 3d printed black plastic sleeves for them. You can find the 3d printer files here to make them yourself.