How to show arduino values in nodered on rapsi

Hello,

i have a question, i dont understand how to send the arudino values (temperature, pressure...) to the raspi.
The raspi should show the values of the arduino in a dashboard.

#include <OneWire.h>

//DHT11
#include "DHT.h"
#define DHTPIN 11          
#define DHTTYPE DHT11     
DHT dht(DHTPIN, DHTTYPE);



//BMP280
#include <Wire.h>
#include <SPI.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BMP280.h>
Adafruit_BMP280 bmp;



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

#define ONE_WIRE_BUS 2 
 
OneWire oneWire(ONE_WIRE_BUS); 

DallasTemperature sensors(&oneWire);

void setup() {
  Serial.begin(9600);
  //DHT11
  dht.begin();

  //BMP280
  if (!bmp.begin(0x76)) {
  Serial.println(F("Could not find a valid BMP280 sensor, check wiring!"));
  while (1);

  //DS18B20
  sensors.begin();
}
}

void loop() {

  //DHT11
  
  delay(2000);                     
  float h = dht.readHumidity();    
  float t = dht.readTemperature(); 
  if (isnan(h) || isnan(t)) {
    Serial.println("Fehler beim auslesen des Sensors DHT11!");
    return;
  }
  Serial.print("Luftfeuchtigkeit: ");
  Serial.println(h);
  Serial.print("Temperatur: ");
  Serial.print(t);
  Serial.println("°C");


  //BMP280
  Serial.print(F("Pressure = "));
  Serial.print(bmp.readPressure());
  Serial.println(" Pa");



  //DS18B20
   sensors.requestTemperatures(); // 
   Serial.print("Wasser Temperatur: "); 
   Serial.print(sensors.getTempCByIndex(0));
  Serial.println();
  Serial.println();

  
  delay(2000);
}

thx for any help

Does the Arduino have WiFi?

hi, no :slight_smile:

Then you can only send data to the Pi over your serial port, shouldn't be too difficult. There is also a node to use firmata:

For things like sensors just use serial. The firmata node is really just for simple pin io

2 Likes

There is another easy alternative called RPIEasy. It is full framework covering lot of different sensors via plugins. In your case you can activate plugins for whatever sensors you have attached to your hardware plus there are one of few plugins for communication.based on either serial, Bluetooth, I2C, Lora, IR, or RF.You can choose one of them by just clicking on GUI. It can take only few minutes to setup whole system without knowing any code or programming.It has powerful rules engine to automate whole system using GUI. You do not have to even use arduino if you want to use Raspi for all your sensors including analog sensors with help of plugins for ADC chips. Link for repo is below:

On arduino you can use compatible ESPEasy framework or just following code listed below:


Thanks.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.