Go Down

Topic: what pins do I use with the arduino Micro and a serial LCD? (Read 7 times) previous topic - next topic

1ChicagoDave

.

My suspicion is that the code from the seller may be a bit too generic, something he picked up somewhere else but hasn't tried - because he probably only sells Arduino stuff, rather than using it as is our interest.



What a good argument for purchasing items from good, open-source suppliers which thoroughly test everything they sell to ensure compatibility & provide excellent online documentation & support of all of their products.....even if that means it costs an extra dollar or two.
:smiley-roll:

kd7vea

I was thinking about it, and what I dont understand is that the scanner does not pick it up. Regardless of the lcd header file , shouldnt the i2c scanner show something?  I am not adding my possibly corrupt header file to the scanner, or should I be?

jack wp

Which scanner are you using. I think if you are using the one from Nick, the script is all inclusive (don't need to add anything else).

And of course, if you do not have it wired to the right pins, It will not find anything. Did you decide which pins to use on the Micro?

Good luck, Jack

1ChicagoDave


jack wp

Ha Dave. I don't think the contrast control will make any difference while trying to scan for I2C slave addresses. I used the scanner from Nick, and it worked really well.
Good luck, Jack

kd7vea

#20
Sep 10, 2013, 06:34 am Last Edit: Sep 10, 2013, 06:36 am by kd7vea Reason: 1
I did use Nicks scanner, and that is why I wonder what the problem is.  if the scanner works fine, it has to be something that I am doing on my end because even the serial monitor isn't doing anything, it displays absolutely nothing. I did turn the contrast up and down, and it does change the display, but that is it.  oddly, when I do that, it only gives me two white bars across the display(Lines 1 and 3)  I would have expected that all 4 lines would have lit up???  is there anything special that I need to do to make the scanner work?  If I run the scanner without the display, shouldn't the serial monitor at least say that there is nothing there?

1ChicagoDave

Interesting.  It writes to the display 1st line then wraps to 3rd line. How it's designed.

You have the four line LCD, right?

Did you notice the comments next to the I2C address in your code?

Code: [Select]
LiquidCrystal_I2C lcd(0x27,20,4);  // set the LCD address to 0x27 for a 16 chars and 2 line display

Might want to look at these -
http://forum.arduino.cc/index.php?topic=158312.0
http://arduino-info.wikispaces.com/LCD-Blue-I2C

kd7vea

#22
Sep 10, 2013, 07:36 am Last Edit: Sep 10, 2013, 07:56 am by kd7vea Reason: 1
Yes, I did notice that in the code, and I am trying to make sense of a lot of things right now.  here is what I have found.  I wanted to make sure that the serial display was functioning properly so I wrote a quick little test sketch
Code: [Select]
#include <Wire.h>

void setup()
{
  Wire.begin();
  Serial.begin(9600);
}
void loop()
{
  Serial.println("TEST");
  delay(1000);
}

and opened the serial monitor, and it worked.

so I decided to toy with the I2C scanner sketch, if I comment out everything (except for the closing "}" )after  Serial.println("Scanning..."); then it just keeps printing  Scanning...  but when I try to let the whole program run,, I get nothing at all on the serial monitor.  It seems as if there is a bug in the scanner code.  I cant see any reason why it would not work on the micro. here is the link to the scanner page, I copied and pasted right from this page, I have also clicked on the get code button and used that one.

UPDATE  I commented out the  line  " error = Wire.endTransmission();"
and now it shows a couple hundred addresses in the serial monitor.  Is it possible that I have the wrong code?  It would still work on the arduino micro correct?

TheCoolest

Have you added pullup resistors to the SDA and SCL lines?  Try adding them if you didn't and run the I2C scanner sketch again.
I'm quite positive that your problem is with incorrect wiring.

kd7vea

#24
Sep 16, 2013, 05:51 am Last Edit: Sep 16, 2013, 06:05 am by kd7vea Reason: 1
OK, I got it.  I took everything else off of my bread board to eliminate anything else that could cause problems.  At this point the I2C scanner started working.  after that, I started going from pin to pin.  I found out that it is the 2 pins on the board labeled 1 and 2 (1ChicagoDave pointed this out earlier)  so there was something in the rest of my wiring that was tripping it up.  So, the pins used are the two pins labeled 2 (SDA)and 3(SCL).  no pullup resistors needed.  so now I can start moving on. thanks for the help everyone, and hopefully this helps someone else in the future.
Jake
KD7VEA

Paul__B


Have you added pullup resistors to the SDA and SCL lines?  Try adding them if you didn't and run the I2C scanner sketch again.


I have had a bit of a bash at figuring out the library code.  I have not found the actual bus manipulation/ transfer points, but note that the SDA and SCL lines have the internal pullups enabled as part of initialisation.

It makes obvious sense to use these, though it means that a write command must (simultaneously) change pin mode and pin state on each transition.

TheCoolest

It has been shown that using external resistors of around 4.7K (or 10K) produce a much nicer square wave than the built in pullups of the Atmega chip.
I'm not sure whether that I2C module has pullups, or whether the IC on it already has proper pullups built in, but it is usually recommended to have 4.7K or so external pullups on your I2C bus.

Paul__B


It has been shown that using external resistors of around 4.7K (or 10K) produce a much nicer square wave than the built in pullups of the Atmega chip.

No doubt, since the internal pullups presumably correspond to a greater resistance.  On the other hand, MOS pullups can implement a more closely constant-current drive.


I'm not sure whether that I2C module has pullups, or whether the IC on it already has proper pullups built in, but it is usually recommended to have 4.7K or so external pullups on your I2C bus.

Slave devices should not contain pullups as a general rule (because by definition, there are likely to be more than one).  There is a consideration whether the pullups should only be on the master, or at the distant end of the bus.

jack wp

Quote
I found out that it is the 2 pins on the board labeled 1 and 2 (1ChicagoDave pointed this out earlier)  so there was something in the rest of my wiring that was tripping it up.  So, the pins used are the two pins labeled 2 (SDA)and 3(SCL).

I am confused. Did you find data pins 1 and 2 to be the SDA and SCL, or is it data pin 2 and 3 ?
(On the Micro).

Good luck, Jack

kd7vea

if you look at the attached image, the pins are on the left side, and the 7th, and 8th down from the top.  they are marked in the picture as 2/SDA, and 3(PWM) /SCL  I matched the pins on the LCD to the pins, on the board, hooked up the power wires, and the Scanner gave me the address 0x27.  I am having problems with my LCD.h file, I think I don't have it installed in the library right, I will have to do some more digging and see what I come up with.

Go Up