In: Electrical Engineering
A 120VAC fan is to be controlled by an MSP430F2273. Assuming the maximum
fan current is 2A, provide a solid-state relay interface using a Sharp
S108T02. Verify both voltage and current compatibility in the control interface.
Add a single push-button interface to the system and a status LED to be lit when the fan is ON. Provide a short program to toggle the fan with the
push-button.
From the datasheet of S108T02, the voltage rating 120 v and the current rating 2A seem to be okay with the semiconductor switch S108T02 as it can handle a peak of 400V(another varient of the relay can handle peal voltage of 600V) and a current of 8A RMS. Also, the range of the frequency of AC is 47 HZ 63 HZ for this device. By looking at this, we may say the relay is suitable for the application but the minimum input current needed to turn on the relay is 16 mA which we cannot draw from any single pin of the microcontroller mentioned in the question.
so try to find out another relay which requires less input current to turn in ON or try to add a common collector amplifier between the MSP output pin that controls the relay and the control input pin of the relay. This is because the common collector acts as a buffer and so we can draw enough current without overloading the MSP pins
Regarding the code, you didn't mention the language or the software for which the code is to be written for (Energia/code composer studio).
So I'm providing code that can be used with Energia software and only the syntax changes for the code composer studio but the logic remains the same.
code for energia:
#define led_pin 13 //defining 13th pin as the led pin
#define control_pin 3 // this is the pin that controls the
relay.
// you can change the pin numbers as per the requirement
#define button_pin 2 //this pin is for the button
boolean state=0; // state is a variabel which is used to store state
void setup() {
// put your setup code here, to run once:
pinMode(led_pin,OUTPUT); //defining the led pin as the output
pin
pinMode(control_pin,OUTPUT); //defining the control pin as the
output pin
pinMode(button_pin,INPUT_PULLUP); //defining the button pin as
input and also pullup to reduce the noise
// so connect the button between button pin and the GND
}
void loop() {
// put your main code here, to run repeatedly:
if(digitalRead(button_pin)==LOW)
{
state=!state; // toggling the state
digitalWrite(led_pin,state); // if state=0, pin will be low else
pin will turn high
digitalWrite(control_pin,state);
delay(200); //delay of 200 milli seconds to avoid multiple inputs
in one switching
}
}
please check the datasheet of the relay and the datasheet of msp board you are using.
The code is same for all MSPs except for the pin numbers which vary with the microcontroller.
please don't forget to add a resistor (around 1k) in series with the LED. otherwise LED draws heavy current damaging the pin of MSP