Software Archive
Read-only legacy content
17061 Discussions

Fix & Sample for LCD on Edison

Bob_Duffy
Moderator
4,247 Views

If you are using the Grove Starter Kit for the IOT Development kit you may be having a problem getting it to work.  Some documentation has the incorrect BUS ID listed and could be the issue. Also you need to make sure the data being sent to the LCD is a string. 

To fix the BUS issue change the BUS ID from 0 to 6, ie from this:, Jhd1313m1(0, 0x3E, 0x62); to Jhd1313m1(6, 0x3E, 0x62);

Also make sure your data you writing the the LCD is a text string. Simple way to do this is add the sensor variable to a text message ie:
lcdMessage = "Light is "+lightValue+".";

Here is sample javascript code that should work using the Intel XDK, which reads from the light sensor then outputs it on the LCD. Connect the light sensor for the Starter Kit to A0, and connect the LCD to any I2C.

var mraa = require ('mraa');
var LCD  = require ('jsupm_i2clcd');
console.log('Current version of MRAA is', mraa.getVersion());

var light = new mraa.Aio(0);
var lightValue;
var lcdMessage=" ";
var myLCD = new LCD.Jhd1313m1(6, 0x3E, 0x62);

loop();

function loop(){
    lightValue  = light.read();
    lightValue = Math.round( lightValue*.1);
    lcdMessage = "Light is @ "+lightValue+"%";
    myLCD.setCursor(0,1);
    console.log(lcdMessage); 
    myLCD.write(lcdMessage);
    setTimeout(loop,1000);
}

 

0 Kudos
23 Replies
Richard_B_1
Beginner
3,667 Views
Hi I came across your post and would like to know if there is a way to copy and modify jsupm_i2clcd so it can work with a generic i2c backpack LCD connected to a Galileo?. If so, can you tell me where jsupm_i2clcd is stored so I could take a look at it? I am rather new to node.js, as mostly played around with C++, where it is easy to modify header files. thanks rick
0 Kudos
Matthias_H_Intel
Employee
3,667 Views

don't have a system running right now. But just have a look with "opkg files upm"

0 Kudos
Richard_B_1
Beginner
3,667 Views
Thanks Mhanh I finally just took the SD card and did a search and found jsupm_i2clcd.node in /usr/lib/node_modules/jsupm_i2clcd, but it isn't a file that can be edited. I have tried to just see if I could do a npm install of a generic i2c-lcd, but so far haven't gotten any to work. I'll keep looking, but it shouldn't be that hard as the standard backpack i2c LCDs run on just about everything out there, including the Raspberry Pi. thanks rick
0 Kudos
alex_w_
Beginner
3,667 Views

while i have an error said as the following:

ERROR:Error: Cannot find module 'jsupm_i2clcd'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object. (/node_app_slot/main.js:5:12)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.run

0 Kudos
Matthias_H_Intel
Employee
3,667 Views

pls make sure you have the latest libmraa / upm installed:

cat > /etc/opkg/mraa-upm.conf <<EOF
src mraa-upm http://iotdk.intel.com/repos/1.1/intelgalactic
EOF
opkg upgrade
opkg update

 

0 Kudos
Matthias_H_Intel
Employee
3,667 Views

with 

 

opkg info upm | head -n2

you should get something like

Package: upm
Version: 0.1.6-r0

If not run 

opkg install upm

 

0 Kudos
alex_w_
Beginner
3,667 Views

 thanks, it works for me.

thank you very much   :)

0 Kudos
alex_w_
Beginner
3,667 Views

 thanks, it works for me.

thank you very much   :)

0 Kudos
Richard_B_1
Beginner
3,667 Views
After changing the bus from 6 to 0 it worked on a Galileo 1 with a Grove RGB LCD This should be included as an example for the kit. Thanks rick
0 Kudos
Bob_Duffy
Moderator
3,667 Views
Rick is right. Bus 0 is the correct address for Galileo and is what is listed in existing documentation. For Edison, however the documentation has not caught up, and why I posted this sample explaining the address change to 6. The sample should work with either board as long as you change the Bus address
0 Kudos
Matthias_H_Intel
Employee
3,667 Views

sure - as a heads up: updated examples are supposed to appear on https://github.com/intel-iot-devkit/iot-devkit-samples; work in progress ...

0 Kudos
Brendan_L_Intel
Employee
3,667 Views

Bob Duffy (Intel) wrote:

Rick is right. Bus 0 is the correct address for Galileo and is what is listed in existing documentation. For Edison, however the documentation has not caught up, and why I posted this sample explaining the address change to 6. The sample should work with either board as long as you change the Bus address

Not required anymore if you have the latest libmraa. Bus 0 should work everywhere.

0 Kudos
toadaze
Beginner
3,667 Views

I've been trying to get a couple of my LCD displays working on my Edison to no avail. These are the standard non-RGB type that work with Adafruit i2c backpacks. In fact, they work fine on the Edison using the Arduino IDE and the Adafruit i2c MCP23008 library.  In that case, SCL from the display connects to A5 on the Edison/Arduino and SDA connects to A4.

But I can't get them working with mraa/upm as used with the Edison IOTDK or XDK. I don't get any errors - just nothing on the display. I suspect addressing is different.  The i2c addressing on the backpack can be changed from 0-7, but I'm not sure that's what you refer to as BUS ID. Nor do I understand what the rgb-lcd library expects or how to match lcdAddress 0x3E and rgbAddress 0x62 to my displays.  I know my displays won't respond to rgb type functions, but it seems like normal characters would display.

Or is there something about the rgb-lcd libraries that make them completely incompatible with standard lcd displays?

 

0 Kudos
Bob_Duffy
Moderator
3,667 Views

Marvin, when I say bus to 0 or 6 I'm referring to my line of code here
var myLCD = new LCD.Jhd1313m1(6, 0x3E, 0x62);

The LCD that comes with the starter kit from Seeed has the following parameters. The first parameter is the i2c bus.  

Jhd1313m1 constructor

Parameters
bus i2c bus to use
address the slave address the lcd is registered on
address the slave address the rgb backlight is on

 

 
 
0 Kudos
Stan_G_
Beginner
3,667 Views

Marvin A. wrote:

I've been trying to get a couple of my LCD displays working on my Edison to no avail. These are the standard non-RGB type that work with Adafruit i2c backpacks. In fact, they work fine on the Edison using the Arduino IDE and the Adafruit i2c MCP23008 library.  In that case, SCL from the display connects to A5 on the Edison/Arduino and SDA connects to A4.

But I can't get them working with mraa/upm as used with the Edison IOTDK or XDK. I don't get any errors - just nothing on the display. I suspect addressing is different.  The i2c addressing on the backpack can be changed from 0-7, but I'm not sure that's what you refer to as BUS ID. Nor do I understand what the rgb-lcd library expects or how to match lcdAddress 0x3E and rgbAddress 0x62 to my displays.  I know my displays won't respond to rgb type functions, but it seems like normal characters would display.

Or is there something about the rgb-lcd libraries that make them completely incompatible with standard lcd displays?

 

Hi - I have been beating my head against the wall on this issue and believe I am getting somewhere.

I have one of these generic I2c LCD displays that works fine on an Arduino. I ported the arduino code to the Arduino IDE for edison and as soon as the code started executing the console started blatting a huge amount of register info with errors appearing to come from I2c.

I then ported/re-wrote the code for the edison IDE and used the lcd code from the example.

The example code (sort of worked) - occasionally I got display corruption like the cursor positioning was not quite correct.

So then I ran my code - and lo and behold the register dumps came back.

Now the example code uses the grove LCD which also has a seperate address for an I2c controlled backlight (or color - cant fully remember).

SO I recompiled using the lcd1602 include - and nothing comes out on the LCD - but lots of register dumps come up. (Note that I had to change the initialisation call as there is only one I2c address used)

I did a logic trace and it appears nothing is coming out on i2c either!

The example using the grove LCD did put stuff out on i2c!

I need to do more tests (and perhaps write a much simpler example) but electrically nothing has changed (just different library used) - when I get home I will post the exact model of the LCD along with more findings.

Note that once the register dumps start coming, a power reset of the arduino/edison board seem to be manditory to get anything happening again.

Stan

0 Kudos
toadaze
Beginner
3,667 Views

I still haven't gotten my generic LCD displays working on the Edison.  I'm using Adafruit's "i2c / SPI character LCD backpack PRODUCT ID: 292" on both a 2x20 and 4x20 display. They work fine on my Arduino UNO using the Arduino IDE and the Adafruit i2c MCP23008 library.

On another note, I notice the bus id doesn't matter using the latest mraa/upm updates on Grove's rgb-lcd. I can use 0 or 6 just fine on the Edison. Just wish I could use my bigger and better 4x20 generic display on the Edison. The Grove display has poor contrast.

 

0 Kudos
Artem_P_
Beginner
3,667 Views

Hi all!

C can't get this code working.

I am getting lcd purple and "light is ..." on console, but not on my Grove-lcd.

I have edison with upm  0.1.8.59

 

0 Kudos
toadaze
Beginner
3,667 Views

While I have been successfully reading and displaying various sensors on my Grove - LCD RGB Backlight using Javascript and Python, I haven't been able to do the same using C++.  My problem is converting a number from a sensor to a string for the display.

The old iota function is not supported by the compiler provided by IoTDK, so I've been trying to use stringstream.  After a bit of trial and error, I was able to convert a number to a string with the following code:

adc_value = mraa_aio_read(adc_a0);
fprintf(stdout, "ADC A0 read %X - %d\n", adc_value, adc_value);
int number = adc_value;
std::ostringstream ostr;
ostr << number;
std::string theNumberString = ostr.str();
lcd->write(theNumberString);

So much so good, but for some reason #include <sstream> causes an error with my upm library. It gives me "undefined reference to `upm::Jhd1313m1::Jhd1313m1(int, int, int)'" on this statement:  upm::Jhd1313m1 *lcd = new upm::Jhd1313m1(0, 0x3E, 0x62);

Here's what I'm including:

#include <unistd.h>
#include "mraa/aio.h"
#include "stdio.h"
#include "mraa.h"
#include <iostream>
#include <string>
#include "upm/grove.h"
#include "upm/jhd1313m1.h"
#include <sstream>

If I comment out #include <sstream> the upm statement works fine, but of course, then I have no way to convert a number to a string.

Any idea what's going on?

 

0 Kudos
Alexander_A_2
Beginner
3,667 Views

I'm also having issues with getting the Grove LCD display to work with the Edison.

I can get it to change the backlight color, but the lcd->write statements don't seem to be working, as I see no text!

0 Kudos
Raghavendr_U_Intel
3,487 Views

we have seen similar issues where it was only lighting the LCD but nothing was written. if you are using Grove kit expansion sheild, then you have a switch next to A0, which needs to be changed to 5v. it was in 3.3v when we found this issue. When we changed this to 5v, we started getting the text on the LCD. 

 

Ural

0 Kudos
Reply