Software apps and online services

Story

This project came about because I wanted to be able to feed my dog while I wasn't home. Using an old cereal container was the perfect vessel to automate a dog feeder. The device simply replaces the hand crank with a stepper motor to turn the silicon butterfly gear instead of having to do it manually. The best part is that it can be controlled by my smartphone via the Blynk app. I figured that I would probably not be the best judge of when my dog was going to be hungry so I decided to add a force pad so that my four-legged friend could feed himself.

The Idea would be that the force sensor would be set on a delay of an hour, so he wouldn't over-serve himself. The force pad would tell the photon to turn the stepper motor a predetermined number of rotations so that the right amount of food would come out, the same that would happen when triggered from my smartphone. After the device was assembled I tested it and had to change the scope of the project. The stepper motor could not apply enough torque to allow the gear to turn with the bulky dog food. Further testing with cereal and granola determined that this particular set-up works best with small, granular foods. The pressure pad turned into a back up to using a smartphone. If I didn't have my smartphone I could still tap the pad to make the machine serve me a bowl of cereal.

1 / 3

This project would probably benefit from a larger stepper motor for larger food items but as-is, this project works great for small food dispensary!

Controlling a Stepper Motor with an H Bridge

Code

Food Dispenser Code

C/C++

This is the whole code for the Food Dispenser

#define BLYNK_PRINT Serial// This #include statement was automatically added by the Particle IDE.#include<blynk.h>// This #include statement was automatically added by the Particle IDE.#include<Stepper.h>//#include <Stepper.h>charauth[]="b6e6d2da0de14ea48f4d1070c99384d2";constintstepsPerRevolution=512;// change this to fit the number of steps per revolution// for your motorintpressurePad=D2;intLED=D1;intpressure;// initialize the stepper library on pins 8 through 11:SteppermyStepper(stepsPerRevolution,3,4,5,6);voidsetup(){// set the speed at 60 rpm:myStepper.setSpeed(3);// initialize the serial port://Serial.begin(9600);pinMode(pressurePad,INPUT);pinMode(LED,OUTPUT);Blynk.begin(auth);Serial.begin(9600);Serial.println("Start");}voidloop(){//digitalWrite(LED, HIGH);Serial.println("light on");Blynk.run();pressure=digitalRead(pressurePad);Serial.println(pressure);if(pressure==HIGH){digitalWrite(LED,HIGH);// step one revolution in one direction://Serial.println("clockwise");myStepper.step(stepsPerRevolution);// delay(500);}else{digitalWrite(LED,LOW);}}BLYNK_WRITE(V1){if(param.asInt()==1){// On button down...Serial.println("Blynk Recieved");digitalWrite(LED,HIGH);// step one revolution in one direction://Serial.println("clockwise");myStepper.step(stepsPerRevolution);// delay(500);// Tweeting!// Note:// We allow 1 tweet per minute for now.// Twitter doesn't allow identical subsequent messages.// Blynk.tweet("My Particle project is tweeting using @blynk_app and it’s awesome!\n @Particle #IoT #blynk");// Pushing notification to the app!// Note:// We allow 1 notification per minute for now.//Blynk.notify("You pressed the button and I know it ;)");}}// step one revolution in one direction:// Serial.println("clockwise");//myStepper.step(stepsPerRevolution);// delay(500);// step one revolution in the other direction:// Serial.println("counterclockwise");//myStepper.step(-stepsPerRevolution);//delay(500);

Controlling a Stepper Motor with an H Bridge

C/C++

This Code is from New York University and it helped me get the motor working.

#include<Stepper.h>constintstepsPerRevolution=512;// change this to fit the number of steps per revolution// for your motor// initialize the stepper library on pins 8 through 11:SteppermyStepper(stepsPerRevolution,8,9,10,11);voidsetup(){// set the speed at 60 rpm:myStepper.setSpeed(10);// initialize the serial port:Serial.begin(9600);}voidloop(){// step one revolution in one direction:Serial.println("clockwise");myStepper.step(stepsPerRevolution);delay(500);// step one revolution in the other direction:Serial.println("counterclockwise");myStepper.step(-stepsPerRevolution);delay(500);}