Sharing Electronics Projects

Prototype in Elektor Lab

Luc Lemmens's picture

Not too difficult to solder and the hardware isn't too complicated, so I didn't expect much issues. However, I was unpleasently surprised by the LCD I ordered (Powertip PC1604LRU-AWB-H), which appeared to need a negative voltage on the contrast pin (VO on pin 3) to get readable text on the display. For the time being this was solved with the good-old diode trick (schematic) to get one end of the contrast potmeter at -0.7V. The result is not really encouraging, but I can still use this LCD before I get a more modern LCD in stead.

Negative contrast voltage on LCD modules was quite common 'in the old days', but I hadn't seen one for years!

Attachments: 
0 photos | 1 schematics | 0 PCB(s) | 0 software files | 0 other
9140804167

8 comments

joergt's picture

Submitted by joergt on 6 August 2014 - 6:06pm.

Hi Luc,

the LCD you ordered is only nearly the same I used.

Here you can read the data of the panel LCD TC1604A-05:

http://www.pollin.de/shop/downloads/D120689D.PDF

I'm astonished that there are such differences. Using a negative voltage is not state of the art, I think also.

At Farnell alternatives are available. What do you think about FDCC1604A-FLYYBW-51LK ?

http://www.farnell.com/datasheets/653684.pdf

This company sells 13 different types of LCD 16x4 displays. No easy choice...

Kind regards,
Joerg

Luc Lemmens's picture

Submitted by Luc Lemmens on 8 August 2014 - 10:05am.

Hi Joerg,
There are many alternatives for the LCD, for now I've ordered the MC41605 (Midas) which should arrive today.
Of course the dimensions of the display module are important (we want to fix the LCD to the PCB), and (what's even trickier) the interface connector must fit the footprint on the PCB. The Powertip display has this connector shifted 100mil to the left side compared to the one from Midas, and it seems like every manufacturer has his own standard :-(

However, it looks like the prototype is working fine! Some minor things to change though, I made a mistake in the PCB, swapped the Return and Next buttons. Easy to change in software of course, but I prefer to correct it in hardware to prevent confusion in firmware versions.
One thing (so far) that should be corrected in the software:
Trigger_out = On 'Create 10us pulse to trigger US module
Waitus 10
Trigger_out = Off
Time_value = 0
Timer1 = 0
Do 'Waiting for receiving US signal (echo)
Loop Until Echo_in = 1
This works fine under normal conditions, but if -for some reason- the US pulse is not sent or the echo not received, the software will never exit the loop. A time out plus corresponding error message would be more elegant.

Best regards,
Luc

joergt's picture

Submitted by joergt on 8 August 2014 - 6:03pm.

Hi Luc,

That every LCD manufacturer cooks his own soup is really annoying!

Changing the software and implementing a watchdog function is a good idea, but not easy to realize because of no more free memory - it is in use to 100%.

I read your comment just in my holiday and will be back at the 17th of august. Then I will try to optimize the memory consumption for implementing the additional code.

Best regards,
Joerg

Luc Lemmens's picture

Submitted by Luc Lemmens on 11 August 2014 - 8:46am.

Hi Joerg,
Enjoy your holiday first! :-)

Best regards,
Luc

Luc Lemmens's picture

Submitted by Luc Lemmens on 14 August 2014 - 3:19pm.

Hi Joerg,

The new LCD certainly is an improvement, no negative voltage needed for the contrast.

If flash memory is a limiting factor for further development or improvement, I would suggest to use an ATmega168, which has twice the amount of program memory. The software runs on this microcontroller and it’s pin compatible with the ATmega8. It’s just a bit more expensive than the ATmega8, and it will save a lot of time trying to optimize the code size.

I noticed that there is an offset of 7.5cm in the distance measurement, which is related to the constant value of Box_width_default added to the measured value in software. I don’t quite get why you are adding this constant, but I’m very sure you have a good reason (preferably with an explanation ). Maybe you can add a routine to set a zero-distance point for this measurement?

Is there a procedure to recalibrate, or to clear the min and max settings of a tank?

Best regards,
Luc

joergt's picture

Submitted by joergt on 14 August 2014 - 6:00pm.

Hi Luc,

To take the next higher ATMega type is a good suggestion, but nevertheless I'll try to shrink the code for implementing a watchdog function :-)

When you are using the distance mode, the distance will be measured from the back of the box to the target object. Why should I do this? Well, in this mode I want to measure the distance from wall to wall for example. So I have to calculate from the back of the box. That's the way commercial distance gauges are working also.

The constant Box_width_default is used if the user didn't store a user defined offset value for the box width in the EEPROM variable Saved_box_width. How you can change this value is described in the documentation. The default value is set to 7.5 cm. I hope my explanation was good enough to understand the reason for this procedure.

It's no problem to recalibrate a used tank number. Just call the calibration menu for the selected tank and execute the calibration again.

Best regards,
Joerg

Luc Lemmens's picture

Submitted by Luc Lemmens on 15 August 2014 - 8:24am.

Hi Joerg,

You were not supposed to reply before next week ;-)

I won't stop you if you want to squeeze the watchdog in too, I was just trying to make it easier for you. Anyway, it can still be mentioned for people who want to extend the functionality of this project.

I knew that there was be a good reason for the distance offset! My mind too much set to the liquid level measurement I guess. Still it would be nice if the user can set the reference point manually without changing the firmware, but that will be too much to ask if you want to stick to the ATmega8.

Recalibrating a tank is easier than I thought...

Best regards,
Luc

joergt's picture

Submitted by joergt on 15 August 2014 - 10:03am.

Hi Luc,

Answering your questions during my holidays is no problem, it's like reading the newspaper at breakfast ;-)

While I have developed the software, I have also thought about storing user-defined offset values ​​for the housing width and the outside temperature. Here you can read the description of the original documentation you can find as project attachment:

>> Was the first launch successful the basic settings can be made now. For this purpose turn off the power again. Now hold the Return key pressed while turning on the device. After releasing the Return key, the user is prompted for the width of the box. This value is important to correct the distance measurement, because the measurement starts from the rear of the box. So you can for example easily measure the distance from wall to wall. The value for the box width can changed in 5 mm steps using the + and - buttons. After confirming the input with Return you are prompted for the divisor value. This value is used for a measurement result correction at air temperatures below 15 ° C or above 25 ° C, if you want to reach a high accuracy. Note that the higher the temperature the greater must be the value of the divisor. To get good results make a reference measurement in front of a wall in 2 m distance for example. After confirming the divisor value by pressing Return again the actual program starts. If you can live with an inaccuracy of about 5% in the temperature range from 0 ° C to 40 ° C, you can skip this menu item by pressing Return. The values ​​for box width and divisor are retained even after changing the battery and may be re-configured using the above-described process. <<

You see, the two offset values are not static in the software and can be changed dynamically by the user.

Hope, I could help you with this information.

Best regards,
Joerg

Level and distance gauge with alarm function [140209-I]

  • Please log in to see the project's files and to post contributions or comments to this project.