Petoneer Nutri Smart Pet Feeder
An overview of the Petoneer Nutri Smart Pet Feeder, as well as ESPHome flashing and integration into Home Assistant.
I have had the idea to purchase or make my own automatic portion dispenser for pets for a long time. This is both convenient for hosts and unusual for guests. The network already has examples of home-made “smart feeders”, for example, this one:
I also have a couple more bookmarked on GitHub:
In terms of cost and interesting pastime, this is undoubtedly the best option. Especially when “it” is “alive” and will feed your cat. As in the case of everything homemade, the process itself is interesting)
My task was to make it all look nice, including hidden electronics with wires. I’ve almost started building my feeder, taking ideas from the links above, but circumstances have changed. Well, now I’m the owner of Petoneer’s Nutri Smart Pet Feeder.
Packaging, appearance and equipment
The packaging was a little wrinkled, but everything arrived safely. The characteristics of the feeder and the qr code of the application in the AppStore and Google Play are already painted on the box.
Includes feeder, bowl and 5V 1A power supply with micro usb cable 120cm long
The body of the feeder is made of matte plastic, it will not collect fingerprints. And the plastic feels nice too.
Feeder dimensions 230x246x352mm, weight 2kg.
On the front side there are indication LEDs and two buttons. The top button is mechanical, to open the lid. The bottom button starts serving a portion.
The bowl is also made of plastic, which is of course a minus. I would like something more durable. It is inserted quite easily, you just need to lift the feeder and insert the bowl into the groove.
On the reverse side of the feeder, in addition to the sticker with the name, there is a place for a power bank. It is hidden behind a stub.
Very comfortably. The pet will be fed even if the power goes out.
Below is a micro usb connector for the main power supply, holes for the speaker and buzzer. In the niche you can hide the excess cable.
Airtight Pet Dog Food Storage Container 3 Piece Combo H520
Inside the feeder, a capacity of 3. 7 liters and feed level sensors are installed.
The sensor is laser. When there is food, the beam is interrupted. If there is no feed, the beam shines from one point and gets into another, the sensor works.
The same principle of the second sensor located under the dispenser. If the beam is interrupted during the issuance of a portion, then everything is fine.
First launch and basic functions
Now we turn on and try all this in action. The feeder can be used without an application, but the whole point in it is then lost. We turn on the network and try to give out a portion with a button on the case
When issuing a portion, a sound signal is triggered. The motor, spinning the blades, is rather quiet. I was seriously ready for a loud sound. The sound signal is even louder than the motor.
Now add the feeder to the application. Since I have this first device from Petoneer, I need to register. There are no problems with this.
Next, click +, select Nutri and follow the instructions on the screen
We call the device and you can control the issuance of food.
The application is intuitive. Everything is well translated and nothing lays. It’s nice to use it. You can give the feed button to feed now or configure schedules.
Schedules are configured by time and number of portions. The maximum amount is 12. You can note the necessary days of the week, but individually it will not work to configure the days. For example, on Sunday, only 5 feeders will not work.
In the settings, you can rename the device, see the firmware version, as well as turn on or turn off the feeding button on the feeder and set the number of portions for it.
The cat immediately appealed to the cat. I read that some animals are initially afraid of such devices. Mine immediately climbed all over. I was especially surprised at the amount of food in the open feeder)
And when pressing the button to feed now, I immediately ran to a bite.
With a successful or unsuccessful issuance of a portion, a notification comes to the phone. The application also announces when the food ends or ends even.
Now we will analyze the feeder and see what is inside.
Disassembly and flashing Esphome
I began to disassemble the feeder from the main control board. It is located right behind the buttons and indication LEDs, from the inside. We unscrew 5 screws of gray plugs and here it is:
We unscrew 4 more screws that hold the fee.
It immediately became clear that the TYWE3S module based on esp8266 is responsible for wifi. Also, a side feed level sensor is connected to the board and its power supply from the opposite side with red-black wires. The yellow wires are connected to the motor, another sensor and power at the bottom of the feeder.
In the process of studying the board, I found out that the MCU labeled STM8S005K6T6C is responsible for the logic. Engine control and status indication is his job. Tywe3s is just an intermediate for wifi control.
Empirically, I also found out that the white LED is gpio4 on the TYWE3S module, which is responsible for indicating the wifi connection, and gpio5 works when the button is pressed.
We understand further. At the bottom of the feeder, under the rubber anti-slip pads, there are screws. We unscrew them and separate the upper part of the case from the lower one.
Here we have a power board and a motor that dispenses food.
Between the blades is another sensor. Most likely triggered if the blades were not scrolled, that is, for food jamming.
In the part of the body, on which the feed is poured out, there is a sensor that monitors the delivery of feed. If at the time of issuance it works, that is, the food spills out, then everything is fine. If not, there will be a feed dispensing error.
Now about the firmware. As I wrote above, gpio5 is responsible for the feed button on the TYWE3S module, gpio4 is responsible for the wifi indication. I made a simple ESPHome config and filled it in, soldering to the necessary esp8266 pins
The config for ESPHome is the following:
I uploaded the firmware via esptool with the command:
Specified the actual size as 1mb for the TYWE3S module, although esptool recognizes 2mb. In the process of studying the board, I had problems restoring the backup of my native firmware because of this.
Status_led works with this config, that is, an indication of wifi connection, and a button for issuing feed. I had to write an additional template switch petoneer_nutri_feed to simulate a short press. 150 ms. Quite similar to the physical pressing of a button. For the first petoneer_nutri_feed_button I added only id without name so that it would not be displayed in the Home Assistant interface.
At this stage, we can control the distribution of food, but we do not know anything about the state – whether the food is dispensed and whether it is available at all. It was possible to go by monitoring the communication of esp8266 and STM8S005K6T6C via UART, but I chose a slightly different and easier to implement method. I connected the red indication LED to a free gpio14 on the esp8266. In the photo below, this is the blue wire.
And he began to imitate possible events associated with the issuance or absence of food and track the LED. For example, when the feed is issued and the container with it is complete, the LED does not burn at all. If the feed is less than the level, the LED flashes with a frequency of about 1 second. If the food does not pass through the lower sensor during issuance, the LED will begin to flash with a frequency of 2-3 seconds, it certainly did not measure. Or, if when the LED flashed due to the low level of feed, the sensor did not work in the lower part of the feeder, the LED will light up and shine.
I created a text sensor so that Esphome would write down all the states in it.
As a result, I hung a low level of feed and an error in the issuance on ON_CLICK BINARY_SENSOR with different frequency of delay. This was the easiest way. But with other statuses I had to look for other ways. I created a script, called it the Detection, and set the conditions in it with the LED turned off and when the LED is working. I set the response period for both conditions of 5 seconds.
If the LED is turned off for 5 seconds, the status of a text sensor becomes OK. If 5 seconds are burning, there is no feed, respectively. I do not remember what exactly happened during the tracking of the LED, but I also indicated for the status of the absence of food an error.
Then I hung up the implementation of this script on Interval to execute with a given frequency.
But because of this, the Esphome log was crowded, and I prescribed the script of the script for any change in the Binary_Sensor of the Red LED.
And when loading the firmware to know the status of a newly neglected device.
So that when issuing food (pressing. Petoneer_nutri_feed_button), the status of a successful or unsuccessful feeding showed the correct condition, hanging on it at ON_TURN_ON another piece of automation:
I wanted to make sure that with manual pressing the feed button, the successful status was also updated. I made another Binary_Sensor on the same pin as Switch – GPIO5, and hang the same automation on it, only at ON_RELEASE, since the issuance occurs at the time of release of the button. The status was worked out, but now only with a manual pressing of the button. Switch stopped working from Home Assistant. Removed this Binary_Sensor from the code.
Then I decided to configure the control of the Zummer. He worked every time when issuing food, and since I have a small child at home, this is not a very useful option. Of course, it is good that each feeding is accompanied by sound indication, but it will be useful to configure manual control. And the ability to create automation in Home Assistant, for example, turn off the sound in the evening. To do this, I used another free pin on TyW3s – GPIO16. And here is such a relay module that I had idle:
It perfectly approached one of the many free places in this part of the feeder. In the relay break, I launched a plus cummer contact. To do this, he dropped it, bent a plus leg to its side and soldered the wire to it. And he soldered only the remaining in place, and the exit with the relay soldered into the original contact.
He took the land for the relay module from the power supply, and the 3. 3v and the wire on the GPIO16 pulled to Tywe3s.
All this is closed without problems with a plug. There are more than plenty of places.
The final config for Esphome is as follows:
I am sure that you can make automation in the config more elegant, I will be glad to hear advice on this.
An example of a feeder control from the Home Assistant interface:
Home Assistant automation tools can be configured to issue feed on schedule and send only the necessary notifications.
The feeder is very interesting, both in terms of functionality from the box with the native cloud application, and in terms of refinement. There are a lot of places, you can embed any sensors. The engine works quietly, the plastic is pleasant to the touch, and the feeder looks great. The place for Powerbank is also a big plus. The unique operation of the indication LED allowed to track it for integration with alternative firmware for local control. And most importantly – animals are satisfied, and they will beg for food already at this white container