The DUO Tiny is my smallest project yet. As a result, the DUO Tiny is easy to construct.
You will need all of the parts below to build a DUO Tiny. Excluding the miscellaneous parts, the total cost should be around $25.
I probably don't need to say this, but read everything carefully!
= = = PART LIST = = =
(x1) ATTiny 8 bit microcontroller
ATTINY84-20PU
(x1) 64+ KB EEPROM
AT24C1024B-PU25 (the chip I used, but now seems to be at "end of life".)
Or:
24FC512-I/P (also seems to be compatible, but make sure to ground pin 1.)
(x1) 102 by 64 LCD
EA DOGS102W-6
(x4) Tactile push buttons
B3F-6000
(x1) 14 pin IC socket
1825093-3
(x1) 8 pin IC socket
1825093-2
(x5) 100 kOhm resistor
291-100K-RC
(x3) 1 microfarad capacitor
EEA-GA1H1R0
(x2) 4 pin header
22-03-2041
(x2) 4 pin socket
102241-2
(x1) 2 AAA battery holder
122-0421-R-GR
Miscellaneous components include a circuit board, Arduino UNO, and jumper wire. It is possible to use a generic printed circuit board for the DUO Tiny. My second prototype uses this type of board.
However, to produce a smaller device, a custom printed circuit board is recommended. Here is a picture of the custom PCB which I have designed. I have several extra boards available. You may purchase one for $20. If you are interested, please send an email to esperantanaso at gmail.
This guide will assume that you have the same PCB as my final DUO Tiny device. Note that my prototypes use a different wiring scheme than the final device. If you are using a generic PCB, please wire the board according to my custom PCB schematic.
= = = INSTALLING COMPONENTS = = =
Solder each component into your PCB. Use this picture of the board to see where each part should be placed. If you want soldering tips, please refer to this video:
Do NOT solder chips directly into the board. Heat can caused damage to integrated circuits. First solder in an IC socket, then plug in the chip afterward.
Plug in both chips "upside down" with the semicircle notch closer to the front of the board. This notch is visible in the photo of the DUO Tiny.
Be sure to place extra space between the board and LCD. The display can also be damaged by heat. I found this out the hard way! 5 mm of extra height should suffice.
Orient the capacitors so their positive ends connect to pins 15, 18, and 19 on the LCD. These capacitors are important for the display to function.
If you supply power to your board right now, absolutely nothing will occur. We need to install the ATTiny code and software!
= = = INSTALLING SOFTWARE = = =
Connect the Arduino UNO to the DUO Tiny board by using the pin headers and pin sockets. Use the diagram below for reference.
ARDUINO PIN LEFT HEADER RIGHT HEADER ARDUINO PIN
13 ----------- O O ----------- None
12 ----------- O O ----------- 4
11 ----------- O O ----------- 3
10 ----------- O O ----------- 2
On a laptop computer, install the Arduino development environment. By default, this application does not compile for the ATTiny. To add ATTiny support, visit this page and follow the instructions. I would avoid burning fuses in the ATTiny.
Incase that link ever dies, I have copied the instructions here:
- Download the ATiny master.zip file from this link.
- Unzip the attiny master.zip file. It should contain an "attiny-master" folder that contains an "attiny" folder.
- Locate your Arduino sketchbook folder (you can find its location in the preferences dialog in the Arduino software)
- Create a new sub-folder called "hardware" in the sketchbook folder, if it doesn't exist already.
- Copy the "attiny" folder (not the attiny-master folder) from the unzipped ATtiny master.zip to the "hardware" folder. You should end up with folder structure like Documents > Arduino > hardware > attiny that contains the file boards.txt and another folder called variants.
- Restart the Arduino development environment.
- You should see ATtiny entries in the Tools > Board menu.
I have found there to be a bug in the ATTiny support. For any sketch larger than 4 KB, the compiler will fail. To fix the problem, please visit this page
Again, incase the link dies, I have copied the information here:
This patch replaces the ld.exe file (or just ld for Mac) in WinAVR/Crosspack supplied with the Arduino IDE. The supplied version has a bug which causes weird errors when files larger than 4kB are compiled for AVR25 processors which include those in the Tiny series.
This Bug was fixed in a later version of the linker, and thankfully it is a simple case of replacing one file to fix the Arduino version.
How to Apply:
FOR MAC OSX (Works on Snow Leopard, Lion, Mountain Lion)
---------------------------------------------------------
The following is how to apply the fix for MacOSX. This is based of AVR crosspack 20090319.
For Mac you only need the single extensionless file "ld" which is included in this folder, or can be aquired from the downloads page under then named "MAC ld.zip".
Right-Click on Arduino.app
Click "Show Package Contents"
Due to MacOSx inability to merge folders, you will have to navigate to the correct folder yourself:
/Contents/Resources/Java/hardware/tools/avr/avr/bin/
Copy and replace "ld" with the version from this folder or the aforementioned the zip archive.
Restart the IDE and that is all.
FOR WINDOWS USERS (Works on all version starting with XP)
---------------------------------------------------------
The following is how to apply the fix for Windows. The issue was fixed as of WinAVR 20090313
For windows, the ld.exe file needs replacing. It is buried deep within a chain of folders, so I have built the directory structure for you. You can either navigate through the folders starting with 'hardware' (following the structure in this repository) and replace the ld.exe file with the one from this git repo, or you can just go to the downloads page and download "WINDOWS ld.zip".
If you extract the zip file, you will find a folder called 'hardware'. Just copy this into the directory and when Windows asks, merge existing folders, and replace the one file - by creating the directory structure for you the file will be copied into the correct place.
Restart the IDE and that is all.
After installing the plugin and patch, follow these instructions to install the DUO Tiny sketch onto the ATTiny:
Open the Arduino development environment.
Open File > Examples > ArduinoISP.
Select Tools > Board > Arduino Uno (if it is not selected already).
Plug the Arduino UNO board into your laptop with a USB 1.0 cable.
Press the upload button on the ArduinoISP sketch to upload to the Arduino UNO. Your Arduino UNO will now act as a programmer for the ATTiny.
In the Arduino development environment, open Tools > Board > ATTiny84 (internal 1 MHz clock).
Plug in the left pin header of the DUO Tiny to the Arduino UNO (if you have not done so already) using the diagram shown earlier.
Connect the DUO Tiny to ground and 3.3 volts on the Arduino. Do NOT use the batteries yet.
Press the upload button on the WatchComputer2 sketch. The program will take a minute to load into the ATTiny. If everything was successful, the LCD should write the text "DUO TINY".
If nothing is displayed on the LCD, review all instructions and try again. If that fails, please contact me at esperantanaso at gmail.com.
Now you are ready to load DTPL programs into the DUO Tiny EEPROM:
Plug in the right pin header of the DUO Tiny to the Arduino UNO (if you have not done so already) using the diagram shown earlier.
On the DUO Tiny board, press and hold the top button for 5 seconds. This will reset the DUO Tiny; the DUO Tiny cannot read from the Arduino UNO while running programs.
Open "ArduinoControl.ino" included in the tiny_sketches folder.
Select Tools > Board > Arduino Uno.
Upload the ArduinoControl sketch to the Arduino UNO.
Open the Arduino console with Tools > Serial Monitor. You should see the text "Please enter a command: R or W."
Follow the onscreen prompt to write data to the DUO Tiny EEPROM. Find DTPL code in this file. Do not enter more than 500 characters at a time. The Arduino UNO does not have a lot of memory to store text. To divide text into pieces, use this utility.
When you have written some programs into the DUO Tiny, press the bottom button on the DUO Tiny board. Execution will begin at address 0.
I recommend that you first try writing and reading a small amount of text. This will let you confirm that the DUO Tiny is functioning properly. If the Arduino UNO reports bad data, check your connections and read this document again.
If you build your own DUO Tiny, I would love to see a photo! My email address is esperantanaso at gmail. You should also send me an email if you have any problems. Good luck!