SCRATCH control for MOD-IO

Image

Controlling Relays, Switching ON/OFF of 220V appliances and home automation is possible now with Scratch + MOD-IO.

1. Install python-smbus:

#apt-get install python-smbus
2. Install scratchpy

#git clone https://github.com/pilliq/scratchpy.git
#cd scratchpy
#make install

3. Run SCRATCH and open MOD-IO.sb

4. Go to ‘Sensing’. Right click ‘… sensor value’ hit: ‘Enable
remote sensor connections’ (if it not enabled).

5. Run terminal and start the python script
#python IO.py -a 0x58 -i 2 --host=xxx.xxx.xxx.xxx --port=xxxx --verbose
-i - I2C bus that you're using
-a - Address of MOD-IO (default 0x58)
--host - IP if you're connecting remote computer
--port - Port number
--verbose - Print some debug information.
For example:
#python IO.py -a 0x58 -i 2 --verbose --host=192.168.0.100 --port=40000

You should see message that the program is connected.

6. Run the Scratch block

7. Press ‘1’, ‘2’, ‘3’ or ‘4’ to toggle relays

the project is uploaded on GitHub: https://github.com/OLIMEX/OLINUXINO/tree/master/SOFTWARE/A13/A13%2BSCRATCH%2BMOD-IO

A13-OLinuXino project – control relays and read ADCs and IOs with Android

Image

Yesterday we got yet another amazing project by our friend Dimitar Gamishev.

He was playing with A13-OLinuXino-WIFI and decided to learn how to write Android applications, but he didn’t stop with “Hello world”

What he decided to try is to interface low level resources to his Android application like to implement I2C communication and control of MOD-IO connected to A13-OLinuXino UEXT connector.

The result is MODIO.apk which you can download from: https://github.com/OLIMEX/OLINUXINO/tree/master/SOFTWARE/A13/ANDROID-MOD-IO

You can see this application running in this video: http://www.youtube.com/watch?v=fBydZn8FylE

With it you can switch on/off relays on MOD-IO and read the Input status and ADC analog values (the trimmer potentiometer on the picture).

The sources are at GitHub: https://github.com/hehopmajieh/modio_android, what he did was to use Android NDK to implement the I2C communication in C then to export it and make it public for use by the Android SDK java applications. As you can see the result is Android APK which you can run and it communicates with MOD-IO connected to UEXT.

Using the same approach all GPIOs, SPIs, I2C and etc resources on A13-OLinuXino can be made available for native Android SDK applications and you can intereface real world hardware with pure Android application code.