Skills Dev IV: Working with Outputs - Motors and Movement

Made by bmkaufma · UNLISTED (SHOWN IN POOLS)

Turn on a fan when a new photo is uploaded to my iCloud

Created: December 14th, 2022

0

Outcome

    The outcome of this lab was a successful circuit and code that operated as intended. The circuit consists of a Particle Argon board, a pushbutton, a transistor, a diode, a resistor, and a fan. The fan is configured to turn on for one second every time a new photo is added to my icloud account. 

0

Process

The first step in creating the device was to assemble the circuit. This circuit was a little more complex than the ones we have worked with in the past. Because this circuit use a fan, a transistor was required to satisfy the higher power consumption. The transistor is placed in between the external power supply and the fan, so that the argon can turn the fan on and off, but utilize the external power to actually run the fan. Once the circuit was assembled, the code was written to have a cloud function that would trigger the fan when called. This was then integrated with a webhook in IFTTT. This webhook is configured to trigger when a new photo is added to my icloud. This required downloading the IFTTT app to my phone to monitor my photos and trigger when a new one is added.

0

Reflection

This was a fun lab to work on because I got to learn how to use higher powered components than LEDs or Neopixels. It didn't occur to me that you would have to modify the circuit design to incorporate a higher powered device. I also enjoyed figuring out what cloud integration I was going to use for this lab. I hadn't browsed the entire IFTTT catalog before this, but I took the time to look through all of the services you can integrate and was surprised to see that there was one that could handle icloud photos. I would have thought this would be too complicated to integrate, but IFTTT made it simple.

0
int solPin = D2;

bool shouldActivate = false;

void setup()
{
  Particle.function( "activate", activateSolenoid );
  Particle.function( "speed", setSpeed);

  pinMode(solPin, OUTPUT);

}

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

  }
  delay( 100 );

}

void doSolenoid(  ){
     digitalWrite(solPin, HIGH);

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


int activateSolenoid( String command ){
  shouldActivate = true;
  return 1;

}

int setSpeed( String command){
    int speed = command.toInt();
    analogWrite(solPin, speed);
    return 1;
}
Click to Expand
x
Share this Project

This project is only listed in this pool. Be considerate and think twice before sharing.


Courses

About

Turn on a fan when a new photo is uploaded to my iCloud