Skip to main content

Tools for Karbon hardware interfaces.

Project description

For the full rundown, read the rest of the docs.

What is it?

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 a few other hardware devices.

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

The tools in this package are designed to work with specific hardware; this will not work for more generalized projects

How do I use it?

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

Getting started with pykarbon takes only a few minutes:

  • Open up a terminal, and run pip install pykarbon

    • On some systems you may need to run as admin, or use the --user flag

  • Launch a python shell with python

    • Usually linux users do not have write access to serial ports; grant your user permanent access with usermod -a -G dialout $USER or use sudo python

  • Import pykarbon with import pykarbon.pykarbon as pk

  • And finally create a control object using dev = pk.Karbon()

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:

  • dev.show_info()

And close our session:

  • dev.close()

What else can I 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 function calls based on these bus events:

    • CAN data IDs

    • Digital Input Events

    • DIO Bus States (Allows partial 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

Additonally, as Pykarbon’s CAN and Terminal sessions must connect to 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)

A Simple Example: Pykarbon.Core

import pykarbon.core as pkcore

# Set up interfaces:
can = pkcore.Can()
term = pkcore.Terminal()

# Claim the serial ports for use:
can.claim()
term.claim()

# Configure the can baudrate, and view that config
term.command('set can-baudrate 800')

print("\nRead User Configuration:")
term.print_command('config')

# Write a message, and then listen for and print responses
can.send(0x123, 0x11223344)

print("\nMonitoring CAN Bus, Press CTRL+C to Stop!")
can.sniff() # Will block until you exit with ctrl+c

# Close the ports!
can.release()
term.release()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pykarbon-1.1.8.tar.gz (24.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pykarbon-1.1.8-py3-none-any.whl (28.3 kB view details)

Uploaded Python 3

File details

Details for the file pykarbon-1.1.8.tar.gz.

File metadata

  • Download URL: pykarbon-1.1.8.tar.gz
  • Upload date:
  • Size: 24.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/44.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/2.7.17

File hashes

Hashes for pykarbon-1.1.8.tar.gz
Algorithm Hash digest
SHA256 e44fc8897bdc3cc317ce6cbeb9a7c6bbbcd3ad027cc36d777c38203269592676
MD5 8d541032a4beaafb7b9f6c3143ed3c84
BLAKE2b-256 1971f59917b97e965752847c44f4d09189247e435b8e02f1d86e186a6ea4aa4e

See more details on using hashes here.

File details

Details for the file pykarbon-1.1.8-py3-none-any.whl.

File metadata

  • Download URL: pykarbon-1.1.8-py3-none-any.whl
  • Upload date:
  • Size: 28.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/44.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/2.7.17

File hashes

Hashes for pykarbon-1.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 e9f93add01f3db9ff9710620d50b2ad822ebe0ed818f6d25293d4c23ccc83719
MD5 54c0bcafaefbd8b2be040bf18558ce36
BLAKE2b-256 6858ef0437a8f49c6043e5f7b8a865e173c4e487b2558116531e7c5a88c281f4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page