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
You just need to follow three steps to set up your obniz.
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.
Now you need to connect the servo motor to obniz as below.
io0: GND,
io1: VCC,
io2: signal
And then power up your obniz.
Write codes below and put food into the bottle. Food will come out from the pipe.
You just need to open HTML on your browser with your smartphone. Now you are ready to feed your pet from anywhere!
<!-- 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