Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

voltage divider

Status
Not open for further replies.
I might just take 2-3 AA batteries .. rechargable with a nice 2500mAH.. which would mean this would last about 125 hours on 1 full charge.Thats about 1 charge a month...

If you decide to go the NiMH rechargable route, go for the ones with a low self discharge. Panasonic calls it R2 technology. They have a lower capacity than regular NiMHs, but when used in low drain applications like yours, will last much longer.
 
I have a LED using about 7-10ma when on (run mode) and my pic is taking about the same i suppose in run mode. So im using about 20mA of current + buzzer when in use.

Now in sleep mode im using almost no current so i suppose it will last a mighty long time while sleeping :D I will look into those batteries thanks.
 
Hi again,


I am happy to hear you got the sleep mode working. I am always amazed
at how little power the PIC chips can use when powered down and how
useful this feature can be with todays battery operated devices.

I was using a wireless thermometer as a refrigerator monitor that used three batteries
about every two months. I got tired of changing the batteries, so with a $2
PIC chip and a cheap thermistor and a few tiny resistors and an LED i made a
monitor myself, and it powers down for 3 seconds at a time, waking only to
take a measurement and yell if something is wrong (temperature too high).
Now the predicted life of the batteries is about 2 years. Quite a difference :)
 
Last edited:
Nice work!

Smart thing to use batteries. Some might tap off the frig. itself. But wounder why it wont scream when the temp is high :D if power gets cut you cant take temp or warn user.

With batteries. Its on when it has to be and working with no external power...

I feel like making a wireless sensor now lol
 
hey guys more fun for my son lol i found a older toy ... its a green bow and arrow thing plastic. Without the bow part. It kind looks like a shotgun. But green lol

I might mod it.... I made my buzzer make a cool laser shooting sound and i want to through it in it.

With a nice RBG LED for when he presses the trigger it hits the button and plays the laser sound and flashes the led cool colors...

here is the sound part i got so far...(also includes the sleep code too!

Code:
#include <p18Cxxx.h>
#include <delays.h>
#pragma config WDT = OFF, LVP = OFF, OSC = INTIO2

#define button1 PORTBbits.RB0

#define MainButton PORTBbits.RB0
#define MainButtonT TRISBbits.TRISB0
#define MySec 3

char pos;
unsigned long time;


void ShootLaser(void);
void high_ISR (void) ;
void high_interrupt (void);
void NightTime(void);



#pragma code high_vector = 0x08
void high_interrupt (void){
_asm goto high_ISR _endasm
}
#pragma code

#pragma interrupt high_ISR
void high_ISR (void) {
    INTCONbits.INT0IF = 0;
    INTCONbits.RBIF = 0;
    LATAbits.LATA0 = 1;
    ShootLaser();    
}

void main(void){
 int k,j,i;
    OSCCON = 0x72;              //8MHz clock
    while(!OSCCONbits.IOFS);    //Wait for OSC to become stable

    pos = 0;

    ADCON1 = 0xFF;
    TRISB = 0x00;
    TRISA = 0x00;

    MainButtonT = 1;


    INTCON  = 0b11010000;
    INTCON2 = 0b11110000;
    INTCON3 = 0x00;
    RCON    = 0b10000000;

    time = 0;
	while(1){
        time++;
        if(time == (MySec * 200000)){     //x seconds @ 8 MHz
            NightTime();
        }
	}

}
void NightTime(void){
    LATAbits.LATA0 = 0;         //Turn off LED
    OSCCONbits.IDLEN = 0;       //Clear he IDLEN and SCS1:SCS0
    OSCCONbits.SCS1 = 0;
    OSCCONbits.SCS0 = 0;
    Sleep();                    //Call Sleep instruction
}

void ShootLaser(void){
 int k,j,i;
        for(k=0;k<80;k+=1){
            for(j=0;j<5;j++){
                LATBbits.LATB1 = 1;
                for (i=k; i; i--);
                LATBbits.LATB1 = 0;
                for (i=k; i; i--);
            }
        }

time = 0;
}
 
Hi again,


Just wondering, did you measure the chip current while it is in the sleep mode?
Just to make sure it really went to sleep...i guess you read up on all this by
now though anyway.
 
hey this is the outcome of my latest toy mod lol i find it cool! It was just a normal plastic gun nothing electronic inside. (not anymore)

**broken link removed**
 
Hello Jason,
Here is a simple formula to use for finding the V-junction between 2 resistors

V-junc = V x resistor B / total resistance of A & B

where resistor A is connected to V+ and B is connected to ground.

I found this formula in an electronics book.

Cheers Bryan
 
Status
Not open for further replies.

Latest threads

Back
Top