MQTT controlled Cat Feeder

@kayhanbelek I’ve followed the diagram so there’s only one 12v power supply which goes to the motor driver. The nodemcu receives 5v power via the same motor driver – and it is already grounded back through the motor driver the same way. (so the power supply and nodemcu are both connected to ground on the motor driver)

I don’t think it’s a grounding problem, as best I can tell.

Here is mine i did

in the .ino script

const int stepsPerRevolution = 200;  
const int shots = 4;
const int DelayBetween = 250;
int stepsPerDose = (stepsPerRevolution / shots); 
Stepper myStepper(stepsPerRevolution, D1,D2,D3,D4);  

This let be able to send a Shot to the Feeder

here the Script

script: 
  feed_the_cat: 
    alias: Feed the cats
    sequence:
      - service: mqtt.publish        
        data_template:
          topic: 'home/catfeeder/feed'
          payload_template: '{{states.input_number.cat_feed_dose.state|int}}:feed'   

base on the input number was how much it gets

input_number:
  cat_feed_dose:
    name: Doese
    icon: mdi:format-list-numbers
    min: 0
    max: 10
    step: 1
    initial: 3 # <= Make this the Default Value 

here is part of the void feedCats

// feeds cats
void feedCats(int Dosees) {
  int ii;
  analogWrite(enA, 700);
  analogWrite(enB, 700);
  for ( ii=0; ii < Dosees; ii++){
    myStepper.step(stepsPerDose);
    delay(DelayBetween);
  }
  analogWrite(enA, 0);
  analogWrite(enB, 0);
  delay(2000); // you may wanna change this based on how many times you press te button continously 
....

I know its a over kill got bored one day

Hey everyone!
I am a bit late to the party, but currently making this project!
I’ve got most of the things working, but I was wondering how did you guys attach the rod of the motor to the cereal dispenser? I’m having trouble coming up with an elegant solution.
My dispenser is a different one than linked in this thread, but I could still use some advice.

Hi. Did anyone found a fix for the Nema motor rotation ? I’m having the same problem. With a value of 50 stepsPerDose or 100, no change, only about 60° rotation, not enough for a dose.