Grundlagen 1-wire

Lady Ada mal wieder, alles fertig:

Klicke, um auf adafruits-raspberry-pi-lesson-11-ds18b20-temperature-sensing.pdf zuzugreifen

Vorsicht 1, je nach PDF-Reader gehen die Einrückungen beim STRG-C, STRG-V verloren, dann tut das Skript nicht.

 VORSICHT 2 NEUER KERNEL mit „device tree“, alte hardwareabhängigen Anleitungen müssen oft modifiziert werden, siehe http://www.raspberrypi.org/forums/viewtopic.php?p=675658#p675658

Hier in /boot/config.txt hinten anfügen:

# 1-wire settings
dtoverlay=w1-gpio,gpiopin=4

So wie’s aussieht braucht man danach auch keine 1-wire-Module mehr in /etc/modules eintragen, die werden automatisch geladen.

PDF lokal, falls adafruit-Linkziel nicht mehr vorhanden: adafruits-raspberry-pi-lesson-11-ds18b20-temperature-sensing

Bluetooth und 1-wire DS18B20 Arduino -> Pi

http://dwightreid.com/blog/2014/09/24/arduino-bluetooth-temperature-sensor/

Link wackelt, deshalb hier ein Snapshot

Bluetoothcommunikcation wie hier:

Bluetooth Communication between Raspberry Pi and Arduino

cat /dev/rfcomm

 

Disseminating Technology

dwightreid.com Search

Main menu

Post navigation

Arduino Bluetooth Temperature Sensor

This Arduino based temperature sensor measures the temperature via the DS18B20 integrated digital temperature sensor and makes it available via bluetooth. The temperature reading is then transmitted via the Arduino’s serial port (pin 0 and pin 1) to the bluetooth module. An assembled sensor is shown in figure 1 and the system block digram in figure 2, both below.

AssembledKitFigure 1: Bluetooth Temperature Sensor, Battery Powered

The DS18B20 digital temperature sensor is a three pin integrated sensor that provides  its readings digitally via a one-wire interface. It has an accuracy of ±0.5°C in the measurement range -10°C to +85°C (14°F to +185°F) making it ideal for hobbyist and some industrial applications. The Arduino community already has libraries to interface with this sensor making it easier to integrate this sensor into projects.

BlockDiagFigure 2: Sensor Block Diagram

The bluetooth module acts as a transparent link and simply relays what is sent to its serial port to a paired bluetooth receiver.Default settings:

  • Default pairing code: 1234
  • Default baudrate: 9600

The bluetooth receiver can be a pc, laptop, table, smartphone, etc and the readings displayed via a standard bluetooth terminal app.

ScreenshotTablet7inchFigure 3: Example Bluetooth Receiver Software (Android App)

Arduino Code:

#include <OneWire.h>
#include <DallasTemperature.h>

// Data wire is plugged into port 2 on the Arduino
#define ONE_WIRE_BUS 2

// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
OneWire oneWire(ONE_WIRE_BUS);

// Pass our oneWire reference to Dallas Temperature. 
DallasTemperature sensors(&oneWire);

void setup(void)
{
  // start serial port
  Serial.begin(9600);
   // Start up the library
  sensors.begin();
}

void loop(void)
{ 
  sensors.requestTemperatures(); // Send the command to get temperatures
  Serial.print("Temperature is: ");
  Serial.print(sensors.getTempCByIndex(0));  
  Serial.println(" degrees Celsius ");
  delay(1000);
}