1. Home
  2. OnLogic Systems
  3. Rugged Line
  4. Karbon Series
  5. Introducing The Pykarbon Module: Karbon K300 and K700 Series Interface Tool

Introducing The Pykarbon Module: Karbon K300 and K700 Series Interface Tool

Your Karbon series rugged PC comes with several hardware interfaces that can be modified and customized for your specific applications using OnLogic’s own microcontroller (MCU) and supporting Pykarbon Module.

What is the Pykarbon Module?

The Pykarbon module provides a set of tools for interfacing with the hardware devices on OnLogic’s ‘Karbon’ series industrial PCs. These interfaces include the onboard CAN bus, Digital IO, and other hardware devices.

The goal of the Pykarbon package is to provide a simple, powerful base platform that will allow users to quickly and easily integrate a Karbon into their own application.

The tools in the Pykarbon package are designed to work with the Karbon series rugged industrial computers; this will not work for more generalized systems.

Setting Up the Pykarbon Module

You will need to install Python 3 prior to following this guide.

To get started with Pykarbon, follow these steps:

  1. Open up a terminal and run:
  2. pip install pykarbon
  3. Launch a python shell with:
  4. python
  5. In the python shell, import pykarbon with:
  6. import pykarbon.pykarbon as pk
  7. And finally create a control object using:
  8. dev = pk.Karbon()
  9. If all went well, you should now be ready to control a variety of systems, but for now let’s just print out some configuration information:
  10. dev.show_info()
  11. And close our session:
  12. dev.close()

What can the Pykarbon Module do?

Pykarbon offers a number of tools for automating and using Karbon series hardware interfaces. These include:

  • CAN and DIO background data monitoring
  • Exporting logged data to .csv
  • Registering and making functions calls based on these bus events:
    • CAN data IDs
    • Digital Input Events
    • DIO Bus States
  • Automated CAN message response to registered IDs
  • Automated setting of Digital Output states
  • Automatic CAN baudrate detection
  • Updating user configuration information:
    • Ignition sense enable/disable
    • Power timing configurations
    • Low battery shutdown voltage
    • Etc.
  • Firmware update

Additionally, as Pykarbon’s CAN and Terminal sessions must connect to (virtual) device serial ports, functionality has been added to allow running these sessions using a context manager:

import pykarbon.pykarbon as pk
import pykarbon.can as pkc

with pk.Karbon() as dev:
    dev.show_info()

with pkc.Session() as dev:
    dev.write(0x123, 0x11223344)

After the initial setup, visit our Pykarbon Github page to begin using the Pykarbon module for your Karbon series rugged PC.

Updated on August 31, 2023

Was this article helpful?

Related Articles

Keep In Touch.
Subscribe today and we’ll send the latest product and content updates right to your inbox.
Subscribe