Community Forum
    • Blog
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    PitInfo 1.5 + Arduino Uno + LibTeleinfo + mode Standard

    Scheduled Pinned Locked Moved Ethernet Teleinfo
    4 Posts 2 Posters 2.1k Views
    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.
    • SbastienGa99566S Offline
      SbastienGa99566
      last edited by Charles

      Bonjour,

      J'ai acheté un PitInfo 1.5 que j'ai branché sur mon Arduino Uno et sur ma TIC afin d'exploiter les données de mon Linky en mode standard.
      Je reçois bien des données mais elles semblent incohérentes / mal interprété par la librairie LibTeleInfo.
      J'ai suivi les infos du site https://hallard.me/pitinfov12-light/, j'ai connecté le TX du pitinfo sur le port 3.
      Depuis Arduino IDE, je me suis appuyé sur l'exemple de LibTeleInfo Arduino_Softserial_Blink.
      Dans mon serial monitor, il m'affiche que les frame sont toujours les mêmes.
      quand j'affiche les Frames, j'obtiens cela :

      107874798582709484893813107874798582704349948489661310807479858270434994848484852484849324854484852484850325050484852484849327879788584737669327879788584737669327879788584737669327879788584737669327879788584737669327879788584737669327879788584737669327879788584737669946133210656883679485149575554485051575150958131086847367948509741310686584699725053485148544954484848509958131078718470932323232328469778079323232323232970131076846582709323232327280323266766985323232329431310696583849485449525154535349946131069658370484994849575355505755499751310696583704850948515155544856574897113106965837048519484850525656485654972131069658370485294848515355525250579711310696583704853948484952565049515095913106965837048549484848535356485251964131069658370485594848484848484848489401310696583704856948484848484848484894113106965837048579484848484848484213106965837049484848484848489341310696583684894849535054574969131069658368509505656495651965106965836848519485649494957968106965836848529485749495349962107382778349948485048131073828350948484713107382775194849949108582778349950519641085827783509515066131085827751951539701080826970949539131080677980953995131083738384948485454988108373788384834994848554991310837378838350484853577013108373788384519485051549131083776588837897253484854525148519485250579131083776583784995053514854485054569515056913108377658378972504851484950505255950564995210837765888351950535148544851504848485355514413108377658883784597253485153485150524948575251993108377658883784549972534851534851554894852485677131083778883504597250485153494955539484855579013108377658883514549725048514848515052948535648913106767657895053485154494848489485452913106767658345497250535148545351484894957569131085777949950534848545448484895149913108577795097250485154494848489505194610857779899725348515449484848950539491083847169948516567484991310778349980653268693232323232323277838371693232323232323291310808277957514849575553565049913108269766573948489661078846582704850979107874798570948938107874798570439489661080747985827043499484852484932484848484850505048524849327878858473693279788473693278788584766978797885847669787978847376327879788473693279788473766978797884736991332106568836794851495755544850515751509581310868473679485097413106865846997250534851485449544848485199591310787184709323232323284697780793232323232329701310768465827093232323272803232667669853232323294313106965838494854495251545353499461310696583704849948495753555057554997513106965837048509485151555448565748971131069658370485194848505256564856549721310696583704852948485153555252505797113106965837048539484952564951505913106965837048484853565251641310696583705594848484848401310696583704856948484848489411069658370579484848484848913106965837094848484848483413106965836894953505457499691069658368485049564951496513106965834851948564954575696810696583684848574949514996210738277839509131073827783948489131073827783948499131085827749519641085827783505051966108582778351951537013108082709495369131080677985539513108373788483955549131083737883844994852569131083737883845094848539701083737883848394857701310837765888372534848545251484857505791310837765884995053514848515054569485691310837765837850725053514849505052554850565691083776583789725348485453515048953515513108377658883784597250484853515350529485299310837765888378494995053484848515548948505256913108377658883785049950534848535353951485791310837765887851499725348515348515052494853564879131067676583789505348485454484848545291310676765784549725048515449534848948499371085777989499505351485454484895051943108577895072505351484954484895051913108577519505351484954484895053913108384716994849516752489821310778349965833269323232323232323269836571693232323232329608277495748524957555352509611310826973834848966131078848270485091078747982709489131078747982704394896610807479827049948484852484948544852485032504848327878857376327879787669787985847369327878857376327879787369327978847369327879788473693279788584766946133
      2s	FRAME -> SAME AS PREVIOUS
      DATA
      0 - =
      21065688367948514957555448505157515095813108684736794850974131068658469972505348514854495448484853996113107871847093232323232846977807932323232323297013107684658270932323232728032326676698532323232943131069658384948544952515453535094713106965837048499484957535550575549975131069658370485094851515554485657499721310696583704851948485052565648565497213106965837048529484851535552525057971131069658370485394848495256504950913106965837054484853534852964131069658370489484848484891310696583705694848484848484113106570489484848484848942106965834948484848484893410696583684994852545757969106965836848509565649514965131069658368514848494957968131069656848948485749495150631310738277834994850913107382778394848947107382778351948494913108549950499131085827750950511310858277519505391310808269495391310806779859499510837378838483484856569901083737883848348535396813108378848394848535770108378838451948505168108377658883787253484854525148519485250967131083658883789725348515448505456948566013108377658378972534851545050505294850564952131083778883519505351484853515048948534413108377658883784997253484853515350499525193131083776588837845497250485148485155489525691310837765888378504995053514853564994848559901083776588837845497250485148535153948545697910676765837895053514849544848489575269131067678378499725348485453514848948494956371310857789497250535148495448484895149913108577798950972504851544948484895051985798997253485154494848489515349131083847169495167524991310778349980836869323232323232776983657169323232323232913108082779495148524954535652499131082697665484866131078848270950910787479858294893810787479858243494848661310807485824349484848483248544852485032504852484879788473763278788576327878857376693278788573766932797885737632787885737669787973693279788473769463
      

      Je vous joins mon code source.
      Est-ce qu'il y a quelque chose à modifier pour que le mode standard fonctionne ?

      Merci !
      Sébastien

      
      #include <string.h>
      #include <SoftwareSerial.h>
      #include "LibTeleinfo.h"
      
      /****************************** Defines *******************************/
      
      /****************************** Constants *****************************/
      #define TIC_RX_PIN      3
      #define TIC_TX_PIN      4
      
      #define LEDPIN 13
      
      // Pour clignotement LED asynchrone
      unsigned long blinkLed  = 0;
      uint8_t       blinkDelay= 0;
      
      const char HEURES_PLEINES_JOUR_ROUGE[8] = "HPJR";
      const char HEURES_CREUSES_JOUR_ROUGE[8] = "HCJR";
      const char HEURES_PLEINES_JOUR_BLANC[8] = "HPJW";
      const char HEURES_CREUSES_JOUR_BLANC[8] = "HCJW";
      const char HEURES_PLEINES_JOUR_BLEU[8]  = "HPJB";
      const char HEURES_CREUSES_JOUR_BLEU[8]  = "HCJB";
      
      const char PERIODE_TARIFAIRE[8] = "NGTF";
      
      const int PIN_RELAIS_CIRCULATEUR_RADIATEURS = 5;
      const int PIN_RELAIS_PAC = 6;
      const int PIN_RELAIS_CIRCULATEUR_PLANCHER_CHAUFFANT = 7;
      
      /************************* Global variables ***************************/
      
      
      
      
      /************************* Object instanciation ***********************/
      SoftwareSerial Serial10(TIC_RX_PIN, TIC_TX_PIN);
      TInfo tinfo;
      
      /****************************  Routines  ******************************/
      void activerChauffage()
      {
        Serial.println(F("ACTIVATION chauffage !"));
        digitalWrite(PIN_RELAIS_CIRCULATEUR_RADIATEURS, LOW);
        digitalWrite(PIN_RELAIS_CIRCULATEUR_PLANCHER_CHAUFFANT, LOW);
        digitalWrite(PIN_RELAIS_PAC, LOW);
      }
      
      void desactiverChauffage()
      {
        Serial.println(F("DESACTIVATION chauffage !"));
        digitalWrite(PIN_RELAIS_CIRCULATEUR_RADIATEURS, HIGH);
        digitalWrite(PIN_RELAIS_CIRCULATEUR_PLANCHER_CHAUFFANT, HIGH);
        digitalWrite(PIN_RELAIS_PAC, HIGH);
      }
      
       /* ======================================================================
      Function: printUptime 
      Purpose : print pseudo uptime value
      Input   : -
      Output  : - 
      Comments: compteur de secondes basique sans controle de dépassement
                En plus SoftwareSerial rend le compteur de millis() totalement
                A la rue, donc la precision de ce compteur de seconde n'est
                pas fiable du tout, dont acte !!!
      ====================================================================== */
      void printUptime(void)
      {
        Serial.print(millis()/1000);
        Serial.print(F("s\t"));
      }
      
      /******************************  Setup  *******************************/
      void setup()
        {
          // Configure Teleinfo Soft serial 
          Serial.println(F("Set Baud"));
          Serial.begin(115200);
          Serial.print(F("TIC RX = "));
          Serial.println(TIC_RX_PIN);
          Serial10.begin(9600);
      
          // Init teleinfo
          tinfo.init();
      
          // Attacher les callbacks dont nous avons besoin
          tinfo.attachADPS(ADPSCallback);
          tinfo.attachData(DataCallback);
          tinfo.attachNewFrame(NewFrame);
          tinfo.attachUpdatedFrame(UpdatedFrame);
      
          pinMode(PIN_RELAIS_CIRCULATEUR_RADIATEURS, OUTPUT);
          pinMode(PIN_RELAIS_CIRCULATEUR_PLANCHER_CHAUFFANT, OUTPUT);
          pinMode(PIN_RELAIS_PAC, OUTPUT);
      
          printUptime();
          Serial.println(F("PROGRAM STARTED"));
        }
      
      /****************************** Processing ****************************/
      void DataCallback(ValueList * me, uint8_t  flags)
      {
        Serial.println(F(""));
        printUptime();
      
        Serial.println(F("New data"));  
        if (flags & TINFO_FLAGS_ADDED) 
          Serial.print(F("NEW -> "));
      
        if (flags & TINFO_FLAGS_UPDATED)
          Serial.print(F("MAJ -> "));
      
        // Display values
        Serial.println(F("DATA"));
        Serial.print(me->ts);
        Serial.print(" - ");
        Serial.print(me->name);
        Serial.print("=");
        Serial.println(me->value);
      
        if (strcmp(me->name, PERIODE_TARIFAIRE) == 0)
        {
          Serial.print(F("Période tarifaire = "));
          Serial.println(me->value);
          if (strcmp(me->value, HEURES_PLEINES_JOUR_ROUGE) == 0)
            desactiverChauffage();
          else
            activerChauffage();
        }
        if ((strcmp(me->name, "SINSTS1") == 0) || (strcmp(me->name, "SINSTS2") == 0) || (strcmp(me->name, "SINSTS3") == 0))
        {
          Serial.print(F("Puissance app. Instantanée soutirée ("));
          Serial.print(me->name);
          Serial.print(F(") = "));
          Serial.println(me->value);
        }
      }
      
      /* ======================================================================
      Function: ADPSCallback 
      Purpose : called by library when we detected a ADPS on any phased
      Input   : phase number 
                  0 for ADPS (monophase)
                  1 for ADIR1 triphase
                  2 for ADIR2 triphase
                  3 for ADIR3 triphase
      Output  : - 
      Comments: should have been initialised in the main sketch with a
                tinfo.attachADPSCallback(ADPSCallback())
      ====================================================================== */
      void ADPSCallback(uint8_t phase)
      {
        Serial.println(F(""));
        printUptime();
      
        // Monophasé
        if (phase == 0 ) {
          Serial.println(F("ADPS"));
        }
        else {
          Serial.print(F("ADPS PHASE #"));
          Serial.println('0' + phase);
        }
      }
      
      /* ======================================================================
      Function: NewFrame 
      Purpose : callback when we received a complete teleinfo frame
      Input   : linked list pointer on the concerned data
      Output  : - 
      Comments: -
      ====================================================================== */
      void NewFrame(ValueList * me)
      {
        Serial.println(F(""));
        // Start short led blink
        digitalWrite(LEDPIN, HIGH);
        blinkLed = millis();
        blinkDelay = 50; // 50ms
      
        printUptime();
        Serial.println(F("FRAME -> SAME AS PREVIOUS"));
        // Display values
        Serial.println(F("DATA"));
        Serial.print(me->ts);
        Serial.print(" - ");
        Serial.print(me->name);
        Serial.print("=");
        Serial.println(me->value);
      }
      
      /* ======================================================================
      Function: UpdatedFrame 
      Purpose : callback when we received a complete teleinfo frame
      Input   : linked list pointer on the concerned data
      Output  : - 
      Comments: it's called only if one data in the frame is different than
                the previous frame
      ====================================================================== */
      void UpdatedFrame(ValueList * me)
      {
        Serial.println(F(""));
        // Start long led blink
        digitalWrite(LEDPIN, HIGH);
        blinkLed = millis();
        blinkDelay = 100; // 100ms
      
        printUptime();
        Serial.println(F("FRAME -> UPDATED"));
      }
      
      /******************************* Loop *********************************/
      void loop()
      {
        static char c;
       
        // On a reçu un caractère ?
        if ( Serial10.available() )
        {
          c = Serial10.read() ;
          Serial.print(c & 0x7F);
      
          // Gerer
          tinfo.process(c);
        }
      }
      
      

      Pilotage_SGA.ino.txt

      CharlesC 1 Reply Last reply Reply Quote
      • CharlesC Offline
        Charles @SbastienGa99566
        last edited by Charles

        @SbastienGa99566
        je crains que le soft serial ait beaucoup de mal à 9600 bauds sur un uno.
        Pourriez vous essayer juste avec une vraie UART série, mais comme le UNO n'en a qu'une de mémoire impossible d'avoir la teleinfo et le Serial en même temps.

        Visiblement il affiche le char en hexa, curieux

        SbastienGa99566S 2 Replies Last reply Reply Quote
        • SbastienGa99566S Offline
          SbastienGa99566 @Charles
          last edited by

          @Charles
          Merci pour votre réponse.
          Ca fonctionnait bien avec le mode historique mais c'était effectivement en 1200baud...

          1 Reply Last reply Reply Quote
          • SbastienGa99566S Offline
            SbastienGa99566 @Charles
            last edited by

            @Charles J'ai testé sur le port 0/RX et j'obtiens la même chose.

            1 Reply Last reply Reply Quote
            • First post
              Last post

            3

            Online

            5.7k

            Users

            534

            Topics

            5.0k

            Posts

            Top Topics

            • Denky 4 - Domoticz - Triphasé -
              Nicolas BernaertsN
              Nicolas Bernaerts
              0
              7
              249

            • Denky D4 et Linky Standard TInfo Rx Non Configuré
              CharlesC
              Charles
              0
              5
              282

            • CC1101
              CharlesC
              Charles
              0
              2
              117

            Popular Tags

            teleinfo
            24 topics
            arduino
            19 topics
            remora
            16 topics
            esp8266
            10 topics
            arduipi
            10 topics
            wifinfo
            7 topics
            raspberry
            7 topics
            broadcast
            7 topics
            Copyright © 2022 Charles-Henri Hallard | Return to blog page | Powered by NodeBB