Yes, but mine is a bit outdated. I will update it with the latest version soon.
I just checked with a multimeter which signal (high/low) I will have when a lead is open or closed, which signals I will have when the motor is spinning etc.
For NodeMCU pins - just used random GPIO pins based on PinOut.
The onboard ESP8266 is only used as a WiFi chip, it doesn’t handle the GPIOs I think, there’s an ARM processor onboard that handles it. We probably would need to crack that ARM chip’s firmware to do an offline integration.
Yep, or you need to find out how to connect the existing ESP chip to signal lines with physical wiring.
Unfortunately, I don’t have enough experience to crack ARM chip’s firmware, so I use an extra esp8266 chip to handle this integration.
I don’t know if it’s possible. Number Component — ESPHome, normally, you can set a number component to interact with the ESP for grams of feed.
It will be usefull.
Bare with my ignorance but I’m not sure how you do this? Is the pet feeder powered via the mains when you do this test? I presume one of the probes is attached to a groud and the other to the GPIO pad? And what’s the multimetre set to? I’m keen to know what sort of test this is called so I can Google it further and learn more.
Hi @AndreyShpilevoy, thank’s again for your DIY tuto. I finished to implement ESP8266 on my petkit and it’s work like a charm.
To improve interaction, I perform research and found that how send grams directly to the ESP.
To make this :
- Create an input number :
petkit_grammage:
name: Petkit - Grammage
min: 5
max: 50
step: 5
unit_of_measurement: g
- Create a template who make a multiplication gram * number of millisecond for each. For me, 2000ms corresponding to 5g.
- platform: template
sensors:
grammage_vers_esp:
friendly_name: Grammage vers ESP
unit_of_measurement: "ms"
value_template: >
{% set grammage = states.input_number.petkit_grammage.state | int %}
{{ grammage * 400 }}
- Adding the sensor on the ESP Conf :
sensor:
- platform: homeassistant
name: "Valeur ms dans ESP "
entity_id: sensor.grammage_vers_esp
id: var_grammage
- Change the delay on switch define of the ESP by using lambda function :
switch:
- platform: gpio
pin:
number: D3
inverted: true
id: relay
name: "Petkit - Actionneur croquettes"
icon: "mdi:shaker"
on_turn_on:
#2000 4g
#4000 8g
#20000ms 50g
- delay: !lambda 'return id(var_grammage).state;'
- switch.turn_off: relay
That’s all. Flash the ESP via your prefered option (OTA or USB) and you can set grams via HA to the ESP.
Great!
I added a link to this post in the first message.
Mainboard powered.
Both multimeter probes on both pins that related to the necessary sensor.
Called action that was most interesting for me - tracked results on multimeter.
This is a fully offline solution, right? Of course you need to block connections from the feeder to the internet, but it will be fully operational.
The way that I described in the first post - fully local.
You can think about it like any other regular ESPHome device.
I’ve to set delayed_off to 120000ms (2min). With the delay of 20000ms, the binary_sensor switch to Problem > OK and OK > Problem in 1 second while the compartment is empty.
I followed the steps but i cant seem to get it to work. I hope I did not mess up the board with my bad soldering skills. Funny thing is nothing works, not even the manual button press. Now, I did this on a new feeder, so I don’t know if it worked before installing the nodemcu. Do you need to set it up via the app first?
Usually, the manual button should work even without any preconditions.
I would check maybe you made some breaches between some points and shorted the board.
Removed all custom wiring, plugging it in now gives a steady light, but nothing happens (WiFi configuration, manual feeder both not working). So I guess I have shorted it somewhere or bricked the board.
Any chance these boards can be ordered somewhere?
Hey or someone else, I wanted to buy a petlibro, it does have an camera, anyone knows if it exposes an rtsp feed??
I’m here fighting a bit with this cat feeder and it’s ESPHome code.
I bought this one dumb feeder:
https://www.amazon.de/-/en/dp/B0C2TXSCBK
Which I’d love to make it a bit smarter in HA.
I would like to have the ability to press a button in HA and feed one portion, as well, read and store an event in HA when the motor turned, and for how long.
I was hoping to use this great project with small adaptations to my end. I’d like to use this as a “spy board”, this means all the original functions are kept.
First barrier would be, I’m not a programmer.
I’m doing one change at a time and testing in between because I can more or less understand if I read code…
I already changed some stuff, but I think I have to change my approach.
After some multimeter searching, I can’t use the manual feed button on the unit because:
- It’s in the PCB
- It just sends a 10kOhm resistance and other chip will see it as a sign to manual feed.
After looking into some components, I found the step motor driver.
I receives 2,72V has a start signal, and it sends 4V to the motor to make it turn.
I was wondering, how can I use this to my benefit?
I’m using an 8266 NodemcuV2, so my first question.
How can I put a voltage in the driver pin with the esp pin D1 (for example)?
Question two, can the esp read on another pin (D2 for example) that the driver is sending 4V to the motor?
What would be the code for this?
Hi, can you share a photo of your main board? I’m curious what it looks like overall.
In general, I think it will be much easier to bypass btn than to develop a way to control the motor driver from ESPHome.
Hello Andrey
Thank you for chime in
photo back
Photo front
My idea matured a bit
In the end, I want to
- know when and for how long did the motor turned, and
- I want to be able to press an HA button and turn the motor for a portion. (or via an HA automation)
Read a voltage (the one that makes the motor turn) should be enough to know .1
What I’m not sure how to do, is how to make the esp command the driver…
I even already remembered to buy this Amazon link which is the same driver
, and connect the motor ALSO to this one, controlling it paralelly.
Not sure yet if the esp can control this one.
I think you loaded 2 identical photos
Well, I wish you good luck then)
If you could use a standard button, I think you could read input signals from the stepper driver and check for how long it was active.
Otherwise, if you want to control motor by yourself - you can check this documentation: Stepper Component — ESPHome
But you need to use or A4988 or ULN2003 driver.
I would appreciate if you would keep us updated
Also check this post: ESPHome - 28BYJ-48 motors with A4988 driver (Working Solution) - #9 by fourtrax011