Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
DS18B20 example on PIC32 OTG board
18-10-2012, 05:52 PM,
#1
DS18B20 example on PIC32 OTG board
Hello Guys,

I just have received my PIC32 OTG Pinguino Board and tried to get working the DS18B20.
I used the following Demo
/* -----------------------------------------------------------------------
Pinguino example to read ds18b20 1wire temperature sensor
Result is sent on usb-serial bus and can be read with index.php
author Régis Blanchot
first release 14/09/2010
last update 10/06/2011
IDE Pinguino > b9.5
-----------------------------------------------------------------------
DS18B20 wiring
-----------------------------------------------------------------------
pin 1: GND
pin 2: DQ (Data in/out) must be connected to the PIC
pin 3: VDD (+5V)
NB : 1-wire bus (DQ line) must have 4K7 pull-up resistor (connected to +5V)
-----------------------------------------------------------------------
Data's are sent to /dev/ttyACM0
Make sure you have persmission on it : sudo chmod 777 /dev/ttyACM0
Maybe you will have to add your user name to the dialup group
----------------------------------------------------------------------*/

#define ONEWIREBUS 0 // DQ line

void setup()
{
}

void loop()
{
TEMPERATURE t;

if (DS18B20.read(ONEWIREBUS, SKIPROM, RES12BIT, &t))
{
if (t.sign) CDC.printf("-");
CDC.printf("%d.%d°C \r", t.integer, t.fraction);
}
delay(1000);
}


When I start this Program and connected the PIC32OTG board via USB on emulated COM6, on PC side I use putty terminal, than I got the following output:
3.18°C

The room temperatur is about 24 °C, but the measured value seems not to be correct, the DS18B20 is OK, I tested it on another hardware with an MSP430 there it works fine. My thouggt is that there is something wrong the the t.fraction and t.integer... Any ideas ?
Reply
19-10-2012, 01:13 PM,
#2
RE: DS18B20 example on PIC32 OTG board
Wouldn't you have to do something with the fractional part to display it right?

Doesn't explain the 3.

I used the same device and it just worked.

I didn't need the sudo chmod but then I do have /etc/udev values.

John
Reply
17-04-2013, 06:28 PM,
#3
RE: DS18B20 example on PIC32 OTG board
(18-10-2012, 05:52 PM)bronsus Wrote: When I start this Program and connected the PIC32OTG board via USB on emulated COM6, on PC side I use putty terminal, than I got the following output:
3.18°C

The room temperatur is about 24 °C, but the measured value seems not to be correct, the DS18B20 is OK, I tested it on another hardware with an MSP430 there it works fine. My thouggt is that there is something wrong the the t.fraction and t.integer... Any ideas ?

Hello !

I use a pinguino micro and i have the same result...
It seems than the DS18B20 work in 9 bits resolution and the calcul is made with 12 bits resolution.
Who can help me ?

(Sorry for this very poor english ^^)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)