-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LCD: I2C device/controller profiles #486
Comments
Not exactly. I know this is TMI, but it helps me to talk through it... I see the whole ecosystem as having five layers:
ExamplesMultiple Devices, one Controller - In motor (prior to I2C and ShiftRegister support) we had motors that required 1, 2 or 3 pins, and we had motors with current sensing pins and brake pins. These were all different devices. The physical interface, and therefore the code to control those devices was very different, but they all just used pins on the Arduino. One device, multiple Controllers - In servo we still use one PWM pin to control the servo regardless of wether it is addressed as a pin on the micro controller, or a pin on another controller (PCA9685). One device, multiple controllers. Multiple Devices, multiple Controllers - Some 2-pin motors are controlled using pins on the micro controller, others using pins that are attached to a PWM controller that we communicate with via I2C. These are different controllers. So for LCD, the differences in I2C would actually be different controllers. These all look like controllers to me, but I haven't done a deep dive on any of them If any of these LCD's have different capabilities that Add to the standard device (i.e. a backlight), those might be different devices that decorate the default. Also, if any of the LCD's share a controller, but use a different number/type of pins they would also be different devices. Ugh, this still seems convoluted. |
@dtex thanks, that helps me better understand the stuff you've been doing recently. |
@dtex re:TMI - that was really helpful to me! |
I should qualify one thing: I just made up that Foundation Class label. It's not an official thing... It just helps me organize. |
Have somebody implemented the 1602? |
This stands for the number of columns and rows: 16 columns and 2 rows. There are many 1602 devices that are already accounted for, including parallel and i2c variants. Do you have a product link for the device/ That will help us figure out which you're using. |
Thank you for fast answering. My display uses the LCM1602 IIC V1 controller. http://arduino-info.wikispaces.com/file/view/YwRobotLCD-CU-450.jpg/341645320/YwRobotLCD-CU-450.jpg This one. |
@nofear87 ok, I've got one of those here but I'm having strange issues with mine. I will post back when I know more. Thanks for your patience. |
@rwaldron That would be very nice! Thank you very much! |
@nofear87 ok, looks like mine is different, so I ordered this: http://www.amazon.com/Arrela%C2%AE-Display-Yellow-green-Backlight-Character/dp/B00KKQVHME/ref=sr_1_7?ie=UTF8&qid=1419018582&sr=8-7&keywords=i2c+lcd should be here on Sunday. I will post more when I know more :) |
good job! I am very pleased to hear that. |
@rwaldron you get it working? |
@nofear87 yes, but I haven't landed the patch yet. Unfortunately I just left my house to drive to Boston—I won't be able to get back to this until tomorrow |
@rwaldron are there some updates for me :-) |
@nofear87 yes: I've pushed all the work to this branch: https://github.com/rwaldron/johnny-five/tree/PCF8574 |
Thank you very much! I will test it today! |
@rwaldron I only have to overwrite these files, right? How can I find the pin setup I have to realize? |
The only pins are V, G, SDA, SCL. The chip on the LCD backpack will say PCF8574 or PCF8574A, then follow the example in the commit |
Overwrite? Just make a new branch in your local repo and pull PCF8574 branch onto it |
@rwaldron I have pulled the repo. var lcd = new LCD({ I get the following error: /home/robert/workspace/arduino/server.js:46 I connected it to Arduino Mega Pin 21 SCL und 20 SDA |
Try changing this: var lcd = new LCD({
controller: "LCM1602",
board: this.board
}); To this: var lcd = new five.LCD({
controller: "LCM1602"
}); The LCD class located at |
@rwaldron works like a charm...thank you very very much! |
That's awesome. I will land the branch this week and it will be available via npm (we have some other stuff to address first :) |
Hi @rwaldron, firstly, congratulations to Johnny-five project, is exciting. |
@gabrielpapke can you share your code? To initialize that device: var lcd = new five.LCD({
controller: "PCF8574"
}); I will add an alias for |
Added. var lcd = new five.LCD({
controller: "PCF8574T"
}); |
When i initialize the device the display show only box like this image This is my code: var five = require("johnny-five/lib/johnny-five.js");
var board = new five.Board();
board.on("ready", function() {
var l = new five.LCD({
controller: "PCF8574"
});
l.useChar("heart");
l.cursor(0, 0).print("hello : heart:");
l.blink();
l.cursor(1, 0).print("Blinking? ");
}); Thanks for attention. |
Are you running this code from the repo or from an npm install?
The good news is that I have that exact same LCD, so I was able to identify the actual chip model. Unfortunately, the example you've provided isn't using the correct controller, and my last fix overlooked the alternate default I2C slave address. I've just updated Johnny-Five's LCD class and confirmed on 4 separate LCD components. This code works correctly when using the LCD in the image above: // From the repo eg/ dir:
// var five = require("../");
// From an npm install:
var five = require("johnny-five");
var board = new five.Board();
board.on("ready", function() {
var lcd = new five.LCD({
controller: "PCF8574AT"
});
lcd.useChar("heart");
lcd.cursor(0, 0).print("hello :heart:");
lcd.blink();
lcd.cursor(1, 0).print("Blinking? ");
}); Note that the controller is PCF8574AT, that's the chip model as printed on the chip itself. This is very important, as it determines which default address to use. Here's a video of the above code with the same LCD: https://www.youtube.com/watch?v=thFte7gjoNI |
I'm using the code from repo, i have updated the repo but still not working :( Thanks for attention. |
Whatever the chip number on your chip, use that. Can you share a picture of your own wiring? |
Sorry if this is a dumb question, but you've made sure that StandardFirmata is on the board, correct? Can you take a picture of the back of the LCD, as close as possible but without blurring the writing on the chip and the pcb? I really appreciate your patience :) Also, this picture is really great :) I think I might've noticed something, but I can't be sure—can you take a look at these solder points: (This may be nothing at all, but I know I'd look closer at them if I could) |
Thanks for your patience too! I don't have so much experience with solder, the solder can not touch each other? Sorry about my english, I from Brazil and i speak portuguese. Thanks! |
Correct—each solder joint must be "isolated" such that it only affects the circuit nodes that it's connecting. If any of those are touching on the LCD, then it could (at least) not work correctly or (at worst) permanently damage the LCD. Do you have access to a multimeter? If you do, set it to "continuity" mode, look for this icon: Then touch and hold the two probes together, you will hear a beep when they are touching—this is just a self check. Now touch and hold the probes to any two solder joints at a time—there should be no "long beep" (some multimeters have a short tone for low ohm continuity and a continuous tone for continuity).
Don't be sorry—this is how we learn together :) |
A don't have access to a multimeter now, but I already test the LCD with C++ code directly with Arduino, and it works. Thanks for the tips. :) |
If it works with the C code, then it's not the LCD. That also means that I don't know what's wrong and I'm completely out of ideas :( I have about 10 LCDs here, 3 of which are variations of yours, 1 that is identical and all of them work for me, so I'm at a loss. |
@gabrielpapke adjust the potentiometer backside the lcd in controller |
Hey, @rwaldron, I have the same issue like @rwaldron… And also, I've tested with C++ code - everything works fine. Unfortunately, with Johny-Five it does not work correctly. But, what I have noticed… I think, the program (code below) was not loaded to Arduino, because my previous program (some operations with expander PCF8574 still working - LED are lighting). Perhaps it is some tip for you. var five = require("johnny-five");
var board = new five.Board();
board.on("ready", function() {
var random = Math.random().toString(36).replace(/[^a-z]+/g, "").substr(0, 4).toUpperCase();
var l = new five.LCD({
controller: "PCF8574T"
});
l.useChar("heart");
l.cursor(0, 0).print("hello :heart:");
l.blink();
l.cursor(1, 0).print("Blinking? ");
l.cursor(0, 10).print(random);
}); |
@rwaldron Just wanted to say that thanks to your help troubleshooting gabrielpapke's problem I decided to take a closer look at my own lcd and noticed two leads slightly touching making my ic2 code never work, yet I could bypass the ic2 chip altogether and connect the lcd to the arduino directly and it would work! This saved me from hours of frustration, so thank you! |
Examples of device/controller profile designs:
Notes:
Example Usage:
Suggested devices:
cc @deathbearbrown
The text was updated successfully, but these errors were encountered: