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:
- Open up a terminal and run:
- Launch a python shell with:
- In the python shell, import pykarbon with:
- And finally create a control object using:
- 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:
- And close our session:
pip install pykarbon
import pykarbon.pykarbon as pk
dev = pk.Karbon()
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
- Firmware update
Additionally, 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)
After the initial setup, visit our Pykarbon Github page to begin using the Pykarbon module for your Karbon series rugged PC.