1 2 Previous Next 25 Replies Latest reply on Apr 30, 2015 1:36 PM by slbaker

    Fix & Sample for LCD on Edison

    ForumMigrationAdmin

      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);
      }
      
      
      
      
      
      
        • 1. Re: Fix & Sample for LCD on Edison
          ForumMigrationAdmin

          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

          • 2. Re: Fix & Sample for LCD on Edison
            ForumMigrationAdmin

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

            • 3. Re: Fix & Sample for LCD on Edison
              ForumMigrationAdmin

              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

              • 4. Re: Fix & Sample for LCD on Edison
                ForumMigrationAdmin

                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

                • 5. Re: Fix & Sample for LCD on Edison
                  ForumMigrationAdmin

                  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
                  


                  • 6. Re: Fix & Sample for LCD on Edison
                    ForumMigrationAdmin

                    with

                    opkg info upm | head -n2
                    

                     

                    you should get something like


                    Package: upm
                    Version: 0.1.6-r0
                    

                     

                    If not run

                    opkg install upm
                    
                    • 7. Re: Fix & Sample for LCD on Edison
                      ForumMigrationAdmin

                      matthias-hahn (Intel)

                      thanks, it works for me.

                      thank you very much  

                      • 8. Re: Fix & Sample for LCD on Edison
                        ForumMigrationAdmin

                        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

                        • 9. Re: Fix & Sample for LCD on Edison
                          ForumMigrationAdmin

                          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

                          • 10. Re: Fix & Sample for LCD on Edison
                            ForumMigrationAdmin

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

                            • 11. Re: Fix & Sample for LCD on Edison
                              ForumMigrationAdmin

                              Quote:

                              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.

                              • 12. Re: Fix & Sample for LCD on Edison
                                ForumMigrationAdmin

                                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?

                                • 13. Re: Fix & Sample for LCD on Edison
                                  ForumMigrationAdmin

                                  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

                                  • 14. Re: Fix & Sample for LCD on Edison
                                    ForumMigrationAdmin

                                    Quote:

                                    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

                                    1 2 Previous Next