Spinning Reminder

Made by Tiancheng Yang

The spinning project helps people find the best sunny spot in their home for their plant.

0

Solution Statement:

This device is to prevent the plant from overheating from the sun. It uses a fan to cool down and remind the users that the plant will be subjected to severe heat. 

Approach: 

The device involves a DC motor, a servo, a relay switch, and a photoresistor. The servo is mapped according to the photoresistor readings. When the reading goes over a certain level, the relay switch is triggered, which turns on the motor with the fan. 

Process: 

The first design did not involve servo and relay switch. The motor was mounted to digital ports so that the "HIGH" signal should turn it on. However, I found out that the voltage of digital ports is not enough to power the motor, which has a minimal working voltage of 3V. It has to be mounted to 3.3V output. After evaluating what resources and parts I have, I decided to use a servo to activate a relay switch, which connects the motor to the power source. 

Technical Documentation: 

0
const int ledPin = D2;
const int lightPin = A5;
const int servoPin = D5;
Servo P;

int lightData;
int servoPos;

int last_published = -1;

void spreadsheet(){

  // check if 1 minute has elapsed
	if( last_published + 60000 < millis() ){
		Particle.publish( "spreadsheet", String(lightData) );
		last_published = millis();
	}

}

 
void setup()
{
  //Setup pin modes
  pinMode(lightPin, INPUT);
  pinMode(ledPin, OUTPUT);
  P.attach(servoPin);
  
}
 
void loop(){
    lightData = analogRead(lightPin);

    
    spreadsheet();

    servoPos = map(lightData, 4000, 4095, 85, 180);
    
    P.write(servoPos);
    
    Particle.publish("lightData", String(lightData));
    
    delay(5000);

    
    //if(lightData < 200){
    //    P.write(70);
    //}
    //else{
    //    P.write(160);
    //    digitalWrite(ledPin, HIGH);
    //}
    
}
const int ledPin = D2;
const int lightPin = A5;
const int servoPin = D5;
Servo P;

int lightData;
int servoPos;

int last_published = -1;

void spreadsheet(){

  // check if 1 minute has elapsed
	if( last_published + 60000 < millis() ){
		Particle.publish( "spreadsheet", String(lightData) );
		last_published = millis();
	}

}

 
void setup()
{
  //Setup pin modes
  pinMode(lightPin, INPUT);
  pinMode(ledPin, OUTPUT);
  P.attach(servoPin);
  
}
 
void loop(){
    lightData = analogRead(lightPin);

    
    spreadsheet();

    servoPos = map(lightData, 4000, 4095, 85, 180);
    
    P.write(servoPos);
    
    Particle.publish("lightData", String(lightData));
    
    delay(5000);

    
    //if(lightData < 200){
    //    P.write(70);
    //}
    //else{
    //    P.write(160);
    //    digitalWrite(ledPin, HIGH);
    //}
    
}
const int ledPin = D2;
const int lightPin = A5;
const int servoPin = D5;
Servo P;

int lightData;
int servoPos;

int last_published = -1;

void spreadsheet(){

  // check if 1 minute has elapsed
	if( last_published + 60000 < millis() ){
		Particle.publish( "spreadsheet", String(lightData) );
		last_published = millis();
	}

}

 
void setup()
{
  //Setup pin modes
  pinMode(lightPin, INPUT);
  pinMode(ledPin, OUTPUT);
  P.attach(servoPin);
  
}
 
void loop(){
    lightData = analogRead(lightPin);

    
    spreadsheet();

    servoPos = map(lightData, 4000, 4095, 85, 180);
    
    P.write(servoPos);
    
    Particle.publish("lightData", String(lightData));
    
    delay(5000);

    
    //if(lightData < 200){
    //    P.write(70);
    //}
    //else{
    //    P.write(160);
    //    digitalWrite(ledPin, HIGH);
    //}
    
}
Click to Expand
0

Next Steps:

I went through ten photoresistors, and none of them can give accurate and precise readings. The reading either stays the same with fingering pinching and flashlight on top of it or just between 4000 to 2000 with no change in the environment. 

To make the device reliable, better photoresistors are needed. 

Reflection:

I did a good job incorporating a DC motor in the device. It could not be implemented directly, so I found another way to make it work. 

I found Tech Spark a very good resource. They will play a big part in my future projects. 

References:

http://www.toptechboy.com/arduino-lessons/

x
Share this Project


About

The spinning project helps people find the best sunny spot in their home for their plant.

Created

November 7th, 2019