LCD Init

bwaii

New Member
I, too, bought one of those cheap I2C LCD's thinking I'd just hook it up and start printing. Ha! So I started researching and found some answers here. The problem is the answer was WAY over my head. So I made a small strip board and wired an 18 directly to the LCD. The nice part is the I2C board powered the backlight and gave me contrast control. Downloaded the prog from here, changed the greeting and it worked - usually. Sometimes I'd have to switch it on a coupe of times for it to boot. Tried a different 18 but same thing. Now it won't initialize at all. I get 2 rows of light squares for a second then it clears and nothing.

I tried increasing the pauses in the init section and even put it in a loop to init 3x but the welcome message never shows.

Any ideas? Or just toss it a buy another?
 

inglewoodpete

Senior Member
Persist with logical steps.

I have not tried to use one of the cheap i2c LCDs that you refer to. I have read that they can be quite a challenge.

However, I have used a PICAXE 20X2 configured as an i2c slave, controlling an 2x16 OLED display. I have found that it is necessary to power cycle the master (PICAXE) chip, the i2c slave (PICAXE or other) and the LCD EVERY time the LCD fails to work or I make a change the PICAXE i2c master's code.

It is important to save versions of software that works so that you have a fall-back that you know should work. It is too easy to have some success and then immediately go and make a small software change that fails and lose track of exactly what worked! I know - I've done it too many times :(.

If you have got the LCD working once then it will be repeatable. PICAXE chips, along with other small circuit boards do not usually fail after working a few time (unless they become physically damaged or connected badly or to the wrong voltage).

Downloaded the prog from here, changed the greeting and it worked....
If that worked, then try downloading the program again and trying that.
 

nick12ab

Senior Member
I, too, bought one of those cheap I2C LCD's thinking I'd just hook it up and start printing.
What cheap I2C LCD? 16x2 or 20x4?

Tried a different 18 but same thing. Now it won't initialize at all. I get 2 rows of light squares for a second then it clears and nothing.
What are you doing with the contrast control? Two rows of squares would suggest it is getting initialised for a 16x2 LCD.
 

Flenser

Senior Member
I get 2 rows of light squares for a second then it clears and nothing.
When you apply ground, power and contrast to these 16x2 LCDs you get a single line of light squares. The fact that you are getting "2 rows of light squares for a second then it clears" and then shows nothing indicates to me that some of of the commands in your LCD_init section are probably working successfully.

At the end of the LCD_init function before the welcome messages are displayed the LCD display _should_ be blank. The fact that it clears could indicate that your LCD_init is successful and it might be your code to write the characters (which includes the welcome message) that is not working reliably.
 

bwaii

New Member
The crinkle is that it was working and then it wasn't. Same program. It just reads temperature and puts it on the LCD. It was the beginning of what was to be a data logger. So every hour or so we'd turn it on and check the temperature (probe in the 'fridge). Sometimes the LCD would come on the first time sometimes it wouldn't. so turn it off and on and it'd work after 2 to 5 times. Now it doesn't. I wondered if a defective I2C board could be interfering.

NOTE: I'm not using the I2C. I've got an 18m2 wired to the R/W, E, and data pins and the 08 serials to the 18 which loads the LCD. It's like the axe133.

20x4
 

Flenser

Senior Member
Sometimes the LCD would come on the first time sometimes it wouldn't
The instuctions for initializing these 16x2 LCDs has very specific timings that need to be met, often as a minimum time that LCD pin X must be set before or after setting LCD pin Y.

The PICAXE firmware is an interpreter that reads your program one command at a time and then runs the code to perform each command, all the time while maintaining it's own housekeeping stuff in the background. One implication of this is that you generally can't rely on the commands taking _exactly_ the same time to execute each time you run the same program.

If the timing of the commands on your chip happen to be only just long enough to meet the LCD timing specs then on those occasions when the firmware executes the LCD_init commands a little bit faster it could mean that the timng does not meet the spec, and the LCD initialization is not successful.

You could try increasing the delays in LCD_init one at a time by 25% and see what effect that has.

FULL DISCLOSURE: I only have experience with initializing these LCDs using the AXE133 type serial backpack code. I've never tried getting the LCD code working for one of these cheap I2C type backpacks.
 
Last edited:

Rick100

Senior Member
Hello bwaii,

NOTE: I'm not using the I2C. I've got an 18m2 wired to the R/W, E, and data pins and the 08 serials to the 18 which loads the LCD. It's like the axe133.
The axe133 schematic shows RS connected to C.7, E connected to C.6, and R/W tied to ground. Can you confirm this is how you have it wired? Was the i2c board soldered to the lcd? Could you have damaged the lcd removing it?

Good luck,
Rick
 

westaust55

Moderator
For a basic LCD even the speed for the rise time of the power supply voltage and time before the very first command can have an effect.
That you were having to cycle the power several time initially suggests a possible power supply rise time problem.
How much capacitance is there across the power supply - too much capacitance can lead to slower rise times as the capacitors need to charge leading to a prospect that the LCD will not initialise properly.
 

inglewoodpete

Senior Member
For a basic LCD even the speed for the rise time of the power supply voltage and time before the very first command can have an effect.
That you were having to cycle the power several time initially suggests a possible power supply rise time problem.
How much capacitance is there across the power supply - too much capacitance can lead to slower rise times as the capacitors need to charge leading to a prospect that the LCD will not initialise properly.
It would also be wise to insert a pause of several hundred milliseconds at the start of the PICAXE code to ensure the LCD has booted fully before trying to configure it.
 

hippy

Technical Support
Staff member
Perhaps it may help if you describe exactly what you have, perhaps provide a photo. It seems you have wired to the I2C board, but perhaps not. If you did; did you actually remove the I2C controller chip ?
 

SAborn

Senior Member
Along with all other suggestions, have you simply tried adjusting the contrast to see if you get the displayed data back.
It is so easy to chase your tail and not know why with a LCD, more often its the simple things we do that cause the biggest problems.
 

bwaii

New Member
I believe the wiring is correct as it did function. I didn't remove the I2C board for fear of damaging it. My mini-solder skills aren't too great. In fact my solder usually looks more like I left the board in a pigeon coop. :) I guess damage is irrelevant now. So I just soldered on top of the pins. I hard tested it with jumpers first, then a 20x2 (Evil genius book) then the 18m2. It was erratic and I thought it was me or bad connection etc.

I did increase the delay and slowed the speed but maybe not as much as suggested here. I think I put pause 50.

The contrast is unchanged between working / not working.

I don't know how to check circuit capacitance. I have many years in general electricity and have tinkered with programing since GWBasic came free with DOS but know little about electronics. Started messing with this to home-school my son. I ran GWbasic and QBasic for him one day. His reaction was kind of funny. He kept grabbing the mouse. He looked like Scotty in Star Trek IV.
 

hippy

Technical Support
Staff member
I also left the I2C as it provided the power, resistors and contrast control.
The I2C chip may be competing with the PICAXE for control of the LCD module. That could prevent it working and could potentially lead to damage of the PICAXE chip. Such damage may be why it stopped working.

It should be possible to remove the I2C controller chip as the contrast pot should be separate from that and the resistors should also be separate or only apply to the I2C chip.
 

Flenser

Senior Member
bwaii, some clarfication please.

Does the way you have wired this all up mean that the pins on your LCD end up being connected to the pins on the I2C chip and pins on the PICAXE chip at the same time?
 

bwaii

New Member
I replied to this but looks like it didn't post. Sorry.

Yes the i2c board remained attached but it worked at first.
 

bwaii

New Member
SOLVED!!

SOLVED!!

I couldn't un-solder the i2c board so I took a grinder to it. It's off. Well, it was the Dremmel (clone) tool. I had to do the backlight and the contrast (which wasn't as easy as I hoped) and it works fine.

So the moral to this Aesops fable ( or dare I say "he-floped" fable) is remove the i2c piggy-back board if you want to save your bacon.

File this under "shudda known".

The kicker is I only had the courage to cu it after I bought another at a ridiculous price.
 
Top