Intro: Serial I2C HD44780-compatible LCD for ATTINY85
This instructable will show you how to use an LCD and I2C module to display data from an ATTINY85. The intent of the schematic above it to show the connection needed to display data. Note that pull-up resistors are needed for the I2C module.
Step 1: Modify Liquid Crystal Display Library
The following two libraries will need to be installed in your Arduino environment.
The NewLiquidCrystal library has to be modified to make it work with the ATTINY chips. Modify the following file accordingly.
Find the following file I2CIO.cpp and make the modification below:
Line 33 replace with:
#if (ARDUINO > 100)
Line 34 “#include <../Wire/Wire.h>” replace with
#if defined(__AVR_ATtiny84__) || (__AVR_ATtiny2313__) || defined (__AVR_ATtiny85__)
#include "TinyWireM.h" // include this if ATtiny84 or ATtiny85 or ATtiny2313
#define Wire TinyWireM
#include "Wire.h" // original lib include
Step 2: Source Code
//To wire your Lcd I2C Display to your ATtiny85, connect the following pins :
//ATtiny85 Pin1 –> NC
//ATtiny85 Pin2 –> NC
//ATtiny85 Pin3 –> NC
//ATtiny85 Pin4 –> Ground
//ATtiny85 Pin5 –> LCD Sda
//ATtiny85 Pin6 –> NC
//ATtiny85 Pin7 –> LCD Scl
//ATtiny85 Pin8 –> +5V
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
//3 flash introduction
for (int i = 0; i< 3; i++)
Step 3: Notes
I am using the latest (at the time of this writing) arduino core (IDE version 1.6.2).
Please note that I have referenced and modified according the following information:
I hope this instruction helps as I spent many hours trying to figure out how to get these libraries to work with the ATTINY.
Note update Feb 07, 2016. After upgrading to the newer version of Arduino (1.6.7) if you are using Visual Studio with Visual Micro this code will not work. There appears to be an issue with the #define statements not being passed in. If you get an error do to Wire.h then this was the reason. Hopefully they will fix this issue.
Upate: Feb 09, 2016. The fix for the Visual Micro is to install the latest as of this date.