Ci-dessous le code sur le recepteur NANO :
// ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
// Linky-TIC.ino
#include <ELECHOUSE_CC1101_RCS_DRV.h>
//#include <SoftwareSerial.h>
//const byte TELEINFO_PIN = 8; //Connexion TELEINFO
const byte TX_PIN = 6; //emetteur 433 MHZ
const unsigned long TIME = 488;
const unsigned long TWOTIME = TIME2;
#define SEND_HIGH() digitalWrite(TX_PIN, HIGH)
#define SEND_LOW() digitalWrite(TX_PIN, LOW)
byte OregonMessageBuffer[13]; // OWL180
//********************************************************
char HHPHC;
int ISOUSC; // intensité souscrite
int IINST; // intensité instantanée en A
int IMAX; // intensité maxi en A
int PAPP; // puissance apparente en VA
int calt;
int calt2;
unsigned long HCHC; // compteur Heures Creuses en W
unsigned long HCHP; // compteur Heures Pleines en W
String PTEC; // Régime actuel : HPJB, HCJB, HPJW, HCJW, HPJR, HCJR
String ADCO; // adresse compteur
String OPTARIF; // option tarifaire
String MOTDETAT; // status word
String pgmVersion; // TeleInfo program version
boolean ethernetIsOK;
boolean teleInfoReceived;
char chksum(char *buff, uint8_t len);
char message;
boolean handleBuffer(char bufferTeleinfo, int sequenceNumnber);
char version[17] = "TeleInfo V 1.00";
unsigned long PAPP_arrondi; // PAPP497/500/16 arrondi
unsigned long chksum_CM180;
unsigned long long HCP;
inline void sendZero(void) {
SEND_LOW();
delayMicroseconds(TIME);
SEND_HIGH();
delayMicroseconds(TIME);
}
inline void sendOne(void) {
SEND_HIGH();
delayMicroseconds(TIME);
SEND_LOW();
delayMicroseconds(TIME);
}
void sendData(byte data, byte size) {
for(byte i = 0; i < size; ++i) {
(bitRead(data, 0)) ? sendOne() : sendZero();*
_ (bitRead(data*, 1)) ? sendOne() : sendZero();_
_ (bitRead(data, 2)) ? sendOne() : sendZero();
(bitRead(data, 3)) ? sendOne() : sendZero();
(bitRead(data, 4)) ? sendOne() : sendZero();
(bitRead(data, 5)) ? sendOne() : sendZero();
(bitRead(data, 6)) ? sendOne() : sendZero();
(bitRead(data, 7)) ? sendOne() : sendZero();
}
}
inline void sendPreamble(void) {
for(byte i = 0; i < 10; ++i) //OWL CM180
{
sendOne();
}
}
inline void sendPostamble(void) {
for(byte i = 0; i <4 ; ++i) //OWL CM180
{
sendZero() ;
}_
SEND_LOW();
_ delayMicroseconds(TIME);
}
void sendOregon(byte *data, byte size) {
sendPreamble();
sendData(data,size);
sendPostamble();
}
void encodeur_OWL_CM180() {
OregonMessageBuffer[0] =0x62;
OregonMessageBuffer[1] =0x80;
//OregonMessageBuffer[2] =0x7D;
PAPP=int(PAPP0.9941);
* calt=PAPP % 256;
calt=calt-(PAPP % 16);
OregonMessageBuffer[3] =calt,HEX;
calt=int(PAPP/256);
calt=calt % 256;
OregonMessageBuffer[4] =calt,HEX;
calt=int(PAPP/256/256);
OregonMessageBuffer[5] =calt,HEX;
//HCP=(HCHC223666LL)/1000LL;
* OregonMessageBuffer[6] =(HCP>>4)&0xFF;
OregonMessageBuffer[7] =(HCP>>12)&0xFF; // ST sert total conso*
* OregonMessageBuffer[8] =(HCP>>20)&0xFF; // UV sert total conso*
* OregonMessageBuffer[9] =(HCP>>28)&0xFF;
OregonMessageBuffer[10] =(HCP>>36)&0xFF;_
chksum_CM180= 0;
_ for (byte i=0; i<11; i++) {
chksum_CM180 += long(OregonMessageBuffer&0x0F) + long(OregonMessageBuffer>>4);
}_
chksum_CM180 -=2;
OregonMessageBuffer[11] =((chksum_CM180&0x0F)<<4) + ((chksum_CM180>>8)&0x0F);
calt2=int(chksum_CM180 % 16)16+int((chksum_CM180)/16);
_ OregonMessageBuffer[12] =calt2,HEX;
* //OregonMessageBuffer[12] =(int(chksum_CM180>>4)&0x0F); //C = 0 mais inutilisé*
}
//******************************************************************
void setup() {
Serial.begin(1200);_
//Serial.begin(1200,SERIAL_7E1);
ELECHOUSE_cc1101.setMHZ(433.92);
ELECHOUSE_cc1101.Init(PA10);
ELECHOUSE_cc1101.SetRx();
pinMode(TX_PIN, OUTPUT);
SEND_LOW();
_}
String info="";
String libelle;
unsigned long millis();
unsigned long tempo;
void loop() {
if (Serial.available()>0) {
message=Serial.read()& 0x6F;
Serial.print(message);_
* if (message==0x0A) {*
* if (info.substring(1,5)=="PAPP") {*
* libelle=info.substring(6,12);*
* PAPP=libelle.toInt();*
* Serial.print("PAPP="); *
* Serial.println(PAPP); *
* }*
* if (info.substring(1,5)=="HCHC") {*
* libelle=info.substring(6,16);*
* HCHC=libelle.toInt();*
* Serial.print("HCHC="); *
* Serial.println(HCHC); *
* }*
* if (info.substring(1,5)=="HCHP") {*
* libelle=info.substring(6,16);*
* HCHP=libelle.toInt();*
* Serial.print("HCHP="); *
* Serial.println(HCHP); *
* }*
* if (info.substring(1,5)=="BASE") {*
* libelle=info.substring(6,16);*
* HCHC=libelle.toInt();*
* Serial.print("HCHC="); *
* Serial.println(HCHC); *
* }*
* info="";*
* }*
* info=info+message;*
* tempo=millis();*
* tempo=int(tempo/1000) % 55;*
* delay(5);*
* if (tempo < 10) {*
* OregonMessageBuffer[2] =0x6D;*
_ HCP=(HCHC223666LL)/1000LL;_
encodeur_OWL_CM180();
_ sendOregon(OregonMessageBuffer, sizeof(OregonMessageBuffer));
delay(5000);
OregonMessageBuffer[2] =0x6C;
HCP=(HCHP223666LL)/1000LL;
* encodeur_OWL_CM180();*
* sendOregon(OregonMessageBuffer, sizeof(OregonMessageBuffer));
delay(5000);
}
}
}*_
J'ai une photo du montage mais je ne sais pas comment l'envoyer....