Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 12:50 10 Nov 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : 5v MM and LCD

Author Message
Alastair
Senior Member

Joined: 03/04/2017
Location: Australia
Posts: 161
Posted: 12:07pm 11 Oct 2017
Copy link to clipboard 
Print this post

I have been in the habit of trying to only use 5v tolerant pins when connecting to 5v devices like an lcd panel. I have never been sure if this is really necessary.

I am now having a pin crisis on an E28 based project. I have tried to shuffle things around but it would really make things much easier if I could drive the 2004 LCD from pins that are not listed as 5v tolerant.

If I do make the change should I put clamping diodes on the pins to limit the excursion or is that not necessary?

I am currently using pins 21 & 22 to drive the lcd RS & EN lines but I now need the com1 port which utilises these pins. I can free pins 23 & 24 for RS & EN but they not 5v tolerant, hence my question.

Cheers, Alastair
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9749
Posted: 12:30pm 11 Oct 2017
Copy link to clipboard 
Print this post

Quick simple test is to power the LCD module, but leave the data pins(on the LCD) disconnected. Now measure the voltage between Vcc and any of the data pins with a multimeter. If they measure as 5v, you ideally need 5v tolerant pins. If they measure as 3v3, any pins can be used.

If you have the datasheet for the LCD in question, it will stipulate what the input pins are tolerant of.

I believe it can be acceptable to put 1k series resistors on all the data lines to the LCD, and connect them to the MM - even if the LCD is 5v, but I think this can be frowned apon by some.

Something else to consider is if the LCD itself will run at 3v3. If it does, then the I/O pins on the LCD will never be higher then Vcc, so if you can run the LCD at 3v3, then you can put all the LCD pins, on any pins you like on the MM.

Again, the LCD datasheet would be the first port of call here....
Smoke makes things work. When the smoke gets out, it stops!
 
bigmik

Guru

Joined: 20/06/2011
Location: Australia
Posts: 2971
Posted: 03:05pm 11 Oct 2017
Copy link to clipboard 
Print this post

GDay Alistair,

You could always use an I2C to LCD interface such as >>THIS ONE<<

Then send your commands through the I2C pins and it only costs 2 pins in total,

Regards,

Mick
Mick's uMite Stuff can be found >>> HERE (Kindly hosted by Dontronics) <<<
 
GoodToGo!

Senior Member

Joined: 23/04/2017
Location: Australia
Posts: 188
Posted: 03:42pm 11 Oct 2017
Copy link to clipboard 
Print this post

+1 for the I2C interface.

I use them on all my LCD's. Very easy to use.
I uploaded some code on the Fruit of the Shed to drive the I2c port expander using only a few subs.....

Give it a go!

Cheers
GTG!
...... Don't worry mate, it'll be GoodToGo!
 
Alastair
Senior Member

Joined: 03/04/2017
Location: Australia
Posts: 161
Posted: 04:53pm 11 Oct 2017
Copy link to clipboard 
Print this post

@G you are right - I was being lazy hoping that someone might tell me the answer rather my getting organised and measuring things. I will now do so when time permits.

Mick & GTG - I have used I2C & serial to drive lcds in the past and I could certainly save some pins doing that. This project has been running happily for quite a while but I need to add something hence the pin crisis. I have an ultrasonic distance measure for the rainwater tanks and the cable length is too long & I am getting false results. It is fine with a short cable.

I plan to use one of the Picaxe units I have in the drawer to drive the Tx and then send the result down a serial line to the E28 which currently then sends all the data to a base unit via an HC-12. All works well but for the tank measure.

I have lots of other stuff hanging off the E28 and I don't want to completely re-engineer things, just swap 2 pairs of pins so I can use the com1 port. Com2 and the console are already busy. On the E28 the I2C pins are 5v tolerant being used for the LCD.

Thanks for the comments - I will stop being lazy and do as Grogs suggested and see if i can safely swap pins.

Cheers, Alastair
 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 2461
Posted: 06:31pm 11 Oct 2017
Copy link to clipboard 
Print this post

since you are DRIVING the pins to the LCD, it does not matter if the micromite pins are 5v tolerant. you only need to use 5v tolerant pins for INPUT from external devices that feed 5v signal levels BACK to the micromite.

as grogster has pointed out, you can always add a small series resistor in series with any micromite pin that is likely to see a voltage greater than Vcc. the down side of this is that it can slightly distort the incoming waveform, but at the sorts of speeds that mmbasic operates at this is not a real problem.

another option with 5v LCD modules (of the HD44780 variety) is to run them off 3v3 and then generate a small negative voltage (-1.7v) to power the contrast pin. i believe that the vast majority of these modules will run off a 3v3 quite happily like this.


cheers,
rob :-)
 
Alastair
Senior Member

Joined: 03/04/2017
Location: Australia
Posts: 161
Posted: 09:20pm 11 Oct 2017
Copy link to clipboard 
Print this post

ok. thanks to all for their input.

I have read specs, the MMmanual and done measurements.

the specs for the various chips, but I am focused on the E28 for now, suggests to me that I can use any pins when driving the display - as rob says - he would know far better than me.

The MM manual, top pg 28 says you can use any pins to drive an lcd.

My measurements with scope show the levels on the data pins 0 - 3.3 with no sign of being pulled higher.

The two 2004 displays I have tried, one blue with white characters, the other black on green will NOT work when powered by 3.3v.

so until proven wrong by a failure I am going to use the most convenient pins.

now back to the task at hand and getting the u/s sensor reliable.

Cheers, Alastair
 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2959
Posted: 10:24pm 11 Oct 2017
Copy link to clipboard 
Print this post

  robert.rozee said   since you are DRIVING the pins to the LCD, it does not matter if the micromite pins are 5v tolerant. you only need to use 5v tolerant pins for INPUT from external devices that feed 5v signal levels BACK to the micromite.


The above statement is fact - and with LCDs that you're describing then you have no issue to run the LCD at 5v, and the 'other' (data/control} pins from the MicroMite.

And as pointed out elsewhere when an INPUT is used on the MM (from a module that is 5v), a simple 1K resistor in series will 99% of the time just work with zero damage

WW
 
isochronic
Guru

Joined: 21/01/2012
Location: Australia
Posts: 689
Posted: 10:57pm 11 Oct 2017
Copy link to clipboard 
Print this post

I would add a caution though.
The HD44780 lcds have a small controller built in. It is not usual but data can be read out if needed, there are deliberate output modes. It takes significant time to initialize on start up, before that the pins can be in random states. As well it is not unknown for it to to lose the plot after static, bugs etc. So the pins can feed 5v back to the pic accidentally.
An easy resistor divider to drop the lcd 5v down to 3 v works well, eg a 4 k and 6 k in series from the lcd pin to ground, connect the pic to the mid point.
 
CaptainBoing

Guru

Joined: 07/09/2016
Location: United Kingdom
Posts: 2171
Posted: 02:08am 12 Oct 2017
Copy link to clipboard 
Print this post

  Alastair said   I have been in the habit of trying to only use 5v tolerant pins when connecting to 5v devices like an lcd panel. I have never been sure if this is really necessary.

I am now having a pin crisis on an E28 based project. I have tried to shuffle things around but it would really make things much easier if I could drive the 2004 LCD from pins that are not listed as 5v tolerant.



or you can use these Bi-directional and cheap as chips

I don't get stuck very often but I have used them (not these exact ones) with no problems for shifting levelsEdited by CaptainBoing 2017-10-13
 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2959
Posted: 04:06am 12 Oct 2017
Copy link to clipboard 
Print this post

Also to add that those PIC chips are pretty robust. Some time back Geoff 'stressed' a PIC chip (or two) and was surprised at just how resilient they were. I too have fed (accidentally) 5v INTO a 3v3 pin and held it high for sometime before I realised what I had done. PIC was still fine after - and just added a 1K in series.

Sometimes things are over-engineered and with all the MMs I have played with/use/constructed, I have never had an issue with 5v into a 3v3 pin (via a limiting resistor). This does not mean it will work in every scenario (i.e. very high speed input may be mis-interpreted) but for the LCD discussed in the original post I don't see any need for any hardware at all.

Will be interesting to see what solution the OP takes . . . (do tell us!)

 
Alastair
Senior Member

Joined: 03/04/2017
Location: Australia
Posts: 161
Posted: 08:43pm 12 Oct 2017
Copy link to clipboard 
Print this post

WW,
this has actually been a good learning experience as I now have some firm guides that I will follow in the future. It is a little frustrating that we have the common mix of 3.3 levels, 5v & 12v devices and the question of what is in & out.

The level shifter looks to be a useful thing to have in the parts cupboard. There are lots of variants I see. Will order some on my next buy up.

My intention is to use 2 non-5v compliant pins to drive the LCD which will free up the serial port so I can get the data from the u/s transducer. This will then be aggregated with other data and sent to the base station via HC-12. The main link already works well and I just need the tank level info reliable to complete this node.

will report back when it is working - shortly I hope. Not technically difficult just a matter of running a different wire (4 cores=5v, gnd, Tx ,Rx) in place of the existing coax. A plastic box on the end with picaxe/E28 running the already installed transducer and then sending back over the serial line. Cable is awkward to access of course.

cheers

Cheers, Alastair
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025