# Remote Reward Dog Trainer

Hi!

I am a total newbe in arduino and start to make a remote reward controlled dog trainer.
After filling the reward feeder I want a step motor to rotate 1/10 turn each time I push a button.
I would appreciate some tips on how to solve this with an arduino.
My stepmotor is a 28BYJ-48.

Have a look at the stepper examples in the ide.

anqas:
I would appreciate some tips on how to solve this with an arduino.
My stepmotor is a 28BYJ-48.

Have you written a simple program to make the stepper motor move? If not, that is the first thing to do. There are dozens of Forum Threads about 28BYJ-48 stepper motors and I'm sure there are also many other online tutorials.

The 28BYJ motor needs 2048 steps per revolution so 1/10th of a revolution would be about 205 steps. Ten jumps of 205 steps would be a little too much so do 8 jumps of 205 steps and 2 jumps of 204 steps.

...R

You will loose quality friendship to the machine You intend to make. What would You prefer, being rewarded by a nice, loving human being or a machine?

Hi Railroader I will use this when I train agility and I can´t be in two places at the same time. If I send the dog to jump over agility obstacle or run true a tunnel I have to reward him exact when he is doing right and then I haw to reward him from distant.
And Robin2, I did not think of that maby I could have only 8 feeder make it 256 steps.

anqas:
And Robin2, I did not think of that maby I could have only 8 feeder make it 256 steps.

I don't think there is any need for each move to be the exact same number of steps. An error of 5 steps would only be about 1 degree. You just need to ensure that the total number of steps for a revolution is exact so that you don't get a long term error.

...R

So the trainer is not following the dog around the track and is not "there" when and where the dog performed well? Never mind....

The mechanics will be one major task.

Hi again! I am working with this projekt read and looked on videos tutorial and come so far that tis program will start the feed sequence and stop there, but I get stuck, cant start the secuese of the motor with the button, so I will be grateful if someone could give me some good advice.

rewarder.ino (1.19 KB)

If You use code tags for attaching code more helpers will answer. Some of us don't want to fill up our harddiscs with code from OPs.

Attache the wiring diagram.
Also tell what driver boards You use for steppers and other current needing devices.
.

Excuse me but how to use code tags for attaching code?

First select, use the autoformat in the IDE. Then mark, select, the entire code. Then click on the symbol up to the left in this window. It looks like </>.
The paste the code! Voila!

Thanks Railoader for info, and yes I have looked for examples and come so far that this code will drive the motor in the sequense I want, but I dont find some way to start the loop sequens with the button. The botton is wired with a pull down resistor.

Hi Pal! where is Your code tagged code? Maybe a sharp helper would step in.....

Your code for moving the stepper looks like nothing I've seen before.
If I haven't missed information I guess that You have tied the stepper directly to the Arduino. Correct?

Still, attache a wiring diagram!

Dont know where the expired but try to post a new one

``````#define STEPPER_PIN_1 9
#define STEPPER_PIN_2 10
#define STEPPER_PIN_3 11
#define STEPPER_PIN_4 12

boolean reward = true;
int button = 3;
void setup() {
pinMode(STEPPER_PIN_1, OUTPUT);
pinMode(STEPPER_PIN_2, OUTPUT);
pinMode(STEPPER_PIN_3, OUTPUT);
pinMode(STEPPER_PIN_4, OUTPUT);
Serial.begin (9600);
pinMode (button, INPUT);

}
void loop() {

if (button == LOW)reward = false;
if (button == HIGH)reward = true;
if (reward == true)
for (int j = 1; j <= 51; j = j + 1 )  {
Serial.println(j);
delay (2);
digitalWrite(STEPPER_PIN_1, HIGH);
digitalWrite(STEPPER_PIN_2, LOW);
digitalWrite(STEPPER_PIN_3, LOW);
digitalWrite(STEPPER_PIN_4, LOW);
delay(2);

digitalWrite(STEPPER_PIN_1, LOW);
digitalWrite(STEPPER_PIN_2, HIGH);
digitalWrite(STEPPER_PIN_3, LOW);
digitalWrite(STEPPER_PIN_4, LOW);

delay(2);
digitalWrite(STEPPER_PIN_1, LOW);
digitalWrite(STEPPER_PIN_2, LOW);
digitalWrite(STEPPER_PIN_3, HIGH);
digitalWrite(STEPPER_PIN_4, LOW);

delay(2);
digitalWrite(STEPPER_PIN_1, LOW);
digitalWrite(STEPPER_PIN_2, LOW);
digitalWrite(STEPPER_PIN_3, LOW);
digitalWrite(STEPPER_PIN_4, HIGH);
delay(2);

}
reward = false;

}[code] code expired try to send a new one.
``````

Bingo! That's the code. Now go for the wiring. Pen, paper and a picture....

Here is the wiring example I used dig in 9-12 and a button with a pull down resistor wired to dig 3.

That can't work. There is no power supplied to the system......

Whats is the status of the proj now? What works and what doesn't?

I used +5v extern supply and when I download the sketch the motor start and spin 1/10 turn and than stop

5 Volt extren… Where did You apply it on the controller? Is that 5 volt also supplying the motor? 5 volt looks like very little in my eyes.

Something wrong in this line of code

``````    for (int j = 1; j <= 51; j = j + 1 )  {
``````

What if You tampere with the 51?