Author Topic: MoteinoMEGA & LCD Shield problems [SOLVED: BAD BREADBOARD!]  (Read 1880 times)

doublec4

  • Jr. Member
  • **
  • Posts: 53
MoteinoMEGA & LCD Shield problems [SOLVED: BAD BREADBOARD!]
« on: March 25, 2018, 07:49:36 PM »
Hi all,

I was previously using an Arduino pro mini and had my project working flawlessly. I wanted to introduce some RF communication capabilities so I picked up some Moteinos. I am using the Moteino Mega with my 16x2 LCD display:

https://www.dfrobot.com/wiki/index.php/LCD_Keypad_Shield_V2.0_SKU:_DFR0374

I understand that the Moteino products run on 3.3V and that LCD shield runs on 5V. I am correctly powering the LCD shield with 5V and I am using Moteino Mega digital pins 16 through 22 (I don't see any conflict with the pins used for the RFM69) connected to a Nexperia 74LVC4245A translator to shift from 3.3V to 5V for the LCD pins.

https://assets.nexperia.com/documents/data-sheet/74LVC4245A.pdf

My first test was to upload the program I was previously using with my Pro Mini to the Moteino Mega just to make sure the LCD screen / buttons, etc were working. Of course in my program I had to change the pin numbers to the appropriate pin numbers on the Moteino Mega, but nothing else was altered. Unfortunately, the LCD screen shows nothing on the screen.

I've checked over the connections 100 times now, verified the pin numbers are correct, verified that the translator is working correctly (I connected each of the pins to 3.3V to make sure the corresponding output one reliably outputs 5V). I cannot seem to get the LCD screen to print anything. I then used the very simple "Hello World" example program and still nothing. I also plugged my LCD screen back into my pro mini project board and it works flawlessly. No problems with the LCD screen being fried.

I am thinking that something in the LiquidCrystal library is not playing nicely with the Moteino MEGA. Anyone else experience this issue? Is there a known fix? I searched the forum but only see a problem related to I2C LCD screen. Mine is the regular 7 wire 16x2 display... any help would be greatly appreciated!

Thank you
« Last Edit: March 27, 2018, 09:14:42 AM by Felix »

perky

  • Hero Member
  • *****
  • Posts: 873
  • Country: gb
More info needed I think. Which signals did you use (are they unconnected to anything else on the Moteino Mega?), what code are you using to initialise the LCD? Any other code present like the RFM library or is this bare bones? Have you tried toggling the pins directly in the firmware to verify connectivity rather than applying voltages to your interface?

Mark.

doublec4

  • Jr. Member
  • **
  • Posts: 53
Hi Mark,

When you say, "which signals did you use?" I'm not sure what you mean by that. I only used digital pins 16 through 22 strictly for the LCD interface. Not connected to anything else. Just a straight run from the Moteino Mega to the translator and the corresponding output to the LCD shield.

I can try toggling the pins now and report back.

For the sake of simplicity, we can try to get the simple "hello world" program working. Which I have been unsuccessful with using the Moteino Mega.

Code: [Select]
/*
  LiquidCrystal Library - Hello World

 Demonstrates the use a 16x2 LCD display.  The LiquidCrystal
 library works with all LCD displays that are compatible with the
 Hitachi HD44780 driver. There are many of them out there, and you
 can usually tell them by the 16-pin interface.

 This sketch prints "Hello World!" to the LCD
 and shows the time.

 Library originally added 18 Apr 2008
 by David A. Mellis
 library modified 5 Jul 2009
 by Limor Fried (http://www.ladyada.net)
 example added 9 Jul 2009
 by Tom Igoe
 modified 22 Nov 2010
 by Tom Igoe
 modified 7 Nov 2016
 by Arturo Guadalupi

 This example code is in the public domain.

 http://www.arduino.cc/en/Tutorial/LiquidCrystalHelloWorld

*/

// include the library code:
#include <LiquidCrystal.h>

// initialize the library by associating any needed LCD interface pin
// with the arduino pin number it is connected to
const int rs = 18, en = 17, d4 = 22, d5 = 21, d6 = 20, d7 = 19;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

void setup() {
  // set up the LCD's number of columns and rows:
  lcd.begin(16, 2);
  // Print a message to the LCD.
  lcd.print("hello, world!");
}

void loop() {
  // set the cursor to column 0, line 1
  // (note: line 1 is the second row, since counting begins with 0):
  lcd.setCursor(0, 1);
  // print the number of seconds since reset:
  lcd.print(millis() / 1000);
}

doublec4

  • Jr. Member
  • **
  • Posts: 53
To make things even more confusing... I did as suggested and created a simple program to cycle through each of the digital outputs, run them high and then turn them off:

Code: [Select]
void setup() {


}

void loop() {


for (int j = 16; j < 23; j++)
{
  digitalWrite(j,HIGH);
  delay(1000);
  digitalWrite(j,LOW);
}
}

I then probed digital pins 16 through 22 on the Moteino Mega and I could see each one rise to 3.3V for a moment, and fall back to zero. For this test I also removed the LCD shield, allowing me to probe the output pins on the translator. I was expecting to see the same result where each pin would rise to 5V for a moment, and then fall back to zero. However, with the LCD shield removed, all output pins on the translator were stuck at 5V for some strange reason. I repeated the test with the LCD shield back on the breadboard and I had the same result.

I then uploaded the hello world sketch back to the Moteino and I could see the voltages varying again on the input and only some of the outputs of the translator.

Do these LCD screens require bi-directional communication? I was under the impression that it was just a one way communication from Arduino to whatever driver is on this LCD shield...

perky

  • Hero Member
  • *****
  • Posts: 873
  • Country: gb
Have you configured the pins as outputs with pinMode? E.g.

Code: [Select]
void setup() {
for (int j = 16; j < 23; j++)
{
  pinMode(j, OUTPUT);
}

for (int j = 16; j < 23; j++)
{
  digitalWrite(j,HIGH);
  delay(1000);
  digitalWrite(j,LOW);
}
}
To answer your question, the shield has strapped the W pin to write only so it's not possible to read the busy bit (it complicates the interface to use bidirectional accesses). It relies on software delays to ensure commands are actioned properly. Most of these character LCD module shields, like yours, also use 4 bit mode so only 4 of the data lines are wired up.

Mark.
« Last Edit: March 26, 2018, 11:57:19 AM by perky »

doublec4

  • Jr. Member
  • **
  • Posts: 53
Thanks Mark, I will give that a try as I didn't do that. I suppose I forgot to do that in my code for the Pro Mini but it worked fine, but it is obviously good practice.

I also realized that I routed the analog out from the LCd shield (for the push buttons) directly to A0 on my Moteino... it might be seeing ~4V right now, exceeding the 3.3V limit. Maybe this is throwing things off on the Moteino board. Additionally, for another translator chip, the TXB0108, the datasheet suggests that unused pins are brought to the same potential on the input/output rather than left floating. My unused pins are floating.. might be creating other issues.

I will try again when I get home and report back.

Thanks!

perky

  • Hero Member
  • *****
  • Posts: 873
  • Country: gb
OK. BTW if the pin is in input mode (which it will be after a power up) when you do a digital write high the pullup is turned on, and when you do a digital write low it is turned off leaving the pin floating. Any attempt to measure it using a scope or DVM can add enough impedance to ground to discharge the stray capacitance, so you may well see it go back low. This explains why once the pullup has been turned on the output from your translator appeared permanently high. There's leakage from the translator's input buffers that will potentially bias the input pin close to its switching threshold eventually possibly causing oscillation, so you must drive these signals and not float them.

Mark.

doublec4

  • Jr. Member
  • **
  • Posts: 53
Okay problem solved.

After all of this nonsense it turns out that one of the rows on my breadboard is faulty  >:( Noticed it after probing the pin off the translator and seeing it go from 5V to 0V but then the corresponding pin on the LCD shield was stuck on 5V... obviously something wasn't right. No continuity on that row, ugh.

Thanks for all of the help!

perky

  • Hero Member
  • *****
  • Posts: 873
  • Country: gb
OK, presumably you turn the pins to outputs now too? Did one row dodgy on your breadboard affect multiple outputs (was it a gnd or something)?

Mark.

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6867
  • Country: us
    • LowPowerLab
Okay problem solved.

After all of this nonsense it turns out that one of the rows on my breadboard is faulty  >:(
Was that made in china? :)
Happens to me all the time. We are very unfortunately hooked and dependent to cheap chinese crap.

How does it feel to get screwed?

doublec4

  • Jr. Member
  • **
  • Posts: 53
Re: MoteinoMEGA & LCD Shield problems [SOLVED: BAD BREADBOARD!]
« Reply #10 on: March 27, 2018, 10:18:57 AM »
What I noticed was that if you just power the LCD shield and do not have any wires connected to the data pins, the data pins get pulled up to 5V at some point. I'm just using a simple multimeter so I can only probe one pin at a time, but my guess is that if the lcd driver doesn't get some specific instructions within some amount of time starting up all those data pins just sit stuck at 5V.

Since one of my breadboard rows was faulty, the driver was never getting any start up instructions... and after a few seconds all the pins would sit at 5V.

I did change the outputs on the Moteino to output as you suggested, and this corrected the issue with the Moteino outputs, so that was helpful!

... and yes... cheap Chinese breadboard  :-\