CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

logarithmic math question [solved]

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
artohautala



Joined: 17 Nov 2011
Posts: 187

View user's profile Send private message Send e-mail

logarithmic math question [solved]
PostPosted: Tue May 09, 2017 7:24 am     Reply with quote

HI,

I'm very poor / bad in mathematics I can't undestand math so I'll be very happy if someone will help me to solve my problem ...
so I'm programming PIC18F452 and trying to get work logaritmic ambient light sensor
sharp GA1A1S202WP ...

I use 10bit AD-converter A0 in PIC - processor ...

AD-result 925 equals 100 000 lx...

How I can calculate those other values in logaritmic scale ?

I'll be very pleased if someone help me because I'm so bad in mathematics Sad

best regards
-arto-


Last edited by artohautala on Tue May 09, 2017 9:12 am; edited 1 time in total
Ttelmah



Joined: 11 Mar 2010
Posts: 19552

View user's profile Send private message

PostPosted: Tue May 09, 2017 7:47 am     Reply with quote

That is an obsolete sensor.

The actual behaviour is simply uA/decade. So if (for instance) it gives 925 at 100000 lux (though beware this is slightly beyond the recommended top of this sensors operating range), it should give about 740 at 10000 lux.

Conversion is simple:

lux=(adc_reading/185)^5
artohautala



Joined: 17 Nov 2011
Posts: 187

View user's profile Send private message Send e-mail

PostPosted: Tue May 09, 2017 8:21 am     Reply with quote

Ttelmah wrote:
That is an obsolete sensor.

The actual behaviour is simply uA/decade. So if (for instance) it gives 925 at 100000 lux (though beware this is slightly beyond the recommended top of this sensors operating range), it should give about 740 at 10000 lux.

Conversion is simple:

lux=(adc_reading/185)^5


Thank you for your answer..

I know sensor is rather obsolete... but I have one and I like to use it ...

so maybe power of 5 is because there's 5 decades...

but where comes that number 185 ?

925/185 = 5, 5^5 = 3125 not 100000 as it should be... ?

-arto- Smile
Ttelmah



Joined: 11 Mar 2010
Posts: 19552

View user's profile Send private message

PostPosted: Tue May 09, 2017 8:52 am     Reply with quote

Sorry:

10^(adc_reading/185)

Yes, it is just 185 counts/decade. So 5 decades.
artohautala



Joined: 17 Nov 2011
Posts: 187

View user's profile Send private message Send e-mail

PostPosted: Tue May 09, 2017 9:10 am     Reply with quote

Ttelmah wrote:
Sorry:

10^(adc_reading/185)

Yes, it is just 185 counts/decade. So 5 decades.


Thank you ... I made excel table to solve this problem ...
and 10^(adc_reading/185) in that table works fine ! everything is OK !

Thank you so much Very Happy

all the best for you

friendly regards

-arto-
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group