Uniostar
Published © GPL3+

Arduino Solar Tracker Gimbal with Sensor Noise Removal

Track the sun with a DIY Arduino-powered gimbal that boosts solar panel efficiency and smoothens sensor data in real time.

BeginnerFull instructions provided30 minutes105
Arduino Solar Tracker Gimbal with Sensor Noise Removal

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
SG90 Micro-servo motor
SG90 Micro-servo motor
×1
LDR, 5 Mohm
LDR, 5 Mohm
×2
Resistor 10k ohm
Resistor 10k ohm
×1
Jumper wires (generic)
Jumper wires (generic)
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Main Schematic

Code

Main Code

Arduino
#include <Servo.h>

Servo rotator;

void setup()
{
  Serial.begin(9600);
  rotator.attach(9);
}

void loop()
{
  int input = smoothen(20, A2) - smoothen(20, A5);
  input = map(input, -200, 200, 0, 180);
  rotator.write(input);
  Serial.print(input);
  Serial.print(';');
  delay(5);
}

int smoothen(int arraySize, int inputPin)
{
  int input = 0;
  double sum = 0;

  for (int i = 0; i < arraySize; i++)
  {
    input = analogRead(inputPin);
    sum += input;
  }  

  sum /= arraySize;

  return (int) sum;
}

Credits

Uniostar
10 projects • 8 followers
Electrical Engineering Undergrad Student specialized in low-level programming, IoT projects, and microcontroller electronics.

Comments