lunes, 6 de octubre de 2014

Comunicación Inalambrica Launchpad CC110L AIR Booster Pack

Hola amigos en está ocasión quiero dar una introducción a estos magnificos modulos inalambricos desarrollados por la empresa AIR, que vienen en un booster pack para nuestra Launchpad.
El modulo viene acompañado de dos modulos inalambricos con un microcontrolador MSP430G2553 incluido.





Estos modulos trabajan a dos frecuencias, dependiedo del pais en el cual se desee utilizar, a 433MHz y 900MHz, los cuales están debidamente certificados, listos para utilizar en un proyecto comercial, lo cual es muy bueno y no cualquier modulo de radiofrecuencia tiene.

¿Como programarlo?
Gracias a Energia y la comunidad open source, encontramos que ya existe la libreria y ejemplos para utilizarlo en esta plataforma tipo Arduino. Lo cual nos lleva menos de 5 minutos ponerlos a trabajar sin necesidad de escribir algún código.

Existen diferentes ejemplos, entre los que destaca un ejemplo donde veremos como realizar una red tipo estrella.

Para este ejemplo necesitaremos un kit CC110L AIR Booster pack y dos Launchpad MSP430G2553
Un modulo trabajara como emisor, es importante recalcar que estos modulos son Transceiver, esto quiere decir que pueden funcionar como transmisores y receptores.
Ejemplo Wireless Monitor HUB

/**
* ----------------------------------------------------------------------------
* WirelessMonitorHub.ino - wireless monitor hub sketch using AIR430Boost FCC driver.
* Copyright (C) 2012-2013 Anaren Microwave, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* This example demonstrates usage of the AIR430BoostFCC library which uses
* the 430Boost-CC110L AIR Module BoosterPack created by Anaren Microwave, Inc.
* and available through the TI eStore, for the European Union.
*
* ----------------------------------------------------------------------------
*
* Note: This file is part of AIR430Boost.
*
* ----------------------------------------------------------------------------
*
* Description
* ===========
*
* Acts as a simple receiver for a star network. The hub node can receive both
* broadcast messages and messages directed to its assigned address. The hub
* node should not be assigned to address 0 (broadcast address). To create an
* additional network, simply change the hub address.
*
* ----------------------------------------------------------------------------
*
* This example assumes that two BoosterPacks will be used to showcase the
* wireless radio communication functionality. This same code should be
* programmed to both LaunchPad development kits.
*
* This BoosterPack relies on the SPI hardware peripheral and two additional
* GPIO lines for SPI chip-select and GDO0 for packet handling. They use pins 18
* and 19 respectively.
*
* In the default configuration, this BoosterPack is not compatible with an
* external crystal oscillator. This can be changed, if necessary, and would
* require reconfiguration of the BoosterPack hardware and changes to the
* AIR430BoostFCC library. Refer to the BoosterPack User's Manual if necessary.
*
* For complete information, please refer to the BoosterPack User's Manual
* available at:
* https://www.anaren.com/air/cc110l-air-module-boosterpack-embedded-antenna-module-anaren
*
* To purchase the 430Boost-CC110L AIR module BoosterPack kit, please visit the
* TI eStore at:
* https://estore.ti.com/430BOOST-CC110L-CC110L-RF-Module-BoosterPack-P2734.aspx
*/
/**
* The AIR430BoostFCC library uses the SPI library internally. Energia does not
* copy the library to the output folder unless it is referenced here. The order
* of includes is also important due to this fact.
*/
#include <SPI.h>
#include <AIR430BoostFCC.h>
// -----------------------------------------------------------------------------
/**
* Defines, enumerations, and structure definitions
*/
#define ADDRESS_LOCAL 0x01
/**
* sPacket - packet format.
*/
struct sPacket
{
uint8_t from; // Local node address that message originated from
uint8_t message[59]; // Local node message [MAX. 59 bytes]
};
// -----------------------------------------------------------------------------
/**
* Global data
*/
struct sPacket rxPacket;
// -----------------------------------------------------------------------------
// Main example
void setup()
{
// The radio library uses the SPI library internally, this call initializes
// SPI/CSn and GDO0 lines. Also setup initial address, channel, and TX power.
Radio.begin(ADDRESS_LOCAL, CHANNEL_1, POWER_MAX);
rxPacket.from = 0;
memset(rxPacket.message, 0, sizeof(rxPacket.message));
// Setup serial for debug printing.
Serial.begin(9600);
/**
* Setup LED for example demonstration purposes.
*
* Note: Set radio first to ensure that GDO2 line isn't being driven by the
* MCU as it is an output from the radio.
*/
pinMode(RED_LED, OUTPUT); // Use red LED to display message reception
digitalWrite(RED_LED, LOW);
}
void loop()
{
// Turn on the receiver and listen for incoming data. Timeout after 1 seconds.
// The receiverOn() method returns the number of bytes copied to rxData.
if (Radio.receiverOn((unsigned char*)&rxPacket, sizeof(rxPacket), 1000) > 0)
{
digitalWrite(RED_LED, HIGH);
Serial.print("FROM: ");
Serial.print(rxPacket.from);
Serial.print(" MSG: ");
Serial.println((char*)rxPacket.message);
digitalWrite(RED_LED, LOW);
}
}
Ejemplo Wireless sensor node

/**
* ----------------------------------------------------------------------------
* WirelessMonitorSensor.ino - wireless monitor sensor sketch using AIR430Boost ETSI driver.
* Copyright (C) 2012-2013 Anaren Microwave, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* This example demonstrates usage of the AIR430BoostETSI library which uses
* the 430Boost-CC110L AIR Module BoosterPack created by Anaren Microwave, Inc.
* and available through the TI eStore, for the European Union.
*
* ----------------------------------------------------------------------------
*
* Note: This file is part of AIR430Boost.
*
* ----------------------------------------------------------------------------
*
* Description
* ===========
*
* Acts as a simple transmitter for a star network. The sensor node can
* transmit any type of message one-way using the broadcast address. To create
* multiple networks, simply change the address on the hub node and have the
* nodes in that network transmit to the assigned hub address.
*
* ----------------------------------------------------------------------------
*
* This example assumes that two BoosterPacks will be used to showcase the
* wireless radio communication functionality. This same code should be
* programmed to both LaunchPad development kits.
*
* This BoosterPack relies on the SPI hardware peripheral and two additional
* GPIO lines for SPI chip-select and GDO0 for packet handling. They use pins 18
* and 19 respectively.
*
* In the default configuration, this BoosterPack is not compatible with an
* external crystal oscillator. This can be changed, if necessary, and would
* require reconfiguration of the BoosterPack hardware and changes to the
* AIR430BoostETSI library. Refer to the BoosterPack User's Manual if necessary.
*
* ETSI regulations must be followed when using this library. This example
* limits the wireless duty cycle to 0.1% per ETSI.
*
* For complete information, please refer to the BoosterPack User's Manual
* available at:
* https://www.anaren.com/air/cc110l-air-module-boosterpack-embedded-antenna-module-anaren
*
* To purchase the 430Boost-CC110L AIR module BoosterPack kit, please visit the
* TI eStore at:
* https://estore.ti.com/430BOOST-CC110L-CC110L-RF-Module-BoosterPack-P2734.aspx
*/
/**
* The AIR430BoostETSI library uses the SPI library internally. Energia does not
* copy the library to the output folder unless it is referenced here. The order
* of includes is also important due to this fact.
*/
#include <SPI.h>
#include <AIR430BoostETSI.h>
// -----------------------------------------------------------------------------
/**
* Defines, enumerations, and structure definitions
*/
#define ADDRESS_LOCAL 0x02
#define ADDRESS_REMOTE 0x01
/**
* sPacket - packet format.
*/
struct sPacket
{
uint8_t from; // Local node address that message originated from
uint8_t message[59]; // Local node message [MAX. 59 bytes]
};
// -----------------------------------------------------------------------------
/**
* Global data
*/
struct sPacket txPacket;
// -----------------------------------------------------------------------------
// Main example
void setup()
{
// The radio library uses the SPI library internally, this call initializes
// SPI/CSn and GDO0 lines. Also setup initial address, channel, and TX power.
Radio.begin(ADDRESS_LOCAL, CHANNEL_1, POWER_MAX);
txPacket.from = ADDRESS_LOCAL;
memset(txPacket.message, 0, sizeof(txPacket.message));
// Setup serial for debug printing.
Serial.begin(9600);
/**
* Setup LED for example demonstration purposes.
*
* Note: Set radio first to ensure that GDO2 line isn't being driven by the
* MCU as it is an output from the radio.
*/
pinMode(RED_LED, OUTPUT); // Use red LED to display message reception
digitalWrite(RED_LED, LOW);
}
void loop()
{
int i, j;
delay(1000); // Send every second
for (i = 0, j = '0'; i <= 0x2A; i++, j++)
{
txPacket.message[i] = j;
}
Radio.transmit(ADDRESS_REMOTE, (unsigned char*)&txPacket, sizeof(txPacket));
/**
* Warning: ETSI regulations require duty cycling of 0.1% per hour. Changing
* this may invalidate ETSI compliance. Some margin has been added. Please
* refer to Anaren's A110LR09 User's Manual for more information.
*/
delay(500);
}



¿Que realizará el ejemplo?
El Hub lo conectaremos al puerto USB de nuestra computadora y abriremos el puerto COM de la tarjeta Launchpad en una hyperterminal, puede ser la misma que trae el Energia, el nodo lo conectaremos tambien a la alimentación, puede ser a la misma computadora para que empiece a transmitir los datos, y el Hub reciba toda la información, con esto podremos verificar el funcionamiento de nuestro kit. He realizado algunas pruebas, con distancias de transmision de hasta 30 metros aproximadamente, supuestamente debe de llegar a los 100 metros, pero al menos a mi, no llego a esa distancia.



1 comentario:

  1. Las Vegas (NV) Casino and Hotel - MapYRO
    Get 대전광역 출장마사지 directions, reviews 김천 출장샵 and information for 평택 출장마사지 the Las Vegas (NV) Casino and Hotel 정읍 출장마사지 in Las Vegas, NV. In-room dining, fitness center, 포항 출장마사지 and dining

    ResponderEliminar