The Digispark > Digispark Projects
sleep mode
fr:
Hi,
How to ask digispark to put in sleep mode until a state change on one pin ?
Bluebie:
The digispark uses quite a bit of power through the USB circuitry (the pullup) and the power LED so if your goal is to use a very very small amount of power, you'd have to cripple the digispark. Better to program raw AVR chips.
fr:
I understand.
I love the simplicity of digispark, communication by USB for debuging but it is a project where it would be used alone
I have no experience on ATTINY85 use alone with language arduino.
If you have some links...
Bluebie:
Do you really need sleep mode for your project? You can't make the digispark be powered just when it is needed for instance? It's easier to remove the 5 second delay from the bootloader than to learn to program and work with raw ATtiny85 chips at the moment.
In the future (next release or maybe the one after that) the digispark software will be getting a lot better at working with raw ATtiny85 chips. For now it takes a bunch of messing with fuses with an ISP programmer to setup a chip to be compatible with the digispark software.
If it is really completely unacceptable I can try and write up some info on how to program a raw chip. Let me know which operating system you're using if so. Digispark uses about 20ma to run when not asleep. Sleep mode can probably make that number about half as much without doing hardware modifications to the circuit board like removing the power LED and possibly crippling the USB port.
On a raw ATtiny85 chip sleep mode will reduce power consumption to about 0.01ma
fr:
Bonjour à tous,
Mon projet est un interrupteur magnétique pour rc.
En bateau l'eau est l'ennemi et avec ce genre de gadget on peut protéger, en même temps le circuit doit surveiller la batterie afin qu'elle ne soit pas détruite. Il existe un produit qui fait cette dernière fonction très bien mais pas pour les LiFePO4
mon code et le schéma
#include <DigiUSB.h>
const int pinPont = 1; // An1 (ou pin 7 sur ATtiny85) milieu du pont
// extérieurs vers ground et +5V après vers lipo
const int pinMagn = 0 ; // P0 (ou pin 5 sur ATtiny85) capteur effet hall mégane
const int pinBuzz = 5 ; // P5 (ou pin 1 sur ATtiny85) buzzer
const int pinMosfet = 1 ; // P1 (ou pin 6 sur ATtiny) commande mosfet
int val = 0 ; // variable pour valeur lue
int nb = 0 ; // variable de test
unsigned long StartMs = 0 ; // durée pour viser tampon com USB
const unsigned long dureeAffich = 2000 ; // Durée d'affichage
void setup() {
DigiUSB.begin();
pinMode(pinBuzz, OUTPUT) ; // set a pin for buzzer
pinMode(pinMosfet, OUTPUT) ; // set a pin for led intégrée et mosfet
//P2 pas besoin de déclarer la pin
// Attention liaison usb sur P3 et P4
}
void loop() {
if ( (millis()-StartMs) >= dureeAffich )
{
val = analogRead(pinPont) ; // lire tension accus
DigiUSB.println(val);
StartMs=millis() ; // Réarme le chrono
if (digitalRead(pinMagn) !=0 || val > 800) {
digitalWrite(pinMosfet,LOW) ; } // le mosfet 25N05 est passant, la radio est allumée
else {
digitalWrite(pinMosfet,HIGH) ; //le mosfet est bloqué,la radio est éteinte
// prévoir mise en sommeil ATtiny
} // http://arduino.cc/forum/index.php?topic=83826.0
if (val < 600) { // la tension est basse
digitalWrite(pinBuzz,LOW); } // Pas d'alarme sonore
else {
digitalWrite(pinBuzz,HIGH); }
}
DigiUSB.refresh(); //pour que la liaison USB fonctionne correctement
}
Actuellement je mesure 40 mA en consommation, je vide donc la batterie en 5 heures et surtout elle meure car elle va continuer à se vider au delà des valeurs limites
My project is a magnetic switch for rc.
Boat water is the enemy and with this kind of gadget can be protected at the same time the system must monitor the battery so that it is not destroyed. There is a product that makes it function well but not for LiFePO4
my code and schema
I currently use is 40 mA, so I empty the battery in 5 hours and especially because she dies she will continue to drain beyond the limits
Navigation
[0] Message Index
[#] Next page
Go to full version