Hi Craig .
Thanks for the reply.
I see you mentioned the wiring for these sensors, just to check ,with Cayenne do i need to wire them separately with a 4.7k resistor for each sensor connected to a individual Pin , or as with Blynk all wired in parallel with one common resistor back to one Pin and identified by the sensors mac address ?
I have one working with Cayenne using the arduino IDE Cayenne example MQTT DS18B20 ( below)
wired (red 5v) (yellow sig) ( black E ) resistor between red and yellow , works fine , just cant seem to add another sensor , they always both read the same value . i have tried adapting the the supplied sketch but i get constant errors or duplicate readings, it seem that sketch is for the older version that used tokens.
Cayenne DS18B20 Example
This sketch shows how to send DS18B20 Sensor data to the Cayenne Dashboard.
The CayenneMQTT Library is required to run this sketch. If you have not already done so you can install it from the Arduino IDE Library Manager.
- Install the OneWire library (http://www.pjrc.com/teensy/td_libs_OneWire.html) from the Arduino Library Manager.
- Install the DallasTemperature library (http://milesburton.com/Main_Page?title=Dallas_Temperature_Control_Library#Code.2FLibrary) from the Arduino Library Manager.
- Attach a DS18B20 to a digital pin on your Arduino.
[Ground] – [DS18B20] – [4.7k resistor] – [5V]
- Set the SENSOR_PIN value below to the pin number you used when connecting the sensor.
- Set the VIRTUAL_CHANNEL value below to a free virtual channel (or the virtual channel of a DS18B20 Sensor widget you have added) in the Dashboard.
- Set the Cayenne authentication info to match the authentication info from the Dashboard.
- Compile and upload this sketch.
- Once the Arduino connects to the Dashboard it should automatically create a temporary display widget (or update the DS18B20 Sensor widget you have added) with data.
To make a temporary widget permanent click the plus sign on the widget.
#define CAYENNE_PRINT Serial // Comment this out to disable prints and save space
// Cayenne authentication info. This should be obtained from the Cayenne Dashboard.
char username = “MQTT_USERNAME”;
char password = “MQTT_PASSWORD”;
char clientID = “CLIENT_ID”;
#define SENSOR_PIN 2 // Do not use digital pins 0 or 1 since those conflict with the use of Serial.
#define VIRTUAL_CHANNEL 1
Cayenne.begin(username, password, clientID);
// This function is called at intervals to send sensor data to Cayenne.
// Send the command to get temperatures.
// This command writes the temperature in Celsius to the Virtual Channel.
// To send the temperature in Fahrenheit use the corresponding code below.