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
megaindpackage, not to be confused withSMmegaind.
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
Metadata
Release files for smmegaind 1.0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| smmegaind-1.0.7.tar.gz | 11.2 kB | Without provenance | Details for smmegaind-1.0.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| smmegaind-1.0.7-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for smmegaind-1.0.7-py2.py3-none-any.whl |
Total release size: 18.5 kB
Release files / smmegaind-1.0.7.tar.gz
| Download URL | smmegaind-1.0.7.tar.gz |
|---|---|
| Size | 11.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9351a3be7048d8858365a80a9155c0c8d194739b0622ddfa791681599897938c
|
|
BLAKE2b-256 checksum How to use checksums |
fa39cb5d52d7e6f1114bd2acb6f1fb2033adfc9af0ddd5e6d42a2a10bc6cf4c1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|
Release files / smmegaind-1.0.7-py2.py3-none-any.whl
| Download URL | smmegaind-1.0.7-py2.py3-none-any.whl |
|---|---|
| Size | 7.2 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
b57a4329bb74bfe767f00decc71ef6eee0eb2a22ecd9a6e97fc8e96a69f8aec9
|
|
BLAKE2b-256 checksum How to use checksums |
5046a07a827fa05df04917a4628253e1bf888f6746fd04ddba08bbd1c2ea91a6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|
Security for smmegaind 1.0.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.