User Tools

Site Tools


info:program_avr_remoteley_with_zigbee

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
info:program_avr_remoteley_with_zigbee [2008/08/16 07:11] tomgeeinfo:program_avr_remoteley_with_zigbee [2008/08/16 07:20] (current) tomgee
Line 1: Line 1:
-===== Programming Arduino Wirelessly ==== +===== Programming Arduino Wirelessly ====  
-   +
 The Arduino system offers an easy and open-source method for programming microcontrollers. Normally this means using a serial cable or USB cable attached directly to the microcontroller project. But what if your project is floating in a weather balloon, glued to the bottom of a swimming pool or baked into a loaf of bread? It would be great to upload code changes wirelessly, and even greater if you could do it from several kilometers away. The Arduino system offers an easy and open-source method for programming microcontrollers. Normally this means using a serial cable or USB cable attached directly to the microcontroller project. But what if your project is floating in a weather balloon, glued to the bottom of a swimming pool or baked into a loaf of bread? It would be great to upload code changes wirelessly, and even greater if you could do it from several kilometers away.
  
-The following example demonstrates how to build a complete wireless solution for uploading code to a remote Arduino microcontroller using a couple of XBee radios, and a handy function for accomplishing wireless resets. +The following example demonstrates how to build a complete wireless solution for uploading code to a remote Arduino microcontroller using a couple of XBee radios, and a handy function for accomplishing wireless resets.\\ 
-     +\\ 
-Practical Example +**Practical Example**\\ 
- +Minimum parts needed:\\
-Minimum parts needed: (see Tom Igoe's parts list for additional details)+
  
     * Two 5-15VDC power supplies. Radio Shack sells 4AA Battery Holders that are convenient for remote 3.3 Volt circuits.     * Two 5-15VDC power supplies. Radio Shack sells 4AA Battery Holders that are convenient for remote 3.3 Volt circuits.
Line 57: Line 54:
    */    */
  
-int ledPin = 13; // LED connected to digital pin +  int ledPin = 13; // LED connected to digital pin int transistorPin = 12;
-    int transistorPin = 12;+
  
-void setup()  {+   
 +  void setup()  {
    pinMode(ledPin, OUTPUT); // sets the digital pin as output    pinMode(ledPin, OUTPUT); // sets the digital pin as output
    pinMode(transistorPin, OUTPUT);    pinMode(transistorPin, OUTPUT);
  
- blinkLED(ledPin, 2, 500); // startup blink+  blinkLED(ledPin, 2, 500); // startup blink
    delay(1000);    delay(1000);
    Serial.begin(19200); // start serial at 19200 baud, same as programmer speed    Serial.begin(19200); // start serial at 19200 baud, same as programmer speed
    }    }
  
-void loop()  {+  void loop()  {
    blinkLED(ledPin, 1, 250);    blinkLED(ledPin, 1, 250);
  
Line 84: Line 81:
    }    }
   }   }
-}+  }
          
  
-void resetChip(int delayTime) { +  void resetChip(int delayTime) { 
-   /* if the project does not typically receive data, and accidental chip resets are tolerable,+   /* if the project does not typically receive data,  
 +    * and accidental chip resets are tolerable,
    * this is a simple method that should work just fine. Otherwise it is recommended that the     * this is a simple method that should work just fine. Otherwise it is recommended that the 
    * reset request string be part of a call-response sequence, be transmitted with a    * reset request string be part of a call-response sequence, be transmitted with a
Line 99: Line 97:
    blinkLED(ledPin, delayTime/100, 100); // wait for the specified amount of time, doing nothing    blinkLED(ledPin, delayTime/100, 100); // wait for the specified amount of time, doing nothing
    Serial.print("\nResetting NOW.\n\r");    Serial.print("\nResetting NOW.\n\r");
-   digitalWrite(transistorPin, HIGH); // switch on a transistor that pulls the chip's reset pin to ground +   digitalWrite(transistorPin, HIGH); // switch on a transistor that pulls the chip'  reset   pin to ground 
-}+  }
          
  
-void blinkLED(int targetPin, int numBlinks, int blinkRate) {+  void blinkLED(int targetPin, int numBlinks, int blinkRate) {
    // this function blinks the an LED light as many times as requested    // this function blinks the an LED light as many times as requested
    for (int i=0; i<numBlinks; i++) {    for (int i=0; i<numBlinks; i++) {
Line 111: Line 109:
     delay(blinkRate);     delay(blinkRate);
    }    }
-}+  } 
  
-%%  
  
 Once the code has been loaded, replace the Arduino microcontroller into the breadboard setup. You are now ready to upload code wirelessly! Once the code has been loaded, replace the Arduino microcontroller into the breadboard setup. You are now ready to upload code wirelessly!
Line 139: Line 137:
 5. When you've got the timing right, your code will begin to upload wirelessly to the remote Arduino, and you will officially be living in a brave new world. 5. When you've got the timing right, your code will begin to upload wirelessly to the remote Arduino, and you will officially be living in a brave new world.
      
-  Step 5:+Step 5:
  
 Go crazy putting your PAW enabled Arduino systems into impossible places, knowing that you can still fix bugs, make improvements and try out new ideas. Make sure that your new code always includes the function which monitors for the *reset command! Go crazy putting your PAW enabled Arduino systems into impossible places, knowing that you can still fix bugs, make improvements and try out new ideas. Make sure that your new code always includes the function which monitors for the *reset command!
info/program_avr_remoteley_with_zigbee.1218885096.txt.gz · Last modified: 2008/08/16 07:11 by tomgee