element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Industrial Automation
  • Technologies
  • More
Industrial Automation
Blog Connect to AVNET iotconnect.io with Python IoTConnectSDK and BLE - part 3: Adding a Module (RSL10)
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Industrial Automation to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: Jan Cumps
  • Date Created: 10 May 2021 2:04 PM Date Created
  • Views 698 views
  • Likes 5 likes
  • Comments 0 comments
  • avnet
  • rsl10
  • smartedge
  • onsemiconductor
Related
Recommended

Connect to AVNET iotconnect.io with Python IoTConnectSDK and BLE - part 3: Adding a Module (RSL10)

Jan Cumps
Jan Cumps
10 May 2021

AVNET's iotconnect.io cloud platform is an online service that you can use to send data to, and then show it on a dashboard. In this blog series I'm learning the Python SDK and integrating BLE devices.

In this post: the SDK plug-in functionality to add the RSL10 sensor kit as a Bluetooth Low Energy node.

image

Like the previous blog, the technique in this post can be used on other devices supported by the SDK. When you use it outside the context of the Avnet portal, you can learn BLE integration from it too.

 

SDK Support for Plug-in modules

 

In the IoTConnect SDK, a plugin is a subdirectory with a specific naming pattern IoTPlugin*.

The SDK looks for subdirectories with that name, and tries to __import__() them.

As a natural effect, Python will execute a file called __init__.py if it is in that directory.

So it's partly custom code to find the plugins, then using standard Python constructs to let those register themselves in the SDK.

Additionally, this part of the example also searches for any file in the folder or subfolder called IoTConnectSDK.conf. If files exist, their config is imported before starting to import modules.

 

        if (int(my_config_parser_dict["CloudSystemControl"]["systemconfigured"]) == 0):
            # Setup factory defaults
        
            configs = cmdline("find . -name IoTConnectSDK.conf")
            myprint(configs)
            configs = configs.splitlines()
            for item in configs:
                config = configparser.ConfigParser()
                item = item[2:len(item)]
                myprint(item)
                if (item.find(str("Plugin").encode(encoding='UTF-8')) != -1):
                    config.read(mystr(item,'utf-8'))
                    print("Importing PluginCfg " + mystr(item,'utf-8'))
                    my_config_parser_plugin_dict = {s:dict(config.items(s)) for s in config.sections()}
                    my_config_parser_dict.update(my_config_parser_plugin_dict)

        plugins = cmdline("find . -name 'IoTPlugin*'")
        plugins = plugins.splitlines()
        for item in plugins:
            item = item[2:len(item)]
            print("Importing Plugin " + mystr(item,'utf-8'))
            m = __import__(mystr(item, 'utf-8'))
            m.__init__(m,globals())
            globals().update(m.__dict__)

 

At this point, submodules and configuration is known, and submodules had a chance to initialise themselves.

I've executed a few commands from the prompt to show what kind of info the Python script is getting from the OS:

 

image

 

The remainder of the code will check via REST calls if the template for the RSL10 application exists in iotcloud.io.

When all checks are ok, the device is enrolled.

 

The IoTPluginRssi that comes with the example is the only part of the code that speaks BLE.

As far as the SDK is concerned, the module can generate valid objects.

It's up to the module now to implement the physical interaction with the RSLE10.

I will review that in the next post.

 

If you wonder what the ON Semiconductor RSL10 kit is, check out these 2 recent road tests: RSL10 Sensor Development Kit and ON Semi RSL10-SENSE-DB-GEVK Sensor Board.

image

Here you can see it in action in an end-to-end sensor to cloud application, with the SmartEdge gateway collecting and uploading the sensor data.

For a detailed review of the cloud dashboard, check part 5: A Cloud User Experience Example.

image

 

 

The Python SDK with On Semiconductor RSL10 BLE article seriesIndustry
part 1: overview and goal
part 2: WiFi Provisioning
part 3: Adding a Module (RSL10)
part 4: Talk BLE to the On Semi RSL10 Sensor Kit
part 5: A Cloud User Experience Example
part 6: Register as a Gateway Device
part 7: Register a Gateway and Client Devices
The NODE-Red SDK article seriesIndustry
part 1: overview and goal
register a Thing and connect to IoTConnect.io cloud
part 2: create an account and log on to the portal
part 3: set up the thing and its interface in the cloud
part 4: set up Node-RED and first exchange
interact with IoTConnect.io cloud
part 5: online dashboard
part 6: rules and alerts
part 7: messages and commands from the cloud
safer connections with certificates
part 8a: safer connect with Self Signed Certificates
part 8b: safer connect with CA certificatesY
commercial and industrial scale: outsource certificate generation and programming to subcontractors and suppliers
part 9a: Outsource Certificate Signing in IIoT Supply ChainY
part 9b: IIoT supply chain and Certificates - Create Ca Root certificate, Load to IoTConnect Cloud and ValidateY
part 9c: IIoT supply chain and Certificates - Create an Intermediate CA Certificate for your SubcontractorY
part 9d: IIoT supply chain and Certificates - Subcontractor Generates a Thing Certificate for Your DeviceY
part 9e: IIoT supply chain and Certificates - Test!Y
commercial and industrial scale: Trusted Platform Module (TPM) Authentication
part 10: Trusted Platform Module (TPM) SecurityY
Infineon SLx9670 Trusted Platform Module (TPM) for IoT SecurityY
The Automate Device Provisioning and Cloud Configuration article seriesIndustry
Automatic Provisioning with REST APIY
  • Sign in to reply
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube