Solar recharging vibrating motor with nano

Ok my setup is as follows in the picture and code:

  1. A nano runs code that uses wdt to set pin 13 high and low every so often. The idea is to save power and only turn on the motor a few times a day for a few seconds, then turn it off. I believe the code is fine.

  2. the nano runs off a solar recharging battery pack that for now will run without sun so as to ascertain about how much power (for how long given the timing in code) will this battery pack power the nano and the motor. The pack outputs 5V since its made for charging phones and what not. I tested at 5.08V fully charged.

  3. the motor is a small dc vibrating motor.

I just want to make sure the wiring is correct before I power it up.

GND to common GROUND of battery pack and motor.
Vin to 5V from battery pack
pin 13 to red cable on motor

#include <avr/wdt.h>            // library for default watchdog functions
#include <avr/interrupt.h>      // library for interrupts handling
#include <avr/sleep.h>          // library for sleep
#include <avr/power.h>          // library for power control

int nbr_remaining; 

#define led 13
#define motorPin 10

        // not hanging, just waiting
        // reset the watchdog

void configure_wdt(void){
  cli();                           // disable interrupts for changing the registers
  MCUSR = 0;                       // reset status register flags
                                   // Put timer in interrupt-only mode:                                       
  WDTCSR |= 0b00011000;            // Set WDCE (5th from left) and WDE (4th from left) to enter config mode,
                                   // using bitwise OR assignment (leaves other bits unchanged).
  WDTCSR =  0b01000000 | 0b100001; // set WDIE: interrupt enabled
                                   // clr WDE: reset disabled
                                   // and set delay interval (right side of bar) to 8 seconds
  sei();                           // re-enable interrupts

void sleep(int ncycles){  
  nbr_remaining = ncycles; // defines how many cycles should sleep
  while (nbr_remaining > 0){ // while some cycles left, sleep!

  // CPU is now asleep and program execution completely halts!
  // Once awake, execution will resume at this point if the
  // watchdog is configured for resume rather than restart
  // When awake, disable sleep mode
  // we have slept one time more
  nbr_remaining = nbr_remaining - 1;
  // put everything on again

void setup(){
  // use led 13 and put it in low mode
  pinMode(led, OUTPUT);
  digitalWrite(led, LOW);
  // configure the watchdog

  // blink twice
  digitalWrite(led, HIGH);   
  digitalWrite(led, LOW);   
  digitalWrite(led, HIGH);   
  digitalWrite(led, LOW);   

  digitalWrite(motorPin, HIGH);

void loop(){

  // sleep for a given number of cycles (here, 5 * 8 seconds) in lowest power mode
  sleep(100); //8sec x 5 cycles=40s....8sec x 1000 cycles=8000sec or 133 mins

  // usefull stuff should be done here before next long sleep
  // blink three times
  digitalWrite(led, HIGH);   
  digitalWrite(led, LOW);   
  digitalWrite(led, HIGH);   
  digitalWrite(led, LOW);   
  digitalWrite(led, HIGH);   
  digitalWrite(led, LOW);   


If I run my Arduino nanos from 5 volts, it goes to the 5 volt pin. Vin is for more than 7 volts. I have one on my irrigation system running between 10 and 11 volts to Vin.

No matter how small your motor is, measure it's stall current to see if it is appropriate for an Arduino pin ro power it.


What makes you think your "small DC vibrating motor" has a stall current less than 30 mA?

Oh I'm not saying it does. I just didn't want to add more stuff for energy savings.

So I should use a small relay instead to control the motor?

Oh I'm not saying it does. I just didn't want to add more stuff for energy savings.

No, I doubt it would, especially given the size of the enclosure you illustrate.

So I should use a small relay instead to control the motor?

No, that makes it more inefficient - and - you still need a transistor to control the relay!

You need a logic-level FET - that is one whose low ON resistance is achieved at 3 V. Unrelated to the threshold Vgs. Can't recall type number offhand, someone else may kick in. :grinning:

I've got logic level fets.

But why would I need a transistor to activate the relay? I can activate the relay from the nano upon wakening.

I've got logic level FETs.

But why would I need a transistor to activate the relay?

Because - unless you have a rather unusual relay or actually mean a relay module when you say "relay", the relay will - like the motor - draw more than the safe 25 mA from the Arduino pin.

I do mean relay modules like :

Then you have the transistor - and an optocoupler as well - already on the module.

But it defeats the intent of power efficiency as the relay may use as much or almost as much power as your small motor. The FET on the other hand, uses no extra.

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

You have over a 1000 posts, can you place your images into your posts please.

Thanks.. Tom... :slight_smile:

Sorry Tom, which image didn't I include?

Here's the diagram:

I would need the 1 ohm R between +/- of the battery pack to "keep it alive" right?