Quickstart Plug and Sense Guide
Quickstart Plug and Sense Guide
Quickstart Plug and Sense Guide
Quickstart Guide
INDEX
1. Introduction.......................................................................................................................................... 3 2. Waspmote Plug & Sense!s Donnots.................................................................................................... 4 3. Waspmote Plug & Sense!s Hardware Setup....................................................................................... 5
3.1. ON/OFF Button .............................................................................................................................................................................5 3.2. External led.....................................................................................................................................................................................6 3.3. Resetting Waspmote Plug & Sense! with an external magnet.....................................................................................6 3.4. USB.....................................................................................................................................................................................................8 3.4.1. External SIM socket.....................................................................................................................................................10 3.5. Antenna......................................................................................................................................................................................... 12
6. Compiling a New Program................................................................................................................. 19 7. Uploading a New Program to Waspmote Plug & Sense!.................................................................. 21 8. Next Steps: using the Developers Guides........................................................................................ 27 9. Documentation Changelog............................................................................................................... 28
-2-
v4.3
1. Introduction
The aim of this Guide is to introduce the user to Waspmote Plug & Sense! in a practical way. Waspmote Plug & Sense! is a complex device and a learning process must be completed. Libelium offers many Guides and examples which will help the developer. The present Guide was created in the hope of helping the developer in the very first steps with Waspmote Plug & Sense!. We advice to follow this Guide when the user wants to start the learning process. The last chapter will try to plan a learning process, proposing further steps.
-3-
v4.3
Hardware: Do not handle black stickers seals on both sides of the enclosure (Warranty stickers). Their integrity is the proof that Waspmote Plug & Sense! has not been opened. If they have been handled, damaged or broken, the warranty is void. Do not open Waspmote Plug & Sense! in any case. This will automatically make the warranty void. Do not handle the four metallic screws of Waspmote Plug & Sense!. They ensures waterproof seal. Do not submerge Waspmote Plug & Sense! in liquids. Do not place nodes on places or equipment where it could be exposed to shocks and/or big vibrations. Do not expose Waspmote Plug & Sense! to temperatures below -10C or above 50C. Do not power Waspmote with other power sources than the original provided by Libelium. Voltage and current maximum ratings can be exceeded, stopping Waspmote working and voiding warranty. Do not try to extract, screw, break or move Waspmote Plug & Sense! connectors far from necessary usage, waterproof sealing can be damaged and warranty will be voided. For more information: http://www.libelium.com Do not connect any sensor on the solar panel connector and also do not connect the solar panel to any of sensor connectors. Waspmote can be damaged and warranty void. Do not connect any sensor not provided by Libelium. Do not place Waspmote Plug & Sense! where water can reach internal parts of sensors.
-4-
v4.3
Note: Remember that ON / OFF button must be in ON position to charge the battery. Otherwise the node will not be charged. -5v4.3
-6-
v4.3
The magnet is made of neodymium. It is a special, high-power magnet. We only advise to use the magnet Libelium provides. It is not mandatory, but highly recommended to consider this feature when designing the project. The user should design the software in a way the node can be reset if things go wrong. Remember that laboratory tests are always needed to validate the feature before your final deployment. When the node is already deployed in the field, and for instance it is installed in a traffic light, this feature can be used to reset the node easily, as it is shown in the diagram below, where a technician uses a pole with the magnet attached in one side.
-7-
v4.3
3.4. USB
This connector is used to upload code into Waspmote with a male to male USB cable provided by Libelium. Just connect one side of the cable to this connector, removing protection cap and connect the other side to a PC to upload a code or to charge the battery in case your model has a rechargeable battery. Next picture shows an example.
When uploading processes are finished, do not forget to screw firmly the protection cap to avoid connector damage. Never connect a USB which exceed maximum ratings of USB standard.
-8-
v4.3
For indoor deployments the nodes can be recharged using the USB charger. Important: Use the USB charger just with the models which includes rechargeable battery.
-9-
v4.3
The External SIM socket is composed of 2 connectors: micro-SIM card micro-USB (type B)
Figure 11: External SIM socket in a Plug & Sense! with GPRS or 3G module
The operation with the micro-USB socket is just the same than with the normal USB socket. Just remember to use a micro-USB cable.
-10-
v4.3
Waspmote Plug & Sense! - Quickstart Guide The micro-SIM card connector allows now the user to connect the SIM card he likes from the outside. It is no longer necessary to send a SIM card to Libelium for proper installation. You can ask your telecommunication provider for a micro-SIM card. Alternatively you can take a normal SIM card and transform it into a micro-SIM card with a SIM card cutter. Besides, the micro-SIM card connector has a push-pull mechanism, so it is really easy to remove the card with the aid of one nail.
It is highly important to turn off the Plug & Sense! device in a secure way before inserting a micro-SIM card, or removing an existing SIM-card. The user can damage the device if this operation is done on-the-fly. Make sure you closed the External SIM socket with its protection cap before outdoors deployment. Take into account that the External SIM socket has a limited resistance so please be gentle and do not push too hard with the USB or SIM card.
Figure 14: Inserting a SIM card with care in the External SIM socket
-11-
v4.3
3.5. Antenna
By default Waspmote Plug & Sense! has one external antenna of 5dBm with a standard reverse polarized SMA connector. This connector allows to connect the RF antenna.
To ensure good RF coverage, be sure antenna points to the sky and also be sure antenna is screwed completely to the connector. To connect the antenna, just align it with the connector and screw it carefully. Antenna must be connected in order to ensure RF communication.
Note: Once Waspmote Plug & Sense! is installed, it is recommended to fix it using a tape like the one shown in the picture below.
-12-
v4.3
Do not try to connect other kind of antennas which do not match with SMA RP standard connector and also other antennas not provided by Libelium.
-13-
v4.3
Figure 19: Differences between Waspmote IDE and Waspmote Plug & Sense! IDE
The Waspmote Plug & Sense! IDE is based on the open source Arduino platform compiler, following the same style of libraries and operation. It is important to use the version found on Libelium website and no other version of Arduino IDE. This is because the version available on the Libelium website has been properly tested and for which we can assure optimum operation. To be able to run the compilation from a code successfully a series of applications must be installed on the computer. The applications to install vary according to the O.S. used.
4.1. Linux
Waspmote Plug & Sense! can be programmed using any of the many available Linux distributions. Libelium ensures stability of the Waspmote Plug & Sense! IDE using the Debian and Ubuntu distributions, as they have been used during development. The process for Ubuntu 9.04 is explained below. To be able to correctly compile and use Waspmote it is necessary to install some packets related with the version of the compiler for Atmel microcontrollers and Java environment. 1. Installing Java The next step is to install the necessary version of the avr-gcc compiler to be able to program the Waspmote Plug & Sense! microcontroller. We can use the Synaptic package manager or a terminal. Using Synaptic we must look for the gcc-avr package and install it. Using the terminal we must use the apt-get command in the following way:
$ sudo apt-get install sun-java6-jre
-14-
v4.3
Waspmote Plug & Sense! - Quickstart Guide 2. Installing AVR-GCC Compiler The next step is to install the necessary version of the avr-gcc compiler to be able to program the Waspmote Plug & Sense! microcontroller. We can use the Synaptic package manager or a terminal. Using Synaptic we must look for the gcc-avr package and install it. Using the terminal we must use the apt-get command in the following way:
$ sudo apt-get install gcc-avr
3. Installing lib-avc Library The next step is to install the necessary version of the lib-avc library. We can use the Synaptic package manager or a terminal. Using Synaptic we must look for the lib-avc package and install it. Using the terminal we must use the apt-get command in the following way:
$ sudo apt-get install avr-libc
4.- Installing Waspmote Plug & Sense! IDE Waspmote Plug & Sense! IDE installation entails unzipping the file downloaded in the previous step to the chosen folder. Once the downloaded file has been unzipped, the file called Waspmote must be run to launch the IDE.
4.2. Windows
The process for installing Waspmote Plug & Sense! IDE on a computer with Window XP SP3 is explained below. 1. Downloading Waspmote Plug & Sense! IDE The first step is to download the file that contains the environment and the libraries (the IDE). This file can be found at http://www.libelium.com/development/plug_&_sense/sdk_and_applications 2. Installing Waspmote Plug & Sense! IDE The next step is to unzip the downloaded file to the chosen folder. This folder includes the drivers needed in the next step to install the USB and FTDI converter. 3. Connecting Waspmote Plug & Sense! When connecting a Waspmote Plug & Sense! using the USB connector, the message New device found will appear. A window will open for the installation of this device. Select the option Not right now and press the Next button. Next select the path where the drivers for the FTDI converter are. These drivers are in the folder where Waspmote was unzipped. Then proceed to the installation of the FTDI converter drivers, which shows the following message when finished. Once installation is finished, the message New device found will appear, referring to the USB. The same process carried out for the FTDI converter must now be followed, choosing the same options in all the windows. The path for the drivers is the same as that previously specified. Once this installation is finished, a message will appear indicating the correct installation of the USB. Once both devices are correctly installed, the port on which the Waspmote board has been installed will appear in the Device manager.
4.3. Mac
Waspmote Plug & Sense! can be programmed using the Mac OS X operating system. The process of install Waspmote Plug & Sense! IDE on a computer with a version later than 10.3.9 is explained below. -15v4.3
Waspmote Plug & Sense! - Quickstart Guide 1. Downloading Waspmote Plug & Sense! IDE The first step is to download the file that contains the environment and libraries (the IDE). This file can be found on our web page http://www.libelium.com/development/plug_&_sense/sdk_and_applications 2. Installing Waspmote Plug & Sense! IDE The next step is to unzip the downloaded file to the chosen folder. The drivers needed in the next step to install the FTDI converter are found in this folder. 3. Installing FTDI converter drivers Waspmote requires the installation of the FTDI converter drivers. These drivers are found in the downloaded file. Once the drivers are installed for the FTDI converter, the Waspmote board can be connected and the system will recognize it correctly.
-16-
v4.3
When the program starts, it executes sequentially these actions: State 1 External LED ON for 0.5 seconds State 2 External LED blinking for 0.5 seconds State 3 Sending messages (blink External LED shortly with each frame)
State 1 and 2 are only executed once (when program starts) whereas state 3 will loop indefinitely every second (if we reset Waspmote, the program starts again). Every packet contains a message with sensor data formatted as Waspmote Data Frame. The sensor fields added to the frame are: Accelerometer values, RTC internal temperature value, and battery level. In the case the XBee is not using DigiMesh protocol, then the MAC address is added (because of length constraints). For further information, please check the Waspmote Data Frame Guide in: http://www.libelium.com/development/plug-sense/documentation/?cat=programming
Example:
~\0x00I\0x90\0x00}3\0xa2\0x00@z\0xcb\0x92\0xd8\0xd3\0x02<=>\0x80\0x03#35689722##7#ACC:80;10 ;987#IN_TEMP:22.50#BAT:93#\0xb4
Initially there are some hexadecimal characters, which belong to the XBee API frame, followed by the message. In the above example the message is:
<=>\0x80\0x03#35689722##7#ACC:80;10;987#IN_TEMP:22.50#BAT:93#
-17-
v4.3
5.2. In Meshlium
When you buy a kit containing Meshlium and Waspmote, your Waspmtes already come configured to send frames to the Gateway. Later, once the user has developed the code for transmitting to Gateway, he can swich to Meshlium. Before send frames to Meshlium, We recommend you read and study networking guides for your module: Waspmote 802.15.4 Networking Guide Waspmote 868MHz Networking Guide Waspmote 900MHz Networking Guide Waspmote Digimesh Networking Guide Waspmote ZigBee Networking Guide
Meshlium will receive the sensor data sent by Waspmote using the XBee radio and it will store the frames in the Local Database. That can be done in an automatic way now thanks to the new Sensor Parser. The Sensor Parser is a new feature for Meshlium (version 3.0.5 or older). It is a new software system which is able to do the following tasks in an easy and transparent way: receive frames from XBee (with the Data Frame format) parse these frames store the data in local Database synchronize the local Database with an external Database
-18-
v4.3
Main Code
Output messages
The first part is the menu which allows configuration of general parameters such as the selected serial port. The second part is a button menu which allows compilation, opening, saving or loading the selected code on the board. The third part contains the main code which will load in Waspmote and the fourth part shows us the possible compilation and load errors, as well as the success messages if the process is carried out satisfactorily.
The Waspmote-IDE buttons panel allows certain functions to be carried out such as opening a previously saved code, creating a new one or loading the code on the board. The following figure shows the panel and the functions of each button. Compile New sketch Save Serial Monitor
Stop compiling
Figure 22: IDE Waspmote panel of buttons
Open
Upload
-19-
v4.3
Waspmote Plug & Sense! - Quickstart Guide The next step is to configure the folder where the created programs are going to be saved. In the Waspmote Plug & Sense! IDE, this folder is called sketchbook and can be configured by accessing the File/Preferences tab. Clicking on this tab will open a new window where the location of the sketchbook can be indicated. Once the sketchbook folder path is indicated, the downloaded test program must be saved in this folder. Waspmote Plug & Sense! IDE must be closed so that the changes and the newly saved program in the sketchbook folder are reflected. Note: The Gateway is just a UART-USB bridge. This means that the Gateway cannot be programmed and code cannot be uploaded.
-20-
v4.3
Figure 23: Removing the USB cap * In the case you have a Plug & Sense! With GPRS or 3G module, insert your micro-SIM card in the External SIM socket with care.
Figure 24: Inserting a SIM card with care in the External SIM socket
-21-
v4.3
Waspmote Plug & Sense! - Quickstart Guide Step 2: Connect the USB cable to Waspmote Plug & Sense! Connect one side of the provided male-to-male USB cable to the USB connector. For models with GPRS or 3G module, a microUSB is supplied.
Figure 25: Connecting the USB cable to Waspmote Plug & Sense!
-22-
v4.3
Waspmote Plug & Sense! - Quickstart Guide Step 3: Connect the USB cable to PC Connect the other side of the USB cable to your PC.
Step 4: Turn On Waspmote Plug & Sense! Be sure you have turned ON the node by pressing ON/OFF button.
Step 5: Open Waspmote Plug & Sense! IDE Now open Waspmote Plug & Sense! IDE. If you do not have Waspmote Plug & Sense! IDE already installed in your PC, then go to the Development section of Libelium website to download the latest version.
-23-
v4.3
Waspmote Plug & Sense! - Quickstart Guide Step 6: Select the corresponding code Build your own code for your model using the online Code Generator (http://www.libelium.com/development/waspmote/ code_generator) provided by Libelium at the Development section of Libelium website (see corresponding section for details about how to use the code generator). Download and open it in Waspmote Plug & Sense! IDE. Save the sketch (Waspmote Plug & Sense! IDE has a button for that), for example with the name Waspmote_Plug_ Sense_test_code, and check the IDE message Done Saving
Step 7: Select the corresponding API Select the API version corresponding to Waspmote Plug & Sense! going to tools/board. If you do not have the API for Waspmote Plug & Sense!, please go to the Development section of Libelium website and download the latest version.
Please notice that the Waspmote Plug & Sense! API is different from the Waspmote API. It should be called Waspmote_Plug_ Sense_V001. Check Libelium website for new API updates.
-24-
v4.3
Waspmote Plug & Sense! - Quickstart Guide Step 8: Select the USB port Select the corresponding serial port by going to tools/serial port. If you are unable to see the proper USB port maybe you should install the latest FTDI drivers.
Figure 30: Selecting the USB port for Waspmote Plug & Sense!
Note: the name of the USB ports depends on the OS and the particular PC you have. The best way to find the USB where Waspmote is connected is trial & error. Step 9: Compile the code Compile the code (the IDE has a button for that), and check there are no errors or warnings. The IDE should say Done Compiling.
-25-
v4.3
Waspmote Plug & Sense! - Quickstart Guide Step 10: Upload the code Now, press the upload button and see messages coming out from IDE. During a while you will see message uploading to I/O board.
Wait a few seconds until the process ends and check there are no error messages, just Done uploading message. Step 11: Open the Serial Monitor If uploading processes are successfully completed, open Serial Monitor to see the output of the uploaded code.
Figure 33: Opening Waspmote Plug & Sense! IDE serial monitor
When uploading processes are finished successfully, do not forget to screw the protection cap of USB connector to avoid its damage. Never connect a USB which exceed maximum ratting of the USB standard. Waspmote can be damaged and warranty voided.
-26-
v4.3
-27-
v4.3
9. Documentation Changelog
From v4.2 to v4.3: Added references to External SIM socket
From v4.1 to v4.2: Added references to magnetic reset Added Documentation Changelog chapter
-28-
v4.3