How to read a 1-wire sensor with C on a Raspberry Pi

Jamon Camisso jamon.camisso-H217xnMUJC0sA/PxXw9srA at public.gmane.org
Fri Jan 17 02:25:37 UTC 2014


On 16/01/14 08:43 PM, Mel Wilson wrote:
>> Ah and note: I know that the inline variable assignment is bad form, I'm
>> just trying to save some space. I also know my rounding is off here:
>> float temp_f = floorf((atof(temp_raw)/1000 + 0.05)*100)/100;
>>
>> But that I can figure out on my own.
> 
> Could I ask which sensor you're using, and how you've hooked it up?  I'm
> doing similar things here, using RHT02, RHT03 or DS1820B.  I've been
> using them with Arduini, though.  I have some RasPi boards to play with.

I'm using a DS18B20 as well, hence that float rounding - it's supposed
to be accurate to +/- 0.5C through most of it's range, but I've measured
with other thermometers and it's close enough to 1/10th for my purposes.

I've used it with an Ardunino as well with the Dallas 1-wire scanning
library. Is that what you used?

I also tried building an op-amp for PT-100 sensors but couldn't get it
going, hence overpaying for a 1-wire device :p

Cheers, Jamon
--
The Toronto Linux Users Group.      Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists





More information about the Legacy mailing list