Solar Tracker - PowerPoint PPT Presentation

1 / 22
About This Presentation
Title:

Solar Tracker

Description:

Steven Ernst, Hansang Ko, David Jensen, and Jon Mueller. Special Thanks to... With the usage of three photo-voltaic sensors, the ATmega128 AVR board ... – PowerPoint PPT presentation

Number of Views:17429
Avg rating:5.0/5.0
Slides: 23
Provided by: steven339
Category:
Tags: solar | steven | tracker

less

Transcript and Presenter's Notes

Title: Solar Tracker


1
Solar Tracker
  • Where is the light at?

Website http//web.engr.oregonstate.edu/ernsts/me
chatronics/ Members Steven Ernst, Hansang Ko,
David Jensen, and Jon Mueller Special Thanks
to Kevin Gatimu, Takahiro Yamakawa, and Matt
Knudson
2
What is it?
  • The solar tracker responds to the light intensity
    to situate the solar panel in an optimal location
    for capturing solar rays.
  • With the usage of three photo-voltaic sensors,
    the ATmega128 AVR board (microcontroller)
    controls the actuators so the solar panel will
    always point in the direction of the brightest
    light source.

3
Finalized Parts List
Parts used only (excluding testing equipment)
  • Motor Controller Board
  • Atmega128 AVR Board
  • TekBot charger board
  • 3 Photoresistors
  • Male Female Headers
  • Shrink Wrap
  • Wire and Solder
  • 2 Actuators (Motors)
  • Plastic Sheets
  • Resistors

4
Lets see it work!
  • Show video here
  • Video should show
  • Moving left, then change direction to move right
  • Moving up, then change direction to move down
  • Covering left sensor and moving up and down,
    covering right sensor and moving up and down.

5
How did we make it?
  • Design Process
  • Generate idea
  • Device to optimize solar rays
  • Design physical layout
  • Continuous rotating base
  • Maximum angle rotation
  • Enclosed electronics
  • Design code layout
  • Identify what the code must do
  • Break down processes into specific functions with
    inputs and outputs
  • Optimize design and restructure layouts
  • Based on complete detailed overview, make
    necessary changes to the design.
  • Build the project
  • Sequentially code the project
  • Sample circuit first

6
Physical Design Facts
7
Programming Diagram Tree
8
Programming Facts
  • Functions
  • int getSensorInput(int sensorChoice)
  • void sendMotorOutput(int motorChoice, int
    motorDirection, int motorSpeed)
  • int compareSensors(int sensorA, int sensorB)
  • void controlBaseMotor(void)
  • void controlAngleMotor(void)
  • void angleLimit(int motorDirection)
  • void PWM_init()
  • int pwmRate(int sensorA, int sensorB)
  • void change_motor_speed(int motorChoice, uint8_t
    motorSpeed)

9
Testing
  • Step by Step design
  • Motor Torque Debugging

10
Cool Facts / Extras
  • Variable PWM Actuator Control With the use of a
    PWM signal, the user has flexibility to
    independently and dynamically adjust the speed of
    each actuator.
  • Sensor Variability Sometimes a sensor can be
    covered up due to unforeseen affects. Fortunately
    the solar tracker can account for this when
    adjusting the angle sensor. If the left sensor is
    covered, the right sensor is utilized to compare
    with the upper sensor and vise versa.
  • Semi - Infinite Rotation Our sleek mechanical
    design provides us with a base that can
    continuously rotate in a single direction without
    being limited by physical parameters.

11
What would we change?
  • Include motors with encoders to code in more
    bells and whistles.
  • Optimizing Hardware
  • Self-Charging Design

12
Documentation
13
Conclusions
  • A special offer just for you , buy one today and
    well knock off 100.00
  • Only 199.99 while supplies last

14
Code (Header)
  • define motorForward 1
  • define motorBackward -1
  • define motorOff 0
  • define topSensor 101
  • define leftSensor 102
  • define rightSensor 103
  • define baseMotor 110
  • define angleMotor 111 // the larger the
    sensitivity range, the longer the sensors will be
    off
  • define sensitivity 0
  • define TRUE 1
  • define FALSE 0

15
Code (PWM)
  • //PWM code
  • define F_CPU 16000000UL //CPU speed in hertz
  • include ltavr/io.hgt
  • include ltstdlib.hgt
  • include "light.h
  • //PWM frequency (16,000,000)/(1 (799 1))
    20kHz
  • uint16_t TOP_value 799
  • /
    /
  • /
    change_motor_speed
    /
  • /Change the speed of motor according to the
    current duty cycle setting /
  • /OCR1A and OCR1B are calculated from TOP_value
    and duty cycles /
  • /OCR1A and OCR1B are updated at the end of the
    function /
  • /
    /
  • void change_motor_speed(int motorChoice, uint8_t
    motorSpeed)
  • if(motorChoice baseMotor)
  • OCR1A TOP_value motorSpeed / 100 //PORTB
    PIN5 output
  • else if (motorChoice angleMotor)
  • OCR1B TOP_value motorSpeed / 100 //PORTB
    PIN6 output

16
Adjustable Speed Code
  • //This adjusts the speed the motors will rotate
    based upon the percent difference between the two
    inputted sensors
  • int pwmRate(int sensorA, int sensorB)
    if(((float)getSensorInput(sensorA) /
    (float)getSensorInput(sensorB) gt (1
    sensitivity)) ((float)getSensorInput(sensorA)
    / (float)getSensorInput(sensorB) lt (1 -
    sensitivity)))
  • int maxSpeedRange 0.25 //difference
    percentage scaled to 1
  • int mediumSpeedRange 0.2 //difference
    percentage scaled to 1
  • int minSpeedRange 0.15 //difference
    percentage scaled to 1
  • int maxSpeed 60 //expressed as percentage out
    of 100
  • int mediumSpeed 50 //expressed as percentage
    out of 100
  • int minSpeed 40 //expressed as percentage out
    of 100
  • //If the difference between the two is greater
    than maxSpeed, then it returns the highest
    percentage desired
  • if(((float)getSensorInput(sensorA) /
    (float)getSensorInput(sensorB) gt (1
    maxSpeedRange)) ((float)getSensorInput(sensorA)
    / (float)getSensorInput(sensorB) lt (1 -
    maxSpeedRange)))
  • return(maxSpeed)
  • //If the difference between the two is greater
    than mediumSpeed but less than maxSpeed, then it
    returns the medium percentage desired
  • else if(((float)getSensorInput(sensorA) /
    (float)getSensorInput(sensorB) gt (1
    mediumSpeedRange)) ((float)getSensorInput(sens
    orA) / (float)getSensorInput(sensorB) lt (1 -
    mediumSpeedRange)))
  • return(mediumSpeed)
  • //If the difference between the two is greater
    than minSpeed but less than mediumSpeed, then it
    returns the lowest percentage desired
  • else if(((float)getSensorInput(sensorA) /
    (float)getSensorInput(sensorB) gt (1
    minSpeedRange)) ((float)getSensorInput(sensorA)
    / (float)getSensorInput(sensorB) lt (1 -
    minSpeedRange)))
  • return(minSpeed)

17
Code (Main)
  • int main()
  • //Initialize PWM settings
  • PWM_init()
  • while(1)
  • angleLimit(angleMotorDirection) controlBaseMot
    or()
  • angleLimit(angleMotorDirection) controlAngleMo
    tor()
  • return 0

18
Code (getSensorInput)
  • //Determines which sensor to get data from and
    returns that data.int
  • getSensorInput(int sensorChoice)
  • DDRF ((1ltlt0)(1ltlt2)(1ltlt4)) //sets PortF
    pins0,2,4 to zero one means output pins, zero
    means input pins
  • switch (sensorChoice)
  • case topSensor //Top Sensor plugs into PORT F,
    PIN 0
  • ADMUX (1ltltREFS1)(1ltltREFS1)
  • ADCSRA (1ltltADEN)(1ltltADSC)(1ltltADPS2)(1ltltADPS1)
    (1ltltADPS0)
  • while(bit_is_clear(ADCSRA,ADIF)) //loops while
    interrupt flag not set (while it is zero)
  • ADCSRA (1ltltADIF) //set interrupt flag to
    1
  • return ADCW //returns raw sensor value
  • break
  • case leftSensor //Left Sensor plugs into PORT
    F, PIN 2
  • ADMUX (1ltltREFS1)(1ltltREFS1)(1ltltMUX1)
  • ADCSRA (1ltltADEN)(1ltltADSC)(1ltltADPS2)(1ltltADPS1)
    (1ltltADPS0)
  • while(bit_is_clear(ADCSRA,ADIF)) //loops while
    interrupt flag not set (while it is zero)
  • ADCSRA (1ltltADIF) //set interrupt flag to
    1
  • return ADCW //returns raw sensor value
  • break
  • case rightSensor //Right Sensor plugs into PORT
    F, PIN 4

19
Code (sendMotorOutput)
  • //Determines which motor to send an output to and
    what direction should be sent.void
  • sendMotorOutput(int motorChoice, int
    motorDirection, int motorSpeed)
  • DDRE (1ltltPE0)(1ltltPE4) //sets PortE pins0,4
    to one one means output pins, zero means input
    pins
  • switch (motorChoice) //Port E Pin 0 connects
    to baseMotor direction pin
  • case baseMotor
  • if (motorDirection motorForward) // Sets
    PortE Pin0 to 1 (high) this outputs to the
    direction pin on the motor controller
  • PORTE (1ltltPE0) //Sets motor speed using PWM
    this outputs to the enable pin on the motor
    controller
  • change_motor_speed(baseMotor, motorSpeed)
  • else if (motorDirection motorBackward) //
    Sets PortE Pin0 to 0 (low) this outputs to the
    direction pin on the motor controller
  • PORTE (1ltltPE0) //Sets motor speed using
    PWM this outputs to the enable pin on the motor
    controller
  • change_motor_speed(baseMotor, motorSpeed)
  • else //Set motor speed using PWM this
    outputs to the enable pin on the motor
    controller
  • change_motor_speed(baseMotor,0)
  • break //Port E Pin 4 connects to baseMotor
    direction pin
  • case angleMotor
  • if (motorDirection motorForward
    angleLimitForward FALSE) // Sets PortE Pin4
    to 1 (high) this outputs to the direction pin on
    the motor controller

20
Code (compareSensors)
  • int compareSensors(int sensorA, int sensorB)
  • if(((float)getSensorInput(sensorA) /
    (float)getSensorInput(sensorB) gt (1
    sensitivity)) ((float)getSensorInput(sensorA)
    / (float)getSensorInput(sensorB) lt (1 -
    sensitivity)))
  • if ((getSensorInput(sensorA) -
    getSensorInput(sensorB)) gt 0)
  • return(motorForward)
  • else
  • return(motorBackward)
  • //If the sensors are within the sensitivity
    range, then motorOff is returned.
  • else
  • return(motorOff)

21
Code (controlBaseMotor and controlAngleMotor)
  • //sends a motor output, determined by
    compareSensors function, to the base motor
  • void controlBaseMotor(void)
  • sendMotorOutput(baseMotor, compareSensors(leftSens
    or, rightSensor))
  • //sends a motor output, determined by
    compareSensors function, to the angle motor
  • void controlAngleMotor(void)
  • int brighterSensor rightSensor
  • //if-else statement ensures the topSensor is
    compared to the smaller voltage (brighter).
  • if (getSensorInput(leftSensor) lt
    getSensorInput(rightSensor))
  • brighterSensor leftSensor
  • sendMotorOutput(angleMotor, compareSensors(topSens
    or, brighterSensor))

22
Code (angleLimit)
  • //if an input switch is set, then the angle motor
    is turned of and a limit flag is set
  • //Port D Pin 0 and 4 are default to 1 when
    pressed, they are zero (limit becomes TRUE)
  • void angleLimit(int motorDirection)
  • DDRD ((1ltlt0)(1ltlt4)) //sets PortD pins0,4 to
    zero one means output pins, zero means input
    pins
  • if (motorDirection motorForward
    bit_is_clear(PIND,0)) sendMotorOutput(angleMoto
    r, motorOff)
  • angleLimitForward TRUE
  • else if (motorDirection motorBackward
    bit_is_clear(PIND,4))
  • sendMotorOutput(angleMotor, motorOff)
  • angleLimitBackward TRUE
Write a Comment
User Comments (0)
About PowerShow.com