Pages: [1]   Go Down
Author Topic: Minimum start-up time  (Read 576 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Full Member
***
Karma: 0
Posts: 128
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi:

I am planning to design a infrared controller. Each time that a button is pushed the Arduino will be powered on and an input will be send to it.

Therefore, I need to know how much time the microprocessor needs to be ready to process inputs (to execute a program).

I will use an Arduino nano or an Attiny85.

Thanks in advance.
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 200
Posts: 12782
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


The biggest delay is from a bootloader.  

Assuming the processor does not have a bootloader ... The processor will be ready for business before your brain has time to send a signal to your hand to release the button.

The latest optiboot is very efficient at getting the application started.   I suspect, even with it installed, the processor will be ready for business long before you are.

But, it is fairly easy to test.  Essentially, you would be building a JEOPARDY! button.  You versus the processor.   smiley-grin
« Last Edit: December 31, 2011, 02:18:41 pm by Coding Badly » Logged

Washington
Offline Offline
God Member
*****
Karma: 38
Posts: 790
Firefox & Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

IMO, Starting the MCU every time is a poor idea.
The amount of time required for startup depends on the startup fuses programmed.
The lowest setting is no delay so all there is - is 1-2ms of overhead. This setting is not recommended because it gives it very little time to stabilize.
The next setting is 4 ms + 1-2ms overhead. It takes about 5-6 ms to startup.
The longest setting is 64ms + 1-2ms overhead. Total startup 65-66ms. This is usually the default.

Fuse calculator is here: http://www.engbedded.com/fusecalc/
Logged

Avoid throwing electronics out as you or someone else might need them for parts or use.
Solid state rectifiers are the only REAL rectifiers.
Resistors for LEDS!

Offline Offline
Full Member
***
Karma: 0
Posts: 128
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

OK, thanks both, so no problem with delay.

IMO, Starting the MCU every time is a poor idea.

I thought this is the way what a remote control works...  
Logged

Washington
Offline Offline
God Member
*****
Karma: 38
Posts: 790
Firefox & Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Normally you would run it in IDLE mode which reduces the power consumption to a very tiny amount but it is waken by an interrupt (which can be a pin change).
Logged

Avoid throwing electronics out as you or someone else might need them for parts or use.
Solid state rectifiers are the only REAL rectifiers.
Resistors for LEDS!

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 525
Posts: 26554
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Even better is to use any key press to create an interrupt to wake the processor from power down sleep mode, it reads the keypad, sends the button, goes back to sleep.

Can use a 8MHz promini running off 3.7V Lipo battery, or wire up a bare minimum board to do the same.
Add your IR transmitter where I have the RF transmitter.


* Simpler_remote.jpg (74.58 KB, 960x720 - viewed 31 times.)
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Romania
Offline Offline
Full Member
***
Karma: 0
Posts: 174
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

what its the purpose of the diods smiley-grin ?
Logged


Washington
Offline Offline
God Member
*****
Karma: 38
Posts: 790
Firefox & Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

what its the purpose of the diods smiley-grin ?
I assume to use one interrupt line without short circuiting the buttons together smiley
Logged

Avoid throwing electronics out as you or someone else might need them for parts or use.
Solid state rectifiers are the only REAL rectifiers.
Resistors for LEDS!

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 525
Posts: 26554
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes. Any button in a row pulls that cathode low to create the interrupt.

Tricky part was discovering that the keypad library left the columns pin High when sleep was entered, I had to drive them low when sleep was entered, then back high to read the keypress after the interrupt:
Code:
void loop()
{
  if (sleep_count>1000){                      // check if we should go to sleep because of "time" --> Try shorter versions of this
    sleep_count=0;                           // turn it off for when we wake up
//    Serial.println("Sleep");               // for debug only
                                             // set the columns low before sleeping, otherwise Keypad leaves them high and Rows have nothing to pull low.
    digitalWrite(7, LOW);
    digitalWrite(8, LOW);
    digitalWrite(9, LOW);
    digitalWrite(10, LOW);   
    delay(100);                               // need this?
    enterSleep();                             // call Sleep function to put us out
   
                                              //  THE PROGRAM CONTINUEs FROM HERE after waking up in enterSleep()
  }                                           // end of checking to go to sleep

Code:
//***************************************************
// *  Name:        enterSleep
void enterSleep()
{
  /* Setup pin2 as an interrupt and attach handler. */
  attachInterrupt(0, pin2Interrupt, LOW);
  delay(50); // need this?
  /* the sleep modes
   SLEEP_MODE_IDLE - the least power savings
   SLEEP_MODE_ADC
   SLEEP_MODE_PWR_SAVE
   SLEEP_MODE_STANDBY
   SLEEP_MODE_PWR_DOWN - the most power savings
   */
  set_sleep_mode(SLEEP_MODE_PWR_DOWN);  // setting up for sleep ...
  sleep_enable();                       // setting up for sleep ...

    // Disable ADC
  ADCSRA &= ~(1 << ADEN);

  // Power down functions
  PRR = 0xFF;

  sleep_mode();                         // now goes to Sleep and waits for the interrupt

  /* The program will continue from here after the interrupt. */
  detachInterrupt(0);                 //disable interrupts while we get ready to read the keypad
  
    // Power up functions
  PRR = 0x00;

/* First thing to do is disable sleep. */
  sleep_disable();

  // set all the keypad columns back high so can read keypad presses again
  digitalWrite(7, HIGH);
  digitalWrite(8, HIGH);
  digitalWrite(9, HIGH);
  digitalWrite(10, HIGH);
  // then go to the void Loop()
}

« Last Edit: January 01, 2012, 06:56:42 pm by CrossRoads » Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Pages: [1]   Go Up
Jump to: