Lucas PopanPatrick Lichtenwalner
Published © GPL3+

Autoshot | MEGR 3171 IOT Project | Group 28

Sit back and relax while the Autoshot pours the perfect shot with the press of a button.

BeginnerFull instructions provided258
Autoshot | MEGR 3171 IOT Project | Group 28

Things used in this project

Hardware components

Argon
Particle Argon
×2
Jumper wires (generic)
Jumper wires (generic)
×1
Breadboard (generic)
Breadboard (generic)
×2
4 AA Batter Case Holder
×2
Food Grade Hose
×1
DC 12 V Mini Water Pump
×1
USB-A to Micro-USB Cable
USB-A to Micro-USB Cable
×2

Software apps and online services

Particle Build Web IDE
Particle Build Web IDE
Mobicle
ControlEverything.com Mobicle
Google Sheets
Google Sheets
Maker service
IFTTT Maker service

Hand tools and fabrication machines

Hot glue gun (generic)
Hot glue gun (generic)

Story

Read more

Schematics

Project Schematic

Cloud Data

Google Sheets plot of AutoShot dispensing.

Code

Publish

C/C++
This is the code for the argon that triggers the D7 pin and publishes an event to the cloud
// *                          |          +-----+          |
 //*                          | [ ] RST               __  |
 //*                          | [ ] 3V3              |    |
 //*                          | [ ] MD               |__  |
 //*                          | [ ] GND                   |
 //*                          | [ ] A0            LI+ [ ] |
 //*                          | [ ] A1            EN  [ ] |
 //*                          | [ ] A2           VUSB [ ] |
 //*                          | [ ] A3  [M]  [Re]  D8 [ ] |
 //*                          | [ ] A4             D7 [*] |<-LED is jumpered to pin D0 (digitalWrite)
 //*                          | [ ] A5  +-------+  D6 [ ] |
 //*                          | [ ] D13 |   *   |  D5 [ ] |
 //*                          | [ ] D12 | Argon |  D4 [ ] |
 //*                          | [ ] D11 |       |  D3 [ ] |
 //*                          | [ ] D10 +-------+  D2 [ ] |
 //*                          | [ ] D9             D1 [ ] |
 //*                          | [ ] NC             D0 [*] |<-This pin reads signal from the D7 pin (digitalRead)
 //*                          |                           |
 //*                           \    []         [______]  /
 //*                            \_______________________/
 //*
//The D7 pin is jumpered to the D0 pin.  





int led = D7;
int lightsensor = D0;
int val = 1;

void setup() 
{
pinMode(led, OUTPUT);
pinMode(lightsensor, INPUT_PULLDOWN);


digitalWrite(led, HIGH);
digitalWrite(led, LOW);

Particle.function("togglelights", togglelights);

}

int togglelights(String command){
    if(command == "On" || command == "on" || command == "ON"){
        digitalWrite(led,LOW);
        return 1;
    }
 else if (command=="off") {
        digitalWrite(led,HIGH);
    
        return 0;
}
else {
    return -1;
}
}

void loop() {
    
    val = digitalRead(lightsensor);
    digitalWrite(led, val);

 
    if(digitalRead(lightsensor) == 1){
        Particle.publish("Patricks_Argon","flowin",60);
    }
   else 
   {delay(3000);
   }
}

Subscribe

C/C++
This is the code for the argon that subscribes to the event and turns on the relay
// *                               |          +-----+          |
 //*                               | [ ] RST               __  |
 //*                               | [ ] 3V3              |    |
 //*                               | [ ] MD               |__  |
 //* GND connect to GND on relay-->| [*] GND                   |
 //*                               | [ ] A0            LI+ [ ] |
 //*                               | [ ] A1            EN  [ ] |
 //*                               | [ ] A2           VUSB [*] |<-- connects to vcc on relay
 //*                               | [ ] A3  [M]  [Re]  D8 [ ] |
 //*                               | [ ] A4             D7 [*] |<-- connects to IN1 on relay
 //*                               | [ ] A5  +-------+  D6 [ ] |
 //*                               | [ ] D13 |   *   |  D5 [ ] |
 //*                               | [ ] D12 | Argon |  D4 [ ] |
 //*                               | [ ] D11 |       |  D3 [ ] |
 //*                               | [ ] D10 +-------+  D2 [ ] |
 //*                               | [ ] D9             D1 [ ] |
 //*                               | [ ] NC             D0 [ ] |
 //*                               |                           |
 //*                                \    []         [______]  /
 //*                                 \_______________________/
 //*

int led = D7;


void setup() {

    pinMode(led, OUTPUT);
    digitalWrite(led, HIGH);

    Particle.subscribe("Patricks_Argon", pumpOn);

}

void loop (){
    
}

void pumpOn(const char *event, const char *data)
{

digitalWrite(led, LOW);

  // We'll leave it on for 0.7 seconds...
  delay(700);


  // Then we'll turn it off...
  digitalWrite(led, HIGH);
  


}

Credits

Lucas Popan

Lucas Popan

1 project • 0 followers
Patrick Lichtenwalner

Patrick Lichtenwalner

1 project • 0 followers

Comments

Add projectSign up / Login