Self-contained 16-Digit display - Arduino & Attiny85
Ever wanted a 7-segment display for around the house? Here's your chance to make one!
It can even be interactive based on the programming.

Parts:
($7.60) 16 Digit TM1640 based display
Dealextreme.com SKU: 104311
http://www.dealextreme.com/p/jy-mcu-16x-digital-tube-yellow-led-module-104311

($2.50) Atmel ATtiny85
Digikey PN: ATTINY85-20PU-ND

($1.73) Extra long female header pins
Digikey PN: SAM1209-12-ND
- I got longer sections, as I plan to use these for other projects. ($8.75) Digikey PN: SAM1198-50-ND for 40-Pin headers.

($0.13) 8-pin IC socket
Digikey PN: A100204-ND
NOTE: I suggest you experiment with a different 8-pin socket. This one requires quite a bit of force to insert and remove your chip. It's easy to bend the ATtiny's pins when doing this.
Although you should have no reason to remove the ATtiny85 after you've got the final breadboard. The chip can be used and programmed in-circuit.

($1.50) Perfboard / Veroboard / valley of holes. Individual solder pads.
Sparkfun PN: PRT-08808
- I opted for a bigger ($12) piece from Digikey, as I wanted it for other projects. (Digikey PN: V2012-ND)

Total: $13.46 - You'll have some extra long header pins for use with other projects. These header pins are perfect for Arduino shields.

You will also need:
-Soldering iron
-Solder
-ATmega328 based Arduino. I used an Official Arduino UNO R3.
(You can alternatively use another ISP for the ATtiny85)
-5v Switching power supply if you want to use the display as a standalone device.
-Breadboard (optional) - You can program the ATtiny in the completed circuit/holder with wires directly to the arduino.

Step 1: A note on soldering.

Self-contained 16-Digit display - Arduino & Attiny85
Before we start, I want to say that this is my first EVER attempt to solder on a piece of perfboard/veroboard.
I've soldered wires together a handful of times before though.

Although the connections seem small, just take your time and try to steady your hand! You'll be fine.
If I can do it, so can you!

Step 2: Step 1: Arduino software, libraries.

Self-contained 16-Digit display - Arduino & Attiny85
1. Download Arduino v1.0
2. Download Arduino v0023
You can get both of these from Arduino.cc

3. Extract both to separate folders on your desktop.

4. Download and install the TM1638/TM1640 library from here:
http://code.google.com/p/tm1638-library/

5. Place it with your other arduino libraries **ON ARDUINO v1.0**
Google if you do not know how to install a Arduino library.

6. Install ATtiny45 / ATtiny85 support in **Arduino v0023**

- Download: attiny45_85.zip
http://hlt.media.mit.edu/wp-content/uploads/2011/06/attiny45_85.zip

- 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.
- Copy the attiny45_85 folder from the attiny45_85.zip to the hardware folder.
- Restart the Arduino development environment.

Step 3: Program Arduino-as-ISP to your Arduino

Self-contained 16-Digit display - Arduino & Attiny85
1. Start up your copy of Arduino v0023
2. Under the Examples menu item, choose ArduinoISP option
3. Program the arduino with this sketch

Note: I had to perform this step in Windows XP. Something about Mac OSX refreshing the connection gave me trouble.

Step 4: Wire up your Arduino to program the ATtiny85

Self-contained 16-Digit display - Arduino & Attiny85
Self-contained 16-Digit display - Arduino & Attiny85
Follow the wiring/pin diagrams here:
http://hlt.media.mit.edu/?p=1229

This site is also good reference:
http://provideyourown.com/2011/arduino-program-attiny/

The connections are:
ATtiny Pin 2 to Arduino Pin 13 (or SCK of another programmer)
ATtiny Pin 1 to Arduino Pin 12 (or MISO of another programmer)
ATtiny Pin 0 to Arduino Pin 11 (or MOSI of another programmer)
ATtiny Reset Pin to Arduino Pin 10 (or RESET of another programmer)

You can also wire up LEDs to show your programmers status. Use 1K ohm resistors between the LEDs and Vcc.
Arduino Pin 9: Heartbeat - shows the programmer is running
Arduino Pin 8: Error - Lights up if something goes wrong (use red if that makes sense)
Arduino Pin 7: Programming - In communication with the slave (use green if you like)

Connect a 120ohm resistor between the arduino Reset pin and +5v. This will prevent the arduino from resetting before it can program the ATtiny85.
Some have had success with a 10uF capacitor between the arduino Reset pin and Ground.

Step 5: Burn your program onto the ATtiny85.

Self-contained 16-Digit display - Arduino & Attiny85
1. Load the example TM1640 sketch in your Arduino v1.0 software.
2. Change your output pins to 0 and 1 respectively.

If you want to use premade code, see the attached Arduino sketch. It's a modified version of the TM1640 example sketch.

Note: You might notice that in my example code, i've divided the millis() function by 16. This is because the millis() function was written for the Arduino, that runs at 16Mhz, whereas the ATtiny85 is running at 1Mhz. If you don't do this, the time will run 16x too fast!

3a. (original method, not recommended)
In your arduino menu:
-Change the board to "ATtiny85 (1Mhz)"
-Change the Programmer to "Arduino As ISP"

3b. (optional, recommended)
Configure your ATtiny85 to run at 8Mhz!
-Change the board to "ATtiny85 (8Mhz)"
-Change the Programmer to "Arduino As ISP"
-Click "Burn Bootloader"

Running the ATtiny85 @ 8Mhz seems to fix the division problem with the millis() function. It keeps proper time without the division by 16.


4. Burn the sketch. You should see the green LED light up, and the RX/TX leds blink rapidly.
If all goes well you should see the green LED go out and the status led continue pulsing.

Note: I had to perform this step in Windows XP. Something about Mac OSX refreshing the connection gave me trouble.


You should now have a programmed ATtiny 85! Test it out by connecting the chip to Vcc and ground. Connect the TM1640 to Vcc and ground, and connect the Data and Clock pins to Pins 5 and 6 respectively on the Attiny85.

Don't worry if you get the data and clock pins backwards for the TM1640, you can just switch them with no damage done.


Note: The ATtiny85 can be programmed right on a breadboard. It can also be programmed in the circuit we will build. (as pictured)


Self-contained 16-Digit display - Arduino & Attiny85
tm1640_example_attiny85.ino1 KB

Step 6: Make a versatile interface for the ATtiny . Build the perfboard circuit.

Self-contained 16-Digit display - Arduino & Attiny85
Self-contained 16-Digit display - Arduino & Attiny85
Self-contained 16-Digit display - Arduino & Attiny85
Now that you've got the code on the ATtiny85, it's time to put your chip into a mini-circuit!

1. Trim your perfboard to have 6x4 useable holes.
2. Solder your 8-Pin IC holder to the perfboard.
3. Cut two 4-pin sections out of your long header strip. Note, you'll have to cut along one of the adjacent pins. Each cut you make, you will loose one pin.
4. Solder your two sets of header pins to the perfboard.
It is easier to solder the header pins if you use some male-male header pins, and mount the circuit you're building to a breadboard.
5. Connect each IC holder pin to a long header pin with a line of solder.
6. Check your connections with a test probe or multimeter on continuity mode to insure you haven't bridged any of the IC holder pins.


I plan to use this setup not only for this display, but for future prototyping with the ATtiny13 and ATtiny85.
It's much easier to work with and has only a slightly larger footprint (vs the chip by itself).

Step 7: Final setup and notes. And a video!

Self-contained 16-Digit display - Arduino & Attiny85
Self-contained 16-Digit display - Arduino & Attiny85
Self-contained 16-Digit display - Arduino & Attiny85

===Connecting your ATtiny===
-Instead of using the supplied TM1640 cable, I made my own.
Using some female-female wires from Dealextreme (SKU 55454) and some heatshrink. I could have definitely spliced these cables shorter for this application.
(www.dealextreme.com/p/single-port-female-to-female-jumper-wire-set-50-pack-20cm-length-55454)

-I connect the TM1640 to the male part of the headers, and an external 5v power supply to the female part of the headers.



===Reprogram your ATtiny easily!===
- The ATtiny85 can be programmed without removing it from our new perfboard. It only takes up two additional holes on a breadboard VS the chip by itself. It's also much easier to grab and work with compared to the bare chip.



===Interface with your ATtiny = More inputs/outputs!===
-There are THREE (3) additional pins available on the ATtiny85 for use as data inputs to control the display. These can also be used as outputs to other devices.
-The ATtiny85 is also able to use it's RESET pin for communication, but that's beyond the scope of this instructable.
I'll be writing another in the future to detail this process.



===Project ideas===
-Could be used in a car with the proper voltage regulator. Remember running voltage for most cars is ~14.4v
The ATtiny85 and the TM1640 display operate on 5v.
-Could be wired directly to a USB cable for power (+5v)




Here's a clip of the ATtiny running arduino code for the display, before I built the perfboard setup.
Shows how grounding the RESET pin will restart the sketch.
 
 

Tag cloud

make build easy simple arduino making homemade solar laser printed portable cheap mini building custom cardboard wooden create super lego turn paracord chocolate your paper light intel