I found that the vibrator motor (in fact any motor I think) have this property
1. It needs higher Current (and hence higher voltage across it) to start
2. It can continue to rotate once started with like, half the current.
So, I designed two step motor control. Like this
**broken link removed**
And I am using this code,
Code:
#include<htc.h>
__CONFIG(WDTEN & INTOSCIO & UNPROTECT & BORDIS);
#define motor RC4 // running Transistor Base
#define motor_tris TRISC4
#define motorH RC3 // Kick-Start Transistor Base
#define motorH_tris TRISC3
void main(){
OPTION = 0b00001111;
CMCON = 0xFF;
ANSEL = 0x00;
TRISA = 0x00;
TRISC = 0x00;
PORTA = 0x00;
PORTC = 0x00;
unsigned char counter = 0;
motor_tris = 0; // output
motorH_tris = 0;
while(1){
OPTION = 0b00001111; // maximum watchdog timer
// prescale 1:128 2.3 seconds
SLEEP();
counter++;
if(counter==5){ // happens to be around 11.5 seconds (for test purpose)
// finally counter==255 which would occur ever 9.8min
counter = 0;
OPTION = 0b00001000; // adjust WDT prescale for 18 ms
motorH = 1; // kick start
SLEEP();
motor = 1; // Sart Running
motorH = 0; // stop Kick
OPTION = 0b00001101; // adjust WDT prescale for 575 ms
SLEEP(); // wait (sound still on)
motor = 0; //Stop Running
OPTION = 0b00001100; // adjust WDT prescale for 72 ms
SLEEP(); // wait (sound still off)
OPTION = 0b00001000; // adjust WDT prescale for 18 ms
motorH = 1; // kick start again
SLEEP(); //
motor = 1; // start running
motorH = 0; // stop kick
OPTION = 0b00001101; // adjust WDT prescale for 575 ms
SLEEP(); // wait
motor = 0; // Bruuum~~Bruuum complete :)
}
}
}
I checked the power consumption of the PIC in sleep mode again, disconnecting all peripherals. (And, connecting MCLR to VDD through 400K). It was 4.5 uA.
From the datasheet, the maximum current that WDT can consume at 3V is only 3.5uA.
Is this normal or am I missing something.
Not, that its critical (I am going to use up most of the battery on Vibrator anyway), but just for the sake of knowledge.
Last of all, Is it fine for me to keep posting like this here (with no specific question), but I like to do this for the sake of sharing and documentation. If you don't like, just mention, and I will stop.
Thanks.