Michael Canto
Published

Lane Tech PCL ~ Stuff Dispenser Via Voice Command

I tell my Amazon Alexa to dispense necessary items onto my palms when I ask for them.

IntermediateFull instructions provided89
Lane Tech PCL ~ Stuff Dispenser Via Voice Command

Things used in this project

Hardware components

Argon
Particle Argon
×1
Breadboard (generic)
Breadboard (generic)
×1
Stepper Motor
Digilent Stepper Motor
×1
Male/Female Jumper Wires
Male/Female Jumper Wires
×1
Echo Dot
Amazon Alexa Echo Dot
×1

Software apps and online services

Amazon Alexa service
IFTTT Amazon Alexa service
Particle Build Web IDE
Particle Build Web IDE

Hand tools and fabrication machines

Hot glue gun (generic)
Hot glue gun (generic)
Tape, Duct
Tape, Duct

Story

Read more

Schematics

Stepper Motor Pins

I know this is the pins for an arduino uno, but for a particle argon, everything is pretty much the same except instead of using a 5V adapter, you use the VUSB pin on your argon.

Code

Stepper Motor Code

C/C++
My code is fairly simple, as I only want my stepper motor to turn 500 steps forward and back only when I call Alexa.
I used particle IDE for my code and you must include a stepper library on your code in order for this to all work. On line 13, I set up a function that allows the code be recognized and called by Alexa.
After the stepper motor finishes it's movement forward and back (lines 23-29), I made sure to set my bool variable "voiceCommandOn" back to false (line 35) so you can keep calling the dispenser forever and ever!
#include <Stepper.h>

const int stepsPerRevolution = 2048;

const int turnRevolution = -500;

bool voiceCommandOn = false;

Stepper myStepper(stepsPerRevolution, 2, 4, 3, 5);

void setup() {
     
  Particle.function("MichaelHA", startStepper);
  myStepper.setSpeed(10);
  Serial.begin(9600);
}

void loop() {
    
    
    if ( voiceCommandOn )
    {
        Serial.println("clockwise");
        myStepper.step(500);
         delay(500);
       
        Serial.println("counterclockwise");
        myStepper.step(-500);
        delay(1000);
     if (turnRevolution == -500)
        {
            Serial.println("stop");
            delay(500);
            
            voiceCommandOn = false;
        }
    } 
}

  int startStepper(String param) 
  {
    
    voiceCommandOn = !voiceCommandOn;
    
    return 0;
  }
  

Credits

Michael Canto

Michael Canto

1 project • 0 followers

Comments

Add projectSign up / Login