|
| 1 | +--- |
| 2 | +title: Micro-ROS 6LoWPAN Guide |
| 3 | +permalink: /docs/tutorials/advanced/microros_6lowpan_tutorial/ |
| 4 | +--- |
| 5 | + |
| 6 | +On this guide we will show how to use Micro-ROS over 6LoWPAN communication. |
| 7 | + |
| 8 | +# What is 6LoWPAN? |
| 9 | + |
| 10 | +6LoWPAN is acronym base of IPv6 over Low -Power Wireless Personal Area Networks. This communication protocol allows wireless communication over IEEE 802.15.4 based network using IPv6. Some of the main advantage are: |
| 11 | +- Easy to route from radio devices to the Internet, thanks to ussage of the IP packets. |
| 12 | +- Easy to use on UDP and TCP server/clients. |
| 13 | +- Protocol designed for low power and constrain devices. Perfect for Micro-ROS remote sensors. |
| 14 | + |
| 15 | +# What do you need to try? |
| 16 | + |
| 17 | +At this moment this communication protocol is only available for NuttX RTOS. You need the next devices to try this guide: |
| 18 | + |
| 19 | +- Olimex-STM32-E407 board. [Link](https://www.olimex.com/Products/ARM/ST/STM32-E407/open-source-hardware) |
| 20 | +- PModRF2 Radio [Link](https://store.digilentinc.com/pmod-rf2-ieee-802-15-rf-transceiver/) |
| 21 | +- Micro-ROS hardware bridge. |
| 22 | + |
| 23 | +**Important!** |
| 24 | +You can find a guide of how to set-up the Micro-ROS hardware bridge on the next link: [uROS hardware bridge guide](https://github.com/micro-ROS/micro-ROS-bridge_RPI/blob/new_bridge_tools/Readme.md) |
| 25 | +On the micro-ROS hardware bridge guide you can find everything that you need to set-up this device base. |
| 26 | + |
| 27 | +# Configure the board |
| 28 | + |
| 29 | +This point will split into set-up the hardware and set-up the software |
| 30 | + |
| 31 | +## Set-up the hardware |
| 32 | +First we're going to connect the Pmodrf2 radio. To do so, follow the next wiring table: |
| 33 | + |
| 34 | +- `Board D13` -> `MRF24J40 SCLK` |
| 35 | +- `Board D12` -> `MRF24J40 MISO` |
| 36 | +- `Board D11` -> `MRF24J40 MOSI` |
| 37 | +- `Board D10` -> `MRF24J40 CS` |
| 38 | +- `Board D8` -> `MRF24J40 INT` |
| 39 | + |
| 40 | +The ``D`` reference to the Arduino header pins of the board. |
| 41 | +To help on the set-up process, you can find the pinout of the radio on the next link: [PmodRF2 pinout](https://reference.digilentinc.com/reference/pmod/pmodrf2/start) |
| 42 | + |
| 43 | +The last point, is connect a mini-USB cable to the OTG2 USB port (The USB port next to the Ethernet port). |
| 44 | + |
| 45 | +From the hardware point, everything is ready. |
| 46 | +## Set-up the software |
| 47 | + |
| 48 | +To create and flash the firmware, we're going to use the micro-ROS build system. |
| 49 | + |
| 50 | +You can find the instructions on the next link: [Micro-ROS build system](https://github.com/micro-ROS/micro-ros-build/blob/dashing/micro_ros_setup/README.md). |
| 51 | +For this particular guide, is necessary to use the branch ``dashing`` and use the configuration profiel ``uros_6lowpan``. |
| 52 | + |
| 53 | +Once you follow all the instructions on the build system, and the board is flashed everything is ready. |
| 54 | + |
| 55 | +# How to use it? |
| 56 | + |
| 57 | +- Turn on the Olimex-STM32-E407 board and open the NSH console on a terminal. |
| 58 | +- Check if all the applications are ready by typing ``?`` on the console. It should the return the next: |
| 59 | +```bash |
| 60 | +help usage: help [-v] [<cmd>] |
| 61 | + |
| 62 | + [ cd df help ls mw set true |
| 63 | + ? cp echo hexdump mb ps sh uname |
| 64 | + addroute cmp exec ifconfig mkdir pwd sleep umount |
| 65 | + basename dirname exit ifdown mh rm test unset |
| 66 | + break dd false ifup mount rmdir telnetd usleep |
| 67 | + cat delroute free kill mv route time xd |
| 68 | + |
| 69 | +Builtin Apps: |
| 70 | + ping6 i8sak uros_6lowpan |
| 71 | +``` |
| 72 | +- Now turn-on the Raspberry Pi and execute the micro-ROS hardware bridge tool, by typing the next command: |
| 73 | +```bash |
| 74 | +./ ~/micro-ROS-HB.sh |
| 75 | +``` |
| 76 | +- Once everything is configured, it will return the connection data of the 6LowPAN network: |
| 77 | +```bash |
| 78 | +lowpan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1280 |
| 79 | + inet6 fe80::b482:ca65:743b:b6bd prefixlen 64 scopeid 0x20<link> |
| 80 | + unspec B6-82-CA-65-74-3B-B6-BD-00-00-00-00-00-00-00-00 txqueuelen 1000 (UNSPEC) |
| 81 | + RX packets 0 bytes 0 (0.0 B) |
| 82 | + RX errors 0 dropped 0 overruns 0 frame 0 |
| 83 | + TX packets 21 bytes 2242 (2.1 KiB) |
| 84 | + TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 |
| 85 | + |
| 86 | +1) Add new 6LoWPAN micro-ROS device 3) Create UDP micro-ROS Agent 5) Create Serial micro-ROS Agent server |
| 87 | +2) Create UDP 6LoWPAN micro-ROS Agent 4) Create TCP micro-ROS Agent 6) Quit |
| 88 | +#? |
| 89 | + |
| 90 | +``` |
| 91 | +- Copy the value **inet6**, this will usefull on the next steps, because the IPV6 direcction of the RPI on the 6LoWPAN network. |
| 92 | +
|
| 93 | +
|
0 commit comments