Porblem with LCD

Go To Last Post
25 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello all,

 

I'm developing a car parking sensor with two HC-SR04, an LCD, buzzer and LED blinking at 500ms.

 

I finish the project yesterday and everything works fine. Today i try to change a line of code and nathing works and i get back to original code and still unworking.

 

If i connect the VCC and VSS of LCD on board the program doesnt work but if i put just the VDD the sonar works and the buzzer blink like i want, but the screen doesnt show information and LED blink but almost dont see it.

 

Anyone know what happen?, its really strange because yeserday all works together and i didnt modify the circuit.

 

Thanks

This topic has a solution.
Last Edited: Wed. Jan 3, 2018 - 10:02 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Excuse me, but as I -somewhat randomly- suspect a hardware issue :

* are supplies as they should be (with/without LCD)

 

* could you show the schematic? a photo ("smart" "phones" can do).

 

* have you got a spare LCD/ Avr?(if yes, can you reproduce the normal functioning? the failure?).

 

If I wrongly suspect hardware failure, maybe code would be interesting,  too (LCD needs some timings; being near a limit could induce erratic behavior)...

 

Edited : looked at your posting history (should have done before: I lack method)  : you should post both schematic and full program...

Last Edited: Wed. Jan 3, 2018 - 03:59 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Joao Pinto wrote:
If i connect the VCC and VSS of LCD on board the program doesnt work but if i put just the VDD the sonar works and the buzzer blink like i want, but the screen doesnt show information.

Are you confusing VCC and VSS there, or are they 3 separate connections ?

 

As already noted, it would be clearer to post a schematic.

 

In case a reminder is needed, instructions are here: http://www.avrfreaks.net/comment...

 

 and LED blink 

What LED? Again, the schematic would help.

 

but almost dont see it

You mean it's very dim?

 

It all sounds rather like your power supply is dropping.

 

It sound like it drops when the LCD is connected - which suggests

  1. the power supply is inadequate or faulty
  2. the LCD is overloading the power supply 
  3. both of the above

 

So start by measuring supply voltages.

 

Then measure how much current the LCD is taking.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks for the answer,

 

there is the schematic and video.

 

I test LCD and its all ok on tester. Looks like have some short circuit one LCD because if i dont plug the pin of VSS the rest works fine and LCD if change position on board sometimes works too and stops imidiatly.

 

On the video this time the LCD show the information but its static because the systme stops working. Like you see the LED stop blinking at 500ms and be fast and the buzzerget crazy too.

Video : https://youtu.be/fP0o4BfsOn0

 

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello awneil, i thing its not power supply, i try with a tenson regulator and its the same.

 

And all had work yesterday. i post the schematic

 

thanks

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Joao Pinto wrote:
tenson regulator

Whats that?

 

I do not suggest sinking the LED backlight through the AVR pins.  I use a MOSFET or NPN transistor as a buffer.

 

Jim

If you want a career with a known path - become an undertaker. Dead people don't sue! - Kartman

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

i thing its not power supply,

Really?? You don't have AVCC connected at all and that power half of the chip.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Joao Pinto wrote:
tenson regulator

I see what you did there when translating your native language to English - the same mis-translation can easily be done from Swedish. The English word to use is not "tension" but "Voltage".

 

Besides, if your power supply drops then it takes a special regulator to raise the voltage, and even those can not cope if the input to them drops too low.

 


 

I am troubled by the fact that you supply the back-light LED on the LCD module from an I/O pin on the AVR.

 

What does the data sheet for your LCD module say about current consumption of the back-light? (Hint: I have seen numbers as high as about 250 mA.)

What does the ATmega88 data sheet say about maximum current you may source from an I/O pin? (Hint: 40 mA.)

What does the ATmega88 data sheet say about maximum current for supply (VCC) and GND pins? (Hint: 200  mA.)

 

If you want to be able to switch the back-light on/off by firmware in the AVR, then let the I/O pin control a BJT or FET that in turn switches the supply to the LED back-light on/off. Ask the electronics gurus here about a good circuit for this.

 

Chances are you fried PC2 of your ATmega88 already..

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

Last Edited: Wed. Jan 3, 2018 - 09:45 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello

 

its a voltage regulator (7805 in the case).

 

The goal its put backlike ativated by a pin of avr, because i just want to turn on if distance<200cm

 

thanks

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello js,

 

Why i need AVCC?

 

thanks

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello JohanEkdahl,

 

I already turn off the backlight to see if is that the problem, but its not.

 

A problem i had noted its if i took out the 2 pins conected on PORTC of AVR, the atmel dont program. I try to change the enable pin of LCD to PORTB and if i change the pin i cant send the program to atmega.

 

thanks

This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Why i need AVCC?

 that powers half of the chip.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello js,

 

I really believe i just need AVCC if i use A/D convertion, but i conect to vcc and its working fine now.

 

I dont know why but ever works without this conections but

 

Thanks.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Joao Pinto wrote:
Why i need AVCC?

 

R e a d   t h e   d a t a   s h e e t. [1]

 

Spoiler: Some parts of the ATmega88 internal circuitry draws its supply voltage from AVCC rather than VCC. It is spelled out in the data sheet which parts that is.

 

Joao Pinto wrote:
I already turn off the backlight to see if is that the problem, but its not.

 

I am not sure your problem with the LED is associated with your wiring up of the LCD back-light. I was merely pointing out that the wire-up of the back-light

i) may result in a current draw larger than the allowed absolute maximums (for the specific pin, or for the ATmega chip as a whole), and

ii) that this might damage parts  or all of your ATmega88, and

iii) that this might already have happened.

 

Joao Pinto wrote:
its a voltage regulator (7805 in the case)

If the supply going in to the 7805 is dropping then the 7805 cant do anything about that. It is not constructed in such a way that it can raise that voltage. A 7805 can only lower a voltage higher than 5 Volts down to 5 Volts. (In fact, the supply going into the 7805 has to be substantially higher that 5 Volts in order for it to do what it is designed to. 6 Volts or so, if I recall correctly.) Again, you need to read the data sheet - for the 7805 in this case.

 


 

Your electronic design seems to be much about "shooting from the hip" and possibly based on assumptions rather than facts. Slow down. Read data sheets. Do a design. Post in the "General Electronics" sub-forum here for constructive criticism.

 


 

Joao Pinto wrote:
If i connect the VCC and VSS of LCD on board the program doesnt work but if i put just the VDD the sonar works and the buzzer blink like i want, but the screen doesnt show information and LED blink but almost dont see it.   Anyone know what happen?, its really strange because yeserday all works together and i didnt modify the circuit.

 

Test my hypothesis about the ATmega88 being fried. Pull the '88 out of it's socket. Insert a fresh one. Do not connect the LCD back-light! Program the '88 and test if things are working.

 

Yes: ATmega88 was probably fried. No: Can't rule out that ATmega88 was fried, but there is at least one other problem somewhere.

 

Further investigations then could be e.g.

 

  • Remove peripherals parts, e.g. everything but the LED and see if it lights up brighter, remove everything but the LCD and see if it starts working etc..
  • Measure the current through the LED with your DMM. Is it what the LED needs in order to light up?
  • Measure current consumption for the whole solution e.g. with a DMM. Again, don't connect the LCD back-light! If the current consumption is high (>100 mA?) then remove parts external to the '88, one by one, and see if the current drops substantially. Report findings here.
  • How about, after reading about it in the data sheet, connecting AVCC? ;-)

And of course:

  • Don't think (i.e. assume) that it's not the power supply. Measure the voltage.

 

Fault seeking is about gathering facts. Guessing will not get you far.

 


 

[1] Sometimes I wish we could get blinking text in posts here at AVRfreaks ;-)

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

Last Edited: Wed. Jan 3, 2018 - 10:18 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Joao Pinto wrote:
I really believe i just need AVCC if i use A/D convertion

Go on. Don't read the documentation then. Just keep on guessing and assuming.

 

You're young, judging from your photo so you have a lot of life left to get things working by exhausting all possible alternatives - good and bad..

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Also: If the thing that was working yesterday was wired up exactly as in your diagram above with AVCC not connected, then PC0..3 must have been supplied by stray/leak currents internal to the ATmega88. This situation actually makes it more likely that some parts of the '88 is damaged ("fried"). When you now have connected AVCC those pins get the supply from where they should get it, but it does not rule out that some parts of the '88 actually are damaged.

 

Keep this in memory. If you use the '88 for other purposes in the future and it does not behave like you think it should (after reading the documentation ;-) then the hypothesis that it is damaged is one of the first to test. In fact this holds tru even with the current wire -up if it starts to misbehave in the future.

 

And my firm advice to design a better supply for the back-light still holds. I repeat: Maximum current for a single I/O pin on the '88: 40 mA. Maximum for '88 as a whole: 200 mA. Most back-lights will draw more than 20 mA, some will exceed 200 mA by a good margin.

 

You have been warned. Twice. Happy chip-frying! ;-)

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

Last Edited: Wed. Jan 3, 2018 - 10:36 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Joao Pinto wrote:
I really believe i just need AVCC if i use A/D convertion,

SO what made you believe that?

Or, even, "really believe" - that?

 

See: http://www.avrfreaks.net/comment...

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well, maybe it works now, but .... will it work tomorrow? (the notion of reproducibilty can apply to a huge number of Murphys laws, at least an infinite one)

I did not see decoupling capacitors, except for the voltage regulator. Avr should have two, one for each part of the supply.

I bet it is recommanded in the AN.

It seems to be for a car. As power supply can vary wildly, some people (Elektors book about avrs... I cannot find out the reference but I remember it was in Deutch, French, Dutch and Portugues ... and not in Omericon)  protect the regulator (and what follows) from heavy spikes with a transil diode

https://en.wikipedia.org/wiki/Tr...

 

From previous post, you should post your code, too (if you want to reuse it, or not to get bad programming habbits, better is to have code verified, even if it works: else, Sysiphus supplice can look like a nice holiday w/r the sufferings one has trying to find out which arrays is unedredimensioned, what is the moaning of a variable .....)

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Its solved,

conect AVCC to VCC.

 

Thanks all.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ha ha - another good example that just because something appears to "work" does not mean that it is correct!

 

#ProvenProductSyndrome

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

JohanEkdahl wrote:

Joao Pinto wrote:
tenson regulator

I see what you did there when translating your native language to English - the same mis-translation can easily be done from Swedish. The English word to use is not "tension" but "Voltage".

 

 

Judging from his name, the OP is a native pt speaker.

Interestingly, we actually have both words in Portuguese, "tensão" and "voltagem", but "tensão" is considered the "correct" one. Some teachers will actually scold you if you use "voltagem".

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Joao,

 

Firstly, is the AB9V battery like this one?

 

 

If yes, these are very weak batteries and perhaps your LCD backlight has drained it flat.

 

Secondly, you should use a resistor between your LEDA and PC2 connections. This will limit/control the current to the LCD backlight. Without a resistor, your mega88 will attempt to supply a large current and cause a failure mode which might include damaging your mega88 and/or pulling too much current from the battery so that it drops from 9 volts to something much lower. That in turn will cause the 7805 to stop supplying 5 volts... a much lower voltage will be produced and then your mega88 will possibly stop working and your LCD will almost certainly go blank.

 

Hope that helps you.

 

Ross

 

Ross McKenzie ValuSoft Melbourne Australia

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

you should use a resistor between your LEDA and PC2 connections

or a FET ..

or a transistor...

or

no

LEDA-PC2 link (just resistor  to +5v IIRC my LCD -LCD-keypad shield- does not control the backlight intensity and I always can see chars -sometimes, even the ones I want-)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ha ha - another good example that just because something appears to "work" does not mean that it is correct!

 

IS it the only thing which might led to erratic behavior? (how are the wires to the sensor? decoupling capacitors?software? innity of other details I miss?)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello Valusoft, the battery its just an exemple because im using a power source to build the circuit.