Bonjour,
je me suis fabriquer un System de pompe de dosage pour mon aquarium.
au niveau dosage tout fonctionne correctement mais j'ai un problème avec mon horloge ...
enfaîte elle se dérègle et prend environ 1.30 minute de retard par semaine.
j'ai testé avec 3 module ds1307 venant de 2 fournisseur différent mais également sur 2 arduino différent.
j'ai aussi tester les ds1307 sur un autre projet et la ... il ne se décale pas ...
J'en suis donc arriver a la conclusion que ça devait venir de mon code
quelqu’un peut t'il m'aider pour trouver d'ou vient se phénomène svp
merci
#include "AFMotor.h"
#include "DS1307.h"
#include "Wire.h"
AF_DCMotor motor1(1, MOTOR12_64KHZ); // create motor #2, 64KHz pwm
AF_DCMotor motor2(2, MOTOR12_64KHZ); // create motor #2, 64KHz pwm
AF_DCMotor motor3(3, MOTOR12_64KHZ); // create motor #2, 64KHz pwm
AF_DCMotor motor4(4, MOTOR12_64KHZ); // create motor #2, 64KHz pwm
int seconde;
int minut;
int heure;
int jour;
int temps;
void setup() {
/*
RTC.stop();
RTC.set(DS1307_SEC,0); //réglage secondes
RTC.set(DS1307_MIN,22); //réglage minutes
RTC.set(DS1307_HR,11); //réglage heures
RTC.set(DS1307_DOW,4); //réglage jour de la semaine
RTC.set(DS1307_DATE,15); //réglage date
RTC.set(DS1307_MTH,11); //réglage mois
RTC.set(DS1307_YR,12); //réglage année
RTC.start();
*/
Serial.begin(9600); // set up Serial library at 9600 bps
motor1.setSpeed(111); // set the speed
motor2.setSpeed(111);
motor3.setSpeed(111);
motor4.setSpeed(111);
}
void loop() {
heure = RTC.get(DS1307_HR,true);
minut = RTC.get(DS1307_MIN,true);
seconde = RTC.get(DS1307_SEC,true);
temps = (heure*100) + minut;
/*
************ dosage pour produit tridacna *****************
dosage des produit par litres.
CA/KH en poudre
OLIGO liquide concentré (50ml=500ml)
bouteille 1 (CA + OLIGO 1 + OLIGO 2) :
1 litre eau osmose + 70g de CA/KH 1 + 10ml OLIGO 1 + 10ml OLIGO 2.
bouteille 2 (KH + OLIG 3) :
1 litre eau osmose + 85g de CA/KH 2 + 10ml OLIGO 3.
BOUTEILLE 3 ( SEL SANS CHLORURE DE SODIUM + MAGNESIUM) :
0.75 litre eau osmose + 0.25 litres magnesium 2% + 27g de CA/KH 3.
************ dosage phyto et zoo plancton *****************
produit utilisé :
seachem Phytoplancton Reef (recommandé 0.35ml / J max)
Brightwell Aquatics Zooplanktos s ( recommandé 1.25ml / J max)
melange des solution :
75ml de seachem Phytoplancton Reef + 250ml de Brightwell Aquatics Zooplanktos s
*/
if ((temps == 700) && (seconde == 10)){
motor4.run(FORWARD); // CA/KH 1 (CALCIUM) + OLIGO 1 et 2
delay(9200);
motor4.run(RELEASE);
}
else if ((temps == 1000) && (seconde == 10)){
motor4.run(FORWARD); // CA/KH 1 (CALCIUM) + OLIGO 1 et 2
delay(9200);
motor4.run(RELEASE);
}
else if ((temps == 1300) && (seconde == 10)){
motor4.run(FORWARD); // CA/KH 1 (CALCIUM) + OLIGO 1 et 2
delay(9200);
motor4.run(RELEASE);
}
else if ((temps == 1600) && (seconde == 10)){
motor4.run(FORWARD); // CA/KH 1 (CALCIUM) + OLIGO 1 et 2
delay(9200);
motor4.run(RELEASE);
}
else if ((temps == 1900) && (seconde == 10)){
motor4.run(FORWARD); // CA/KH 1 (CALCIUM) + OLIGO 1 et 2
delay(9200);
motor4.run(RELEASE);
}
if ((temps == 800) && (seconde == 10)){
motor3.run(FORWARD); // CA/KH 2 ( KH )+ OLIGO 3
delay(4600);
motor3.run(RELEASE);
}
else if ((temps == 1100) && (seconde == 10)){
motor3.run(FORWARD); // CA/KH 2 ( KH )+ OLIGO 3
delay(4600);
motor3.run(RELEASE);
}
else if ((temps == 1400) && (seconde == 10)){
motor3.run(FORWARD); // CA/KH 2 ( KH )+ OLIGO 3
delay(4600);
motor3.run(RELEASE);
}
else if ((temps == 1700) && (seconde == 10)){
motor3.run(FORWARD); // CA/KH 2 ( KH )+ OLIGO 3
delay(4600);
motor3.run(RELEASE);
}
else if ((temps == 2000) && (seconde == 10)){
motor3.run(FORWARD); // CA/KH 2 ( KH )+ OLIGO 3
delay(4600);
motor3.run(RELEASE);
}
if ((temps == 900) && (seconde == 10)){
motor2.run(FORWARD); // CA/KH 3 ( SEL SANS CHLORURE DE SODIUM ) + MAGNESIUM 2%
delay(10400);
motor2.run(RELEASE);
}
else if ((temps == 1200) && (seconde == 10)){
motor2.run(FORWARD); // CA/KH 3 ( SEL SANS CHLORURE DE SODIUM ) + MAGNESIUM 2%
delay(10400);
motor2.run(RELEASE);
}
else if ((temps == 1500) && (seconde == 10)){
motor2.run(FORWARD); // CA/KH 3 ( SEL SANS CHLORURE DE SODIUM ) + MAGNESIUM 2%
delay(10400);
motor2.run(RELEASE);
}
else if ((temps == 1800) && (seconde == 10)){
motor2.run(FORWARD); // CA/KH 3 ( SEL SANS CHLORURE DE SODIUM ) + MAGNESIUM 2%
delay(10400);
motor2.run(RELEASE);
}
else if ((temps == 2100) && (seconde == 10)){
motor2.run(FORWARD); // CA/KH 3 ( SEL SANS CHLORURE DE SODIUM ) + MAGNESIUM 2%
delay(10400);
motor2.run(RELEASE);
}
if ((temps == 2130) && (seconde == 10)){
motor1.run(FORWARD); // PHYTO / ZOO PLANCTON dosage MAX 1.5ml / J
delay(2000);
motor1.run(RELEASE);
}
}