Cool 2 Line LCD modules on EBay under $6.00

Profw

Member
Here is a link to EBay for the under $6.00 each LCD modules. I bought 7 of these to use for our Robotics Club for Children. I suggest we all get one to play with.
Sounds good, it uses only 2 I/O pins and communicates via I2C. Now here is the forum part. Who can get these particular LCD units to work with a PicAxe ? So I know it works with Arduino, but we are using 18M2+. Pins 7 and 10 are all that’s needed to hook up on the 18M2+. I checked all the previous threads and none of them will work. So here is the deal can we as a group solve this little mystery?



Serial IIC/I2C/TWI 1602 lcd Character led Module Display For Arduino R3 yellow


Here is the Arduino test code:
Code:
Arduino Test Code:

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,16,2); //set the LCD address to 0x27 for a 16 chars and 2 line display
void setup()
{
lcd.init();
lcd.backlight();
lcd.setCursor(0, 0);
lcd.print("www.b2cqshop.com ");
lcd.setCursor(0, 1);
lcd.print("Voltage: ");
lcd.setCursor(13, 1);
lcd.print("V");
}
void loop()
{
int val;
float temp;
val=analogRead(0);
temp=val/4.092;
val=(int)temp;//
lcd.setCursor(9, 1);
lcd.print(0x30+val/100,BYTE);
lcd.print(0x30+(val%100)/10,BYTE);
lcd.print('.');
lcd.print(0x30+val%10,BYTE);
delay(100);
}
 
Last edited by a moderator:

Dippy

Moderator
You need to link us to the datasheet. It may be easier to make up code from there.
How 'cool' is it? Or do you just mean cheap? :)

If you want people to translate the code for you then you'll have to provide the source code for the call "LiquidCrystal_I2C.h".
Lines like lcd.whatever() are of no use without it.
 

Profw

Member
I think it's cool because it only uses 2 I/O pins on a PicAxe. I see good point as far as your link comment. I just copy and paste the description (not really a link) of the EBay item on EBay's website. The item description has a lot of information. I will look up the Library routines. Here they are I hope this helps someone else as well.
The wire Library just takes care of the pin hook ups as follows: On the PicAxe it would be pin 7 and pin 10.

Board I2C / TWI pins
Uno, Ethernet A4 (SDA), A5 (SCL)
It took a little doing but here it is:

Code:
 LiquidCrystal.I2C.h


// ---------------------------------------------------------------------------
// Created by Francisco Malpartida on 20/08/11.
// Copyright 2011 - Under creative commons license 3.0:
//        Attribution-ShareAlike CC BY-SA
//
// This software is furnished "as is", without technical support, and with no 
// warranty, express or implied, as to its usefulness for any purpose.
//
// Thread Safe: No
// Extendable: Yes
//
// @file LiquidCrystal.h
// This file implements a basic liquid crystal library that comes as standard
// in the Arduino SDK.
// 
// @brief 
// This is a basic implementation of the LiquidCrystal library of the
// Arduino SDK. The original library has been reworked in such a way that 
// this class implements the all methods to command an LCD based
// on the Hitachi HD44780 and compatible chipsets using the parallel port of
// the LCD (4 bit and 8 bit).
//
// The functionality provided by this class and its base class is identical
// to the original functionality of the Arduino LiquidCrystal library.
//
//
// @author F. Malpartida - [email]fmalpartida@gmail.com[/email]
// ---------------------------------------------------------------------------
#ifndef LiquidCrystal_4bit_h
#define LiquidCrystal_4bit_h

#include <inttypes.h>

#include "LCD.h"
#include "FastIO.h"


/*!
    @defined 
    @abstract   Command execution time on the LCD.
    @discussion This defines how long a command takes to execute by the LCD.
      The time is expressed in micro-seconds.
*/
#define EXEC_TIME 37

class LiquidCrystal : public LCD
{
public:
   /*!
    @method     
    @abstract   8 bit LCD constructors.
    @discussion Defines the pin assignment that the LCD will have.
    The constructor does not initialize the LCD.
    */
   LiquidCrystal(uint8_t rs, uint8_t enable,
                 uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3,
                 uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7);
   LiquidCrystal(uint8_t rs, uint8_t rw, uint8_t enable,
                 uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3,
                 uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7);
   
   /*!
    @method     
    @abstract   4 bit LCD constructors.
    @discussion Defines the pin assignment that the LCD will have.
    The constructor does not initialize the LCD.
    */
   LiquidCrystal(uint8_t rs, uint8_t rw, uint8_t enable,
                 uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3);
   LiquidCrystal(uint8_t rs, uint8_t enable,
                 uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3);
   
   /*!
    @function
    @abstract   Send a particular value to the LCD.
    @discussion Sends a particular value to the LCD for writing to the LCD or
    as an LCD command.
    
    Users should never call this method.
    
    @param      value Value to send to the LCD.
    @result     mode LOW - write to the LCD CGRAM, HIGH - write a command to
    the LCD.
    */
   virtual void send(uint8_t value, uint8_t mode);
   
   /*!
    @function
    @abstract   Switch-on/off the LCD backlight.
    @discussion Switch-on/off the LCD backlight.
    The setBacklightPin has to be called before setting the backlight for
    this method to work. @see setBacklightPin.
    
    @param      mode: backlight mode (HIGH|LOW)
    */
   void setBacklight ( uint8_t mode );
   
   /*!
    @function
    @abstract   Sets the pin to control the backlight.
    @discussion Sets the pin in the device to control the backlight.
    
    @param      mode: backlight mode (HIGH|LOW)
    */
   void setBacklightPin ( uint8_t pin );
   
   
private:
   
   /*!
    @method     
    @abstract   Initializes the LCD pin allocation and associated HW
    @discussion Initializes the LCD pin allocation and configuration.
    */
   void init(uint8_t fourbitmode, uint8_t rs, uint8_t rw, uint8_t enable,
             uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3,
             uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7);
   
   /*!
    @method     
    @abstract   Writes numBits bits from value value to the LCD.
    @discussion Writes numBists bits (the least significant) to the LCD control 
    data lines.
    */   
   void writeNbits(uint8_t value, uint8_t numBits);
   
   /*!
    @method     
    @abstract   Pulse the LCD enable line (En).
    @discussion Sends a pulse of 1 uS to the Enable pin to execute an command
    or write operation.
    */ 
   void pulseEnable();
   
   uint8_t _rs_pin;       // LOW: command.  HIGH: character.
   uint8_t _rw_pin;       // LOW: write to LCD.  HIGH: read from LCD.
   uint8_t _enable_pin;   // activated by a HIGH pulse.
   uint8_t _data_pins[8]; // Data pins.
   uint8_t _backlightPin; // Pin associated to control the LCD backlight
};

#endif
 
Last edited by a moderator:

AllyCat

Senior Member
Hi,

If it's just one of the common backlit 16 x 2 LCDs with an added "I2C Expander backpack", coming from China, then $6 is quite expensive; I bought a similar 20 x 4 display for only a little more. But we need a link or datasheet for the actual device, not just some generic Arduino code.

There have been several posts on this forum explaining how to drive the I2C backpacks, which run the LCD controller in 4-bit data mode (with 4 control lines using the rest of the byte). I have a 08M2 driving one with an "AXE132 emulation" program (using HSERIN and PWM control of the backlight) but the code is not finalised yet. I gave a "preview" of the serial comms part in this recent thread.

Cheers, Alan.
 

Flenser

Senior Member
My recommendation to anyone wanting a simple and cheap way to interface a 16x2 LCD is to build their own ttl serial backpack on stripboard using a picaxe 18M2 and the open-source AXE133 firmware from picaxe.com.

The cheapest 16x2 LCDs I found on ebay.com with just a quick search

16x2 LCD with IIC/I2C/TWI/SPI Serial Interface backpack: US$3.67 with free shipping.
http://www.ebay.com/itm/Blue-Display-IIC-I2C-TWI-SP-I-Serial-Interface-1602-16X2-Character-LCD-Module-/161096292800?pt=LH_DefaultDomain_0&hash=item25821659c0


Make your own TTL serial LCD backpack with a Picaxe 18M2, a piece of stripboard, a 16 pin female header, a 10k pot for LCD contrast and the open-source AXE133 firmware.

16x2 LCD (no backpack): US$1.92 with free shipping
http://www.ebay.com/itm/1602-16x2-HD44780-Character-LCD-Display-Module-LCM-blue-blacklight-New-2014-/181295337227?pt=LH_DefaultDomain_0&hash=item2a360b4f0b

18M2 on picaxestore.com: US$3.14

Total: US$5.04 + backpack parts + shipping for 18M2

Pros:
No software to write. You use serout to communicate with the LCD backpack
Uses only one pin for Tx. One pin less than 2 you need for the IIC/I2C/TWI/SPI Serial Interface.

Cons:
Not the absolutely cheapest hardware for an LCD backpack.
The piece of stripboard, 16 pin female header and 10k pot will be pretty cheap but the total cost depends on how much the 18M2+shipping ends up costing you.
 

JPB33

Senior Member
How usable is the display in the first link? From reading previous posts I thought these were not compatible with Picaxe or has the spec changed?

Really confused over the issue, perhaps someone with greater knowledge could illuminate it for me?

Thanks

Peter
 

hippy

Ex-Staff (retired)
Go beyond serial-controlled LCD's and they become more complex to use from a PICAXE program but most LCD modules should be compatible with a PICAXE. It is more a question of exactly how to connect them together, what the command set is, and getting the PICAXE to send the correct data to control it.

The greatest problem is choosing a display to save on cost but not having the experience to know how to control it from within a PICAXE program, being able to write the required code, or to debug it when things do not work as expected. If the product chosen isn't well documented it can be hard to get it to work and, if things don't work, it can be difficult for people who don't have that product themselves to help getting it to work.

In that respect it's perhaps not so much 'PICAXE compatibility' being an issue as 'purchaser compatibility'.
 

Brian M

Member
ProfW

How about a link to the particular Ebay device. Lots of discussion & code, but your first post statement said:

"Here is a link to EBay for the under $6.00 each LCD modules. I bought 7 of these to use for our Robotics Club for Children. I suggest we all get one to play with.
Sounds good, it uses only 2 I/O pins and communicates via I2C. Now here is the forum part. Who can get these particular LCD units to work with a PicAxe ? So I know it works with Arduino, but we are using 18M2+. Pins 7 and 10 are all that&#8217;s needed to hook up on the 18M2+. I checked all the previous threads and none of them will work. So here is the deal can we as a group solve this little mystery?"

Maybe I'm missing it, but can't find your link, and not everyone in the rest of the world automatically links to Ebay.com.

Put me out of my misery please.
 

JPB33

Senior Member

hippy

Ex-Staff (retired)
Part of the confusion is probably with the term "serial", which can refer to different types of communication streams; UART-style, I2C, SPI etc.

When referring to "serial" it often means UART-style, what the SEROUT, SERIN and similar commands on a PICAXE implement, which is how I meant it.

By "command set" I meant the 'what you need to send to command the module to do something', rather than the 'what the display can do' commands, so for UART-style that simply means use SEROUT, send the characters you want, use #variables to display numbers, use a 254 preceding character for the commands which do clever things on the display.

For parallel connected display that becomes 'take each character and strobe it out on an output port', convert numbers to ASCII characters and send those out for number displays. For I2C and SPI it gets more complicated because it's often instructing the backpack to raise and lower lines in sequence to achieve the strobing out to the attached display.

Basically there's a lot more to do than just using SEROUT if not using a UART-style serial connection. You can't just have a sequence of characters as in SEROUT, you have to explicitly send every one individually ...

Code:
SerOut TX, N2400, ( 254, 128, "Count=", #w1 )
Code:
b0 = 128
Gosub SendCommandByte
BinToAscii w1, b15,b14,b13,b12,b11
For b1 = 0 To 10
  LookUp b1, ( "Count=", b15,b14,b13,b12,b11 ), b0
  Gosub SendDataByte
Next
 

Profw

Member
Hey, that's a great idea. Do you or someone you know have pre-made up boards to accommodate this cool LCD piggy back circuit? I think this would be a much better solution to our problem, as the I2C stuff is a bucket of worms.
 

westaust55

Moderator
Hey, that's a great idea. Do you or someone you know have pre-made up boards to accommodate this cool LCD piggy back circuit?
@ProfW,
It is not 100% clear exactly what you believe is a great idea.

Forum member AllyCat (I believe) is currently endeavouring to develop an i2c based LCD project.

Others in the past have looked at LCD&#8217;s commerically supplied with i2c/TWI interface &#8220;backpacks&#8221; preinstalled.

Have a look at this thread on the topic:
http://www.picaxeforum.co.uk/showthread.php?22394-I2C
Also have a smile at the quote given by Technical from the datasheet for the LCD in question at post 12.

Here is another post on using a TWI/i2C interfaced LCD module:
http://www.picaxeforum.co.uk/showthread.php?21872-Using-Arduino-IIC-I2C-Serial-3-2-quot-LCD-2004-Module-Display


For someone with i2c experience developing some code is not too difficult. However there is a need to define the hardware (what interface chip, what slave address to be set up, which pin for which LCD signal, etc) before the code can be developed.

Some time ago I developed a 2-wire LCD interface based on shift registers. It worked for me, albeit slow on data transfer and while it worked, it did break some of the time rules for typical LCD controller chips.

I think this would be a much better solution to our problem, as the I2C stuff is a bucket of worms.
The aspect to keep in mind is that while forum members here can develop code to help others, it is not necessarily a solution for OUR problem.
Any such interface other than a UART type serial interface that works with the SEROUT command is going to take up additional program memory space and generally will slow down the transfer of data (other than a direct parallel interface).
 

geoff07

Senior Member
If you want a colour graphics 320x240px tft display that works with serout serial and can display 5x8 characters at any px position, different font sizes, circles, rectangles, filled and outline, let me know. My driver just passed a milestone and I'm hoping to complete it shortly, when I will then post it with an Eagle schematic. The prototype uses a 2.2 inch display from ebay and a 28X2 Picaxe with added eeprom (for the font), all programmed in Picaxe Basic. Possibly a later version might be downgradeable to a cheaper Picaxe. Internally, it uses spi to talk to the eeprom and the display, externally it uses normal serial with '254' commands plus a single CTS line to prevent the buffer overflowing when writing thousands of pixels.

The pics are from early tests but give you an idea.


IMGP0047smaller.JPGIMGP0059smaller.JPG
 

binary1248

Senior Member
Multi Line LCD

Man these aare really getting cheap. As stated above, it is not clear what the serial format is, but for this price it could be fun trying it out.
$2.35 for multiline unit. 84X48 (presume that is characters).
http://www.ebay.com/itm/84x48-LCD-Module-Board-For-Nokia-5110-Arduino-Blue-Case-White-Backlight-Adapter/121456220845?_trksid=p2047675.c100005.m1851&_trkparms=aid=222007&algo=SIC.MBE&ao=1&asc=27538&meid=bb54a3a2e095495bbfc2fbde68276f5b&pid=100005&prg=11353&rk=4&rkt=6&sd=140730843931&rt=nc
 
Top