My LCD takes too much pin

Hello,

For my project, i need to use a lcd, a shift register (74HC595) and 3 HC-SR04 (ultrasonic sensor). But the problem is that my shift register takes 3 pin, my 3 sensor 6 pin and my LCD 6 pin too. On the Arduino uno, it's still 14 pin maximum that's why I use the shift register to get some leds and buzzer. So I decided to put the enable pin of the LCD to 5V immediatly to preserve some over pin for the LCD. But I saw that in the arduino code it's impossible to run without the enable pin connected to a arduino pin.

Is it possible to run the lcd in an other way ?

Great

Chris

You could use an I2C I/O extender to drive the LCD in four bit mode.

Yeah and how it work cuz don't know this component...
Do you have a video or something like this ?

Google "PCF8574 Arduino LCD"

Nice Thanks you !

So I decided to put the enable pin of the LCD to 5V immediatly to preserve some over pin for the LCD. But I saw that in the arduino code it's impossible to run without the enable pin connected to a arduino pin.

It is impossible to run the LCD with the Enable pin connected to 5V no matter which code you try to use. The pin does not enable the chip, it enables the data transfer. It has to be pulsed in accordance with specific timing constraints for each character or command that is sent to or from the LCD module.

An I2C adapter, as previously mentioned, is your best choice.

Don

You can probably use a second pcf8574 to replace the 74hc595. That will save 3 more pins.

The 74HC595 is imposed by the teacher, so i can't remove it but that's a good idea !

Famd:
For my project, i need to use a lcd, a shift register (74HC595) and 3 HC-SR04 (ultrasonic sensor). But the problem is that my shift register takes 3 pin, my 3 sensor 6 pin and my LCD 6 pin too. On the Arduino uno, it's still 14 pin maximum that's why I use the shift register to get some leds and buzzer. So I decided to put the enable pin of the LCD to 5V immediatly to preserve some over pin for the LCD. But I saw that in the arduino code it's impossible to run without the enable pin connected to a arduino pin.

Write down your complete requirements. i.e. all your LEDs, Sensors, LCD, ...
It is generally unwise to use the Serial pins. But a Uno still leaves D2-D13 and A0-A5 for your external electronics. i.e. 18 pins

I2C backpacks are very handy for an LCD display. You can also use them for your LEDs.
Likewise, you can use 74HC595 for the LCD and another 74HC595 for the LEDs.

In your case, you can probably manage with your existing 18 GPIO pins.

The important lessons are:

  1. write down your pin requirements.
  2. multiple devices can connect to the I2C bus. Only two pins are used.
  3. multiple devices can connect to the SPI bus. Only three pins are used + N chip-select pins

The HC595 can connect to the SPI bus. Do not connect Q7' to MISO.

In practice, a single MCU with more legs is easier than adding external chips.
I2C backpacks are cheap, convenient and available. Very attractive for LCD.

David.