Particle Photon and DS18b20 temperature sensor

I have used code found in multiple threads but cannot seem to read/write any data from the sensor. I know many people used serial commands but I thought since only one sensor was being used that i could skip that part of the code. At some point i will have 3 of these connected to my project and will be able to use one pin per sensor but if the code is similar all three could occupy one pin i guess. Am i using the correct libraries for this task? Any help would be appreciated!

#include "blynk/blynk.h"
#include "blynk/BlynkSimpleParticle.h"
#include "SparkCorePolledTimer/SparkCorePolledTimer.h"
#include "spark-dallas-temperature/spark-dallas-temperature.h"
#include "OneWire/OneWire.h"
#define ONE_WIRE_BUS 0


OneWire oneWire(ONE_WIRE_BUS); // Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
DallasTemperature sensors(&oneWire); // Pass our oneWire reference to Dallas Temperature.

SparkCorePolledTimer updateTimer(5000); //Create a timer object and set it's timeout in milliseconds
void OnTimer(void); //Prototype for timer callback method

float main, mainRaw, aux, auxRaw, acc, accRaw;
float temp = sensors.getTempCByIndex(0);
char auth[] = "qwerty";

void setup(){
Serial.begin(9600);
updateTimer.SetCallback(OnTimer);


delay(5000); // Allow board to settle

pinMode(A0, INPUT);
pinMode(A1, INPUT);
pinMode(A2, INPUT);
pinMode(D0, INPUT);
//sensors.requestTemperatures(); // Send the command to get temperatures
sensors.begin(); // IC Default 9 bit. If you have troubles consider upping it 12. Ups the delay giving the IC more time
Blynk.begin(auth);
}

void loop(){

Blynk.run();
updateTimer.Update();
}

void OnTimer(void) { //Handler for the timer, will be called automatically

// read analog ports
mainRaw = analogRead(A0);
auxRaw = analogRead(A1);
accRaw = analogRead(A2);
temp = digitalRead(D0);

main = map(mainRaw, 0, 4096, 0, 1865);
aux = map(auxRaw, 0, 4096, 0, 1865);
acc = map(accRaw, 0, 4096, 0, 1865);

main = (main / 100);
aux = (aux / 100);
acc = (acc / 100);

sensors.requestTemperatures(); // Send the command to get temperatures

Blynk.virtualWrite(5, main);
Blynk.virtualWrite(6, aux);
Blynk.virtualWrite(7, acc);
Blynk.virtualWrite(8, temp);
}

Your code seems to be correct.

Are you able to get the data from the sensor without Blynk?

Try to make sure that everything works first, then add Blynk cherry :cherries: on top of your :cake: :wink:

Nothing was working so i started from scratch. This is code i used to read the address of each sensor. Flash it to the particle then open up a terminal, i used cool-term, and note each address as you connect them individually to D2 (could be any digital pin but the code is written for D2)


#include "OneWire/OneWire.h"

OneWire ds = OneWire(D2);  // on pin 10 (a 4.7K resistor is necessary)
unsigned long lastUpdate = 0; 
void setup() {
  Serial.begin(9600);
}

void loop() {
 unsigned long now = millis();
    if((now - lastUpdate) > 3000)
    {
        lastUpdate = now;
        byte i;
        byte present = 0;
        byte addr[8];

      if ( !ds.search(addr)) {
        Serial.println("No more addresses.");
        Serial.println();
        ds.reset_search();
        //delay(250);
        return;
      }
      // the first ROM byte indicates which chip
      switch (addr[0]) {
        case 0x10:
          Serial.println("Chip = DS18S20");  // or old DS1820
          break;
        case 0x28:
          Serial.println("Chip = DS18B20");
          break;
        case 0x22:
          Serial.println("Chip = DS1822");
          break;
        default:
          Serial.println("Device is not a DS18x20 family device.");
          return;
      }

      Serial.print("ROM = ");
      Serial.print("0x");
        Serial.print(addr[0],HEX);
      for( i = 1; i < 8; i++) {
        Serial.print(", 0x");
        Serial.print(addr[i],HEX);
      }

      if (OneWire::crc8(addr, 7) != addr[7]) {
          Serial.println("CRC is not valid!");
          return;
      }

    Serial.println();
      ds.reset();
    }
}

Now that i have the individual address I need the code to read serial data from each sensor. Currently this code is written for a single sensor connected to D0, and the temp is read from the same terminal program over usb.

#pragma SPARK_NO_PREPROCESSOR
#include "spark-dallas-temperature/spark-dallas-temperature.h"
#include "OneWire/OneWire.h"

// DS18B20 Thermometer Stuff
#define ONE_WIRE_BUS D0
#define TEMPERATURE_PRECISION 9
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);

//Run I2C Scanner to get address of DS18B20(s)
DeviceAddress inWaterThermometer = { 0x28, 0xFF, 0x33, 0x46, 0x54, 0x15, 0x3, 0x7F };
//CHNAGE TO YOUR DEVICE'S ADDRESS

double InTempC = -1;
double waterTempF = -1;

void update18B20Temp(DeviceAddress deviceAddress, double &tempC);

void setup()
{
    // DS18B20 initialization
    sensors.begin();
    sensors.setResolution(inWaterThermometer, TEMPERATURE_PRECISION);

    Serial.begin(9600);   // open serial over USB
}

void loop()
{
        // DS18B20
        sensors.requestTemperatures();
        update18B20Temp(inWaterThermometer, InTempC);

        waterTempF = (InTempC * 9)/5 + 32;

        Serial.print("Water Temp:");
        Serial.print(waterTempF);
        Serial.println("F");
        delay(1000);
}

void update18B20Temp(DeviceAddress deviceAddress, double &tempC)
{
  tempC = sensors.getTempC(deviceAddress);
}

I managed to get one sensor working with the rest of my original code but flips the value display in blynk flips between a Celsius reading and -127. Closer than I have ever been though, at least i’m reading temperatures!!

The problem with the first attempt was Blynk.virtualWrite(8, temp(0)); now it is Blynk.virtualWrite(8, sensors.getTempCByIndex(0));

i need to change from reading by index to reading by address, then ill be able to add additional temperature sensors.

Current working code is


#include "blynk/blynk.h"
#include "blynk/BlynkSimpleParticle.h"
#include "SparkCorePolledTimer/SparkCorePolledTimer.h"
#include "spark-dallas-temperature/spark-dallas-temperature.h"
#include "OneWire/OneWire.h"
#define ONE_WIRE_BUS D0 // Data wire is plugged into pin D0 on the particle


OneWire oneWire(ONE_WIRE_BUS); // Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
DallasTemperature sensors(&oneWire); // Pass our oneWire reference to Dallas Temperature.

SparkCorePolledTimer updateTimer(5000); //Create a timer object and set it's timeout in milliseconds
void OnTimer(void); //Prototype for timer callback method

float main, mainRaw, aux, auxRaw, acc, accRaw;
float temp = sensors.getTempCByIndex(0); //0 is first sensor in string?



char auth[] = "token";

void setup(){
Serial.begin(9600);
updateTimer.SetCallback(OnTimer);
delay(5000); // Allow board to settle

pinMode(A0, INPUT);
pinMode(A1, INPUT);
pinMode(A2, INPUT);
pinMode(D0, INPUT);
sensors.requestTemperatures(); // Send the command to get temperatures
sensors.begin(); // IC Default 9 bit. If you have troubles consider upping it 12. Ups the delay giving the IC more time
Blynk.begin(auth);
}

void loop(){

Blynk.run();
updateTimer.Update();
sensors.requestTemperatures(); // Send the command to get temperatures
}

void OnTimer(void) { //Handler for the timer, will be called automatically

// read analog ports
mainRaw = analogRead(A0);
auxRaw = analogRead(A1);
accRaw = analogRead(A2);



main = map(mainRaw, 0, 4096, 0, 1865);
aux = map(auxRaw, 0, 4096, 0, 1865);
acc = map(accRaw, 0, 4096, 0, 1865);

main = (main / 100);
aux = (aux / 100);
acc = (acc / 100);


Blynk.virtualWrite(5, main);
Blynk.virtualWrite(6, aux);
Blynk.virtualWrite(7, acc);
Blynk.virtualWrite(8, sensors.getTempCByIndex(0)); 

}

Focusing on getting multiple temp sensors on the same pin now, but i keep getting fliers in the readings. mostly -127 which I have read is attributed to a non read of the device. Can I get rid of any lines of code here?

#include "spark-dallas-temperature/spark-dallas-temperature.h"
#include "OneWire/OneWire.h"
#include "blynk/blynk.h"
#include "blynk/BlynkSimpleParticle.h"
#include "SparkCorePolledTimer/SparkCorePolledTimer.h"  // USED TO SEND PUSH DATA AT INTERVAL SET
char auth[] = "token";   // CHANGE TO BLYNK DASHBOARD TOKEN
#define ONE_WIRE_BUS D0                 // DS18B20 Thermometer Stuff
#define TEMPERATURE_PRECISION 11         // DS18B20 Thermometer Stuff
OneWire oneWire(ONE_WIRE_BUS);          // DS18B20 Thermometer Stuff
DallasTemperature sensors(&oneWire);    // DS18B20 Thermometer Stuff

//Run I2C Scanner to get address of DS18B20(s)
//CHANGE TO YOUR DEVICE'S ADDRESS
DeviceAddress Thermometer1 = { 0x28, 0xFF, 0x44, 0x50, 0x16, 0x15, 0x3, 0xC };
DeviceAddress Thermometer2 = { 0x28, 0xFF, 0xD5, 0x4D, 0x16, 0x15, 0x3, 0xD3 };
DeviceAddress Thermometer3 = { 0x28, 0xFF, 0x2D, 0x37, 0x16, 0x15, 0x3, 0xF8 };
DeviceAddress Thermometer4 = { 0x28, 0xFF, 0x6A, 0x24, 0x16, 0x15, 0x3, 0xF0 };



double InTempC = -1;
double Temp1 = -1;
double Temp2 = -1; // XXXXXXXX
double Temp3 = -1;
double Temp4 = -1;

void update18B20Temp(DeviceAddress deviceAddress, double &tempC);

void setup()
{
    // DS18B20 initialization
    sensors.begin();
    sensors.setResolution(Thermometer1, TEMPERATURE_PRECISION);
    sensors.setResolution(Thermometer2, TEMPERATURE_PRECISION);  //  XXXXXXXXXX
    sensors.setResolution(Thermometer3, TEMPERATURE_PRECISION);
    sensors.setResolution(Thermometer4, TEMPERATURE_PRECISION);
    Serial.begin(9600);   // open serial over USB
    
    //Blynk initialization
    Blynk.begin(auth);
}


void loop()
{
    Blynk.run();
        // DS18B20
        sensors.requestTemperatures();
        update18B20Temp(Thermometer1, InTempC);
        Temp1 = (InTempC * 9)/5 + 32;
        update18B20Temp(Thermometer2, InTempC);  
        Temp2 = (InTempC * 9)/5 + 32;  
        update18B20Temp(Thermometer3, InTempC);  
        Temp3 = (InTempC * 9)/5 + 32;  
        update18B20Temp(Thermometer4, InTempC);  
        Temp4 = (InTempC * 9)/5 + 32;  
       // Serial.print("Water Temp:");
        //Serial.print(waterTempF);
       //Serial.println("F");
       delay(5000); // READ DELAY - TOOK THIS OUT AND IT GOT JUMPY WITH -127'S C AND 196'S F
}

void update18B20Temp(DeviceAddress deviceAddress, double &tempC)
{
  tempC = sensors.getTempC(deviceAddress);
  
  
  Blynk.virtualWrite(8, tempC); 
  Blynk.virtualWrite(9, Temp1); 
  Blynk.virtualWrite(10, Temp2); 
  Blynk.virtualWrite(11, Temp3);
  Blynk.virtualWrite(12, Temp4);
}

I recently started to get strange spikes on DHT22 sensor. Nothing helped until I filtered the values and then averaged them by 100 samples

did you apply that filter to a history widget or when you read the file after it was recorded?

I was lazy to calculate median :slight_smile: so I filter data to ignore outliers, then average 100 readings, then write to Virtual Pin on a History Graph.

do you happen to have an example handy:sunglasses:

Can i get rid of the TempC here

double InTempC = -1;
double Temp1 = -1;
double Temp2 = -1; 
double Temp3 = -1;
double Temp4 = -1;

or here

void loop()
{
Blynk.run();
//updateTimer.Update();    // new stuff
        // DS18B20
        sensors.requestTemperatures();
        update18B20Temp(Thermometer1, InTempC);
        Temp1 = (InTempC * 9)/5 + 32;
        update18B20Temp(Thermometer2, InTempC);  
        Temp2 = (InTempC * 9)/5 + 32;  
        update18B20Temp(Thermometer3, InTempC);  
        Temp3 = (InTempC * 9)/5 + 32;  
        update18B20Temp(Thermometer4, InTempC);  
        Temp4 = (InTempC * 9)/5 + 32;  

For reference this is what i’m seeing @pavel …and thanks for the iOS app update, I got my virtual pins back without rebuilding the dashboard, very nice!

how could I implement something like if reading is less than -30 than don’t send update?

Actually if I only write positive numbers that would be fine too, I tried changing double to float and I get even more -196 fliers. Odd thing now is that they all go to -196 at the same time, before it was one at a time.

I’m using a modified version of: AnalogSmooth Library to smooth analog signal jitter by averaging concurrent readings by Michael Thessel.

I just changed it slightly so that it works not only with Analog Pins, but with any values.

Filtering is a simple if statement:

if ( t < 50 && t > -30){ //checking if value is in the adequate range
      float tempSmooth = as100.smooth(t); //smoothing it with the AnalogSmooth library
      Blynk.virtualWrite(27, tempSmooth); //writing it to the V pin
  }

Thank you, I used if statements as the filter

pragma SPARK_NO_PREPROCESSOR
#include "spark-dallas-temperature/spark-dallas-temperature.h"
#include "OneWire/OneWire.h"
#include "blynk/blynk.h"
#include "blynk/BlynkSimpleParticle.h"
#include "SparkCorePolledTimer/SparkCorePolledTimer.h"  // USED TO SEND PUSH DATA AT INTERVAL SET
char auth[] = "token";   // CHANGE TO BLYNK DASHBOARD TOKEN
#define ONE_WIRE_BUS D0                 // DS18B20 Thermometer Stuff
#define TEMPERATURE_PRECISION 11         // DS18B20 Thermometer Stuff
OneWire oneWire(ONE_WIRE_BUS);          // DS18B20 Thermometer Stuff
DallasTemperature sensors(&oneWire);    // DS18B20 Thermometer Stuff

//SparkCorePolledTimer updateTimer(5000); //Create a timer object and set it's timeout in milliseconds  //new stuff
//void OnTimer(void); //Prototype for timer callback method  // new stuff

//Run I2C Scanner to get address of DS18B20(s)
//CHANGE TO YOUR DEVICE'S ADDRESS
DeviceAddress Thermometer1 = { 0x28, 0xFF, 0x44, 0x50, 0x16, 0x15, 0x3, 0xC };
DeviceAddress Thermometer2 = { 0x28, 0xFF, 0xD5, 0x4D, 0x16, 0x15, 0x3, 0xD3 };
DeviceAddress Thermometer3 = { 0x28, 0xFF, 0x2D, 0x37, 0x16, 0x15, 0x3, 0xF8 };
DeviceAddress Thermometer4 = { 0x28, 0xFF, 0x6A, 0x24, 0x16, 0x15, 0x3, 0xF0 };



double InTempC = -1;
double Temp1 = -1;
double Temp2 = -1; 
double Temp3 = -1;
double Temp4 = -1;

void update18B20Temp(DeviceAddress deviceAddress, double &tempC);

void setup()
{
        
//Serial.begin(9600);                    //new stuff
//updateTimer.SetCallback(OnTimer);      //new stuff
//delay(5000); // Allow board to settle  //new stuff

    // DS18B20 initialization
    sensors.begin();
    sensors.setResolution(Thermometer1, TEMPERATURE_PRECISION);
    sensors.setResolution(Thermometer2, TEMPERATURE_PRECISION); 
    sensors.setResolution(Thermometer3, TEMPERATURE_PRECISION);
    sensors.setResolution(Thermometer4, TEMPERATURE_PRECISION);
    Serial.begin(9600);   // open serial over USB
    
//Blynk initialization
Blynk.begin(auth);

    
}


void loop()
{
Blynk.run();
//updateTimer.Update();    // new stuff
        // DS18B20
        sensors.requestTemperatures();
        update18B20Temp(Thermometer1, InTempC);
        Temp1 = (InTempC * 9)/5 + 32;
        update18B20Temp(Thermometer2, InTempC);  
        Temp2 = (InTempC * 9)/5 + 32;  
        update18B20Temp(Thermometer3, InTempC);  
        Temp3 = (InTempC * 9)/5 + 32;  
        update18B20Temp(Thermometer4, InTempC);  
        Temp4 = (InTempC * 9)/5 + 32;  
        //Serial.print("Water Temp:");
        //Serial.print(waterTempF);
        //Serial.println("F");
       delay(5000); // READ DELAY - TOOK THIS OUT AND IT GOT JUMPY WITH -127'S C AND 196'S F
}

void update18B20Temp(DeviceAddress deviceAddress, double &tempC)
{
  tempC = sensors.getTempC(deviceAddress);


if ( tempC < 60 && tempC > -30) {
    Blynk.virtualWrite(8, tempC);
}
if ( Temp1 < 150 && Temp1 > -30) {
    Blynk.virtualWrite(9, Temp1); 
}
if ( Temp2 < 150 && Temp2 > -30) {
    Blynk.virtualWrite(10, Temp2); 
}
if ( Temp3 < 150 && Temp3 > -30) {
    Blynk.virtualWrite(11, Temp3);
}
if ( Temp4 < 150 && Temp4 > -30) {
    Blynk.virtualWrite(12, Temp4);
}
}

1 Like

I take multiple measurements and average them out. There is a an example in my Home Domotics topic. Basically, I take X measurements for a sensor, subtract the highest and lowest value (for reading mistakes) and average out the rest of them.

Thank you @Pavel and @Lichtsignaal, without your insight it would have taken forever to get this up and running! I now have sensors for voltage temperature and light, with controls for doors locks and engine run, this is very cool.

Now that i have a working system i will tweak the temperature reading to do averaging, probably do the same for the battery voltage. The plan is to have a particle electron with 3g running this so the bandwidth will be a concern at some point. Currently i just run a spare phone has a hotspot and it only pulls a couple hundred MB a day, and thats with flashing code all the time. Here is my code as usual, if theres anything fundamentally wrong please let me know. Im worried that i have some of the timer functions misplaced in the loop.

I love that i can reset the history graphs now, so helpful. Edit: this no longer happens, must have been fixed because I didn’t change anything on my end, well done. - (One thing i have noticed is that if don’t have a value display monitoring a shared channel with the history graph, it will not populate the legend when re-opening the app.)

#include "blynk/blynk.h"
#include "blynk/BlynkSimpleParticle.h"
#include "SparkCorePolledTimer/SparkCorePolledTimer.h"
#include "spark-dallas-temperature/spark-dallas-temperature.h"
#include "OneWire/OneWire.h"
#define ONE_WIRE_BUS D0 // Data wire is plugged into pin D0 on the particle
#define TEMPERATURE_PRECISION 12         // DS18B20 Thermometer Stuff
OneWire oneWire(ONE_WIRE_BUS);          // DS18B20 Thermometer Stuff
DallasTemperature sensors(&oneWire);    // DS18B20 Thermometer Stuff

SparkCorePolledTimer updateTimer(5000); //Create a timer object and set it's timeout in milliseconds
void OnTimer(void); //Prototype for timer callback method

float main, mainRaw, aux, auxRaw, acc, accRaw, light, lightRaw;

char auth[] = "token";

//temp stuff
DeviceAddress Thermometer1 = { 0x28, 0xFF, 0x44, 0x50, 0x16, 0x15, 0x3, 0xC };
DeviceAddress Thermometer2 = { 0x28, 0xFF, 0xD5, 0x4D, 0x16, 0x15, 0x3, 0xD3 };
DeviceAddress Thermometer3 = { 0x28, 0xFF, 0x2D, 0x37, 0x16, 0x15, 0x3, 0xF8 };
DeviceAddress Thermometer4 = { 0x28, 0xFF, 0x6A, 0x24, 0x16, 0x15, 0x3, 0xF0 };
double InTempC = -1;
double Temp1 = -1;
double Temp2 = -1; 
double Temp3 = -1;
double Temp4 = -1;
void update18B20Temp(DeviceAddress deviceAddress, double &tempC);
//end temp stuff

void setup(){
Serial.begin(9600);
updateTimer.SetCallback(OnTimer);

// DS18B20 initialization
    sensors.begin();
    sensors.setResolution(Thermometer1, TEMPERATURE_PRECISION);
    sensors.setResolution(Thermometer2, TEMPERATURE_PRECISION); 
    sensors.setResolution(Thermometer3, TEMPERATURE_PRECISION);
    sensors.setResolution(Thermometer4, TEMPERATURE_PRECISION);


delay(5000); // Allow board to settle

pinMode(A0, INPUT);
pinMode(A1, INPUT);
pinMode(A2, INPUT);
pinMode(A5, INPUT);
Blynk.begin(auth);
}

void loop()
{


Blynk.run();
updateTimer.Update();
}

void OnTimer(void) { //Handler for the timer, will be called automatically



        // DS18B20
        sensors.requestTemperatures();
        update18B20Temp(Thermometer1, InTempC);
        Temp1 = (InTempC * 9)/5 + 32;
        update18B20Temp(Thermometer2, InTempC);  
        Temp2 = (InTempC * 9)/5 + 31.33;  
        update18B20Temp(Thermometer3, InTempC);  
        Temp3 = (InTempC * 9)/5 + 31.67;  
        update18B20Temp(Thermometer4, InTempC);  
        Temp4 = (InTempC * 9)/5 + 32; 
        
//left out due to updatetimer in      delay(5000); // READ DELAY - TOOK THIS OUT AND IT GOT JUMPY WITH -127'S C AND 196'S F


updateTimer.Update();    // new stuff
}

void update18B20Temp(DeviceAddress deviceAddress, double &tempC)
{
  tempC = sensors.getTempC(deviceAddress);


if ( tempC < 60 && tempC > -30) {
    Blynk.virtualWrite(0, tempC);
}
if ( Temp1 < 150 && Temp1 > -30) {
    Blynk.virtualWrite(21, Temp1); 
}
if ( Temp2 < 150 && Temp2 > -30) {
    Blynk.virtualWrite(22, Temp2); 
}
if ( Temp3 < 150 && Temp3 > -30) {
    Blynk.virtualWrite(23, Temp3);
}
if ( Temp4 < 150 && Temp4 > -30) {
    Blynk.virtualWrite(24, Temp4);
}


// read analog ports
mainRaw = analogRead(A0);
auxRaw = analogRead(A1);
accRaw = analogRead(A2);
lightRaw = analogRead(A5);

main = map(mainRaw, 0, 4096, 0, 1865);
aux = map(auxRaw, 0, 4096, 0, 1865);
acc = map(accRaw, 0, 4096, 1000, 1865);
light = map(lightRaw, 0, 4096, 1000, 1500);

main = (main / 100);
aux = (aux / 100);
acc = (acc / 100);
light = (light / 100);

Blynk.virtualWrite(10, main);
Blynk.virtualWrite(11, aux);
Blynk.virtualWrite(12, acc);
Blynk.virtualWrite(25, light);
}
1 Like

Once again i need assistance with my code. Trying to get control of my particle on IFTTT and thought that I could define BLYNK_WRITE as a function, i don’t think i’m going about it correctly though. Should i just wait for BLYNK IFTTT integration or should this work work with a little tweaking? Thanks for any help you can offer!

//#pragma SPARK_NO_PREPROCESSOR
#include "blynk/blynk.h"
#include "blynk/BlynkSimpleParticle.h"
#include "SparkCorePolledTimer/SparkCorePolledTimer.h"
#include "spark-dallas-temperature/spark-dallas-temperature.h"
#include "OneWire/OneWire.h"
#include "MCP23008-I2C/MCP23008-I2C.h"  //I2C STUFF
#define ONE_WIRE_BUS D6                 // Data wire is plugged into pin D5 on the particle
#define TEMPERATURE_PRECISION 12        // DS18B20 Thermometer Stuff
#define lock BLYNK_WRITE(7)             // lock doors
#define unlock BLYNK_WRITE(6)           // unlock doors


char auth[] = "token";  //BLYNK CE3
//char auth[] = "token";  //BLYNK CE2

OneWire oneWire(ONE_WIRE_BUS);          // DS18B20 Thermometer Stuff
DallasTemperature sensors(&oneWire);    // DS18B20 Thermometer Stuff
Adafruit_MCP23008 mcp;                  // I2C STUFF
SparkCorePolledTimer updateTimer(5000); //Create a timer object and set it's timeout in milliseconds
void OnTimer(void);                     //Prototype for timer callback method

float main, mainRaw, aux, auxRaw, acc, accRaw, light, lightRaw;

//defince temp address
DeviceAddress Thermometer1 = { 0x28, 0xFF, 0x44, 0x50, 0x16, 0x15, 0x3, 0xC };
DeviceAddress Thermometer2 = { 0x28, 0xFF, 0xD5, 0x4D, 0x16, 0x15, 0x3, 0xD3 };
DeviceAddress Thermometer3 = { 0x28, 0xFF, 0x2D, 0x37, 0x16, 0x15, 0x3, 0xF8 };
DeviceAddress Thermometer4 = { 0x28, 0xFF, 0x6A, 0x24, 0x16, 0x15, 0x3, 0xF0 };
//DeviceAddress Thermometer5 = { 0x28, 0xFF, 0xF5, 0x4F, 0x16, 0x15, 0x3, 0x2C };
// define temp bit resolution ie: int, float, double
double InTempC = -1;
double Temp1 = -1;
double Temp2 = -1; 
double Temp3 = -1;
double Temp4 = -1;
//double Temp5 = -1;
void update18B20Temp(DeviceAddress deviceAddress, double &tempC);
//end temp stuff

 //setupsetupsetupsetupsetupsetupsetupsetupsetupsetupsetupsetupsetupsetupsetupsetupsetupsetupsetupsetupsetupsetupsetupsetupsetup 
void setup(){
Serial.begin(9600);
Blynk.begin(auth);      // BLYNK initialization
updateTimer.SetCallback(OnTimer);
Particle.function("lock", lock);
Particle.function("unlock", unlock);




    sensors.begin();    // DS18B20 initialization
    sensors.setResolution(Thermometer1, TEMPERATURE_PRECISION);
    sensors.setResolution(Thermometer2, TEMPERATURE_PRECISION); 
    sensors.setResolution(Thermometer3, TEMPERATURE_PRECISION);
    sensors.setResolution(Thermometer4, TEMPERATURE_PRECISION);
//    sensors.setResolution(Thermometer5, TEMPERATURE_PRECISION);
pinMode(A0, INPUT); //
pinMode(A1, INPUT);
pinMode(A2, INPUT);
pinMode(A5, INPUT);

// I2C STUFF
mcp.begin();      // use default address 0
  mcp.pinMode(0, OUTPUT); 
  mcp.pinMode(1, OUTPUT);
  mcp.pinMode(2, OUTPUT);
  mcp.pinMode(3, OUTPUT);
  mcp.pinMode(4, OUTPUT);
  mcp.pinMode(5, OUTPUT);
  mcp.pinMode(6, OUTPUT);
  mcp.pinMode(7, OUTPUT);
// END I2C STUFF
}// END VOID SETUP BUT WHAT ABOUT I2C CODE BELOW BEFORE LOOP

// BLYNY WRITE NEEDS TO BE ABOVE LOOP BUT NOT IN SETUP LIKE THIS
// I2C STUFF
BLYNK_WRITE(0) {
    if (param.asInt()) {
        mcp.digitalWrite(0, HIGH);
        delay(3000);        
    } else {
       mcp.digitalWrite(0, LOW);}}
       
BLYNK_WRITE(1) {
    if (param.asInt()) {
        mcp.digitalWrite(1, HIGH);
    } else {
       mcp.digitalWrite(1, LOW);}}
       
BLYNK_WRITE(2) {
    if (param.asInt()) {
        mcp.digitalWrite(2, HIGH);
    } else {
       mcp.digitalWrite(2, LOW);}}
       
BLYNK_WRITE(3) {
    if (param.asInt()) {
        mcp.digitalWrite(3, HIGH);
    } else {
       mcp.digitalWrite(3, LOW);}}
       
BLYNK_WRITE(4) {
    if (param.asInt()) {
        mcp.digitalWrite(4, HIGH);
    } else {
       mcp.digitalWrite(4, LOW);}}
       
BLYNK_WRITE(5) {
    if (param.asInt()) {
        mcp.digitalWrite(5, HIGH);
    } else {
       mcp.digitalWrite(5, LOW);}}
       
BLYNK_WRITE(6) {
    if (param.asInt()) {
        mcp.digitalWrite(6, HIGH);
        delay(500);   
        mcp.digitalWrite(6, LOW);
        delay(500);  
        mcp.digitalWrite(6, HIGH);
        delay(500); 
    } else {
       mcp.digitalWrite(6, LOW);}}
        
BLYNK_WRITE(7) {
    if (param.asInt()) {
        mcp.digitalWrite(7, HIGH);
        delay(500);   
        mcp.digitalWrite(7, LOW);
        delay(500);  
        mcp.digitalWrite(7, HIGH);
        delay(500); 
    } else {
       mcp.digitalWrite(7, LOW);}}
//I2C STUFF


//looplooplooplooplooplooplooplooplooplooplooplooplooplooplooplooplooplooplooplooplooplooplooploop//looplooplooplooplooplooploopl
void loop()
{
Blynk.run();
updateTimer.Update();
}

void OnTimer(void) { //Handler for the timer, will be called automatically
        // DS18B20
        sensors.requestTemperatures();
        update18B20Temp(Thermometer1, InTempC);
        Temp1 = (InTempC * 9)/5 + 32;
        update18B20Temp(Thermometer2, InTempC);  
        Temp2 = (InTempC * 9)/5 + 31.33;  
        update18B20Temp(Thermometer3, InTempC);  
        Temp3 = (InTempC * 9)/5 + 31.67;  
        update18B20Temp(Thermometer4, InTempC);  
        Temp4 = (InTempC * 9)/5 + 32; 
//        update18B20Temp(Thermometer5, InTempC);
//        Temp5 = (InTempC * 9)/5 + 32.12;
//delay(5000); // READ DELAY - TOOK THIS OUT AND IT GOT JUMPY WITH -127'S C AND 196'S F        
updateTimer.Update();    // new stuff
}

void update18B20Temp(DeviceAddress deviceAddress, double &tempC)
{
  tempC = sensors.getTempC(deviceAddress);

// read temperature and discard reading between 150 and -30
if ( Temp1 < 150 && Temp1 > -30) {
    Blynk.virtualWrite(21, Temp1); 
}
if ( Temp2 < 150 && Temp2 > -30) {
    Blynk.virtualWrite(22, Temp2); 
}
if ( Temp3 < 150 && Temp3 > -30) {
    Blynk.virtualWrite(23, Temp3);
}
if ( Temp4 < 150 && Temp4 > -30) {
    Blynk.virtualWrite(24, Temp4);
}
//if ( Temp5 < 150 && Temp5 > -30) {
//    Blynk.virtualWrite(25, Temp5);
//}

// read analog ports
mainRaw = analogRead(A0);
auxRaw = analogRead(A1);
accRaw = analogRead(A2);
lightRaw = analogRead(A5);
// map analog input scale output
main = map(mainRaw, 0, 4096, 0, 1865);
aux = map(auxRaw, 0, 4096, 0, 1865);
acc = map(accRaw, 0, 4096, 0, 1865);
light = map(lightRaw, 0, 4050, 1100, 1500);
// correct display decimal place
main = (main / 100);
aux = (aux / 100);
acc = (acc / 100);
light = (light / 100);

Blynk.virtualWrite(10, main);
Blynk.virtualWrite(11, aux);
Blynk.virtualWrite(12, acc);
Blynk.virtualWrite(15, light);
}

error message

In file included from blynk/BlynkParticle.h:16:0,
                 from blynk/BlynkSimpleParticle.h:14,
                 from blynk/blynk.h:2,
                 from cruisecontrolce2.cpp:2:
blynk/BlynkApiParticle.h:78:6: warning: #warning "analogInputToDigitalPin not defined => Named analog pins will not work" [-Wcpp]
     #warning "analogInputToDigitalPin not defined => Named analog pins will not work"
      ^
In file included from blynk/BlynkApi.h:17:0,
                 from blynk/BlynkApiParticle.h:15,
                 from blynk/BlynkParticle.h:16,
                 from blynk/BlynkSimpleParticle.h:14,
                 from blynk/blynk.h:2,
                 from cruisecontrolce2.cpp:2:
cruisecontrolce2.cpp: In function 'void setup()':
This looks like an error in blynk library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
This looks like an error in blynk library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
blynk/BlynkHandlers.h:54:5: error: expected primary-expression before 'void'
     void BlynkWidgetWrite ## pin (BlynkReq& request, const BlynkParam& param)
     ^

blynk/BlynkHandlers.h:62:31: note: in expansion of macro 'BLYNK_WRITE_2'
 #define BLYNK_WRITE(pin)      BLYNK_WRITE_2(pin)
                               ^
cruisecontrolce2.cpp:10:14: note: in expansion of macro 'BLYNK_WRITE'
 #define lock BLYNK_WRITE(7)             // lock doors
              ^
cruisecontrolce2.cpp:46:27: note: in expansion of macro 'lock'
 Particle.function("lock", lock);
                           ^
blynk/BlynkHandlers.h:54:5: error: expected primary-expression before 'void'
     void BlynkWidgetWrite ## pin (BlynkReq& request, const BlynkParam& param)
     ^
blynk/BlynkHandlers.h:62:31: note: in expansion of macro 'BLYNK_WRITE_2'
 #define BLYNK_WRITE(pin)      BLYNK_WRITE_2(pin)
                               ^
cruisecontrolce2.cpp:11:16: note: in expansion of macro 'BLYNK_WRITE'
 #define unlock BLYNK_WRITE(6)           // unlock doors
                ^
cruisecontrolce2.cpp:47:29: note: in expansion of macro 'unlock'
 Particle.function("unlock", unlock);
                             ^
make[1]: *** [../build/target/user/platform-6cruisecontrolce2.o] Error 1
make: *** [user] Error 2

Good afternoon, I would like the libraries used in your project because I am not finding