ardutronic
Published © CC BY-NC-SA

DIY Automatic Pill Dispenser

My younger brother and sister, have to take medication every day. I figured I could spice it up a bit by creating my own dispenser.

IntermediateFull instructions provided5 hours3,544

Things used in this project

Hardware components

ESP8266 ESP-12E
Espressif ESP8266 ESP-12E
×1
Microchip TC2117
×1
Microchip MCP7940M
×1
Microchip MIC2288
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Custom parts and enclosures

Dispenser

Schematics

PCB

Schematic

Code

Code

Arduino
#include <Stepper.h>

const int stepsPerRevolution = 200; // change this to fit the number of steps per revolution

// initialize the stepper library on pins D5 to D8
Stepper myStepper(stepsPerRevolution, 13, 14, 12, 16);
int stepCount = 0;
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <Servo.h>

Servo servo;
#include <BlynkSimpleEsp8266.h>
char auth[] = "auth";
int stan;
int stan1;
int stan2;
int val = 50;

void setup()
{
  Serial.begin(9600);
  servo.attach(4);
  Blynk.begin(auth, "name", "pass");
  pinMode(2, OUTPUT);
  myStepper.setSpeed(60);
}

BLYNK_WRITE(V0) // V5 is the number of Virtual Pin
{
  stan = param.asInt();
}

BLYNK_WRITE(V1) // V5 is the number of Virtual Pin
{
  stan1 = param.asInt();
}

BLYNK_WRITE(V3) // V5 is the number of Virtual Pin
{
  servo.write(param.asInt());
}

void loop()
{
  Blynk.run();
  if (stan)
  {
    myStepper.step(val);
    delay(10);
  }

  if (stan1)
  {
    myStepper.step(-val);
    delay(10);
  }


}

Credits

ardutronic

ardutronic

39 projects • 37 followers
I'm 20 years old student of electronic technical college. I'm passionate about electronics as well as editing movies

Comments