This article explains how to use the Arduino toolchain to program microcontrollers from the Arduino IDE using their bootloaders, and also burning bootloaders directly onto bare microcontroller chips. It covers developing interactively with Forth (rapid prototyping), and moving your creations from a development board (Nano, Uno) to a standalone, low-cost, low-power, small footprint chip such as the ATMega328P or ATTiny85 or ATTiny84. Each of these microcontrollers is powerful, inexpensive, and allows using 3V batteries directly without the need to boost voltage to 5V. Additionally, we describe how to build an inexpensive (under £5), standalone 3-chip Atmel AVR universal bootloading programmer that you can use to program all of the chips above.
To see what you can do with microcontrollers, check out the gallery here and here.
Our preferred microcontrollers
When building embedded projects, I typically use one of the following:
(1) Arduino Nano, a breadboard friendly 30-pin board built around the Atmega328P microcontroller, (2) Atmega328P, standalone 8-bit low power (3mA) microcontroller IC (P stands for PicoPower), and (3) Attiny85/84 which are standalone 8-bit low power (1mA) microcontrollers.
The Arduino Nano is an excellent 8-bit microcontroller for developing embedded applications. It is reasonable cost and power consumption (£3.70 ea, 19mA), is easy to program (Arduino IDE via USB serial connection, or via SPI 6-pin header), supports interactive tethered software development from PC over USB using 3-instruction Forth, is versatile (has digital I/O, analog IN, PWM analog OUT, can generate tones), has 18 I/O lines and several built-in communication protocols (asynchronous Serial UART, synchronous serial I2C and SPI).
Once your code is stable and you no longer require tethered software development, it is more economical to drop the finished code into the standalone 28-pin Atmega328P IC (c.50% cheaper at £1.95 and 80% lower power consumption at 4mA). Best part is that the code you’ve written for the Nano needs no modification to port to the standalone Atmega 328P, since it is the same microcontroller at the core of Arduino Nano and Uno boards.
For an even smaller footprint, you can drop down to the truly tiny 8-pin Attiny85 IC (£1.50ea, 3mA power), provided you can manage with 5 or fewer I/O pins.
This is probably as cheap/small as you can go with hobbyist-friendly microcontrollers (easy to program with low fixed cost investments, I’ve assembled a £5 three-chip programmer that works for any of Atmega328P, ATtiny84, and ATtiny85 using Arduino interface).
To get cheaper than this, you’re into the territory of chips that require special hardware to program and custom toolchains (see Appendix).
Choosing a Microcontroller | Top Microcontrollers
History: Microcontrollers | Atmel | AVR family of uCs | Microchip’s acquisition of Atmel (2016) | Atmega 8-bit uCs | Atmega328 | Arduino
Examples of what can be accomplished, and supply links to try it out:
- Experimenting with Microcontrollers, an Arduino development kit for under £10 – covering applications for the Arduino Nano and ATtiny85.
- Making Sensors Talk for Under £5.
- Microcontroller & Sensor supply list
Building a £5 Atmel AVR bootloading programmer
This inexpensive programmer design has three independent channels each with a DIP socket and 6-pin ISP programming header required to directly program a particular Atmel AVR microcontroller: from left to right: Atmega328P (DIP-28) which is used in Arduino Uno/Nano single-board uC systems, ATtiny84 (DIP-14), and ATtiny85 (DIP-8). A custom 6-pin cable connects the desired channel to an Arduino Nano running the ArduinoISP code which turns it into an in-system programmer (ISP).
User connects the bootload programmer to Arduino IDE via USB. The Arduino IDE is used to program the chips, i.e. to write compiled code to the target chip. The 3-chip programmer is easy to assemble on a 4cm x 6cm PCB and uses less than a dozen through-hole components. Total parts cost, including the Nano, is c.£5. If interested, ask in the comments.
Usage as an ISP Bootloader/Programmer:
- Insert desired chip into matching socket.
- Move ISP header cable to corresponding 6-pin header, keeping pin1 (purple) in position (top left).
- Apply power to Nano via USB mini cable.
- Load code (sketch, .INO) into Arduino Studio IDE (best to have pretested the code with a separate Arduino Nano).
- If code is for ATtiny, make the relevant modifications going from Nano to Tiny pin numbers if any (see below).
- Select Tools > Programmer > “Arduino as ISP”. IMPORTANT! This is Arduino AS ISP not ArduinoISP.
- If target uC is Atmega328P with desired timing to match the Nano/Uno, select Tools > Boards > “Arduino Uno. (You will need to deploy the ATmega328P with a 16MHz external crystal oscillator and 2x 22pF caps.)
- If target uC is Atmega328P and if ok that timing will be half as fast, then select Tools > Boards > “Atmega328P on a breadboard (8MHz internal clock)”.
- If target uC is ATtiny, select Tools > Boards > “Attiny” and Tools > Processor > “Attiny84 or Attiny85” and Tools > Clock > 1 MHz or 8MHz or 16MHz.
- IMPORTANT: Always burn a bootloader first before uploading the Sketch, to ensure that the chip’s timing fuses and other operating parameters are set correctly. Tools > Burn Bootloader….
- IMPORTANT: To upload the program, select Sketch > Upload using Programmer (Ctrl+Shift+U).
- Program should upload successfully.
- Disconnect the USB power and then remove chip carefully from socket (use a flathead screwdriver) and install onto breadboard or PCB.
- Consult the relevant pinout diagram to make the correct connections. Add in any additional components such as caps and crystal oscillator.
- Test!
1. Programming the Nano board
Arduino Nano can be most easily programmed from Windows PC using usb-mini cable (note there are now usb-micro and usb-type-c variants) and the Arduino IDE. Programming is done in C modified with Arduino specific functions, or 3-instruction Forth that uses a serial umbilical to connect a host Forth (GForth) to the Arduino, permitting interactive remote development on the target Nano chip.
Programming Arduino Nano from Arduino IDE:
- Tools > Board > Arduino Nano
- Tools > Processor > ATmega328P (Old Bootloader) – Try the Old Bootloader first. Most of the Nano clones that you can buy inexpensively have this burned into them by default. If it doesn’t work try the standard ATmega328P processor choice. Note, the P at the end of the chip name stands for PicoPower, i.e. ultra-low power functionality.
- Select the correct Serial COM port in which the mini cable is plugged into.
- Write your program (Arduino calls this a sketch) in the IDE editor (or load from source file written in another editor).
- Upload your program directly (Ctrl+U) to the Arduino.
- Wire up your circuit referring to the Nano’s pinouts.
3-instruction Forth for Arduino Nano
Interactive software development allows real-time exploration of a chip/sensor’s capabilities, and can speed application development by 10x! For this I use Forth , which has the additional advantage of making it easy to write a domain specific language, which is very handy for embedded development.
Over the COVID period (2020) I wrote a fully-functioning 3-instruction Forth for Arduino Nano/Uno (Arduino 3iForth), following the approach of Frank Sergeant (“A 3-INSTRUCTION FORTH FOR EMBEDDED SYSTEMS WORK”, 1991). The result has indeed accelerated embedded development. I can now take a new sensor, and get it up and running in less than 30 minutes using Forth to probe how to communicate with/use the sensor’s capabilities. Once the right instructions/command sequence are tested, it’s a simple matter to translate back to C code to create standalone (untethered) application, or add extended capabilities that run on the remote chip with a single command from the host PC. For the full code, request in the comments.
A complication in building 3iForth for Arduino is the Harvard architecture that means program/instruction memory (Flash) is physically separate from user/data memory (SRAM), unlike a von Neumann architecture chip such as the Motorola 68HC11 (Sergeant’s target), where memory is shared between program and data. To get around this, I used function pointers to the functions desired to be remotely called, and these are stored in a table held in user memory. This means that 3iForth is not technically self-extensible on the Nano itself, but because it is tethered, the user does not perceive it, as the host Forth on the PC is extensible. As mentioned above, additional capabilities must be added to the C program core and a pointer exported to the user exposing the functionality. This technique is useful generally, since most modern, low-cost microcontrollers use a Harvard architecture.
The core of Arduino 3iForth is 44 lines of C code. The code creates a combined data and address stack in the remote chip’s data space, and stores the 3 instructions xfetch, xstore, xcall, along with two useful additions x_s (inspect remote stack) and xdrop, into an array of function pointers. The design allows the user to export any of the capabilities of the chip through functions written to use the remote chip’s stack. These functions can then be added to the function pointer array, and called using their index. The user connects to the remote Forth using serial UART. The remote chip responds only to these 3 (actually 5) commands, but due to xcall, it is unlimited in how many instructions can be added. The user can now work in any Forth that can make and maintain a serial connection. I use GForth on Windows.
To initialize the serial port, I use a hack: RealTerm first makes the connection (startup flags: baud=9600 display=2 half port=1), after which GForth under 3iForth.fs the command X open-com works.1
Writing to flash directly is possible using AVR assembly language.2 AVR Instruction Set. AVR1 is the minimal core language. AVR2.5 is the superset that works for Attiny 84/85. AVR5 or AVR5.1 is the superset that works for ATmeg328.
2. Standalone Atmega328P uC IC
The Atmega 328P is available in a sub-£2 package package convenient for use in breadboards. It is the same microcontroller chip that is integrated into the Arduino Uno and Nano boards, so the same code can be used in standalone mode without modification, with the advantage that total power consumption is 3mA (85% reduction) instead of the 19mA used by the Nano board.
To use the Atemga328P as a standalone chip requires a breadboard and at a minimum 2x 100nF (0.1uF, 100kpF, #104) capacitors between VCC and GND pins and between AVCC and GND. (Note BOTH power/ground pairs need to be connected for the chip to work.) The programming a standalone Atmega328P is easy: just use an Arduino Uno that accepts the through-hole part.
As a trade-off for this simplicity, the standalone uC requires connection to an external 16MHz crystal oscillator and 2x 22pF capacitors, hooked up from the oscillator pins to ground. This ensures that the code will run at 16MHz, which is the standard clock speed of the Nano and Uno, so that there are no timing differences and no code adjustments required.
Instructions for programming Atmega328P for use with 16MHz external oscillator
- Insert the Atmega328P IC into the socket of the target UNO.
- Connect the target UNO to the PC using the USB cable.
- In the Arduino IDE, select Tools > Board > Uno. Select the appropriate COM port (Tools > Board > COM > …)
- Upload your sketch: Sketch > Upload. Done!
- Remove power from board. Pry the chip carefully from the socket using a small screwdriver so the pins don’t get bent.
- Insert the programmed chip into your breadboard circuit.
- Connect 16MHz crystal oscillator to pins 9/10 (XTAL1/XTAL2) and 2x 22pF capacitors from pins 9/10 to ground. Ref: Wiring up 16MHz crystal NOTE: crystal oscillators have no polarity – they can be inserted in either direction.
- Ensure rest of your connections are correct using the Atmega328P pinout (see below)
- Add 0.1uF (#104, 100k pF) capacitors between pins 7/8 VCC/GND and pins 20/22 AVCC/AGND
- Apply PROPERLY REGULATED 5V power. (The example image shows the use of a boost converter with a single 1.5V AAA battery.) You should see the programmed functionality working!
Source: https://www.arduino.cc/en/Hacking/PinMapping168
WARNING1: When applying 5V power do NOT just use a 5V rated wall-wart. This unregulated power and will typically kill your micro. You need to supply regulated power. You can use an Arduino and piggy back off its 5V and GND pins. Or you can use a battery and boost convert it to 5V. Or you can use a regulated power supply.
WARNING2: Make sure you don’t reverse power and ground. This will fry your micro. And probably your OLED. And probably everything else in your ciruit. You should wire in a switch instead of disconnecting/reconnecting wires (which you are likely at some point to put in backwards by mistake). You can also put in a protection diode 1N4001 1A diode to be safe.
WARNING3: Ensure you connect BOTH VCC/GND and AVCC/GND to the 5V and Ground rails respectively. Otherwise the chip does not function correctly (display stutters in the OLED example).
PRECAUTIONS: Use power smoothing caps as a matter of course: 100uF for input power (can ignore if powering from a battery as batteries are low-noise power sources), 10uF for output power, e.g. coming out of a boost converter, 0.1uF (#104 caps) across the power/ground inputs for EACH IC.
In summary:
Simplest way to program Atmega328P to run in standalone mode is to:
Program and test in situ on the Arduino Uno.
Pull the DIP chip, mount onto breadboard, adding 2 sets of power connections and 2x 0.1uF smoothing caps.
Also add external 16MHz crystal oscillator and 2x 22 pF caps connecting the ends of the crystal to ground, and it should work just fine when powered!
Reference:
[1]Woole’s Blog post showing the wiring of thec crystal oscillator (16MHz) and two 22pF caps to ground
[2]Programming an Atmega328p and using it without Arduino board
[3]Step-by-Step Photo-Illustrated Process
Minimal parts count standalone Atmega328P – Burning Bootloaders and Uploading using ISP Programmer
To reduce parts count further, we would need to get rid of the external 16MHz oscillator and the 2x 22pF capacitors from the previous instruction. Doing so will require burning a new bootloader to the uC in order to set the appropriate fuses of the Atmega328P to use the 8MHz INTERNAL clock, but timing will be half as fast as a result, and if this is critical for your code, you may need to introduce appropriate corrections.
Ref: AVR Fuses Calculator and here
Ref: Atmega328P on a breadboard | Arduino to breadboard
Instructions for programming Atmega328P for use with 8MHz internal clock using fewer parts
- Put the chip into the TARGET Arduino UNO (ensure you match up the indentation on the chip with the outline). (The source system is the PC’s Arduino IDE.)
- On your PC, download and the board definition file Atmega328p_breadboard-1-6-x_board_def.zip (original source)
- Unpack to Arduino folder: .\arduino\hardware\..
- Restart Arduino IDE to see the new board definition: “Arduino 328 on a breadboard 8MHz internal clock”
- Select it: Tools > Boards > “Arduino 328 on a breadboard 8MHz internal clock”
You’re now ready to burn the bootloader and upload the program, both of which you can do using an AVR ISP programmer. You can buy one (TinyAVR or PocketAVR), or if you have a spare Arduino Nano or Uno lying around you can build one for a lot less! (£3 – the cost of the Nano). (See figure for three AVR ISP programmers.)
Ref: Arduino instructions for burning bootloader
Setting up an AVR ISP Programmer
- To use the Tiny AVR as your AVR ISP programmer (EASIEST – but you will need to install the device drivers for this… see here for files & screenshots post-installation):
NOTE: if the TinyAVR programmer is not recognized, you will need to install device driver files from here.- Connect PC to Tiny AVR programmer with built in USB
- Now connect the Tiny AVR programmer to the target UNO with 6 pins from the 8-pin Tiny85 header.
- No additional adjustments necessary.
- Choose Tools > Programmer > “USBtinyISP” (not ArduinoISP or anything else)
- Now connect the TinyAVR to the 6-pin ICSP header on the target UNO. Not special connections are required.
- To use a Nano as your AVR ISP programmer (CHEAPEST):
- Connect PC to programmer Nano with USB-mini cable
- Tools > Board: select Nano. Tools COM: select
- Load ArduinoISP.avr into Arduino IDE
- Sketch > Upload
This makes the Nano the ISP programmer. - Choose Tools > Programmer > “Arduino as ISP” (not ArduinoISP or anything else)
- Now connect the Nano programmer to the target UNO via the two 6-pin ICSP headers, EXCEPT (a) connect pin 5 (\RESET) of the target UNO with pin10 (SS) on the programming Nano AND (b) connect \RESET to GND with 10uF capacitor.
Ref: Nano as Programmer
- To use a second Uno as your AVR ISP programmer:
- Connect PC to programmer Uno with standard USB cable
- Tools > Board: select Uno. Tools COM: select
- Load ArduinoISP.avr into Arduino IDE
- Sketch > Upload
This makes the UNO the ISP programmer. - Choose Tools > Programmer > “Arduino as ISP” (not ArduinoISP or anything else)
- Now connect the UNO programmer to the target UNO via the two 6-pin ICSP headers, EXCEPT (a) connect pin 5 (\RESET) of the target UNO with pin10 (SS) on the programming UNO.
Next step is to make the connections between the AVR ISP programmer and the 6-pin ICSP/SPI header on the target. See the pinouts:
Final steps:
- Burn the bootloader for the Atmega328P with 8MHz internal clock. Tools > Board > …. | Tools > Programmer > … | Tools > Burn Bootloader
- Upload your program using the ISP programmer: Sketch > Upload using Programmer (Ctrl+Shift+U). Done!
- You can now carefully pry out the Atmega328P chip, install to your breadboard, make the appropriate circuit connections, and cautiously apply power. SEE PRECAUTIONS from above [link].
References:
- Another blog collection for 15 minutes
- A third discussion
- Breadboarding without oscillator
- Programmers for Atmel AVR uCs: TinyAVR Hookup Guide,
PocketAVR - Installing an Arduino Bootloader Alternate instructions
- change the bootloader
- The successor chip is the Atmega328PB with additional capabilities.
3. ATtiny85/84 uC IC
Benefits of choosing an ATtiny85
The Atmel Tiny85 is an ultra low power (2mA idle, 10x less power draw than the Nano), DIP-8 8-bit microcontroller with 5 i/o pins + reset (see [5], I2C/SPI comms, 2x 10-bit ADC channels, 4x 8-bit PWM output (256 levels), and a timer.
The Atmel Tiny84 is a low power, DIP-14 8-bit microcontroller with 11 i/o pins + reset, I2C/SPI comms, 2x 8-bit (256 levels) 2x 16-bit (65k levels) PWM outputs,
Easiest way to program Tiny85 is with the Sparkfun Tiny AVR Programmer board. This has a DIP-8 socket which you can push a new IC into (remember to line up pin1 on the chip with the notch on the chip footprint). The programmer uses the SPI pins of the Tiny85. Plugging it into USB port will not show any visual indicator that it is on/working. Programming a Tiny85 to flash pin0 flashes built-in LED on the board.
The Arduino IDE needs some software extensions (see here for how).[links]
After that, almost any Arduino code should work on the Tiny. Just keep in mind that memory is even more precious at 8KB of flash memory (program space), 4x smaller than the Nano (32KB), i.e. minimize use of libraries.
Code that works on the Nano typically needs only a new pin assignment to Atiny using preprocessing conditionals #ifdef TINY85 … #endif and #ifdef NANO … #endif to keep a single code base. For an example with details on how to do this, including code for dropping from Nano into ATTiny, and what you need to do to compile for the Tiny uCs, see my article on Making Sensors Talk for Under £5.
Using the Arduino IDE:
First you need to use the Board Manager to add the ATtiny85 driver files. See [2] below.
Then select the ATtiny board (Tools > Board > ATtiny) — scroll down, it will have been added near the bottom of a long list.
Select Tools > Processor > ATtiny85
Select Tools > Clock > 1MHz (internal)
Can also choose 8MHz (internal) for more processing power, but its usually not needed, and slower draws less power.
Select Tools > Programmer > USBtinyISP
This is for using the Sparkfun Tiny AVR programmer
You’re ready to go!
Sketch > Upload using Programmer (Ctrl+Shift+U).
The program will compile and then upload, and start.
You can use the female header pins on the Tiny AVR programmer to directly test to breadboard.
What’s really cool is that you can use the same Arduino/Forth development chain and drop from the Nano/UNO board or even the Atmega328P IC down to the ATTiny85 (DIP-8, 5 I/O pins) microcontroller. This really shrinks things down and delivers lower power, at lower cost, in a significantly smaller overall footprint (ATTiny85 is DIP-8, Nano is DIP-30). The ATTiny85 sips on avg 1-3mA power in a benchmark use vs. 20mA power for the Nano. The really fun part? As long as none of the rest of your components require 5VDC (especially watch out for ICs), you can get away with the need for a DC boost converter and directly power your whole device with 3V (could be a 3V coin cell, a 3V LiIon battery, or 2x any 1.5V battery whether button cell, AAA, or AA, C or D batteries)! With a bit of soldering and some small prototype PCB you can make some nifty little gadgets.
References:
[1] Integrating ATtiny85 into your project
[2] Programming ATtiny85 using Arduino and the Sparkfun Tiny Programmer board
[3] Step-by-Step programming ATtiny85 – SparkFun Tutorial
[4] Writing direct AVR-C (bypassing the Arduino IDE)
[5] Using the 6th (reset) pin on Tiny85 for I/O is painful
[6] Programming instruction using Arduino UNO as an ISP programmer
3.1 ATtiny84
The Tiny AVR programmer then works with the Tiny84 chip as well. Just choose the Tiny84 processor in the Arduino IDE.
TIP: You can write code for the Arduino Nano, and then move directly to Tiny84, by putting chip specific pin definitions in #ifdef NANO … #endif and #ifdef TINY84 … #endif respectively, and then modifying the code with #define NANO or #define TINY84 before compilation.
Appendix 0. Additional controllers
For the hobbyist, the above three chips are likely to cover almost all of the applications you need.
But if your idea requires wireless connectivity/internet of things, requiring sub-£1 pricing per chip, or requires multiple parallel controllers (e.g. dispersed or simultaneous sensors/motors, e.g. robotics), then you will want to look at a few other options.
(4) For wireless/internet of things applications, the 32-bit Espressif (ESP8266, NodeMCU (based on ESP8266), and ESP32) microcontrollers are exceptionally well suited featuring built-in wireless connectivity (802.11 WiFi, Bluetooth) and are programmable using the Arduino IDE. With the ESP8266 it is possible to interface with Alexa.
(5) For high volume applications, the ultra-low cost category can be worth a look: there are the sub-30p reprogrammable ISP microcontrollers and the sub-10p one time programmable (OTP) microcontrollers. While these are really inexpensive and quite powerful, they are not easy for hobbyists to use, typically requiring specialized high voltage programming equipment, assembly language coding using proprietary toolchains with limited documentation. Examples: Padauk PMS150C example, full review);
(6) for large-scale ubiquitous computing, the ultra-low power GA-144 multi-core controller with 144 individual controllers, invented by Chuck Moore, the father of Forth and of ultra-low power MISC (minimal instruction set computing) hardware designs, offer intriguing possibilities. The GA-144 has 144 independently programmable F18 microcontrollers, interconnected in a defined topology, on a single-die. Ultra-low power. Usage: Wherever there is a need for dedicated continuous real-time monitoring and control, instead of multiple discrete components and a lot of communication interconnects, this chip allows integration. Application: Piano-25 PCB (small scale, 3 dedicated controllers, 1 coordinating controller), smart sensored car (many dedicated controllers, 1 coordinating controller). Sort of like CAN bus in automotive control.
Appendix 1. Design choices
Nano vs. Tiny
What designs can use the Tiny85 (5 i/o pins, £1.30 ea), Tiny84 (11 i/o pins), and what need the Nano (usb interface, 16-22 i/o lines)? Note Tiny85 can run on 2.7-5.5V, so does not need converter, just 2x 1.5V AAA batteries.
- PIR sensor (Tiny85): requires 1 output for buzzer, 1 signal input from PIR sensor, and 2 pins for red/green light state signalling (total 4 pins). Low power of Tiny85 is perfect (2mA) running from 1x 1.5V AAA battery boosted to 5V using CR012 converter, needed to provide 5V to the PIR sensor, which runs a signal processing chip onboard to reduce false detections. Total cost: £3.50 (£1.30 for Tiny85, £1.10 for PIR sensor, 35p for AAA battery holder, 30p for AAA battery, 35p for 170 tie points beadboard, 10p for misc parts LEDs, wiring, resistors). Total time to wire up, program, and test: 2 hrs. Requires: USBTiny programmer, Laptop with Arduino IDE. ATTiny85 code
- 4-way Traffic lights (Tiny84): requires 3 outputs to control a pair of Traffic lights, so 6 outputs for 4 traffic lights, plus need signals (buttons) so additional one if one signal and two if two signals for total of 7-8 i/o lines. No need for Forth interface. Tiny84 works.
- Step motor control (Tiny85): requires 4 outputs to control.
- Piano (Nano): Uses Nano as the tone generator (later could use AY-3-8913 or YM*). I/O has a few different flavors/options:
- Piano direct (Nano): Basic requires 13 pins for keys, 1 for speaker, 14 total.
- Piano-13 PCB (Nano): 13-key PCB uses priority encoder and channel selector/demultiplexer for LEDs, requires 5 pins for keys, 5 pins for LEDs, 1 for speaker, 2 for I2C, and 4 for Menu buttons, total of 17 pins.
- Piano-25 PCB (Nano/Tiny85/Tiny84): uses two 25-key shift IN/OUT registers each requiring 3 pins, allowing 2x Tiny85s to be used talking to Nano via I2C, or 1x Tiny84 talking to Nano via I2C. Nano required because also want tethered operation capability via USB using 3iForth.
- Complex Sound Effects Generator using 76477 chip
- Mixer Generator breakout board (Tiny84): uC uses 3 pins to encode inputs from mixer buttons selected by user and 3 outputs to 3 pins on 76477 controller (6 total), so cannot use 1 Tiny85, but could do 2 Tiny85s talking via I2C. Better to use 1 Tiny84. Rest is manual switches and the 76477 controller.
- Drum sequencer with 76477 complex sound generator IC using Tiny85: Tiny85 uses 3 pins to input from shift-in register which can have up to 32 inputs from DIP switch bank. With the two remaining pins, one is for one-shot trigger IC, and an analog variable resistor to indicate the beat pace. The Tiny85 loops through the beat sequence in code. For more complicated effects, the two pins on the Tiny85 can be I2C to a control micro feeding in the user requested beat sequence (i.e. a UX board interface) and the control micro could issue the beats interfacing to 76477 CSG or the more powerful 3-voice chip AY-3-8910 fully programmable sound generator (PSG)
- Keypad (Tiny84): 8 pins for keypad I/O, 2 for I2C
- 3D robotic wrist (pan/tilt/roll) (Nano): requires programmable PWM outputs when using precision position motor controllers (actuators)
- Etch-a-sketch (Nano): OLED driver (X KB) exceeds the 8KB max flash memory space of Tiny, so needs Nano.3 If the device driver can simplified (see TinyPhoto) then can use the Tiny85: 2 pins for I2C, two PWM pins for horizontal and vertical cursor movements.
- Remote Control Car (RF-Nano): Need wireless capability for communicating with the car
Appendix 2. Supporting silicon to expand uC choice
ATtiny85 + Encoders and Shift-in registers, Decoders and Shift-out registers, and Channel select multiplexers.
ATtiny85 is an ideal shift register controller. It has 5 I/O pins, for which 3 can control the ‘165 shift IN register, and 2 can be used for I2C communication with the master CPU. With this design, can now readily extend to controlling 25 inputs/outputs or more from the Tiny85.
74148 (DIP-16) is an 8-input priority encoder with a cascade feature. It takes 8-inputs and encodes the highest active input into a 3-bit binary output. Cascading two ‘148s into a 7408 AND chip allows a 16-input priority encoder producing a 4-bit binary output. Usage: keypad where only one key is permitted to be active at a time (more get subject to the prioritization). Application: 13-key Piano-PCB + 3 function keys.
74165 (DIP-16) is an 8-input shift IN register with a cascade feature. This is ideal for encoding independent states where more than one can be active at the same time. Takes 3 control lines (data, latch, clock) and best part is cascading more inputs does not require any more control pins, just a longer sweep time to latch out all of the state bits in serial. To ensure dedicated CPU service, pair with a low-cost microcontroller. Usage: keyboard input, drum machine beat input, keypad input.
Related Reading
- A tiny high-level language runtime for embedded computing with the power of C and the extensibility of Forth or LISP.
- The Sacred and the Profane: Why learn assembly language? and a look at how the vision for GCC and optimizing compilers has changed computing
- TinyPhoto: Embedded Graphics and Low-Fat Computing
- Knowledge Engineering & Emerging Technologies (2005-2015)
Thanks a lot for the information!