im currently working on mini project for my car. ok, i would like to display voltage and current of my car onto a lcd 16x2 RT1602C using pic18f4520.
1. what type of voltage and current sensor can i use?( car voltage 12v battery)
2. is pic18f4520 has an inbuilt analog to digital or i need adc ic to connect it externally?
3. im using mplab ide v 7.6 for the coding. i have pic18f4520 with components pack connected to lcd and its working( tested with simple lcd code) is there any link in google for the code that i could alter it?
Voltage sensor - maybe consider connecting the battery to a potential divider (1:4 ratio) to give you a 0-20 volt battery range down to a 0-5v range for the PIC (also consider filtering, a zener to protect against over voltage and a cap to smooth the nasties a bit)
Current sensor will be a pain in the neck - especially if you are intending to measure the charge and discharge of the battery.
Consider using a clamp on type of current measuring device for any cable - there are some large currents flowing through the battery circuit. Something like a ferrite filter modified with a low gauss flux sensor in the gap works.
A LONGGG! ago project in EPE (before it was called that), back when the LM3914 LED display chips first came out, measured car battery charging and discharging by using an opamp to simply monitor (and amplify) the voltage drop across the existing car battery earth strap. Nice easy solution, requiring no modification, and no extra voltage drop.
Your microcontroller and LCD require a regulated +5V supply i.e. voltage fixed at +5V. So the +9V would supply a LDO (low drop out regulator) directly and you can scale the analog input voltage so that , for example, +10V to +12V (battery discharged at +10V?) gives 0 to +5V. The pic analog input voltage should not go higher than the PIC supply voltage.
ok here's my latest program. i could display voltage but in binary.there a potentiometer that could adjust the voltage. 1024 is displayed on my lcd which equivalent to 5v.
i would like to display the current as well.
is there any way that i can display 5v instead of 1024?
#include <p18f4520.h>
#include <delays.h>
#include <stdlib.h>
int result;
void Init_LCD(void);
Well you've still got a HECK of a problem measuring current.
Any shunt with a small enough resistance that it won't overheat when charging (which can be >100A if your batt was run down) or starting (which can be hundreds of amps), or drop the voltage so much that the vehicle won't operate properly at high charge/discharge rates, will be far too small for the PIC to measure. It's also bidirectional, and the PIC cannot measure negative voltages even if the shunt is ground-referenced; nor can it even be exposed to that voltage on the pin.