Paying $50 to whomever can get my digispark to work with I2C & 16x2 LCD

I just tried using the original code posted (digisparkLCD library) and changed the GPIO_ADDR to 0x3F and still no changes to the display. I tried both with and without using pullups.

try this:

LiquidCrystal_I2C lcd(0x38,2,1,0,4,5,6,7);

also need this in setup:

lcd.begin (16,2);

Also if that doesn't work you can run this on an arduino to read the I2C address on the device:

My guess is still with the address issue

// I2C Scanner


#include <Wire.h>

void setup() {
  Serial.begin (115200);

  // Leonardo: wait for serial port to connect
  while (!Serial) 
    {
    }

  Serial.println ();
  Serial.println ("I2C scanner. Scanning ...");
  byte count = 0;
  
  Wire.begin();
  for (byte i = 8; i < 120; i++)
  {
    Wire.beginTransmission (i);
    if (Wire.endTransmission () == 0)
      {
      Serial.print ("Found address: ");
      Serial.print (i, DEC);
      Serial.print (" (0x");
      Serial.print (i, HEX);
      Serial.println (")");
      count++;
      delay (1);  // maybe unneeded?
      } // end of good response
  } // end of for loop
  Serial.println ("Done.");
  Serial.print ("Found ");
  Serial.print (count, DEC);
  Serial.println (" device(s).");
}  // end of setup

void loop() {}

I commented out the define GPIO ADDRESS and Previous LiquidCrystal Call, I now have the error No matching function to LiquidCrystal_I2C.. See code below for error.

BasicUsage:23:41: error: no matching function for call to 'LiquidCrystal_I2C::LiquidCrystal_I2C(int, int, int, int, int, int, int, int)'

 LiquidCrystal_I2C lcd(0x38,2,1,0,4,5,6,7);

                                         ^

C:\Users\Matthew\AppData\Local\Temp\arduino_modified_sketch_211171\BasicUsage.ino:23:41: note: candidates are:

In file included from C:\Users\Matthew\AppData\Local\Temp\arduino_modified_sketch_211171\BasicUsage.ino:17:0:

C:\Users\Matthew\AppData\Local\Arduino15\packages\digistump\hardware\avr\1.6.7\libraries\DigisparkLCD/LiquidCrystal_I2C.h:59:3: note: LiquidCrystal_I2C::LiquidCrystal_I2C(uint8_t, uint8_t, uint8_t)

   LiquidCrystal_I2C(uint8_t lcd_Addr,uint8_t lcd_cols,uint8_t lcd_rows);

   ^

C:\Users\Matthew\AppData\Local\Arduino15\packages\digistump\hardware\avr\1.6.7\libraries\DigisparkLCD/LiquidCrystal_I2C.h:59:3: note:   candidate expects 3 arguments, 8 provided

C:\Users\Matthew\AppData\Local\Arduino15\packages\digistump\hardware\avr\1.6.7\libraries\DigisparkLCD/LiquidCrystal_I2C.h:57:7: note: LiquidCrystal_I2C::LiquidCrystal_I2C(const LiquidCrystal_I2C&)

 class LiquidCrystal_I2C : public Print {

       ^

C:\Users\Matthew\AppData\Local\Arduino15\packages\digistump\hardware\avr\1.6.7\libraries\DigisparkLCD/LiquidCrystal_I2C.h:57:7: note:   candidate expects 1 argument, 8 provided

exit status 1
no matching function for call to 'LiquidCrystal_I2C::LiquidCrystal_I2C(int, int, int, int, int, int, int, int)'

Cannot get the I2C scanner to work either

Arduino: 1.8.7 (Windows 10), Board: "Digispark (Default - 16.5mhz)"

C:\Users\Matthew\Desktop\The Mist - Smoke Mate\Arduino Code\Arduino - LCD Display Sketch\Led Blink\sketch_nov15a\sketch_nov15a.ino: In function 'void setup()':

sketch_nov15a:11:10: error: no match for 'operator!' (operand type is 'TinyDebugSerial')

   while (!Serial) 

          ^

C:\Users\Matthew\Desktop\The Mist - Smoke Mate\Arduino Code\Arduino - LCD Display Sketch\Led Blink\sketch_nov15a\sketch_nov15a.ino:11:10: note: candidate is:

C:\Users\Matthew\Desktop\The Mist - Smoke Mate\Arduino Code\Arduino - LCD Display Sketch\Led Blink\sketch_nov15a\sketch_nov15a.ino:11:10: note: operator!(bool) <built-in>

C:\Users\Matthew\Desktop\The Mist - Smoke Mate\Arduino Code\Arduino - LCD Display Sketch\Led Blink\sketch_nov15a\sketch_nov15a.ino:11:10: note:   no known conversion for argument 1 from 'TinyDebugSerial' to 'bool'

exit status 1
no match for 'operator!' (operand type is 'TinyDebugSerial')

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

try this... looks like attiny is the challenge.

No such luck, if I follow the instructions as described, I get an error that lcd is not declared in this scope
It complies if i use the example within the Adagfruit folder... so not sure whats going on there.

I completely replaced the TinyWireM file, and I already have all of the cores it was wanting me to use.

I added in coding from the other sketches to get it to compile, but that just puts me back at square one.

#include <TinyWireM.h>                 // ATtiny I2C communication
//#include <Adafruit_RGBLCDShield.h> // RGB LCD Shield communications
#include <LiquidCrystal_I2C.h>  
//Adafruit_RGBLCDShield lcd = Adafruit_RGBLCDShield();
#define GPIO_ADDR     0x27  
LiquidCrystal_I2C lcd(GPIO_ADDR,16,2);
long secs = 0;

void setup()
{

  lcd.begin(16, 2); // set up the LCD's number of columns and rows.
  lcd.setBacklight(7); // For monochrome LCD lcd.setBacklight(ON)
  lcd.clear();
  lcd.setCursor(0,0);
  lcd.print("Hello World!");
}

void loop()
{
 
}

You reverted back to #define GPIO_ADDR 0x27

Please try 0x38;

if (that doesn't work) 0x3F

:slight_smile:

I tried both, but I was just able to get a I2C scanner working,

C device found at address 0x3F !
done

sweet! does it work now?

Go on. He posted a photo of a PCF8574A with unmounted links on the A0, A1, A2 pins. i.e. Slave = 0x3F

However, it is much safer to install Bill Perry's HD44780 library or run an I2C sniffer program. Then you will know the address.

Or you could just use Codevision C Compiler. Which supports the I2C backpack.

David.

not yet, I am going bake through all of the previous libraries Ive used to see if any will work using the 0X3F library.

that's the first address we tried... try David's suggestion on the library. I can see why I2C is so important on attiny. what are you making? Why not just use a 328?

Do we still know if pin 5 and 7 are still good?

OK try this...

Go here and download:
https://bitbucket.org/fmalpartida/new-liquidcrystal/downloads/

seems not all the libraries work with ATTINY.

Open file I2CIO.cpp

After line 34 insert the code below:

#if defined(AVR_ATtiny84) || (AVR_ATtiny2313)
#include "TinyWireM.h" // include this if ATtiny85 or ATtiny2313
#define Wire TinyWireM
#else
#include <Wire.h> // original lib include
#endif

#include <TinyWireM.h>                 // ATtiny I2C communication

#include <LiquidCrystal.I2C.h>  

#define GPIO_ADDR     0x3F  
LiquidCrystal_I2C lcd(GPIO_ADDR, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
long secs = 0;

void setup()
{

  lcd.begin(16, 2); // set up the LCD's number of columns and rows.
  lcd.setBacklight(ON);
  lcd.clear();
  lcd.setCursor(0,0);
  lcd.print("Hello World!");
}

void loop()
{
 
}

wolframore:
that's the first address we tried... try David's suggestion on the library. I can see why I2C is so important on attiny. what are you making? Why not just use a 328?

Do we still know if pin 5 and 7 are still good?

I want to use a micro controller that is under $3 for my project. Eventually, I would like to just use the Attiny85 alone and not on the digispark. I just Received my Uno, so I can test the screen and I2C.

I will also try your recommendation and reply.

Good luck... I get 328P chips for $1.50 and make my own. Attiny isn't a huge savings for the issues it can cause.

Im a man of my word, Wofl please send me a personal message to declare how you would like your payment.

The code below worked for me.

/*
 * Interactive nametag sketch for ATtiny85. Based on the Digispark
 * ATtiny LCD example and the Adafruit "Measuring Sound Levels" example.
 * Every 12000 milliseconds will change the display from my name to my website.
 * On the second line, will measure and display sound levels.
 * For more info check: https://platis.solutions/blog/2015/03/22/diy-interactive-name-tag/
 * ATtiny85 I2C pins:
 * ATtiny Pin 5 = SDA on DS1621  & GPIO
 * ATtiny Pin 7 = SCK on DS1621  & GPIO
 */

#include <TinyWireM.h>                  // I2C Master lib for ATTinys which use USI - comment this out to use with standard arduinos
#include <LiquidCrystal_attiny.h>          // for LCD w/ GPIO MODIFIED for the ATtiny85

#define GPIO_ADDR     0x3F
LiquidCrystal_I2C lcd(GPIO_ADDR, 16, 2); // set address & 16 chars / 2 lines

const short micPin = A3;
const short sampleWindow = 50; // Sample window width in mS (50 mS = 20Hz)
const unsigned long nameInterval = 12000;
unsigned long prevNameChange = 0;
short state = 1;
unsigned int sample;

void setup() {
  lcd.init();                           // initialize the lcd
  lcd.backlight();                      // Print a message to the LCD.
  lcd.print("Name: Dimitris");
}

void loop() {
  printName();
  printTemp();
}

void printName() {
  if (millis() - prevNameChange > nameInterval) {
    lcd.setCursor(0, 0);
    if (state) {
      lcd.print("platis.solutions");
    } else {
      lcd.print("Name: Dimitris  ");
    }
    prevNameChange = millis();
    state = !state;
  }
}

void printTemp()
{
  unsigned long startMillis = millis(); // Start of sample window
  unsigned int peakToPeak = 0;   // peak-to-peak level

  unsigned int signalMax = 0;
  unsigned int signalMin = 1024;

  // collect data for 50 mS
  while (millis() - startMillis < sampleWindow)
  {
    sample = analogRead(micPin);
    if (sample < 1024)  // toss out spurious readings
    {
      if (sample > signalMax)
      {
        signalMax = sample;  // save just the max levels
      }
      else if (sample < signalMin)
      {
        signalMin = sample;  // save just the min levels
      }
    }
  }
  peakToPeak = signalMax - signalMin;  // max - min = peak-peak amplitude
  printBars(peakToPeak);
}

void printBars(int bars) {
  if (bars > 14) bars = 14;
  for (int i = 0; i < 15; i++) {
    lcd.setCursor(i, 1);
    if (i <= bars) {
      lcd.print("*");
    } else {
      lcd.print(" ");
    }
  }
}

matt_funder27:
I want to use a micro controller that is under $3 for my project. Eventually, I would like to just use the Attiny85 alone and not on the digispark. I just Received my Uno, so I can test the screen and I2C.

If you want a minimal system, the Pro Mini will cost you less than $2 from China (where else?), is more capable, and you get the PCB with all support parts fitted. I can't see the point in re-inventing the wheel with bare chips. :roll_eyes:

Matt I just read through your code. That’s pretty fun. Is this for s maker faire or a hacker event???