Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Need help in the coding

Status
Not open for further replies.

hridz

Junior Member level 3
Junior Member level 3
Joined
Oct 11, 2011
Messages
27
Helped
0
Reputation
2
Reaction score
1
Trophy points
1,283
Location
Tezpur, India
Activity points
1,485
hi i m trying to display the voltage as well as the power from a solar panel on a LCD using microconroller, but i m not getting any idea of writing the code (in C) because the voltage level will change with the variation of light falling on the panel. so guyz can anybody help me regarding this problem... plz do help me... thanks in advance...
 

You need to tell us much more.
Which micro-controller ?
What kind of LCD?
What maximum voltage?
What maximum current?
What resolution in readings do you need?
Does the reading have to be averaged?
Power depends to some extent on the load, what is it?

Basically though, you follow a loop, read, display, read, display and so on so the measurement shown is 'live'.

Brian.
 

well right now m using 8051 microcontroller.
LCD is JHD 162A (16 * 2)
maxm voltage is 2 volt
maxm currnt is 380mA
regarding resolution i dont have idea what should be best???
i have not connected any load yet just a 1k resistance..

hope this information will help you to help me..
 

That helps, sorry to be blunt before but without knowing the scale of your operation is wasn't possible to give a sensible answer. It looks like you have one small PV unit but it could have been a commercial system running hundreds of large panels and producing kilowatts of power.

I can't hep with specific coding for the 8051, but I'm sure there are many readers with experience of exactly what you need. The last processor in that series I used was the 8035 which shows how long I've been in the business!

Basically though, you need two ADC channels, one for the voltage and one for the current. You measure the voltage directly across the PV output and you measure current as a voltage drop in a resistor in series with the PV. If you multiply the two you can also show how much power is being consumed. I would think for such a small system, measuring voltage to one decimal place and current to 1mA would be sufficient resolution, both should be easy to achieve.

Brian.
 

hi i m trying to display the voltage as well as the power from a solar panel on a LCD using microconroller, but i m not getting any idea of writing the code (in C) because the voltage level will change with the variation of light falling on the panel. so guyz can anybody help me regarding this problem... plz do help me... thanks in advance...

For an idea see https://www.edaboard.com/threads/217541/ also search this board

---------- Post added at 15:38 ---------- Previous post was at 15:30 ----------

http://tuxgraphics.org/common/src2/article07061/

---------- Post added at 15:40 ---------- Previous post was at 15:38 ----------

**broken link removed**

---------- Post added at 15:47 ---------- Previous post was at 15:40 ----------

Measuring voltage and current in a DC circuit
http://serc.carleton.edu/sp/compadre/interactive/examples/19095.html
 

Mr Brian

If I used PIC o4r atmega16 microcontroller instead of 8051 which will reduce the use of ADC then can you help me with some codes?

hridz
 
Mr Brian

If I used PIC o4r atmega16 microcontroller instead of 8051 which will reduce the use of ADC then can you help me with some codes?

hridz

For PIC16F87Xa & 8051 I can help you with code as I have tested code. Idont have tested code for atmega16
 

You will need to read the voltage using the ADC (internal or external). You also need to sense current (also with the ADC). It can be done simply via a shunt resistor. Or you can use other methods like hall-effect sensor. In the microcontroller code, you need to scale the ADC readings and convert them to display them to LCD. This depends to a large extent on your reference voltage and the attenuation circuit.

If you use PIC or AVR, you can use the internal ADC. For 8051, you must use an external ADC.
If you need, code snippets may be provided to help you understand stuff like the ADC, interfacing, etc.

Before further help, you must tell us how much C programming you have done in the past, if you need help with the algorithm or entire coding or do you just want the code?

Hope this helps.
Tahmid.
 
  • Like
Reactions: hridz

    hridz

    Points: 2
    Helpful Answer Positive Rating
well i have not done so much of c programming in the past, i have done only few simple program, I just need the code for the part in which the ADC will measure the voltage itself from the panel, since i am using a shunt resistance so the current can be measured from that. finally the power can also be calculated. So mainly i need the code for this part. I am going to use PIC.

hridz

---------- Post added at 15:31 ---------- Previous post was at 15:28 ----------

Mr. Rajsekhar Nag

I have PIC18F452, so can you provide me the code which will work in this PIC.


hridz
 

Hi ,

How do I construct MikroC programming for PIC16f877a.......the microcontroller needs to read from an analog input(LDR) and display the output to LCD and Visual Basic 2008 to turn on an LED
 

For such a simple application , why do you intend to use PIC , 8051 will easily serve the purpose with the help of ADC0809
 

Please correct me if i am wrong but in india 8051 is available at half price compared to pic
 

Please correct me if i am wrong but in india 8051 is available at half price compared to pic

In my place At89S52 + ADC0804 cost much lower than pic16F876A and almost same to 16F84A(no adc).

But using PIC with in-built ADC reduces the circuit size.
 

Using a PIC would be simpler than using an 8051 with external ADC. Why would you use the 8051 with external ADC instead of a cheap PIC with internal ADC? The price difference isn't collosal.
 

PIC12F675 (no of pins fewer)with 10 bit ADC still available at Rs.60/- . At89S52 + ADC0804 at Rs.60+25. PIC16F877A approx Rs. 235/-
 

PIC12F675 (no of pins fewer)with 10 bit ADC still available at Rs.60/- . At89S52 + ADC0804 at Rs.60+25. PIC16F877A approx Rs. 235/-

If he wishes to make the circuit for himself, I would still recommend the PIC despite the higher price, due to the versatility and flexibility he can obtain with the internal ADC and other peripherals. Plus, the PIC is quite a bit faster than the AT89S52. The internal ADC has 10-bit resolution and if he uses 16F877A, there are 8 analogue channels. Compare this to ADC0804 - 8-bit resolution and only 1 channel. Plus, you'd need to interface the ADC with the microcontroller and it is in a 20-pin package. Overall, while it may be cheaper, circuit becomes more complex, especially if multiple inputs are required.

And wow, the PICs are more than twice as expensive in India as they are here in Bangladesh.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top