Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Troubleshooting
  3. Temperature Sensor problem

Temperature Sensor problem

Scheduled Pinned Locked Moved Troubleshooting
15 Posts 7 Posters 6.6k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    vampircik
    wrote on last edited by
    #3

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

    tbowmoT 1 Reply Last reply
    0
    • V vampircik

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

      tbowmoT Offline
      tbowmoT Offline
      tbowmo
      Admin
      wrote on last edited by
      #4

      @vampircik

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

      1 Reply Last reply
      0
      • BulldogLowellB Offline
        BulldogLowellB Offline
        BulldogLowell
        Contest Winner
        wrote on last edited by BulldogLowell
        #5

        @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);
        }
        
        1 Reply Last reply
        0
        • HeinzH Offline
          HeinzH Offline
          Heinz
          Hero Member
          wrote on last edited by
          #6

          Yep I agree, looks like wrong baudrate.

          1 Reply Last reply
          0
          • V Offline
            V Offline
            vampircik
            wrote on last edited by
            #7

            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

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

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

            1 Reply Last reply
            0
            • V Offline
              V Offline
              vampircik
              wrote on last edited by
              #8

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

              1 Reply Last reply
              0
              • V Offline
                V Offline
                vampircik
                wrote on last edited by
                #9

                @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

                1 Reply Last reply
                0
                • BulldogLowellB Offline
                  BulldogLowellB Offline
                  BulldogLowell
                  Contest Winner
                  wrote on last edited by
                  #10

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

                  1 Reply Last reply
                  0
                  • V Offline
                    V Offline
                    vampircik
                    wrote on last edited by
                    #11

                    I connected properly checked.

                    1 Reply Last reply
                    0
                    • sundberg84S Offline
                      sundberg84S Offline
                      sundberg84
                      Hardware Contributor
                      wrote on last edited by sundberg84
                      #12

                      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.

                      Controller: Proxmox VM - Home Assistant
                      MySensors GW: Arduino Uno - W5100 Ethernet, Gw Shield Nrf24l01+ 2,4Ghz
                      MySensors GW: Arduino Uno - Gw Shield RFM69, 433mhz
                      RFLink GW - Arduino Mega + RFLink Shield, 433mhz

                      1 Reply Last reply
                      0
                      • hekH Offline
                        hekH Offline
                        hek
                        Admin
                        wrote on last edited by
                        #13

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

                        1 Reply Last reply
                        0
                        • V Offline
                          V Offline
                          vinzouille
                          wrote on last edited by
                          #14

                          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 ?

                          1 Reply Last reply
                          0
                          • V Offline
                            V Offline
                            vinzouille
                            wrote on last edited by
                            #15

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

                            1 Reply Last reply
                            1
                            Reply
                            • Reply as topic
                            Log in to reply
                            • Oldest to Newest
                            • Newest to Oldest
                            • Most Votes


                            10

                            Online

                            11.7k

                            Users

                            11.2k

                            Topics

                            113.1k

                            Posts


                            Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                            • Login

                            • Don't have an account? Register

                            • Login or register to search.
                            • First post
                              Last post
                            0
                            • MySensors
                            • OpenHardware.io
                            • Categories
                            • Recent
                            • Tags
                            • Popular