paint-brush
IoT Smart Home - Feeding pets remotely using smartphoneby@obniz.io
812 reads
812 reads

IoT Smart Home - Feeding pets remotely using smartphone

by ObnizJuly 27th, 2018
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

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.
featured image - IoT Smart Home - Feeding pets remotely using smartphone
Obniz HackerNoon profile picture

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