Skip to main content

Library to control Industrial Automation Card from Sequent Microsystems

Project description

SMmegaind

Official Python library for controlling the Industrial Automation Stackable Card for Raspberry Pi from Sequent Microsystems.

It supports Python 2.7, Python 3.7 and newer.

Installation

Install the package with:

sudo pip install SMmegaind

To upgrade to the latest version:

sudo pip install --upgrade SMmegaind

Quick Start

Read the 0–10V input from channel 1 on a Industrial Automation Card board with stack level 0:

~$ python
>>> import megaind
>>> megaind.get0_10In(0, 1)
0.003
>>>

NOTE: All functions are installed under the megaind package, not to be confused with SMmegaind.

Examples

More usage examples are available in the /tests folder.

All tests assume that one card with no address jumpers (stack level = 0) is present.

Documentation

Diagnose Functions

getFwVer(stack)

Return firmware version

stack - stack level of the megaind card (selectable from address jumpers [0..7])

getRaspVolt(stack)

Read raspberry voltage

stack - stack level of the megaind card (selectable from address jumpers [0..7])

return Raspberry PI voltage in volts

Analog input/output Functions

getPowerVolt(stack)

Read power source voltage

stack - stack level of the megaind card (selectable from address jumpers [0..7])

return voltage in volts

getCpuTemp(stack)

Get the cpu temperature

stack - stack level of the megaind card (selectable from address jumpers [0..7])

return - temperature in deg Celsius

get0_10In(stack, ch)

Return the selected input 0-10V channel value in volts. Make sure the selection jumper is not connectd in order for this measurement to be correct.

stack - stack level of the megaind card (selectable from address jumpers [0..7])

ch - selected channel number [1..4]

return - value in volts

getpm10In(stack, ch)

Return the selected input +/-10V channel value in volts. Make sure the selection jumper is connectd in order for this measurement to be correct.

stack - stack level of the megaind card (selectable from address jumpers [0..7])

ch - selected channel number [1..4]

return - value in volts

setUinRange(stack, channel, range)

Set the input range for one voltage input channel

stack - stack level of the megaind card (selectable from address jumpers [0..7])

channel - selected channel number [1..4]

range - select range 0= 0..10V; 1 = -10..10V

retrn none

getUinRange(stack, channel)

Get the input range for one voltage input channel

stack - stack level of the megaind card (selectable from address jumpers [0..7])

channel - selected channel number [1..4]

return 0 for 0..10V; 1 for -10..10V

get0_10Out(stack, ch)

Get the selected output 0-10V channel value in volts

stack - stack level of the megaind card (selectable from address jumpers [0..7])

ch - selected channel number [1..4]

return - value in volts [0..10]

set0_10Out(stack, ch, value)

Set the selected output 0-10V channel value in volts

stack - stack level of the megaind card (selectable from address jumpers [0..7])

ch - selected channel number [1..4]

value - voltage output value in V [0..10]

return - none

get4_20In(stack, ch)

Return the selected input 4 - 20mA channel value.

stack - stack level of the megaind card (selectable from address jumpers [0..7])

ch - selected channel number [1..4]

return - value in milliamps

get4_20Out(stack, ch)

Get the selected output 4 - 20mA channel value.

stack - stack level of the megaind card (selectable from address jumpers [0..7])

ch - selected channel number [1..4]

return - value in milliamps [4..20]

set4_20Out(stack, ch, value)

Set the selected output 4 - 20mA channel value.

stack - stack level of the megaind card (selectable from address jumpers [0..7])

ch - selected channel number [1..4]

value - current output value in milliamps [4..20]

return - none

Digital input/output Functions

getOptoCh(stack, ch)

Get the state of the optically isolated digital input channel

stack - stack level of the megaind card (selectable from address jumpers [0..7])

ch - selected channel number [1..4]

return - value of the inputs [0/1]

getOpto(stack)

Get the state of the all optically isolated digital inputs

stack - stack level of the megaind card (selectable from address jumpers [0..7])

return - value of the inputs [0..15]

getOptoCount(stack, ch)

Return the counter value for corresponding optically isolated input.

stack - stack level of the megaind card (selectable from address jumpers [0..7])

ch - selected channel number [1..4]

return - counter value [0..65535]

rstOptoCount(stack, ch)

Reset the counter value for corresponding optically isolated input.

stack - stack level of the megaind card (selectable from address jumpers [0..7])

ch - selected channel number [1..4]

return none

getOptoRisingCountEnable(stack, ch)

Get the rising edge enable counting for corresponding optically isolated input.

stack - stack level of the megaind card (selectable from address jumpers [0..7])

ch - selected channel number [1..4]

return 1 - rising edges will be counted; 0 - not

setOptoRisingCountEnable(stack, ch, state)

Set the rising edge enable counting for corresponding optically isolated input.

stack - stack level of the megaind card (selectable from address jumpers [0..7])

ch - selected channel number [1..4]

state - 1 = enable; 0 - disable

return none

getOptoFallingCountEnable(stack, ch)

Get the falling edge enable counting for corresponding optically isolated input.

stack - stack level of the megaind card (selectable from address jumpers [0..7])

ch - selected channel number [1..4]

return 1 - falling edges will be counted; 0 - not

setOptoFallingCountEnable(stack, ch, state)

Set the falling edge enable counting for corresponding optically isolated input.

stack - stack level of the megaind card (selectable from address jumpers [0..7])

ch - selected channel number [1..4]

state - 1 = enable; 0 - disable

return none

setOdPWM(stack, ch, value)

Set the filling factor for Open-Drain outputs

stack - stack level of the megaind card (selectable from address jumpers [0..7])

ch - selected channel number [1..4]

value - filling factor in precent [0..100]

return none

getOdPWM(stack, ch)

Read the filling factor for Open-Drain outputs

stack - stack level of the megaind card (selectable from address jumpers [0..7])

ch - selected channel number [1..4]

return - filling factor in precent [0..100]

setLed(stack, channel, val)

Set one of the 4 LED's on the card.

stack - stack level of the megaind card (selectable from address jumpers [0..7])

channel - selected LED number [1..4]

val - 0 = OFF, 1 = ON

setLedAll(stack, val)

Set all 4 LED's on the card.

stack - stack level of the megaind card (selectable from address jumpers [0..7])

val - bitmap of the 4 LED's [0..15]

getLed(stack, channel)

Get the state of one of the 4 LED's om the card.

stack - stack level of the megaind card (selectable from address jumpers [0..7])

channel - selected LED number [1..4]

return 0 if the LED is OFF, 1 if is ON

getOptoFrequency(stack, channel)

Get the frequency of the signal connected on one of the 4 optically isolated inputs.

channel - selected LED number [1..4]

return frequency expressed in Hz

Watcdog Timer Functions

wdtGetPeriod(stack)

Return the current period of the watchdog timer in seconds

stack - stack level of the megaind card (selectable from address jumpers [0..7])

wdtSetPeriod(stack, val)

Set the period of the watchdog in seconds, val = 65000 disable the watchdog

stack - stack level of the megaind card (selectable from address jumpers [0..7])

val - [10..65000]

wdtReload(stack)

Reload the watchdog timer with the current period. The next reload command must occur in no more the "period" time in order to prevent watchdog to re-power the Raspberry. This command also enables the watchdog if is disabled (power-up disabled).

stack - stack level of the megaind card (selectable from address jumpers [0..7])

wdtSetDefaultPeriod(stack, val)

This function updates the period that will be loaded after Raspberry power is turned off and back on. You must set this period long enough to let Raspberry boot-up and your "watchdog maintaining" script to start.

stack - stack level of the megaind card (selectable from address jumpers [0..7])

value - [10...64999] seconds

wdtGetDefaultPeriod(stack)

Return the default period

stack - stack level of the megaind card (selectable from address jumpers [0..7])

value - [10...64999] seconds

wdtSetOffInterval(stack, val)

Set the time interval in seconds for keeping Raspberry power off in case of watchdog timer expire.

stack - stack level of the megaind card (selectable from address jumpers [0..7])

val - [10...4147200] seconds

wdtGetOffInterval(stack)

Return the Off time interval in seconds

stack - stack level of the megaind card (selectable from address jumpers [0..7])

return - [10...4147200] seconds

wdtGetResetCount(stack)

Return the numbers of Raspberry re-powers performed by the watchdog

stack - stack level of the megaind card (selectable from address jumpers [0..7])

return - [0..65535]

RTC Functions

rtcGet(stack)

Return the RTC date and time as a list

stack - stack level of the megaind card (selectable from address jumpers [0..7])

return (year, month, day, hour, minute, seconds)

rtcSet(stack, y, mo, d, h, m, s)

Set the RTC date and time

stack - stack level of the megaind card (selectable from address jumpers [0..7])

y - year between 2000..2255 or between 0..255

mo - month 1..12

d - day

h - hour

m - minutes

s - seconds

Owire Bus Functions

owbScan(stack)

Start scanning for connected sensors

stack - stack level of the megaind card (selectable from address jumpers [0..7])

owbGetSensorNo(stack)

Get the numbers of 18B20 sensors connected on the bus

stack - stack level of the megaind card (selectable from address jumpers [0..7])

return number of connected sensors

owbGetTemp(stack, sensor)

Read the temperature aquired by one sensor

stack - stack level of the megaind card (selectable from address jumpers [0..7])

sensor - sensor number [1..16]

return temperature in degree Celsius

owbGetRomCode(stack, sensor)

Read the unic ROM code of one sensor

stack - stack level of the megaind card (selectable from address jumpers [0..7])

sensor - sensor number [1..16]

return ROM code as 8 bytes array

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

smmegaind-1.0.7.tar.gz (11.2 kB view details)

Uploaded Source

Built Distribution

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

smmegaind-1.0.7-py2.py3-none-any.whl (7.2 kB view details)

Uploaded Python 2Python 3

File details

Details for the file smmegaind-1.0.7.tar.gz.

File metadata

  • Download URL: smmegaind-1.0.7.tar.gz
  • Upload date:
  • Size: 11.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for smmegaind-1.0.7.tar.gz
Algorithm Hash digest
SHA256 9351a3be7048d8858365a80a9155c0c8d194739b0622ddfa791681599897938c
MD5 b0d6f4b412cb0b7f42972457e864b659
BLAKE2b-256 fa39cb5d52d7e6f1114bd2acb6f1fb2033adfc9af0ddd5e6d42a2a10bc6cf4c1

See more details on using hashes here.

File details

Details for the file smmegaind-1.0.7-py2.py3-none-any.whl.

File metadata

  • Download URL: smmegaind-1.0.7-py2.py3-none-any.whl
  • Upload date:
  • Size: 7.2 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for smmegaind-1.0.7-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 b57a4329bb74bfe767f00decc71ef6eee0eb2a22ecd9a6e97fc8e96a69f8aec9
MD5 e5363292eae06170bbfbf2ae5983d3be
BLAKE2b-256 5046a07a827fa05df04917a4628253e1bf888f6746fd04ddba08bbd1c2ea91a6

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