In my previous post https://olimex.wordpress.com/2012/11/21/raspberry-pi-gpio-to-breadboard-and-uext-adapter/ I wrote about the Raspberry pi adapter we designed which allow Raspberry Pi to have access to the modules we have like Relay modules, Thermocouple sensor modules, 3-axis magnetometer and accelerometers, Zigbee, WiFi, GSM, GPS etc.
On this video you can see how Raspberry PI is controlling MOD-IO 4 relays with the help of the RPI-UEXT adapter: http://www.youtube.com/watch?v=vuHU2SmLYBI
to make MOD-IO control as on above video with your RPi you should do as follows:
sudo vi /etc/modprobe.d/raspi-blacklist.conf
The file should look like:
# blacklist spi and i2c by default (many users don’t need them)
sudo vi /etc/modules
# /etc/modules: kernel modules to load at boot time.
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with “#” are ignored.
# Parameters can be specified after the module name.
sudo apt-get install python-smbus
sudo vi modio.py
bus = smbus.SMBus(0)
address = 0x58
bus.write_byte_data(address, 0x10, 0x0F)
bus.write_byte_data(address, 0x10, 0x00)
sudo python modio.py
and you will see how the relays go ON and OFF🙂