LCD class for a 16x2 LCD using the Hitachi HD44780 driver chip

Project: LCD library for Electrosmith’s Daisy Seed
Description: LCD class for a 16x2 LCD using the Hitachi HD44780 driver chip, using 4 bit parallell mode
Author: Staffan Melin, staffan.melin@oscillator.se
Project site: http://www.oscillator.se/opensource
Based on: HD44780-Stm32HAL by Olivier Van den Eede (https://github.com/4ilo/HD44780-Stm32HAL)

I needed some way for my Daisy Seed to speak to an LCD Keypad that I have used with Arduinos. The LCD is a 16x2 LCD using the Hitachi HD44780 driver chip.

I first tried to port the Arduino LiquidCrystal library, without success. Searching online, I found HD44780-Stm32HAL, by Olivier Van den Eede (https://github.com/4ilo/HD44780-Stm32HAL). I modified it, removed what I didn’t need, and turned it into a C++ class.

My LCD Keypad doesn’t have a RW line, but if you have it, connect it to ground.

For instructions on how to use it with your Daisy Seed, see test.cpp.

To use on other Daisys, I think you can replace the #include “daisy_seed.h” and the DaisySeed reference in Lcd::init().


Lcd is licensed under The MIT License (MIT)

6 Likes

Just a note: This library is now included in libdaisy.

3 Likes

Hi, I am using the HD44780 1602 LCD module but can’t find the driver in LibDaisy. I can only find :
OLED_SoftSPI
OLED_SSD130x4WireSPI
OLED_SPI

My mistake I was looking in DaisyExamples\libDaisy\examples and it is in src/dev folder.
https://electro-smith.github.io/libDaisy/lcd__hd44780_8h_source.html

@justinjools Glad you found it! I hope you got it working, too!

I am using it in my OscPocketD project: https://www.oscillator.se/wp-content/uploads/opensource/daisy/oscpocketd.zip

Hi Steffan, I already had a look through your code and pulled out the essential set up part to test it below. I compiled it but have yet to test it on Daisy. Does this look right to you? Thanks for your reply. Your project looks very impressive btw and would like to try once I’ve mastered the basics.


#include "daisy_seed.h"
#include "dev/lcd_hd44780.h"

// Daisy SM uses SCL - SPI_SCK D1O, SDA - SPI_MOSI D9
// Use the daisy namespace to prevent having to type
// daisy:: before all libdaisy functions
using namespace daisy;

// globals
LcdHD44780 lcd;

#define PIN_LCD_RS 8 // LCD: pin 8 pin_rs
#define PIN_LCD_EN 7 // LCD: pin 9 pin_en
#define PIN_LCD_D4 9 // LCD: D4 data_pin[0]
#define PIN_LCD_D5 10 // LCD: D5 data_pin[1]
#define PIN_LCD_D6 11 // LCD: D6 data_pin[2]
#define PIN_LCD_D7 12 // LCD: D7 data_pin[3]

// Declare a DaisySeed object called hardware
DaisySeed hardware;

int main(void)
{
    // Configure and Initialize the Daisy Seed
    hardware.Configure();
    hardware.Init();
    
    // LCD
	LcdHD44780::Config lcd_config;
	lcd_config.cursor_on = true;
	lcd_config.cursor_blink = false;
    lcd_config.rs = hardware.GetPin(PIN_LCD_RS);
	lcd_config.en = hardware.GetPin(PIN_LCD_EN);
	lcd_config.d4 = hardware.GetPin(PIN_LCD_D4);
	lcd_config.d5 = hardware.GetPin(PIN_LCD_D5);
	lcd_config.d6 = hardware.GetPin(PIN_LCD_D6);
	lcd_config.d7 = hardware.GetPin(PIN_LCD_D7);
	lcd.Init(lcd_config);

    lcd.SetCursor(0, 1);
    lcd.Print("hello, world!");

}

It’s been pointed out to me that the parallel interface is used for this project and my HD44780 has a I2C adpapter. Being new to this I didn’t know there was a difference. Can you give me some direction for getting this to work with I2C using the driver. Thanks.

Another Daisy dead end. I found out that I can just connect using the header pins to connect to parrallel and not use or remove the I2C adapter. But I am also using Daisy SM which I’m told doesn’t have enough pins to do parallel connection.

1 Like

@justinjools Sorry I can’t help you. I am not active at all with the Daisy, having moved on to more powerful hardware. Like you, I only used what I could find, and sifting through examples got it to work in the state that I have described in my project.

I agree that my feeling when starting out with Daisy Seed was that documentation and documented code was lacking.

My contribution to remedy this was this project.

https://www.oscillator.se/opensource/#daisy

I didn’t get a lot of feedback that time, but I had a lot of fun with the Daisy Seed.

any clue to find information about it?

Well, I still think Daisy Seed is a wonderful piece of hardware. I had a lot of fun working with it. But I needed more “juice” to I started working with SBCs, and, finding they got more and more powerful and at the same time more and more expensive, just abandoned the whole idea.

So now I work with cheap available Linux boxes, refurbished laptops etc. No special hardware, a working OS etc. What I find laying around.

Sounds very interesting. Daisy is my gateway into learning to program with the STM controllers and will see how far I can get with this platform for my design ideas. I am going to try out CircuitPython next with the STM32F411CE Black Pill which has more peripheral support like Adafruit which is what I’m after. The limitations on peripheral support is a shame as I too feel this is a fantastic platform. I’m also going to look at Raspberry Pi which I considered before trying Daisy, and see Korg use it for the synth design now.

Zynthian is a Raspberry Pi based open source (software and hardware) synthesizer. It combines a huge number of available synths and puts them in a framework that provides a mixer, microDAW, sequencer, looper, etc.
You can use “official” hardware or use the software with DIY hardware or even just a Raspberry Pi.
Main website:

Forum:

github:

1 Like