| 38 | |
| 39 | |
| 40 | |
| 41 | == RF Network / Infrastructure == |
| 42 | |
| 43 | The CC135x operates on its own network. It does not rely on towers/networks installed by 3rd party companies (!LoRa, Sigfox, Verizon, AT&T, etc). The entire network infrastructure is under control by the user. This includes sensors/nodes, collector(s), antennas and more. |
| 44 | |
| 45 | == Network Architecture == |
| 46 | |
| 47 | The default is a star-based topology system where there is one central collector (The CC135x on a Gateworks SBC) that listens to all the sensors / nodes that are around it. |
| 48 | |
| 49 | |
| 50 | == Range Testing == |
| 51 | |
| 52 | *** Note below testing done with GW16122 rev A with CC1350. CC1352P has a 20dBm power amplifier which will increase the range *** |
| 53 | |
| 54 | Gateworks did basic range testing with the GW16122 using a 2dBi Omni Antenna on the 915Mhz band. A successful link was acquired at 4500ft/1.4km over water. Note both the transmitter and receiver were only 1m off the ground so much better performance would be expected if the antennas were mounted higher to clear the Fresnel zones. Using a directional antennas, range can be increased further with links easily greater then >10Km. Additionally, there is different modes and tuning that can be done in software to increase the range, such as LRM (long range mode). |
| 55 | |
| 56 | More range information may be found on the [https://e2e.ti.com/support/ TI E2E Forums] and on the TI documentation listed in the references on this page. |
| 57 | |
| 58 | Gateworks Range testing map: |
| 59 | |
| 60 | [[Image(16122range.png,400px)]] |
| 61 | |
| 62 | == Glossary == |
| 63 | |
| 64 | * BLE - Bluetooth Low Engery |
| 65 | * BLE-ADV - Bluetooth Low Energy Advertising |
| 66 | * OAD - Over the Air Download |
| 67 | * 802.15.4 - IEEE standard defining the operation of low-rate wireless personal area networks (LR-WPANs). Definition includes the physical layer and media access control. Can be used with 6LoWPAN. The IEEE 802.15.4 standard is used as a data-link layer of many popular networking standards deployed in the market (6LoWPAN, Wi-SUN, !ZigBee®, Thread and WHART). It guarantees a solid wireless foundation thanks to features like air arbitration (through CSMA-CA), acknowledgments and retransmissions and built-in AES security. 802.15.4 can operate on the following frequencies: 868/915/2450 MHz |
| 68 | * Frequency: North America: 902–928 MHz, up to 30 channels |
| 69 | * RTOS - Real Time Operating System |
| 70 | * LoWPAN - Low Power Wireless Personal Area Network |
| 71 | * 6LoWPAN - Low Power Wireless Personal Area Network, allowing for IPv6 packets. Read more [http://www.ti.com/lit/wp/swry013/swry013.pdf here]. |
| 72 | * LRM - Long Range Mode |
| 73 | * LP - Likely LaunchPad, referring to the CC1350 'Dev Kit' from Ti. Could also mean 'LowPower' |
| 74 | * PA/LNA - Power amplifier (PA) for increased output power, and a low-noise amplifier (LNA) with low noise figure for improved receiver sensitivity. This can be used with the [http://www.ti.com/product/CC1190/toolssoftware Ti CC1190 RF Booster / Front End] |
| 75 | * BLE Modes - advertising, scanning, master, slave. Read more [http://www.eetimes.com/document.asp?doc_id=1278927 here] |
| 76 | * TI-RTOS - TI-RTOS kernel is a tailored version of the legacy SYS/BIOS kernel and operates as a real-time, preemptive, multi-threaded operating system with drivers, tools for synchronization and scheduling. |
| 77 | * TI-15.4 Stack - The TI 15.4-Stack is a software development kit (SDK) running on the !SimpleLink™ Sub-1 GHz CC1310 wireless microcontroller (MCU). Based on the proven IEEE 802.15.4 standard, it implements the 'g' amendment of the specification for operations in North America and Europe in the Sub-1 GHz band (regulated respectively by FCC and ETSI). |
| 78 | * LPWAN - Low‑Power Wide‑Area |
| 79 | * NB-IoT - Narrow band Internet of Things |
| 80 | * Contiki - read more [#ThirdPartySoftware Third Party Software] |
| 81 | * rfWsnDmNodeOad_US_CC1350STK_TI_CC1350F128-v1_06.hex |
| 82 | * rf = Radio Frequency |
| 83 | * Wsn = Wireless Sensor Network |
| 84 | * Dm = Dual Mode, Bluetooth and Sub 1Ghz |
| 85 | * Node = A node is an edge device that is a sensor and sends data back to a central coordinator or collector |
| 86 | * Oad = Over the air download |
| 87 | * STK = Sensor Tag Kit |
| 88 | * Coord Addr - Coordinator Address - This is the address on the network for the coordinator/collector. Example: 0xAABB |
| 89 | * PanID - Personal Area Network ID, example 0xACDC |
| 90 | * FAN - Field Area Network |
| 91 | * FH - Frequency hopping. Not used in default examples. |
| 92 | * EasyLink - an API, a simple abstraction layer on top of the RF Driver and is intended as a starting point for customers creating a proprietary Sub1-GHz protocol or application. |
| 93 | * Alternatives: |
| 94 | * TI-RTOS RF driver (of what EasyLink is a abstraction of) |
| 95 | * TI-15.4 Stack, Full stack-based network solution, available as part of the CC13x0 SDK |
| 96 | * Thread - read more [#ThirdPartySoftware Third Party Software] |
| 97 | * Dash7 - DASH7 Alliance Protocol (D7A) is an open source Wireless Sensor and Actuator Network protocol, which operates in the 433 MHz, 868 MHz and 915 MHz unlicensed ISM band/SRD band. Dash7 has not been tested on the GW16122. |
| 98 | |
| 580 | |
| 581 | |
| 582 | |
| 583 | == Third Party Software == |
| 584 | * Contiki - Open Source OS for IoT, utilizing 6LoWPAN, can run on Sub-1GHz |
| 585 | * Thingsquare - Based on Contiki, exposes through REST API [#Thingsquare Click here ] |
| 586 | * !WiSun [#Wi-Sun Click Here] |
| 587 | * Thread - Thread is an IPv6-based, low-power mesh networking technology for IoT products, intended to be secure and future-proof. Thread will not work on the Gateworks GW16122 because it is not designed for Sub-1Ghz. Based on 6LowPan. Based on 802.15.4 2.4GHz. |
| 588 | * KNX - Open protocol Aimed at building automation. Operates on many physical layers. |
| 589 | * Ti Simple 6LoWPAN Mesh End-Node Improves Network Performance Reference Design [http://www.ti.com/tool/tida-010003] |
| 590 | * Wirepas: Fairly close to WiSun [https://wirepas.com/] |
| 591 | |
| 592 | === Wi-Sun === |
| 593 | |
| 594 | The TI 15.4 stack leverages WiSun-based frequency hopping and can be used on CC1350 and CC1352. |
| 595 | |
| 596 | Some 3rd parties capable of implementing a Wi-SUN stack are Adsol-Nissin and Procubed. |
| 597 | |
| 598 | Please use the E2E Ti Forums for more information [https://e2e.ti.com/support/ TI E2E Forums] |
| 599 | |
| 600 | |
| 601 | === Thingsquare === |
| 602 | |
| 603 | |
| 604 | *** Note below testing done with rev A with CC1350. GW16122-B uses a CC1352P which has not been tested with Thingsquare but should operate the same *** |
| 605 | |
| 606 | [http://www.thingsquare.com Thingsquare] is a software company that offers customized software for the chip on the GW16122, the Ti CC135x. This software allows for the use of a smartphone app to monitor and control sensors through the Thingsquare cloud/backend. A [https://www.thingsquare.com/docs/api/ REST API] is available as well. |
| 607 | |
| 608 | A brief description of what is happening in the demo below: |
| 609 | * A Gateworks GW16122 is acting as the Thingsquare IoT gateway on the Gateworks SBC |
| 610 | * The GW16122 exposes a few serial interfaces (/dev/ttyACM0 and /dev/ttyACM1) which are then used for the SLIP interface |
| 611 | * dnsmasq acts as a DNS server for the slip interface |
| 612 | * The sl0 uses PTP for the DNS |
| 613 | * The SLIP requires some routing and forwarding between interface sl0 and eth0 |
| 614 | * The firmware on the GW16122 pushes data up to the Thingsquare cloud |
| 615 | * The CC1350 Sensor tag is reporting back to the Gateway and pushing it's information up to the cloud |
| 616 | |
| 617 | |
| 618 | |
| 619 | '''Hardware required:''' |
| 620 | All items purchased seperately |
| 621 | |
| 622 | * Gateworks [http://www.gateworks.com/product Ventana or Newport] Single Board Computer |
| 623 | * Gateworks [http://www.gateworks.com/product/item/gw16122-mini-pcie-iot-radio-expansion-card GW16122 IoT Card] |
| 624 | * Gateworks GW10124 900Mhz Antenna |
| 625 | * Gateworks [https://shop.gateworks.com/index.php?route=product/product&product_id=59 GW10074] MMCX to SMA Female Adapter Cable |
| 626 | * [http://www.ti.com/tool/CC1350STK Ti CC1350 Sensor Tag] |
| 627 | * Gateworks SBC and GW16122 are the 'collector' in the system. This CC1350 !Sensor !Tag becomes the 'sensor' for development. |
| 628 | * USB to Mini-PCIe Adapter |
| 629 | * This allows the Gateworks GW16122 to be connected to a Laptop / PC for programming purposes. |
| 630 | * [https://www.amazon.com/Mini-Wireless-Adapter-Module-Testing/dp/B00T2FPC2A/ref=sr_1_8?ie=UTF8&qid=1519335779&sr=8-8& Option #1 - Amazon] - Requires rubberband to hold GW16122 in |
| 631 | |
| 632 | ''' The following instructions assume the developer is familiar with using the Gateworks SBC & GW16122 and programming it using the instructions given elsewhere on this wiki''' |
| 633 | |
| 634 | '''Setup Instructions''' |
| 635 | 1. [http://trac.gateworks.com/wiki/expansion/gw16122#Windows Flash] the GW16122 and sensor nodes with Thingsquare Firmware located [https://www.thingsquare.com/docs/downloads/ here] |
| 636 | a. GW16122 Firmnware is labeled as ''CC1350 Launchpad Serial USB Access Point (US / 915 MHz)'' |
| 637 | a. Sensor Firmnware is labeled as ''CC1350 Sensortag'' |
| 638 | 1. Insert a programmed GW16122 into a Gateworks SBC Mini-PCIe slot that has USB support |
| 639 | 1. Load Gateworks SBC Ubuntu 16.04 Software |
| 640 | a. Install Ubuntu Xenial 16.04 with the instructions [wiki:ventana/ubuntu#Ubuntu16.04LTSXenialXerusconsoleimage Ventana 16.04] |
| 641 | a. Confirm /dev/ttyACM0 and /dev/ttyACM1 exist on the Gateworks SBC in software |
| 642 | a. Confirm an ethernet cable is connected to the Gateworks SBC connected to a LAN that has internet access via a WAN |
| 643 | a. Install dnsmasq{{{apt-get install dnsmasq}}} |
| 644 | a. Add the following lines to the end of the /etc/dnsmasq.conf file: |
| 645 | {{{ |
| 646 | interface=sl0 |
| 647 | listen-address=127.0.0.1 |
| 648 | listen-address=172.16.0.1 |
| 649 | }}} |
| 650 | a. Create a script or add to /etc/rc.local to be ran after the board boots each time: |
| 651 | {{{ |
| 652 | modprobe slip |
| 653 | stty -F /dev/ttyACM0 115200 |
| 654 | sleep 3 |
| 655 | slattach -L -s 115200 -p slip /dev/ttyACM0 & |
| 656 | |
| 657 | sleep 10 |
| 658 | ifconfig sl0 172.16.0.1 dstaddr 172.16.0.2 |
| 659 | ifconfig sl0 mtu 600 |
| 660 | |
| 661 | echo 1 > /proc/sys/net/ipv4/ip_forward |
| 662 | |
| 663 | iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE |
| 664 | iptables -A FORWARD -i eth0 -o sl0 -j ACCEPT |
| 665 | iptables -A FORWARD -i sl0 -o eth0 -j ACCEPT |
| 666 | systemctl start dnsmasq.service |
| 667 | }}} |
| 668 | a. After script is installed, either run the script or reboot the board if the script will run automatically |
| 669 | 1. Connect the Gateway / Sensor either using a mobile phone or network browser, explained below: |
| 670 | 1. Utilize the Thingsquare website to connect both sensor and Gateway to cloud with the following instructions using a mobile phone: [http://www.thingsquare.com/docs/get-started-with-starter-kit/] |
| 671 | a. Important Note: Checking the box 'Remote Access' is important to connect the device to the Thingsquare backend and available when logging into the app/browser with user account |
| 672 | 1. You can use the website [https://developer.thingsquare.com/web/] to access the devices from a PC browser on the same LAN. Create a Thingsquare account. |
| 673 | a. Use the bottom menu icon, 'Nearby' to be sure you can discover the device on the LAN |
| 674 | a. Important Note: Checking the box 'Remote Access' is important to connect the device to the Thingsquare backend and available when logging into the app/browser with user account |
| 675 | |
| 676 | '''Screenshots:''' |
| 677 | * [[Image(thingsquare1.png,400px)]] |
| 678 | * [[Image(thingsquare2.png,400px)]] |
| 679 | |
| 680 | '''Troubleshooting:''' |
| 681 | 1. Verify traffic on sl0 interface with tcpdump, example below: |
| 682 | {{{ |
| 683 | root@xenial-ventana:~# tcpdump -i sl0 |
| 684 | tcpdump: verbose output suppressed, use -v or -vv for full protocol decode |
| 685 | listening on sl0, link-type RAW (Raw IP), capture size 262144 bytes |
| 686 | 17:04:02.516758 IP 172.16.0.2.10323 > ec2-52-211-110-245.eu-west-1.compute.amazonaws.com.https: Flags [P.], seq 12805:13034, ack 371767140, win 500, length 229 |
| 687 | 17:04:02.682914 IP ec2-52-211-110-245.eu-west-1.compute.amazonaws.com.https > 172.16.0.2.10323: Flags [.], ack 229, win 54500, length 0 |
| 688 | 17:04:02.685640 IP ec2-52-211-110-245.eu-west-1.compute.amazonaws.com.https > 172.16.0.2.10323: Flags [P.], seq 1:102, ack 229, win 54500, length 101 |
| 689 | 17:04:02.941381 IP 172.16.0.2.10323 > ec2-52-211-110-245.eu-west-1.compute.amazonaws.com.https: Flags [P.], seq 229:330, ack 102, win 500, length 101 |
| 690 | 17:04:03.148806 IP ec2-52-211-110-245.eu-west-1.compute.amazonaws.com.https > 172.16.0.2.10323: Flags [.], ack 330, win 54500, length 0 |
| 691 | 17:04:12.109625 IP 172.16.0.2.10323 > ec2-52-211-110-245.eu-west-1.compute.amazonaws.com.https: Flags [P.], seq 330:479, ack 102, win 500, length 149 |
| 692 | 17:04:12.276629 IP ec2-52-211-110-245.eu-west-1.compute.amazonaws.com.https > 172.16.0.2.10323: Flags [.], ack 479, win 55500, length 0 |
| 693 | 17:04:18.591617 IP 172.16.0.2.10323 > ec2-52-211-110-245.eu-west-1.compute.amazonaws.com.https: Flags [P.], seq 479:580, ack 102, win 500, length 101 |
| 694 | 17:04:18.756148 IP ec2-52-211-110-245.eu-west-1.compute.amazonaws.com.https > 172.16.0.2.10323: Flags [.], ack 580, win 55500, length 0 |
| 695 | 17:04:18.772626 IP 172.16.0.2.10323 > ec2-52-211-110-245.eu-west-1.compute.amazonaws.com.https: Flags [P.], seq 580:649, ack 102, win 500, length 69 |
| 696 | 17:04:18.941914 IP ec2-52-211-110-245.eu-west-1.compute.amazonaws.com.https > 172.16.0.2.10323: Flags [.], ack 649, win 55500, length 0 |
| 697 | ^C |
| 698 | 11 packets captured |
| 699 | 11 packets received by filter |
| 700 | 0 packets dropped by kernel |
| 701 | root@xenial-ventana:~# |
| 702 | |
| 703 | }}} |
| 704 | 1. Verify dnsmasq is running: |
| 705 | {{{ |
| 706 | systemctl status dnsmasq.service |
| 707 | }}} |
| 708 | 1. Verify dnsmasq is listening on the right address 172.16.0.1 |
| 709 | {{{ |
| 710 | root@xenial-ventana:~# netstat -tulpn |
| 711 | Active Internet connections (only servers) |
| 712 | Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name |
| 713 | tcp 0 0 127.0.0.1:53 0.0.0.0:* LISTEN 824/dnsmasq |
| 714 | tcp 0 0 172.16.0.1:53 0.0.0.0:* LISTEN 824/dnsmasq |
| 715 | tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 645/sshd |
| 716 | tcp6 0 0 ::1:53 :::* LISTEN 824/dnsmasq |
| 717 | tcp6 0 0 :::22 :::* LISTEN 645/sshd |
| 718 | udp 0 0 127.0.0.1:53 0.0.0.0:* 824/dnsmasq |
| 719 | udp 0 0 172.16.0.1:53 0.0.0.0:* 824/dnsmasq |
| 720 | udp 0 0 0.0.0.0:68 0.0.0.0:* 584/dhclient |
| 721 | udp6 0 0 ::1:53 :::* 824/dnsmasq |
| 722 | root@xenial-ventana:~# |
| 723 | |
| 724 | }}} |
| 725 | 1. Verify sl0 interface exists and is up: |
| 726 | {{{ |
| 727 | root@xenial-ventana:~# ifconfig |
| 728 | eth0 Link encap:Ethernet HWaddr 00:d0:12:9b:f2:af |
| 729 | inet addr:172.24.22.173 Bcast:172.24.255.255 Mask:255.240.0.0 |
| 730 | inet6 addr: fe80::2d0:12ff:fe9b:f2af/64 Scope:Link |
| 731 | UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 |
| 732 | RX packets:8962 errors:0 dropped:0 overruns:0 frame:0 |
| 733 | TX packets:483 errors:0 dropped:0 overruns:0 carrier:0 |
| 734 | collisions:0 txqueuelen:1000 |
| 735 | RX bytes:665276 (665.2 KB) TX bytes:58003 (58.0 KB) |
| 736 | |
| 737 | lo Link encap:Local Loopback |
| 738 | inet addr:127.0.0.1 Mask:255.0.0.0 |
| 739 | inet6 addr: ::1/128 Scope:Host |
| 740 | UP LOOPBACK RUNNING MTU:65536 Metric:1 |
| 741 | RX packets:172 errors:0 dropped:0 overruns:0 frame:0 |
| 742 | TX packets:172 errors:0 dropped:0 overruns:0 carrier:0 |
| 743 | collisions:0 txqueuelen:1000 |
| 744 | RX bytes:13066 (13.0 KB) TX bytes:13066 (13.0 KB) |
| 745 | |
| 746 | sl0 Link encap:Serial Line IP |
| 747 | inet addr:172.16.0.1 P-t-P:172.16.0.2 Mask:255.255.255.255 |
| 748 | UP POINTOPOINT RUNNING NOARP MULTICAST MTU:600 Metric:1 |
| 749 | RX packets:307 errors:0 dropped:0 overruns:0 frame:0 |
| 750 | TX packets:345 errors:0 dropped:0 overruns:0 carrier:0 |
| 751 | collisions:0 txqueuelen:10 |
| 752 | RX bytes:42795 (42.7 KB) TX bytes:24061 (24.0 KB) |
| 753 | |
| 754 | |
| 755 | }}} |
| 756 | 1. Verify you can ping www.google.com from the Gateworks SBC command line |
| 757 | |
| 758 | |
| 759 | References: |
| 760 | * Ti Thingsquare [http://www.ti.com/ww/en/internet_of_things/Thingsquare-for-TI-IoT-development-kits.html] |