Hardware components | ||||||
![]() |
| × | 1 | |||
![]() |
| × | 1 | |||
![]() |
| × | 3 | |||
![]() |
| × | 3 | |||
![]() |
| × | 2 | |||
Hand tools and fabrication machines | ||||||
![]() |
|
In order to create a solar parabola tracker, we wanted to create a mini solar tracker in the first place.
This device is working thanks to 3 photoresistor and 2 servo-motors.
// 29/07/2017 - Programme C - Tracker solaire - Carte Arduino ( UNO )
// Ce programme a pour objectif de :
// - Traiter les informations apportés par les photorésistances
// - Gérer la rotation et l'inclinaison du module pour suivre une source lumineuse
// Programme réalisé par Techno_Fabrik
//********************BIBLIOTHEQUES****************************
// bibliothèque permettant d'utiliser les commandes pour servomoteurs facilement
#include <Servo.h>
//********************DECLARATIONS****************************
float photo_r_0,photo_r_1,photo_r_2; // valeur des photorésisances
int servo1=6; // commande du premier servo
int servo2=7;
int angle_rot=90,angle_inc=90; // angle des servos
Servo moteur_rotation;
Servo moteur_inclinaison;
//*************************INITIALISATION **********************
void setup() {
moteur_rotation.attach(servo1); // on relie l'obtet au pin de commande
moteur_inclinaison.attach(servo2);// on relie l'objet au pin de commande
Serial.begin(9600);
delay(2000);
}
//*************************************** BOUCLE ***************************
void loop() {
while ( (angle_rot > 10 )&&(angle_rot< 170) && (angle_inc>10)&&(angle_inc<170)) // sécurité pour les servos
{
photo_r_0=analogRead(A0);Serial.print("R_0 : ");Serial.println(photo_r_0); // entrée analogique 8 bits = 1024 valeurs = 0 à 5V
photo_r_1=analogRead(A1);Serial.print("R_1 : ");Serial.println(photo_r_1);
photo_r_2=analogRead(A2);Serial.print("R_2 : ");Serial.println(photo_r_2);
if ( photo_r_0<photo_r_1-3) // selon la valeur des photorésistances, on va moduler l'angle des servomoteurs
{
angle_rot=angle_rot-1;
moteur_rotation.write(angle_rot);
}
else if (photo_r_0>photo_r_1+3)
{
angle_rot=angle_rot+1;
moteur_rotation.write(angle_rot);
}
if (photo_r_2>photo_r_1+3)
{
angle_inc=angle_inc-1;
moteur_inclinaison.write(angle_inc);
}
else if (photo_r_2<photo_r_1-3)
{
angle_inc=angle_inc+1;
moteur_inclinaison.write(angle_inc);
}
}
Serial.println(" ANGLE SERVO MAXIMUM ");
}
Comments