duino icon indicating copy to clipboard operation
duino copied to clipboard

conect onewire sensor

Open maverik23 opened this issue 10 years ago • 2 comments

anyone know how to connect a DS1820 sensor OneWire to receive temperature data?

maverik23 avatar Jun 01 '14 15:06 maverik23

Yeah, there's lots of documentation on this. Check out these:

  • http://playground.arduino.cc/Learning/OneWire
  • http://sheepdogguides.com/arduino/asw1onew1.htm

These show using an interface board. You don't need an interface, though. On my Duemilanove, I run four OneWire sensors off a single port (2). I'm running three wires so I can run reliably on a 10 foot long bus, and the pull-up to the data line. You can run without the power wire, and use a common frame as a ground to get true one wire operation.

rixon avatar Jun 01 '14 16:06 rixon

I have already connected the sensor to another arduino sketch. right now I'm using duino with heimcontrol.js. where I have to modify the sketch to receive data from this sensor.

I have connected the sensor to pin 11. and I modified the code but does not work

/*

  • Digital read */ void dr(char *pin, char *val) { if (debug) Serial.println("dr"); int p = getPin(pin); if(p == -1) { if(debug) Serial.println("badpin"); return; } int oraw = 0; if(pin==11) { int oraw = sensors.getTempCByIndex(0); } else { pinMode(p, INPUT); int oraw = digitalRead(p); } char m[7]; sprintf(m, "%02d::%02d", p,oraw); Serial.println(m); }

maverik23 avatar Jun 01 '14 17:06 maverik23