Code Monkey home page Code Monkey logo

pimatic-lcd's Introduction

pimatic-lcd

pimatic support for LCD Displays using i2c serial bus.

Tested with:

  • 2004 LCD Display Module HD44780 (20x4)
  • 1602 LCD Display Module HD44780 (16x2)

Example config:

{
  "plugin": "lcd",
  "bus": "/dev/i2c-1",
  "rows": 4,
  "cols": 20
}

If the i2c address of the LCD Display Module is different from the default address "0x27", the "address" property needs to be set. If the address of the module is unknown the i2cdetect tool can be used which is part of the i2c-tools package on Raspbian. Note, the addresses output by the tool are hexadecimal numbers. To set the address property of the plugin accordingly, the number has to be provided as a string preceded by 0x.

{
  "plugin": "lcd",
  "bus": "/dev/i2c-1",
  "address": "0x23",
  "rows": 4,
  "cols": 20
}

Example rules:

IF $syssensor.cpu changes
THEN display "CPU: {$syssensor.cpu}%" on lcd line 1


IF $syssensor.cpu changes or $syssensor.memory changes
THEN display "CPU: {$syssensor.cpu}%" on lcd line 1 and display "MEM: {$syssensor.memory}MB" on lcd line 2


IF switch is turned off
THEN turn LCD backlight off


IF switch is turned off
THEN display "Bye bye" on lcd and after 5 seconds turn LCD backlight off

pimatic-lcd's People

Contributors

mwittig avatar sweetpi avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

pimatic-lcd's Issues

hardcoded address?

Hi,

here is something wrong, my lcd runs on i2c-1 address 20

/usr/local/pimatic-app# i2cdetect -y 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: 20 -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- UU -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

I can display whatever i want with some python scripts,

This dont work for me
{
"plugin": "lcd",
"bus": "/dev/i2c-1",
"rows": 2,
"cols": 16
},
This also dont work:
{
"plugin": "lcd",
"bus": "/dev/i2c-1",
"address": 20,
"rows": 2,
"cols": 16
},

19:40:19.375 [pimatic-homeduino] info: Connected to homeduino device.
Possibly unhandled Error: Cannot write to device
at i2c.writeByte (/usr/local/pimatic-app/i2c.coffee:51:10)
at i2c.writeByteAsync (eval at makeNodePromisifiedEval (/usr/local/pimatic-app/node_modules/pimatic-lcd/node_modules/i2c-lcd/node_modules/bluebird/js/main/promisify.js:201:12), :12:22)
at /usr/local/pimatic-app/node_modules/pimatic-lcd/node_modules/i2c-lcd/lib/lcd.js:68:26
at tryCatch1 (/usr/local/pimatic-app/node_modules/pimatic-lcd/node_modules/i2c-lcd/node_modules/bluebird/js/main/util.js:45:21)
at Promise$_callHandler as _callHandler
at Promise$_settlePromiseFromHandler as _settlePromiseFromHandler
at Promise$_settlePromiseAt as _settlePromiseAt
at Async$_consumeFunctionBuffer as _consumeFunctionBuffer
at Async$consumeFunctionBuffer (/usr/local/pimatic-app/node_modules/pimatic-lcd/node_modules/i2c-lcd/node_modules/bluebird/js/main/async.js:40:14)
at process._tickCallback (node.js:415:13)
19:40:22.105 [pimatic] info: new device "EasyBox"...

But if i change the lcd-config-schema.coffee default and remove "address" from config.json pimatic startup without errors:

module.exports = {
title: "lcd plugin config options"
type: "object"
properties:
bus:
description: "i2c bus device"
type: "string"
default: "/dev/i2c-1"
address:
description: "address of the device"
type: "number"
default: 0x20
rows:
description: "number of rows (lines) of the LCD"
type: "number"
default: 2
cols:
description: "number of cols (characters in a line) of the LCD"
type: "number"
default: 16

but if i set a rule like this it will run and say "displaying xx on line 1" but nothing happend on line 1

"rules": [
{
"id": "aa",
"name": "aa",
"rule": "if $syssensor1.cpu changes then display "CPU: {$syssensor1.cpu}%" on lcd line 1",
"active": true,
"logging": true
}

i also see in my logs a error in the first install of pimatic-lcd:

19:17:29.044 [pimatic] info: loading plugin: "pimatic-sunrise" (0.8.0)
19:17:29.209 [pimatic-cron] info: the time is: Sat Jan 03 2015 19:17:29 GMT+0100 (CET)
19:17:29.534 [pimatic-sunrise] info: Your location is set to lat: 53.682185431, long: 9.749752655
Possibly unhandled TypeError: Failed to set address
at i2c.setAddress (/usr/local/pimatic-app/node_modules/pimatic-lcd/node_modules/i2c-lcd/node_modules/i2c/lib/i2c.coffe
e:64:10)
at i2c.writeByte (/usr/local/pimatic-app/node_modules/pimatic-lcd/node_modules/i2c-lcd/node_modules/i2c/lib/i2c.coffee
:81:10)
at i2c.writeByteAsync (eval at makeNodePromisifiedEval (/usr/local/pimatic-app/node_modules/pimatic-lcd/node_modules/i
2c-lcd/node_modules/bluebird/js/main/promisify.js:201:12), :12:22)
at /usr/local/pimatic-app/node_modules/pimatic-lcd/node_modules/i2c-lcd/lib/lcd.js:68:26
at tryCatch1 (/usr/local/pimatic-app/node_modules/pimatic-lcd/node_modules/i2c-lcd/node_modules/bluebird/js/main/util.
js:45:21)
at Promise$_callHandler [as _callHandler](/usr/local/pimatic-app/node_modules/pimatic-lcd/node_modules/i2c-lcd/node_m
odules/bluebird/js/main/promise.js:660:13)
at Promise$_settlePromiseFromHandler [as _settlePromiseFromHandler](/usr/local/pimatic-app/node_modules/pimatic-lcd/n
ode_modules/i2c-lcd/node_modules/bluebird/js/main/promise.js:675:18)
at Promise$_settlePromiseAt [as _settlePromiseAt](/usr/local/pimatic-app/node_modules/pimatic-lcd/node_modules/i2c-lc
d/node_modules/bluebird/js/main/promise.js:845:14)
at Async$_consumeFunctionBuffer as _consumeFunctionBuffer
at Async$consumeFunctionBuffer (/usr/local/pimatic-app/node_modules/pimatic-lcd/node_modules/i2c-lcd/node_modules/bluebird/js/main/async.js:40:14)
at process._tickCallback (node.js:415:13)
19:17:29.811 [pimatic-homeduino] info: Connected to homeduino device.
19:17:38.676 [pimatic] info: new device "EasyBox"...

It looks like something (address) is hardcode or the installation was wrong...

Pimatic-LCD error Cannot write to device at i2c.writeByte

Hello,

I am facing an issue with pimatic-lcd or i2c plugin. I am using lcd to display current temperature and time based on rule every 5 seconds. After few hours lcd stops responding with following error:

debug [pimatic]: Error: Cannot write to device at i2c.writeByte (/i2c.coffee:58:10) at
i2c.tryCatcher (/root/pimatic-app/node_modules/pimatic-lcd/node_modules/i2c-
lcd/node_modules/bluebird/js/main/util.js:24:31) at i2c.ret [as writeByteAsync](eval at
%28/root/pimatic-app/node_modules/pimatic-lcd/node_modules/i2c-
lcd/node_modules/bluebird/js/main/promisify.js:154:12%29, :12:39) at /root/pimatic-
app/node_modules/pimatic-lcd/node_modules/i2c-lcd/lib/lcd.js:72:26 at tryCatcher
(/root/pimatic-app/node_modules/pimatic-lcd/node_modules/i2c-
lcd/node_modules/bluebird/js/main/util.js:24:31) at Promise._settlePromiseFromHandler
(/root/pimatic-app/node_modules/pimatic-lcd/node_modules/i2c-
lcd/node_modules/bluebird/js/main/promise.js:454:31) at Promise._settlePromiseAt
(/root/pimatic-app/node_modules/pimatic-lcd/node_modules/i2c-
lcd/node_modules/bluebird/js/main/promise.js:530:18) at Async._drainQueue (/root/pimatic-
app/node_modules/pimatic-lcd/node_modules/i2c-
lcd/node_modules/bluebird/js/main/async.js:84:12) at Async._drainQueues (/root/pimatic-
app/node_modules/pimatic-lcd/node_modules/i2c-
lcd/node_modules/bluebird/js/main/async.js:89:10) at Async.drainQueues (/root/pimatic-
app/node_modules/pimatic-lcd/node_modules/i2c-
lcd/node_modules/bluebird/js/main/async.js:14:14) at process._tickCallback (node.js:415:13

Firstly I thought that it is hardware isssue but python script is running ok
python2 /root/python-i2c-lcd/display.py test1test2test3~test4
Only pimatic restart helps but just for few hour...

Thank you for any idea how to fix it.
BR, Michal

device connected @ /dev/usb/iowarriorX

Hi there,
it is not possible to connect 44780 display to USB Port with IOWarrior24 Device; shouldn't this also work via /dev/usb/iowarrior0 or /dev/usb/iowarrior1? thank you in advance.

init log info:
Unhandled rejection TypeError: Failed to set address
at TypeError (native)
at i2c.setAddress (/home/pi/pimatic-app/node_modules/pimatic-lcd/node_modules/i2c-lcd/node_modules/i2c/lib/i2c.coffee:38:10)
at i2c.writeByte (/home/pi/pimatic-app/node_modules/pimatic-lcd/node_modules/i2c-lcd/node_modules/i2c/lib/i2c.coffee:57:6)
at i2c.tryCatcher (/home/pi/pimatic-app/node_modules/pimatic-lcd/node_modules/i2c-lcd/node_modules/bluebird/js/release/util.js:16:23)
at i2c.ret [as writeByteAsync] (eval at (/home/pi/pimatic-app/node_modules/pimatic-lcd/node_modules/i2c-lcd/node_modules/bluebird/js/release/promisify.js:184:12), :13:39)
at /home/pi/pimatic-app/node_modules/pimatic-lcd/node_modules/i2c-lcd/lib/lcd.js:68:26
at tryCatcher (/home/pi/pimatic-app/node_modules/pimatic-lcd/node_modules/i2c-lcd/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/home/pi/pimatic-app/node_modules/pimatic-lcd/node_modules/i2c-lcd/node_modules/bluebird/js/release/promise.js:510:31)
at Promise._settlePromise (/home/pi/pimatic-app/node_modules/pimatic-lcd/node_modules/i2c-lcd/node_modules/bluebird/js/release/promise.js:567:18)
at Promise._settlePromiseCtx (/home/pi/pimatic-app/node_modules/pimatic-lcd/node_modules/i2c-lcd/node_modules/bluebird/js/release/promise.js:604:10)
at Async._drainQueue (/home/pi/pimatic-app/node_modules/pimatic-lcd/node_modules/i2c-lcd/node_modules/bluebird/js/release/async.js:143:12)
at Async._drainQueues (/home/pi/pimatic-app/node_modules/pimatic-lcd/node_modules/i2c-lcd/node_modules/bluebird/js/release/async.js:148:10)
at Immediate.Async.drainQueues [as _onImmediate] (/home/pi/pimatic-app/node_modules/pimatic-lcd/node_modules/i2c-lcd/node_modules/bluebird/js/release/async.js:17:14)
at processImmediate [as _immediateCallback] (timers.js:383:17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.