Temperature Sensor problem




  • Admin

    Looks like garbage... try switching usb cable to your board.

    Nice to see the site in russian BTW 🙂



  • You need to change the cable? I am also pleased to work with you.


  • Admin

    @vampircik

    Have you set the correct board type in arduino? Could look like the baudrate doesn't match..


  • Contest Winner

    @vampircik

    it could also be as simple as the sketch in the library does not by default enable serial communication, nor does that sketch output any Serial data!!

    try inserting the lines I added below and make sure that your baudrate on your serial Monitor is the same (115200bps)

    void setup()  
    { 
      Serial.begin(115200);  //<<<<<<<<<<<<<<<<<<<<<  Add This Line
      // Startup OneWire 
      sensors.begin();
    
      // Startup and initialize MySensors library. Set callback for incoming messages. 
      gw.begin(); 
    
      // Send the sketch version information to the gateway and Controller
      gw.sendSketchInfo("Temperature Sensor", "1.0");
    
      // Fetch the number of attached temperature sensors  
      numSensors = sensors.getDeviceCount();
    
      // Present all sensors to controller
      for (int i=0; i<numSensors && i<MAX_ATTACHED_DS18B20; i++) {   
         gw.present(i, S_TEMP);
      }
      Serial.println("Yeah!! now it works!!");
    }
    

    @Admin

    Entire library sketch:

    // Example sketch showing how to send in OneWire temperature readings
    #include <MySensor.h>  
    #include <SPI.h>
    #include <DallasTemperature.h>
    #include <OneWire.h>
    
    #define ONE_WIRE_BUS 3 // Pin where dallase sensor is connected 
    #define MAX_ATTACHED_DS18B20 16
    unsigned long SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds)
    OneWire oneWire(ONE_WIRE_BUS);
    DallasTemperature sensors(&oneWire);
    MySensor gw;
    float lastTemperature[MAX_ATTACHED_DS18B20];
    int numSensors=0;
    boolean receivedConfig = false;
    boolean metric = true; 
    // Initialize temperature message
    MyMessage msg(0,V_TEMP);
    
    void setup()  
    { 
      // Startup OneWire 
      sensors.begin();
    
      // Startup and initialize MySensors library. Set callback for incoming messages. 
      gw.begin(); 
    
      // Send the sketch version information to the gateway and Controller
      gw.sendSketchInfo("Temperature Sensor", "1.0");
    
      // Fetch the number of attached temperature sensors  
      numSensors = sensors.getDeviceCount();
    
      // Present all sensors to controller
      for (int i=0; i<numSensors && i<MAX_ATTACHED_DS18B20; i++) {   
         gw.present(i, S_TEMP);
      }
    }
    
    
    void loop()     
    {     
      // Process incoming messages (like config from server)
      gw.process(); 
    
      // Fetch temperatures from Dallas sensors
      sensors.requestTemperatures(); 
    
      // Read temperatures and send them to controller 
      for (int i=0; i<numSensors && i<MAX_ATTACHED_DS18B20; i++) {
     
        // Fetch and round temperature to one decimal
        float temperature = static_cast<float>(static_cast<int>((gw.getConfig().isMetric?sensors.getTempCByIndex(i):sensors.getTempFByIndex(i)) * 10.)) / 10.;
     
        // Only send data if temperature has changed and no error
        if (lastTemperature[i] != temperature && temperature != -127.00) {
     
          // Send in the new temperature
          gw.send(msg.setSensor(i).set(temperature,1));
          lastTemperature[i]=temperature;
        }
      }
      gw.sleep(SLEEP_TIME);
    }
    

  • Hero Member

    Yep I agree, looks like wrong baudrate.



  • Arduino: 1.6.3 (Windows 8), Плата"Arduino Pro or Pro Mini, ATmega328 (3.3V, 8 MHz)"

    Изменена опция сборки, пересобираем все

    sketch_jul26d.ino:2:3: error: invalid preprocessing directive #\

    sketch_jul26d.ino:3:3: error: invalid preprocessing directive #\

    sketch_jul26d.ino:4:3: error: invalid preprocessing directive #\

    sketch_jul26d.ino:5:3: error: invalid preprocessing directive #\

    sketch_jul26d.ino:7:3: error: invalid preprocessing directive #\

    sketch_jul26d.ino:8:4: error: invalid preprocessing directive #\

    sketch_jul26d.ino:9:1: error: stray '' in program

    sketch_jul26d.ino:9:1: error: stray '' in program

    sketch_jul26d.ino:9:1: error: stray '' in program

    sketch_jul26d.ino:9:1: error: stray '' in program

    sketch_jul26d.ino:9:1: error: stray '' in program

    sketch_jul26d.ino:9:1: error: stray '' in program

    sketch_jul26d.ino:9:1: error: stray '' in program

    sketch_jul26d.ino:9:1: error: stray '' in program

    sketch_jul26d.ino:9:1: error: stray '' in program

    sketch_jul26d.ino:9:1: error: stray '' in program

    sketch_jul26d.ino:10:1: error: stray '' in program

    sketch_jul26d.ino:10:1: error: stray '' in program

    sketch_jul26d.ino:10:1: error: stray '' in program

    sketch_jul26d.ino:10:1: error: stray '' in program

    sketch_jul26d.ino:10:1: error: stray '' in program

    sketch_jul26d.ino:10:1: error: stray '' in program

    sketch_jul26d.ino:11:1: error: stray '' in program

    sketch_jul26d.ino:11:1: error: stray '' in program

    sketch_jul26d.ino:11:1: error: stray '' in program

    sketch_jul26d.ino:11:1: error: stray '' in program

    sketch_jul26d.ino:11:1: error: stray '' in program

    sketch_jul26d.ino:11:1: error: stray '' in program

    sketch_jul26d.ino:11:1: error: stray '' in program

    sketch_jul26d.ino:11:1: error: stray '' in program

    sketch_jul26d.ino:11:1: error: stray '' in program

    sketch_jul26d.ino:11:1: error: stray '' in program

    sketch_jul26d.ino:13:1: error: stray '' in program

    sketch_jul26d.ino:13:1: error: stray '' in program

    sketch_jul26d.ino:13:1: error: stray '' in program

    sketch_jul26d.ino:13:1: error: stray '' in program

    sketch_jul26d.ino:13:1: error: stray '' in program

    sketch_jul26d.ino:13:1: error: stray '' in program

    sketch_jul26d.ino:13:1: error: stray '' in program

    sketch_jul26d.ino:15:1: error: stray '' in program

    sketch_jul26d.ino:15:1: error: stray '' in program

    sketch_jul26d.ino:15:1: error: stray '' in program

    sketch_jul26d.ino:15:1: error: stray '' in program

    sketch_jul26d.ino:15:1: error: stray '' in program

    sketch_jul26d.ino:15:1: error: stray '' in program

    sketch_jul26d.ino:15:1: error: stray '' in program

    sketch_jul26d.ino:15:1: error: stray '' in program

    sketch_jul26d.ino:15:1: error: stray '' in program

    sketch_jul26d.ino:15:1: error: stray '' in program

    sketch_jul26d.ino:15:1: error: stray '' in program

    sketch_jul26d.ino:15:1: error: stray '' in program

    sketch_jul26d.ino:15:1: error: stray '' in program

    sketch_jul26d.ino:15:1: error: stray '' in program

    sketch_jul26d.ino:16:1: error: stray '' in program

    sketch_jul26d.ino:16:1: error: stray '' in program

    sketch_jul26d.ino:16:1: error: stray '' in program

    sketch_jul26d.ino:16:1: error: stray '' in program

    sketch_jul26d.ino:16:1: error: stray '' in program

    sketch_jul26d.ino:16:1: error: stray '' in program

    sketch_jul26d.ino:16:1: error: stray '' in program

    sketch_jul26d.ino:16:1: error: stray '' in program

    sketch_jul26d.ino:16:1: error: stray '' in program

    sketch_jul26d.ino:16:1: error: stray '' in program

    sketch_jul26d.ino:16:1: error: stray '' in program

    sketch_jul26d.ino:16:1: error: stray '' in program

    sketch_jul26d.ino:16:1: error: stray '' in program

    sketch_jul26d.ino:16:1: error: stray '' in program

    sketch_jul26d.ino:16:1: error: stray '' in program

    sketch_jul26d.ino:16:1: error: stray '' in program

    sketch_jul26d.ino:16:1: error: stray '' in program

    sketch_jul26d.ino:16:1: error: stray '' in program

    sketch_jul26d.ino:16:1: error: stray '' in program

    sketch_jul26d.ino:16:1: error: stray '' in program

    sketch_jul26d.ino:16:1: error: stray '' in program

    sketch_jul26d.ino:16:1: error: stray '' in program

    sketch_jul26d.ino:16:1: error: stray '' in program

    sketch_jul26d.ino:20:1: error: stray '' in program

    sketch_jul26d.ino:20:1: error: stray '' in program

    sketch_jul26d.ino:20:1: error: stray '' in program

    sketch_jul26d.ino:20:1: error: stray '' in program

    sketch_jul26d.ino:20:1: error: stray '' in program

    sketch_jul26d.ino:20:1: error: stray '' in program

    sketch_jul26d.ino:20:1: error: stray '' in program

    sketch_jul26d.ino:20:1: error: stray '' in program

    sketch_jul26d.ino:20:1: error: stray '' in program

    sketch_jul26d.ino:20:1: error: stray '' in program

    sketch_jul26d.ino:20:1: error: stray '' in program

    sketch_jul26d.ino:20:1: error: stray '' in program

    sketch_jul26d.ino:20:1: error: stray '' in program

    sketch_jul26d.ino:20:1: error: stray '' in program

    sketch_jul26d.ino:20:1: error: stray '' in program

    sketch_jul26d.ino:20:1: error: stray '' in program

    sketch_jul26d.ino:20:1: error: stray '' in program

    sketch_jul26d.ino:20:1: error: stray '' in program

    sketch_jul26d.ino:20:1: error: stray '' in program

    sketch_jul26d.ino:20:1: error: stray '' in program

    sketch_jul26d.ino:20:1: error: stray '' in program

    sketch_jul26d.ino:20:1: error: stray '' in program

    sketch_jul26d.ino:20:1: error: stray '' in program

    sketch_jul26d.ino:20:1: error: stray '' in program

    sketch_jul26d.ino:20:1: error: stray '' in program

    sketch_jul26d.ino:20:1: error: stray '' in program

    sketch_jul26d.ino:35:3: error: stray '' in program

    sketch_jul26d.ino:35:3: error: stray '' in program

    sketch_jul26d.ino:35:3: error: stray '' in program

    sketch_jul26d.ino:35:3: error: stray '' in program

    sketch_jul26d.ino:35:3: error: stray '' in program

    sketch_jul26d.ino:35:3: error: stray '' in program

    sketch_jul26d.ino:36:6: error: stray '' in program

    sketch_jul26d.ino:41:1: error: stray '' in program

    sketch_jul26d.ino:41:1: error: stray '' in program

    sketch_jul26d.ino:41:1: error: stray '' in program

    sketch_jul26d.ino:41:1: error: stray '' in program

    sketch_jul26d.ino:41:1: error: stray '' in program

    sketch_jul26d.ino:41:1: error: stray '' in program

    sketch_jul26d.ino:41:1: error: stray '' in program

    sketch_jul26d.ino:41:1: error: stray '' in program

    sketch_jul26d.ino:41:1: error: stray '' in program

    sketch_jul26d.ino:41:1: error: stray '' in program

    sketch_jul26d.ino:41:1: error: stray '' in program

    sketch_jul26d.ino:41:1: error: stray '' in program

    sketch_jul26d.ino:41:1: error: stray '' in program

    sketch_jul26d.ino:41:1: error: stray '' in program

    sketch_jul26d.ino:41:1: error: stray '' in program

    sketch_jul26d.ino:41:1: error: stray '' in program

    sketch_jul26d.ino:41:1: error: stray '' in program

    sketch_jul26d.ino:41:1: error: stray '' in program

    sketch_jul26d.ino:41:1: error: stray '' in program

    sketch_jul26d.ino:41:1: error: stray '' in program

    sketch_jul26d.ino:41:1: error: stray '' in program

    sketch_jul26d.ino:50:3: error: stray '' in program

    sketch_jul26d.ino:50:3: error: stray '' in program

    sketch_jul26d.ino:50:3: error: stray '' in program

    sketch_jul26d.ino:50:3: error: stray '' in program

    sketch_jul26d.ino:50:3: error: stray '' in program

    sketch_jul26d.ino:50:3: error: stray '' in program

    sketch_jul26d.ino:53:5: error: stray '' in program

    sketch_jul26d.ino:53:5: error: stray '' in program

    sketch_jul26d.ino:53:5: error: stray '' in program

    sketch_jul26d.ino:53:5: error: stray '' in program

    sketch_jul26d.ino:53:5: error: stray '' in program

    sketch_jul26d.ino:53:5: error: stray '' in program

    sketch_jul26d.ino:53:5: error: stray '' in program

    sketch_jul26d.ino:53:5: error: stray '' in program

    sketch_jul26d.ino:53:5: error: stray '' in program

    sketch_jul26d.ino:53:5: error: stray '' in program

    sketch_jul26d.ino:53:5: error: stray '' in program

    sketch_jul26d.ino:53:5: error: stray '' in program

    sketch_jul26d.ino:53:5: error: stray '' in program

    sketch_jul26d.ino:53:5: error: stray '' in program

    sketch_jul26d.ino:53:5: error: stray '' in program

    sketch_jul26d.ino:53:5: error: stray '' in program

    sketch_jul26d.ino:56:5: error: stray '' in program

    sketch_jul26d.ino:56:5: error: stray '' in program

    sketch_jul26d.ino:56:5: error: stray '' in program

    sketch_jul26d.ino:56:5: error: stray '' in program

    sketch_jul26d.ino:56:5: error: stray '' in program

    sketch_jul26d.ino:56:5: error: stray '' in program

    sketch_jul26d.ino:56:5: error: stray '' in program

    sketch_jul26d.ino:56:5: error: stray '' in program

    sketch_jul26d.ino:56:5: error: stray '' in program

    sketch_jul26d.ino:56:5: error: stray '' in program

    sketch_jul26d.ino:56:5: error: stray '' in program

    sketch_jul26d.ino:56:5: error: stray '' in program

    sketch_jul26d.ino:56:5: error: stray '' in program

    sketch_jul26d.ino:56:5: error: stray '' in program

    sketch_jul26d.ino:56:5: error: stray '' in program

    sketch_jul26d.ino:56:5: error: stray '' in program

    sketch_jul26d.ino:56:5: error: stray '' in program

    sketch_jul26d.ino:56:5: error: stray '' in program

    sketch_jul26d.ino:56:5: error: stray '' in program

    sketch_jul26d.ino:56:5: error: stray '' in program

    sketch_jul26d.ino:56:5: error: stray '' in program

    sketch_jul26d.ino:56:5: error: stray '' in program

    sketch_jul26d.ino:56:5: error: stray '' in program

    sketch_jul26d.ino:56:5: error: stray '' in program

    sketch_jul26d.ino:56:5: error: stray '' in program

    sketch_jul26d.ino:56:5: error: stray '' in program

    sketch_jul26d.ino:56:5: error: stray '' in program

    sketch_jul26d.ino:59:7: error: stray '' in program

    sketch_jul26d.ino:59:7: error: stray '' in program

    sketch_jul26d.ino:59:7: error: stray '' in program

    sketch_jul26d.ino:59:7: error: stray '' in program

    sketch_jul26d.ino:59:7: error: stray '' in program

    sketch_jul26d.ino:59:7: error: stray '' in program

    sketch_jul26d.ino:59:7: error: stray '' in program

    sketch_jul26d.ino:59:7: error: stray '' in program

    sketch_jul26d.ino:59:7: error: stray '' in program

    sketch_jul26d.ino:59:7: error: stray '' in program

    sketch_jul26d.ino:59:7: error: stray '' in program

    sketch_jul26d.ino:59:7: error: stray '' in program

    sketch_jul26d.ino:59:7: error: stray '' in program

    sketch_jul26d.ino:59:7: error: stray '' in program

    sketch_jul26d.ino:59:7: error: stray '' in program

    sketch_jul26d.ino:59:7: error: stray '' in program

    sketch_jul26d.ino:59:7: error: stray '' in program

    sketch_jul26d.ino:59:7: error: stray '' in program

    sketch_jul26d.ino:59:7: error: stray '' in program

    sketch_jul26d.ino:59:7: error: stray '' in program

    sketch_jul26d.ino:59:7: error: stray '' in program

    sketch_jul26d.ino:60:7: error: stray '' in program

    sketch_jul26d.ino:60:7: error: stray '' in program

    sketch_jul26d.ino:60:7: error: stray '' in program

    sketch_jul26d.ino:60:7: error: stray '' in program

    sketch_jul26d.ino:60:7: error: stray '' in program

    sketch_jul26d.ino:60:7: error: stray '' in program

    sketch_jul26d.ino:60:7: error: stray '' in program

    sketch_jul26d.ino:60:7: error: stray '' in program

    sketch_jul26d.ino:60:7: error: stray '' in program

    sketch_jul26d.ino:60:7: error: stray '' in program

    sketch_jul26d.ino:60:7: error: stray '' in program

    sketch_jul26d.ino:60:7: error: stray '' in program

    sketch_jul26d.ino:9:2: error: 'u0437' does not name a type

    sketch_jul26d.ino:10:1: error: 'Wire' does not name a type

    sketch_jul26d.ino:11:1: error: 'DallasTemperature' does not name a type

    sketch_jul26d.ino:12:1: error: 'MySensor' does not name a type

    sketch_jul26d.ino:13:2: error: 'u043f' does not name a type

    sketch_jul26d.ino:14:2: error: 'INT' does not name a type

    sketch_jul26d.ino:15:2: error: 'u043b' does not name a type

    sketch_jul26d.ino:16:2: error: 'u043b' does not name a type

    sketch_jul26d.ino:18:1: error: 'MyMessage' does not name a type

    sketch_jul26d.ino:20:2: error: 'u043d' does not name a type

    sketch_jul26d.ino:41:2: error: 'u043d' does not name a type

    Ошибка компиляции.

    Это сообщение будет содержать больше информации чем
    "Отображать вывод во время компиляции"
    включено в Файл > Настройки



  • Снимок экрана (21).png



  • @BulldogLowell said:

    // Example sketch showing how to send in OneWire temperature readings
    #include <MySensor.h>
    #include <SPI.h>
    #include <DallasTemperature.h>
    #include <OneWire.h>

    #define ONE_WIRE_BUS 3 // Pin where dallase sensor is connected
    #define MAX_ATTACHED_DS18B20 16
    unsigned long SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds)
    OneWire oneWire(ONE_WIRE_BUS);
    DallasTemperature sensors(&oneWire);
    MySensor gw;
    float lastTemperature[MAX_ATTACHED_DS18B20];
    int numSensors=0;
    boolean receivedConfig = false;
    boolean metric = true;
    // Initialize temperature message
    MyMessage msg(0,V_TEMP);

    void setup()
    {
    // Startup OneWire
    sensors.begin();

    // Startup and initialize MySensors library. Set callback for incoming messages.
    gw.begin();

    // Send the sketch version information to the gateway and Controller
    gw.sendSketchInfo("Temperature Sensor", "1.0");

    // Fetch the number of attached temperature sensors
    numSensors = sensors.getDeviceCount();

    // Present all sensors to controller
    for (int i=0; i<numSensors && i<MAX_ATTACHED_DS18B20; i++) {
    gw.present(i, S_TEMP);
    }
    }

    void loop()
    {
    // Process incoming messages (like config from server)
    gw.process();

    // Fetch temperatures from Dallas sensors
    sensors.requestTemperatures();

    // Read temperatures and send them to controller
    for (int i=0; i<numSensors && i<MAX_ATTACHED_DS18B20; i++) {

    // Fetch and round temperature to one decimal
    float temperature = static_cast<float>(static_cast<int>((gw.getConfig().isMetric?sensors.getTempCByIndex(i):sensors.getTempFByIndex(i)) * 10.)) / 10.;
    
    // Only send data if temperature has changed and no error
    if (lastTemperature[i] != temperature && temperature != -127.00) {
    
      // Send in the new temperature
      gw.send(msg.setSensor(i).set(temperature,1));
      lastTemperature[i]=temperature;
    }
    

    }
    gw.sleep(SLEEP_TIME);
    }

    Снимок экрана (22).png


  • Contest Winner

    "Check wires" error when you don't have the NRF radio connected properly.



  • I connected properly checked.


  • Hardware Contributor

    I have seen "check wires" a 100 times and every time it is because I missed in the wiring.

    Double and tripple check wiring in both arduino and radio side.
    If its correct, try another radio, change wires or even try another arduino.

    Good luck.


  • Admin

    And make sure you haven't enabled SOFTSPI earlier and forgot to change it back.



  • Hi,

    I had the check wires problem and this topic was helpful thanks a lot 🙂
    Now I don't have this error message anymore but I don't have any message at all, so my question is am I supposed to have any message while running my temperature sensor on serial monitor ?



  • I found the solution this was my NRF that didn't work


Log in to reply
 

Suggested Topics

  • 3
  • 3
  • 2
  • 10
  • 24
  • 1

16
Online

11.2k
Users

11.1k
Topics

112.5k
Posts