Trying to send text to LCD over i2c contrib

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

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}]};

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

OK... getting someware...

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

Oh, figured that one out :stuck_out_tongue: changed position to 1

1 Like

I sat down and did as @E1cid said.

Alas I get rubbish on my screen.

So I guess: Win some, lose some.

OK

image
image

But still nada on the actual display.

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

This is what I have:

[{"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.

What do you mean?

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

1 Like

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

  • No way to easily import, had to learn how to do so manually :stuck_out_tongue:
  • looks simpler to interface, but... noooo

image

image

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

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.

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.

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 :innocent:

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 :1st_place_medal: It did help in the true goal toward learning mowr!!.

1 Like

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.

@Trying_to_learn I found an example!!! - node-red-contrib-lcd20x4-i2c Example (flow) - Node-RED

Not that it made any difference to my display :frowning:

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

Again... works perfectly from any script directly on the RPi... and I do keep checking to keep my sanity level :crazy_face: 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)

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...

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

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 :innocent: ) 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.

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