IoT Smart Home - Feeding pets remotely using smartphone

Written by obniz.io | Published 2018/07/27
Tech Story Tags: javascript | iot-smart-home | feeding-pets-remotely | feeding-pets-from-phone | iot

TLDRvia the TL;DR App

Do you want to feed your pets when you are not at home? This feeding machine can be controlled on the web browser using smartphone from anywhere.

Feeding cat with obniz

Things used in this project

  • Obniz
  • Battery or USB adaptor & cable
  • Screw and pipe
  • Servo motor ( unlimited rotation)
  • Pet food — as much as possible

Step 1 — setting up obniz

You just need to follow three steps to set up your obniz.

  1. Connect obniz to wifi
  2. Connect devices like LED or motors to obniz
  3. Scan QR code of obniz and start programming. You do not need to install any software.

Step 2

Cut pipes and prepare the screw. I made the screw by using 3D printer. Then, connect screw to a motor and put them into a box.

Step 3

Now you need to connect the servo motor to obniz as below.

io0: GND,

io1: VCC,

io2: signal

And then power up your obniz.

Step 4

Write codes below and put food into the bottle. Food will come out from the pipe.

Feed your pet!

You just need to open HTML on your browser with your smartphone. Now you are ready to feed your pet from anywhere!

Program

<!-- HTML Example --><!DOCTYPE html><html><head><script src="https://code.jquery.com/jquery-3.2.1.min.js" crossorigin="anonymous"></script>

<script src="https://unpkg.com/[email protected]/obniz.js"></script></head>

<body><div id="obniz-debug"></div><br><div class="text-center"><h1> Pet Feeder </h1></div>

<button id="meal">Feeding</button><div id="dispMeal"></div>

<script>

function getTime(){var dateTime=new Date();var hour = dateTime.getHours();var minute = dateTime.getMinutes();return hour + ":" + minute;}

/* This will be over written on obniz.io webapp page */var obniz = new Obniz("OBNIZ_ID_HERE");

obniz.onconnect = async function () {var numberOfMeal = 0;var lastTimeMeal;$("#dispMeal").text("Number of feeding : "+numberOfMeal)var servo = obniz.wired("ServoMotor", {gnd:0, vcc:1, signal:2});

$("#meal").click(async function(){numberOfMeal++;lastTimeMeal = getTime();$("#dispMeal").text("Number of feeding : "+numberOfMeal+", The last time : "+lastTimeMeal)servo.angle(0.0);await obniz.wait(10000);servo.angle(6.9);})}

</script></body></html>

For more information on the project please visit here


Published by HackerNoon on 2018/07/27