Hello everyone, it's my first topic, i hope i've done it correctly.
I need to power a 12v 100 mA brushed motor and it needs to be running a fixed time every day (ex. 1 hour from 12.00 to 13.00).
Moreover i need to add a button to make the motor spin for a short period of time (ex. 10 seconds). It will be used to demonstrate the movements of the machine i'm building.
I know a little of C language from university but i'm totally lost, any help would be really appreciated.
Sorry for my english, it's not my first language.
Thanks!
Does the motor turn in one direction only or must it be reversible? You will need a motor driver of some sort as the Arduino cannot power a motor. The main specs to look for in a driver are the rated motor voltage and stall current of the motor.
To keep precise time of day you will need an external time reference as the internal Arduino clock is not that accurate. That could be a RTC (Real Time Clock) or from the network.
Thanks for the answer, the motor needs to turn just one direction, and the timing doesnt need to be super precise.
What kind of research should i do to find the right motor driver?
Is it possible to use Arduino to activate a small relay that will power the motor from a different 12v battery?
I'm trying to keep it as simple and understandable as possible because it will be used for educational purpose.
A 100 mA motor will almost certainly be fine with a standard motor driver such as the TB6612FNG, or if running in only one direction just about any logic level MOSFET (except small signal ones).
For time, indeed a battery backed RTC would be appropriate to keep the thing on track. Otherwise you're losing or gaining several minutes a day, and your timing will be seriously off after a few days. Without RTC your timing will be completely off after a power outage, as the Arduino has no idea on the wall clock time.
The button is simple: check the button example; you can just use a delay() call to keep it running for 10 seconds if there's no need to interrupt it.
What kind of research should i do to find the right motor driver?
The first thing to know is the stall current of the motor. That is the current that the motor draws every time that it starts. The driver must be able to supply that much current. The motor data sheet should have that spec or you can estimate the stall current by measuring the resistance of the motor winding. The current is the supply voltage divided by the measured resistance. Take many readings while turning the motor a bit between readings and use the lowest.
Is it possible to use Arduino to activate a small relay that will power the motor from a different 12v battery?
Yes you could do that. In fact having separate supplies for the motor and Arduino is the best practice. However, the Arduino needs a driver to actuate the relay. An Arduino output can't drive a relay so a transistor is used to switch the relay coil current. Since you need a transistor anyway, why not use it to drive the motor. Here is a MOSFET motor driver.