## Introduction: EF 230 Captures the Sun

This Instructable will detail how to use an Arduino kit/circuit board and MATLAB to create a prototype home energy system that focuses on the acquisition of wind and solar power. With the proper materials and by using the provided code/setup, you can make your own small scale, green energy collection system.

This project was designed by students in the Tickle College of Engineering at the University of Tennessee, Knoxville.

## Step 1: Materials Needed

1) A laptop with MATLAB installed.

3) You will also need an Arduino micro-controller kit.

4) A suitable platform to mount the DC motor. In the provided example, a wooden cutout was used to support the servo motor and mount the DC motor on top.

5) This link can be used to 3D print a propeller that can be attached to the mounted DC motor: https://www.thingiverse.com/thing:3188702

## Step 2: Code Part 1: Variable Setup

This code is essential for initial variable declaration.

clc; clear all;

%Declaring Objects like Pins and the Arduino a=arduino('com3','uno'); s1 = servo(a,'D9', 'MinPulseDuration', 1e-3, 'MaxPulseDuration', 2e-3); s2 = servo(a,'D10', 'MinPulseDuration', 1e-3, 'MaxPulseDuration', 2e-3); configurePin(a,'A0','Analoginput'); configurePin(a,'A1','Analoginput'); configurePin(a,'A2','Analoginput'); configurePin(a,'A3','Analoginput') b=0; i=0.1 figure

## Step 3: Code Part 2: Turbine Code

while i<10;

%Turbine Part potval=readVoltage(a,'A0') servoval=potval./5 writePosition(s1, servoval)

## Step 4: Code Part 3: Solar Panel Code and Plot

This code will allow you to use two photo-resistors to move the servo according to sun movement. The code will also plot a polar graph of wind direction vs time for the wind turbine.

%Solar Panel Part

photoval1=readVoltage(a,'A1'); photoval2=readVoltage(a,'A2'); difference= photoval1-photoval2 absdiff=abs(difference) if difference > 1.5 writePosition(s2,0); elseif difference > 1.25 writePosition(s2,0.3); elseif absdiff < 1 writePosition(s2,0.5); elseif difference < (-1) writePosition(s2, 0.7); elseif difference < (-1.25) writePosition(s2,1); else end i=i+0.1 theta=(potval/5).*(2*pi) polarscatter(theta,i) hold on end

## Step 5: Code Part 4: Email

Change 'example email' to the desired address in order to properly receive an email including plot data.

%Email Section

title('Wind Direction vs. Time') saveas(gcf,'Turbine.png') %saves the figure setpref('Internet','SMTP_Server','smtp.gmail.com'); setpref('Internet','E_mail','gssecomputercomputer@gmail.com'); % mail account to send from setpref('Internet','SMTP_Username','gssecomputercomputer@gmail.com'); % senders username setpref('Internet','SMTP_Password','gssegsse'); % Senders password props = java.lang.System.getProperties; props.setProperty('mail.smtp.auth','true'); props.setProperty('mail.smtp.socketFactory.class', 'javax.net.ssl.SSLSocketFactory'); props.setProperty('mail.smtp.socketFactory.port','465'); sendmail('example email','Turbine Data','This is your turbine data. Thanks for saving the planet!','Turbine.png') disp('email sent')

## Step 6: Extra Help

You can refer to the SIK Guide that accompanies the Arduino micro controller kit for extra help in setting up your circuit board. The MathWorks website can also be a useful tool for MATLAB support.