Author Topic: Temperature sensing with ds18b20 and hacked OneWire library  (Read 7149 times)

kaspesla2

  • RFduino Newbie
  • *
  • Posts: 2
  • Karma: +2/-0
    • View Profile
Temperature sensing with ds18b20 and hacked OneWire library
« on: November 20, 2013, 06:47:49 PM »
I was able to get the OneWire library working with the RFDuino.
I did this simply by replacing the strange direct register macros with normal, platform agnostic digital IO commands. It seems to work well with the ds18b20 temperature sensor.

Attaching in case anybody needs it.
Also attaching a sketch to read the temperature from OneWire and send it over BTLE to the RFduino Temperature iOS example.
And a picture of my wireless temperature probe ;) Fun.

odsneed

  • RFduino Newbie
  • *
  • Posts: 1
  • Karma: +1/-0
    • View Profile
Re: Temperature sensing with ds18b20 and hacked OneWire library
« Reply #1 on: November 23, 2013, 08:24:11 PM »
I was able to get the OneWire library working with the RFDuino.
I did this simply by replacing the strange direct register macros with normal, platform agnostic digital IO commands. It seems to work well with the ds18b20 temperature sensor.

Attaching in case anybody needs it.
Also attaching a sketch to read the temperature from OneWire and send it over BTLE to the RFduino Temperature iOS example.
And a picture of my wireless temperature probe ;) Fun.

Awesome, Thanks. This fixed sketches I had created for an UNO which also uses DallasTemperature.h/.cpp
I haven't actually tested the sensors but it will now load my sketches on the RFDuino.

jamesingham

  • RFduino Newbie
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: Temperature sensing with ds18b20 and hacked OneWire library
« Reply #2 on: December 18, 2013, 06:46:46 PM »
Thank you for this, I can confirm it works without having to change any code! 8)
« Last Edit: December 18, 2013, 07:07:06 PM by jamesingham »

mkay

  • RFduino Team
  • *****
  • Posts: 405
  • Karma: +15/-0
    • View Profile
Re: Temperature sensing with ds18b20 and hacked OneWire library
« Reply #3 on: December 20, 2013, 01:28:03 PM »
Awesome thanks for sharing. Now I have to get a DS18B20 ;)

stonez56

  • RFduino Newbie
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: Temperature sensing with ds18b20 and hacked OneWire library
« Reply #4 on: December 28, 2013, 07:06:30 PM »
Thanks for this. I no longer get compile error.
However, the code said: "No more addresses".. what does this mean?

Stonez

camillo777

  • RFduino Newbie
  • *
  • Posts: 11
  • Karma: +0/-0
    • View Profile
Re: Temperature sensing with ds18b20 and hacked OneWire library
« Reply #5 on: January 16, 2014, 08:00:23 AM »
Hi fantastic work.
Did You have the chance to measure in this configuration the battery power usage?
Is it possible to extract battery charge information from the battery shield via RFduino and send it via BLE along with the temperature?
Thank you!
Best regards,
Camillo

EDelang

  • RFduino Newbie
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Re: Temperature sensing with ds18b20 and hacked OneWire library
« Reply #6 on: January 26, 2014, 12:35:23 PM »
Nice work.
Does anyone have information on the RFduino function.

RFduino_temperature()
This function returns a sample from the on-chip temperature sensor. RFduino_temperature(int scale) Example:
float temp = RFduino_temperature(CELSIUS); // returns temperature in Celsius and stores in float temp or float temp = RFduino_temperature(FAHRENHEIT); // returns temperature in Celsius and stores in float temp

It uses the on-chip temperature sensor.  Is this temperature sensor connected out to any pins on the RFduino?  Is the actual temperature returned by this function the chip temperature or if ambient temperature how accurate it is?  Does the chip temperature itself affect the measurement?

Thanks,

mkay

  • RFduino Team
  • *****
  • Posts: 405
  • Karma: +15/-0
    • View Profile
Re: Temperature sensing with ds18b20 and hacked OneWire library
« Reply #7 on: January 27, 2014, 01:03:19 PM »
Hi, the internal temperature sensor is on the silicon and not connected to any of the pins. It measures the silicon die temperature and can be used for ambient measurements depending on accuracy needs.

If you need more accurate temperature measurements you should use an external temp sensor or thermistor.

smni

  • RFduino Newbie
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: Temperature sensing with ds18b20 and hacked OneWire library
« Reply #8 on: May 19, 2014, 09:31:01 PM »
Hi, the internal temperature sensor is on the silicon and not connected to any of the pins. It measures the silicon die temperature and can be used for ambient measurements depending on accuracy needs.

If you need more accurate temperature measurements you should use an external temp sensor or thermistor.

By how much does the temperature on the silicon vary form the ambient temperature, especially if you are running at a low duty cycle? Should be pretty close, right....? 


Also, I see the spec sheet claims that the temperature reads in 0.25C increments.

gecko

  • RFduino Newbie
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: Temperature sensing with ds18b20 and hacked OneWire library
« Reply #9 on: September 06, 2014, 03:07:25 AM »
Hi, I am having trouble importing a similar library from Paul, Capsense library to rfduino platform. Can someone help?

mrwilljackson

  • RFduino Newbie
  • *
  • Posts: 14
  • Karma: +0/-0
    • View Profile
Re: Temperature sensing with ds18b20 and hacked OneWire library
« Reply #10 on: April 09, 2015, 09:24:27 AM »
if anyone is listening to this thread any more  ???

I can upload the rfduino temperature demo sketch and this works fine with the IOS app. I don't seem to be able to compile the code from kaspesla2 given in post one above?

I've tried the library in:
/Users/mrwilljackson/Documents/Arduino/libraries/OneWire_RFDuino/
and in:
/Users/mrwilljackson/Documents/Arduino/hardware/arduino/RFduino/libraries/OneWire_RFDuino/

(restarting the arduino IDE each time I've moved the library)

the error i get is:
Code: [Select]
/Users/mrwilljackson/Documents/Arduino/libraries/OneWire/OneWire.cpp:69:20: fatal error: avr/io.h: No such file or directory
 #include <avr/io.h>
                    ^
compilation terminated.
Error compiling.

Have I missed something really obvious? - thanks!

mrwilljackson

  • RFduino Newbie
  • *
  • Posts: 14
  • Karma: +0/-0
    • View Profile
Re: Temperature sensing with ds18b20 and hacked OneWire library
« Reply #11 on: April 11, 2015, 04:59:02 AM »
SO the really obvisous thing was to use arduino IDE 1.6.1 (not the current 1.6.3 version), now i've uploaded the sketch and library and all works nicely  8)

 

anything