Components and supplies
Resistor 330 ohm
LDR, 5 Mohm
Arduino UNO
Mini Solar Panel
SG90 Micro-servo motor
Rotary potentiometer (generic)
Pushbutton Switch, Pushbutton
Tools and machines
PLX-DAQ
Apps and platforms
Arduino IDE
Project description
Code
Embedded Software os solar tracker test bench
arduino
Embedded Software os solar tracker test bench
arduino
Downloadable files
Electronic circuit of the solar tracker with manual and automatic modes
Electronic circuit of the solar tracker with manual and automatic modes
Comments
Only logged in users can leave comments
ghostdemus
7 months ago
My code works, but it is in Portuguese #include <Servo.h> // Inicialização de variáveis int modo = 0; // 0 para manual, 1 para automático int eixo = 0; // 0 para esquerda-direita, 1 para cima-baixo int estadoBotaoModo = 0; int estadoBotaoEixo = 0; int estadoBotaoAnteriorModo = 0; int estadoBotaoAnteriorEixo = 0; // Definição dos pinos dos LDRs int ldrSuperiorDireito = A0; int ldrSuperiorEsquerdo = A1; int ldrInferiorDireito = A2; int ldrInferiorEsquerdo = A3; // Leituras dos LDRs int superiorEsquerdo = 0; int superiorDireito = 0; int inferiorEsquerdo = 0; int inferiorDireito = 0; // Declaração dos dois servos Servo servoCimaBaixo; Servo servoEsquerdaDireita; int valorLimite = 10; // Sensibilidade da medição void setup() { Serial.begin(9600); Serial.println("CLEARDATA"); Serial.println("LABEL,t,voltage,current,power,Mode"); pinMode(12, INPUT_PULLUP); // Botão de Modo (com pull-up interno) pinMode(11, INPUT_PULLUP); // Botão de Eixo (com pull-up interno) pinMode(A4, INPUT); // Potenciômetro para controle manual servoCimaBaixo.attach(5); // Servo para movimento cima-baixo servoEsquerdaDireita.attach(6); // Servo para movimento esquerda-direita Serial.println("Setup completo"); } void loop() { float volt = analogRead(A5) * 5.0 / 1023; float tensao = 2 * volt; // Tensão=(R1/(R1+R2))*Tensão, R1=R2=10Ohms => tensao=2*volt float corrente = tensao / 20; // I=tensao/(R1+R2) float potencia = tensao * corrente; Serial.print("DATA,TIME,"); // Comando PLX-DAQ Serial.print(tensao); Serial.print(","); Serial.print(corrente); Serial.print(","); Serial.print(potencia); Serial.print(","); // Tratamento do botão de modo estadoBotaoModo = digitalRead(12); if (estadoBotaoModo != estadoBotaoAnteriorModo) { if (estadoBotaoModo == LOW) { // LOW porque o pull-up inverte a lógica modo = 1 - modo; // Alterna o modo entre 0 e 1 Serial.print("Modo alterado para: "); Serial.println(modo == 0 ? "Manual" : "Automático"); } } estadoBotaoAnteriorModo = estadoBotaoModo; delay(50); // Atraso para debouncing if (modo == 0) { Serial.println('M'); rastreadorSolarManual(); } else { Serial.println('A'); rastreadorSolarAutomatico(); } } void rastreadorSolarAutomatico() { // Captura dos valores analógicos de cada LDR superiorDireito = analogRead(ldrSuperiorDireito); superiorEsquerdo = analogRead(ldrSuperiorEsquerdo); inferiorDireito = analogRead(ldrInferiorDireito); inferiorEsquerdo = analogRead(ldrInferiorEsquerdo); // Calculando a média int mediaSuperior = (superiorDireito + superiorEsquerdo) / 2; int mediaInferior = (inferiorDireito + inferiorEsquerdo) / 2; int mediaEsquerda = (superiorEsquerdo + inferiorEsquerdo) / 2; int mediaDireita = (superiorDireito + inferiorDireito) / 2; // Calculando as diferenças int diferencaElevacao = mediaSuperior - mediaInferior; int diferencaAzimute = mediaDireita - mediaEsquerda; // Movimento esquerda-direita do rastreador solar if (abs(diferencaAzimute) >= valorLimite) { if (diferencaAzimute > 0 && servoEsquerdaDireita.read() < 180) { servoEsquerdaDireita.write(servoEsquerdaDireita.read() + 2); } if (diferencaAzimute < 0 && servoEsquerdaDireita.read() > 0) { servoEsquerdaDireita.write(servoEsquerdaDireita.read() - 2); } } // Movimento cima-baixo do rastreador solar if (abs(diferencaElevacao) >= valorLimite) { if (diferencaElevacao > 0 && servoCimaBaixo.read() < 180) { servoCimaBaixo.write(servoCimaBaixo.read() + 2); } if (diferencaElevacao < 0 && servoCimaBaixo.read() > 0) { servoCimaBaixo.write(servoCimaBaixo.read() - 2); } } } void rastreadorSolarManual() { // Tratamento do botão de eixo estadoBotaoEixo = digitalRead(11); if (estadoBotaoEixo != estadoBotaoAnteriorEixo) { if (estadoBotaoEixo == LOW) { // LOW porque o pull-up inverte a lógica eixo = 1 - eixo; // Alterna o eixo entre 0 e 1 Serial.print("Eixo alterado para: "); Serial.println(eixo == 0 ? "Esquerda-Direita" : "Cima-Baixo"); } } estadoBotaoAnteriorEixo = estadoBotaoEixo; delay(50); // Atraso para debouncing if (eixo == 0) { // Controle esquerda-direita int valorPot = analogRead(A4); int posicaoServo = map(valorPot, 0, 1023, 0, 180); servoEsquerdaDireita.write(posicaoServo); Serial.print("Posição Esquerda-Direita: "); Serial.println(posicaoServo); } else { // Controle cima-baixo int valorPot = analogRead(A4); int posicaoServo = map(valorPot, 0, 1023, 0, 180); servoCimaBaixo.write(posicaoServo); Serial.print("Posição Cima-Baixo: "); Serial.println(posicaoServo); } }
anotheryou123
8 months ago
hi, im having a problem with servo motor not rotating with the old coding.... can anyone update me about the coding
chanthulax_20
8 months ago
CAN WE USE 6V 1W SOLAR PANEL
chanthulax_20
8 months ago
CAN WE USE 6V 1W SOLAR PANEL
dwhou
9 months ago
Hi, I've been learning arduino recently and I think your project is very good, can you send me the project to learn it please? My email is davidhou267@gmail.com
wmattis
a year ago
Tracking system as shown here has no chance of tracking a distant light source like the sun. The shadow cast by a cylinder that SURROUNDS each LDR will be the same on ALL FOUR sensors, and no differential will ever be generated. The CORRECT tracking sensor will have the LDRs arranged in a quad surrounding the cylinder or in the four corners of a divider. The operating theory is to have the shadow caused by a misalignment to shade one or two of the LDRs, maybe even three, but never all four. Figure 7A and 7B in the author's paper will work. Figure 7C and figure 8 will not.
borromeo
a year ago
hi i am new here how to run the code if the code are running? can you tell me? cuz its say it has an error
nikhil_09
a year ago
Hi , servos are not rotating brother can u please let me know the problem plz.
loernr53
2 years ago
That was so amazingly. https://mcdvoice.me/
Anonymous user
2 years ago
Hello i want do it for 5kw solar panels introducing electricity please help me for design i after coding it work automatic or always need connection with pc or laptop please send me a simple plan for assembling the device
Anonymous user
2 years ago
Always need a pc
Anonymous user
2 years ago
Hi, Thanks for sharing information about this project. I did similar circuit and coding but if switch button is not connected then servo becomes unstable and move randomly. Do you know any fix for this?
Anonymous user
2 years ago
Nicely done! I used your design to make a DAST using a full-size solar panel. I placed the LDRs (centered and carefully aligned) in tubes mounted on the four corners of the PV panel, and each tube is oriented perpendicular to the face of the panel. After testing the tracker outside in the sun I must agree with others who have commented on this project that the LDR arrangement does not work. I read your paper posted on the Wiley Online Library and I don’t see anything in the paper that would explain how one LDR would receive more or less light than the other three LDRs. If we (myself and the other skeptics) are missing something, please explain how you designed the LDRs so that they all do not receive the same amount of light all the time. If the sun goes behind a tree, for example, this design could not “reacquire” the sun once it reappears. Other than the LDR arrangement, this is a wonderful project!
Anonymous user
2 years ago
I need this solar project for my College project submission how can we contact with you my G-MAIL is pittalapavan96@gmail.com...
Anonymous user
2 years ago
Please explain how the voltage is calculated in this project?
Aboubakr_Elhammoumi
2 years ago
The used PV panel generates a voltage up to 5.5 V or more. Therefore, in this project, a voltage divider circuit, which also acts as a load, is realized to adapt this voltage to the Arduino analog input which is limited to 5 V. But, you can simply use a voltage sensor to acquire the PV voltage.
Anonymous user
2 years ago
Hello, Thanks for the work. But, the pin 13 is not connected, so line 133 buttonState2 = digitalRead(13); seems impossible.
Aboubakr_Elhammoumi
2 years ago
You are right! it should be 11 instead of 13 as shown in the electronic circuit
Anonymous user
2 years ago
Nice project, well-executed, well-presented. I made a tracker last year, using code remarkably similar to your automatic tracker function. Worked well on the bench using a lamp to test, and also worked well outdoors in bright sun. However, I found that using a fixed threshold or a threshold derived from averaging the four LDR readings made tracking ineffective in any condition but full sun. This year I've rebuilt the hardware (larger solar panel, more robust frame, with linear actuators) and am rewriting the code to use a fifth LDR for ambient light to set the threshold. We'll see how that works.
Aboubakr_Elhammoumi
2 years ago
Good idea! Hope it works well with you... Note: a large hysteresis band can reduce the tracking accuracy, therefore, it should be chosen carefully!
elmandrine
2 years ago
can you share you project with us? schematic and code?
godra
2 years ago
Do you mind share your code with us. I'm no so good in coding but this looks like a good project to try make but if the code don't work will be hell of a build. I will be pleased to try your code.
Anonymous user
2 years ago
Great project. Thanks for sharing. I am writing you from Republic of Congo, I need some clarifications about the Parallax PLX-DAQ. I need to know where do you install it in the Schematics? Do I need to buy only the Propeller 2 Evaluation Board (Rev C) or I also need some complementary driver for the connection to arduino or PC. Thanks.
Aboubakr_Elhammoumi
2 years ago
Parallax Data Acquisition tool (PLX-DAQ) software add-in for Microsoft Excel acquires up to 26 channels of data from microcontrollers and drops the numbers into columns as they arrive. PLX-DAQ provides easy spreadsheet analysis of data collected in the field, laboratory analysis of sensors and real-time equipment monitoring. You can download it from this link https://www.parallax.com/package/plx-daq/
Aboubakr_Elhammoumi
2 years ago
The PLX-DAQ Excel Macro is used for data acquisition from the Arduino microcontroller to an Excel Spreadsheet. We only need to download it. After installation, a folder named "PLX-DAQ" will automatically be created on the PC in which a shortcut named "PLX-DAQ Spreadsheet" is inside. Then, to establish the communication between the board and Excel, we just need to open the Spreadsheet and defining the connections settings (Baud rate and port) in the PLX-DAQ window (Fig. 5). Thereafter, after clicking on "connect" the output data will be collected and displayed in real-time on the Excel Spreadsheet.
Anonymous user
2 years ago
How did you wire the solar panel to the arduino? Did you just weld a cable to the negative and plug it in? I'm trying to build a similar project for my school, thanks.
Anonymous user
2 years ago
I think your must redesign your light sensor for exampel like giannis or brown dog project. For long distance source light. Your sensor will get same intensity of light. When your try with spot light. Your position of solar panel not precise to direction of light. In theory giannis way and brown dog way. When source of light move, four sensor will get differences intensity of light. And your servo can move to the direction of light or until your four sensor got same intensity. Sorry
Aboubakr_Elhammoumi
2 years ago
No! the sensors will not get the same light intensity! Why? I invite you to read carefully our paper from this link: https://onlinelibrary.wiley.com/doi/full/10.1002/ese3.236 , and you will get all the answers you need. Good reading! Besides, this solar tracker has been tested in a real environment (exposed to the sun, long-distance source light!!) and it can instantly track the sun's movement.
Anonymous user
2 years ago
Great idea and great project but I have some concerns about the way you test your project and real-life situation. First of all since all the LDR sensors are pointing the same direction you will always read the same values from them all the time, because when you use a small light source the light comes from that source has different angles but the sun is so big that light comes from the sun has no different angles and they are considered parallel. LDR sensors should point different angles and they should not be on the moving part. So you can position the sun no matter where it is, sun set or sun down...
Aboubakr_Elhammoumi
2 years ago
The LDR sensors are placed in the four corners of the PV panel and are put in dark tubes with a small hole on the top to detect the illumination of the sun. The shading resulting from the dark tubes will create a light intensity differential on LDR sensors, i.e. sensors point different angles. The dark tubes are also considered a concentrator of radiation and are used to increase the solar tracker robustness. The solar tracker above has been tested under a real environment (exposed to the sun) and it is able to instantly track the sun movement.
Anonymous user
2 years ago
Congratulations, your project is really interesting! Could you provide more details about how you attached the SG90 to your rotating horizontal platform? Thank you very much!
Aboubakr_Elhammoumi
2 years ago
Refer to the paper in this link and see Figure 1 "Rear View" https://onlinelibrary.wiley.com/doi/full/10.1002/ese3.236
Anonymous user
2 years ago
Guys i am a final year ec student i have been preparing for cs/it entrance exams so i don't get enough time to make this easy project on my own and now i have one week to submit this project so PLEASE can someone of you mail me the finished files for this project at yasheshpatel1626@gmail.com this is a humble request WISH YOU ALL LIFE FULL OF HAPPINESS AND GREAT SUCESSS!!!
Anonymous user
2 years ago
please help me guys i need you
Anonymous user
2 years ago
Nice project.How can I di it without the automatic mode
Anonymous user
2 years ago
Any one can share circuit diagram for solar tracker using arduino
Anonymous user
2 years ago
where can I get the library file for the code
Anonymous user
2 years ago
Agradezco mucho compartir este gran proyecto, lo montare y comentare ....
Anonymous user
2 years ago
hello, i tried to simulate the project with tinker cad but it doesn't respond to change light of ldr and potintiometer. where's the problem? if you have the project on tinkercad please send me the link.
Anonymous user
2 years ago
Do you have a full video instructions on how to assemble the components?
Anonymous user
2 years ago
Does this program works in larger solar panel with 25KG rated servo motor?
jackfaye
2 years ago
Hi, this project looks insane, I may just be an eejit but where is the 3d model?
Anonymous user
2 years ago
How did you wire the solar panel to the arduino? Did you just weld a cable to the negative and plug it in? I'm trying to build a similar project for my school, thanks.
Anonymous user
3 years ago
Great project. Thanks for sharing. I am writing you from Republic of Congo, I need some clarifications about the Parallax PLX-DAQ. I need to know where do you install it in the Schematics? Do I need to buy only the Propeller 2 Evaluation Board (Rev C) or I also need some complementary driver for the connection to arduino or PC. Thanks.
Aboubakr_Elhammoumi
2 years ago
The PLX-DAQ Excel Macro is used for data acquisition from the Arduino microcontroller to an Excel Spreadsheet. We only need to download it. After installation, a folder named "PLX-DAQ" will automatically be created on the PC in which a shortcut named "PLX-DAQ Spreadsheet" is inside. Then, to establish the communication between the board and Excel, we just need to open the Spreadsheet and defining the connections settings (Baud rate and port) in the PLX-DAQ window (Fig. 5). Thereafter, after clicking on "connect" the output data will be collected and displayed in real-time on the Excel Spreadsheet.
Aboubakr_Elhammoumi
2 years ago
Parallax Data Acquisition tool (PLX-DAQ) software add-in for Microsoft Excel acquires up to 26 channels of data from microcontrollers and drops the numbers into columns as they arrive. PLX-DAQ provides easy spreadsheet analysis of data collected in the field, laboratory analysis of sensors and real-time equipment monitoring. You can download it from this link https://www.parallax.com/package/plx-daq/
Anonymous user
3 years ago
Please explain how the voltage is calculated in this project?
Aboubakr_Elhammoumi
2 years ago
The used PV panel generates a voltage up to 5.5 V or more. Therefore, in this project, a voltage divider circuit, which also acts as a load, is realized to adapt this voltage to the Arduino analog input which is limited to 5 V. But, you can simply use a voltage sensor to acquire the PV voltage.
YasheshPatel26
3 years ago
Guys i am a final year ec student i have been preparing for cs/it entrance exams so i don't get enough time to make this easy project on my own and now i have one week to submit this project so PLEASE can someone of you mail me the finished files for this project at yasheshpatel1626@gmail.com this is a humble request WISH YOU ALL LIFE FULL OF HAPPINESS AND GREAT SUCESSS!!!
YasheshPatel26
2 years ago
please help me guys i need you
Anonymous user
3 years ago
Hello i want do it for 5kw solar panels introducing electricity please help me for design i after coding it work automatic or always need connection with pc or laptop please send me a simple plan for assembling the device
Anonymous user
2 years ago
Always need a pc
Anonymous user
3 years ago
Nice project.How can I di it without the automatic mode
Anonymous user
3 years ago
Nicely done! I used your design to make a DAST using a full-size solar panel. I placed the LDRs (centered and carefully aligned) in tubes mounted on the four corners of the PV panel, and each tube is oriented perpendicular to the face of the panel. After testing the tracker outside in the sun I must agree with others who have commented on this project that the LDR arrangement does not work. I read your paper posted on the Wiley Online Library and I don’t see anything in the paper that would explain how one LDR would receive more or less light than the other three LDRs. If we (myself and the other skeptics) are missing something, please explain how you designed the LDRs so that they all do not receive the same amount of light all the time. If the sun goes behind a tree, for example, this design could not “reacquire” the sun once it reappears. Other than the LDR arrangement, this is a wonderful project!
Anonymous user
3 years ago
I need this solar project for my College project submission how can we contact with you my G-MAIL is pittalapavan96@gmail.com...
hadypranoto
3 years ago
I think your must redesign your light sensor for exampel like giannis or brown dog project. For long distance source light. Your sensor will get same intensity of light. When your try with spot light. Your position of solar panel not precise to direction of light. In theory giannis way and brown dog way. When source of light move, four sensor will get differences intensity of light. And your servo can move to the direction of light or until your four sensor got same intensity. Sorry
Aboubakr_Elhammoumi
2 years ago
No! the sensors will not get the same light intensity! Why? I invite you to read carefully our paper from this link: https://onlinelibrary.wiley.com/doi/full/10.1002/ese3.236 , and you will get all the answers you need. Good reading! Besides, this solar tracker has been tested in a real environment (exposed to the sun, long-distance source light!!) and it can instantly track the sun's movement.
Anonymous user
3 years ago
Any one can share circuit diagram for solar tracker using arduino
elmandrine
4 years ago
hello, i tried to simulate the project with tinker cad but it doesn't respond to change light of ldr and potintiometer. where's the problem? if you have the project on tinkercad please send me the link.
Anonymous user
4 years ago
where can I get the library file for the code
Anonymous user
4 years ago
Hi, Thanks for sharing information about this project. I did similar circuit and coding but if switch button is not connected then servo becomes unstable and move randomly. Do you know any fix for this?
tamer79
4 years ago
Congratulations, your project is really interesting! Could you provide more details about how you attached the SG90 to your rotating horizontal platform? Thank you very much!
Aboubakr_Elhammoumi
2 years ago
Refer to the paper in this link and see Figure 1 "Rear View" https://onlinelibrary.wiley.com/doi/full/10.1002/ese3.236
Anonymous user
4 years ago
Hello, Thanks for the work. But, the pin 13 is not connected, so line 133 buttonState2 = digitalRead(13); seems impossible.
Aboubakr_Elhammoumi
2 years ago
You are right! it should be 11 instead of 13 as shown in the electronic circuit
Anonymous user
4 years ago
Nice project, well-executed, well-presented. I made a tracker last year, using code remarkably similar to your automatic tracker function. Worked well on the bench using a lamp to test, and also worked well outdoors in bright sun. However, I found that using a fixed threshold or a threshold derived from averaging the four LDR readings made tracking ineffective in any condition but full sun. This year I've rebuilt the hardware (larger solar panel, more robust frame, with linear actuators) and am rewriting the code to use a fifth LDR for ambient light to set the threshold. We'll see how that works.
Anonymous user
2 years ago
can you share you project with us? schematic and code?
wosscoe
2 years ago
Me too. I want to code a system to control dc motors north south up and down
Anonymous user
4 years ago
Agradezco mucho compartir este gran proyecto, lo montare y comentare ....
hasangunel
5 years ago
Great idea and great project but I have some concerns about the way you test your project and real-life situation. First of all since all the LDR sensors are pointing the same direction you will always read the same values from them all the time, because when you use a small light source the light comes from that source has different angles but the sun is so big that light comes from the sun has no different angles and they are considered parallel. LDR sensors should point different angles and they should not be on the moving part. So you can position the sun no matter where it is, sun set or sun down...
Aboubakr_Elhammoumi
2 years ago
The LDR sensors are placed in the four corners of the PV panel and are put in dark tubes with a small hole on the top to detect the illumination of the sun. The shading resulting from the dark tubes will create a light intensity differential on LDR sensors, i.e. sensors point different angles. The dark tubes are also considered a concentrator of radiation and are used to increase the solar tracker robustness. The solar tracker above has been tested under a real environment (exposed to the sun) and it is able to instantly track the sun movement.
Arduino Solar Tracker | Arduino Project Hub
sfegdffgsdr
3 months ago
will auto mode work without P2 EVO