0

So i got that 2,5m cable wired with the LCD and the arduino, but i keep getting those weird characters showing up on the LCD. Clearly there is a signal loss between the components but there has to be a solution to the problem. Perhaps by connecting capacitors/resistors to the wires will help? Is there any solution other than not using this long cable?

  • 1
    Try shielding the cable. Wrap it in tin-foil or something. – Gerben Aug 4 '15 at 15:05
  • 2
    2.5m of what cable? What interface are you using for the LCD? – Majenko Aug 4 '15 at 15:05
1

If the interface you're using is I2C(only two cables from arduino to lcd, vice versa)you have a problem,you need to pull up the sda-scl channel with appropriate resistors, you could (maybe) boost the I2C signal using ti-p82b715 bus extender, I just assume you use I2C (2,5m length?), what interface do you use? SPI? I2C?

1

I'm presuming this is I2C or SPI, because a Serial cable of 2.5 m should still work.

You can slow both I2C and SPI down.


In the case of SPI you can call something like this:

SPI.setClockDivider(divider);

Where "divider" is one of:

  • SPI_CLOCK_DIV2
  • SPI_CLOCK_DIV4
  • SPI_CLOCK_DIV8
  • SPI_CLOCK_DIV16
  • SPI_CLOCK_DIV32
  • SPI_CLOCK_DIV64
  • SPI_CLOCK_DIV128

The default is SPI_CLOCK_DIV4, so try a larger divider.


In the case of I2C you can change the clock speed and the prescaler. The default frequency is 100 kHz, but you could make it slower.

TWBR   prescaler   Frequency

  12       1       400   kHz  (the maximum supported frequency)
  32       1       200   kHz
  72       1       100   kHz  (the default)
 152       1        50   kHz
  78       4        25   kHz
 158       4        12.5 kHz

For example, to run at half the frequency (50 kHz) use:

  Wire.begin ();
  TWBR = 152;  

To run at 25 kHz you also need to change the prescaler, eg.

  Wire.begin ();
  TWBR = 78;  
  TWSR |= bit (TWPS0);

In the case of I2C make sure you have pull-up resistors on SDA and SCL in order to get a clean signal. 4.7 k is a reasonable value to try (for both of them) with the other ends connected to +5 V.

  • Sorry. I probably should have mentioned hat my LCD is connected to an arduino expander - a mcp23017 to be specific - which is connected to the arduino. Therefore I guess that I use I2c? – CrazyBacon Aug 5 '15 at 17:41
  • Yes, the MCP23017 is I2C. The MCP23S17 is SPI. You should have four wires in that case: +5V, Gnd, SDA, SCL. Make sure you have the 4.7 k pull-up resistors on SDA and SCL (at the Arduino end). Also try dropping the I2C frequency as shown above. – Nick Gammon Aug 5 '15 at 20:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.