#Automatic cat feeder

48 messages · Page 1 of 1 (latest)

teal zinc
#

Hi everyone,

I wanted to share my project of an automatic cat feeder that integrate in HA.
I share the thingiverse link where you will find all information regarding the project. It's highly based on another thingiverse project, I just replaced the Arduino to an ESP8266 to connect it to HA, and some tweeks for my personal needs
Might update the thingiverse later on if i need more functionality but for now it works perfectly.

And thanks to @bitter jacinth for helping me to understand a bit more ESPHome 🙂

https://www.thingiverse.com/thing:6622879

shrewd tartan
#

Whooah!

#

Don't you have one for sale?

#

We need one super-urgently - we're gonna be on vacation for a week

teal zinc
#

Unfortunately not, I didn't plan to sell it

wheat pulsar
#

Pindaaaa's 😛

pallid bane
#

how can this even work without you posting a cat tax pic??

teal zinc
#

Here you go, i didn't knew about this tax sorry

pallid bane
#

ahh what a sweety!

#

one thing - how big is it ? what size of build plate do u need?

teal zinc
#

size is 33(length)x33(height)x17(width) cm

#

build plate for the printer is 22x22 that i used

#

for the biggest part it's the base, i had to print it on the flank but it works

pallid bane
#

not too bad i thought it was bigger

shrewd tartan
pallid bane
shrewd tartan
#

So I need a feeder for her

teal zinc
#

print time i would say about 30h, longest print is the tank by memory

fathom maple
#

What was the weight of this print? My local printer chargers in grams

teal zinc
#

I don't remember sorry

fathom maple
#

Please add all files to a single thing verse.. It will reduce confusion

#

I did download some files from the original project

#

My cats would love this

vagrant gale
#

don't forget a B plan in case the power goes down or your cat might starve 😿

#

or just be notified of the power outage + call a neighboor

#

tbh i draw the line of DIY at "anything that involves life or mains electricity unattended" 👀

teal zinc
#

Personally the feeder is for when I'm at the office or leaving for less than a day. Otherwise I always have someone coming once a day.
Also I have some alerts setup in HA in case of issue with the feeder itself (run time, disconnection)

teal zinc
pallid bane
#

i think that is the convention on the site?

teal zinc
#

I thought so also seeing multiple remix done

pallid bane
#

well the creator of the first design didnt complain and u linked everything in the right way so i think you are doing it in the right way

teal zinc
#

Also I have a question / issue if anyone can help. The HX711 is drifting a lot, I have to make zero almost everyday. Is there a way to avoid that ?

fathom maple
ornate mantle
ornate mantle
#

Here's a snippet of my litterbox yaml where it works. My units are in KG, and my threshold is 5g (0.005).

  - id: tare_value
    type: float
    initial_value: "0.0"
    restore_value: True
  - id: auto_tare_value
    type: float
    initial_value: "0.0"
    restore_value: True 
sensor:
  - platform: hx711
    id: hx711_raw_value
    dout_pin: GPIO16
    clk_pin: GPIO4
    gain: 128
    update_interval: 0.2s
    unit_of_measurement: "kg"
    accuracy_decimals: 3
    filters:
      - calibrate_linear: 
          - 205154 -> 0.0
          - 752029 -> 4.169
          - 1564936 -> 10.404
          - 2921084 -> 20.846
      # Ignore reading spikes
      - lambda: if (x > 40.0 || x < -20.0) { return {}; } else { return x; }
      - median: 
          window_size: 4
          send_every: 1
          send_first_at: 1
      on_value: 
      - sensor.template.publish:
          id: weight_value
          state: !lambda 'return x - id(tare_value) - id(auto_tare_value);'
      - lambda: |- # Auto Tare
          if (abs(id(weight_value).state) < 0.005 && id(activity_detected).state == false) {
            if (id(weight_value).state != 0.0) {
              id(auto_tare_value) += id(weight_value).state;
            }
          }
  - platform: template
    id: weight_value
    unit_of_measurement: "kg"
    accuracy_decimals: 3
    filters:
      - lambda: |-
          if (abs(x) < 0.001) {
            return 0.0;
          } else {
            return x;
          }```
#

The tricky part to adapt this to a feeder bowl is what constitutes the "idle" state where you want to auto-tare to 0 all the time. You'll maybe have to keep track of the uneaten weight in a separate global, and add to it after a dispense event, and subtract from it after you pets have finished eating. The activity_detected could be as simple as a vibration boolean derived from the weight value itself:

sensor:
  - platform: hx711
    on_value:
      # other stuff from above
      - lambda: |- # Reading Stability
          static float prev_value = 0.0;
          if (abs(x - prev_value) < ${vibration_threshold}) {
            id(vibration_detected).publish_state(false);
          } else {
            id(vibration_detected).publish_state(true);
          }
          prev_value = x; 
binary_sensor:
  - platform: template
    device_class: vibration
    entity_category: diagnostic
    name: "Vibration"
    id: vibration_detected
    filters:
      - delayed_off: 
          seconds: ${vibration_off_delay}
    on_release:
      - lambda: |- 
          id(food_weight) = std::max(id(food_weight) + id(weight_value).state, (double)0);
          id(tare_value) = id(hx711_raw_value).state;
          id(auto_tare_value) = 0;
teal zinc
#

Hey, thanks for you proposition, by reading what you've done it made me thought that i could make a tare before each distribution. Like that i would be sure that the right quantity is given every time, and my cat is safe blobcatgooglythumbup . So no need to worry about the sensor reading, expect for my personnal tracking.

ornate mantle
#

Sure! The only edge case I would see there is if a cat is actively munching when a distribution is about to start, the tare will be random

#

Also, for health tracking reasons, it may be nice to know how much your cat eats normally and have an alert when the trend changes.

teal zinc
#

still limited to 3 distribution a day that doesn't change. And for the other case, i have a delay of 3minutes to check that the value is stable before making the tare and distribution.

twin verge
#

Hi. I,m having difculty to make the motor works. I, m seeing on the dataaheet of the h-bridge LN298n that the Logic have to be 5v . That works fine with you ?

twin verge
#

I see some using the LN298n like on your schematic , and others ( well One at least) using the in3 and in4 has output switchs for selection of the direction and the enable pin for pwm.... a litle strange ....

twin verge
#

Well forget it , i was being a fool.

#

I bought a female conector for the power suplly in ali and this have 3 pins to connect. Has i was soldering i measure the pins and saw that 2 of them was connect, i thought they were solder inside. Turns out that it is a switch , and when i conect the power suplly the switch opens 🤷.

#

I solder there one wire to the esp and another Wire to the h-bridge. The h-bridge took the PIN from the switch...

twin verge
#

Some thing that could be useful to others.

I was trying to a way that "lower" from analog_thresold could be templetable , but i think it can not.... meanwhile i found a post from Jesse in Reddit that we can do it other way.

#
  - platform: template
    name: quantidade
    optimistic: true
    min_value: 20
    max_value: 200
    step: 1
    set_action: 
      lambda: |- 
        id(missing_food).set_lower_threshold(x);```