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

I have venmo and paypal ready to pay whoever can get my digispark to work. The reward is $50, no matter how simple the fix is. You can supply me the files, or tell me how to fix my code and if it works, I will happily pay you. I wish I could figure this out, but it looks like it may be over my head :frowning: .
I will be monitoring this thread often to respond to replies.

The digispark is wired to the I2C via P0 to SDA, and P2 to SDL, and powers the display on but no text shows on the screen, all that is visible is white boxes on the top row, and dark blue boxes on the bottom.

I have gone through what seems to be every single line of code within the libraries that are called out and cannot figure out why this isn't working. I have tried altering several lines with no success. I ordered an Arduino Uno to help debug this problem, and it will arrive tomorrow, I'm very happy to use this to help solve the issue. (I have also tried replacing several different libraries with no success)

Below is my code (example sketch within DigiSparkLCD), and I have attached the two libraries it calls out... if needed I can attach any .cpp, or .h files that are required to solve my problem.

/* ATtiny85 as an I2C Master   Ex2        BroHogan                           1/21/11
 * Modified for Digistump - Digispark LCD Shield by Erik Kettenburg 11/2012
 * SETUP:
 * ATtiny Pin 1 = (RESET) N/U                      ATtiny Pin 2 = (D3) N/U
 * ATtiny Pin 3 = (D4) to LED1                     ATtiny Pin 4 = GND
 * ATtiny Pin 5 = SDA on DS1621  & GPIO            ATtiny Pin 6 = (D1) to LED2
 * ATtiny Pin 7 = SCK on DS1621  & GPIO            ATtiny Pin 8 = VCC (2.7-5.5V)
 * NOTE! - It's very important to use pullups on the SDA & SCL lines!
 * PCA8574A GPIO was used wired per instructions in "info" folder in the LiquidCrystal_I2C lib.
 * This ex assumes A0-A2 are set HIGH for an addeess of 0x3F
 * LiquidCrystal_I2C lib was modified for ATtiny - on Playground with TinyWireM lib.
 * TinyWireM USAGE & CREDITS: - see TinyWireM.h
 */

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

#define GPIO_ADDR     0x27             // (PCA8574A A0-A2 @5V) typ. A0-A3 Gnd 0x20 / 0x38 for A - 0x27 is the address of the Digispark LCD modules.


LiquidCrystal_I2C lcd(GPIO_ADDR,16,2);  // set address & 16 chars / 2 lines


void setup(){
  TinyWireM.begin();                    // initialize I2C lib - comment this out to use with standard arduinos
  lcd.init();                           // initialize the lcd 
  lcd.backlight();                      // Print a message to the LCD.
  lcd.print("Digispark!");
}


void loop(){

}

LiquidCrystal_I2C.h (3.41 KB)

TinyWireM.h (3.7 KB)

OK, use Bill, bperrybap's HD4470 library which is installed from the IDE library manager. Forget the others, this library is more sophisticated in so many ways. There are test examples provided with it.

I was jsut a trifle curious about

matt_funder27:
no text shows on the screen, all that is visible is white boxes on the top row, and dark blue boxes on the bottom.

I trust that you have found the white boxes by adjusting the contrast potentiometer? If the contrast potentiometer did not affect the display, I would have to conclude you had the backpack fitted the wrong way round.

Can you post a picture of the I2C backpack. Could be you have the wrong address.

wolframore:
Can you post a picture of the I2C backpack.

Always an excellent idea. The backpack and the display as described.

wolframore:
Could be you have the wrong address.

Which is exactly why I recommended Bill's HD4470 library.

In retrospect, I am not too sure how well it integrates to the digispark's processor. Bill?

Paul__B:
OK, use Bill, bperrybap's HD4470 library which is installed from the IDE library manager. Forget the others, this library is more sophisticated in so many ways. There are test examples provided with it.

I will try out this library and post back the results.

Paul__B:
I was jsut a trifle curious aboutI trust that you have found the white boxes by adjusting the contrast potentiometer? If the contrast potentiometer did not affect the display, I would have to conclude you had the backpack fitted the wrong way round.

Yes, the white boxes came to once adjusting the contrast.

I am using 0x27 for the address, No jumpers have been used to change the address.
I have tried using pullups and without pullups, but it appears the code has a pullup feature built in

There are several examples within the Bill library, the first try uses a library "LCD.h" that I do not have, and the other example I used returns an error of: 'POSITIVE' was not declared in this scope.

I have received this error with other attempts on different libraries.

Error:

In file included from C:\Users\Matthew\Documents\Arduino\libraries\arduino_730361\examples\otherLibraries\NewLiquidCrystal\LiquidCrystal_I2C\hd44780examples\LCDiSpeed400\LCDiSpeed400.ino:23:0:

C:\Users\Matthew\Documents\Arduino\libraries\arduino_730361/hd44780.h:150:77: error: '__FlashStringHelper' does not name a type

  size_t __attribute__ ((error("println() is not supported"))) println(const __FlashStringHelper *);

                                                                             ^

C:\Users\Matthew\Documents\Arduino\libraries\arduino_730361/hd44780.h:150:97: error: ISO C++ forbids declaration of 'parameter' with no type [-fpermissive]

  size_t __attribute__ ((error("println() is not supported"))) println(const __FlashStringHelper *);

                                                                                                 ^

LCDiSpeed400:40:69: error: 'POSITIVE' was not declared in this scope

 const int rs=0, rw=1, en=2, db4=4, db5=5, db6=6, db7=7, bl=3, blpol=POSITIVE;

                                                                     ^

LCDiSpeed400:41:73: error: no matching function for call to 'LiquidCrystal_I2C::LiquidCrystal_I2C(const uint8_t&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&)'

 LiquidCrystal_I2C lcd(i2cAddr, en, rw, rs, db4, db5, db6, db7, bl, blpol);

                                                                         ^

C:\Users\Matthew\Documents\Arduino\libraries\arduino_730361\examples\otherLibraries\NewLiquidCrystal\LiquidCrystal_I2C\hd44780examples\LCDiSpeed400\LCDiSpeed400.ino:41:73: note: candidates are:

In file included from C:\Users\Matthew\Documents\Arduino\libraries\arduino_730361\examples\otherLibraries\NewLiquidCrystal\LiquidCrystal_I2C\hd44780examples\LCDiSpeed400\LCDiSpeed400.ino:19: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, 10 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, 10 provided

In file included from C:\Users\Matthew\Documents\Arduino\libraries\arduino_730361\examples\otherLibraries\NewLiquidCrystal\LiquidCrystal_I2C\hd44780examples\LCDiSpeed400\LCDiSpeed400.ino:47:0:

C:\Users\Matthew\Documents\Arduino\libraries\arduino_730361/examples/hd44780examples/LCDiSpeed/LCDiSpeed.ino: In function 'void setup()':

C:\Users\Matthew\Documents\Arduino\libraries\arduino_730361/examples/hd44780examples/LCDiSpeed/LCDiSpeed.ino:188:7: error: 'class USI_TWI' has no member named 'setClock'

  Wire.setClock(WIRECLOCK); // set i2c clock bit rate, if asked

       ^

exit status 1
'POSITIVE' was not declared in this scope

I can't read the chip... can you read the PCF8574 part name... does it say PCF8574AT by any chance?

Very hard to see, but yes the part number is PCF8574AT

then change your code for address: 0x3F

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.