Getting started with A13-OLinuXino blog post on element14



We spotted blog post on element14 about Getting started with A13-OLinuXino

pyA10Lime 0.1.0. Python library for GPIO access


We just uploaded pyA10Lime

>>>import A10Lime as lime

# Initialize module

# Read configuration of GPIO
# or you can use

# You can address GPIO either by pin numeration or port name
# For example PG0 pin on GPIO-1 connector can be accessed with lime.PG0 or lime.PIN1_5

# Set configuration
>>>lime.setcfg(lime.PC3, lime.OUTPUT)
>>>lime.setcfg(lime.PC3, lime.INPUT)

# Set output level
>>>lime.output(lime.PC3, lime.HIGH)
>>>lime.output(lime.PC3, lime.LOW)

# Read input state

# Read detailed info about pin

New Product in stock: A10-OLinuXino-LIME-UEXT adapter


A10-OLinuXino-LIME-UEXT is adapter board with Male connector on 0.05″ which can connect to A10-OLinuXino-LIME GPIOs with  0.05″ step ribbon CABLE-40-40-10CM and allow LIME GPIOs to be used with BREADBOARD-1, or with A13-LCD43TS, A13-LCD7TS or A13-LCD10TS.

For the moment A20-LCD15.6 is not supported as LVDS signals got noisy when pass through A10-OLinuXino-LIME-UEXT but we are looking for solution.

UEXT signals can be used only when connected to GPIO1. On the other connectors UEXT signals will be not present.

New A20 Android 4.2.2 image now supports all A20-OLinuXino-MICRO hardware features


We received A20-SDK2.0 from Allwinner few weeks ago and were working to generate image for A20-OLinuXino but our aim was to add support to all hardware features the board offers. The process was pretty slow as the compilation is very heavy and even small change requires hours of waiting the image generation to complete.

Now we are ready, the only two features left unsupported are the SATA and second SD-MMC card on the bottom but we think that we should give it a break for a while or our heads will explode :)

Two images are uploaded on Wiki: one for 7″LCD and one for 10″LCD, the good news is that the Android 4.2.2 with SDK2.0 now support higher resolution as previous SDK for ICS 4.0.3 had hardcoded 800×600 max resolution which made 10″LCD and HDMI useless.

The image have:

  • LCD and HDMI support at same time
  • Touchscreen support
  • GPIO support – we prepare Android application demo code which show how you can access and use GPIOs under Android
  • I2C1 and I2C2 support – we prepare Android application demo code which show how you can access and use I2C under Android
  • 100Mbit Ethernet
  • USB-Ethernet AX88772
  • USB WiFi RTL8188
  • microSD
  • Audio Out, Audio In
  • USB-OTG device and host with Low/Full/High speed
  • USB HOST upper and bottom with Low/Full/High speed
  • UART6 and UART7 support on UEXT connectors  – we prepare Android application demo code which show how you can access and use UART6,7 under Android
  • Buttons

Python GPIOs module for A20-OLinuXino-MICRO


pyA20 GPIO module is uploaded yesterday to Pypi

The use is same as the Python modules for imx233, A10S, A13 OLinuXino:

#!/usr/bin/env python
import A20_GPIO as GPIO
#init module
#configure module
#read the current GPIO configuration
config = GPIO.getcfg(GPIO.PIN#)
#set GPIO high
#set GPIO low
#read input
state = GPIO.input(GPIO.PIN#)

this is initial release so if you find some bugs please report back to us :)

A10S-OLinuXino ANDROID GPIO control LED toggle app


We got lot of requests on our forum how to control GPIOs from Android.

With the new A10S Android image we decided to play a bit and it appear to be not hard to implement.

We found two ways to do GPIO control running Android.

GPIO using ADB

1. Boot android (from nand or sdcard)

2. Connect USB-to-Serial cable on UART1

3. Open terminal at speed 115200

4. When loading is ready in the terminal type “sh” and enter

5. “ls /sys/class/gpio_sw” will give you a list of all accessable GPIOs.

The GPIOs name is according to the chip ports. For example PE3 is LED1.

6. To set PE3 as output:

#echo 1 > /sys/class/gpio_sw/PE3/mul_sel

or as input

#echo 0 > /sys/class/gpio_sw/PE3/mul_sel

7. To turn on LED:

#echo 1 > /sys/class/gpio_sw/PE3/data

and to turn off:

#echo 0 > /sys/class/gpio_sw/PE3/data

8. If GPIO is as input to read state:

#cat /sys/class/gpio_sw/PE3/data

GPIO using Android SDK

Basicly you should read and write to the filesys. Make sure that your app is running as root, or else nothing will happen.

The demo program toggle LED1 on every button press.  The sources are at GitHub:

All read/write methods are realized in file.

The application is with single button and each time you press it it toggles the green LED on the board.


You can see ToggleLED.apk running at this video:

A10S-OLinuXino-MICRO Python GPIO module


pyA10S GPIO ports module is available at:

iMX233-OLinuXino GPIO Python Libraries


Soon after we released A13-GPIO for Python we got requests to do same for iMX233.

iMX233_GPIO is released on PyPi now
it works identical to pyA13 you can use same commands:

import iMX233_GPIO as GPIO
#init module
#configure module
#set GPIO high
GPIO.output(GPIO.PIN#, 1)
#set GPIO low
GPIO.output(GPIO.PIN#, 0)
#read input
state = GPIO.input(GPIO.PIN#)

due to the GPIO multiplexing we add only these GPIOs in the base package:

PIN9, PIN10, PIN11, PIN12, PIN13, PIN14, PIN15, PIN16, PIN17, PIN18, PIN23, PIN24, PIN25, PIN26, PIN27, PIN28, PIN29, PIN31

you can use this as template, and if you for instance disable LCD in your linux image you can have access to all LCD pins too.

After you download the package from PyPi do as follows to install it:

#tar -zxvf iMX233_GPIO-0.1.0.tar.gz
#cd iMX233_GPIO-0.1.0.tar.gz
#sudo python install

after the installation you can use it this way:

#sudo python
>>> import iMX233_GPIO as GPIO
>>> GPIO.init() #init GPIOs
>>> GPIO.getcfg(GPIO.PIN31) #config PIN31 as GPIO
>>> GPIO.setcfg(GPIO.PIN31, GPIO.OUTPUT) #config PIN31 as output
>>> GPIO.output(GPIO.PIN31, GPIO.HIGH) #set PIN31 high
>>> GPIO.output(GPIO.PIN31, GPIO.LOW) #set PIN31 low
>>> GPIO.setcfg(GPIO.PIN31, GPIO.INPUT) #config PIN31 as input
>>> GPIO.input(GPIO.PIN31) #read PIN31

PINxx assignments is exactly as per imx233-OLinuXino-MAXI schematic

Maximum iMX233 GPIO toggle speed via Python is 15,6 kHz, which is kind of dissapointing, as /dev/mem C approach achieve about 5.7 6 Mhz, but Python is running slow on imx233 so this probably cause the slow GPIOs access.

On A13 is opposite /dev/mem is running slower at 1Mhz but pyA13 GPIO achieve up to 100 kHz as Python is running faster on A13.

Scratch + A13-OLinuXino-WIFI Physical Computing


Scratch is great visual environment very easy to understand by children.

I already blogged that Scratch is running fine on OLinuXino here

What bothered us though was that we can’t use all GPIOs and hardware resource which OLinuXino offers and Scratch basic installation can only play music and make cool animations.

So we start searching info how to implement this.

Soon we found SNAP which is based BYOB (Build your own Blocks) which is based on Scratch but adds ability to make your own blocks, recursion etc new features.

SNAP is implemented with JavaScript so even better it runs on your Browser without need of installation. Based on SNAP there are few cool projects made by Technoboy10 ( interfacing Wii Nunchuk , Arduino and NXT-Lego robots.

I asked Technoboy10 is there documentation how to connect Hardware to SNAP and soon he published this info in the Wiki:!-Extension which is very detailed.

So How cool is this? Kids are able to program robots with visual IDE!

Looking at Technoboy10 GitHub repository we figured out how to do this, but SNAP basic installation have no such great choice of sprites and animation examples, so I decided for the beginning to try to implement OLinuXino hardware features to SCratch.

So I posted question on Scratch forum and start to wait for reply . After few days waiting, 30+ views and none reply I did what I had to do at the beginning: searched github for “scratch c” then for “scratch python” and found what we needed:

This is cool python client for Scratch. When you enable remote sensors in Scratch it creates server, then with scratchpy you can pool for given variables and take their values or change them, this way you can connect sensors or actuators.

As opposite to SNAP (where SNAP i client and snap-server is made with pyton, so SNAP connects to the server) here Scratch makes server and the scratchpy client connects to it and interact through variables.

So here is our first “Hello World” blinking LED with Scratch:

Instruction how to install the OLinuXino GPIO interface to Scratch is on GitHub:

Our second project animate GPIO connector with Scratch based on real buttons inputs and LED outputs:


Here is video on the GPIO interaction with SCRATCH

Now when we have this powerful tool: scratchpy to interface Scratch to anything via python, just imagine what would happend if we connect Scratch to … OpenCV :)

From my previous blog I show you some videos which demonstrate the power of OpenCV: face recognition, face expression recognition, color objects tracking.  You can make SCRATCH script for instance which recognize the face of the person in the fron of the web cam and run some animation to welcome it by name.

Or you can program your robot to chase this yellow pong ball which is in the front of it.

Or you can make different animations depend on the face expression of the person in the front of the camera… the applications and the fun will be endless!

A13-OLinuXino GPIO Python libraries


Python is one of the most popular languages in the last years, it’s used by Google for their search engine and many other apps like game designs, databases etc.

Python combines the easy of use of the interpretive languages with powerful datastructures, so it replaces the old days BASIC but opens up lot of new possibilities.

If you want to learn more about Python you can read or the official Python language web site

The best of all are the Python libraries you can see thousands of these at

A13-OLinuXino as any Linux platform can run Python language, what we were missing was GPIO library which to allow Python users to have access to A13-OLinuXino GPIOs.

Now this library is done! You can download is from or from GitHub:

then install it:

#tar -zxvf pyA13-0.1.7.tar.gz
#cd pyA13-0.1.7.tar.gz
#sudo python install

after the installation you can use it this way:

#sudo python

>>> import A13_GPIO as GPIO
>>> GPIO.init()                           #init GPIOs
>>> GPIO.getcfg(GPIO.PIN37)               #config PIN37 as GPIO
>>> GPIO.setcfg(GPIO.PIN37, GPIO.OUTPUT)  #config PIN37 as output
>>> GPIO.output(GPIO.PIN37, GPIO.HIGH)    #set PIN37 high
>>> GPIO.output(GPIO.PIN37, GPIO.LOW)     #set PIN37 low
>>> GPIO.setcfg(GPIO.PIN37, GPIO.INPUT)   #config PIN37 as input
>>> GPIO.input(GPIO.PIN37)                #read PIN37

PINxx assignments is exactly as per A13-OLinuXino schematic

EDIT: Maximum GPIO toggle speed via Python is 101 kHz

Previous Older Entries


Get every new post delivered to your Inbox.

Join 514 other followers