• Home
  • Raspberry Pi
  • Codesys eCockpit
  • Python
  • Docker
  • Embedded Programming
Brighter Side Tech
  • Home
  • Raspberry Pi
  • Codesys eCockpit
  • Python
  • Docker
  • Embedded Programming
No Result
View All Result
  • Home
  • Raspberry Pi
  • Codesys eCockpit
  • Python
  • Docker
  • Embedded Programming
No Result
View All Result
Brighter Side Tech
No Result
View All Result
Home Python

Raspberry Pi Ic2 Protocol with Sequent Microsystems Stackable Cards in Python

Mwesigwa Peter by Mwesigwa Peter
July 13, 2022
in Python, Raspberry Pi
0
Raspberry Pi Ic2 Protocol with Sequent Microsystems Stackable Cards in Python

Raspberry Pi Ic2 Protocol with Sequent Microsystems Stackable Cards in Python

0
SHARES
158
VIEWS
Share on FacebookShare on Twitter

The Raspberry Pi has the ability to read a maximum of 26 input signals through its GPIO pin header. Now consider a scenario when you want to read more than 26 signals. That will mean that you have to implement some sort of multiplexing or use extra hardware to do this. Thankfully Sequent Microsystems have the right solution for this.

Their Stackable cards give you the ability to read up to 16 inputs using just 2 pins of the i2c port, leaving you with all the rest of the 24 pins. These are optically isolated inputs capable of reading both DC and AC signals with a voltage range pf 3 to 24 volts. A step by step process for configuring both your Stackable cards (The 16 Universal Inputs 8-Layer Stackable Card and the Home Automation 8-Layer Stackable Card) and raspberry pi has been presented here below.

Enable i2c protocol

pi@raspberrypi:~ $ sudo raspi-config

Check if Ic2 is enabled

pi@raspberrypi:~ $ lsmod | grep i2c_
i2c_bcm2835            16384  0
i2c_dev                20480  0

Testing Hardware

sudo i2cdetect -l
i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- 23 -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- -- 

Set up ic2 to work in python

sudo apt-get install -y python-smbus
sudo apt-get install -y i2c-tools

Configure 16 Universal Inputs 8-Layer Stackable Card for Raspberry Pi

pi@raspberrypi:~ $ git clone https://github.com/SequentMicrosystems/16inputs-rpi.git
Cloning into '16inputs-rpi'...
remote: Enumerating objects: 87, done.
remote: Counting objects: 100% (87/87), done.
remote: Compressing objects: 100% (76/76), done.
remote: Total 87 (delta 36), reused 9 (delta 5), pack-reused 0
Unpacking objects: 100% (87/87), done.
pi@raspberrypi:~ $ cd /home/pi/16inputs-rpi
pi@raspberrypi:~/16inputs-rpi $ sudo make install
[Compile] src/16in.c
[Compile] src/comm.c
[Link]
[Install]
pi@raspberrypi:~/16inputs-rpi $ 16inputs -h
	-v		Display the 16inputs command version number
	-h		Display the list of command options or one command option details
	-warranty	Display the warranty
	-list:		List all 16inputs boards connected
			return the # of boards and stack level for every board
	rd:		Read inputs state

Installing and using the lib16in python library for the 16 Universal Inputs 8-Layer Stackable Card for Raspberry Pi

pi@raspberrypi:~/16inputs-rpi $ sudo apt-get update
pi@raspberrypi:~/16inputs-rpi $ sudo apt-get install build-essential python-pip python-dev python-smbus git
pi@raspberrypi:~/16inputs-rpi $ cd python/16inputs/
pi@raspberrypi:~/16inputs-rpi/python/16inputs $ sudo python3 setup.py install

Usage

import lib16in
print(lib16in.readCh(0,7))

Configure the Home Automation 8-Layer Stackable Card for Raspberry Pi

pi@raspberrypi:~ $ git clone https://github.com/SequentMicrosystems/ioplus-rpi.git
Cloning into 'ioplus-rpi'...
remote: Enumerating objects: 343, done.
remote: Counting objects: 100% (95/95), done.
remote: Compressing objects: 100% (89/89), done.
remote: Total 343 (delta 33), reused 18 (delta 4), pack-reused 248
Receiving objects: 100% (343/343), 812.86 KiB | 850.00 KiB/s, done.
Resolving deltas: 100% (146/146), done.
pi@raspberrypi:~ $ cd /home/pi/ioplus-rpi
pi@raspberrypi:~/ioplus-rpi $ sudo make install
[Compile] src/ioplus.c
[Compile] src/comm.c
[Compile] src/thread.c
[Compile] src/gpio.c
[Compile] src/opto.c
[Link]
[Install]
pi@raspberrypi:~/ioplus-rpi $ ioplus
Usage:		ioplus -v
	Usage:		ioplus -h    Display command options list
	Usage:		ioplus -h <param>   Display help for <param> command option
	Usage:		ioplus -warranty
	Usage:		ioplus -pinout
	Usage:		ioplus -list
	Usage:		ioplus <stack> board
	Usage:		ioplus <id> relwr <channel> <on/off>
	Usage:		ioplus <id> relwr <value>
	Usage:		ioplus <id> relrd <channel>
	Usage:		ioplus <id> relrd
	Usage:		ioplus <id> reltest
	Usage:		ioplus <id> gpiowr <channel> <on/off>
	Usage:		ioplus <id> gpiowr <value>
	Usage:		ioplus <id> gpiord <channel>
	Usage:		ioplus <id> gpiord
	Usage:		ioplus <id> gpiodirwr <channel> <out/in> 
	Usage:		ioplus <id> gpiodirwr <value>
	Usage:		ioplus <id> gpiodirrd <pin>
	Usage:		ioplus <id> gpiodirrd
	Usage:		ioplus <id> gpioedgewr <channel> <edges> 
	Usage:		ioplus <id> gpioedgerd <pin>
	Usage:		ioplus <id> gpiocntrd <channel>
	Usage:		ioplus <id> gpiocntrst <channel>
	Usage:		ioplus <id> optrd <channel>
	Usage:		ioplus <id> optrd
	Usage:		ioplus <id> optedgerd <pin>
	Usage:		ioplus <id> optedgewr <channel> <edges> 
	Usage:		ioplus <id> optcntrd <channel>
	Usage:		ioplus <id> optcntrst <channel>
	Usage:		ioplus <id> optencwr <channel> <0/1> 
	Usage:		ioplus <id> optencrd <pin>
	Usage:		ioplus <id> optcntencrd <channel>
	Usage:		ioplus <id> optcntencrst <channel>
	Usage:		ioplus <id> odrd <channel>
	Usage:		ioplus <id> odwr <channel> <value>
	Usage:		ioplus <id> dacrd <channel>
	Usage:		ioplus <id> dacwr <channel> <value>
	Usage:		ioplus <id> adcrd <channel>
	Usage:		ioplus <id> adccal <channel> <value>
	Usage:		ioplus <id> adccalrst <channel>
	Usage:		ioplus <id> daccal <channel> <value>
	Usage:		ioplus <id> daccalrst <channel>
	Usage:		ioplus <id> wdtr
	Usage:		ioplus <id> wdtpwr <val> 
	Usage:		ioplus <id> wdtprd 
	Usage:		ioplus <id> wdtipwr <val> 
	Usage:		ioplus <id> wdtiprd 
	Usage:		ioplus <id> wdtopwr <val> 
	Usage:		ioplus <id> wdtoprd 
	Usage:		ioplus <id> iotst
Where: <id> = Board level id = 0..7
Type ioplus -h <command> for more help

Installing and using the libioplus python library for the Home Automation 8-Layer Stackable Card for Raspberry Pi

pi@raspberrypi:~/16inputs-rpi $ sudo apt-get update
pi@raspberrypi:~/16inputs-rpi $ sudo apt-get install build-essential python-pip python-dev python-smbus git
pi@raspberrypi:~/16inputs-rpi $ cd python/ioplus/
pi@raspberrypi:~/16inputs-rpi/python/16inputs $ sudo python3 setup.py install

Usage

import library and read voltage level at board stack number 6, channel 1

import libioplus
print(libioplus.getAdcV(6, 1))
Previous Post

Running Flask Apps in Google Colab

Next Post

OPC UA Client In Python

Mwesigwa Peter

Mwesigwa Peter

Related Posts

Configure Raspberry Pi Serial ports as COM ports for Codesys Runtime
Automation

Configure Raspberry Pi Serial ports as COM ports for Codesys Runtime

Introduction Codesys Runtime for Linux ARM SL allows you to program your Raspberry Pi according t the IEC 61131-6 standard...

by Mwesigwa Peter
October 7, 2024
Modbus TCP Master Simulator
Automation

Modbus TCP Master Simulator Tool – Free Download

The Modbus TCP Master Simulator Tool has been implemented in using QT for python and can be used to Simulate...

by Mwesigwa Peter
October 14, 2023
Next Post
OPC UA Client In Python

OPC UA Client In Python

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Parsing JSON Data in Codesys
Automation

Parsing JSON Data in Codesys

by Mwesigwa Peter
January 25, 2025
0

Parsing JSON Data in Codesys is quite an important operation especially when exchanging data over the REST API. The data...

Read moreDetails
Configure Raspberry Pi Serial ports as COM ports for Codesys Runtime

Configure Raspberry Pi Serial ports as COM ports for Codesys Runtime

October 7, 2024
ARM error: no member named ‘IP’ in ‘NVIC_Type’ Solved

ARM error: no member named ‘IP’ in ‘NVIC_Type’ Solved

July 18, 2024
TCP Socket Client Implementation in Codesys

TCP Socket Client Implementation in Codesys

January 11, 2024
Modbus TCP Master Simulator

Modbus TCP Master Simulator Tool – Free Download

October 14, 2023
Parsing JSON Data in Codesys

Parsing JSON Data in Codesys

by Mwesigwa Peter
January 25, 2025
0

Parsing JSON Data in Codesys is quite an important operation especially when exchanging data over the REST API. The data...

Configure Raspberry Pi Serial ports as COM ports for Codesys Runtime

Configure Raspberry Pi Serial ports as COM ports for Codesys Runtime

by Mwesigwa Peter
October 7, 2024
0

Introduction Codesys Runtime for Linux ARM SL allows you to program your Raspberry Pi according t the IEC 61131-6 standard...

ARM error: no member named ‘IP’ in ‘NVIC_Type’ Solved

ARM error: no member named ‘IP’ in ‘NVIC_Type’ Solved

by Mwesigwa Peter
July 18, 2024
0

This is how to solve the error: no member named 'IP' in 'NVIC_Type' Open the misc.c file : AppData\Local\Arm\Packs\Keil\STM32F1xx_DFP\2.4.1\Device\StdPeriph_Driver\src\misc.c, if you are...

TCP Socket Client Implementation in Codesys

TCP Socket Client Implementation in Codesys

by Mwesigwa Peter
January 11, 2024
0

This is a TCP socket client implementation in codesys to run on your PLC and connect to any TCP Socket...

About Brighterside Tech

Brighter Side Tech

As a hobbyist Engineer and Programmer , i love to share my learnings and solutions to technical challenges that i face during work and studying. My website gives me the ability to express my ideas and such solutions to the wider audience

Contact: admin@brightersidetech.com

Browse by Category

  • Automation
  • Codesys eCockpit
  • Docker
  • Embedded Programming
  • Python
  • Raspberry Pi
https://youtu.be/Lkrma5f60rs

Recent News

Parsing JSON Data in Codesys

Parsing JSON Data in Codesys

January 25, 2025
Configure Raspberry Pi Serial ports as COM ports for Codesys Runtime

Configure Raspberry Pi Serial ports as COM ports for Codesys Runtime

October 7, 2024
ARM error: no member named ‘IP’ in ‘NVIC_Type’ Solved

ARM error: no member named ‘IP’ in ‘NVIC_Type’ Solved

July 18, 2024
  • Home
  • Raspberry Pi
  • Codesys eCockpit
  • Python
  • Docker
  • Embedded Programming

© 2024 Brighterside Tech.

No Result
View All Result
  • Home
  • Raspberry Pi
  • Codesys eCockpit
  • Python
  • Docker
  • Embedded Programming

© 2024 Brighterside Tech.