GithubHelp home page GithubHelp logo

kmurphs / labview-client-for-micropython Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 967 KB

This is a client implemented in LabVIEW that interacts with an embedded device or constrained system that runs micropython, a stripped down version of Python. This Library can optionally be used with TestStand to perform tests against the target device / system

License: Apache License 2.0

LabVIEW 97.07% Python 2.93%
labview teststand micropython python embedded embedded-systems abstraction-layer microcontroller pyboard esp32 arduino iot

labview-client-for-micropython's Introduction

labview-client-for-micropython

This is a client implemented in LabVIEW that interacts with an embedded device or constrained system that runs micropython. Essentially, this target device runs Python code.

MicroPython - a lean and efficient Python implementation for microcontrollers and constrained systems

Introduction

This is a small library / client implemented in LabVIEW to interact with a target device running MicroPython.

MicroPython is a project, that aims to put an implementation of Python 3.x on microcontrollers and small embedded systems. You can find the official website at micropython.org.

Essentially, a library for micropython will use a serial port to interact with the target device running micropython. One requires nothing else than that. And, as such, a program like Putty can be used to open a serial communication session to the device and, pretty much, run python code / commands.

Putty running on a laptop - And a Python REPL running on the remote device over serial port - The interactive prompt gives you control over the device and all its peripherals. And you can run Python Commands. LabVIEW can do the same.

Putty running on a laptop - And a Python REPL running on the remote device over serial port - The interactive prompt gives you control over the device and all its peripherals. And you can run Python Commands

What this library makes easy is the integration in Test Systems. One such example is TestStand which is a popular Test Executive Software Suite and developed by National Instrument.

As a matter of fact, this library was initially created for this very purpose. It is made available to speed up development of similar Systems.

API

The Public API consists of 4 simple LabVIEW functions / SubVIs:

  • Initialize.vi: To Initialize the comport
  • Close.vi: To close the comport
  • SendCommand.vi: Will send a command to the device and wait for its response
  • UploadScript.vi: Will take in a python script and send it over the serial port to the target device. SendCommand.vi can then be used to invoke functions and variables defined within this script.

When integrating with a Test Executive like TestStand, these are the VIs that will be called.

Getting Started

To get started, one needs some hardware running micropython. MicroPython requires a minimum 128K of Flash, 8K of RAM so not all arduino boards will support it (Officially 256k of code space and 16k of RAM). However, the official github page lists a few boards that will run micropython.

The PyBoard (running on a STM32F405xxxx) is the official board, but, alternatively, one can use the popular ESP32 or the ESP8266 as well.

Once Micropython is installed on your hardware, you can test that everything is working by opening a Serial Communication Session using Putty on the comport used by your board.

The same operation can be reproduced using this library by calling Initialize.vi first, then SendCommand.vi and UploadScript.vi as necessary.

Design

As stated previously, the library is written for LabVIEW and can be used with TestStand. The following provides an overview of the of the LabVIEW VIs that make up the library:

  • Initialize.vi: To Initialize the comport

LabVIEW VI to Initialize the comport to the micropython device

  • Close.vi: To close the comport

LabVIEW VI to Closes the comport to the micropython device

  • SendCommand.vi: Will send a command to the device and wait for its response

LabVIEW VI to Send a python command over the comport to the micropython device

  • UploadScript.vi: Will take in a python script and send it over the serial port to the target device. SendCommand.vi can then be used to invoke functions and variables defined within this script.

LabVIEW VI to Send a python script over the comport to the micropython device

transmit and receive operations are handled by the VI TxRx.vi. It will send a message to the target device and, optionally, wait, collect and aggregate response packets until some (stopping) conditions are met.

LabVIEW VI to Send and Receive function / VI to and from the micropython device

Similarily, TestStand will use the same set of steps to interact with a target device calling Initialize.vi as a setup action and Close.vi as a cleanup action. UploadScript.vi and SendCommand.vi will then be used to interact with the target.

TestStand Sequence to use the micropython library / client and perform test against a target device, i.e. the micropython device

The Screen snippet taken from the sample TestStand Sequence File provided in the repository.

References

labview-client-for-micropython's People

Contributors

kmurphs avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.