Don't Touch Me

Made by Xingsuo Liu

The purpose of this project is to design a smart pot that can detect if someone will touch it and can send this message to the host. By doing this, I hope it can keep it's safety and prevent it from destroying by others

Created: January 29th, 2016

1

Intention

My cousin raise some plants at the front of his door, but his little plants always be destroyed by some naughty kids who live in his neighbourhood. So he always want to come up with an approach to protect his plant from ruining. Whenever there is someone want to touch the plant, he can know it instantly and can go and stop it.

0

Goal

The goal of this project is to develop a pot which can detect the environment. By using the photo sensor, if some one is getting close to the plant, the sensor will detect the changing of the light and send the data to the Particle. Then Particle will control the servo to rotate and the pot will be powered to vibrating as a signal to the offender. At the same time, the message will be sent to the cloud to notice the host that there are someone try to touch the plant.

0

Process

Components Used

10 kohm resistor

1 - servo motor

2 - photoresistor

1 - switch

1 - Particle Photon & breadboard

Jumper cables

colored papers,

plastic papers

foam

0
int servoPin = A5;
Servo myServo;
int servoPos = 0;
int lightPin1 = A0;
int lightPin2 = A1;
String trigger = "50";
int switchPin = D0;



void setup() {

 // attaches the servo on the A7 pin to the servo object
 myServo.attach( A5 );

  //Register our Particle to control the servo
  Particle.function("servo", servoControl);

 // Keep a cloud variable for the current position
 Particle.variable(  "servoPosition" , servoPos);
 Serial.begin(9600);  //Begin serial communcation
     pinMode( A1, OUTPUT );
     pinMode(lightPin1, INPUT);
     pinMode(lightPin2, INPUT);
 pinMode( switchPin , INPUT_PULLUP);
}

void loop() {
  //Write the value of the photoresistor to the serial monitor.
      //analogWrite(A1, analogRead(lightPin)/4);  //send the value to the ledPin. Depending on value of resistor
              //Serial.println(A1);
              int buttonState = digitalRead( switchPin );
    int a1 =  analogRead(lightPin1)/4;
    int a2 =  analogRead(lightPin2)/4;
    Serial.println((a1-a2));                                   //you have  to divide the value. for example,
if( buttonState == HIGH )
{
    if(a1>=a2)
    {
      if((a1-a2)<=50)
      {
        servoControl( "90" );
        }                                       //with a 10k resistor divide the value by 2, for 100k resistor divide by 4.
     else if((a1-a2)<=100)
     {
       servoControl( "110" );
     }else if((a1-a2)<=150)
     {
       servoControl( "130");
     }else if((a1-a2)<=200){
       servoControl( "150");
     }else if((a1-a2)<=250){
        servoControl( "170");
     }else if((a1-a2)<=300){
       servoControl( "180");
     }
     } else if(a1<a2)
     {
       if((a2-a1)<=50)
       {
         servoControl( "90" );
         }                                       //with a 10k resistor divide the value by 2, for 100k resistor divide by 4.
      else if((a2-a1)<=100)
      {
        servoControl( "70" );
      }else if((a2-a1)<=150)
      {
        servoControl( "50");
      }else if((a2-a1)<=200){
        servoControl( "30");
      }else if((a2-a1)<=250){
         servoControl( "10");
      }else if((a2-a1)<=300){
        servoControl( "5");
      }

     }
   }
}


int servoControl(String trigger)
{    // Convert
  int newPos = trigger.toInt();
  // Make sure it is in the right range
  // And set the position
  servoPos = constrain( newPos, 0 , 180);

  // Set the servo
  myServo.write( servoPos );

  // done

  return 1;
}
Click to Expand
0

Outcome

As the video shows below, when I close the switch and try to touch the plant, there is nothing happened. When I open the switch and try to touch the plant again, the pot start to vibrating. And at the same time, I got some notification on my phone saids: Help!! Someone is touching me!! For the next step, I will add some sound alert and maybe can add camera to monitor the environment of the plant.
0
Don't touch me!
Xingsuo Liu - https://vimeo.com/153576026
0

Reflection

By completing this project, I learn more about how to use Particle platform to develop Iot Product, know more about how to use different basic components to build a wholistic object and give me some new thought about the core of the Iot, which is lied on data flowing and exchanging. I think I can do some better work in the future after this project

x
Share this Project

Courses

49-713 Designing for the Internet of Things

· 4 members

This course charts the emergence of the now "connected world" to explore the possibilities for future products and connected spaces.


About

The purpose of this project is to design a smart pot that can detect if someone will touch it and can send this message to the host. By doing this, I hope it can keep it's safety and prevent it from destroying by others