Project tutorial
Arduino Sunflower

Arduino Sunflower

The sunflower follows the light using a servo motor and two photoresistors.

  • 24,064 views
  • 24 comments
  • 77 respects

Components and supplies

About this project

The sunflower follows the light using a servo motor and two photoresistors.

Code

Solar Tracker CodeC/C++
#include <Servo.h>

int sensorPin = A0;
int servoPin  = 9;

int sensorValue = 0;
int servoGrad = 90;
int tolerance = 40;

Servo myservo;

void setup() {
  pinMode( sensorPin, INPUT);
  myservo.attach( servoPin );
  myservo.write( servoGrad );
}

void loop() {
  sensorValue = analogRead(sensorPin);
  if ( sensorValue < (512-tolerance) )
  {
    if (servoGrad < 180) servoGrad++;
  }

  if ( sensorValue > (512+tolerance) )
  {
    if (servoGrad > 0) servoGrad--;
  }

  myservo.write( servoGrad ); 

  delay(100);
}

Schematics

Sunflower Schematics
Schermata 2018 03 03 alle 21 57 54 arqht6xwyl

Comments

Author

008c1350 370c 4a5f b1fb 117d97d44b08 r7kbm6lho7
Rick_Findus
  • 2 projects
  • 18 followers

Published on

September 15, 2017

Members who respect this project

12540590 741555235974555 3535889509737692135 n u3tbvajh6hImg 20170806 200034 319 bkmr9o7xzkDefaultDefaultDefaultInductor color code   copyPhoto1f4a6 xl7jqg1chh

and 77 others

Project replicated by

Default
See similar projects
you might like

Similar projects you might like

Valentine's Sunflower

Project tutorial by circuito.io team

  • 6,910 views
  • 11 comments
  • 22 respects

Solar Panel Sun Tracker - Phone Charger

Project tutorial by FIELDING

  • 27,300 views
  • 11 comments
  • 118 respects

Robotic Arm from Recycled Materials

Project tutorial by circuito.io team

  • 24,658 views
  • 22 comments
  • 97 respects

Pathfinder

Project showcase by Team Maverick

  • 23,822 views
  • 15 comments
  • 121 respects

Home Automation Using Raspberry Pi 2 And Windows 10 IoT

Project tutorial by Anurag S. Vasanwala

  • 297,268 views
  • 98 comments
  • 706 respects

Windows Remote Arduino

Project tutorial by Team Windows IoT

  • 166,243 views
  • 167 comments
  • 339 respects
Add projectSign up / Login