I2C Display not working with PCB

Hello,

I have an PCF8574 based I2C LCD display that works with my Arduino UNO. I'm using the LiquidCrystal_I2C library Library link.

When I try to connect this to our custom PCB the LCD does not display any data. We had other sensors and LEDs connected to the PCB that were working as expected.

We modified the library to change pins from the default A4 and A5 to pins 6 and 7 using the following code.

// LiquidCrystal_I2C.cpp file
#include "LiquidCrystal_I2C.h"
#include <inttypes.h>
#if defined(ARDUINO) && ARDUINO >= 100

#include "Arduino.h"

#include "SoftwareWire.h" // Modification
SoftwareWire myWire(6,7); // Modification

#define printIIC(args)	myWire.write(args)
inline size_t LiquidCrystal_I2C::write(uint8_t value) {
	send(value, Rs);
	return 1;
}

#else
#include "WProgram.h"

#define printIIC(args)	myWire.send(args)
inline void LiquidCrystal_I2C::write(uint8_t value) {
	send(value, Rs);
}

#endif

Here's the schematic of the PCB.

The code works with Uno R3 board but doesn't work with the PCB.

1 Like

If you are using an Atmega328 the I2C pins are A4 and A5 !

Cannot tell if you have decoupling capacitors on the controller Vcc pins :thinking:, these are not optional.


Why are your traces so narrow ?

We need to see a schematic.

2 Likes

I wonder where those vias go.

1 Like

Cool. I'll share the schematic as soon as possible. Thanks!

Did you test the board before assembly? Things like open vias are know to happen.

BTW when designing a PCB, the "default" rules are not the optimum. Usually they are set at the smallest size a typical board mfg could fabricate.
For hobby boards (especially a new board) I make the traces much wider and the vias much larger. I often use duplicate vias just in case.

Got this from the gerber files


Hope this helps

You have designed what I would call an OOPS. The Arduino Uno board has only one I2C module , but it provides these SDA and SCL line at two different locations. Note these two locations are connected together. All is not lost, you can bit-bang the I2C and use most any GPIO pin. This is a good reason to build a prototype first.

Welcome to the forum.

It is possible to use the SoftwareWire with the LiquidCrystal_I2C library, but then the LiquidCrystal_I2C library has to be adapted. I did that in Wokwi simulation to create thirty I2C buses:

Please show all the code (everything), so we can check and compile it ourselves.
There is a website for that: https://snippets-r-us.com/
If you set the compiler warnings to "All" in the preferences, then it might tell about possible problems.

Is there only C3 as a decoupling capacitor ? You need more. Did you design the circuit ? Can you tell in which program it is designed ? We really need to see the schematic.
I think there are no pullup resistors for SDA and SCL, but the resistors are in the signal path. A similar problem might be at the reset pin. I see no pullup resistor, but there is a resistor to the connector.

Are the purple and grey wire for SDA and SCL attached to each other ? Please split those wires. The I2C bus can not deal with crosstalk between SDA and SCL.

Is this an assignment from school ? And were you given this board that you must use ? Then you are in trouble. The board is not okay. Return the board, together with a link to this topic.

What are you currently using pins A4 and A5 for ?
You are aware that you can attach multiple I2C devices to pins A4 and A5 provided that the devices have unique I2C addresses.

I believe all the Analog pins are currently used for current and voltage sensors.

Thanks for your input! I'll make sure that I share the link to this topic to the designers. I believe it was designed using EasyEDA. I'm not sure though. I'll try to share the schematics if possible.

Thanks for your input! I'll share this info with the designers.

This forum is the wrong place for questions of beliefs.

Check it and test it to get results.

It would be nice to see an actual schematic.
From the image in post #6 it appears that R1, R2, and C3 must be zero ohm resistors.

For a library that works with SoftwareWire, you can use the hd44780 library and the hd44780_I2Cexp i/o class.
You don't have to modify any library code, and there is an example called SoftwareWire that shows how to do this.

--- bill

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.