Node for node-red to interact with Adafruit and sainsmart i2c-lcd's. Also units built using MCP23017 i2c port expander and a HD44780 LCD or conpatable 16x2 LCD.
npm install node-red-contrib-i2c-lcd-adafruit-sainsmartnode-red-contrib-i2c-lcd-adafruit-sainsmart
===========================================
~/.node-red:
npm install node-red-contrib-i2c-lcd-adafruit-sainsmart
`
i2c_LCD_Input
i2c_LCD_Input - Node for recording a button press from the controller.
It will send button presses to:
msg.button_name
msg.button_state
example:
If you press the down button you will recieve,
msg.button_name = DOWN, msg.button_state = pressed
When you relesse the down button you will recieve,
msg.button_name = DOWN, msg.button_state = released
!msgbtn1.png
!input.png
$3
i2c Device # - The device number by default is set to 1. This is the number for most current raspberry pi's. i2c device numbers can range from i2c-0 to i2c-256. To find your device from the command line use
$3
i2c Address - The Address by default is set to 0x20. This is the Address for Adafruit and sainsmart units that use the MCP23017 i2c port expander. The rang the MCP23017 uses is a hex value from 0x20 to 0x27. If you need further information please see data on the MCP23017.
$3
Polling ms - The speed, in milliseconds, at witch the i2c port expander (MCP23017) polls button presses. By default is set to 200ms. Also if the i2c_LCD_Input not is not used polling is disabled as there is no need to listen for button press events. Averag people have a hard time responding to a stimulus faster than that. The minimum value allowed is 40ms; however if you have other devices using the i2c bus you will be fighing for use of the bus.
i2c_LCD_Output
i2c_LCD_Output - Node for sending txt and changing screen color of the LCD. Settings button changes between Basic or Advanced. If you are just looking to put some txt onto the screen and want to have it clear the old message for you and dim the screen after an ammount of time you define then Basic is for you. Advanced is if you wish to control every aspect of the message. You control clearing the screen, turning it on and off etc. This is needed if your going to create your own LCD menu system or something complicated.
!output_basic.png
!output_advanced.png
$3
Manufacture - The maker of the product. Default value is set to Adafruit. sainsmart clone uses a backlight and then a seperate RGB led. It requires sending some extra bytes to turn on and off the backlight. Make sure you select the correct maker.
$3
i2c Device # - The device number by default is set to 1. This is the number for most current raspberry pi's. i2c device numbers can range from i2c-0 to i2c-256. To find your device from the command line in linux use.
`
$ ls /dev | grep i2c
`
A list of all avalible i2c chips will be listed.
$3
i2c Address - The Address by default is set to 0x20. This is the Address for Adafruit and sainsmart units that use the MCP23017 i2c port expander. The rang the MCP23017 uses is a hex value from 0x20 to 0x27. If you need further information please see data on the MCP23017.
Also you can install i2cdetect to list all of your detected devices addresses.
`
$ sudo i2cdetect -y your_device_numer_here
`
on my raspberry pi it is 1 so....
`
$ sudo i2cdetect -y 1
`
$3
Line1 - The text sent to the first line of the LCD screen
Line2 - The text sent to the second line of the LCD Screen
You can send basic lines of text to the screen without much worry. However if you get fancy with the characters you send things may not show up on the screen as expected.
If you send a backslash \ you will get a Yen symbol. You may send any char to the screen that is in the HD44780 char sheet.
If you want to send the letter Q you can send a msg with Q or you can send a msg with \x51 as you can see on the chart its in coll 5 and row 1.
!Line1_n_2_example.png
`JSON
[{"id":"e5bc0af2.967648","type":"i2c_LCD_Output","z":"7edb64d7.2216cc","name":"","manufacturer":"adafruit","Line1":"Line1","Line2":"Line2","settings":"Basic","basic_screen_color":"ON","timeLimit":3,"timeLimitType":"seconds","i2c_device_number":1,"i2c_address":"0x20","advanced_clear":"clear","advanced_close":"close","advanced_color":"color","advanced_char0":"char0","advanced_char1":"char1","advanced_char2":"char2","advanced_char3":"char3","advanced_char4":"char4","advanced_char5":"char5","advanced_char6":"char6","advanced_char7":"char7","x":1140,"y":260,"wires":[]},{"id":"17b1c82d.6a8488","type":"change","z":"7edb64d7.2216cc","name":"\\x51","rules":[{"t":"set","p":"Line1","pt":"msg","to":"P\\x51RS \\x51 ","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":970,"y":260,"wires":[["e5bc0af2.967648"]]},{"id":"d2f15605.3ed8b8","type":"inject","z":"7edb64d7.2216cc","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":820,"y":260,"wires":[["17b1c82d.6a8488"]]},{"id":"69b53087.ded8","type":"comment","z":"7edb64d7.2216cc","name":"hex for the letter Q","info":"","x":970,"y":220,"wires":[]}]
``