Electronics Bash – Arduino #11 – Making it Permanent

So you’ve made a cool thing with an Arduino Uno that works fine on the workbench. But when you try to install it somewhere for long term use – wires start falling out, components come out of the breadboard, it’s a big ole mess. There must be a better way to make Arduino projects more permanent.

This week’s stream will continue our look at Arduino, the most popular microcontroller on the planet. We’ll focus on ways of turning a transitory and experimental Arduino project into a more permanent installation, including:

  • Working with sodler-able perfboard/protoboard
  • Transferring the Microprocessor itself from the Arduino to a breadboard/protoboard
  • Programming microprocessors without the Arduino itself
  • Working with smaller/cheaper microprocessors (ATMEGA, ATTINY) to cut down pricing on large-scale projects

This is the space where I’ll be posting code samples and circuit layouts sometime in advance of the stream, for those who want to follow along more directly. You can expect the code and formatting here to change up to a couple hours before the stream as the plan for the evening comes together.

Materials

This week’s episode will involve programming several microcontroller chips outside of the Arduino itself. If you’re looking to purchase some of the these chips (and the other supporting materials), you have a couple options of where to purchase. Amazon, of course, is ubiquitious but there are relatively few options available, it’s typically more expensive per unit, and you run the risk of counterfit chips. DigiKey, an online electronics catalog, is much better populated and usually cheaper per unit price, but you will pay for shipping (usually $5 flat rate USPS works fine for ICs). You can choose which is better for you.

Micrcontrollers

These are the brains of the operation – literally. They are the heart and sole of the Arduino, the chip that you write your code to and that carries the program forward. The first chip in the list is exactly what’s on, say, an Arduino Uno – the others are variants in size/scope/price.

I should say – there are lots of lots of different microcontrollers in the ATtiny family and ATmega family – this is just a (semi)representative sampling based on a few different IC sizes/scopes.

ATmega328P-PU

ATMEGA328P-PU Microchip Technology | ATMEGA328P-PU-ND DigiKey Electronics

This is literally the exact chip that’s present on the Arduino Uno, and can be

turned into a breadboard equivalent by moving the chip off the Uno. Note that the Amazon chips come pre-loaded with the bootloader, which isn’t really necessary – we’ll be looking at how to load the bootloader onto the chips ourselves. (The bootloader is a tiny bit of code that helps the Arduino IDE load code onto the Chip.)

Amazon: $13.97 for 4 or $29.98 for 10 (bootloader pre-loaded)
Digikey: $1.90 each

ATtiny44a

ATTINY44A-PU Microchip Technology | ATTINY44A-PU-ND DigiKey Electronics

Somewhat more compact that than the ATMEGA but still with 12 General Purpose Input/Output (GPIO) pins, these is a nice step down in price and complexity from a full ATmega328. Useful in cases where you’re doing some heavy lifting, but down need, say, a full 32K of program space.

Amazon: $20 for 5
Digikey: $1.11 each

ATtiny85-20PU

ATTINY85-20PU Microchip Technology | ATTINY85-20PU-ND DigiKey Electronics

Now we’re getting really small – this guy comes in a DIP-8 package less than 1/2″ wide and long, though with only 8 pins, it’s I/O capabilities are of course somewhat limited.

Amazon: $10.35 for 5
Digikey: $1.20 each

ATtiny13

The cheapest of the lot of the lot – comes in an 8-pin DIP package less than 1/2″ wide and long. It’s capabilities (clock speed, program storage, flash memory, long-term EEPROM storage) are quite small compared to the AMTEGA328 we’re used to, but if price-per-unit is a serious concern, you can push it way down by using something that just barely fills your needs

Amazon: $19.50 for 20
Digikey: $0.82 Each

Ancillaries

Crystal Oscillator

9B-16.000MBBK-B TXC CORPORATION | 887-2015-ND DigiKey Electronics

For any of the ATtiny options, we can run our processors either from the an internal oscillator or an external crystal. For the ATmega328, in order to respond appropriately to the Arduino bootloader, we’ll need to have a 16Mhz crystal oscillator present, with a pair of 22pF capacitors that help the crystal to oscillate. Thankfully, both of these parts are really inexpensive:

Crystal:

Amazon: $4.27 for 10 or $7.60 for 20
Digikey: $0.30 each or $2.50 for 10

Capacitors:

C317C220J2G5TA KEMET | 399-4220-ND DigiKey Electronics

Amazon: If you’re going to buy discrete capacitors from Amazon, I think this is a great opportunity to buy yourself an inexpensive capacitor assortmentit will have lots of uses and opportunities for experimentation. Here’s a kit that’s $5.99 for 300 pcs
Digikey: $1.26 for 10 or $6.38 for 100

Smoothing Capacitors

UVR1V100MDD Nichicon | 493-1077-ND DigiKey Electronics

While not strictly necessary, as we’ve discussed in previous episodes, having a (fairly) large capacitor near the point where your circuit is consuming power can help smooth over gaps in the power supply when your circuit asks for a lot of current. Like I say, if this is just for a lark, don’t worry too much about this, but if you’re interested in pursuing the idea of moving Arduinos into the world (or honestly, if you’re interested in circuitry in general) this is a good excuse to buy an inexpensive electrolytic capacitor assortment – here’s one that’s $10.31 for 240pcs.

Can i just use the capacitor assortment I bought for the crystals? Unfortunately no – you’ll notice that the crystal-related capictors have values in the picofarad (pF) range, and the electrolytics are in the microfarad range (μF) – 1,000,000 times larger! They serve two different purposes in our circuitry, and so are of two massively different scales.

Power

NCP7805CTG Rochester Electronics, LLC | 2156-NCP7805CTG-ON-ND DigiKey Electronics

In our examples together, we’ll be using one of our existing Arduino Unos to provide power to our off-board microprocessors at 5V, but as we discussed two weeks ago in the Batteries episode, sometimes you’ll need a voltage regulator to provide 5V power to your device in you’re moving it out into the real world. (You could, of course, also power it directly from a 5V power brick) The 7805 is most basic example:

Amazon: $6.99 for 15
Digikey: $0.25 Each

Code

The following pieces of code will make use of this circuit

Expository writing goes here

Code heading

And some more details about some code to come.

Show Code