Light Sensor

Ryan Courtney
Senior Design II
Advisor: Junkun Ma
 Design Dual-Axis Solar Tracking System
o Feedback Control
 Light Intensity Sensor
 Microcontroller (Arduino)
 Dual-Motor Setup
o Wireless Communication
 XBee Radio
 Position a solar panel to receive maximum light
intensity
 Integrate wireless communication
 Achieve positioning using two axis of freedom as
opposed to one
Software
oArduino Programming Environment
oAlgorithm
Hardware
oLight Sensor
oFrame
oMicrocontroller
oWireless Modules
oMotors and H-bridges
 PWM to Analog
 Low-Pass Filter Design
 Arduino Programming
Environment
o Based on language
known as Processing
o Processing based on
C++
o Allows for
composition and
troubleshooting of
Arduino code known
as “sketches”
o www.arduino.cc
Algorithm
oBroken into two major pieces
•Sender
•Receiver
Variable
Value
Description
top
0
Top sensor pin
bottom
1
Bottom sensor pin
left
2
Left sensor pin
right
3
Right sensor pin
linearPot
5
Potentiometer pin for linear actuator control
tol_v
10
Tolerance for vertical sensors
tol_h
10
Tolerance for horizontal sensors
dark
20
Darkness threshold
wait
5000
Delay interval (5 seconds)
vMotor
9
Vertical motor PWM pin
up
40
Vertical motor speed up
down
200
Vertical motor speed down
cease
127
Value to stop vertical motor
MAX
950
Maximum distance to allow actuator to extend (obtained from linearPot)
MID
500
Point at which linear actuator has system at 45º angle (obtained from linearPot)
MIN
200
Minimum distance to allow actuator to extend (obtained from linearPot)
Startup
Position at 45º angle
Initial Check
Average Sensors
Wireless Sender (Horizontal Motor)
Control Vertical
Control Horizontal
Check Dark (not for use indoors)
Delay (when balanced)
 Sends numeric codes
to wireless module for
horizontal motor
control
Code
Name
Description
0
Stop
Stops horizontal motor
1
hRIGHT
Signals horizontal motor to turn right
2
hLEFT
Signals horizontal motor to turn left
3
vUP
Signals that vertical motor is moving system up
4
vDOWN
Signals that vertical motor is moving system down
5
balanced
Signals that system is balanced
6
start
Signals that startup function has begun
7
finish
Signals that startup function is complete
Variable
Value
Description
Hpwm
9
Horizontal motor PWM pin
left
0
Horizontal motor speed left
right
255
Horizontal motor speed right
cease
127
Value to stop horizontal motor
Error Check
Main loop
Stop Horizontal Motor
 Keeps motor at halt if no
data is available
 Ensures code sent is within
the correct range
 Returns code when correct





Light Sensor
Frame
Microcontroller
Wireless Modules
Motors and H-bridges
o PWM to Analog
o Low-Pass Filter
Design
 Use property of
photoresistors
 Layout in grid
pattern
 Use comparisons
of resistors
 Balance sensors on
most intense light
Photoresistor A0
Photoresistor A2
Photoresistor A3
Photoresistor A1
 Use plywood for
structure
 Two degrees of
freedom
 Maximum vertical
adjustment is 63º
 Minimum vertical
adjustment is 23º
 Horizontal
adjustment is 360º
Microcontroller
ATmega328
Operating Voltage
5V
Input Voltage
(recommended)
7-12V
Input Voltage (limits)
6-20V
Digital I/O Pins
14 (of which 6 provide
PWM output)
Analog Input Pins
6
DC Current per I/O Pin
40 mA
DC Current for 3.3V Pin
50 mA
Flash Memory
32 KB (ATmega328) of
which 0.5 KB used by
bootloader
SRAM
2 KB (ATmega328)
EEPROM
1 KB (ATmega328)
Clock Speed
16 MHz
 Arduino
Uno/Duemilanove
(x2)
 Use Wireless Shield
to snap to Arduino
(top)
 Use XBee radios
snapped to wireless
shields (bottom)
 Wireless
communication via
serial commands
 24 VDC Slewing
Drive motor for
horizontal motion
(top)
 12 VDC Linear
Actuator with
potentiometer
feedback for vertical
motion (bottom)
 Sabertooth 2x25 (top)
and 2x12 (bottom) used
as H-Bridges
 0-5V input from
microcontroller
 0-2.5V input signal for
reverse
 2.5V for stop
 2.5-5V input signal for
forward
 Pulse Width Modulation
(PWM) is digital
representation of analog
signal in square wave
form
 Sabertooth H-Bridge
cannot accept
digital/PWM signal
 Sabertooth H-Bridge can
accept analog signal
 Use low-pass filter to
condition PWM signal to
smooth analog signal
 1 KΩ resistor
 1 uF capacitor
 F = 1/2πRC to
calculate Frequency of
filter
 Filter frequency is 15.9
Hz
 Frequency is sufficient
for the rate of change
of the project
 Wireless
communication
between Arduinos
 Dual-Axis
movement
 Tracks light
intensity
 Balance on most
intense light
Light Sensor (Single Component)
Control of Two Individual Motors
Wireless Communication
Single System
Source Code
 Block Diagram
Date (Week of)
Task
2/6/2012
Amend Proposal
2/13/2012
Select and Test Method of Motor Control
3/5/2012
Research/Implement Wireless Communication
and Begin Assembly of Final System
3/12/2012
Assemble Light Sensor into Single Component
and Continue Assembly
3/19/2012
Continue Assembly
4/2/2012
5/4/2012
Complete Assembly and Begin Tests
Final Presentation