MicroPython: SunLight Tracker system for solar panels using ESP8266

Learn how to create a sunlight tracker system using an ESP8266 and servo motor in MicroPython

Solar panels need sunlight to generate the electricity but as we all know our renewable light source sun is not always stable at one position, it rises from east and sets at west one horizon to another. So if we place our solar panel in any one direction they wont get the most of the light throughout the day. So in that scenario Sun light tracking system comes into role. This system faces the panels towards the incomming light source to get more out of it.

This is an example of how you can create for real time bigger solar panels but you need to implement with more heavy duty components for durability during winds.

So lets get started with looking at the required components for this project.

Required Components:

  • ESP8266 NodeMCU with MicroPython installed
  •  Light dependent resistors (LDR).  X  2
  •  MG90S Servo – generic X 1
  • 10k Resistor X2
  • Connecting wires.
  • 2 diodes for stable readings  (1N4004 )

Schematic diagram

Connect the above components as shown in the below circuit diagram.

single axis light tracking system for solar panels circuit diagram

In the above circuit diagram we connected two LDR to the D1 and D2 pins along with diodes in series and other side of the LDRs are connected to one side of 10k Ohm resistors and other side of the resistor to ground GND.

Next connect the servo motor as power wire to the 5V supply of nodeMCU Vin, and blackwire to the Ground, and signal wire to the D5 digital pin.

Servo motor Setup:

To build the moving face we need to add a base plastic panel on servo motor and the rotating shaft of motor should be sticked to ground surface. for reference look at the below image. this setup works only for mini sized project.

servo motor setup with solar panel

Source Code:

Upload the code to the nodeMCU with MicroPython installed in it through uPycraft. If you dont know how to install refer the below tutorials.

Install MicroPython on ESP8266

Copy the code from below and paste it in the main.py file and upload it to board.

After uploading the code press reset button on the board, then to test weither it is working or not use a flash light and move over it. The motor moved according to the light.

CircuitSchools Staff

We at CircuitSchools publish on basics of electronics and electric components and everything related to evolution of electrical technology with complete analysis of development boards and modules along with latest projects with innovative ideas.
Back to top button