Skills Dev IV: Working with Outputs - Motors and Movement

Made by Yi Sun

Created: December 11th, 2022

0

Outcome

    • In this project, I chose fan as my output. I used it to remind user if the wind is strong today. By connecting it with a cloud function, if the wind intensity is larger than 2000, fan will be triggered. It will blow up the "hair" of a little paper man, and indicates that it is windy.
    • Video: https://youtube.com/shorts/3xPPA4rGbu4

0
int solPin = D2;

bool shouldActivate = false;

void setup()
{
  Particle.function( "windIntensity", activateSolenoid );

  pinMode(solPin, OUTPUT);
}

void loop()
{
  if( shouldActivate ){
    doSolenoid(  );
    shouldActivate = false;

  }
  delay( 100 );

}

void doSolenoid( ){
  for( int i = 0; i < 5; i++ )
  {
    digitalWrite(solPin, HIGH);
    delay( 2000 ) ;
    digitalWrite(solPin, LOW);
    delay( 1000 );
  }
}


int activateSolenoid( String command ){
    int intensity = command.toInt();
    if (intensity>2000){
        shouldActivate = true;
    }
  return 13;

}
Click to Expand
0

Process

I first built the circuit based on the graph on the website. At first I am using a solenoid. However, I failed to make it run. After using multimeter to test it, I found it was because the connection between wire and external power is too loose. But after fixing this problem, it still didn't work. Then I replaced the solenoid with fan and it works. It turns out to be that it needs higher voltage to trigger solenoid.

0

Reflection & Next Steps

I learned that unlike LED, some motors need extra power to trigger. I also got familiar with diode and transistor, and learned how to build circuits for motors and servos and control them.

This project helps us a lot in our final project, we got an idea of using servos to control our flower model. We need to further adjust parameters to decide proper value to pass to servo.

x