Build Your Own Mioty® Demo Kit Using Only Off-the-Shelf Components
by phaseshifted in Circuits > Raspberry Pi
39 Views, 0 Favorites, 0 Comments
Build Your Own Mioty® Demo Kit Using Only Off-the-Shelf Components
mioty® is a robust, low-power wireless protocol designed for massive IoT deployments. While commercial development kits exist, it is entirely possible to build a fully functional mioty demo node yourself using standard components and an open hardware PCB.
In this Instructable, you will build a working mioty demo kit based on a Raspberry Pi Pico and a HopeRF RFM69 module. It is basically a breakout board for the Raspberry Pi Pico, where the Raspberry Pi can be removed, in case you need it for a different project as well.
In this demo, we will order the PCB, solder the components, and upload a simple demo firmware that sends data over mioty.
This project is suitable for makers with basic soldering experience and some familiarity with Arduino-style programming.
Supplies
Electronics
- Raspberry Pi Pico
- The normal version is completely fine for this project, you don't need the Pico 2 or the W version that would include WiFi. Also, go for the original version with the micro-USB port and not the copies with USB C, these might be different to integrate into the Arduino environment.
- Radio module: HopeRF RFM69CW or RFM69HCW (EU 868 MHz)
- Watch out for the "C" - this is the compact form factor. Modules without the "C" won't fit this PCB
- SMA connector and 868 MHz antenna
- 2x 20-pin headers
- Passive components (0805 format):
- R1: 100Ω (optional, but can be used to generate small current pulses for example to keep your power bank active if you're using this project together with a power bank)
- C1: 0.1 µF (decoupling)
- C2: 1 µF (decoupling)
- Optional: Buttons and Grove Connectors
PCB
- mioty Open Source demo kit PCB, we will order it as part of this demo: https://github.com/phaseshifted-iot/mioty-demokit
Tools
- Soldering iron with fine tip
- Solder wire
- Flux
- Tweezers
- Side cutters
- micro-USB cable for Raspberry Pi Pico
Software
- A computer with Visual Studio Code installed
Order the Breakout Board PCB
The PCB design files are provided as KiCad sources and ready-to-manufacture exports in the GitHub repository. Depending on your favorite PCB supplier, ordering an initial quantity of 5 pieces starts around 10$ including shipping.
- Open the repository:
- https://github.com/phaseshifted-iot/mioty-demokit
- Navigate to the /export folder.
- Download the Gerber files.
- Upload the Gerbers to your preferred PCB manufacturer.
- Use standard FR-4, 1.6 mm thickness, 2-layer board.
- No special impedance control or advanced options are required.
Once the PCB arrives, you are ready to assemble the hardware.
Soldering and Assembly
Start with the lowest profile components and work up to the connectors.
Recommended order:
- Resistors and capacitors:
- R1: Resistor 0805 100Ω (optional)
- C1: Decoupling capacitor 0805 0.1 µF
- C2: Decoupling capacitor 0805 1 µF
- (Optional components):
- Buttons: 5.2mm x 5.2mm (Button_Switch_SMD:SW_SPST_TL3342)
- Grove: Connector_JST:JST_PH_B4B-PH-K_1x04_P2.00mm_Vertical
- Header pins for the Raspberry Pi Pico
- RFM69 module
- SMA antenna connector. Alternatively, there is a connection foreseen for a coil antenna, but this will give you a worse RF performance.
Pay close attention to:
- Orientation of the RFM69 module: The ANT-pin should be closest to the antenna, that's an easy way to check the orientation.
- Proper ground connection for the SMA connector (also solder on the back side)
- Clean solder joints on SPI pins
Setup Visual Studio Code
Unfortunately, there is currently no implementation of a dedicated Arduino library for the TS-UNB implementation of the Pico. But it is quite straight forward to set up everything inside Visual Studio Code with the Raspberry Pi Pico extension.
Install Visual Studio Code
Download and install VS Code from:
Install the Raspberry Pi Pico SDK
Follow the official Raspberry Pi guide for your operating system:
https://datasheets.raspberrypi.com/pico/getting-started-with-pico.pdf
This installs:
- Pico SDK
- ARM GCC toolchain
- CMake
- Python tools
After installation, verify that the environment variable PICO_SDK_PATH is set.
Install VS Code Extensions
Open VS Code and install:
- C/C++ (Microsoft)
- CMake Tools (Microsoft)
- Raspberry Pi Pico Extension (very practical to configure and flash your pico)
Example Mioty Demo for Pico
Clone TS-UNB library
Create a working directory, for example mioty-projects.
Clone the TS-UNB library:
You now have the mioty stack available locally.
Navigate to the /examples folder and open the sendString.cpp example.
Definitions
mioty Network Key: Randomly generate this number for each device individually. This key will be used to encrypt the messages over the air.
MAC EUI64: This is a globally unique identifier that is different on every mioty device. Usually, a mioty hardware manufacturer would purchase an address range from IEEE, and then use these addresses for their devices. As makers, we can't do that. Therefore, a good trick is to use the EUI of a component that already is on our hardware. For example, the MAC address of the Pico.
Demo Code
This demo project will send a simple String over the mioty protocol. We will just compile this project and send it to the Pico to test if everything works properly. To send and receive mioty messages afterwards, you will also need a mioty Base Station, which can be covered in a different tutorial.
To flash this code to your Pico, it is easiest to do the following:
- In the Visual Studio Code / Raspberry Pi Quick Access console on the left, hit "Import Project"
- Select your TS-UNB-Lib-Pico > examples folder, leave other settings untouched
- Click "Import" - the extension will configure CMake automatically
- Build the project first:
- In the Raspberry Pi Pico extension panel, click "Compile Project" button
- Wait for the build to complete (you'll see "Build finished" in the terminal)
- Connect your Pico:
- Hold the BOOTSEL button on your Pico while plugging in the USB cable
- Release the button once connected
- Upload the code:
- In the Raspberry Pi Pico extension panel, click "Run Project (USB)"
- The Pico will automatically reboot and run your sendString program