-
Notifications
You must be signed in to change notification settings - Fork 156
PlatformIO
Prerequisites: We need VSCode.
-
Go to VSCodeβs extension manager and search for the βPlatformIO IDEβ extension.
-
In terminal, navigate to your desired folder. (usually in Documents folder)
-
Clone the CDP repository:
git clone https://github.com/ClusterDuck-Protocol/ClusterDuck-Protocol.git
-
Navigate to the CDP repository:
cd ClusterDuck Protocol
-
Click on the PlatformIO icon on the sidebar.
-
Click on Pick a Folder and open
ClusterDuck-Protocol/examples/1.Ducks/MamaDuck
when prompted. -
In the
MamaDuck.ino
file, set your MamaDuck ID on line 33:std::string deviceId("MAMA0001");
Make sure the final ID is 8 characters long. You can use the default. Each device is required to have a unique identifier to operate properly in the network. -
In the
platformio.ini
file, select the environment from the list configurations to build your MamaDuck.- In my case, I'm using a
Heltec Wifi Lora 32 V2
, so I can select its environment as the default by commenting it out in this file.- Note that Iβm selecting the production environment because I want to use the released CDP instead of a local copy. If you clone the CDP repo, modify some files, and want to build one of the examples to reflect your changes, you should select the local environment instead.
- In my case, I'm using a
-
After setting your MamaDuck ID and board environment, click the upload icon on the taskbar.
-
If the upload was successful, click on the serial monitor icon on the taskbar and check that your MamaDuck was configured correctly. Once the setup is completed, you should see a
[MAMA]: Setup OK!
message in the serial monitor.
There are two PapaDuck examples listed in ClusterDuck-Protocol/examples/1.Ducks
: PapaDuck
and PapaDuck-Basic
.
The PapaDuck example forwards all messages (except pings) to the cloud, while the PapaDuck-Basic example doesnβt send to the cloud. Weβll be using the PapaDuck-Basic to communicate with our MamaDuck and output messages to the serial monitor in JSON format.
-
Disconnect your MamaDuck from the computer and get another development board.
-
On a new window (or by clicking Open in the PlatformIO extension on the same window βshown with an asterisk), open the ClusterDuck-Protocol/examples/1.Ducks/PapaDuck-Basic as a PlatformIO project.
-
In the
platformio.ini
file choose your board development. In my case, I used the TTGO T-Beam (with a SX127x LoRa module). -
Click the upload icon on the taskbar.
-
If the upload was successful, click on the serial monitor icon on the taskbar and check that your PapaDuck-Basic was configured correctly. Once the setup is completed, you should see a
[PAPA]: Setup OK!
message in the serial monitor.
-
With your PapaDuck-Basic still connected to your computer and its serial monitor open, plug your MamaDuck into any power source. Make sure both boards have their antennas attached.
-
Look in the serial monitor for any incoming messages from the MamaDuck. If messages start showing up, your network is working!
-
Install PlatformIO CLI
-
Clone the ClusterDuck Protocol repository
git clone https://github.com/ClusterDuck-Protocol/ClusterDuck-Protocol.git
-
Navigate to the example you want to upload. For this example, we will go to DuckLink.
cd ClusterDuckProtocol/examples/1.Ducks/DuckLink
-
Connect the your board.
-
Upload the firmware using the following command:
platformio run -e local_heltec_wifi_lora_32_V3 -t upload
The
-e
command selects the environment. The-t
targets the boardNOTE: These are the default boards that CDP supports. These boards start with
local_
andprod_
.local_
means you want to use your local CDP repository.prod_
means you are using the CDP repo from Github as is.prod_heltec_wifi_lora_32_V2 local_heltec_wifi_lora_32_V2 prod_heltec_wifi_lora_32_V3 local_heltec_wifi_lora_32_V3 prod_ttgo_lora32_v1 local_ttgo_lora32_v1 prod_lilygo_t_beam_sx1262 local_lilygo_t_beam_sx1262 release_cdp local_cdp esp32
-
Open the serial monitor to see the data flow through with this command:
platformio device monitor
-
You are done. The build and upload should be successful and you are ready to create your own CDP network!
ClusterDuck Protocol 2020-2024 https://www.clusterduckprotocol.org