BRT Sys AN-003 LDSBus Python SDK User Guide

June 13, 2024
BRT Sys

Application Note
BRTSYS_AN_003
LDSBus Python SDK on IDM2040 User
Guide
Version 1.2
Issue Date: 22-09-2023

AN-003 LDSBus Python SDK

This document provides information about how to setup and use the LDSBus Python SDK on IDM2040.
Use of BRTSys devices in life support and/or safety applications is entirely at the user’s risk, and the user agrees to defend, indemnify, and hold BRTSys harmless from any and all damages, claims, suits, or expense resulting from such use.

Introduction

This document describes how to use IDM2040 with LDSU circuity example including the Installation procedure for Thorny Python IDE and steps to execute LDSU circuitry examples.
The Python SDK will run on IDM2040 with appropriate LDSBus interface. IDM2040 has built-in LDSBus interface and can supply up to 24v to the LDSBus. More information on the IDM2040 is available at https://brtsys.com.

Credits

Open-Source Software

Getting Started with IDM2040

3.1 Hardware Overview

BRT Sys AN 003 LDSBus Python SDK - Hardware

3.2 Hardware Setup Instructions
Follow these steps to setup the IDM2040 Hardware Setup –
a. Remove the Jumper.BRT Sys AN 003 LDSBus Python SDK - Hardware
Setup

b. Connect the LDSU module to Quad T-Junction.BRT Sys AN 003 LDSBus Python
SDK - LDSU

c. Using RJ45 cable, connect Quad T-Junction to IDM2040 RJ45 connector. BRT
Sys AN 003 LDSBus Python SDK - cable

d. Connect the 20v supply adapter using a USB-C cable to the USB-C port on the IDM2040. BRT Sys AN 003 LDSBus Python SDK - Hardware
Setup1

e. Turn on the 20v adapter using the AC power supply.
f. Connect IDM2040 to PC using Type-C cable.![BRT Sys AN 003 LDSBus Python SDK

  • Hardware Setup2](https://manuals.plus/wp-content/uploads/2023/09/BRT-Sys- AN-003-LDSBus-Python-SDK-Hardware-Setup2.png)  g. Press the Boot button the IDM2040 board; Hold it for a few seconds and release it after resetting the board. Windows will open a drive named “RP1-RP2”.
    BRT Sys AN 003 LDSBus Python SDK - apph. In the given example package, there must be an “.uf2” file, copy the file and paste it into “RP1-RP2” drive.BRT Sys AN 003 LDSBus Python SDK -
app1i. Upon copying the “.uf2” file to “RPI-RP2”, the device will reboot automatically and again will appear as a new drive, such as “CIRCUITPY”.BRT Sys AN 003 LDSBus Python SDK - app2

The “code.py” is the main file which runs every time the IDM2040 is reset. Open this file and delete any content inside of it before saving.
j. The COM port for this device will appear in Device Manager. Here is an example screen showing the IDM2040’s COM Port as COM6.BRT Sys AN 003 LDSBus
Python SDK - app3

Thorny Python IDE – Installation/Setup Instructions

Follow these steps to install and setup Thorny Python IDE –
a. Download the Thorny Python IDE package from https://thonny.org/.
b. Click Windows to download the windows version.BRT Sys AN 003 LDSBus
Python SDK - app4

c. Upon downloading the application, complete the installation by clicking the executable file (.exe) and following the installation wizard. Upon completing the installation, open the Thorny Python IDE from the Windows Startup.
d. To open the Properties, click the left mouse button at the right bottom corner. Select “Circuit Python (generic)”. ![BRT Sys AN 003 LDSBus Python SDK

e. Click “ Configure Interpreter…”.

BRT Sys AN 003 LDSBus Python SDK - app6 f. Click on the Port drop down and select the port appeared for IDM2040 in device manager after connecting. In this example screenshot COM port appeared as COM6. Click [OK].BRT Sys AN 003 LDSBus Python SDK - app7

g. Thorny will report the device information at the interpreter prompt (“Ad fruit Circuit Python 7.0.0-dirty on 2021-11-11; Raspberry Pi Pico with rp2040”) if the device port is correct.BRT Sys AN 003 LDSBus Python SDK -
app8

Procedure to run LDSU Circuity Sample Example using Thorny

Follow these steps to run the LDSU circuity sample example –
a. Open the sample package file. As part of the sample package there is a folder by name “son” which contains various sensor son file. BRT Sys AN 003
LDSBus Python SDK - app9

b. Copy and paste the “json” folder to the “CIRCUITPY” storage device. BRT
Sys AN 003 LDSBus Python SDK - app10c. Open any given example using a text editor such as notepad ++ and copy it to the Thorny Editor and save it. For example, open “LDSBus_Thermocouple_Sensor.py” and copy/paste on Thorny Editor. Click [Save]. BRT Sys AN 003 LDSBus Python
SDK - app11

d. Upon clicking [Save], a “Where to save to?” dialog box will be displayed. Click and select Circuit Python device. BRT Sys AN 003 LDSBus Python SDK -
app12

e. Enter a file name and click [OK].
Note: When sample code is saved to “code.py” then every time it reboots, it will begin running “code.py”. To avoid this, specify a different name.BRT
Sys AN 003 LDSBus Python SDK - app13

f. The file will be saved to “CIRCUITPY” drive.BRT Sys AN 003 LDSBus Python
SDK - app14

g. To run the example from Thorny Editor, click (Run current script). BRT
Sys AN 003 LDSBus Python SDK - app15h. The Circuity LDSU example will run to scan the bus and start reporting the sensor data.BRT Sys AN 003 LDSBus Python SDK - app16

i. To stop the execution, click (Stop). Users can update the code as required or can copy/paste another example to try in the Thorny editor.
Note: Upon making any changes to the script file, remember to Save and Run the script. BRT Sys AN 003 LDSBus Python SDK -
app17

j. Remember to copy the following files – “irBlasterAppHelperFunctions” and “lir_input_file.txt” before trying the LDSBus_IR_Blaster.py example. BRT Sys
AN 003 LDSBus Python SDK - app18

Refer to BRTSYS_AN_002_LDSU IR Blaster Application for more details on “LDSBus_IR_Blaster.py” example.

Contact Information

Refer to https://brtsys.com/contact-us/ for contact information.
System and equipment manufacturers and designers are responsible to ensure that their systems, and any BRT Systems Pate Ltd (BRTSys) devices incorporated in their systems, meet all applicable safety, regulatory and system-level performance requirements. All application-related information in this document (including application descriptions, suggested BRTSys devices and other materials) is provided for reference only. While BRTSys has taken care to assure it  is accurate, this information is subject to customer confirmation, and BRTSys disclaims all liability for system designs and for any applications assistance provided by BRTSys. Use of BRTSys devices in life support and/or safety  applications is entirely at the user’s risk, and the user agrees to defend, indemnify, and hold harmless BRTSys from any and all damages, claims, suits, or expense resulting from such use. This document is subject to change without  notice. No freedom to use patents or other intellectual property rights is implied by the publication of this document. Neither the whole nor any part of the information contained in, or the product described in this document, may be  adapted, or reproduced in any material or electronic form without the prior written consent of the copyright holder. BRT Systems Pate Ltd, 1 Tai Seng Avenue, Tower A, #03-01, Singapore 536464. Singapore Registered Company Number: 202220043R
Appendix A – References
Document References

BRTSYS_API_001_LDSBus_Python_SDK_Guide
BRTSYS_AN_002_LDSU IR Blaster Application
Acronyms and Abbreviations

Terms Description
IDE Integrated Development Environment
LDSBus Long Distance Sensor Bus
USB Universal Serial Bus

Appendix B – List of Tables & Figures
List of Tables
NA
List of Figures
Figure 1 – IDM2040 Hardware Features ……………………………………………………………………… 5
Appendix C – Revision History
Document Title: BRTSYS_AN_003 LDSBus Python SDK on IDM2040 User Guide
Document Reference No.: BRTSYS_000016
Clearance No.: BRTSYS#019
Product Page: https://brtsys.com/ldsbus
Document Feedback: Send Feedback

Revision Changes Date
Version 1.0 Initial Release 29-11-2021
Version 1.1 Updated release under BRT Systems 15-09-2022
Version 1.2 Updated HVT references to Quad T-Junction;
Updated Singapore Address 22-09-2023

BRT Systems Pate Ltd (BRTSys)
1 Tai Seng Avenue, Tower A, #03-01, Singapore 536464
Tel: +65 6547 4827
Web Site: http://www.brtsys.com
Copyright © BRT Systems Pate Ltd
Application Note
BRTSYS_AN_003 LDSBus Python SDK on IDM2040 User Guide
Version 1.2
Document Reference No.: BRTSYS_000016
Clearance No.: BRTSYS#019

References

Read User Manual Online (PDF format)

Read User Manual Online (PDF format)  >>

Download This Manual (PDF format)

Download this manual  >>

Related Manuals