This is a quick reference guide to get a first contact with the Waspmote platform.
1.1- Downloading the Waspmote IDE
Waspmote-IDE can be run over Windows, Linux or Mac-OS. It includes the Waspmote API and the compiler (both released as open source code).
1.2- Installing Waspmote IDE
Installing Waspmote is as simple as extracting the downloaded file in the chosen folder. Inside this folder there will be a file called 'waspmote'. Execute it and the Waspmote IDE will be launched.
NOTE: some applications or drivers may be necessary, please refer to Waspmote Technical Guide to get more details about Waspmote installation.
1.3- Waspmote IDE Overview
Waspmote IDE is divided in four main parts that can be seen in the Figure 1.
1.4- Configuring Waspmote IDE
Previous to be able to compile and upload a program to Waspmote, some configurations parameters must be changed for the first time (this changes will be kept by Waspmote IDE).
1.Select 'Wasp v01' in 'Tools/Board' inside IDE options menu.
2.Select the port where Waspmote board has been connected in 'Tools/Serial Port' inside IDE options menu.
3.Configuring folder where store our programs: this folder is called ' sketchbook' and its path can be configured in 'File/Preferences'. When opening this menu a new window will be opened and the 'sketchbook' path should be entered.
4.Reset Waspmote IDE to apply the changes.
Connect the antennas and the rest of the desired components to Waspmote and Waspmote Gateway (manual chapter 1.4).
Connect the Waspmote Gateway to the USB port on the computer (manual chapter 14.1).
Launch the serial monitor application (manual chapters 14.2, 14.3 and 14.4) and set the next parameters:
Connect the battery to the Waspmote.
Switch Waspmote to the ON position (manual chapter 1.4).
When the program starts, it executes sequentially these actions:
State 1 and 2 are only executed once (when program starts) whereas state 3 will loop indefinitely every 3 seconds (if we reset Waspmote, the program starts again).
Every packet contains a message with the MAC address of the XBee module. Example:
~\0x00U\0x80\0x00}3\0xa2\0x00@U3\0xdf=\0x02R\0x01#\0x01\0x00}3\0xa2\0x00@U3\0xdf
--hello, this is Waspmote. MAC address: 0013A200405533DF--\0xc1
Initially there are some hexadecimal characters followed by the message. In the above example the message is
--hello, this is Waspmote. MAC address: 0013A200405533DF--
Where 0013A200405533DF matches with the 64 bits MAC address of the XBee module included in the Waspmote which sent the packet.
The rest of the characters match with the parameters included in the application header established in the Waspmote XBee library (for extended information see the section 13.6). These parameters are sent in hexadecimal format.
These hexadecimal parameters are used by the Waspmote devices for making control tasks in the network layer. When we make an application for Waspmote these information is extracted and analyzed by each node and only the real message is sent to the next node in the network. However, in this case the Waspmote Gateway shows the whole content in the packet received.
Inside the folder where Waspmote IDE has been extracted, there is a folder which contains a test program ('test.pde') to get started using Waspmote and Waspmote IDE. This program must be copied into the 'sketchbook' folder.
This test program blinks LEDs and shows the output message 'Hello World, this is Waspmote!'.
Press 'Open' button in 'Button Menu' and select the test program 'test.pde'. The code program will appear in 'Main Code' part. To upload the code to Waspmote, press 'Upload' button. When the code has been uploaded properly a success message will appear in 'Output messages' part. If there are some errors while compiling, an error message in red color will appear in 'Output messages'.
Once the code has been properly uploaded to Waspmote, the LED will start blinking and the output message will appear if we press 'Serial Monitor' button. This button opens a new window that captures the serial output from Waspmote board.
3.1 - Creating our first program: "hello world!"
The steps to create our first program are:
Create the code. This code is written inside 'Main Code' part and it has to follow the structure previously explained : 'setup' and 'loop'. We are going to use the code explained in the previous chapter. This code is shown below:
{
void setup()
{
// Opening UART to show messages using 'Serial Monitor'
USB.begin();
}
void loop()
{
// Blinking LEDs
Utils.blinkLEDs(1000);
// Printing a message, remember to open 'Serial Monitor'
// to be able to see this message
USB.println("Hello World, this is Waspmote!");
// A little delay
delay(2000);
}
}
Once we have created our code we press 'Compile' button to check there are no errors. If no errors, an output message 'Done compiling' will appear.
Save the code. We have to press the 'Save' button and a new window will appear to specify the name and the path where store the code.
Check Waspmote board and port where Waspmote is connected are correctly configured in 'Tools/Board' and 'Tools/Serial Port'.
Press 'Upload' button and uploading process will start.
After a few seconds, if no errors an output message will appear indicating the correct uploading.
Press 'Serial Monitor' button to capture the serial output from Waspmote.
LEDs will blink and 'Hello World, this is Waspmote!' message will appear in 'Serial Monitor' window. This process will repeat all the time till Waspmote was powered down.