I bought this stepper motor 5V 2-phase 4-wire Stepper Motor :
As a noobie, I choose this motor without making any deeper researches first and I think it's not a good choice. I need your help to be sure
The motor needs 5V to work. I've read many article on the internet and I understood that I need a driver board to control it, but I'm not sure which one to choose.
The objectif is to power up the whole project with one single battery, if possible.
I found this tutorial that might be OK for my project :
However, both of these tutorials are used with a 12V stepper motor. I have read that L298N driver board isn't a good choice to drive stepper motors, but it seems to be possible to power up the arduino through the 5V output that would be great for my project.
So my question are :
Would it be possible to power up the whole project with one single battery ?
=> I have 9V and 3.7V batteries. I think the 9V one is too high for the motor but would be enough to power up both arduino and driver motor ? And the 3.7V wouldn't be enough, right ?
Do you have any other driver board recommandation ?
That is not quite accurate. The L298 is a horrible choice for driving a stepper motor especially a battery driven stepper. The L298's ancient technology drops 2V to over 4V of the motor supply current and burns that power as waste heat.
You can run the motor with a higher supply voltage (than 5V) to get higher speed and torque. The coil current will be limited by the driver. At any rate, make sure to set the coil current limit as instructed in the linked page.
Stepper motors are not the best choice of motor for battery powered projects. They are very inefficient. You can use the enable feature of some motor drivers to turn off the current to the motor coils when the motor is stopped, but the motor will not hold position when subjected to outside force (back driven). Consider a geared DC brushed motor with an encoder, instead. The encoder will allow one to position with good precision and the gear train will resist being back driven when unpowered.
Do not use a those small rectangular 9V batteries for powering a motor. They are OK for smoke alarms, but do not have the current capability to drive a motor for long if at all. It is just a waste of money. If you use the DRV8834, a 2S LIPO (7.4V) might be a good choice.
Surprising that they don't say the number of steps. Did you want a push-pull motion or rotary (this has a leadscrew for push-pull)? The DRV8834 might well be a good choice as it is designed for low voltage operation, but even if you choose to operate the motor from 5V don't power it from the Arduino 5v pin because that can't supply enough current. The 8834 will operate from 5V but also directly from 9v, but not more than 10.8v. Don't worry about the 5v rating of the motor, the 8834 will take care of that.
I chose this motor to use it's push/pull motion. The screw does not have a leadscrew if it unscrews completely, so it can come out of the motor. However, I guess I can deal with timers and reverse the motion after pushing. The goal is to press a physical button on a cat flap.
I take note of your suggestion for the DRV8834. So to power it, a 9V battery or an external 5V smartphone battery could do the trick? So the arduino, the DRV8834 and the motor could be powered with one single battery?
You could use a 5v battery though they aren't common. A 9v PP3 type would power it but not for very long. How often will the cat go through the door? What is the Arduino doing? The power LED on the boards itself can use much of the battery energy.
When I designed an electronic cat flap it started with a solenoid-operated toggle latch but that proved a bit unreliable. Later version used a small dc motor with a short leadscrew to operate the "bolt", ran from 4xAA alkaline batteries, 6v nominal IIRC. Long before Arduino days. 6xAA batteries will give you 9V and could last quite well.
To be honest I'd rather use an ESP32, I have a few in stock.
The idea is that the motor presses a button that physically exists on an existing cat flap. This button allows me to change the mode of the cat flap (e.g. keep cats out, keep them in etc.).
My cats are super hunters, when they bring an animal from outside in the middle of the night, they meow really loud and wake me up. I know right away that they have caught something. Besides being great hunters, they are super smart. If they hear me coming, they hurry back out... And when the way is clear again, they come in again meowing to death all over the house.
The best solution I found is to change the cat flap mode to prevent them from going out once they are in. And of course, if I use the automatic locking mode of the cat flap to keep them out (I can choose to keep the cats out between 11PM and 6am for example), they scream to death at the front door, waking me up and the whole neighboorhood.I love my cats but my sleep suffers, especially when it happens several times a night in summer This solution will allow me to change the cat flap mode directly from my bed when they wake me up xD A bit of a gimmick, but not so stupid if it can prevent me from going back and forth between bed and cat flap.
The motor will only be used occasionally, depending on my cats' skills.
So, a 9V battery should be enough? How long can it keep the system on?
Maybe a stepper motor is not the answer.
Tell us more about the cat flap. And post a picture or weblink.
Is the button electrical or mechanical, push once etc.
The slide switch I have on my cat flap could be better operated with a geared DC motor.
Leo..
The idea is to be able to press the button on the far left. It's a spring loaded mechanical button. The mode of the cat flap changes each time you press the button (for example : first press - first mode, second press - second mode ...)
Yes, but does it move the flap lock mechanism inside, or does it only switch/change the electronic lock mode. If it's electrical, and you're comfortable opening it, then you could add an opto coupler across the switch. The Arduino can then 'push' the switch electrically.
Leo..
I didn't know about optocouplers, interesting, thank you. I guess it should work, but I can't remove the buttons and the cover around them without destroying everything. Maybe from the part that is against the door, I can try but I need to take it down first, I'll give it a try when I have a moment.
When you hit the button and change cat flap mode, you can hear that something happening inside. Probably working with magnetic or something like that. The small plastic parts at the bottom of the cat flap (see photo) go up or down to block the flap in one direction, the other or both. In addition, cats have a chip that lowers these plastic parts so they can enter (cat flap in free passage mode, but only if the chip is detected)
So if I want to use my motor instead, in summary can I :
Buy DRV8834
Power DRV8834 and Arduino with a 9V battery ?
What is the difference in duration between 6xAA batteries and a single 9V battery?
A servo could be a better solution than a stepper motor,
because a servo knows where it is, a stepper motor doesn't.
You only need a tiny one to push a button.
Leo..
There are catflaps mde (by the same manufacturer?) that have wi-fi connectivity...will do all you want? I agree a servo is probably better than a stepper.