I am using an ATMega328 on a breadboard with a 16MHz quartz in a small circuit.
I want to read the time of an RTC DS3231 (0.2mA) and power a small LEGO DC Motor (I think 71427 with ~4mA without load at 3.3V, up to 360mA stalled.) each hour for a few seconds.
I have not checked the power consumption on load yet, but there should be little resistance. Since current vs torque seems linear, I assume something like 20mA.
The ATMega is configured to use watchdog & sleep mode for 1s sleep intervals between checking the clock. (5µA in sleep, 7mA awake).
So In total, the device should use about <1mA while sleeping, once every hour 3-4s something like 30mA. Since the motor is powered by an digital PMW-pin, it will only be able to draw up to 40mA power, so worst case (stuck) would be a total of 50mA.
In other mobile projects, I used an MT3608 step-up voltage converter with 2 AA rechargeable batteries. I was thinking about using a different converter with only 1 AA battery (min V for this converter is 2V) or using a LiPo pack with charger (TP4056?), but both versions seem pretty expensive in contrast to the rest of the setup.
What is the common approach to power mobile low voltage/current devices?
Do you see a problem with the setup I made so far?
dediggefedde:
Since the motor is powered by an digital PMW-pin, it will only be able to draw up to 40mA power,
No, the pin does not limit the current to 40mA. Your circuit must limit the current. If you connect something that can draw more than 40mA, the pin or the whole atmega will be damaged.
You must not use an atmega pin to directly drive a motor. You need to use a transistor. If the stall current is 360mA, then an ordinary npn like bc337 will be OK. You will need a 680R resistor to limit the base current. You will also need a flyback diode such as 1n4004, connected (in reverse) across the motor terminals.
Since the motor is powered by an digital PMW-pin, it will only be able to draw up to 40mA power, so worst case (stuck) would be a total of 50mA.
The Arduino will only be able to supply 40 mA without being damaged. You MUST make sure that the motor does not try to draw more than that. The Arduino does NOT limit how much current is delivered. It will allow a device to draw more than 40 mA, but it will be damaged in the process.
Powering the motor from the Arduino is NOT a good idea.
@PaulRB , @PaulS
Thank you for the warning!
I think the 71427 has a diode built in to prevent damaging the power supply by induction, but I put one in here anyway...
I will use a similar setup as mentioned here then: Arduino - DC Motor , but with 680R.
Do you also have recommendations about the power supply?
The 270R and 1n4001 in that tutorial are also fine.
For low power, run the atmega at 8MHz, 4MHz or 1MHz using its internal oscillator. No crystal needed. Does not sound like you need much processing speed for this application. However, I'm not sure if the i2c bus will run at the standard 100KHz with the atmega clock at 4MHz or 1MHz, you will have to experiment to find out.
For power, I would consider 3x or 4x AA rechargeables.