Tuesday, August 9, 2022

Programming Tools for the Atmel ATtiny85 and ATmega328P

 


Just about every project I do that requires a micro-controller is powered by either an Atmel Tiny85 or Mega328. The ATmega328 is of course the chip that powered the amazingly popular Arduino Mega, Uno, and Nano boards. Where as the ATtiny85 is what powers cool little boards like the DigiSpark and Adafruit Trinket. The Atmel company was absorbed by the Microchip Technology company in 2016, but the branding for many of Atmel’s chips remain mostly unchanged, though there is some misinformation floating around regarding some of the codes used to identify specific chips.

The biggest issue I see in online reviews, and a few other places, concerns the “P” identifier, such as in the ATmega328P-PU chips used on Arduino boards. The P before the dash indicates it’s a “Pico Power” version meant for low powered circuits, but the P after the dash simply indicates the package type and means “Plastic”. The problem is there are also ATmega328P-U chips used on Arduino boards and available for purchase, leading people to think these were fake because they don’t show up in official Ateml datasheets. The same goes for the ATtiny85-20PU vs ATtiny85-20U, the info AFTER the dash has nothing to do with power, but many people believed the P in 20PU meant “Pico Power”, when in reality it only means “Plastic”, just like on the Mega328.

The issue arose because at some point Microchip decided to drop the package type identifier, meaning the ATmega328P-PU became the ATmega328P-U and the ATtiny85-20PU became the ATtiny85-20U. Just in case you’re wondering, the “U” indicates the operating temperature range of the chip, -40C to +85C. So, the “PU” and “U” chips are all the exact same chip, the ones without the “P” after the dash are simply newer. 

In case you’re wondering, even I was a bit confused at first when I had ordered a couple tubes of both chips before they became almost impossible to find, so I reached out to Microchip and they got back to me explaining everything I just passed onto you. So, if you’re shopping for these chips, I hope this helps clear up any confusion. 

 

Moving on, before I decided to forgo using Arduino Nano units to power all my projects, and just use the chips themselves, I had stocked up on a few sets of Elegoo Nano units (and before prices went crazy), so many of the prototypes you see on here will be powered by those Nano units instead of the chips. When I did make that change, I also had to decide how I was going to write the necessary bootloader and whatever data I wanted to the chips, and that’s what I am covering here. This won't be a tutorial, there are plenty of good ones out there already, this is just a quick overview of the tools I use to get the job done.

 



Starting with the ATtiny85-20U, I decided to keep it simple and ordered a Tiny AVR Programmer from Sparkfun. They are compatible with both the Tiny85 and Tiny45 chips, are convenient USB sticks, and can connect to the chips either via the included socket or via jumper wires directly to your project. It’s fully compatible with the Arduino IDE that I’m already familiar with and works fine in both Windows and Linux (Ubuntu 20.04 in my case). Getting it up and running is incredibly simple and Sparkfun provides full easy to follow instructions on their website to guide you should you need it. I highly suggest reading it!

Learn: https://learn.sparkfun.com/tutorials/tiny-avr-programmer-hookup-guide/

Buy: https://www.sparkfun.com/products/11801 or https://amzn.to/3PbgP7U




Next, I decided to put an extra Arduino Uno I had lying around to use as the programmer for my ATmega328P-U chips. So I ordered a simple DIY "Canaduino" Arduino Shield with a ZIF socket from a company called Universal-Solder, so I could quickly and easily program my chips and put the extra Uno to use. Again, it’s quick and easy to build and get working and I can still use Arduino IDE since all this does is allow you to move the ATmega328P off the Uno and to the ZIF socket.

Buy: https://universal-solder.ca/product/canaduino-zif-socket-arduino-programming-shield/ or https://amzn.to/3dlX6VO

 


Both of these tools allow me to quickly and easily program both the Tiny85 and Mega328 chips I use in almost all of my projects. Doing it this way saves space and money when compared to using an Arduino Nano like I was in the beginning, and gives you more control over your final circuit design.

The ATtiny85-20U and PU, and the ATmega328P, can run between 1.8V and 5.5V. Also, depending on your specific needs and setup, you can run them without a clock crystal. When I use the Arduino Nano, they are all powered using a 9V battery, the Nano's built in regulator steps the voltage down to 5V. When I just use the chips themselves, I can use 2 or 3 AA or AAA batteries, depending on the demands of my circuit as a whole. If my circuit still needs more power, I can use a simple L7805 voltage regulator and a couple smoothing capacitors to supply 5V from a 9V or other battery, depending on my needs. 

If you're going to be programming a lot of ATmega328P or ATtiny85 chips, then I highly recommend one of these tools, or something similar. They made the process easy and save a lot of time.

Thanks for reading!



Friday, August 5, 2022

Retro 2.5" USB SATA Drive Enclosures


My primary forms of data backup and transfer consist of either a flash drive or extra hard drives and SSD’s I have on hand. When it comes to my short term data storage and transfers, I often use external SATA drive enclosures when there are large amounts of data involved, and flash drives or SD cards when the data is smaller or not intended as a long-term backup.

Over the years, I have used a lot of different external drive enclosures, docking stations, and adapters. Eventually, I decided I wanted to add a bit of "retro flare" to the mix by buying enclosures that fit that theme, and these are two of my favorites!

The first is sold on Amazon by a company called “Orico”, who are known for their USB storage and charging products, among other things. I have used other products of theirs in the past with generally good results, and never had any issues with malware/spyware like you run into with some devices coming from China. So, when I ran across their USB 3.0 to SATA 2.5” cassette themed drive enclosure, I decided to pick one up. 

 


Buy: https://amzn.to/3vHI9DR

As you can see from the photos, the clear plastic enclosure is modeled after classic audio cassette tapes and features your standard USB to SATA adapter. It’s a tool-less design where you slide the case open and apart by pushing the two halves in opposite directions. While I prefer enclosures that use screws due to the fact many tool-less designs break much more easily than just using a few screws, I have swapped out 3 different drives and the latching is still as solid as the day I bought it.

The listing boasts support for up to 4TB drives, UASP (USB Attracted SCSI Protocol) and speeds “up to 5Gbps”, but that’s nowhere near reality. 5Gbps is simply the max supported speed of the USB 3.0 standard. I am using this enclosure to host a Toshiba 1TB MQ01ABD SATA hard drive for semi-long term storage of commonly used files.

When you're writing large folders of varying file sizes, speeds can top 130MB/s. Not bad at all. Writing a single 64GB RetroPie image being pulled from my NVMe drive results in a solid 97MB/s sustained write speed. 

FYI: This enclosure shows up as "NS1068". A semi-common USB-SATA Bridge Controller from a company called Norel Systems in Tianjin China. As of this article, the site does not want to load properly for me in FireFox, so I just linked the Google search.

 

So now my 1TB "cassette drive" stores most of my classic console and arcade files, and backup RetroPie images. Something I update once or twice a year. This really is a neat little retro drive enclosure for the price. It does exactly what it’s supposed to do, looks cool doing it, and seems to be made well enough to last. 


For my more immediate storage and transfer needs, I decided to take it back to the 80’s one more time and invest in an awesome little NES cartridge themed drive enclosure from one of my favorite retro companies, RetroFlag! This one is designed to look like an NES cartridge in its sleeve and boasts the same basic specs and any other external enclosures, USB 3.0, UASP, etc. This was intended for use with the RetroFlag NESPi 4 Case, an NES inspired Raspberry Pi 4 case that has a working cartridge slot that allows you to insert and remove 2.5” drives via this enclosure. 

 

Buy: https://amzn.to/3BOev3t

Thankfully, RetroFlag also decided to sell the cartridge enclosures separately, where it fits into the included cartridge sleeve that acts as the drives dock and contains the USB to SATA adapter. The end result is this wicked little enclosure that fits perfectly in any retro enthusiast’s collection. It comes in two cosmetic variants, the “Zelda” gold style that I bought, and the standard “NES” grey. Both are identical in functionality.

This enclosure has a Kingston 120GB A400 SATA SSD and actually writes a bit slower than the  Toshiba HDD does in the Orico cassette enclosure, about 90MB/s for a 64GB RetroPie image file, also being pulled from an NVMe drive. However, writing large folders of varying file sizes can top 300MB/s, go figure. There is a limiting factor here, most likely the SSD's lack of built-in DRAM. Still, plenty fast for my needs. 

FYI: This enclosure shows up as "AS Media Storage Device". AS Media is a well known Asus owned semi-conductor company based in New Taipei Taiwan.

 

The cartridge is held together using two screws, as well as two tabs at the top of the cart similar to actual NES games. With the screws removed, you have to depress the tabs to open the enclosure. I suggest either a small flat-head screwdriver or a plastic pry tool that will fit if you have one on hand, taking care to not scratch the plastic. Again, I wish they had just went with screws instead of a hybrid “tool-less” and screw design. If you plan on doing a lot of drive swaps, the tabs on the top of the cartridge are eventually going to show signs of ware or break, so I suggest keeping the drive swaps to a minimum. Also, there are snaps on the middle right and left inside of the cartridge, so it actually holds together just fine without the two screws if you want to use it 100% tool-less. 

 
 

This is by far the favorite drive enclosure I have ever owned! My next step will be to print up a nice Legend of Zelda label to replace the generic one it comes with! If you’re a retro gaming enthusiast like me, then this RetroFlag NES Drive Enclosure would make a great addition to your toolbox. It’s well built, performs as it’s intended, and looks absolutely fantastic! It makes a great addition to RetroFlag’s collection of classic console themed products. 

 

Updated for test results: 8/10/2022