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 17.8k 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

      @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 Reply Quote 0
      • S Offline
        Shinji0912 @sdetweil
        last edited by Shinji0912

        @sdetweil alt text
        alt text

        1 Reply Last reply Reply Quote 0
        • S Offline
          sdetweil @Shinji0912
          last edited by sdetweil

          @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 Reply Quote 0
          • S Offline
            Shinji0912 @sdetweil
            last edited by

            @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 Reply Quote 0
            • S Offline
              sdetweil @Shinji0912
              last edited by

              @Shinji0912 see prior post

              Sam

              How to add modules

              learning how to use browser developers window for css changes

              S 1 Reply Last reply Reply Quote 0
              • S Offline
                Shinji0912 @sdetweil
                last edited by Shinji0912

                @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
                • S Offline
                  sdetweil @Shinji0912
                  last edited by sdetweil

                  @Shinji0912 you can only send the sensor values in the sketch loop() function,
                  the rest is is used for getting connected to the matching code in the python script

                  they do
                  arduino, hey, are u there?
                  python script, yes, ready for sensor values

                  arduino, once a second, or whatever frequency

                  hey, here is sensor:???:value

                  Sam

                  How to add modules

                  learning how to use browser developers window for css changes

                  S 1 Reply Last reply Reply Quote 0
                  • S Offline
                    Shinji0912 @sdetweil
                    last edited by

                    @sdetweil Ok , so based on that i have rewritten my whole Script and added just a few comments so maybe you will understand my thoughts about it…

                    #include <dht_nonblocking.h>
                    #include <Wire.h>
                    
                    #define DHT_SENSOR_TYPE DHT_TYPE_11
                    
                    
                    static const char DHT_SENSOR_PIN = 2;
                    
                    DHT_nonblocking dht_sensor( DHT_SENSOR_PIN, DHT_SENSOR_TYPE );
                    
                    
                    
                    void setup() {
                    
                      Wire.begin();
                      Serial.begin(9600);
                      
                    //Verbindung zum Raspberry aufbauen
                    // Connect to the Raspberry start ArduPort connection
                    
                      
                      Serial.println("[status:setup:starting]");
                      Serial.println("[status:setup:started]");
                      
                      
                    }
                    
                    
                    
                    // Messungen Definieren
                    //Define Measurment Names
                      
                      static bool messung_t( float *temperatur, float *feuchtigkeit)
                      {
                        static unsigned long messung_t = millis( );
                          if( millis( ) - messung_t > 3000ul )
                          {
                              if( dht_sensor.measure( temperatur, feuchtigkeit ) == true)
                              {
                                messung_t = millis( );
                                return( true );
                          }
                      }
                    
                                return ( false );
                      }
                      
                    
                    
                    void loop() {
                    
                     //Übermitteln der Daten an ArduPorts
                     //sending informations to ArduPorts
                    
                      float temperatur;
                      float feuchtigkeit;
                        
                        Serial.print( "[sensor:DHT11:" );
                        Serial.print(temperatur, 1 );
                        Serial.println("]");
                        delay(2000);
                        
                        }
                    
                    

                    I thought it is going to work this time but on the mirror it is still : “waiting for connection”

                    but my Console log when starting the mirror shows me that the ArduPorts reads the Temperature (because a slightly mistake (but should still work) the Temperature is always 0.0)

                    Console Log :

                    [2020-09-22 16:24:17.982] [LOG]    Launching application.
                    [2020-09-22 16:24:21.437] [LOG]    Create new calendar fetcher for url: https://calendar.google.com/calendar/ical/oliver.kuck12%40gmail.com/public/basic.ics - Interval: 300000
                    [2020-09-22 16:24:21.624] [LOG]    MMM-RBB-Weather[22.9.2020, 16:24:21]: Load data for ID "18228265" and "0" days ...
                    [2020-09-22 16:24:21.633] [INFO]   Checking git for module: MMM-ArduPort
                    [2020-09-22 16:24:21.665] [INFO]   Checking git for module: MMM-TelegramBot
                    [2020-09-22 16:24:21.700] [INFO]   Checking git for module: MMM-Online-State
                    [2020-09-22 16:24:21.733] [INFO]   Checking git for module: MMM-RBB-Weather
                    [2020-09-22 16:24:21.772] [INFO]   Checking git for module: MMM-NowPlayingOnSpotify
                    [2020-09-22 16:24:21.810] [ERROR]  (node:1379) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
                    [2020-09-22 16:24:21.812] [ERROR]  (node:1379) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
                    [2020-09-22 16:24:21.956] [LOG]    MMM-RBB-Weather[22.9.2020, 16:24:21]: Fetch data for day "0" ...
                    [2020-09-22 16:24:21.999] [LOG]    { debug: 'SerialPort shell started...' }
                    [2020-09-22 16:24:22.014] [LOG]    undefined[MMM-ArduPort] SerialPort shell started...
                    [2020-09-22 16:24:22.016] [LOG]    { debug: 'Waiting Ardunio to connect on port...' }
                    [2020-09-22 16:24:22.018] [LOG]    undefined[MMM-ArduPort] Waiting Ardunio to connect on port...
                    [2020-09-22 16:24:22.019] [LOG]    { status: { name: 'connect', data: 'connected' } }
                    [2020-09-22 16:24:22.020] [LOG]    { name: 'connect', data: 'connected' }
                    [2020-09-22 16:24:22.026] [LOG]    { sensor: { name: 'DHT11', data: '0.0' } }
                    [2020-09-22 16:24:22.031] [LOG]    { sensor: { name: 'DHT11', data: '0.0' } }
                    [2020-09-22 16:24:22.359] [LOG]    { sensor: { name: 'DHT11', data: '0.0' } }
                    [2020-09-22 16:24:22.363] [LOG]    { sensor: { name: 'DHT11', data: '0.0' } }
                    [2020-09-22 16:24:22.731] [LOG]    Refreshed access token because it has expired. Expired at: 16:24:21 now is: 16:24:22
                    [2020-09-22 16:24:22.768] [LOG]    Refreshed access token because it has expired. Expired at: 17:24:22 now is: 16:24:22
                    [2020-09-22 16:24:22.870] [LOG]    MMM-RBB-Weather[22.9.2020, 16:24:22]: Data received, send to module ...
                    [2020-09-22 16:24:23.104] [INFO]   Calendar-Fetcher: Broadcasting 0 events.
                    [2020-09-22 16:24:23.341] [LOG]    { status: { name: 'setup', data: 'starting' } }
                    [2020-09-22 16:24:23.348] [LOG]    { name: 'setup', data: 'starting' }
                    [2020-09-22 16:24:23.723] [LOG]    { status: { name: 'setup', data: 'started' } }
                    [2020-09-22 16:24:23.727] [LOG]    { name: 'setup', data: 'started' }
                    [2020-09-22 16:24:23.731] [LOG]    { sensor: { name: 'DHT11', data: '0.0' } }
                    [2020-09-22 16:24:25.345] [LOG]    { sensor: { name: 'DHT11', data: '0.0' } }
                    [2020-09-22 16:24:27.353] [LOG]    { sensor: { name: 'DHT11', data: '0.0' } }
                    [2020-09-22 16:24:29.363] [LOG]    { sensor: { name: 'DHT11', data: '0.0' } }
                    [2020-09-22 16:24:31.374] [LOG]    { sensor: { name: 'DHT11', data: '0.0' } }
                    [2020-09-22 16:24:33.383] [LOG]    { sensor: { name: 'DHT11', data: '0.0' } }
                    
                    
                    S 1 Reply Last reply Reply Quote 0
                    • S Offline
                      sdetweil @Shinji0912
                      last edited by

                      @Shinji0912 ok, now we need to see the log from the browser

                      ctrl-shift-i on the mirror keyboard, select the tab labeled console, and then put port in the filter field

                      also set

                      developerMode:true, 
                      

                      in the config.js config section for the arduport module

                      there are a lot of messages available from the modulename.js

                      Sam

                      How to add modules

                      learning how to use browser developers window for css changes

                      S 1 Reply Last reply Reply Quote 0
                      • S Offline
                        Shinji0912 @sdetweil
                        last edited by

                        @sdetweil alt text
                        and
                        alt text

                        S 1 Reply Last reply Reply Quote 0
                        • 1
                        • 2
                        • 3
                        • 4
                        • 5
                        • 6
                        • 5 / 6
                        • First post
                          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