+ Reply to Thread
Page 2 of 3
First 1 2 3 Last
Results 16 to 30 of 34

Thread: New To A/D Need Some Guide

  1. #16
    kchriste Excellent kchriste Excellent kchriste Excellent kchriste Excellent kchriste Excellent kchriste Excellent kchriste Excellent kchriste Excellent kchriste Excellent
    Join Date
    Jul 2006
    Location
    Victoria BC, Canada
    Posts
    3,681

    Default

    Quote Originally Posted by Suraj143
    You mean that my Multiplexing routine I must call every one second?
    No, just try calling BCD_Split once a second. The display will still "bobble" when the ADC is near the threshold of changing values, but only at a one second rate. Maybe something like this untested/inelegant code:

    Code:
    Main          movlw 0x??                     ; delay value
                    movwf SomeDelay
    
    Loop		call	Multiplex		;show the display	
    		call	Check_AD		;get the AD value		
    		bcf	STATUS,0
    		rrf	ADL,F			;divide the AD value by by 2
    		call	BCD			;call BCD & make into decimals
                    decfsz SomeDelay, F
    		goto	Loop
     		call	BCD_Split		;move BCD results to segment digits
    		goto	Main
    
    Sorry kchriste I cannot understand this.
    You would take 256 ADC readings and add them to a 16bit location as they are acquired. The upper 8bits of the 16bit number would represent the average value of the 256 ADC readings after 256 ADC readings. You could also take the average of any other number of readings, but 256 makes the "math" really easy.
    In my diagram is it a low pass filter?
    Not really, it is more of a damper to compensate for lead capacitance and noise according the the datasheet. A 2.2K resistor in series with the output of the LM35 with a capacitor to ground on the PIC side of the circuit would be a lowpass filter.
    Last edited by kchriste; 16th January 2008 at 06:07 AM.
    Inside every little problem, is a big problem trying to get out.


  2. #17
    Suraj143 Newbie
    Join Date
    Jan 2007
    Location
    South Mald Isld
    Posts
    921

    Default

    Hi kchriste I got your point.For every one second I'll update the display & see.
    Thanks for that hint.

    You would take 256 ADC readings and add them to a 16bit location as they are acquired. The upper 8bits of the 16bit number would represent the average value of the 256 ADC readings after 256 ADC readings. You could also take the average of any other number of readings, but 256 makes the "math" really easy.
    What I know is for every 256 increments the ADRESH will increment by one.
    Thats what I know.

  3. #18
    Suraj143 Newbie
    Join Date
    Jan 2007
    Location
    South Mald Isld
    Posts
    921

    Default Project Success 70%

    Hi kchriste I followed your three steps all of the methods gave me good results.

    I tried one by one, the best method was reading the average value. That is the more accurate method.

    I added a 16bit register to place the 256 times AD results.& read the higher byte to get the average value.

    I wrote my own coding again & applied.

    Sometimes you can see the bubbles.It means if the temperature is 21 celsious when it goes to 22 C it shifting like this 21,22,21,22,21,22,21,22 this happens continuously even if I read the average temperature.

    I also applied the 2.2K resister with 0.1uF capacitor (low pass filter)

    So what do you think?

    Code:
    ;************
    ;Main program
    ;************			
    Display	call	Multiplex						
    Loop	call	Check_AD		
    	incfsz	Count256,F	;count 256 AD readings
    	goto	$+9		;No,
    	clrf	Count256	;yes, it has reached 256 times
    	bcf	STATUS,C
    	rrf	average_H,F	;make the value divide by 2
    	call	BCD		;make the value into decimals
    	call	BCD_Split	;convert into segment digits
    	clrf	average_H	;clear 16 bit higher byte
    	clrf	average_L	;clear 16 bit lower byte
    	goto	Display		;show the display with updates	
    	movf	ADL,W		;take the AD result to W
    	addwf	average_L,F	;add the value to lower byte of average register
    	btfss	STATUS,C	;has the carry bit set?
    	goto	Display		;No, then show the display without updates
    	incf	average_H,F	;Yes, then increment the higher byte of average register
    	goto	Display		;show the display without updates 

  4. #19
    kchriste Excellent kchriste Excellent kchriste Excellent kchriste Excellent kchriste Excellent kchriste Excellent kchriste Excellent kchriste Excellent kchriste Excellent
    Join Date
    Jul 2006
    Location
    Victoria BC, Canada
    Posts
    3,681

    Default

    I wrote my own coding again & applied.
    Code looks good and will display the average value. Good work.
    So what do you think?
    If you want to totally eliminate the digit bobble, you would need to scale your input with an OpAmp to use the entire 10bits of the ADC. Then your code would have to add 1-2bits of hysteresis which would eliminate the bobble but also reduce the effective resolution to 8bits which would be fine in your case. Least significant digit bobble is a common artifact when a digital device displays an analog signal which is between two neighboring values:
    if the temperature is 21 celsious when it goes to 22 C it shifting like this 21,22,21,22,21,22,21,22
    The real temperature is 21.5 Celsius so the display will bobble.
    Last edited by kchriste; 17th January 2008 at 05:12 AM.
    Inside every little problem, is a big problem trying to get out.

  5. #20
    Suraj143 Newbie
    Join Date
    Jan 2007
    Location
    South Mald Isld
    Posts
    921

    Default

    Quote Originally Posted by kchriste
    Code looks good and will display the average value. Good work.
    Thank you

    Least significant digit bobble is a common artifact when a digital device displays an analog signal which is between two neighboring values:
    Oh I see I thought this bobble happens only in my coding.Its a common fact

    The real temperature is 21.5 Celsius so the display will bobble.
    Exactly

    kchriste I just checked my temperature is correct or not?I measured the LM35 output voltage.
    Its showing 0.28V = 25 Celsius

    It should 28 Celsius.

    Why is this happeneing?

    Shall I add 3 to the result of the ADC every time?

  6. #21
    kchriste Excellent kchriste Excellent kchriste Excellent kchriste Excellent kchriste Excellent kchriste Excellent kchriste Excellent kchriste Excellent kchriste Excellent
    Join Date
    Jul 2006
    Location
    Victoria BC, Canada
    Posts
    3,681

    Default

    So you are saying that the ambient temperature is 25C and the LM35 is outputting 0.28V? If so, it is possible that the LM35 really is at 28C if it is mounted on a PCB / breadboard that has components generating heat. Also, are you measuring the voltage right at the LM35s pins Vout & Gnd? If not, it is possible that there is a voltage drop in the leads due to current draw from other devices.
    Inside every little problem, is a big problem trying to get out.

  7. #22
    Suraj143 Newbie
    Join Date
    Jan 2007
    Location
    South Mald Isld
    Posts
    921

    Default

    I looked at the display & it shows 25 C suddenly I measured the voltage Vout to GND in the LM35DZ.It shows 0.28V.

    In the real calculation it must show 28 C.

    My circuit is in a vero board I never use bread boards.

  8. #23
    Suraj143 Newbie
    Join Date
    Jan 2007
    Location
    South Mald Isld
    Posts
    921

    Default

    Hi kchriste I'm trying my best to get a smooth value count in the segments without adjusting or adding any hardware changes.

    I'm going to try in different ways.Something like calling AD interrupts etc....

    Last night I didn't sleep even.

  9. #24
    kchriste Excellent kchriste Excellent kchriste Excellent kchriste Excellent kchriste Excellent kchriste Excellent kchriste Excellent kchriste Excellent kchriste Excellent
    Join Date
    Jul 2006
    Location
    Victoria BC, Canada
    Posts
    3,681

    Default

    You'll have to do some more tests then. If the LM35 reads 0.28V and your display reads 25 then it is probably due to the fact that your 5V supply, which I assume is used for your ADC reference, is a little high. What is the voltage reading on Vdd of the PIC?
    Shall I add 3 to the result of the ADC every time?
    Only if the reading is 3 degrees low across the temperature range you'll be using.
    It won't work if it reads 3 degrees low at 25C but 6 degrees low at 50C. Then you'd have to adjust the reference/supply voltage.
    Last edited by kchriste; 18th January 2008 at 03:39 AM.
    Inside every little problem, is a big problem trying to get out.

  10. #25
    Suraj143 Newbie
    Join Date
    Jan 2007
    Location
    South Mald Isld
    Posts
    921

    Default

    Hi kchriste thanks for being with me through out the thread.
    last night I measured all the voltages.

    Vdd = 5V
    LM35DZ output voltage = 0.28V at 25 C

    I replaced another LM35DZ but same.That of course ok.The bubble thing is the main headache.
    I'm trying various adjustments in my main code to get a smooth stable count up without bubbles.

  11. #26
    Suraj143 Newbie
    Join Date
    Jan 2007
    Location
    South Mald Isld
    Posts
    921

    Default

    Am I the only person who gets this bubble thing error?I have never seen a similar thread like this.How others managed their LM35 temperature sensors? Didn't they get such a effect?

    I'm really really upset.

  12. #27
    kchriste Excellent kchriste Excellent kchriste Excellent kchriste Excellent kchriste Excellent kchriste Excellent kchriste Excellent kchriste Excellent kchriste Excellent
    Join Date
    Jul 2006
    Location
    Victoria BC, Canada
    Posts
    3,681

    Default

    Am I the only person who gets this bubble thing error?
    If you read this article you'll see on page 5 a description of "Last-digit bobble":
    http://www.ee.latrobe.edu.au/~gt/ele...s/01-units.pdf
    LM35DZ output voltage = 0.28V at 25 C
    What do you get at other temperatures? Try boiling water at 100C as another calibration point.
    Inside every little problem, is a big problem trying to get out.

  13. #28
    Suraj143 Newbie
    Join Date
    Jan 2007
    Location
    South Mald Isld
    Posts
    921

    Default

    Ok this weekend I'm going to work out on fully about this in the weekend I'll tell the progress kchriste.

    Thanks for the support.

  14. #29
    Help us help you blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent
    Join Date
    Jan 2007
    Location
    Toronto, Canada
    Posts
    10,706
    Blog Entries
    5

    Default

    What sort of displays are you using, what type of regulator, how fast are you running your PIC? Your sensor must be located away from any heat source as even a few LEDs or a fast PIC can heat that LM34 up.
    Bill
    Smart Kits build Smart People

    http://www.blueroomelectronics.com/

  15. #30
    Suraj143 Newbie
    Join Date
    Jan 2007
    Location
    South Mald Isld
    Posts
    921

    Default

    Hi blueroomelectronics I’m using CC seven segments. I’m using two segments.

    My PIC is running 4MHZ. My regulator is 7805 I measured the VDD & its 5.0V

    Did you get a bobble error in your last digit? Here is the place I got stucked.
    Attached Images

+ Reply to Thread
Page 2 of 3
First 1 2 3 Last

Similar Threads

  1. Guide to using an MCP2515?
    By Sam Jelfs in forum General Electronics Chat
    Replies: 0
    Latest: 4th April 2007, 08:14 PM
  2. Hotair Soldering Desoldering Guide or Tutorial is Needed
    By xpacer in forum General Electronics Chat
    Replies: 1
    Latest: 20th October 2006, 05:56 PM
  3. Orcad PCB Layout Manual Guide, Help !
    By sinkopa in forum General Electronics Chat
    Replies: 1
    Latest: 31st March 2004, 09:20 AM
  4. ASM guide
    By McGuinn in forum Micro Controllers
    Replies: 4
    Latest: 2nd February 2004, 12:38 AM
  5. anyone willing to help and guide me??
    By philipsi in forum Micro Controllers
    Replies: 2
    Latest: 23rd December 2003, 07:02 AM

Tags for this Thread