New 18M2 LCD software..

cactusface

Senior Member
Hi Folks,
Not been here for a little time? I have just come across the new 18M2 LCD driver software, must have a go at this. I see you can use a spare output to switch a back light on/off via a Fet, it mentions it being active LOW? Not done a lot with Fets, but don't an N channel need a positive on the gate to make it conduct, or are we talking P channel and just how would this be placed between 5V or GND and the LCD? high side or low side switch? 16 Customised messages WOW! I hope to use this in my Greenhouse logger, but more of that in another thread...

Any help and ideas very welcome. ;)

Regards
Mel.
 
Last edited:

inglewoodpete

Senior Member
Mel, Can you tell us which model and datasheet you are referring to? I've looked for "FET" and "BACKLIGHT" in a couple of the docs and come up with nothing.
 

nick12ab

Senior Member
The AXE133 code mentions that you can use the command 255 to control the 'active low' backlight and the AXE132 product photo shows pads for a transistor.
 

cactusface

Senior Member
Hi,
Thanks for your replies.. Pete? not sure where I saw it, but perhaps nick12ab has the answer? but I can't now find the doc or the photo that he refers to! What I really want is a schematic of the FET-LCD set up.
Thanks again everyone.
Regards
Mel.
 

Andy2No

Member
I've just been looking into this. I did a search to see if there's any more knowledge on the subject before I start soldering, but found this question instead :) It seems odd that it was just asked a few days ago.

The Output command would cover turning C2 on and off, to control the backlight:

Output Command (255)
Outputs C.2, C.1 and C.0 are all controlled by the lower 3 bits of an output
which is prefixed by the number 255.
serout B.7,N2400,(255,%00000111); all outputs on
pause 1000
serout B.7,N2400,(255,%00000000); all outputs off

C2 off would turn the backlight on; C2 on would turn it off. If you don't need the other two outputs for anything, just turn them all on and off together, I guess. For using them independently, you'd have to rewrite the "firmware" for the module, i.e. the .BAS program that controls it.

I can't easily draw a diagram, but if you check the connections to those pads in the corner near the stereo socket, you'll see how to do it. There are pads for a base or gate resistor from C2 (near that end of the LCD connector), to a PNP transistor, or P-channel FET, on the corner three pads. The one on the corner is Vdd (5V), for the emitter of the transistor or source of the FET. The collector or drain goes in the third hole and that's connected across to the left one of the next pair of pads. The right hand one of those pads is square and is connected to pin 15 of the LCD module connector (A for anode) - that's not connected, in the photo, and neither is 16 (K for cathode, which is just connected to ground). The order of the pins is 15, 16, 1, 2... 14, taken from the left hand corner of the board in that photo.

I think the best thing to do is use a diode to connect that square pad to the collector or drain, because the LCD backlight probably wants 4.2V, not 5V (Winstar ones do).

I'm sure that's confusing to read, and a diagram would be better, but trace out the connections with a multimeter and it should make more sense, now you know what you're aiming for :)

To summarise:

C2 feeds into the base of a PNP transistor or the gate of a P channel FET via a resistor. There are pads for the resistor, and a transistor or FET with the base or gate in the middle. The transistor/FET may need to source upto 250mA, so a FET might be better than a transistor. You probably need a diode between the collector (or drain) and the A for anode pin of the LCD, to get the correct backlight voltage. There are pads for that too.

I bought a backlit 16x2 module on ebay (Chinese seller) to uprade my AXE133. The connections for the backlight are at the other end - 15 follows 14, and the placing of the set of pads on the board is different, so it doesn't line up as well, but it's basically the same module with a backlight added. I've tested the backlight with a single cell lipo (4.2V max). It's nice and blue :)
 
Last edited:

Andy2No

Member
I guess you could add a bit to the firmware to give PWM control of the backlight, for different brightness levels. I don't like flickering though (I hate fluorescents), so I probably won't bother. It could also be done with a pot as the base resistor, if you used a transistor. It might take a bit of experimenting to find the right value to use though, plus you'd need a fixed resistor in series to set the minimum resistance so as not to damage anything... and it would be a bit temperature dependant. It wouldn't flicker though.
 

Andy2No

Member
Well, I got mine working using the undocumented circuit those unused pads were intended for.

FWIW, I used a TIP127 PNP Darlington, with a 4k7 base resistor (10k or maybe even 22k should work too), and a 1N4001 diode, to drop the voltage to the backlight slightly. The TIP127 has the base at one end, not in the middle, so I bent the legs to reach (and clipped them shorter). It hangs off the side of the board.

As it turns out, the backlit display I bought is barely readable with the backlight turned off, so I could just as easily have used it with the anode hard wired to a diode connected to Vdd. I guess I might want the software to be able to shut down the display to save power though.

The backlight is on by default - it stays on til you set C2 high.

Here's the modified LCD test program that I'm running on a 08M, on an AXE021 PICAXE-08 Proto Board.jpg. It turns the backlight off, shows some text, turns it back on and shows some more, then loops, with suitable pauses.

Code:
;    AXE133 LCD PICAXE Test program for 08M

; Remember to move the Prog / OUT jumper for I/O 0 to OUT
init: 
     pause 500; wait at least this long for display to initialise

     pause 1500;    Show the AXE133 "firmware" boot message for a bit longer

main:
    serout 0,N2400,(254,1); Clear display. Must then:
    pause 30;    Required

    serout 0,N2400,(255,%00000111); all C2:C0 outputs on
                        ; Turns backlight OFF

    serout 0,N2400,(254,128); move to start of first line
    serout 0,N2400,("Hello World!"); output text
    pause 500
    serout 0,N2400,(254,192); move to start of second line
    serout 0,N2400,("1234567890*/+-"); output text
    pause 1000
    serout 0,N2400,(254,128); move to start of first line

    serout 0,N2400,(255,%00000000); all outputs off
                        ;  Turns backlight ON

    serout 0,N2400,("It's alive!!!"); output text
    pause 500
    serout 0,N2400,(254,192); move to start of second line
    serout 0,N2400,("9876543210<>£$%&"); output text
    pause 500
    goto main
    end
 

hal8000

Member
Outputs, C.0, C.1, and C.2 are spare on theAXE133 software.
I've got my LCD display (a Powertip 1602F) working a slightly different way.
The backlight on my display draws about 55mA so MUST use a current limiting resistor
to avoid damaging the LCD backlight.
I simply use a 1k resistor from the 18M2 pin 17, output C.0 to a 2N2222 transistor base,
in common emitter. The collector has in series a 10 ohm resistor, the backlight anode
goes to +5V, the cathode to the 10 ohm resistor.

This works in reverse to Andy2No, the backlight is off until turned on.
Code:
serout B.0,N2400,(255,%00000001) ' backlight on
serout B.0,N2400,("Some Text")  other commands etc
serout B.0,N2400,(255,%00000000) ' backlight off
End result is the same, the backlight can be controlled by setting
last bit C.0 to 1 in my case, and off by setting C.0 to 0.

This saves a lot of current (if battery powered).

All LCD displays draw different backlight current, it is therefore
imperative that the transistor reaches saturation; using a 1k base
resistor acheives this and Vce (on) is less than 0.1 Volt measured
with a meter.
 

srnet

Senior Member
The backlight on my display draws about 55mA so MUST use a current limiting resistor
to avoid damaging the LCD backlight.

The collector has in series a 10 ohm resistor, the backlight anode
goes to +5V, the cathode to the 10 ohm resistor.
So the 10R resistor has approx 2.5v across it, varies slightly depending on the LED colour.

Thats a current of 250ma, but you need to limit the current to 55ma ?

Sums dont seem to add up.
 

Andy2No

Member
In the Winstar WH1602A series data sheet, there's a cryptic note on pin 15 that says "A/Vee 4.2V for LED (RA=0 Ohms) / Negative voltage output".

The negative voltage output seems to refer to non-backlit modules, like that one that came with my AXE133. I took the "RA=0 Ohms" to mean you don't use a series resistor with it, and the googling I did confirmed that. The 4.2V seemed to support that too - it looks like there's something inside the module that powers the LED from a 4.2V supply. Roughly 5V switched by the big transistor, then a diode works for the one I have anyway. It hasn't burned out in all the hours I've been fiddling with it, trying to do something different with the AXE133 BASIC firmware (and failing).

I guess not all 2 line LCDs are the same, but the ones based on the same controller chip mostly are, I expect. My backlit one just says 1602ZFA on the back and I've no idea who made it, but using the information on the Winstar datasheet has worked out okay.

Incidentally, the TIP127 has hfe > 1000, so I only needed 0.25mA base current to ensure upto 250mA output - and I wasn't fussy. I picked 4k7 because it should still do that easily if the PICAXE was running off 3V, and allowing for a bit of a margin for error, but as it turns out, both sorts of display were unreadable when run off a higher voltage than that - I tried running it off the single cell lipo I tested the backlight with, and couldn't read either LCD, though I suspect it was all working apart from that.

At 5V, a 10k base resistor should be fine with the TIP127, or even doubling that should work. At worst, it might dim the display a bit. You have to pick it based on the minimum hfe for your chosen transistor though.
 
Last edited:

hal8000

Member
So the 10R resistor has approx 2.5v across it, varies slightly depending on the LED colour.

Thats a current of 250ma, but you need to limit the current to 55ma ?

Sums dont seem to add up.
No, think about what you're saying.
Current in a series circuit is the same at all points, the display backlight and resistor both
pass 50mA. That's a voltage drop of 0.5 volt across the resistor, not 2.5V and power in
resistor is 250mW.
The backlight in my display is green, and its not forced to be a single LED, could be
several, not sure where you got 2.5V from?
It most likely will be a different colour depending on display backlight, the Power1602
datasheet quotes typical currents from 40 to 140mA for backlight.
 

srnet

Senior Member
No, think about what you're saying.
Current in a series circuit is the same at all points, the display backlight and resistor both
pass 50mA. That's a voltage drop of 0.5 volt across the resistor, not 2.5V and power in
resistor is 250mW.
I think about what I am saying all the time. And I assure you I realise that current in a series circuit is the same at all points.

Refer back to the message I was referring to.

LED back light ?

Whats the forward voltage of a LED, is it possibly around 2.5v, depending on the colour ?

If you have a LED back light with a forward voltage drop of 2.5v, what value of series resistor do you need to limit the current to 50mA when used with 5V supply ?
 

Andy2No

Member
what value of series resistor do you need to limit the current to 50mA when used with 5V supply ?
50 Ohms, if the voltage across the LED is 2.5V. Is there a prize? :)

I suspect if you limited the voltage to 2.5V the LED wouldn't light, because there's a current limiter inside the controller - it's not a directly connected LED. If there wasn't, mine would have burned out almost immediately.

With a 10 Ohm resistor, if it draws 55mA, you're getting a 0.55V drop across the resistor, which is fine, I guess - the backlight power supply wants 4.2V, according to the Winstar datasheet, so you really want a 0.8V drop for a 5V supply, but I don't suppose it has to be exact. There'll be another small drop between the collector and emitter of the transistor. Mine won't be exactly 4.2V either. The diode could be dropping anything from 0.6V to 1V. I haven't measured it.
 

Andy2No

Member
FWIW, I bought a 4 line x 16 character black text on green LCD, with a backlight, and I've substituted that for the blue 2 line x 16 one. The backlight was very faint with the circuit I'd made for the other one (big PNP Darlington transistor to switch it on and off, with a diode on the collector side), and in the datasheet for the new one it says the backlight needs 5V - again, there must be a current limiter / power supply for the actual LEDs, inside the controller.

I've fitted a header and a jumper block to bypass the diode (shorting across it), which solves the backlight problem for the new LCD. I just hope I remember to move the jumper if I switch back to a lower voltage one. 4.2V seems to be pretty common, so it's definitely worth checking the datasheet for the particular LCD you're using.
 

nick12ab

Senior Member
I've fitted a header and a jumper block to bypass the diode (shorting across it), which solves the backlight problem for the new LCD. I just hope I remember to move the jumper if I switch back to a lower voltage one. 4.2V seems to be pretty common, so it's definitely worth checking the datasheet for the particular LCD you're using.
It's helpful to know that the 'current limiter for the leds inside the controller' is simply just a resistor or two in series with the backlight. It might be a good idea to replace these resistors with one of suitable value for operation at 5V. Calculate the forward voltage of the backlight by calculating the voltage drop across the resistor using V=IR and subtract it from the total rated voltage of the backlight.
 

Andy2No

Member
Resistors on the LCD panel PCB makes sense. In that case, you could also work out what size resistor to add in series with the ones already there, to make it compatible with 5V, and fit that resistor on the two pads on the AXE133/AXE132 where I fitted my diode - provided you only want to use the AXE133 with that particular LCD. I guess it's easy enough to change a resistor, if needed, or you could even fit it in a socket, I suppose.

AXE132 is the board, and AXE133 is the board bought with an LCD? I'm still a bit confused by that naming convention.
 

nick12ab

Senior Member
AXE132 is the board, and AXE133 is the board bought with an LCD? I'm still a bit confused by that naming convention.
Yes, and AXE134 is for the 20x4 display. For OLED versions, a letter after the product code indicates the colour: Y=yellow, G=green.
 

Andy2No

Member
But it's the same AXE132 board included in each one, I take it? I've been calling the board AXE133, because that's what I ordered, but I guess I should be calling it AXE132.
 

hippy

Technical Support
Staff member
AXE132 is the board, and AXE133 is the board bought with an LCD? I'm still a bit confused by that naming convention.
AXE033 = Original Driver Board + 16x2 LCD, no backlight
AXE033B = Original Driver Board + 16x2 LCD, with backlight
AXE033Y = Original Driver Board + 16x2 yellow OLED

AXE132 = New 18M2-based driver ( no LCD, no OLED )

AXE133 = AXE132 + 16x2 LCD, no backlight
AXE133Y = AXE132 + 16x2 yellow OLED

AXE134Y = AXE132 + 20x4 yellow OLED
AXE134G = AXE132 + 20x4 green OLED
 
Last edited:

Andy2No

Member
Thanks, hippy. I'd seen references to the AXE033, but I wasn't sure if those were a different board. It makes sense, because the 18M2 is relatively new, and no earlier 18 pin chip has an input on pin 4, where the serial data is fed in - the others had a reset pin there instead.
 

JimPerry

Senior Member
First post ---
The shipping AXE133 has no backlight LEDs fitted to the display board - so no modifications will work. An AXE132 with another model of display can be modded to work as described.

A good mod is to use a 16-way header socket on the board and pins on the display - much easier to change displays then
 

cactusface

Senior Member
A good mod is to use a 16-way header socket on the board and pins on the display - much easier to change displays then
Hi All,
It'ent this what most people do anyway?? I've always worked this way, easy to change displays, even done it on cable too....

Regards
Mel.
 

JimPerry

Senior Member
If you buy the kit and follow instructions - then you are screwed.

Most newcomers will follow the instructions first time (and use the parts supplied).

Experience comes from making mistakes - and I've got 45+ years experience in electronics! :(
 

cactusface

Senior Member
Hi Jim,
Yes we all learn from our mistakes, and some times from others too. I am no wiz kid, in fact I must be your age, and often confess to dropping a clanger now and again. But just because a kit is supplied with certain components, you don't have to use them, if you have other ideas of how you want it to work or look!

Regards
Mel.
 

JimPerry

Senior Member
Agreed. Considering the main target market for Picaxe (Education?) you would have thought that a socket for the LCD would have been provided (so it could be reused with different kits etc) - but pins are cheaper; and LEDless LCD's are also a few pence cheaper as well!

Cheers

Jim
 
Top