Reputation: 317
I am doing a pet feeder with React-Native app - Node.js server - Arduino (ESP32) but I can't figure it out how to make it work so it drops food at specific times.
I was looking into nodeJS libraries like node-schedule or cron but I can't figure it out or they don't seem to fit my needs.
At this moment I can make it drop food when I press a button in my app, but that would make it too simple (I want both manual AND automatized tasks). My intention is to schedule feeding hours for your pet to eat, for example at 9:00, at 15:00 and at 21:00 via app, with some sort of alarms, while also being able to check them on demand and edit/delete options.
Any ideas on how could I do it, please?
Upvotes: 1
Views: 774
Reputation: 477
You don't necessarily have to trigger the "drop food" command from the node app. I've written firmware for a device that connects to wifi, updates its internal date/time from a NTP server, then wakes up at a specified time every data to connect to a server and get setting updates. Ours is a battery powered device, so it doesn't just stay connected to the server all the time, and I used the ESP-IDF but the code was simple enough. I did some research and you can do the same process with an ESP32 using the Arduino Core.
Basic Idea
You could:
Then after a feeding event occurs:
Resources:
Setting Local Time on Arduino using NTP
Using FreeRTOS timer interrupts on Arduino
Upvotes: 1