# Trying to send text to LCD over i2c contrib

**URL:** <https://discourse.nodered.org/t/trying-to-send-text-to-lcd-over-i2c-contrib/47873>\
**Category:** General\
**Created:** [1 July 2021 03:14 UTC](https://discourse.nodered.org/t/trying-to-send-text-to-lcd-over-i2c-contrib/47873 "2021-07-01T03:14:21Z")\
**Posts on this page:** 20\
**Page:** 3

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [1 July 2021 06:10 UTC](https://discourse.nodered.org/t/trying-to-send-text-to-lcd-over-i2c-contrib/47873/41 "2021-07-01T06:10:05Z")

</div>

Hey, no problems. If you got a python script to talk to it you are head and shoulders above me.  
(But I am short)  
😉

---

<div class="post-metadata">

**Author:** ![Gunner](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gunner/32/43582_2.png) [@Gunner](https://discourse.nodered.org/u/Gunner)\
**Post date:** [1 July 2021 06:14 UTC](https://discourse.nodered.org/t/trying-to-send-text-to-lcd-over-i2c-contrib/47873/42 "2021-07-01T06:14:20Z")

</div>

> [@E1cid](#):
>
> This should be set to json, then you can see it in the json editor.  
> Also msg, msgs, pos and center should be surrounded by " " eg. "msg"
> 
> And "false" should be `false`

OK so I am trying to send this as a JSON in an inject node... correct? It gives me grief when I deploy

`{"msgs:" [{"msg:" "Hello","pos:" 0,"center:" false}]};`

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [1 July 2021 06:17 UTC](https://discourse.nodered.org/t/trying-to-send-text-to-lcd-over-i2c-contrib/47873/43 "2021-07-01T06:17:17Z")

</div>

> [@Gunner](#):
>
> {"msgs:" [{"msg:" "Hello","pos:" 0,"center:" false}]};

not quite  
`{"msgs": [{"msg": "Hello","pos": 0,"center": false}]}`

---

<div class="post-metadata">

**Author:** ![Gunner](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gunner/32/43582_2.png) [@Gunner](https://discourse.nodered.org/u/Gunner)\
**Post date:** [1 July 2021 06:19 UTC](https://discourse.nodered.org/t/trying-to-send-text-to-lcd-over-i2c-contrib/47873/44 "2021-07-01T06:19:43Z")

</div>

OK... getting someware...

```auto
6/30/2021, 11:18:31 PM
msg : string[28]
"Message Position not 1-20: 0"

```

Oh, figured that one out 😛 changed position to 1

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [1 July 2021 06:22 UTC](https://discourse.nodered.org/t/trying-to-send-text-to-lcd-over-i2c-contrib/47873/45 "2021-07-01T06:22:34Z")

</div>

I sat down and did as @E1cid said.

Alas I get rubbish on my screen.

So I guess: Win some, lose some.

---

<div class="post-metadata">

**Author:** ![Gunner](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gunner/32/43582_2.png) [@Gunner](https://discourse.nodered.org/u/Gunner)\
**Post date:** [1 July 2021 06:22 UTC](https://discourse.nodered.org/t/trying-to-send-text-to-lcd-over-i2c-contrib/47873/46 "2021-07-01T06:22:44Z")

</div>

OK

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/c/4c719242f81a9a88c0ff1808be0b76b647069e15.png)  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/d/ed272baa9da0dade30eb874d96f6d739051d8ef0.png)

But still nada on the actual display.

I am thinking there must be something missing between NR and the physical LCD

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [1 July 2021 06:23 UTC](https://discourse.nodered.org/t/trying-to-send-text-to-lcd-over-i2c-contrib/47873/47 "2021-07-01T06:23:43Z")

</div>

This is what I have:

```auto
[{"id":"9836059f.db3a5","type":"inject","z":"3496324d.4a5fa6","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"msgs\":[{\"msg\": \"line 1\",\"pos\": 1,\"center\": false},{\"msg\":\"line 2\",\"pos\": 1,\"center\": false},{\"msg\": \"line 3\",\"pos\": 1,\"center\": false},{\"msg\": \"line 4\",\"pos\": 1,\"center\": false}]}","payloadType":"json","x":660,"y":420,"wires":[["1ef7d94c.6353ef"]]}]

```

You may have to `enable` the node.

---

<div class="post-metadata">

**Author:** ![Gunner](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gunner/32/43582_2.png) [@Gunner](https://discourse.nodered.org/u/Gunner)\
**Post date:** [1 July 2021 06:25 UTC](https://discourse.nodered.org/t/trying-to-send-text-to-lcd-over-i2c-contrib/47873/48 "2021-07-01T06:25:57Z")

</div>

> [@Trying\_to\_learn](#):
>
> You may have to `enable` the node.

What do you mean?

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [1 July 2021 06:26 UTC](https://discourse.nodered.org/t/trying-to-send-text-to-lcd-over-i2c-contrib/47873/49 "2021-07-01T06:26:34Z")

</div>

I exported it from a `disabled` flow. I wasn't sure the `enabled` state would be carried or not.

---

<div class="post-metadata">

**Author:** ![Gunner](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gunner/32/43582_2.png) [@Gunner](https://discourse.nodered.org/u/Gunner)\
**Post date:** [1 July 2021 06:39 UTC](https://discourse.nodered.org/t/trying-to-send-text-to-lcd-over-i2c-contrib/47873/50 "2021-07-01T06:39:14Z")

</div>

Well... I have now tried two different nodes...

# 1) node-red-contrib-lcd20x4-i2c

- Figured out the correct way to communicate
- But **NO** action on the physical display via NR (Py script on RPi works, so address settings & wiring are correct)

**--- I am going to shelve this one as unobtanium**

# 2) node-red-contrib-i2clcd-alt

[https://github.com/tek79/node-red-contrib-i2clcd-alt](https://github.com/tek79/node-red-contrib-i2clcd-alt)

- No way to easily import, had to learn how to do so manually 😛
- looks simpler to interface, but... noooo

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/0/40ed607a85df351e3ebe047416305ccae901c416.png)

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/9/e97f3c62ae4df471afd562aaa45cc1c3f6b60519.png)

```auto
6/30/2021, 11:36:37 PM[node: i2clcd-alt](http://10.10.3.13:1880/#)msg : error

"TypeError: Cannot read property 'localeCompare' of undefined"

```

New and strange errors that I have yet to find a suitable Google explanation for

---

<div class="post-metadata">

**Author:** ![Gunner](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gunner/32/43582_2.png) [@Gunner](https://discourse.nodered.org/u/Gunner)\
**Post date:** [1 July 2021 06:43 UTC](https://discourse.nodered.org/t/trying-to-send-text-to-lcd-over-i2c-contrib/47873/51 "2021-07-01T06:43:53Z")

</div>

and probably a rabbit trail... but...

**Requirements**

- ARM-based SBC with i2c bus
- 1602 or 2004 LCD panel that has a PCF8574T/AT i2c driver
- **node** dependencies: **i2c-bus, sleep**

Is this referring to something I must import into Node-red or install in the RPi? If the latter then I must have both already else Python scripts wouldn't work.

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [1 July 2021 06:48 UTC](https://discourse.nodered.org/t/trying-to-send-text-to-lcd-over-i2c-contrib/47873/52 "2021-07-01T06:48:24Z")

</div>

I am not sure.

But the PC8574T/AT would define the _protocol_ (or format) of how it expects the data/messages.

I'd better back out as it is getting way beyond my skill set.  
But: good on you for getting as far as you did.

Maybe:  
Rather than _chasing ghosts_ with these nodes, concentrate on the python script and use it to talk to the display.

To help you may want to look at my (sorry: _my_) script and see how I did it.  
It allows a lot of extra commands like backlight on/off and cursor blinking and on/off.

Your time may be better spent doing that than trying to get these _vague_ nodes to work.

---

<div class="post-metadata">

**Author:** ![Gunner](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gunner/32/43582_2.png) [@Gunner](https://discourse.nodered.org/u/Gunner)\
**Post date:** [1 July 2021 06:53 UTC](https://discourse.nodered.org/t/trying-to-send-text-to-lcd-over-i2c-contrib/47873/53 "2021-07-01T06:53:54Z")

</div>

Yah, probably... it is just my latest kick right now is doing "all the things" with Node-Red.

I have already minored in controlling the display and various other things from python scripts directly on the RPi, and just toggling them remotely via NR seems almost cheating 😇

But then if all the LCD nodes are all just too old to work, then no sense in chasing that lost cause... I just don't know for sure if that is the case.

Well... I will plug away when I have ideas.

Thanks for your time 🥇 It did help in the true goal toward learning **mowr!!.**

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [1 July 2021 06:56 UTC](https://discourse.nodered.org/t/trying-to-send-text-to-lcd-over-i2c-contrib/47873/54 "2021-07-01T06:56:15Z")

</div>

Yeah, I know that feeling.

Good luck with it all. Enjoy it though. You just have to keep in mind how much you are prepared to spend on it as opposed to doing it yourself.

Nothing wrong with trying.

---

<div class="post-metadata">

**Author:** ![Gunner](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gunner/32/43582_2.png) [@Gunner](https://discourse.nodered.org/u/Gunner)\
**Post date:** [1 July 2021 07:29 UTC](https://discourse.nodered.org/t/trying-to-send-text-to-lcd-over-i2c-contrib/47873/56 "2021-07-01T07:29:04Z")

</div>

> [@Gunner](#):
>
> --- I am going to shelve this one as unobtanium

@Trying_to_learn I found an example!!! - [node-red-contrib-lcd20x4-i2c Example (flow) - Node-RED](https://flows.nodered.org/flow/611699c1c6e6b90f6100b0ab2574fc0d)

Not that it made any difference to my display ☹

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [1 July 2021 09:15 UTC](https://discourse.nodered.org/t/trying-to-send-text-to-lcd-over-i2c-contrib/47873/57 "2021-07-01T09:15:28Z")

</div>

Ok - so hopefully that example flow "should work" - so looking elsewhere for things to check...

1. is i2c interface enabled in raspi-config ?
2. is there a contrast control on the lcd that needs to be adjusted (on my non-i2c one it is very sensitive to setting the contrast correctly - 90% of range is white on white so no obvious output.. - but at other end of scale can make it look black on black so you know there is power...)
3. double check the wiring - sda and scl correct ? power correct ? etc

---

<div class="post-metadata">

**Author:** ![Gunner](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gunner/32/43582_2.png) [@Gunner](https://discourse.nodered.org/u/Gunner)\
**Post date:** [1 July 2021 09:21 UTC](https://discourse.nodered.org/t/trying-to-send-text-to-lcd-over-i2c-contrib/47873/58 "2021-07-01T09:21:35Z")

</div>

Again... works perfectly from any script directly on the RPi... and I do keep checking to keep my sanity level 🤪 Wiring, power, i2c connectivity, all good.

Just no apparent way to get it to work via Node-Red. Don't make much sense to me.

Also, I can easily control servos via a i2c PWM board (PCA9685) via nodes on Node-Red, so that should show that there IS possible i2c connectivity between Node-Red and my RPi (and yes, I have even disconnected that board just to confirm no possible conflict)

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [1 July 2021 09:28 UTC](https://discourse.nodered.org/t/trying-to-send-text-to-lcd-over-i2c-contrib/47873/59 "2021-07-01T09:28:13Z")

</div>

So ok - sounds like that node just needs some serious debugging... but looking at it (for 30 seconds) - it looks like it just calls out to a python program anyway - so maybe you can do similar with an exec (or node-red-node-daemon) node to call one of the apps you have that does work...

---

<div class="post-metadata">

**Author:** ![Gunner](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gunner/32/43582_2.png) [@Gunner](https://discourse.nodered.org/u/Gunner)\
**Post date:** [1 July 2021 09:33 UTC](https://discourse.nodered.org/t/trying-to-send-text-to-lcd-over-i2c-contrib/47873/60 "2021-07-01T09:33:37Z")

</div>

> [@dceejay](#):
>
> looks like it just calls out to a python program anyway

No indication of that as a dependency... just the basic i2c-bus needed for all i2c stuff.

> [@dceejay](#):
>
> so maybe you can do similar with an exec

Yes, that is a workaround... if I had actual need to do so. This has mostly been a journey to see what all I can control directly from Node-Red for future projects.

I have dropped a issue post on the **node-red-contrib-i2clcd-alt** github page about the error the node tosses out.

As for **node-red-contrib-lcd20x4-i2c** well, no errors (when done right 😇 ) so not sure what more that author could contribute.

I think I looked at a few others (for both LCD and OLED), but they where all clear they didn't work with newer Node-Red versions... I am suspecting the same might be the case here as well, even if there is no official declaration.

---

<div class="post-metadata">

**Author:** ![Gunner](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gunner/32/43582_2.png) [@Gunner](https://discourse.nodered.org/u/Gunner)\
**Post date:** [1 July 2021 09:42 UTC](https://discourse.nodered.org/t/trying-to-send-text-to-lcd-over-i2c-contrib/47873/61 "2021-07-01T09:42:38Z")

</div>

> [@dceejay](#):
>
> but looking at it (for 30 seconds)

That's actually on my list of to-do's... figure out how nodes are actually made, and edited if need be.

[Previous page](https://discourse.nodered.org/t/trying-to-send-text-to-lcd-over-i2c-contrib/47873.md?page=2)

[Next page](https://discourse.nodered.org/t/trying-to-send-text-to-lcd-over-i2c-contrib/47873.md?page=4)
