0
登录后你可以
  • 下载海量资料
  • 学习在线课程
  • 观看技术视频
  • 写文章/发帖/加入社区
创作中心
发布
  • 发文章

  • 发资料

  • 发帖

  • 提问

  • 发视频

创作活动
WRL-15836

WRL-15836

  • 厂商:

    SPARKFUNELECTRONICS

  • 封装:

  • 描述:

    - ATSAMD21G18A,RFM95W Transceiver; LoRa® 915MHz 评估板

  • 数据手册
  • 价格&库存
WRL-15836 数据手册
  SparkFun SAMD21 Pro RF Hookup Guide Introduction The SparkFun SAMD21 Pro RF is the fated meeting of a SAMD21 and a long-range RFM95W LoRa®-enabled radio. The outcome is a compact, blazing fast microcontroller with excellent point to point data transmission in the 915MHz ISM radio band with LoRa capabilities. In this tutorial we'll break down the capabilities of the development board, give you a brief introduction to LoRa and get you familiarized with the two Arduino libraries that will get you started with the radio and LoRaWan. If you're familiar with LoRaWan then skip ahead to the Hardware Overview, otherwise let's get started with a brief introduction to LoRaWAN. SparkFun Pro RF - LoRa, 915MHz (SAMD21)  WRL-15836 SparkFun Pro RF - LoRa, 915MHz (SAMD21)  WRL-14916      7 Retired SparkFun Pro RF - LoRa, 915MHz (SAMD21, Black Board)  DD-15178 Retired Revision Update: In the latest revision of the SAMD21 Pro RF, we have made a few changes to improve the board, listed below. If users are unsure about which version they purchased, please refer to the pictures of the updated changes, shown below. Fixed the VDDCORE pin connection issue Broken out an LED jumper for low power applications Added PTH pins for software debug (SWD) IO and clock pins for SWD. Jumper for power LED. Product Showcase: SparkFun Pro RF Required Materials To follow along with this tutorial, you will need the following materials. You may not need everything though depending on what you have. Add it to your cart, read through the guide, and adjust the cart as necessary. USB micro-B Cable - 6 Foot  CAB-10215 Hook-Up Wire - Assortment (Solid Core, 22 AWG)  PRT-11367 Pycom LoRa and Sigfox Antenna Kit - 915MHz  WRL-14676 Single Cell LiPo Batteries You can power the SAMD21 Pro RF with any of our stocked LiPo Batteries that is above 500mAh. Lithium Ion Battery - 1Ah Lithium Ion Battery - 2Ah  PRT-13813  PRT-13855 Lithium Ion Battery - 6Ah Lithium Ion Battery - 850mAh  PRT-13856  PRT-13854 Tools Depending on your setup, you may need a soldering iron, solder, and general soldering accessories. Weller WE1010 Soldering Station Solder - 1/4lb Spool (0.032") Special Blend  TOL-14734  TOL-10243 Wire Strippers - 20-30AWG  TOL-14763      3 Retired Suggested Reading If you're not familiar with the following topics, or want a more in depth conversation related to the following, please follow the links below. What is an Arduino? Installing Arduino IDE What is this 'Arduino' thing anyway? This tutorials dives into what an Arduino is and along with Arduino projects and widgets. A step-by-step guide to installing and testing the Arduino software on Windows, Mac, and Linux. SAMD21 Mini/Dev Breakout Hookup Guide LoRaWAN with ProRF and The Things Network An introduction to the Atmel ATSAMD21G18 microprocessor and our Mini and Pro R3 breakout boards. Level up your Arduino-skills with the powerful ARM Cortex M0+ processor. Learn how to make a LoRaWAN node for your next long range IoT project and connect it to the internet with The Things Network! Brief Introduction to LoRaWAN LoRaWAN stands for Long Range Wide Area Network and describes the technology that allows for devices to send and upload data to the Internet using radio transmission. The technology is a frequency modulation scheme similar in theory but dissimilar to AM or FM which stand for Amplitude Modulation and Frequency Modulation respectively. You remember sine waves right? Amplitude modulation changes the height or amplitude of a wave when adding audio (or data) to it and frequency modulation would change, well, the frequency of a wave when adding audio (or data to it). The modulation scheme for LoRaWAN is more complex to explain but maintains this same theory of changing sine waves when they carry data; you can read more about it in detail below: WIKIPEDIA: FREQUENCY SHIFT KEYING This scheme allows for data to be transmitted to the LoRa Network over a specific radio band known as the the Industrial, Scientific, and Medical Band (or ISM band for short). The frequencies of this specific radio band varies from country to country but as an example, the SAMD21 Pro RF will broadcast within the range of 902-928MHz in the Americas and in the range 863-870MHz in Europe. We reference the spectrum of broadcasting frequencies by its' center frequency, 915MHz in the Americas and 868MHz in Europe. Ok, we have a general idea that we broadcast in a band of frequencies using a technology that translates data into radio signals, but how do we get from the SAMD21 Pro RF to the "Internet of Things"? Broadcasting and uploading requires three things: a Node, a Gateway or Concentrator, and a Network Server. The "Node" in this case is the SAMD21 Pro RF, which will broadcast its information into the void and hope that there is a Gateway or Concentrator nearby to hear it. A Gateway or Concentrator will take the information your node is broadcasting and push it to a Network Server like the The Things Network or Resin.io. Let's read that in a different way, the Gateway or Concentrator takes the radio waves, demodulates them (i.e. translates them), and puts that information onto the Internet. Neat! Now it's here on the Network Server that we get to interact with that data. For a more in depth explanation about LoRaWAN, check out this great tutorial. LoRaWAN with ProRF and The Things Network JULY 3, 2018 Learn how to make a LoRaWAN node for your next long range IoT project and connect it to the internet with The Things Network! Want to setup your own Gateway? Check out the tutorial below! SparkFun LoRa Gateway 1-Channel Hookup Guide NOVEMBER 15, 2018 How to setup and use the LoRa Gateway 1-Channel in Arduino. Hardware Overview If this is your first time with the SAMD21 then check out our great write up on the hardware specifications of the SAMD21AG MCU and see how it compares with an ATmega328P. SAMD21 Mini/Dev Breakout Hookup Guide NOVEMBER 12, 2015 An introduction to the Atmel ATSAMD21G18 microprocessor and our Mini and Pro R3 breakout boards. Level up your Arduino-skills with the powerful ARM Cortex M0+ processor. Let's move onto the SAMD21 Pro RF and its hardware features. Supplying Power You can power the SAMD21 Pro RF in a number of external 5V sources. At the head of the board, you'll see a micro-B USB connector and a lithium polymer battery connector that will take any of our stocked LiPo battery options. To safely charge, we recommend using a LiPo with a capacity that is higher than 500mAh. Note the two plated through holes just to the right of the LiPo connector that can be utilized for direct soldering of a LiPo Battery. Next to the switch, you'll see the pins labeled RAW for a external source of 6V or below. Charge Rate: The onboard charging circuit is set at a default charge rate of 500mA. If your are using a LiPo battery with capacity below the set charge rate, we recommend adjusting the MCP73831's programming resistor or charging separately using the SparkFun Adjustable LiPo Charger to safely charge the LiPo battery. Warning: Powering the SAMD21 Pro RF is easy but the onboard low noise, low dropout voltage regulator can not handle anything above 6V. Please be attentive with how you power it. Oops! We accidentally tied the VDDCORE pin to VCC (3.3V); instead of ground via a capacitor (see the SAMD21 datasheet). This issue doesn't affect the overall functionality of the board; however, for low power applications, it does increase the amount of current drawn. For experienced users that are comfortable with their skills to make the required changes, the board can be modified to resolve this issue. Unfortunately, due to the complexity of the modification we will not be providing instructions, as users can easily damage the board permanently with the VDD pad right next to the VDDCORE pad. (*Experienced users with the required skills, should be able to determine and make the necessary changes on their own, without further assistance.) Update: We have updated the board to fix this issue. Therefore, only users who have the previous version without the SWD lines broken out are affected. Updated version with VDDCORE fix. All other boards are affected by this issue. Pinout Logic Levels: Keep in mind that this is a 3.3V system, which interfaces nicely with our Qwiic environment and other 3.3V devices. If you are using the SAMD21 Pro RF with your external 5V devices, we recommend adding a level shifter in between. Below is a table with every pin on the SparkFun SAMD21 Pro RF and it's function. Pin Description RAW Input Supply Voltage should never exceed 6V GND Ground on outside thru-holes 3v3 3.3V OUT RST 3.3V OUT D2, D3, D4, D5, D9 Digital I/O Pins A0, A1, A2, A3, A4 Analog I/O Pins RX/TX Serial Ports MOSI/MISO/SCK SPI ANT Antennae for RFM Module LEDs This product carries the full gamut of LEDs we've come to expect on SparkFun development boards: STAT LED, CHARGE LED, RX/TX indicators, and a Power LED. The STAT LED is on pin 13, typical on most Arduino boards. The RX and TX LEDs indicate activity on the USB serial port and are also available through the Arduino IDE using the macros PIN_LED_RXL and PIN_LED_TXL as your pin declarations. These LEDs are active-low, so writing the pin HIGH will turn the LED off. The charge LED is controlled by the onboard MCP73831 and lights up when a battery is being charged and turns off when the battery is full. Note: In the latest revision of the SAMD21 Pro RF, we have broken out an LED jumper for low power applications. The LED jumper disables only the power LED, but the power savings are quite significant. For the other LEDs: The STAT LED is tied to pin 13, so users can just avoid using that pin. The RX and TX LEDs are only powered during serial communication. The CHG LED is only powered during charging of a connected battery, but at that point users probably won't be worrying about a few mA when there is a power supply. Jumper for power LED. RFM95W Radio Module The RFM95W Radio Module is a powerful but low power module that allows for point to point radio communication. It also has the capability of utilizing the Long Range Wide Area Network (LoRaWan) by closing two LoRaWAN labeled jumpers on the underside. Antenna There are two options for an antenna on the SAMD21 Pro RF, a wire and a u.FL connector. The plated through hole and the connector are both labeled by the same ANT silk on the topside of the product. When using the through hole for your antenna, notice the unplated hole just above it. The purpose of this hole is to thread the wire antenna through it so that it takes the stress of daily wear and tear off of the solder joint. Woot! How Much Wire Length Do I Need? We have you covered, here are wire lengths for quarter-wave antennas at 915MHz and 868MHz: Country Frequency Length (inches) Length (mm) Americas 915 MHz 3.07" (3 + 1/16") 78mm Europe 868 MHz 3.38" (3 + 3/8") 86mm u.FL Antenna Another option is to connect a LoRa Antenna to the u.FL connector. The image below uses the 915MHz antenna. Make sure to select the appropriate antenna for your region. Qwiic Connector On the tail end of the product is a Qwiic connector. If you are not familiar with the system, you can get a full rundown here. In short the Qwiic system is an I2C environment of products that can be rapidly prototyped because we've broken out the I2C lines: ground, power, clock, and data, to a four pin JST connector. There's no need for solder or a soldering iron and our catalog of products with a Qwiic connector are growing rapidly. Here the SAMD21 ProRF is connected to the Qwiic Triple Axis Accelerometer. SWD Pins In the latest revision of the SAMD21 Pro RF, we have added some PTH pins for software debug (SWD). These pins will primarily be used by more advanced users. For more information on the SWD, users should check out the ARM Programming tutorial. IO and clock pins for SWD. ARM Programming MAY 23, 2019 How to program SAMD21 or SAMD51 boards (or other ARM processors). Hardware Limitations and Current Capabilities This topic is mentioned in detail under the SAMD21 Dev/Mini Breakout Hookup Guide but it's worth restating again here. Depending on the task it's given, the SAMD21's core will usually consume between 3-17mA. There should be plenty of juice left from the 600mA 3.3V regulator to power other sensors or components off the board's 3.3V supply rail. Each I/O pin can sink up to 10mA and source up to 7mA, with one caveat: each cluster of I/O is limited to sourcing 14mA or sinking 19.5mA. The GPIO clusters are: Cluster GPIO Cluster Supply (Pin) Cluster Ground (Pin) 1 SWCLK, SWDIO VDDIN (44) GND (42) 2 30, 31 (USB_HOST_EN, TX_LED) VDDIN (44) VDDIO (36) GND (42) GND (35) 3 D2, D5, D6, D7, D10, D11, D12, D13, D38 SCL, SDA, MISO, SCK, MOSI (USB_D-, USB_D+) VDDIO (36) VDDIO (17) GND (35) GND (18) 4 D0, D1, D3, D4 VDDIO (17) GND (18) 5 A1, A2, A3, A4 D8, D9 VDDANA (6) GNDANA (5) 6 A0, A5, AREF (RX_LED, RTC1, RTC2) VDDANA (6) GNDANA (5) If for example, you're sourcing current to four LEDs tied to pins 0, 1, 3, and 4 (cluster 4), the sum of that current must be less than 14mA (~3.5mA per LED). On a related note, Cluster 3 is mostly occupied by the Radio's various inputs: interrupt, chip select, and reset as well as the Qwiic Connector. Drivers (If You Need Them) Heads up! Please be aware that the SparkFunSAMD21 Pro RF is NOT currently supported on Windows 8 due to a lack of support drivers for those specific OS's. Windows 10 After plugging the board in, Windows will try to search the Internet for drivers. They should automatically install for Windows 10 without any issues. Windows 7 If you are using a Windows 7 OS, you will need to install the SAMD drivers using the SAMD Windows 7 Installer. Head over to the GitHub repo to install the executable. SAMD WINDOWS 7 INSTALLER Scroll down the page to the assets in the Latest release and click on the '.exe to download. The version number may be different depending on the release. The image below shows sparkfun_drivers_1.0.5.3.exe . Click on the image for a closer view. After downloading, click on the executable and follow the prompts to install. The steps to install are the same even though the following images show drivers for v1.0.5.1. You will receive a warning from Windows. Click yes to continue. Another window will pop up. Read through the license and click "I Agree". When ready, hit the Install button. Another window will pop up. Click on "Install this driver software anyway" to continue. Your Windows 7 will begin installing the driver. This should take a few seconds. When the drivers have installed, hit the "Close" button to exit out of the installer. Mac and Linux Mac and Linux users shouldn't need to download any drivers. The device should show up as a serial port as soon as it's plugged in to your computer. Setting Up Arduino Heads up! Please be aware that the SparkFun SAMD21 Pro RF is NOT currently supported on Windows 8 due to a lack of support drivers for those specific OS's. Update Arduino! This setup requires at least Arduino version 1.6.4 or later. We've tested it on the latest version – 1.8.5. If you're running an older version of Arduino, consider visiting arduino.cc to get the latest, greatest release. While the SAMD21 is powerful and completely supported by the Arduino IDE. This following section will list every step required for installing the SparkFun SAMD21 Pro RF into the Arduino IDE. Install Arduino SAMD Boards First, we'll install the SAMD board definitions via the Boards Manager in the Arduino IDE which contains a variety of tools, including low-level ARM Cortex libraries full of generic code, arm-gcc to compile your code, and bossa to upload over the bootloader. To install the Arduino SAMD board definitions, navigate to your board manager (Tools > Board > Boards Manager...), then find an entry for Arduino SAMD Boards (32-bits ARM Cortex-M0+). Select it, and install the latest version. At the time of this Hookup Guide, version 1.6.19 was used. Downloading and installing the tools may take a couple minutes -- arm-gcc in particular will take the longest, it's about 250MB unpacked! Once installed. the Installed text will appear next to the SAMD boards list entry. Let's continue... Install SparkFun Board Definition Open your Arduino preferences (File > Preferences). Then find the Additional Board Manager URLs text box, and paste the link listed below in the field encapsulated in the red box: https://raw.githubusercontent.com/sparkfun/Arduino_Boards/master/IDE_Board_Manager/package_spark fun_index.json If you've done this before with different development boards, then you can add the SparkFun link text to the end of the text, just add a comma between seperate links or click on the small square to the right of the field and add it to the bottom of the list. Now hit OK, and travel back to the Boards Manager menu. You'll now see a new entry for SparkFun SAMD Boards. If you don't see it, close the boards manager and open it again. ¯\_(ツ)_/¯. This installation should be much faster; you've already done the heavy lifting in the previous section. You're update should be 1.5.2 or later! Select the Board and Serial Port Once the board is installed, you should see a new entry in your Tools > Board list: SparkFun SAMD21 Pro RF. Finally, select your SAMD21 Pro RF Board's port. Navigate back up to the Tool > Port menu. The port menu may magically know which of your ports (if you have more than one) are the SAMD21 board. On a Windows machine, the serial port should come in the form of "COM#". On a Mac or Linux machine, the port will look like "/dev/cu.usbmodem####". Point to Point Radio Arduino Examples Note: This example assumes you are using the latest version of the Arduino IDE on your desktop. If this is your first time using Arduino, please review our tutorial on installing the Arduino IDE. If you have not previously installed an Arduino library, please check out our installation guide. For this example we'll be utilizing the Radio Head Library to utilize the RFM96W Radio Module. You can download the Radio Head library from its' GitHub repo, or click the link below. While you're clicking on buttons, all of the Arduino example code can be downloaded by downloading it from the SAMD21 Pro RF Arduino Examples GitHub repo or clicking the second button below. DOWNLOAD RADIOHEAD ARDUINO LIBRARY (ZIP) DOWNLOAD SAMD21 PRO RF ARDUINO EXAMPLES (ZIP) One last thing before we go any farther. The SAMD21 is a highly versatile chip and we've taken advantage of that fact by creating two seperate UART lines, one that interfaces with the computer through the micro-B and another one broken out on the RX/TX header on the side of the board. To communicate to the Arduino IDE's serial monitor, we'll be using the statement SerialUSB , rather than the normal Serial that you might be used to. Are they different? Nope! Just different nomenclature for different UART lines. Point to Point Radio Arduino Examples Radio Server Note: For the following two examples to work you'll need one radio module to send your message and another to hear and respond. This example uses two SAMD21 Pro RF's communicating to each other operating in the Americas at 915 MHz. If you are using the SAMD21 Pro RF's in Europe, make sure that you have the antenna length adjusted for 868MHz and set the frequency variable. Assuming that the Arduino library you downloaded and installed is working correctly, let's move onto our first example. This example and the following example build off of the sample code provided by the RadioHead library but has been tailored for the SAMD21 Pro RF. #include //Radio Head Library: #include // We need to provide the RFM95 module's chip select and interrupt pins to the // rf95 instance below.On the SparkFun ProRF those pins are 12 and 6 respectively. RH_RF95 rf95(12, 6); int LED = 13; //Status LED on pin 13 int packetCounter = 0; //Counts the number of packets sent long timeSinceLastPacket = 0; //Tracks the time stamp of last packet received // The broadcast frequency is set to 921.2, but the SADM21 ProRf operates // anywhere in the range of 902-928MHz in the Americas. // Europe operates in the frequencies 863-870, center frequency at // 868MHz.This works but it is unknown how well the radio configures to this frequency: //float frequency = 864.1; float frequency = 921.2; void setup() { pinMode(LED, OUTPUT); SerialUSB.begin(9600); // It may be difficult to read serial messages on startup. The following // line will wait for serial to be ready before continuing. Comment out if not needed. while(!SerialUSB); SerialUSB.println("RFM Server!"); //Initialize the Radio. if (rf95.init() == false){ SerialUSB.println("Radio Init Failed - Freezing"); while (1); } else{ // An LED indicator to let us know radio initialization has completed. SerialUSB.println("Receiver up!"); digitalWrite(LED, HIGH); delay(500); digitalWrite(LED, LOW); delay(500); } rf95.setFrequency(frequency); // // // // } The default transmitter power is 13dBm, using PA_BOOST. If you are using RFM95/96/97/98 modules which uses the PA_BOOST transmitter pin, then you can set transmitter powers from 5 to 23 dBm: rf95.setTxPower(14, false); void loop() { if (rf95.available()){ // Should be a message for us now uint8_t buf[RH_RF95_MAX_MESSAGE_LEN]; uint8_t len = sizeof(buf); if (rf95.recv(buf, &len)){ digitalWrite(LED, HIGH); //Turn on status LED timeSinceLastPacket = millis(); //Timestamp this packet SerialUSB.print("Got message: "); SerialUSB.print((char*)buf); //SerialUSB.print(" RSSI: "); //SerialUSB.print(rf95.lastRssi(), DEC); SerialUSB.println(); // Send a reply uint8_t toSend[] = "Hello Back!"; rf95.send(toSend, sizeof(toSend)); rf95.waitPacketSent(); SerialUSB.println("Sent a reply"); digitalWrite(LED, LOW); //Turn off status LED } else SerialUSB.println("Recieve failed"); } //Turn off status LED if we haven't received a packet after 1s if(millis() - timeSinceLastPacket > 1000){ digitalWrite(LED, LOW); //Turn off status LED timeSinceLastPacket = millis(); //Don't write LED but every 1s } } Radio Client /* Both the TX and RX ProRF boards will need a wire antenna. We recommend a 3" piece of wire. This example is a modified version of the example provided by the Radio Head Library which can be found here: www.github.com/PaulStoffregen/RadioHeadd */ #include //Radio Head Library: #include // We need to provide the RFM95 module's chip select and interrupt pins to the // rf95 instance below.On the SparkFun ProRF those pins are 12 and 6 respectively. RH_RF95 rf95(12, 6); int LED = 13; //Status LED is on pin 13 int packetCounter = 0; //Counts the number of packets sent long timeSinceLastPacket = 0; //Tracks the time stamp of last packet received // The broadcast frequency is set to 921.2, but the SADM21 ProRf operates // anywhere in the range of 902-928MHz in the Americas. // Europe operates in the frequencies 863-870, center frequency at 868MHz. // This works but it is unknown how well the radio configures to this frequency: //float frequency = 864.1; float frequency = 921.2; //Broadcast frequency void setup() { pinMode(LED, OUTPUT); SerialUSB.begin(9600); // It may be difficult to read serial messages on startup. The following line // will wait for serial to be ready before continuing. Comment out if not needed. while(!SerialUSB); SerialUSB.println("RFM Client!"); //Initialize the Radio. if (rf95.init() == false){ SerialUSB.println("Radio Init Failed - Freezing"); while (1); } else{ //An LED inidicator to let us know radio initialization has completed. SerialUSB.println("Transmitter up!"); digitalWrite(LED, HIGH); delay(500); digitalWrite(LED, LOW); delay(500); } // Set frequency rf95.setFrequency(frequency); // The default transmitter power is 13dBm, using PA_BOOST. // If you are using RFM95/96/97/98 modules which uses the PA_BOOST transmitter pin, then // you can set transmitter powers from 5 to 23 dBm: // Transmitter power can range from 14-20dbm. rf95.setTxPower(14, false); } void loop() { SerialUSB.println("Sending message"); //Send a message to the other radio uint8_t toSend[] = "Hi there!"; //sprintf(toSend, "Hi, my counter is: %d", packetCounter++); rf95.send(toSend, sizeof(toSend)); rf95.waitPacketSent(); // Now wait for a reply byte buf[RH_RF95_MAX_MESSAGE_LEN]; byte len = sizeof(buf); if (rf95.waitAvailableTimeout(2000)) { // Should be a reply message for us now if (rf95.recv(buf, &len)) { SerialUSB.print("Got reply: "); SerialUSB.println((char*)buf); //SerialUSB.print(" RSSI: "); //SerialUSB.print(rf95.lastRssi(), DEC); } else { SerialUSB.println("Receive failed"); } } else { SerialUSB.println("No reply, is the receiver running?"); } delay(500); } The "Server" and "Client" nomenclature may be a bit misleading. It might be more accurate to say "call" and "callback". None the less, there are a few notable changes made from the original examples. Chip Select and Interupt Pins RH_RF95 rf95(12, 6) -- Pin 12 and pin 6 are the assigned pins that run to the RM95 Radio Module's chip select and interrupt pins. SerialUSB or Serial? while(!SerialUSB) -- When the SAMD21 Pro RF starts up, it's not always a smooth transition and messages meant for the serial monitor will get missed. This line will hold your code hostage until you open the serial monitor at which point it will continue on. We have two UART lines for this microcontroller, the one that communicates with the serial monitor is called using the keyword SerialUSB. Frequency Select rf95.setFrequency(frequency) -- The default frequency is kind of random, 921.2 but it falls within the American ISM band: 902-928MHz. If you're in Europe, that band is 863-870MHz. You'll find the variable "frequency" is set a little higher up in the code. After you upload the code to two SAMD21 Pro RF's, open a serial monitor set at 9600. You should see the following readout in the serial monitors! Click the image for a closer look at the output. LoRaWAN Arduino Library and Example The Internet of Things "Hello World" - Node Example For this example, we'll be setting up the SAMD21 Pro RF as a node using a library written by Matthijs Kooijman which is a modified version of "IBM's LMIC (LoraMAC-in-C)" library. You can download it through the Arduino Library Manager under "LMIC-Arduino". There are a few versions of this library. The original Arduino library may be under "IBM LMIC framework by IBM". You can also download and manually install it from the GitHub Repository, or click the button below to manually install it from there. ARDUINO-LMIC LIBRARY "V1.5.0+ARDUINO-2" DOWNLOAD (ZIP) This example requires that you have an account with The Things Network and a nearby gateway. Read the brief introduction above to learn about nodes, gateways, and network servers. First, we'll need an account at The Things Network which will provide us our network server to manage, graph, and/or look at our data in the case of our "Hello World" example below. On the front page of the website there's a map that shows active gateways in your area. If you don't have a gateway nearby, you can set one up using SparkFun's ESP32 1-Ch Gateway, using this excellent set up guide here. This is the gateway that I chose to use for this example. Registering Your Node This rest of this example assumes that you have an account with The Things Network. It's free and only requires an email address! Before you can upload with the SAMD21 Pro RF, you'll need to sign up for an account on their website. Registering with their website is free, and allows the network to generate the necessary keys which identify your projects and nodes. You'll notice that there's no option to just add a node, that's because The Things Network needs to know what application to associate with your device. Therefore, you'll need to start by creating an application. Clicking on the Applications button will take you to a page that looks like this: This would usually be a list of all your applications, but The Things Network automatically recognizes that you don't have any applications yet and suggests that you add one. You can add an application either by clicking that link or clicking on "add application" in the upper right corner. Both of those links will take you to this page: Give your application an Application ID (identifier); this is the name that The Things Network will use to distinguish it from the other applications. It can only contain lowercase letters, numbers, and dashes. The description field is for humans, so take a moment to write a sentence about what your app does. In this case, I've just written that it's an example application. The EUI will be issued by the network, so there's no need to type anything there. Finally, select the handler that you want your application to be registered to. Essentially, these are instances of the network server in different physical locations around the world. All applications will talk to all network servers, but to minimize latency, it's best to select the handler closest to your gateway. SparkFun is located in Colorado, so I chose "ttn-handler-us-west," which I assume is in California somewhere. Click the Add Application button and you'll be taken to your freshly generated application console. Now that you've created an application, you can register a device to it. Scroll down to the Devices section of the application page and you will see your current device count (which is none) as well as options to register a device and to manage devices. Click on register device. This form is pretty similar to the Register an Application page, but you have a little less to do. Give your device a Device ID, the same rules apply as did with the Application ID. Then click the little crossed arrows beside the Device EUI field, this lets TTN know that you want them to generate an EUI for you. Now just click on the Register button at the bottom of the form. And now you've been taken to your brand new device console. Under the section labeled Device Overview you'll notice the Application ID and Device ID that you set earlier. Under Activation Method it will likely say "OTAA," which stands for Over The Air Activation. This is a secure, transportable method of activating LoRaWAN devices, whereby the device uses a known application key to request new session keys whenever it wants to join the network. This is the preferred method for activating a production device, but for prototyping it's usually easier to hard code the session keys into your device. In order to do this, we'll need to set the activation method to "ABP" or Activation By Personalization. To do this, click on the Settings tab in the upper right-hand corner of the device page and you'll be taken to the device settings menu. Partway down the page you should find an option to change the activation method. Click on "ABP," and then save your settings. When you return to the Overview page, you should now see some extra fields in the Device Overview: We'll need these keys to program your SAMD21 Pro RF so leave this page up on your browser and let's open up the Arduino IDE. It's time to program the node! Programming the SAMD21 Pro RF This modified example takes directly from the example code provided by the library with a two changes: the function calls to " Serial " will need to be replaced with " SerialUSB " and changes to the pin mapping that is consistent with the SAMD21 Pro RF. Before we look at the code you'll first need to modify the config.h file that came with the LMIC Arduino Library. Configuring Your Region Find your Arduino libraries folder and navigate to ...IBM_LMIC_framework/src/lmic/. You should find a file called config.h. Open it in any text editor and find the lines where CFG_us915 is defined. It should look like this: //#define CFG_eu868 1 #define CFG_us915 1 // This is the SX1272/SX1273 radio, which is also used on the HopeRF // RFM92 boards. //#define CFG_sx1272_radio 1 // This is the SX1276/SX1277/SX1278/SX1279 radio, which is also used on // the HopeRF RFM95 boards. #define CFG_sx1276_radio 1 Since we're using the 915MHz radio module in the US, you need to make sure that the line #define CFG_us915 1 is not commented out and that the line #define CFG_eu868 1 is, by prepending // as shown above. Same goes for the radio type, we want #define CFG_sx1276_radio 1 and not #define CFG_sx1272_radio 1 . Notice how the first "#define" contains "eu868", short for Europe and its center frequency. The line we un-commented contains "us915" which is undoubtedly for United States, with its center frequency at 915. With those changes made, save the config.h file and return to the Arduino IDE. Configuring Your Device Key and Address In order to make it work with your application, you'll need to copy in some keys from the Device Overview page on your TTN Console, so flip back to the browser tab with the Device Overview page loaded up. You'll notice that, by default, the Network Session Key and App Session Key fields are obscured for security reasons. You can click the eye icon to show the code before copying it. Also, it will be easier to copy this into the example code if you click the button to show the codes in "C style", a bunch of HEX designated numbers. You will need to copy three separate numbers into your example code from this page: Network Session Key =(i.e. NWKSKEY[] ) App Session Key (i.e. APPSKEY[] ) Device Address (i.e. DEVADDR ) Here's a diagram explaining which field on this page corresponds to which constant in the example code: Click the image for a closer look. Heads up! The keys and address provided are not the same order as listed on the website. Copy the modified code of the ttn-adb.ino sketch shown below and paste it in the Arduino IDE. Notice the three lines at the top of the code that say " NETWORK_SESSION_KEY_HERE ", " APPLICATION_KEY_HERE ", and " DEVICE_ADDRESS_HERE ". These lines can be replaced by the keys from the website. Make sure to add a 0x before your device address. #include #include #include // LoRaWAN NwkSKey, network session key static const PROGMEM u1_t NWKSKEY[16] = { NETWORK_SESSION_KEY_HERE }; // LoRaWAN AppSKey, application session key static const u1_t PROGMEM APPSKEY[16] = { APPLICATION_KEY_HERE }; // LoRaWAN end-device address (DevAddr) static const u4_t DEVADDR = DEVICE_ADDRESS_HERE ; //
WRL-15836 价格&库存

很抱歉,暂时无法提供与“WRL-15836”相匹配的价格&库存,您可以联系我们找货

免费人工找货