nuromantix

It may sound intimidating to begin with, but the process can be broken down into three more straightforward steps:

  1. Get your LCD screen working with one of libraries referenced above. I would recommend the nodejs option, as that uses javascript which is a relatively nice language for inexperienced developers, and has an API based on Liquid Crystal for Arduino. Note, you will need to swap some of the pins on the P8 header which are used in the example, as they are used by Bela (to see which pins Bela uses, take a look at our handy interactive pin diagram).

  2. Send the text you want to display from PureData over OSC. OSC stands for open sound control, it's a way of communicating between different programs, particularly when building musical systems. It's very common to send OSC messages from PD, see here for an example (note you will need to use IP address 127.0.0.1).

  3. Receive the OSC messages in nodejs, and pass them to the LCD screen. I would recommend using osc-min for this.

It sounds complicated I know, but being able to send osc messages around is a powerful and useful skill! Feel free to ask any questions here if you get stuck.

Thanks! I am sure I'll be back for help but that breaks it down into 3 steps that sound possible.

2 months later

Well I WAS way out of my depth and I chose the bloody-minded route to do it in PD regardless of it being a bit crazy..... still a smaller time investment than learning new programming languages at this stage.
For anyone else who needs it, here is a PD patch that will initialise an HD44780 compatible LCD and display messages on there.
You have to make sure you LOADBANG the INITIALISE subpatch.
Then simply send a message to "string" and it will be output from the analogue outs on Bela to your LCD.
The patch supports capital letters, numbers, and the following other characters: . : - ! ?
It outputs a solid square if it receives a #. It outputs an outline square if it receives a |.
You must use _ instead of "space" in your messages and you can use @ to clear the display and * to display on line 2 of the display.
You could easily expand it to display lowercase and more punctuation if you need it.
It uses the 4 bit interface mode of the display so you only need 6 analogue outs on the Bela, as follows:
Bela out 7 to LCD D7
Bela 6 to D6
Bela 5 to D5
Bela 4 to D4
(D3 to D0 tied to ground)
Bela 3 to RS
Bela 2 to Enable

https://github.com/nuromantix/PD-bela-stuff/blob/master/LCD_Driver.pd
https://github.com/nuromantix/PD-bela-stuff/blob/master/bela_44780_lcd_driver.pd

Thanks that looks great. Surely github needs a plugin to display pure data patches in the browser 😛

By any chance, did you test this with the digital outs as well? Or were the voltage levels not compatible?

I couldn't get the display to power up from 3.3 volts but it is probably enough for the logic.
So you could power from the 5V rail but use digi outs for the logic.
I wasn't brave enough to risk mixing up the wires in case I fried the Bela!

Awesome, this is really great!

We should probably think about ways of sharing/distributing community-contributed code and pd objects etc like this.

Thought I ought to give something back after all my beginner questions......

    a year later

    Hi nuromantix , I'm trying to use your LCD driver but am a bit lost with the messages. What, in the patch, is prompting something to be sent to the LCD? It seems like the is but I'm not sure how to bang the message once it's in the BELA. Forgive me if this is simple, I'm fairly new and a bit over my head but very excited about the driver you made!

      mollyqh Also new to this forum and can't figure out how to uncross my text... SOS

      SOS'ed. Not sure what happened there

      I'll add to the mix of suggestions something that simplifies this for me.
      Adafruit LCD USB backpack:
      https://www.adafruit.com/product/782

      Then power comes from your BBB USB port and it shows up as a USB TTY device, which should be really easy to use from Pd (I'm talking to it using C++ directly).

      Some extra advice on this USB backpack is the code shipped from Adafruit is a little bit buggy (weird stuff happening with read/write EEPROM), so custom characters and saved stuff get garbled and mixed up sometimes.

      The github user CanyonCasa fixed the bugs and added some nice features (GPIO):
      https://github.com/CanyonCasa/BackpackPlus
      I forked this and added an audio level meter and some other small things that strike my fancy:
      https://github.com/transmogrifox/Adafruit_USB_Backpack_Plus
      Also I added the .hex file for the EEPROM clearing utility, so hypothetically all you need is AVRdude and the instructions on my github to flash this image if you want to.

      The image from Adafruit works mostly ok, so there are only some odd behaviors you will notice when you try to do stuff with custom characters or RGB backlighting saved settings.

      7 days later

      mollyqh

      Sending messages to @string do work. But you have to add @ at the start of a new line. There are examples at the LCD driver patch. You should also check the connections from analog out. It all works for me. But some isolation circuit might be needed because LCD consumes lots of energy and makes voltage lower than usual. Try this scheme:

      http://howtomechatronics.com/wp-content/uploads/2015/07/LCD-Display-Tutorial.png?x57244

      Some of the nodes need to be shorted together. So order of the upper nodes are like this
      [GND, 5V, GND, BELA, GND, BELA, GND, GND, GND, GND, BELA, BELA, BELA, BELA, 5V, GND]

      3 months later

      hope this is not too off topic, but if one wanted to hookup a rectangular display (without touch) of some sort: what would be the easiest solution on the bela? a tft? lcd? oled?

      5 years later

      Thanks for the pd patch @nuromantix

      I've tried breadboarding this with a HD44780 but couldn't get it working yet

      First attempt was using the routing mentioned:
      Bela out 7 to LCD D7
      Bela 6 to D6
      Bela 5 to D5
      Bela 4 to D4
      (D3 to D0 tied to ground)
      Bela 3 to RS
      Bela 2 to Enable

      Then I noticed in the 'send_to_output' sub patch that it shows digi pin inputs on the LCD routed slightly differently:

      Bela out 7 to LCD D0
      Bela 6 to D1
      Bela 5 to D2
      Bela 4 to D3
      (D4-D7 to GND)

      This didn't work either.. The LCD backlight does come on. I've got an alternating message box being sent to string (printed to console to verify it's working)

      Has anybody got any idea where it's going wrong? Or any recommendations for using other LCD/OLED with Pd... i'm open to changing the screen if necessary.

      Thank you

      alt text

      alt text

        I also followed @egegonul 's suggestion to GND the unused digi pins in each scenario

        alt text

        dipaloka
        Bela 3 to RS
        Bela 2 to Enable

        The patch shows:

        alt text

        so it should be:
        Analog out 2 to RS
        Analog out 3 to E

        thanks Giulio,
        some progress... i get some blocks when the patch first opens..

        alt text

        then the metronome kicks in and the blocks are changing from light to dark every 1000ms, but there's no visible text

        currently trying to figure out if there's a way to change contrast settings, perhaps it has something to do with that?

          after changing the string text and making it 2 lines it did this - imgur.com/a/VOHfHmK

          dipaloka currently trying to figure out if there's a way to change contrast settings, perhaps it has something to do with that?

          I don't know :-( I never used this display myself.

          dipaloka Bela out 7 to LCD D0
          Bela 6 to D1
          Bela 5 to D2
          Bela 4 to D3
          (D4-D7 to GND)

          can you try going back to the previous pinout where you are using D4-D7 ? This page seems to indicated that D4-D7 are the lines to be used when in 4-bit mode ...
          If I were your, I'd also try to reverse the order of the pins just in case the comment got it backwards.