• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
MagicMirror Forum
  • Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
A New Chapter for MagicMirror: The Community Takes the Lead
Read the statement by Michael Teeuw here.

Is it possible to ad an Arduino?

Scheduled Pinned Locked Moved Troubleshooting
55 Posts 4 Posters 14.4k Views 4 Watching
Loading More Posts
  • 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.
  • S Offline
    sdetweil @Shinji0912
    last edited by Sep 18, 2020, 4:18 PM

    @Shinji0912 it found the Arduino and then died when the data arrived on wrong format

    Sam

    How to add modules

    learning how to use browser developers window for css changes

    S 1 Reply Last reply Sep 18, 2020, 4:18 PM Reply Quote 0
    • S Offline
      Shinji0912 @sdetweil
      last edited by Shinji0912 Sep 18, 2020, 4:19 PM Sep 18, 2020, 4:18 PM

      @sdetweil Ok … so is it the Arduino sketch that is the problem and if yes what should i change?

      S 2 Replies Last reply Sep 18, 2020, 4:31 PM Reply Quote 0
      • S Offline
        sdetweil @Shinji0912
        last edited by Sep 18, 2020, 4:31 PM

        @Shinji0912 says json.parse failed. are u sending json formatted data as required?

        Sam

        How to add modules

        learning how to use browser developers window for css changes

        S 1 Reply Last reply Sep 18, 2020, 4:34 PM Reply Quote 0
        • S Offline
          Shinji0912 @sdetweil
          last edited by Shinji0912 Sep 18, 2020, 4:44 PM Sep 18, 2020, 4:34 PM

          @sdetweil Im not sure about that …
          Like i said im a reallyyy bloody newbie… sry :C

          #include 
          #include "DHT.h"
          
          #define DHTPIN 2
          #define DHTTYPE 11
          
          DHT dht (DHTPIN, DHTTYPE);
          
          
          
          void setup()
          {
            Wire.begin();
            Serial.begin(9600);
            dht.begin();
          }
            
          
          void loop()
          {
            delay(2000);
            float temp = dht.readTemperature();
            float rel_hum = dht.readHumidity();
           
          
            if (isnan(rel_hum) || isnan(temp)) {
              Serial.println(F("Daten vom Sensor konnten nicht gelesen werden!"));
              return;
            }
            float hif = dht.computeHeatIndex(rel_hum);
            float hic = dht.computeHeatIndex(temp, rel_hum, false);
          
            Serial.print(F("Luftfeuchtigkeit: "));
            Serial.print(rel_hum);
            Serial.print(F("%  Temperatur: "));
            Serial.print(temp);
            
            Serial.print(F("°C "));
            
            Serial.println(F(""));
          }
          

          this is the arduino code

          When i tried to rewrite the given code by ArduPorts it didn’t even showed me the temperature in the SerialMonitor this was the sketch ;

          volatile int32_t m_counter = 0;
          bool WasStarted = false;
          
          static const char *pcDHT11Prefix = "[sensor:DHT11:";
          static const char *pcPostfix = "]";
          
          void setup() {
            Serial.begin(9600);
            while(!Serial);
            
            Serial.println("[status:setup:starting]");
            Serial.println("[sensor:DHT11:11]");
            
            int test = 1;
            m_counter = test;
          
            if(test > 1) {
              WasStarted = false;
              Serial.println("[status:setup:failed]");
              return;
            }
            
            delay(3000);
            WasStarted = true;
            Serial.println("[status:setup:started]");
            delay(100);
          }
          
          void loop() {
            Serial.print(m_counter + 11);
            Serial.println(pcPostfix);
          
            if(m_counter % 3 == 0) {
              delay(1000);
              Serial.print(pcDHT11Prefix);
              Serial.print(m_counter + 11);
              Serial.println(pcPostfix);
              delay(2000);
            }
            if(m_counter >= 60) m_counter = 0;
            m_counter++;
          
            delay(1000);
            
            }
          

          EDIT 2 :

          This is what the Arduino SerialOutput looks like in NoteRed
          ( using the Rewritten ArduPorts Sketch)
          :

          alt text

          S 1 Reply Last reply Sep 18, 2020, 4:54 PM Reply Quote 0
          • S Offline
            sdetweil @Shinji0912
            last edited by Sep 18, 2020, 4:54 PM

            @Shinji0912 use one of the online json validators to check your messages

            Sam

            How to add modules

            learning how to use browser developers window for css changes

            S 1 Reply Last reply Sep 18, 2020, 5:09 PM Reply Quote 0
            • S Offline
              Shinji0912 @sdetweil
              last edited by Shinji0912 Sep 18, 2020, 5:10 PM Sep 18, 2020, 5:09 PM

              @sdetweil alt text
              alt text

              1 Reply Last reply Reply Quote 0
              • S Offline
                sdetweil @Shinji0912
                last edited by sdetweil Sep 18, 2020, 5:37 PM Sep 18, 2020, 5:16 PM

                @Shinji0912 only what u send(println) not the whole sketch

                json, all text strings must be in double quotes
                Serial.print(pcMQ2Prefix);
                Serial.print(m_counter);
                Serial.println(pcPostfix);
                sample shows sketch sending sensor info

                Sam

                How to add modules

                learning how to use browser developers window for css changes

                S 1 Reply Last reply Sep 18, 2020, 5:37 PM Reply Quote 0
                • S Offline
                  Shinji0912 @sdetweil
                  last edited by Sep 18, 2020, 5:37 PM

                  @sdetweil U mean like this?

                  {
                     Serial.println("pcPostfix)"
                  }{
                     "Serial.println(""[status:setup:starting]"")"
                  }{
                     "Serial.println(""[sensor:DHT11:11]"")"
                  }{
                     "Serial.println(""[status:setup:failed]"")"
                  }
                  
                  S 2 Replies Last reply Sep 18, 2020, 5:37 PM Reply Quote 0
                  • S Offline
                    sdetweil @Shinji0912
                    last edited by Sep 18, 2020, 5:37 PM

                    @Shinji0912 see prior post

                    Sam

                    How to add modules

                    learning how to use browser developers window for css changes

                    S 1 Reply Last reply Sep 18, 2020, 5:41 PM Reply Quote 0
                    • S Offline
                      Shinji0912 @sdetweil
                      last edited by Shinji0912 Sep 18, 2020, 5:46 PM Sep 18, 2020, 5:41 PM

                      @sdetweil alt text

                      Edit : Im really sorry for my Stupidity normally im a really quick learner and i understand things pretty fast but i got kind off lost at this point… but im sooo thankful for your help in general without you i wouldn’t even been able to get the right SerialPort name…soo thank u soo much so far ^^ and sry for using your time , but i wouldn’t ask if i could do it myself :/

                      1 Reply Last reply Reply Quote 0
                      • 1
                      • 2
                      • 3
                      • 4
                      • 5
                      • 6
                      • 4 / 6
                      4 / 6
                      • First post
                        37/55
                        Last post
                      Enjoying MagicMirror? Please consider a donation!
                      MagicMirror created by Michael Teeuw.
                      Forum managed by Sam, technical setup by Karsten.
                      This forum is using NodeBB as its core | Contributors
                      Contact | Privacy Policy