Parallel and serial i2c

Use at your own risk.

Parallel and serial I2C

Download

Note : no warranty, no liability, project is provided 'as is' but I hope you will enjoy it !
Other:

Why ?

Access to I2C components from a very low cost interface, in pure python, over serial, parallel (maybe more in the future) interfaces, with a minimum hardware. This implementation is intended to be fast but simple and minimalist.

Features (0.3)

  • handle SDA and SCL pins
  • handle your own hardware interface simply adding your puthon driver in drivers directory,
  • auto-detect available interfaces (COM1, COM2, LPT1, etc...)
  • LM75/DS75 I2C sensors,
  • analyse SCL/SDA signals with pyScope :

    pyScope

Future features

  • add more I2C components,
  • add your own driver if you send it to me,

Example

>>> import I2C
>>> import I2C.sensors

>>> i2c = I2C.BusI2C('COM2')
>>> i2c.bus.setSpeed(2000)  # you can set i2c speed adapted to your hardware
>>> sonde = I2C.sensors.LM75('Room 1', i2c)
>>> print "T =  %02.03f C" % sonde.getTemperature()

Example minimal serial port I2C interface


This interface is really low speed and minimalist, it's based on specific optos. You can find better also better solutions : http://www.standardics.nxp.com/support/documents/i2c/pdf/optoisolation.pdf

$ wget wget http://www.standardics.nxp.com/support/documents/i2c/pdf/optoisolation.pdf

Example minimal parallel port I2C interface

It-s possible to select SDA input signal, python driver can be easily adapted to you choice.

Python packages required

  • pySerial if you plan to use I2C over serial port
  • pyParallel if you plan to use I2C over parallel port 

$ sudo apt-cache search pyparallel
python-parallel - pyparallel - module encapsulating access for the parallel port

$ sudo apt-cache search pyserial
python-serial - pyserial - module encapsulating access for the serial port
python3-serial - pyserial - module encapsulating access for the serial port

Win32 platform

pyParallel need you install and start giveio.sys driver

Linuxes

pyParallel on linux is based on ppdev module, make sure ppdev module is loaded and not lp. add change device access rights to make non root users or add users in right group (lp group on most systems). Use a non production computer for this as the parallel port may not print normally after making these adjustments. On most systems, ppdev is not the default parallel port handler, you must make sure module ppdev is loaded :
sudo modprobe ppde
sudo rmmod lp
sudo chmod go+rw /dev/parport0

Install from tarball

tar -xvzf pyI2C-0.3.tar.gz
cd pyI2C
python setup.py install

Comments

Popular posts from this blog

Guiless?

Web.com and Network Solutions, the Walmart of the internet.

MSOffice vs Libreoffice