Develop a SmartThings Find-compatible device
develop a smartthings find-compatible device objective learn how to create your own smartthings find-compatible device using the smartthings find partnership program device sdk learn how to measure the radio frequency rf performance of a bluetooth low energy ble device using tag toolbox partnership request the smartthings find partnership program is available only to registered partners who wish to commercialize you can only do this code lab and get the resources after a successful partnership to form a partnership, contact partners@smartthings com overview the smartthings find partnership program comprises smartthings find device specification, smartthings find device sdk, test tool, and technical support it facilitates the development of devices operating with smartthings find services and mobile applications the smartthings find device sdk is small enough to work on resource-limited microcontroller unit mcu devices in this code lab, you can learn how to develop your own smartthings find device first, you can know how to set up your project in smartthings using the developer workspace next, you can learn how to build your firmware with smartthings find device sdk lastly, you can know how to check the functionalities of your device's rf performance using the tag toolbox app set up your environment you will need the following host pc running on windows 11 visual studio code as the ide smartthings find device sdk code smartthings find tag toolbox smartthings app toolchain for nrf52833 dk use the ncs nrf connect sdk version 2 6 1 nrf52833 dk with buzzer module and nfc antenna galaxy smarttag2 register and deploy to test your device using the smartthings developer workspace, you can create a device profile, customize the instructions for onboarding the device on the smartthings app, and test the devices by deploying them you can edit the configurations until you submit the device for publication in the smartthings ecosystem sign in to smartthings developers go to smartthings developer workspace and sign in using your samsung account select a project and add a device profile select stfind codelab example and check its device profile under the device profile, specify whether the device operates on ble ble and uwb afterward, you can customize your device's onboarding experience in smartthings by uploading your product images, user instructions, and brand name under device onboarding lastly, you can fill in basic product information in the product info deploy your device to test after you complete all of these, you can go back to the overview tab and press deploy to test you can download the tagonboardingconfig h file which includes your project configuration the sdk code needs this configuration file register your devices you can add the identity of your device in the smartthings cloud for authentication this requires device information like serial number and device public key ed25519 when you reach the maximum number of test devices per user, remove the existing ones this example shows how to create an ed25519 key pair with sdk tools in visual studio code, press the tagkeygen button at the bottom afterward, you can generate the serial number, private key, and public key register it to the smartthings cloud using the smartthings developer workspace and include it in your firmware after checking the created information on visual studio code go to the developer workspace go to test > test devices menu, and click register new device input the generated serial number and public key build the firmware with the sdk open visual studio code and build the firmware for your device open the sdk project in the file explorer of visual studio code, you can find four code lab files here when you click the nrf connect icon, it shows important functions such as build, flash, and serial log check the configuration files ensure that two essential configuration files are applied tagonboardingconfig h tagdeviceinfo h write your code in main c, complete the code to call the taginit and tagstart apis of device sdk you can find code_mission in the source code and follow the instructions in the code by simply removing the comments #include <zephyr/zephyr h> #include <zephyr/sys/printk h> #include "tagsdk h" #include "mbedtls/aes h" static void init_aes_table void { mbedtls_aes_context dump_ctx; unsigned char dump_key[16]; mbedtls_aes_setkey_enc &dump_ctx, dump_key, 128 ; } void main void { int err = 0xff; tagresult_t result = tag_result_not_supported; /** * code_mission * you will check this serial log later in this codelab */ printk "tag demo! %s-%s-%s\n", config_board, __date__,__time__ ; init_aes_table ; /** * code_mission * call taginit api by removing comment // * * by calling this api, tag sdk will load nv, set rtc and * initialize crypto, and so on * you shall initialize bsp before call this api * services and starts ble advertising */ // result = taginit ; if result != tag_result_success { printk "failed to init %d\n", result ; return; } err = bt_enable 0 ; if err { printk "failed to init bt %d\n", err ; return; } /** * code_mission * call tagstart api by removing comment // * * by calling this api, tag sdk will initialize ble gatt * db and services and starts ble advertising * you shall initialize ble stack before call this api */ // result = tagstart ; if result != tag_result_success { printk "failed to start maintask %d\n", result ; return; } } in portnfc c, call the seturl function you can find code_mission in the source code and follow the instructions in the code by simply removing the comments tagerror_t portnfcseturl char *url, size_t urllen { tagerror_t ret = tag_error_none; ret = disablenfc ; if ret != tag_error_none { tag_log_e "failed to disable nfc" ; return ret; } /** * code_mission * remove comment // below to call seturl function */ // ret = seturl url, urllen ; if ret != tag_error_none { tag_log_e "failed to set url message" ; return ret; } ret = enablenfc ; if ret != tag_error_none { tag_log_e "failed to enable nfc" ; return ret; } return tag_error_none; } build go to nrf connect > actions click on build noteit may take some time for the build to finish you can see the progress by checking the popup at the bottom-right corner of the ide you can also select nrf connect build in the terminal to check the detailed status flash connect the nrf52833 dk to your computer go to nrf connect > actions click on flash once completed, you can hear a notification sound from your device check the serial log of your device go to nrf connect > connected devices click the plug icon on the right side of vcom0 comxx at the top of the ide, select the first item in the list under connected devices press the reset button briefly on your device by checking the timestamp from the serial log, you can verify whether your device successfully downloaded the firmware onboard and control your device via smartthings app onboard your device launch the smartthings app tap the + icon at the top right of the screen click on add device select add in the partner devices section select my testing devices then, select stfind codelab example to start onboarding allow the use of location information and press agree verify your device by pressing the button on the board in the success! page, tap on done to finish onboarding your device locate and ring your device tap on view map to show the location of your device select ring and your device produces a sound through its buzzer module you may switch to either high-volume or low-volume ringing press stop to stop the ringing configure the lost mode of your device when lost mode is activated, it allows you to view a lost message showing the owner's contact information and any personalized messages in the smartthings app, tap on view map > more > lost mode in the lost mode page, select next add email, contact, and message information then, tap on turn on test it by placing an nfc device or a mobile device at the nfc antenna of your device a lost message should show on your mobile device test the device's rf performance via tag toolbox smartthings find tag toolbox allows you to measure the rf performance of a ble device and log the results create a new test item launch the tag toolbox app on a mobile device tap on ble performance > add new test to create a new test item select a target device and a reference device to compare rf performance a target device this is your device created through this code lab b reference device this is the smarttag2 as a comparison target conduct rf performance tests press start session and check your device's rf performance once completed, tap on take a picture and capture how far away the mobile device is from both your device and the smarttag2 tap on test result to find out your device's rf performance export test result test reports can be exported as a file either during the test or after completing the test check your device's rf performance in the list of session menu a min rssi minimum value of your device's rf signal b max rssi maximum value of your device's rf signal c packet detection rate if the advertising transmission interval is two seconds, it indicates how many packets were detected during the test duration press export test result and it shows the location of the file on your mobile device you're done! congratulations! you have successfully achieved the goal of this code lab topic now, you can develop your own smartthings find-compatible devices to form a partnership, contact partners@smartthings com