bonsoir je reprend le travail sur ce sujet nous avons travaillé sur le chauffage douche solaire qui est tiré d'ici et j'ai modifié pour remplacer la DS18 des panneaux solaire puisque j'en ai fait l'expérience elle est détruite au delà de 125 degrés par un thermocouple (reprise du système de douche solaire , en bricolant un peut j'ai un système qui fonctionne puisque j'ai réussi a supprimer les alertes thermocouple , mais maintenant j'ai un problème de retour T panneaux erroné , comment faire pour l'étalonner ?
les codes
;gestion chauffage solaire ; MM 15/06/25
;modif 13/06/25 : Tpanneau par thermocouple et liaison RS232
#picaxe 20M2
setfreq M16
symbol pano=C.7 ;Entrée T panneau
symbol selec=pinC.6 ;poussoir de sélection
symbol DSbalon=C.5 ;T balon
symbol DSjac=C.4 ;T jaccuzi
symbol DSpisc=C.3 ;T piscine
symbol DSser=C.2 ;T serre
symbol valid=pinC.0 ;poussoir de validation
symbol potar=B.5 ;pot de réglages consignes
symbol LCD=B.0 ;LCD 2004
symbol circBal=outpinB.1 ;circulateur balon
symbol circJac=outpinB.2 ;circulateur jaccuzi
symbol circPisc=outpinB.3 ;circulateur piscinne
symbol circSer=outpinB.4 ;circulateuur serre
symbol def =bit0
symbol Tpano =b1 ;valeur T° panneaux
symbol Tbalon =b2 ;ballon
symbol Tpisc =b3 ;piscine
symbol Tjac =b4 ;jacuzzi
symbol Tser =b5 ;serre
symbol Cbalon =b6 ;valeur consigne ballon
symbol Cjac =b7 ;jacuzzi
symbol Cpisc =b8 ;piscine
symbol Cser =b9 ;serre
symbol varb =b10 ;variable byte
symbol delt =b11 ;delte pan-balon
symbol Ident =b12 ;Identification RS232
symbol cpt =b13 ;compteur
symbol cumul =w13 ;somme temp
symbol baud =N2400_16
symbol baudT =T2400_16 ;idem LCD mais peut changer
dirsC=%0
dirsB=%00011111
pullup %1111111100000000
;****************************************
pause 500 ;temps iitialisation LCD
serout LCD, baud,(254,1)
serout LCD, baud,(254,130,"Pa Ba Ja Pi Se")
serout LCD, baud,(254,148,"C",254,192,"T",254,212,"P")
def=0:ident=123
read 0,Cjac,Cpisc,Cser ;lecture consignes enEEPROM
if Cjac=0 then
gosub consigne ; si EEPROM vide
else
serout LCD,baud,(254,158,#Cjac,254,162,#Cpisc,254,166,#Cser)
endif
do
cumul=0
for cpt=0 to 3
serin [20000,erreur],C.7,baudT,Tpano,def,ident ;reception Tpano,def,ident timeout 5s
cumul=cumul+Tpano
next
; if def <>0 then erreur
Tpano=cumul/4
readtemp DSbalon,Tbalon ;sur C.5
readtemp DSjac,Tjac ;sur C.4
readtemp DSpisc,Tpisc ;sur C.3
readtemp DSser,Tser ;sur C.2
;Tpano=85:Tbalon=75:Tjac=35:Tpisc=32:Tser=22 ;valeurs test
serout LCD, baud,(254,194,#Tpano," ",254,198,#Tbalon," ",254,202,#Tjac," ",254,206,#Tpisc," ",254,210,#Tser)
pause 200
if valid=0 then gosub consigne ;passage par consigne à la MST
gosub gescirc
loop
;*********************************************
consigne:
serout LCD,baud, (254,150," ",254,153,">",#delt," ") ;affichage chevron
do loop while valid=0 ;attente relachement valid
do
if selec=0 then jac ;si pous selection => étiquette pisc
loop while valid=1 ;si valid relaché, on tourve
do loop while valid=0 ;valid a été appuyé, on attend le relachement
do ;réglage Cjac
readadc potar, delt
delt= 90 *delt/255
serout LCD, baud,(254,153,"=",#delt," ") ;affichage = devant la valeur de Cjac
loop while valid=1 ;on tourne tant que valid est relaché
write 3,delt ;valid appuyé consigne en mémoire EEPROM
do loop while valid=0 ;attente relachement
jac:
do loop while selec=0 ;si selec appuyé, on attend le relachement
serout LCD,baud, (254,153," ",254,157,">",#Cjac," ") ;effacement "=" et chevron suivant
do
if selec=0 then pisc ;si pous selection => étiquette pisc
loop while valid=1 ;si valid relaché, on tourve
do loop while valid=0 ;valid a été appuyé, on attend le relachement
do ;réglage Cjac
readadc potar, Cjac
Cjac= 50 *Cjac/255
serout LCD, baud,(254,157,"=",#Cjac," ") ;affichage = devant la valeur de Cjac
loop while valid=1 ;on tourne tant que valid est relaché
write 0,Cjac ;valid appuyé consigne en mémoire EEPROM
do loop while valid=0 ;attente relachement
pisc:
do loop while selec=0 ;si selec appuyé, on attend le relachement
serout LCD,baud, (254,157," ",254,161,">",#Cpisc," ") ;effacement "=" et chevron suivant
do
if selec=0 then Ser
loop while valid=1
do loop while valid=0
do
readadc potar, Cpisc
Cpisc= 40 *Cpisc/255
serout LCD, baud,(254,161,"=",#Cpisc," ")
loop while valid=1
write 1, Cpisc
do loop while valid=0
Ser:
do loop while selec=0
serout LCD,baud, (254,161," ",254,165,">",#Cser)
do
if selec=0 then fin
loop while valid=1
do loop while valid=0
do
readadc potar, Cser
Cser= 20 *Cser/255 +10
serout LCD, baud,(254,165,"=",#Cser)
loop while valid=1
write 2, Cser
do loop while valid=0
fin:
serout LCD, baud,(254,165," ")
return
gescirc:
if Tbalon >=90 or Tbalon>= Tpano then
circBal=0
endif
varb=Tbalon+delt ;Temp ballon +5°C
if Tpano>varb then
circBal=1
else circBal=0
endif
serout LCD,baud,(254,218,#circBal) ;affichage val de circbal
if Tbalon>Tjac and Cjac> Tjac then
circJac= 1
endif
If Tjac>=Cjac or Tjac>=Tbalon then
circJac=0
endif
serout LCD,baud,(254,222,#circJac)
if Tser>=Cser or Tbalon<Tser or circJac=1 then
circSer=0
endif
if Tbalon>Tser and circJac=0 and Tser<Cser then
circser=1
endif
serout LCD,baud,(254,230,#circSer)
if Tbalon>Tpisc and circJac=0 and Tpisc< Cpisc then
circpisc=1
endif
if Tpisc>=Tbalon or Tpisc>=Cpisc or circJac=1 then
circpisc=0
endif
serout LCD,baud,(254,226,#circpisc)
return
erreur:
if def <> 0 then
serout LCD,baud,(254,148,"ERR THERMOC=>valid")
else
serout LCD,baud,(254,148,"ERR TEMPSMAX=>valid")
endif
do loop while valid=1 ;attente appui
do loop while valid=0 ;attente relachement
reset
et pour le thermocouple
;MESURE TMAX31855 RS232 19/06/25
;lecture thermocouple par MAX31855 MM 13/06/25
;La broche SO va prendre successivement la valeur de chaque bit du registre.
; scanné poids fort en tête
;moyenne sur 4 mesures
;transmission : temp, def, identifiant=123
#picaxe 08M2
#no_data
symbol CLK=C.1 ; pulse horloge
symbol CSB=C.2 ;demande lecture _____/
symbol SO=pinC.3 ;bit de donnée serial out
symbol def=bit0
symbol cpt=b1
symbol temp=b2
symbol cpt2=b3
symbol varw=w13 ;var temporaire
symbol cumul=w12
symbol temptherm=w11 ;tempé thermocouple
setfreq M4
symbol baud=T2400_4
symbol baudN=N2400_4
;*****************************
#macro spin(varw) ;macro SPIIN
varw = 0
for cpt = 1 to 16
varw=varw * 2 + SO ;décalage à gauche + SO (0 ou 1)
pulsout CLK,1 ;pulse horloge
next cpt
#endmacro
;************************************
pause 500
high CSB ;première conversion
Do
cumul=0
for cpt2 = 1 to 4
pause 200 ;200 ms
low CSB ;lecture registre
spin(temptherm) ;exécution macro 16 premiers bits (poid fort en tête
high CSB ;nouvelle conversion
;*****defaut **********************
def=temptherm//2 ;isol bit défaut
;**** temp thermocouple ******************************
temptherm=temptherm/4 ;suppression des 2 derniers bits
if temptherm>=$2000 then ;test 1er bit des 14 bits pour valeur négative
temptherm=0 ;fixé à 0 si négatif
endif
temptherm=temptherm/4 ;suppression des décimales-> val entière
temptherm=temptherm//256 ;valeur entière ; on garde les 8 derniers bits
temp=temptherm
cumul=cumul + temp
next cpt2
temp=cumul/4
;serout C.0, baudN,(254,148,#temp," ",#def," ",#123) ;liaison RS232
serout C.0, baud,(temp,def,123) ;liaison RS232 ²
loop