Project in progress

AMOORA (Dog Food Dispenser)

A dog food dispenser that you can control actions through a responsive webpage (ESP8266 as web server).

  • 499 views
  • 1 comment
  • 3 respects

Components and supplies

Apps and online services

About this project

Inspired by my sister's pet, Amora.

I'm still improving this project, mainly structural components that are only a prototype so far.

My sister works a lot and we can't help her to take care of Amora, so I decided to create something to help her to do it (in almost all your basic needs) even when she's not at home.

That's the first step that I want to come it bigger and improved, to help more and more people (and for sure i'm with arms wide open to constructive opinions :).

In this first step the idea is plays a music to warn that the food will be delivered, controlled through an interface hosted in a website.

The wheel goes one time to deliver the food (that was already filled) and come up to be fullfilled again and deliver one more time (or how many times you want). It means that I just project a simple wheel right now, but it's necessary to project the compartment responsible to fill this wheel.

And that's my user interface so far:

Hey guys I'm Amora, by the way.

This is my first project and I hope you enjoy it!

Thanks! :-)

Code

User Interface (complement)CSS
Style for user interface.
.logo{
    width: 10%;
    float: right;
    position: absolute;
    top: 20px;
    right: 20px;
}

.logo_nome {
    font-family: 'Indie Flower', cursive;
    text-transform: uppercase; 
    float: right;
    position: absolute;
    top: 140px;
    right: 30px;
}

div {
    font-family: 'Indie Flower', cursive;
    position: relative;
    font-weight: thin;
    top: 100px;
    left: 100px;
}

.row{
    position: absolute;
    top: 280px;
    left: 50px;
}


.agua{
    float: left; 
    margin-left: 150px;
}

.agua:hover {
    transform: scale(0.9);
    color: green;
}

.agua_img{
    width: 150px; 
    height: 150px;
    border-radius: 50%;
    border:4px solid black;
}

.racao:hover {
    transform: scale(0.9);
    color: green;
}

.racao{
    float: left;
    margin-left: 150px;
}

.racao_img{
    width: 150px; 
    height: 150px;
    border-radius: 50%;
    border:4px solid black;
}

.webcam:hover {
    transform: scale(0.9);
    color: green;
}

.webcam {
    float: left;
    margin-left: 150px;
}

.webcam_img{
    width: 150px; 
    height: 150px;
    border-radius: 50%;
    border:4px solid black;
}

footer {
    color: grey;
    font-family: Verdana, Geneva, Tahoma, sans-serif;
    position: absolute;
    bottom: 0px;
    left: 500px;
    opacity: 0.7;
}
Basic code ( no communication w/ esp8266)Arduino
Plays music to warn that food will be delivered.
#include <Servo.h> 

Servo servo_motor;  //controle da posio do servo-motor

//notas para msica do buzzer
const int a = 440;
const int f = 349;
const int cH = 523;
const int eH = 659;
const int fH = 698;
const int gS = 415;

int contador = 0; //contador musica
int led_verde = 11; // LED verde no pino PWM 11
int led_vermelho = 13;  //LED vermelho no pino digital 13 
int buzzer = 2; //Buzzer no pino digital 2
int pos = 0;
int i = 0;

void setup() 
{ 
  pinMode(buzzer, OUTPUT); 
  servo_motor.attach(9); //servo-motor no pino PWM 9
  pinMode(led_verde, OUTPUT); 
  pinMode(led_vermelho, OUTPUT); 

  servo_motor.write(0); //orienta o servo_motor a iniciar em 0
  
  //Toca msica para avisar que a comida ser dispensada
  tocarMusica();
  
  //Roda dosadora (servo_motor) comea a girar e dispensar a comida
  for(i = 0; i < 3; i += 1)
  {
        for(pos = 0; pos < 180; pos += 1) // vai de zero a 0 to 179
          {                                 
            servo_motor.write(pos);  // vai para a posio armazenada em 'pos'
            delay(15);  // servo_motor espera 15ms para mover 
          } 
      for(pos = 180; pos>=1; pos-=1) /// vai de 179 para 0
          {                                
            servo_motor.write(pos);              
            delay(15);                       
          } 
      delay(3000); //aguarda 3s antes de iniciar a prxima retetio
      i++;
  }
}

void loop() 
{  
}
 
void beep(int nota, int duracao)
{
  //toca musica no buzzer
  tone(buzzer, nota, duracao);
 
  //Dependendo do valor do contador, piscam LEDs diferentes
  if(contador % 2 == 0)
  {
    digitalWrite(led_vermelho, HIGH);
    delay(duracao);
    digitalWrite(led_vermelho, LOW);
  }else
  {
    digitalWrite(led_verde, HIGH);
    delay(duracao);
    digitalWrite(led_verde, LOW);
  }
 
  //Stop tone on buzzerPin
  noTone(buzzer);
 
  delay(50);
 
  //Increment counter
  contador++;
}
 
void tocarMusica()
{
  beep(a, 500);
  beep(a, 500);    
  beep(a, 500);
  beep(f, 350);
  beep(cH, 150);  
  beep(a, 500);
  beep(f, 350);
  beep(cH, 150);
  beep(a, 650);
 
  delay(500);
 
  beep(eH, 500);
  beep(eH, 500);
  beep(eH, 500);  
  beep(fH, 350);
  beep(cH, 150);
  beep(gS, 500);
  beep(f, 350);
  beep(cH, 150);
  beep(a, 650);
 
  delay(500);
}
 
User Interface HTML
There are some buttons on the page that it's possible to control the food dispenser.
<!DOCTYPE html>
<html>
<head>
<title>Amoora</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Google Fonts -->
<link href="https://fonts.googleapis.com/css?family=Indie+Flower" rel="stylesheet">
<!-- Arquivo de Estilo - CSS -->
<link rel="stylesheet" type="text/css" href="estilo.css">
</head>

<body>
    <img src="img/amoora_logo.jpg" class="logo" alt="Logo do site Amoora">
    <h1 class="logo_nome">Amoora</h1>
    <div class="container">
        <main>
            <h3>Aqui você garante que nada vai faltar para seu melhor amigo!
            <br/><br/>
            AMOORA foi elaborado para você poder monitorar a distancia: ração, água e petCareCam.
            <br/><br/></h3>
        </main>
        <section>
            <h3>O que você deseja fazer?<br/><br/>
            <b>Clique nos botões abaixo </b> e escolha:</h3>
        </section>
    </div>
    <div class="row" align="center">
        <div class="agua"> <a href="#agua"> <img src="img/agua.jpg" alt="botão para liberar água" class="agua_img"></a> <h3>Água</h3> </div>
        <div class="racao"> <a href="#racao"> <img src="img/racao.jpg" alt="botão para liberar ração" class="racao_img"></a> <h3>Ração</h3> </div>
        <div class="webcam"> <a href="#webcam"> <img src="img/webcam.png" alt="botão para acionar webcam" class="webcam_img"></a> <h3>petCareCam</h3> </div>
    </div>
          
    <footer><h5>Copyright © 2008 Design by Amoora Corp.</h5></footer>
</body>

</html>
Communication w/ ESP8266 (unfinished)Arduino
ESP8266 as webserver, communication with arduino via browser.
#include "SoftwareSerial.h"
#include <Servo.h> 

Servo servo_motor;  //controle da posição do servo-motor

int pos = 0;

SoftwareSerial ESP_Serial(5, 6); // RX, TX

String rede = "Nome_da_suarede_Wifi"; 
String senha = "Senha_da_suarede_Wifi";
String resposta = "";

void setup() {
  Serial.begin(9600);
  ESP_Serial.begin(9600);

  Serial.println("Inicializando...");
  delay(1000);

  Serial.println("Conectando a rede...");
  String CWJAP = "\"AT+CWJAP=\"";
  CWJAP += rede;
  CWJAP += "\",\"";
  CWJAP += senha;
  CWJAP += "\"";
  sendCommand(CWJAP);
  readResponse(10000);

  delay(2000); 

  if (resposta.indexOf("OK") == -1) { //procura na resposta se houve OK
    Serial.println("Atencao: Nao foi possivel conectar a rede WiFi.");
    Serial.println("Verifique se o nome da rede e senha foram preenchidos corretamente no codigo e tente novamente.");
  } else {

    Serial.println("Obtendo endereco de IP na rede...");
    sendCommand("AT+CIFSR");
    readResponse(1000);

    Serial.println("Configurando para multiplas conexoes...");
    sendCommand("AT+CIPMUX=1");
    readResponse(1000);

    Serial.println("Ligando servidor...");
    sendCommand("AT+CIPSERVER=1,80");
    readResponse(1000);

    Serial.print("Pronto, acesse o IP atraves de um dispositivo ligado na mesma rede do ESP8266.");
  }
}

void loop() {
  if (ESP_Serial.available()) {
    //.find le os dados vindos da serial ate o alvo, neste caso +IPD,
    if (ESP_Serial.find("+IPD,")) {
      delay(500);
      char id = ESP_Serial.peek();//pega ID da conexao
      
      //pagina web teste em HTML
      String webpage = String("HTTP/1.1 200 OK\r\n") +
                        "Content-Type: text/html\r\n" +
                        "Connection: close\r\n" +
                        "\r\n" +
                        "<!DOCTYPE HTML>" +
                        "<html>" +
                        "<h1>" +
                        "Tenho fome..." +
                        "</h1>"+
                        "<a href=\"?function=dosarRacao\"><button>Liberar Racao</button></a>";
                        "</html>"
                        "\r\n";
     
      String cipSend = "AT+CIPSEND=";
      cipSend += (int(id) - 48);
      cipSend += ",";
      cipSend += webpage.length();
      Serial.println(webpage.length());
      sendCommand(cipSend);
      readResponse(500);

      sendCommand(webpage);
      readResponse(750);

      String closeCommand = "AT+CIPCLOSE=";
      closeCommand += (int(id) - 48);
      sendCommand(closeCommand);
      readResponse(750);
    }
  }
}

void dosarRacao()
{
  //Roda dosadora (servo_motor) começa a girar e dispensar a comida
     for(i = 0; i < 3; i += 1)
  {
        for(pos = 0; pos < 180; pos += 1) // vai de zero a 0° to 179°
          {                                 
            servo_motor.write(pos);  // vai para a posição armazenada em 'pos'
            delay(15);  // servo_motor espera 15ms para mover 
          } 
      for(pos = 180; pos>=1; pos-=1) /// vai de 179° para 0°
          {                                
            servo_motor.write(pos);              
            delay(15);                       
          } 
      delay(3000); //aguarda 3s antes de iniciar a próxima retetição
      i++;
  }
} 

void sendCommand(String cmd) {
  ESP_Serial.println(cmd);
}

void readResponse(unsigned int timeout) {
  unsigned long timeIn = millis(); //momento que entramos nessa funcao é salvo
  resposta = "";
  //cada comando AT tem um tempo de resposta diferente...
  while (timeIn + timeout > millis()) {
    if (ESP_Serial.available()) {
      char c = ESP_Serial.read();
      resposta += c;
    }
  }
  Serial.println(resposta);
}

Custom parts and enclosures

Images user interface - 1/4
Amoora logo ajza75ciqh
Images user interface - 2/4
Agua 9opexyuqdl
Images user interface - 3/4
Racao xjhcvwokjv
Images user interface - 4/4
Webcam d1pv0sllc6

Schematics

Arduino + ESP8266
Esquema arduino hsxyuvcmae

Comments

Similar projects you might like

Arduino Bluetooth Basic Tutorial

by Mayoogh Girish

  • 455,068 views
  • 42 comments
  • 239 respects

Home Automation Using Raspberry Pi 2 And Windows 10 IoT

Project tutorial by Anurag S. Vasanwala

  • 285,505 views
  • 95 comments
  • 671 respects

Security Access Using RFID Reader

by Aritro Mukherjee

  • 229,362 views
  • 38 comments
  • 236 respects

OpenCat

Project in progress by Team Petoi

  • 195,951 views
  • 154 comments
  • 1,361 respects
Add projectSign up / Login