At 35:00 you go on to check the system locally and in doing so the time service status and the button service status are green and active. All of mine are yellow. Do you know what I have done wrong?
Yellow is shown when the site cannot determine if service is available. The site runs a similar command that is below to check status. What is returned when you run this command? sudo service feederButtonService.sh status
Hello, I’m having issue around 32:02, when I run the test, I have no Apache log files, just the buttonservice log and the feedertimeservice... I notice that the file we edited right before looked a bit different then the one on my screen so, I thought maybe that would fix it, but still unable to see the log files. Thanks in advance for any help
Can you share screenshot or text snippet of the Apache logrotate file before the test is run? If easier can email the details to the address listed in 'About' section of the channel page. A bearded dragon sounds awesome.
diy petfeeder thx for the quick reply! And as far the the difference in code, it’s the first ‘if’ block in /etc/logrotate.d/apache2, mine reads “if invoke-rc.d apache2 status > /dev/null 2>&1; then \ invoke-rc.d apache2 reload > /dev/null 2>&1; \ fi;” instead of yours at 31:14
Hello, first of all, thank you for this clear, super helpful video! i am trying to recreate the feeder to feed my dogs... could you tell me what are the changes that need to be made to each step to be able to control 2 motors and have the exact same features? thank you much
I am not sure I fully understand what your are asking for. You want 2 motors to control one feed container? Send me an email found in the channel description about what looking to do and we can discuss options.
Hello! I'm making this website for my an assignment in my class. I want to add a passive buzzer into this project and show how many bowls of food the cat has eaten today, and also change the background into a gif. Do you have any guidance on how to do add these into the code of the website? I've tried for the past 2 days and I still can't figure it out.
wonder how big of an hopper this could be modified to use, also how it could be modified to be used in an outdoors environment (ducks/chickens/horses etc)
Have my feeder up and running and it is working well. Thanks again for all your hard work. Have a couple of questions. 1. Running this on a pi zero w. Looking at top on the rpi, it is running feederBut+ at 95 to 99 % cpu. Is that something you are seeing on yours as well? Feeder Button service jumps up to 97% CPU as soon as it is restarted from the admin page. Any way to make it less of a CPU hog? 2. If I set the schedule to feed at 12:00 PM, it usually runs 2 -3 minutes after 12:00. Is this the expected behavior?
1) I'm running on pi 3B and usually takes around 15-25% cpu. The pi zero w has less power. I have never used a pi zero w yet but looking at the specs those numbers don't surprise me. If can spring for a pi4 or bigger version id recommend that. 2) Yes that is expected. The scheduler only checks ever 5 minutes for every past due feedings so that seems right. You can lower the check value but then your cpu will probably go up even more which I doubt you want.
Hi, we have been working on the group project and we are taking your project as a basis for development .Whenever we run our code to run motor, it just does opposite of the code. Runs infinitely and stops for 2 seconds. Is it caused by wiring issues or it is problem in code. Thanks. Please reply.
This is really awesome. Thing is that I'm using an orange pi and not a Raspberry pi. So it basically uses an entirely different library (wiringpi). I think most of the other devices i have are the same. Any advice in this situation? What do i have to do differently if I'm following your steps.
Great instructions. Was wondering if there was a way to have more than one rotation duration or use multiples of the hopper spin time. I feed my cats different amounts at different times of the day.
@@diypetfeeder1205 Is the Seconds_Delay_Between_Schedule_Checks=300 how often it checks the current time against the feed schedule. Notice that my food doesn't come out for 5 minutes following the scheduled time, but the display shows the last feed as the scheduled time. Any issues setting this to 60 so it checks every minute?
Hello we are trying to create a similar project, but we are also implementing a weight sensor ( Load cell HX711 weight sensor), would this be suitable for this type of design ?
Hi, I have the display that came with 4 pins in the back. it has an additional board soldered to it with a built-in potentiometer. Can you please help me wire it correctly? I found some info online and wired it, it tuns on and I can even use the terminal to load pre-written py files to show on the lcd but can’t get it to show the last feed times. Please help. thanks!
Without knowing anything about this new LCD it will be pretty difficult to help in great detail. However, you mentioned you currently can write to the screen so your best bet is to use to code that is current in your pre-written python file(s) and plug into the current python function that writes to the screen. Currently under commonTasks.py there is a function called print_to_LCDScreen which takes a whatever message is passed in and prints it to the screen. This function is used throughout the code. You can modify this current function with your current pre-written python file you have and that should get you going in the right direction.
How long the motor will rotate for is a configurable value in the config file. The config value is called Hopper_Spin_Time and the default is 0.6 seconds. The link below jumps to part of video showing how to access and modify the value in the file. After modifying it is best to restart both feeder services (through the admin page or terminal) to have the value change take effect. th-cam.com/video/bvon9nxhqHk/w-d-xo.html
My group and I are trying to build a pet feeder like yours but wanted to have it connect to Alexa and, hopefully, have an application that someone could go into and do all the things offered on the website. We have the Alexa portion sorta figured out, but what I wanted to know is if it's even possible to create an app that does the same stuff as the website? Is there an app that already exists that could connect the raspberry pi to an app without starting from scratch?
There is not an app the currently exists, but it is certainly possible to build one. In your app you could use the same 'trigger feed' URL endpoint you are calling with Alexa to also trigger a feeding. The other features on the site (like scheduling for example) don't currently have endpoints so they would also have to be coded. Feel free to submit a Pull request in gitlab if adding new features. I can also help with developing the endpoints if it is something you are serious about moving forward on and need some help.
I built this about a year ago, and it still works great! However, for some reason it might fire when we are using power from the outlet next to it, is there a fix to this, or is this an issue with my house wiring or something?
I have a similar issue as well with one of my outlets. My guess is its probably related to the pins on the pi getting false positives from a voltage change when light changes. The pi is a pretty small (cheap) device and the pins aren't shielded so that's my guess. I have not found a solution for it no unfortunately. I don't think its your house wiring.
Great tutorial, but I have a question, can you edit the website itself? I want to move some of the buttons to other areas and I want to add more images on the site so that it would not feel very empty.
Great guide, just spotted a small coding mistake while following: "pip install gspread gspread-formatting oauth2client" should be pip3 in your latest google docs guide. Thanks for putting this together, my cats will love it.
I guess the above is due to mod_wsgi not installing, it gives this error: File "/tmp/pip-install-urrx9jvb/mod-wsgi/setup.py", line 168, in 'missing Apache httpd server packages.' % APXS) RuntimeError: The 'apxs' command appears not to be installed or is not executable.
Sir ,I loved your idea and making . But i wanna make it as a robot, which means adding wheels to the pet feeder. Can you help me to write the code for motor wheels for moving the pet feeder for surveilling the dog whenever we r free outside.
Amazing tutorial thank you for sharing! I am running into an issue where my motor is constantly running and only turning off for a second when I press the button, I'm sure I've wired something wrong but I can't seem to find where. Any ideas about what to check please?
Yea sounds like something was wired wrong. Would check relay first, than everything plug into pi. I Reversing the mounts on the motor really only causes it to switch direction so I doubt its that.
I don’t use the same router company as you! How do I configure my router so I can put the IP address in it so I can move to the next step? Because when I put my router’s IP address in the URL it takes me to the feeder website
If you never logged in before often times the default user name password is on the back. If not would read manual which will tell you what the login is. Would change after to something more secure. After logging in should be able to find the correct settings by looking around in settings. Without knowing your exact router it is impossible to tell you where, but shouldn't be hard to find
Another question. Am I doing something wrong or is this a bug? When I add a daily feed to my schedule for example 12:00 PM and it is 6:00 PM, it runs a feed cycle. Can I only enter new daily schedules after midnight and before the time I want it to cycle?
The daily feeding schedule looks for an past due feedings for a day. Since your first scheduled is in the past for the for the first day it is triggered. The next day it should run as expected. If your initial schedule set is later then the actual time this shouldn't happen.
Thank you for doing this. I have a couple questions. Would I be able to set this up for two dispensers? I have two dogs, so I'd like to activate at the same time to two different bowls. Do you think the dispenser/motor would be able to handle larger dog food, especially if added to a larger hopper?
I think the motor would be able handle larger dog food. Will have to adjust the shoot and opening in the front obviously depending on the size. There will be a limit as to how much bigger the hopper can be before it is too heavy for the motor to spin. Not exactly sure what that limit would be though. I have seen others design a two shoots going down either side instead of one going down the middle. That could be an option as well.
Hello, i have some issue when i pressed the "feed now" button in step 32 , the website didnt update and show a warning : Database did not update: attempt to write a readonly database. It also happened after i logged in to the admin page. Can you guide me a bit on this issue?
The user which runs the website doesnt have write access to the database in the website folder. These permissions are usually granted in the createFiles.py script, not sure why yours did not work. You can run it manually though. Open a terminal and grant proper permissions . For ex.) sudo chmod 777 -R /var/www/feeder
How long the motor will rotate for is a configurable value in the config file. The config value is called Hopper_Spin_Time and the default is 0.6 seconds. The link below jumps to part of video showing how to access and modify the value in the file. After modifying it is best to restart both feeder services (through the admin page or terminal) to have the value change take effect. th-cam.com/video/bvon9nxhqHk/w-d-xo.html
@@diypetfeeder1205 I tried the Hopper_Spin_Time=0.6 to 1.0 but all this. Does is to delay the spin time between spins and does not extend the spring period. Any advice would be appreciated
@@arthurvanzyl @ataraxia440 Hopper_Spin_Time changes how long the hopper spins it does not delay the time between spins. The seconds_delay variables is responsible for the wait period after a button press. You may have they mixed up. Regardless make sure refresh Apache after saving the app.cfg for changes to take affect
Very well done video. Everything worked out so far. Which files would i have to edit in terms of configuring some of the gpio pins i order to set up another physical button for example. I am currently trying to add a water dispenser to the whole system (basically building the same system again which would dispense water)... I would be glad if you could throw me some pointers my way.
What kind of water dispenser are you using? Are you planning to use the relay to power it or the pi itself? If have a link to water dispenser could gave a better idea of what to do. In general want to do something similar then what is in the spin_hopper function in commontasks.py which is triggering gpio pins on and off.
Hi, I just implement the camera site and host on . I cannot access my page from outside by the duckdns. I type .duckdns.org:8080. Is there any difference of 8080 and 8081? How can I make my camera page accessible outside?
8080 is the admin page. 8081 is the dedicated video page (and is also the port that the website uses when you click on live video). You need to port forward 8081 to the pi just like did with port 80 to view from outside
Thanks so much for doing this! Had one question so far. For step 14-25 on the document am I supposed to copy and paste LoadModule wsgi_module "/usr/lib/apache2/modules/mod_wsgi-py37.cpython-37m-arm-linux-gnueabihf.so" or just the part in the quotation marks? "/usr/lib/apache2/modules/mod_wsgi-py37.cpython-37m-arm-linux-gnueabihf.so"
@@diypetfeeder1205 got it! Yea I finally got the updated logs, but the website doesn’t load locally, I keep getting a 500 internal server error. Any thoughts on why that may be?
I believe it is possible to get a USB camera working. You might have to change a few configs in motion set up. Can refer to their website for that. motion-project.github.io/. The site is currently to be plug and play with pi camera
Awesome video!! Am currently following the video to work on the pet feeder project. I ran into an issue while setting up the duckdns Just after I entered the command "Crontab -e" I was able to paste the code from duckdns but could not save the file... Due to that, I cannot access the feeder from the url remotely.
Spoke with Jonathan via email about this and this specific issue was due to fact that nano is no longer second choice of list of editors to pick from as I originally stated in the video. It is now first on the list. This response is more for others who may read this in the future. I have already updated the documentation and will eventually make an annotation to the video, but basically need to make sure nano is selected as the editor (wherever it is on the list)
Fantastic tutorial. I am very impressed with the level of detail. Wondering if you can guide me a bit. On step 32 and trying to test the 127.0.0.1 but getting internal server error. I have gone over the steps a number of times but can't seem to see what I missed. Python 3.7. All lines loaded without errors when cutting and pasting. But can't get website to work using 127.0.0.1. getting the following apache log errors. Any ideas? [Mon Dec 09 21:19:58.652546 2019] [wsgi:error] [pid 1496:tid 1940141088] [remote 127.0.0.1:50962] File "/var/www/feeder/feeder/app.py", line 9, in [Mon Dec 09 21:19:58.652588 2019] [wsgi:error] [pid 1496:tid 1940141088] [remote 127.0.0.1:50962] import commonTasks [Mon Dec 09 21:19:58.652654 2019] [wsgi:error] [pid 1496:tid 1940141088] [remote 127.0.0.1:50962] File "/var/www/feeder/feeder/commonTasks.py", line 7, in [Mon Dec 09 21:19:58.652693 2019] [wsgi:error] [pid 1496:tid 1940141088] [remote 127.0.0.1:50962] import gspread [Mon Dec 09 21:19:58.652836 2019] [wsgi:error] [pid 1496:tid 1940141088] [remote 127.0.0.1:50962] ModuleNotFoundError: No module named 'gspread' [Mon Dec 09 21:19:58.915980 2019] [wsgi:error] [pid 1496:tid 1931748384] [remote 127.0.0.1:50964] mod_wsgi (pid=1496): Failed to exec Python script file '/var/www/feeder/feeder/feeder.wsgi'. [Mon Dec 09 21:19:58.916361 2019] [wsgi:error] [pid 1496:tid 1931748384] [remote 127.0.0.1:50964] mod_wsgi (pid=1496): Exception occurred processing WSGI script '/var/www/feeder/feeder/feeder.wsgi'. [Mon Dec 09 21:19:58.917348 2019] [wsgi:error] [pid 1496:tid 1931748384] [remote 127.0.0.1:50964] Traceback (most recent call last): [Mon Dec 09 21:19:58.917697 2019] [wsgi:error] [pid 1496:tid 1931748384] [remote 127.0.0.1:50964] File "/var/www/feeder/feeder/feeder.wsgi", line 9, in [Mon Dec 09 21:19:58.917749 2019] [wsgi:error] [pid 1496:tid 1931748384] [remote 127.0.0.1:50964] from app import app as application [Mon Dec 09 21:19:58.917823 2019] [wsgi:error] [pid 1496:tid 1931748384] [remote 127.0.0.1:50964] File "/var/www/feeder/feeder/app.py", line 9, in [Mon Dec 09 21:19:58.917864 2019] [wsgi:error] [pid 1496:tid 1931748384] [remote 127.0.0.1:50964] import commonTasks [Mon Dec 09 21:19:58.917930 2019] [wsgi:error] [pid 1496:tid 1931748384] [remote 127.0.0.1:50964] File "/var/www/feeder/feeder/commonTasks.py", line 7, in [Mon Dec 09 21:19:58.917971 2019] [wsgi:error] [pid 1496:tid 1931748384] [remote 127.0.0.1:50964] import gspread [Mon Dec 09 21:19:58.918135 2019] [wsgi:error] [pid 1496:tid 1931748384] [remote 127.0.0.1:50964] ModuleNotFoundError: No module named 'gspread'
Yes need to go back and reload virtualenv feeder and also run this command. "pip install gspread gspread-formatting oauth2client". The instructions at step 12 have been updated. Apologies think you were setting up before had chance to update instructions.
sir i have a question . my backlight lcd screen doesnt show anything . i just testing without my potentioner knob . is it because i didnt my potentioner knob it become like that sir ?
@@diypetfeeder1205 sir my camera problem have been solved . thankyou sir . its just i plug in a pi camera cable in wrong direction . but now i have 1 more question sir . about my lcd . after i assemble the potentiometer . its show just a black bar . but doesnt show any digit or info . can i ask u why sir ? sorry if i have a lot of question . its because i take this project for my final year project sir . and i hope u can help
Hi, I would like to ask why the code for the motor is set to be high voltage at first then low and then high again? def spin_hopper(pin, duration): try: pin = int(pin) duration = float(duration) GPIO.setwarnings(False) GPIO.cleanup(pin) GPIO.setmode(GPIO.BOARD) GPIO.setup(pin, GPIO.OUT) GPIO.output(pin, GPIO.HIGH) GPIO.output(pin, GPIO.LOW) time.sleep(duration) GPIO.output(pin, GPIO.HIGH) GPIO.cleanup(pin)
It should already be high from the previous time it ran, but this was just as a double check to ensure pin is in the right position before getting switched to low
Thanks for sharing. This is awesome! One question: The duckdns approach does not have encryption so anyone with the link could feed the pet and change the scheduled feeding. Is there any safety concern or can we add some protection like password to access the website?
Hi! Very helpful project. I follow all steps and app works. I change part of the code in commonTask but it won't run the servo? Do You know what is the problem?(Servo TowerPro MG995)
I am not familiar with that servo. You would have to look at the data specs to see how it runs. Most servos are not strong enough to spin the feeder when it is full of food. I would suggest the high torque motor used in the video. I would not use a pi zero either they are not powerful enough to run everything efficiently.
Looks like the links may have changed. Any in the original link should work. Those in link below should work too. www.amazon.com/uxcell-Momentary-Tactile-Button-12x12x12mm/dp/B008DGAEEA/ref=sr_1_38?dchild=1&keywords=12x12x12mm+button&qid=1606112740&sr=8-38
@@diypetfeeder1205 Thank you so much. One more thing: will the feeder hold together well with magnets? Does it ever accidentally fall apart because I'm not sure if the magnets are very strong?
It has never fallen apart for me. The magnets I used and suggested are pretty strong. Obviously want to be careful if you do decide to move it but should hold up just fine
Nice project! Is it possible to modify project and make app which has button to rotate servo(spin hooper function) and button for live stream( turn on live stream when button is pressed) . I am new in all of this and your help would mean a lot. Sorry for grammatical mistakes 😁
Yes it would be possible. You could use the api command (same URL as video in section about using a smart device) to integrate with an android app. For the video to work outside home network you would need DNS set up but that is possible as well. The code is on gitlab as well. Feel free to modify and add an features you like to an app.
Would it be possible to trigger this from a Twitch stream using an emote or keyword? If so, would you consider selling one of these kits ready to go? I'm trying to support a local farm really struggling in these times.
Thank you for sharing this fantastic project and the detailed instructions. Would it be easy to swap the motor with the servo MG996R? I built a pet feeder based in a different project that use emails as a trigger but your is much better with more functionality and would love to implement your system to control the hardware.
Not sure I fully understand what asking. If you are suggesting that want to keep everything else in system the same, but just replace motor with MG996R servo I would not recommend as that servo is most likely not powerful enough. Need a quite a bit of power to turn the feeder, especially when it is filled to the top with food. MG996R servo is designed more for lighter applications like RC cars planes. That servo also only rotates 180 degrees which could be problematic as well. There are continuous rotation servos, but again need to make sure get one with enough torque to spin everything when filled to top with food. The pi also does not output much power so you would need a relay, and at that point you are basically back where the project currently is with a high torque motor. On other hand, if you are simply asking if it is possible to use the software to control your hardware of the other system you built, then I would say it is possible only after making several coding changes. The code for the feeder is currently designed to activate a relay which activates a motor which is programmed to turn on for a bit then turn off. With a servo you would have to program the exact amount of rotation you would want using pulse width modulation so that would need to be updated. Not impossible just something to keep in mind. Hope this helps, any other questions let me know.
@@diypetfeeder1205 Thanks for the quick reply and yes I am looking to a way of modify your code to implement the MG996R Unfortunately I don't have any experience in coding and I am just trying to make the changes comparing the code with other project, could you point me to the files that need to be modify? I bought the 360 degree version of MG996R installed without relay and I can assure you it works very well with the hopper full of food, there are few other project online with same servo that have been in use for more than a year with no problem. It would be great if you could help as your project is by far the best on the web and everyone that built the hardware based on a servo motor could easily implement your software to control the feeder... Thank you again...
Ok glad it is powerful enough to work. I have a continuous running servo lying around somewhere. Give me some time to find it and make code changes to get it working with the system. Then you can install and test it with your servo version.
Was able to dig up my continuous servo so will get it working on that and then give you a branch of code to download and test. Servos are basically all the same so confident yours will work the same. If not then maybe can send me a link to where got yours and I can try with that. Will be away for work next week, but will follow up week after with something you can test with.
great video. But I have looked as best I can through the comments and your written instructions. What cat feeder are you using? I am having a hard time finding on online. Thanks!
the duckdns cannot update my ip address every 5 minutes and I checked online my ip, after 5 minutes its still the same. How can I solve this? I cannot access the website from my phone which connected to the same wifi.
In step 36n which test the duckdns set up is that returning OK or KO? Also, just so you are not stuck you can manually update your duckdns and test to see if website is available externally after that... If you cannot access your website on your phone from same wifi sometimes some routers block external traffic on same wifi network. From your phone try your local ip address in browser and see if that works. Can also turn off wifi and use mobile data from your phone so can externally check
diy petfeeder thanks I can mow access the website from my phone connected to the same wifi. May I ask for the detailed setting of router in port forwarding? I don’t know how to set the port forwarding for duckdns
Which part of the written directions are you specifically stuck on? You don't need port forward anything for duckdns. Just need to port forward web traffic to the pi
I love this! Best tutorial and write up ever! I'm having a slight problem with my LCD screen. It lights up, and I can only see the words if I'm turning the potentiometer. If I turn the potentiometer either direction the text will show for a brief few seconds then it disappears but the screen stays lit. Where am I wrong? I think it may be the potentiometer but I'm not sure...
Just sounds like one of your wires is mixed up. If the wires were touching or shorted would most likely never light up or show text. Would go through and double check that they are all in the correct positions and spots on GPIO. Would pay particular attention to the first and third potentiometer pins as sometimes text is tough to read on the potentiometer showing which is which and they could get swapped. Did you soldered all the connections down yet or just testing? If still doesn't work email me a few pictures of your set up and I can see if anything jumps out. Email under the channel about section->view email address
diy petfeeder unfortunately I eagerly went and soldering everything. I don't have the same potentiometer that you do but it is 10k and I have swapped the third and first post/gpio connections on the potentiometer and I get the same result. I'll double check my connections in the morning
No worries if soldered already. I am not sure how a different potentiometer would play with the system. I have only ever used the blue one in the past. The blue one is also 10k, but the order of your pins might be totally different on yours. The one I used you can get one off the adafruit site if want to try same as mine. www.adafruit.com/product/356
It is possible, but I would highly advise against it, everything will run slowly. Plus you will have to buy and solder on your own GPIO header pins separately. Buying a Model B is an easier way to go.
This is by far THE BEST Raspberry Pi Tutorial I've ever seen. I'm almost all the way through the rPI configuration, and you have the BEST documentation ever. The only thing you might want to add is that in the dns config section, you need to update /var/www/feeder/feeder/app.cfg an update the Motion_Camera_Site_Address to the DNS address, and open/forward port 8081 on the router. Thanks a ton! My cats will be happy campers! 2 other questions- Do you have instructions to make this more secure (HTTPS vs HTTP), and currently I'm not hitting a user loging screen. Where do I enable the login requirement?
Thanks! Go callout on making the documentation more clear I will add that in. It is possible to make site use HTTPs, however I do not have directions or a video at this time. One free service for SSL is letsencrypt.org/ there documentation is pretty good on how to set up. I used their certbot app (select Apache and correct Debian version of Raspbian). Just a heads up my feeder is pointed at a domain now not duckdns so I am not sure duckdns will work for SSL if you are using that. So you might have to set up a domain first in your apache config if duckdns does not work. There are very cheap domains (and even free ones as well) if you need to go down that route. Many domain registrars also provide SSL certs, but they will not be free like letencrypt. I am not sure what you mean by enable the login requirement? Login for the pi, the admin website, the camera?
@@diypetfeeder1205 When I navigate from a browser to my feeder url, I think I should hit a login screen. Otherwise, someone could find my url and either watch live video or feed the cat over and over. I do hit the login if I go to www..../admin, but not just the www.... Url.
Ok I see what you mean now. That functionality currently does not exist. Only the admin screen is password protected. You could modify the code to move the home page behind the login page.
Hi, almost done here with the project! Great write-up! I still have some questions here and there though. Like how can we add a melody each time the food is dispensed? Also how can I adjust the time the relay is turned on, therefore the quantity of food dispensed? Thanks!
A triggering for a feeding from any source type eventually calls the function spin_hopper in the file commonTasks.py. You could modify that function to also play a sound after the hopper is done spinning. To adjust relay time modify config file and change Hopper_Spin_Time as mentioned here in video th-cam.com/video/bvon9nxhqHk/w-d-xo.html
Did you also install pygame and add import into this file as well? This needs to be done in the virtual environment like the other modules which were done during the video. Once that is done I would double check your while loop that doesn't look right to me. Having a wait might make more sense. import pygame file = 'some.mp3' pygame.init() pygame.mixer.init() pygame.mixer.music.load(file) pygame.mixer.music.play() pygame.event.wait()
@@diypetfeeder1205 I don't understand what am I doing wrong... been dealing with this for 2 days... As soon as I type import pygame and save the file, the website stops working giving me a 500 internal server error. aaaaaahhhhhh what am I doing wrong?????? :((((
Did you run 'pip install pygames' in your virtualenv? I just tried quick and I got it working on mine. Some things to note: 1) import pygame goes at top of the file with the other import lines 2) rest of the code goes in spin_hopper function after GPIO.cleanup (pin). My working code is below file = '/var/www/feeder/feeder/static/test.mp3' pygame.init() pygame.mixer.init() pygame.mixer.music.load(file) pygame.mixer.music.play() 3) You can check the error logs to see if any specific errors getting for HTTP 500 4) Unless you have speaker plugged into pi or headphones wont hear anything
Thanks so much for making this and providing excellent documentation! Just got started on the project this weekend. Quick question, is there a particular specification needed for the potentiometer?
I believe the 'LCD Screen' link listed under Optional Materials comes with a potentiometer. However if you needed just the potentiometer itself adafruit and amazon sells same one I used. Any similarly spec one should work I imagine though www.adafruit.com/product/356 www.amazon.com/Adafruit-Breadboard-Trim-Potentiometer-ADA356/dp/B00NAY2682/ref=sr_1_9?dchild=1&keywords=Breadboard+trim+potentiometer+-+10K&qid=1595913728&sr=8-9
@@diypetfeeder1205 Awesome, thanks! I have a kit so I will try to pull one with around 10K ohms. Yeah unfortunately amazon was out of stock on the lcd that was listed but I picked up a similar one - no potentiometer though.
Most likely your local IP address changed. Go onto router and look for what new address is and see if can connect with that. If that is the case make sure save that address in you router to the pi so it always gets same address upon reboot
why I can't access to the Pet Feeder website. It's come out : This is the default welcome page used to test the correct operation of the Apache2 server after installation on Debian systems. If you can read this page, it means that the Apache HTTP server installed at this site is working properly. You should replace this file (located at /var/www/html/index.html) before continuing to operate your HTTP server. If you are a normal user of this web site and don't know what this page is about, this probably means that the site is currently unavailable due to maintenance. If the problem persists, please contact the site's administrator.
That is the default website that Apache sets up after install. Still have to go through and set up the feeder website. Have you gone through the Config Apache step in the written directions yet? (Step 27)
I absolutely love your documentation and video! I wonder if you would be able to work with me on dispensing a variable weight? Would be an amazing enhancement. Perhaps a 4th video :)
Not exactly sure what mean by dispense variable weight. If you want the configure the motor to spin longer and dispense more food can already do that in the config file. The config value is called Hopper_Spin_Time and the default is 0.6 seconds. The link below jumps to part of video showing how to access and modify the value in the file. After modifying it is best to restart both feeder services (through the admin page or terminal) to have the value change take effect. th-cam.com/video/bvon9nxhqHk/w-d-xo.html
@@diypetfeeder1205 Thank you for this advice and response. What i meant was you can choose the weight you would like to dispense. 15g, 30g, 31g, etc. I think I have a lot to learn still but this is the idea I have for my project. Best!
@@theothertom1603 I see. I don't think the hopper is precise enough to handle exact measurements like that, but you could certainly modified the equipment or code to better suit your needs.
Main feeder components cost around $150 USD plus any tools to construct the components that you may or may not have. Extensive list of tools needed in written directions docs.google.com/document/d/12b4Bzq5u67sQ7vvfZI9Wh92H_r2RVhh2vrMzNrYyuPc
You can reset the PW on the admin site following the directions below. Start from the terminal on the pi and copy in each line Note:[From terminal] cd /var/www/feeder/ source bin/activate python Note:[Python will be brought up in terminal] from werkzeug.security import generate_password_hash import sqlite3 con=sqlite3.connect('/var/www/feeder/feeder/feeder.db') cur=con.execute("delete from user;") Note:[To change default PW replace text 'admin' or 'ChangeMe!' with username/pw] cur = con.execute('''insert into user (username,email,pw_hash) values (?,?,?)''',['admin', '', generate_password_hash('ChangeMe!')]) con.commit() cur.close() con.close()
First of all, kudos to you for this awesome detailed guide. I'm facing a problem at the moment: the website keeps on loading forever. Here's the apache error log (located in /var/log/apache2/error.log): Fatal Python error: initfsencoding: unable to load the file system codec ModuleNotFoundError: No module named 'encodings' Could you please help me in bypassing this issue? Thank you in advance
Main components cost around $150 USD plus any tools that you may or may not have. Extensive list of tools needed in written directions docs.google.com/document/d/12b4Bzq5u67sQ7vvfZI9Wh92H_r2RVhh2vrMzNrYyuPc
I appreciate the documentation and detail you provided. I do have one question, though, and you may have mentioned this further along in the video, or perhaps I'm just missing something entirely, as I'm still very much an amateur when it comes to electrical, but anyway, was the second module on the relay used for anything?
It not used for anything else currently in this project. I used that one cause it this one seems to always work best with the pi. Plus it is usually easiest to get online and gives option to add other feaures in future if need be.
Hi this is very well made, we would like to ask for help because we wanted to make the same project but using android phone and making an app. We appreciate all the help you can give us. subbed!
Good luck with the app. Using the api probably easiest way to integrate with an android app. The code is on gitlab as well. Feel free to modify and add an features you like.
Apologies adding subtitles slipped my mind. Following the written directions along with the video should be just as good as subtitles though. Link here: drive.google.com/open?id=12b4Bzq5u67sQ7vvfZI9Wh92H_r2RVhh2vrMzNrYyuPc
Hi, may i ask something? Did i need to configure the router setup, if i connect pi through hotspot on my android devices? What should i do? Thank you so much
And that is how you document a project. very well done sir!
can I just say this is an excellent project. the effort you went to document is excellent!
At 35:00 you go on to check the system locally and in doing so the time service status and the button service status are green and active. All of mine are yellow. Do you know what I have done wrong?
Yellow is shown when the site cannot determine if service is available. The site runs a similar command that is below to check status. What is returned when you run this command?
sudo service feederButtonService.sh status
You are a master!! Thorough, well written and well put together. I'm going to use this for my bunnies :)
Awesome! Any question let me know
This video could really do good with some timestamps in the video description! Good video and instructions!
Hello, I’m having issue around 32:02, when I run the test, I have no Apache log files, just the buttonservice log and the feedertimeservice... I notice that the file we edited right before looked a bit different then the one on my screen so, I thought maybe that would fix it, but still unable to see the log files. Thanks in advance for any help
Can you share screenshot or text snippet of the Apache logrotate file before the test is run? If easier can email the details to the address listed in 'About' section of the channel page. A bearded dragon sounds awesome.
diy petfeeder thx for the quick reply! And as far the the difference in code, it’s the first ‘if’ block in /etc/logrotate.d/apache2, mine reads
“if invoke-rc.d apache2 status > /dev/null 2>&1; then \
invoke-rc.d apache2 reload > /dev/null 2>&1; \
fi;”
instead of yours at 31:14
Finally got it working after a few hours of troubleshooting! It was an issue on my end :/
Hi, where you able to access the feeder via the duckdns url?
@@bbit6304 I am having the same issue.. what did you do to fix this?
Hello, first of all, thank you for this clear, super helpful video! i am trying to recreate the feeder to feed my dogs... could you tell me what are the changes that need to be made to each step to be able to control 2 motors and have the exact same features? thank you much
I am not sure I fully understand what your are asking for. You want 2 motors to control one feed container? Send me an email found in the channel description about what looking to do and we can discuss options.
Hello! I'm making this website for my an assignment in my class. I want to add a passive buzzer into this project and show how many bowls of food the cat has eaten today, and also change the background into a gif. Do you have any guidance on how to do add these into the code of the website? I've tried for the past 2 days and I still can't figure it out.
There are a few extra gpio spots on the board. The buzzer could use that depending on how many pins it has
Great tutorial I have ever seen. 🎉
wonder how big of an hopper this could be modified to use, also how it could be modified to be used in an outdoors environment (ducks/chickens/horses etc)
If you use a hopper any bigger then this I would recommend a bigger motor with more torque. The food weight will make it struggle to turn
Have my feeder up and running and it is working well. Thanks again for all your hard work. Have a couple of questions.
1. Running this on a pi zero w. Looking at top on the rpi, it is running feederBut+ at 95 to 99 % cpu. Is that something you are seeing on yours as well? Feeder Button service jumps up to 97% CPU as soon as it is restarted from the admin page. Any way to make it less of a CPU hog?
2. If I set the schedule to feed at 12:00 PM, it usually runs 2 -3 minutes after 12:00. Is this the expected behavior?
1) I'm running on pi 3B and usually takes around 15-25% cpu. The pi zero w has less power. I have never used a pi zero w yet but looking at the specs those numbers don't surprise me. If can spring for a pi4 or bigger version id recommend that.
2) Yes that is expected. The scheduler only checks ever 5 minutes for every past due feedings so that seems right. You can lower the check value but then your cpu will probably go up even more which I doubt you want.
When I run the "sudo logrotate --force /etc/logrotate.d" to test there is no second log file in the folder
Also if i skip past that the site does not load either. I haven't noticed any error messages in any of the previous steps
Hi, we have been working on the group project and we are taking your project as a basis for development .Whenever we run our code to run motor, it just does opposite of the code. Runs infinitely and stops for 2 seconds. Is it caused by wiring issues or it is problem in code. Thanks. Please reply.
Sounds like wiring issue. Cant see how code would do that
Awesome project! Thanks for sharing, planning on taking a similar project on but for my bearded dragon
shot in the dark, but I continue to get apache errors when following along with the provided written instructions, could anyone assist?
What errors getting exactly in the log? Can reach out to email in channel if want to send them to me and troubleshoot further
After the jump cut at 26:27 you were no longer doing commands in the 'feeder' virtual environment, is this intended?
Yes don't need to be in the virtual environment to set up these services as they are running at the OS level
This is really awesome. Thing is that I'm using an orange pi and not a Raspberry pi. So it basically uses an entirely different library (wiringpi). I think most of the other devices i have are the same.
Any advice in this situation?
What do i have to do differently if I'm following your steps.
how to know the quantity of food left in the storage tank?
Great instructions. Was wondering if there was a way to have more than one rotation duration or use multiples of the hopper spin time. I feed my cats different amounts at different times of the day.
Not way to have multiple hopper spin duration. Maybe could schedule two feedings very close together during times want to feed more?
@@diypetfeeder1205 Is the Seconds_Delay_Between_Schedule_Checks=300
how often it checks the current time against the feed schedule. Notice that my food doesn't come out for 5 minutes following the scheduled time, but the display shows the last feed as the scheduled time. Any issues setting this to 60 so it checks every minute?
@@rogerolson2252 Yes that is the period is between checks in seconds. 60 should be fine
Make sure to restart the services for the change to take effect
hi, but can you do the coding in thonny please? thank you
Hello we are trying to create a similar project, but we are also implementing a weight sensor ( Load cell HX711 weight sensor), would this be suitable for this type of design ?
@@JackLyons-l8l Yes there should be enough extra gpio pins to work
Hi, I have the display that came with 4 pins in the back. it has an additional board soldered to it with a built-in potentiometer. Can you please help me wire it correctly? I found some info online and wired it, it tuns on and I can even use the terminal to load pre-written py files to show on the lcd but can’t get it to show the last feed times. Please help. thanks!
Without knowing anything about this new LCD it will be pretty difficult to help in great detail. However, you mentioned you currently can write to the screen so your best bet is to use to code that is current in your pre-written python file(s) and plug into the current python function that writes to the screen. Currently under commonTasks.py there is a function called print_to_LCDScreen which takes a whatever message is passed in and prints it to the screen. This function is used throughout the code. You can modify this current function with your current pre-written python file you have and that should get you going in the right direction.
How do i set the motor to rotate an angle that i want?
How long the motor will rotate for is a configurable value in the config file. The config value is called Hopper_Spin_Time and the default is 0.6 seconds. The link below jumps to part of video showing how to access and modify the value in the file. After modifying it is best to restart both feeder services (through the admin page or terminal) to have the value change take effect. th-cam.com/video/bvon9nxhqHk/w-d-xo.html
My group and I are trying to build a pet feeder like yours but wanted to have it connect to Alexa and, hopefully, have an application that someone could go into and do all the things offered on the website. We have the Alexa portion sorta figured out, but what I wanted to know is if it's even possible to create an app that does the same stuff as the website? Is there an app that already exists that could connect the raspberry pi to an app without starting from scratch?
There is not an app the currently exists, but it is certainly possible to build one. In your app you could use the same 'trigger feed' URL endpoint you are calling with Alexa to also trigger a feeding. The other features on the site (like scheduling for example) don't currently have endpoints so they would also have to be coded. Feel free to submit a Pull request in gitlab if adding new features. I can also help with developing the endpoints if it is something you are serious about moving forward on and need some help.
I built this about a year ago, and it still works great! However, for some reason it might fire when we are using power from the outlet next to it, is there a fix to this, or is this an issue with my house wiring or something?
I have a similar issue as well with one of my outlets. My guess is its probably related to the pins on the pi getting false positives from a voltage change when light changes. The pi is a pretty small (cheap) device and the pins aren't shielded so that's my guess. I have not found a solution for it no unfortunately. I don't think its your house wiring.
@@diypetfeeder1205 might be able to put a UPS between the outlet and the pi, if your using the idea for something more serious
Great tutorial, but I have a question, can you edit the website itself? I want to move some of the buttons to other areas and I want to add more images on the site so that it would not feel very empty.
Yes can modify however you like. All code open
I can’t use 127.0.0.1 why? Pls explain about that
same issue here did u find any solutions may i ask ?
Great guide, just spotted a small coding mistake while following: "pip install gspread gspread-formatting oauth2client" should be pip3 in your latest google docs guide. Thanks for putting this together, my cats will love it.
Also I think mod_wsgi-express is missing from the bin folder, sudo /var/www/feeder/bin/mod_wsgi-express install-module returns command not found
I guess the above is due to mod_wsgi not installing, it gives this error: File "/tmp/pip-install-urrx9jvb/mod-wsgi/setup.py", line 168, in
'missing Apache httpd server packages.' % APXS)
RuntimeError: The 'apxs' command appears not to be installed or is not executable.
Ah think I've figured out my mistake, must have missed installing apache2-dev
Thanks for spotting
Hi this is an amazing video! Do you have a link for the potentiometer?
@@eesaasattar6849 It came with the LCD screen. Parts list in manual instructions
Sir ,I loved your idea and making . But i wanna make it as a robot, which means adding wheels to the pet feeder. Can you help me to write the code for motor wheels for moving the pet feeder for surveilling the dog whenever we r free outside.
Great idea. There are already lots of great tutorials online to get started.
Amazing tutorial thank you for sharing! I am running into an issue where my motor is constantly running and only turning off for a second when I press the button, I'm sure I've wired something wrong but I can't seem to find where. Any ideas about what to check please?
Yea sounds like something was wired wrong. Would check relay first, than everything plug into pi. I Reversing the mounts on the motor really only causes it to switch direction so I doubt its that.
I don’t use the same router company as you! How do I configure my router so I can put the IP address in it so I can move to the next step? Because when I put my router’s IP address in the URL it takes me to the feeder website
I also have no idea how to log into my router
If you never logged in before often times the default user name password is on the back. If not would read manual which will tell you what the login is. Would change after to something more secure. After logging in should be able to find the correct settings by looking around in settings. Without knowing your exact router it is impossible to tell you where, but shouldn't be hard to find
Another question. Am I doing something wrong or is this a bug? When I add a daily feed to my schedule for example 12:00 PM and it is 6:00 PM, it runs a feed cycle. Can I only enter new daily schedules after midnight and before the time I want it to cycle?
The daily feeding schedule looks for an past due feedings for a day. Since your first scheduled is in the past for the for the first day it is triggered. The next day it should run as expected. If your initial schedule set is later then the actual time this shouldn't happen.
Unfortunately, pip3 install RPi.GPIO fails for me, so cannot progress
What error are you getting?
This is Great! But do the commands written in the terminal depend on the model or os version downloaded? would be a big help Thanks!
Thank you for doing this. I have a couple questions.
Would I be able to set this up for two dispensers? I have two dogs, so I'd like to activate at the same time to two different bowls.
Do you think the dispenser/motor would be able to handle larger dog food, especially if added to a larger hopper?
I think the motor would be able handle larger dog food. Will have to adjust the shoot and opening in the front obviously depending on the size. There will be a limit as to how much bigger the hopper can be before it is too heavy for the motor to spin. Not exactly sure what that limit would be though. I have seen others design a two shoots going down either side instead of one going down the middle. That could be an option as well.
Hello, i have some issue when i pressed the "feed now" button in step 32 , the website didnt update and show a warning : Database did not update: attempt to write a readonly database. It also happened after i logged in to the admin page. Can you guide me a bit on this issue?
The user which runs the website doesnt have write access to the database in the website folder. These permissions are usually granted in the createFiles.py script, not sure why yours did not work. You can run it manually though. Open a terminal and grant proper permissions . For ex.) sudo chmod 777 -R /var/www/feeder
Great Video thank you sir. Where can I specify the length of the spin of the mother i.e the time to dispense food?
How long the motor will rotate for is a configurable value in the config file. The config value is called Hopper_Spin_Time and the default is 0.6 seconds. The link below jumps to part of video showing how to access and modify the value in the file. After modifying it is best to restart both feeder services (through the admin page or terminal) to have the value change take effect. th-cam.com/video/bvon9nxhqHk/w-d-xo.html
@@diypetfeeder1205 I tried the Hopper_Spin_Time=0.6 to 1.0 but all this. Does is to delay the spin time between spins and does not extend the spring period. Any advice would be appreciated
@@arthurvanzyl @ataraxia440 Hopper_Spin_Time changes how long the hopper spins it does not delay the time between spins. The seconds_delay variables is responsible for the wait period after a button press. You may have they mixed up. Regardless make sure refresh Apache after saving the app.cfg for changes to take affect
Did you include the python code in this tutorial?
Very well done video. Everything worked out so far. Which files would i have to edit in terms of configuring some of the gpio pins i order to set up another physical button for example. I am currently trying to add a water dispenser to the whole system (basically building the same system again which would dispense water)... I would be glad if you could throw me some pointers my way.
What kind of water dispenser are you using? Are you planning to use the relay to power it or the pi itself? If have a link to water dispenser could gave a better idea of what to do. In general want to do something similar then what is in the spin_hopper function in commontasks.py which is triggering gpio pins on and off.
Hi, I just implement the camera site and host on . I cannot access my page from outside by the duckdns. I type .duckdns.org:8080. Is there any difference of 8080 and 8081? How can I make my camera page accessible outside?
8080 is the admin page. 8081 is the dedicated video page (and is also the port that the website uses when you click on live video). You need to port forward 8081 to the pi just like did with port 80 to view from outside
Thanks so much for doing this! Had one question so far. For step 14-25 on the document am I supposed to copy and paste LoadModule wsgi_module "/usr/lib/apache2/modules/mod_wsgi-py37.cpython-37m-arm-linux-gnueabihf.so" or just the part in the quotation marks? "/usr/lib/apache2/modules/mod_wsgi-py37.cpython-37m-arm-linux-gnueabihf.so"
also whenever I run sudo logrotate --force /etc/logrotate.d I don't get the updated logs
Whole line. Exact line value could change based on previous steps so just be aware
@@diypetfeeder1205 got it! Yea I finally got the updated logs, but the website doesn’t load locally, I keep getting a 500 internal server error. Any thoughts on why that may be?
Is there a simplified way of doing things with a mobile app instead???
Yes you could use the same web calls in an app
everytime a put my url that i created in duckdns it will not show up the website? can you help me?
Are you able to get to the site using local IP address?
@@diypetfeeder1205 yes sir i can get the site using the local IP address but the URL I created in duckdns did not appear
@@jimwelrapanut9921 Send the error logs to the email found in the channel description and we can try and troubleshoot further
Hello!
Can I use an usb camera instead pi camera? How much changes I have to do?
I believe it is possible to get a USB camera working. You might have to change a few configs in motion set up. Can refer to their website for that. motion-project.github.io/. The site is currently to be plug and play with pi camera
Just a heads up, if you name your files differently then whats instructed you may have issues running the db.
Good point, in future would be nice to change code to not really on hardcoded directory but for now needs to be at those folder locations
Awesome video!!
Am currently following the video to work on the pet feeder project.
I ran into an issue while setting up the duckdns
Just after I entered the command
"Crontab -e"
I was able to paste the code from duckdns but could not save the file...
Due to that, I cannot access the feeder from the url remotely.
Spoke with Jonathan via email about this and this specific issue was due to fact that nano is no longer second choice of list of editors to pick from as I originally stated in the video. It is now first on the list. This response is more for others who may read this in the future. I have already updated the documentation and will eventually make an annotation to the video, but basically need to make sure nano is selected as the editor (wherever it is on the list)
@@diypetfeeder1205 thanks so much, i got the issue fixed by following your instructions
So much effort to put this up. You deserve a 1:1 view/like ratio. 👍👍👍
Would this project still work with a different OS?
Fantastic tutorial. I am very impressed with the level of detail. Wondering if you can guide me a bit. On step 32 and trying to test the 127.0.0.1 but getting internal server error. I have gone over the steps a number of times but can't seem to see what I missed. Python 3.7. All lines loaded without errors when cutting and pasting. But can't get website to work using 127.0.0.1.
getting the following apache log errors. Any ideas?
[Mon Dec 09 21:19:58.652546 2019] [wsgi:error] [pid 1496:tid 1940141088] [remote 127.0.0.1:50962] File "/var/www/feeder/feeder/app.py", line 9, in
[Mon Dec 09 21:19:58.652588 2019] [wsgi:error] [pid 1496:tid 1940141088] [remote 127.0.0.1:50962] import commonTasks
[Mon Dec 09 21:19:58.652654 2019] [wsgi:error] [pid 1496:tid 1940141088] [remote 127.0.0.1:50962] File "/var/www/feeder/feeder/commonTasks.py", line 7, in
[Mon Dec 09 21:19:58.652693 2019] [wsgi:error] [pid 1496:tid 1940141088] [remote 127.0.0.1:50962] import gspread
[Mon Dec 09 21:19:58.652836 2019] [wsgi:error] [pid 1496:tid 1940141088] [remote 127.0.0.1:50962] ModuleNotFoundError: No module named 'gspread'
[Mon Dec 09 21:19:58.915980 2019] [wsgi:error] [pid 1496:tid 1931748384] [remote 127.0.0.1:50964] mod_wsgi (pid=1496): Failed to exec Python script file '/var/www/feeder/feeder/feeder.wsgi'.
[Mon Dec 09 21:19:58.916361 2019] [wsgi:error] [pid 1496:tid 1931748384] [remote 127.0.0.1:50964] mod_wsgi (pid=1496): Exception occurred processing WSGI script '/var/www/feeder/feeder/feeder.wsgi'.
[Mon Dec 09 21:19:58.917348 2019] [wsgi:error] [pid 1496:tid 1931748384] [remote 127.0.0.1:50964] Traceback (most recent call last):
[Mon Dec 09 21:19:58.917697 2019] [wsgi:error] [pid 1496:tid 1931748384] [remote 127.0.0.1:50964] File "/var/www/feeder/feeder/feeder.wsgi", line 9, in
[Mon Dec 09 21:19:58.917749 2019] [wsgi:error] [pid 1496:tid 1931748384] [remote 127.0.0.1:50964] from app import app as application
[Mon Dec 09 21:19:58.917823 2019] [wsgi:error] [pid 1496:tid 1931748384] [remote 127.0.0.1:50964] File "/var/www/feeder/feeder/app.py", line 9, in
[Mon Dec 09 21:19:58.917864 2019] [wsgi:error] [pid 1496:tid 1931748384] [remote 127.0.0.1:50964] import commonTasks
[Mon Dec 09 21:19:58.917930 2019] [wsgi:error] [pid 1496:tid 1931748384] [remote 127.0.0.1:50964] File "/var/www/feeder/feeder/commonTasks.py", line 7, in
[Mon Dec 09 21:19:58.917971 2019] [wsgi:error] [pid 1496:tid 1931748384] [remote 127.0.0.1:50964] import gspread
[Mon Dec 09 21:19:58.918135 2019] [wsgi:error] [pid 1496:tid 1931748384] [remote 127.0.0.1:50964] ModuleNotFoundError: No module named 'gspread'
Yes need to go back and reload virtualenv feeder and also run this command. "pip install gspread gspread-formatting oauth2client". The instructions at step 12 have been updated. Apologies think you were setting up before had chance to update instructions.
Thanks i will try.
Worked!! Thank so much.
Completed the project and it works great - I used clear plexiglass for the build so you can see the wiring and magic!
@@diypetfeeder1205 thanks help me to
sir i have a question . my backlight lcd screen doesnt show anything . i just testing without my potentioner knob . is it because i didnt my potentioner knob it become like that sir ?
Yes need the potentiometer as well
@@diypetfeeder1205 and one more question sir . why my camera doesnt active ? in admin layout . its show webcam status inactive
Does the camera work on main site it just not showing active on admin page or just not working at all?
@@diypetfeeder1205 just not showing active on admin page
@@diypetfeeder1205 sir my camera problem have been solved . thankyou sir . its just i plug in a pi camera cable in wrong direction . but now i have 1 more question sir . about my lcd . after i assemble the potentiometer . its show just a black bar . but doesnt show any digit or info . can i ask u why sir ? sorry if i have a lot of question . its because i take this project for my final year project sir . and i hope u can help
Hi, I would like to ask why the code for the motor is set to be high voltage at first then low and then high again?
def spin_hopper(pin, duration):
try:
pin = int(pin)
duration = float(duration)
GPIO.setwarnings(False)
GPIO.cleanup(pin)
GPIO.setmode(GPIO.BOARD)
GPIO.setup(pin, GPIO.OUT)
GPIO.output(pin, GPIO.HIGH)
GPIO.output(pin, GPIO.LOW)
time.sleep(duration)
GPIO.output(pin, GPIO.HIGH)
GPIO.cleanup(pin)
It should already be high from the previous time it ran, but this was just as a double check to ensure pin is in the right position before getting switched to low
Thanks for sharing. This is awesome! One question: The duckdns approach does not have encryption so anyone with the link could feed the pet and change the scheduled feeding. Is there any safety concern or can we add some protection like password to access the website?
Hi!
Very helpful project. I follow all steps and app works. I change part of the code in commonTask but it won't run the servo? Do You know what is the problem?(Servo TowerPro MG995)
I am not familiar with that servo. You would have to look at the data specs to see how it runs. Most servos are not strong enough to spin the feeder when it is full of food. I would suggest the high torque motor used in the video. I would not use a pi zero either they are not powerful enough to run everything efficiently.
BTW, what kind of motor did u used
List of products used in written directions. Link in description
Your button looks a bit different than the one that you linked. Is it the same? If not, can you please link the one that you used? Thank you.
Looks like the links may have changed. Any in the original link should work. Those in link below should work too. www.amazon.com/uxcell-Momentary-Tactile-Button-12x12x12mm/dp/B008DGAEEA/ref=sr_1_38?dchild=1&keywords=12x12x12mm+button&qid=1606112740&sr=8-38
@@diypetfeeder1205 Thank you so much. One more thing: will the feeder hold together well with magnets? Does it ever accidentally fall apart because I'm not sure if the magnets are very strong?
It has never fallen apart for me. The magnets I used and suggested are pretty strong. Obviously want to be careful if you do decide to move it but should hold up just fine
Nice project! Is it possible to modify project and make app which has button to rotate servo(spin hooper function) and button for live stream( turn on live stream when button is pressed) . I am new in all of this and your help would mean a lot. Sorry for grammatical mistakes 😁
Yes it would be possible. You could use the api command (same URL as video in section about using a smart device) to integrate with an android app. For the video to work outside home network you would need DNS set up but that is possible as well. The code is on gitlab as well. Feel free to modify and add an features you like to an app.
where is the phyton code in the video?
All code is in the repo for you to download. Directions in link
Would it be possible to trigger this from a Twitch stream using an emote or keyword? If so, would you consider selling one of these kits ready to go? I'm trying to support a local farm really struggling in these times.
Assuming the emote or keyword could trigger an endpoint call is possible. Is there documentation on twitch site about how to use? Can investigate
@@diypetfeeder1205 I'm not sure, but if you look for a channel called DashDucks you'll see the idea in action.
@@mr2nut123 Ok will take a look and get back to you
Ok I see what you mean. Looking at the twitch API that should be possible. Can email me if want to go over details. Email is in channel description.
Thank you for sharing this fantastic project and the detailed instructions.
Would it be easy to swap the motor with the servo MG996R?
I built a pet feeder based in a different project that use emails as a trigger but your is much better with more functionality and would love to implement your system to control the hardware.
Not sure I fully understand what asking. If you are suggesting that want to keep everything else in system the same, but just replace motor with MG996R servo I would not recommend as that servo is most likely not powerful enough. Need a quite a bit of power to turn the feeder, especially when it is filled to the top with food. MG996R servo is designed more for lighter applications like RC cars planes. That servo also only rotates 180 degrees which could be problematic as well. There are continuous rotation servos, but again need to make sure get one with enough torque to spin everything when filled to top with food. The pi also does not output much power so you would need a relay, and at that point you are basically back where the project currently is with a high torque motor.
On other hand, if you are simply asking if it is possible to use the software to control your hardware of the other system you built, then I would say it is possible only after making several coding changes. The code for the feeder is currently designed to activate a relay which activates a motor which is programmed to turn on for a bit then turn off. With a servo you would have to program the exact amount of rotation you would want using pulse width modulation so that would need to be updated. Not impossible just something to keep in mind. Hope this helps, any other questions let me know.
@@diypetfeeder1205 Thanks for the quick reply and yes I am looking to a way of modify your code to implement the MG996R
Unfortunately I don't have any experience in coding and I am just trying to make the changes comparing the code with other project, could you point me to the files that need to be modify?
I bought the 360 degree version of MG996R installed without relay and I can assure you it works very well with the hopper full of food, there are few other project online with same servo that have been in use for more than a year with no problem.
It would be great if you could help as your project is by far the best on the web and everyone that built the hardware based on a servo motor could easily implement your software to control the feeder...
Thank you again...
Ok glad it is powerful enough to work. I have a continuous running servo lying around somewhere. Give me some time to find it and make code changes to get it working with the system. Then you can install and test it with your servo version.
@@diypetfeeder1205 That would be amazing, I'll be more than happy to contribute if this could help, may be with a new servo motor?
Was able to dig up my continuous servo so will get it working on that and then give you a branch of code to download and test. Servos are basically all the same so confident yours will work the same. If not then maybe can send me a link to where got yours and I can try with that. Will be away for work next week, but will follow up week after with something you can test with.
awesome! Could you use a particle photon instead of Pi?
Those would not be powerful enough to run the project as is.
This is awesome! It has inspired me to make something similar at home, thanks!
Great to hear! Any questions let me know
great video. But I have looked as best I can through the comments and your written instructions. What cat feeder are you using? I am having a hard time finding on online. Thanks!
I am not sure what part you mean by cat feeder. Are you referring the dispenser itself? If so the link in #28 in written instructions.
@@diypetfeeder1205 that's it! Thanks. I got the link to work. I hope to make one for my 8 cats to make feeding time easier on them.
the duckdns cannot update my ip address every 5 minutes and I checked online my ip, after 5 minutes its still the same. How can I solve this? I cannot access the website from my phone which connected to the same wifi.
In step 36n which test the duckdns set up is that returning OK or KO? Also, just so you are not stuck you can manually update your duckdns and test to see if website is available externally after that... If you cannot access your website on your phone from same wifi sometimes some routers block external traffic on same wifi network. From your phone try your local ip address in browser and see if that works. Can also turn off wifi and use mobile data from your phone so can externally check
diy petfeeder thanks I can mow access the website from my phone connected to the same wifi. May I ask for the detailed setting of router in port forwarding? I don’t know how to set the port forwarding for duckdns
Which part of the written directions are you specifically stuck on? You don't need port forward anything for duckdns. Just need to port forward web traffic to the pi
I love this! Best tutorial and write up ever! I'm having a slight problem with my LCD screen. It lights up, and I can only see the words if I'm turning the potentiometer. If I turn the potentiometer either direction the text will show for a brief few seconds then it disappears but the screen stays lit. Where am I wrong? I think it may be the potentiometer but I'm not sure...
Just sounds like one of your wires is mixed up. If the wires were touching or shorted would most likely never light up or show text. Would go through and double check that they are all in the correct positions and spots on GPIO. Would pay particular attention to the first and third potentiometer pins as sometimes text is tough to read on the potentiometer showing which is which and they could get swapped. Did you soldered all the connections down yet or just testing? If still doesn't work email me a few pictures of your set up and I can see if anything jumps out. Email under the channel about section->view email address
diy petfeeder unfortunately I eagerly went and soldering everything. I don't have the same potentiometer that you do but it is 10k and I have swapped the third and first post/gpio connections on the potentiometer and I get the same result. I'll double check my connections in the morning
No worries if soldered already. I am not sure how a different potentiometer would play with the system. I have only ever used the blue one in the past. The blue one is also 10k, but the order of your pins might be totally different on yours. The one I used you can get one off the adafruit site if want to try same as mine. www.adafruit.com/product/356
diy petfeeder I think I shorted the potentiometer! I ordered a new one and we are all good to go!
Good catch glad it is sorted
Hi, is it possible to realize or build this project with a raspberry pi zero w?
It is possible, but I would highly advise against it, everything will run slowly. Plus you will have to buy and solder on your own GPIO header pins separately. Buying a Model B is an easier way to go.
This is by far THE BEST Raspberry Pi Tutorial I've ever seen. I'm almost all the way through the rPI configuration, and you have the BEST documentation ever. The only thing you might want to add is that in the dns config section, you need to update /var/www/feeder/feeder/app.cfg an update the Motion_Camera_Site_Address to the DNS address, and open/forward port 8081 on the router. Thanks a ton! My cats will be happy campers!
2 other questions- Do you have instructions to make this more secure (HTTPS vs HTTP), and currently I'm not hitting a user loging screen. Where do I enable the login requirement?
Thanks! Go callout on making the documentation more clear I will add that in.
It is possible to make site use HTTPs, however I do not have directions or a video at this time. One free service for SSL is letsencrypt.org/ there documentation is pretty good on how to set up. I used their certbot app (select Apache and correct Debian version of Raspbian). Just a heads up my feeder is pointed at a domain now not duckdns so I am not sure duckdns will work for SSL if you are using that. So you might have to set up a domain first in your apache config if duckdns does not work. There are very cheap domains (and even free ones as well) if you need to go down that route. Many domain registrars also provide SSL certs, but they will not be free like letencrypt.
I am not sure what you mean by enable the login requirement? Login for the pi, the admin website, the camera?
@@diypetfeeder1205 When I navigate from a browser to my feeder url, I think I should hit a login screen. Otherwise, someone could find my url and either watch live video or feed the cat over and over. I do hit the login if I go to www..../admin, but not just the www.... Url.
Ok I see what you mean now. That functionality currently does not exist. Only the admin screen is password protected. You could modify the code to move the home page behind the login page.
Can u use Rufus instead of etcher?
I have never used Rufus so not 100% sure, but any flash writer should work. If not stick with etcher
@@diypetfeeder1205 ok thank you.
Hello is this beginner friendly who is absolute newbie?
Thank you!
The website doesnt open up for me.... its is only loading forever can you please help?
Can you email me your Apache logs? I can take a look and see if I can notice an issue. Email in channel description.
Same here
Hi, almost done here with the project! Great write-up! I still have some questions here and there though. Like how can we add a melody each time the food is dispensed? Also how can I adjust the time the relay is turned on, therefore the quantity of food dispensed? Thanks!
A triggering for a feeding from any source type eventually calls the function spin_hopper in the file commonTasks.py. You could modify that function to also play a sound after the hopper is done spinning. To adjust relay time modify config file and change Hopper_Spin_Time as mentioned here in video th-cam.com/video/bvon9nxhqHk/w-d-xo.html
@@diypetfeeder1205 I edited the commonTasks.py file but i'm not sure i'm doing it right. Can you guide me please?
def spin_hopper(pin, duration):
try:
pin = int(pin)
duration = float(duration)
GPIO.setwarnings(False)
GPIO.cleanup(pin)
GPIO.setmode(GPIO.BOARD)
GPIO.setup(pin, GPIO.OUT)
GPIO.output(pin, GPIO.HIGH)
GPIO.output(pin, GPIO.LOW)
time.sleep(duration)
GPIO.output(pin, GPIO.HIGH)
GPIO.cleanup(pin)
pygame.mixer.music.load("/var/www/feeder/feeder/nokia_kick_retro.mp3")
pygame.mixer.music.play()
while pygame.mixer.music.get_busy() == True:
continue
return 'ok'
except Exception as e:
return 'ok' # e
Did you also install pygame and add import into this file as well? This needs to be done in the virtual environment like the other modules which were done during the video. Once that is done I would double check your while loop that doesn't look right to me. Having a wait might make more sense.
import pygame
file = 'some.mp3'
pygame.init()
pygame.mixer.init()
pygame.mixer.music.load(file)
pygame.mixer.music.play()
pygame.event.wait()
@@diypetfeeder1205 I don't understand what am I doing wrong... been dealing with this for 2 days... As soon as I type import pygame and save the file, the website stops working giving me a 500 internal server error. aaaaaahhhhhh what am I doing wrong?????? :((((
Did you run 'pip install pygames' in your virtualenv? I just tried quick and I got it working on mine. Some things to note:
1) import pygame goes at top of the file with the other import lines
2) rest of the code goes in spin_hopper function after GPIO.cleanup (pin). My working code is below
file = '/var/www/feeder/feeder/static/test.mp3'
pygame.init()
pygame.mixer.init()
pygame.mixer.music.load(file)
pygame.mixer.music.play()
3) You can check the error logs to see if any specific errors getting for HTTP 500
4) Unless you have speaker plugged into pi or headphones wont hear anything
Thanks so much for making this and providing excellent documentation! Just got started on the project this weekend. Quick question, is there a particular specification needed for the potentiometer?
I believe the 'LCD Screen' link listed under Optional Materials comes with a potentiometer. However if you needed just the potentiometer itself adafruit and amazon sells same one I used. Any similarly spec one should work I imagine though
www.adafruit.com/product/356
www.amazon.com/Adafruit-Breadboard-Trim-Potentiometer-ADA356/dp/B00NAY2682/ref=sr_1_9?dchild=1&keywords=Breadboard+trim+potentiometer+-+10K&qid=1595913728&sr=8-9
@@diypetfeeder1205 Awesome, thanks! I have a kit so I will try to pull one with around 10K ohms. Yeah unfortunately amazon was out of stock on the lcd that was listed but I picked up a similar one - no potentiometer though.
I appreciate the detailed tutorial. My rat binge eats and has become very fat. I am building one of these to automate his new diet 🐀❤🔥
Do you have the flowchart of this project?
Not sure I understand what you mean by flowchart. Could please explain?
I disconnected and took my project to my university to see if it worked from there, now I am home and cannot access the website
The button feature works, but website does not
And my VNC is not connecting with my Pi
Most likely your local IP address changed. Go onto router and look for what new address is and see if can connect with that. If that is the case make sure save that address in you router to the pi so it always gets same address upon reboot
why I can't access to the Pet Feeder website. It's come out :
This is the default welcome page used to test the correct operation of the Apache2 server after installation on Debian systems. If you can read this page, it means that the Apache HTTP server installed at this site is working properly. You should replace this file (located at /var/www/html/index.html) before continuing to operate your HTTP server.
If you are a normal user of this web site and don't know what this page is about, this probably means that the site is currently unavailable due to maintenance. If the problem persists, please contact the site's administrator.
That is the default website that Apache sets up after install. Still have to go through and set up the feeder website. Have you gone through the Config Apache step in the written directions yet? (Step 27)
will this work on Raspberry Pi 4?
Yes it will
Hi! I've encountered a problem with the website. I've sent you an email. Can you help me please?
wow fantastic tutorial how long did it take you to code?
Very Very Very good. Outstanding!
Thanks! Hope your build is going well
I absolutely love your documentation and video! I wonder if you would be able to work with me on dispensing a variable weight? Would be an amazing enhancement. Perhaps a 4th video :)
Not exactly sure what mean by dispense variable weight. If you want the configure the motor to spin longer and dispense more food can already do that in the config file. The config value is called Hopper_Spin_Time and the default is 0.6 seconds. The link below jumps to part of video showing how to access and modify the value in the file. After modifying it is best to restart both feeder services (through the admin page or terminal) to have the value change take effect. th-cam.com/video/bvon9nxhqHk/w-d-xo.html
@@diypetfeeder1205 Thank you for this advice and response. What i meant was you can choose the weight you would like to dispense. 15g, 30g, 31g, etc. I think I have a lot to learn still but this is the idea I have for my project. Best!
@@theothertom1603 I see. I don't think the hopper is precise enough to handle exact measurements like that, but you could certainly modified the equipment or code to better suit your needs.
what was the total price of the project? realy intrested to make it for my end exams with some extras
Main feeder components cost around $150 USD plus any tools to construct the components that you may or may not have. Extensive list of tools needed in written directions docs.google.com/document/d/12b4Bzq5u67sQ7vvfZI9Wh92H_r2RVhh2vrMzNrYyuPc
@@diypetfeeder1205 thx for the answer man
can i have your network diagram?
is there a way to reset the password to the petfeeder website?
You can reset the PW on the admin site following the directions below. Start from the terminal on the pi and copy in each line
Note:[From terminal]
cd /var/www/feeder/
source bin/activate
python
Note:[Python will be brought up in terminal]
from werkzeug.security import generate_password_hash
import sqlite3
con=sqlite3.connect('/var/www/feeder/feeder/feeder.db')
cur=con.execute("delete from user;")
Note:[To change default PW replace text 'admin' or 'ChangeMe!' with username/pw]
cur = con.execute('''insert into user (username,email,pw_hash) values (?,?,?)''',['admin', '', generate_password_hash('ChangeMe!')])
con.commit()
cur.close()
con.close()
Hello, Thanks for The AMAZING Video. Im a newbi in this Field and I wanted to ask Is the RaspberryPies RAM 1 GigaBytes? Or it needs more RAM?
The model 3 B or better with 1GB of ram should work fine. A model 4 would be ideal
@@diypetfeeder1205 Thanks a lot.
First of all, kudos to you for this awesome detailed guide.
I'm facing a problem at the moment: the website keeps on loading forever. Here's the apache error log (located in /var/log/apache2/error.log):
Fatal Python error: initfsencoding: unable to load the file system codec
ModuleNotFoundError: No module named 'encodings'
Could you please help me in bypassing this issue?
Thank you in advance
After troubleshooting through email the issue was related to a bad configured of wsgi_express.config file. Ensure there are separate lines in the file
How much would this project cost?
Main components cost around $150 USD plus any tools that you may or may not have. Extensive list of tools needed in written directions docs.google.com/document/d/12b4Bzq5u67sQ7vvfZI9Wh92H_r2RVhh2vrMzNrYyuPc
I appreciate the documentation and detail you provided. I do have one question, though, and you may have mentioned this further along in the video, or perhaps I'm just missing something entirely, as I'm still very much an amateur when it comes to electrical, but anyway, was the second module on the relay used for anything?
It not used for anything else currently in this project. I used that one cause it this one seems to always work best with the pi. Plus it is usually easiest to get online and gives option to add other feaures in future if need be.
@@diypetfeeder1205 Oh I see, thanks for the fast reply!
Can i get the code ?
gitlab.com/DiyPetFeeder/feeder.git
Hi this is very well made, we would like to ask for help because we wanted to make the same project but using android phone and making an app. We appreciate all the help you can give us. subbed!
Good luck with the app. Using the api probably easiest way to integrate with an android app. The code is on gitlab as well. Feel free to modify and add an features you like.
@@diypetfeeder1205 we encountered a problem on the website. it is blocked in our country/isp. this is sad news
What exactly is blocked?
Hello! Thanks for a this video! Please, tell me can you add subtitles to this video? My englisch is not perfect so.. :)
I will look into adding subtitles. Please give me some time as the video is pretty long.
Apologies adding subtitles slipped my mind. Following the written directions along with the video should be just as good as subtitles though. Link here: drive.google.com/open?id=12b4Bzq5u67sQ7vvfZI9Wh92H_r2RVhh2vrMzNrYyuPc
Nice project! thaks for sharing it! :D
Hi, may i ask something? Did i need to configure the router setup, if i connect pi through hotspot on my android devices? What should i do? Thank you so much