Best Microcontroller Projects


[?] Subscribe To This Site

XML RSS
Add to Google
Add to My Yahoo!
Add to My MSN
Subscribe with Bloglines


Home
Forum
Problem?-Solution
Projects Showcase
LCD-KEYS OnePort
PIC Introduction
PIC Programmer
Schematic Tool
PIC Projects
Tips & Techniques
PIC Tutorials
C Course
Digital Downloads
Store
My SECRET
Oscilloscopes
About Me
Search This Site
Freebies
Articles
Books
Resource Links
Site Map
Video du Jour
Rant/Rave
Privacy Policy
Contact
Terms of Use


Custom Search

Sign up for MicroZine:
''The'' Microcontroller Newsletter


:
:
Don't worry -- your e-mail address is totally secure. I promise to use it only to send you MicroZine
Enter your first Name and primary email address in the form above:

And receive absolutely FREE a full project for:


"Measuring Analogue Voltages
Without An ADC"

(Using only one pin).

Instant Download:
You Can
Get It Right Now

Warning: This project could be Removed
at any time.  

It will NOT be
available indefinitely SO

To avoid
disappointment get it:

Now



Remember this is a project with full description and fully debugged C Source code - and it's not available from the main website.

You can only get it through this newsletter.


To get exclusive access Enter your first name Name and primary email address Now in the form above.:

But wait !

There's more...

You'll receive more
free and exclusive reports as well as site information and site product updates.

Scroll up to the form above and sign up NOW.  Don't forget it's FREE and if you don't like it you can unsubscribe at any time.

Click Here Now to use the form above to get your Valuable information absolutely free.



Social Bookmarking
Click & Add:
add to BlinkBlink
add to Del.icio.usDel.icio.us
add to DiggDigg
add to FurlFurl
add to GoogleGoogle
add to SimpySimpy
add to SpurlSpurl
Bookmark at TechnoratiTechnorati
add to YahooY! MyWeb
Readers comments

"I wanted to thank
you so so so much
for all the information
you have provided in
your site it's

SUPERB and FANTASTIC."


- Ranish Pottath


"This site really is
the best and my favorite.
I find here many useful
projects and tips."

- Milan

bursach<at>gmail.com

Learn PIC C Now
Wondering how to program your next project using C and need a great start?


"Awesome site,
very, very easy and nice
to navigate!"


- Matt
matt_tr<at>
wolf359.cjb.net


"I am a newbie to PIC
and I wanted to say
 how great your
site has been for me."


- Dave

de_scott<at>bellsouth.net

Learn Microcontrollers
"Interested in
Microcontrollers?"


Sign up for The
Free 7 day guide:

FREE GUIDE : CLICK HERE

"Your site is a great
and perfect work.
congratulations."


- Suresh

integratredinfosys<at>
yahoo.com

"I couldn't find the correct
words to define
yourweb site.

Very useful, uncovered,
honest and clear.

Thanks so much for
your time and works.
Regards."


- Anon





Schematics and C code for a 0-5V PIC LCD volt meter.


A very simple volt meter showing
voltage on a standard LCD
display...

"Download Your Essential
Guide To Logic Level MOSFETs"

"This is completely Free"

CLICK HERE to DOWNLOAD NOW

Sponsored Links...

This PIC LCD volt meter project uses a PIC micro and an HD44870 LCD display. The analogue input is taken directly to the analogue input pin of the microcontroller without any other processing.

lcd volt meter

Learn about the tool used for creating this diagram

So the input range is from 0V to 5V - the maximum source impedance is 2k5 (for testing use a 1k pot). To improve the circuit add an opamp in front to present greater impedance to the circuit under test. The output impedance of the opamp will be low which is a requirement of the PIC analogue input.

Specification

Voltage range 0V - 5V
Input signal level TTL
Maximum input impedance 2k5

The LCD volt meter uses the microcontroller power supplies as reference voltages and so it is not likely to be very accurate (e.g. a 7805 5V regulator has an accuracy of 5%). You can make it more accurate by setting the scaling value in the software to match the power supply (measuring the supply using a voltmeter) (see Calibration later).

The most accurate way of all will be to use a voltage reference and feed this into RA3 as the positive reference value but this project simply provides a quick and easy way of measuring volts without circuit complexity.

The project mainly shows how to control and setup the software to read an analogue value from the first analogue port RA0.

Note when designing using the analogue inputs its a good idea to start from AN0 as there is only a limited set of ways that more analogue ports can be selected for use (see the chip data sheet - analogue inputs).

Compiler Mikroelectronika C compiler V5.0.0.3 Free!
Target 16F877A (retargetable to other PICs that have Analogue input AN0).
Software level Easy.
Software notes Using fixed point long instead of floating point.
Hardware level Easy.
Hardware notes LCD will work with LVP (if PGM pin is pulled high).
Project version 1.01
Project files Enter your details to get the Download Link
and get the microcontroller newsletter:
:
:
(Note: Your email is safe it will never be sold or rented).
You will get All the C source code and hex file.

Essential C Programming Course:

For a tutorial on compiling these lcd volt meter files click here.

You can recompile the lcd volt meter files if you want examine code operation (using the built in simulator) or change the source code. Note the hex file is contained in the download.

PIC lcd volt meter using HD44780 LCD.
(Click diagram to open a pdf).
lcd volt meter using LCD and AN0.

Learn about the tool used for creating this diagram

PIC lcd volt meter Hardware

You can use any PIC microcontroller that has an ADC and enough memory to hold the program.

The LED is pulsed after every ADC acquisition to indicate that the processor is alive - so you can tell if the software is active.

You can program the PIC in circuit through the ICSP connector.

lcd volt meter schematic circuit


Learn about the tool used for creating this diagram

LCD volt meter Software

Project files for the PIC frequency counter circuit

Compiler project files
ADC_4MHz_LCD.ppc

C Source files.
ADC_4MHz_LCD.c
bcd.c

Header files.
bcd.h

Output files
ADC_4MHz_LCD.hex

Description

ADC_4MHz_LCD.c

The code is simple showing how to set up the ADC using direct control (it does not use built in routines) so that the code can easily be ported to other compilers.

It enters a continuous loop collecting ADC samples and displaying them on the LCD.

The only complexity is that the code uses fixed point maths so that it avoids using floating point variables (saving memory space). Long variables are used to scale the output result. This statement

lng = (ADC_ip * 5000L) >> 10;

Scales the ADC input value to 5000 and then divides by 1024. The output is a number between 0 and 5000. e.g. for a 2.5V input voltage the ADC will read 512. 512 * 5000 is 2560000 Dividing by 1024 gives 2500. So using the fixed decimal point between the 2 and the 5 gives the final result displaying "2.500"

The code converts the 10bit ADC number into a displayable voltage reading.

Calibration

Note: The circuit does not feed in an accurate voltage to Vref+ so the accuracy of the reading is only as good as the power supply voltage regulator (not shown on circuit diagram) - this will usually be a 7805 standard 5V regulator. This has an acuracy of 5% so the displayed output will be wrong by 5%. If you want to calibrate the output to get a more realistic a reading you can set the scale factor in the software to match the 7805 output voltage value.

All you do is use a multimeter to measure the power supply (mine read 4.91V) then instead of the 'ideal' scale factor of 5000L change it to match the multimeter reading e.g. for 4.91V use the statement

lng = (ADC_ip * 4910L) >> 10

This scales the maximum ADC output to 4.91 (The maximum reference value) and displayed readings will now match the multimeter readings.

Obviously this is not the best way to make an accurate volt meter - it would be better to use a more accurate power supply or feed in an accurate voltage reference to Vref+. But it does give a quick and easy method with minimal components.

bcd.c

You can find notes on operation of this code here.



Jump from lcd volt meter page
to Best Microcontroller Projects Home Page.




Don't forget to Sign Up for your

Microcontroller Newsletter

With "Essential tips and techniques",

..."New Site Info" and more...

Including a free project :

How to drive an LCD and 12key keypad using "Only One 8 Bit Port" with no interface logic!...

(Works for any microcontroller)

This costs you : Nothing...
Just fill out the form below and you'll get full C source code and project schematic and description.



:
:
Don't worry -- your e-mail address is totally secure. I promise to use it only to send you MicroZine
Google
 
  Best Microcontroller projects.





<-- --> <-- -->