Difference between revisions of "Matrix - Compact Kit B"

From FriendlyELEC WiKi
Jump to: navigation, search
(Applications)
 
(28 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
[[Matrix - Compact Kit B/zh|查看中文]]
 
[[Matrix - Compact Kit B/zh|查看中文]]
  
==介绍==
+
==Introduction==
 
[[File:Matrix-Compact_Kit_B.png|thumb|]]
 
[[File:Matrix-Compact_Kit_B.png|thumb|]]
*Matrix - Compact_Kit_B是为Nanopi 2 Fire的接口开发的一款紧凑、简洁的多功能开发者套件,该套件由一系列常用电气元件经过精心构建而成,色彩斑斓,资源丰富,包括了按键、LED、无源蜂鸣器、ADC、指南针、温度传感器、红外接收器、TFT等14种资源。该套件可以直接通过40pin排母和NanoPi2 Fire连接。除了丰富的板上资源以外,您还可以通过扩展的IO口外接模块,基于本产品开发出功能丰富的应用。
+
* The Matrix Compact Kit B is a FriendlyARM developed compact board with various hardware resources, interfaces and ports. It contains user keys, LEDs, buzzer, ADC, compass, temperature sensor, IR receiver and TFT interface. It works with FriendlyARM's NanoPi 2 Fire and NanoPi M2 via its 40 pin male connector and is compatible with Raspberry Pi and Arduino boards. In addition you can connect various devices to its IO pin-header.
  
==资源==
+
==Features==
Matrix - Compact Kit B集成的元件如下:<br>
+
Matrix - Compact Kit B contains the following components:<br>
* 0.9 TFT LCD
+
* 0.9 TFT LCD          
  
* 轻触开关3个
+
* 3 x Switch         
  
* 5mm LED4个
+
* 4 x 5mm LED         
  
* 无源蜂鸣器
+
* Buzzer             
  
* ADC
+
* ADC              
  
* 滑动变阻器
+
* Potentiometer
  
* 40pin排母
+
* 40pin Female Connector         
  
* 4pin排针---I2C接口
+
* 4pin pin-header – I2C
  
* 4pin排针---UART接口
+
* 4pin pin-header – UART
  
* 3pin双排针---3.3V和GND
+
* 3pin double pin-header – 3.3V and GND
  
* 18B20温度传感器
+
* 18B20 Temperature Sensor
  
* 红外接收器
+
* IR Receiver
  
* 3pin排座10个---3个模拟IO,7个数字IO(其中两个可复用为PWM,四个复用为SPI 接口)
+
* 10 x 3pin pin-header – 3 x AIO & 7 x DIO (two can be configured to PWM and four can be configured to SPI)
  
* 指南针
+
* Compass
  
==特性==
+
==Dimensional Diagram and Pin Description==
* PCB尺寸(mm):64X40
+
* PCB Dimension(mm):64 x 40
 
[[File:Matrix-Compact_Kit_B_PCB.png|frameless|400px|]]
 
[[File:Matrix-Compact_Kit_B_PCB.png|frameless|400px|]]
* '''40pin排母GPIO管脚定义'''
+
* '''40 pin female connector's pin description'''
 
::{| class="wikitable"
 
::{| class="wikitable"
 
|-
 
|-
Line 83: Line 83:
 
|39  || DGND          ||40    || SPI2_CLK/GPIOC9
 
|39  || DGND          ||40    || SPI2_CLK/GPIOC9
 
|}
 
|}
* '''30pin排针管脚定义'''
+
* '''30 pin header's pin description'''
 
::{| class="wikitable"
 
::{| class="wikitable"
 
|-
 
|-
Line 110: Line 110:
 
|}
 
|}
  
[[File:18B20 and IRR.png |thumb|300px|18B20和红外接收接口布局]]
+
[[File:18B20 and IRR.png |thumb|300px|18B20 and IR Receiver's Layout]]
* '''18B20和红外接收管脚定义'''
+
* '''DS18B20 and IR receiver's pin description'''
 
::{| class="wikitable"
 
::{| class="wikitable"
 
|-
 
|-
|模块       ||Pin#  || Name        ||Pin#  || Name          ||Pin#  || Name       
+
|Module       ||Pin#  || Name        ||Pin#  || Name          ||Pin#  || Name       
 
|-
 
|-
 
|18B20      ||1    || VDD_5V      ||2    || DATA          ||3    || GND
 
|18B20      ||1    || VDD_5V      ||2    || DATA          ||3    || GND
 
|-
 
|-
|红外接收管 ||1    || DATA        ||2    || GND          ||3    || VDD_5V
+
|IR Receiver ||1    || DATA        ||2    || GND          ||3    || VDD_5V
 
|-  
 
|-  
 
|}
 
|}
  
==下载Matrix源码==
 
Matrix配件相关的代码是完全开源的,统一由一个仓库进行管理:https://github.com/friendlyarm/matrix.git <br>
 
该仓库里不同的分支代表着Matrix配件所支持的不同开发板。<br>
 
* nanopi分支用于支持NanoPi;
 
* nanopi2分支用于支持NanoPi 2;
 
* tiny4412分支用于支持Tiny4412;
 
* raspberrypi分支用于支持RaspberryPi;
 
  
在主机PC上安装git,以Ubuntu14.04为例
+
==Applications==
 +
===Connect to NanoPi M1===
 +
Refer to the following connection diagram to connect the module to the NanoPi M1:<br>
 +
[[File:Matrix-Compact_Kit_B_nanopi_m1.jpg|frameless|600px|Matrix-Compact_Kit_B_nanopi_m1]]
 +
 
 +
===Connect to NanoPi M2 / NanoPi 2 Fire===
 +
Refer to the following connection diagram to connect the module to the NanoPi M2/ NanoPi 2 Fire:<br>
 +
[[File:Matrix-Compact_Kit_B_nanopi_m2.jpg|frameless|600px|Matrix-Compact_Kit_B_nanopi_m2]]
 +
 
 +
==Compile & Run Test Program==
 +
Boot your ARM board with Debian and copy the matrix code:
 +
<syntaxhighlight lang="bash">
 +
$ apt-get update && apt-get install git
 +
$ git clone https://github.com/friendlyarm/matrix.git
 +
</syntaxhighlight>
 +
If your cloning is done successfully a "matrix" directory will be generated.
 +
 
 +
Compile and install Matrix:
 +
<syntaxhighlight lang="bash">
 +
$ cd matrix
 +
$ make && make install
 +
</syntaxhighlight>
 +
 
 +
Run test program:
 +
<syntaxhighlight lang="bash">
 +
$ matrix-compact_kit
 +
</syntaxhighlight>
 +
Note: this module is not plug and play therefore before running the module please make sure it is connected to an ARM board.<br>
 +
Here is what you should observe:<br>
 +
<syntaxhighlight lang="bash">
 +
LED blinking 1
 +
LED blinking 2
 +
Button:  1 1 1
 +
The channel0 value is 2070
 +
The angle is 336.3
 +
Pwm start
 +
Pwm stop
 +
</syntaxhighlight>
 +
 
 +
Run Qt program to test the TFT LCD:
 +
<syntaxhighlight lang="bash">
 +
cd matrix/demo/nanopi-status
 +
./build.sh
 +
./run.sh /dev/fb-st7735s
 +
</syntaxhighlight>
 +
The program will present the system's basic information. Here is what you expect to observe:<br>
 +
[[File:st7735s-status.pnc|frameless|600px|st7735s-status]]
 +
 
 +
==Code Sample==
 +
This Matrix code sample can work with all the ARM boards mentioned in this module's wiki. The name of this code sample is "matrix-compact_kit". Here is its source code:
 +
<syntaxhighlight lang="c">
 +
int main(int argc, char ** argv)
 +
{
 +
    int board;
 +
   
 +
    if ((board = boardInit()) < 0) {
 +
        printf("Fail to init board\n");
 +
        return -1;
 +
    }
 +
    testLED(board);
 +
    readButton();
 +
    readADC();
 +
    readCompass();
 +
    testPWM(board);
 +
    // readTemp();
 +
    // testIR();
 +
   
 +
    return 0;
 +
}
 +
</syntaxhighlight>
 +
For more details about this APIs called in this code sample refer to [[Matrix API reference manual]] <br>
 +
 
 +
<!---
 +
==Download Matrix Source Code==
 +
All the matrix modules' code samples are open source. They are maintained on GitHub: https://github.com/friendlyarm/matrix.git <br>
 +
Each branch in this hub contains the matrix modules' code samples for a board that the matrix modules can work with.<br>
 +
* The matrix-nanopi branch contains the matrix modules' code samples for the NanoPi;
 +
* The matrix-nanopi2 branch contains the matrix modules' code samples for the NanoPi 2;
 +
* The matrix-tiny4412 branch contains the matrix modules' code samples for the Tiny4412;
 +
* The matrix-raspberrypi branch contains the matrix modules' code samples for the RaspberryPi;
 +
 
 +
Follow the steps below to get the source code<br>
 +
Install the git utility on a PC running Ubuntu14.04
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
$ sudo apt-get install git
 
$ sudo apt-get install git
 
</syntaxhighlight>
 
</syntaxhighlight>
  
克隆Matrix配件代码仓库
+
Clone the matrix code from GitHub
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
$ git clone https://github.com/friendlyarm/matrix.git
 
$ git clone https://github.com/friendlyarm/matrix.git
 
</syntaxhighlight>
 
</syntaxhighlight>
克隆完成后会得到一个名为matrix的目录,里面存放着所有Matrix配件的代码。
+
If this is successful a "matrix" directory will be generated, which will contain all the matrix modules' code samples.
  
==与NanoPi 2 Fire连接使用==
+
==Connect to NanoPi 2 Fire==
===硬件连接===
+
===Hardware Connection===
参考下图连接模块Matrix-Compact_Kit_B和NanoPi 2:<br>
+
Refer to the following connection diagram to connect the Matrix-Compact_Kit_B to the NanoPi 2 Fire<br>
 
[[File:Matrix-Compact_Kit_B_nanopi2.jpg|frameless|600px|Matrix-Compact_Kit_B_nanopi2]]
 
[[File:Matrix-Compact_Kit_B_nanopi2.jpg|frameless|600px|Matrix-Compact_Kit_B_nanopi2]]
  
===编译测试程序===
+
===Compile Test Program===
进入Matrix代码仓库,切换到nanopi2分支
+
Login to the matrix hub and enter the nanopi2 branch
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
$ cd matrix
 
$ cd matrix
Line 153: Line 228:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
编译Matrix配件代码
+
Compile the Matrix code
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
$ make CROSS_COMPILE=arm-linux- clean
 
$ make CROSS_COMPILE=arm-linux- clean
Line 159: Line 234:
 
$ make CROSS_COMPILE=arm-linux- install
 
$ make CROSS_COMPILE=arm-linux- install
 
</syntaxhighlight>
 
</syntaxhighlight>
注意:请确保你的主机PC当前使用的交叉编译器为NanoPi 2配套的arm-linux-gcc-4.9.3。<br>
+
Note: make sure to install the cross compiler "arm-linux-gcc-4.9.3" on your PC, which is used to compile files for the NanoPi 2.<br>
编译成功后库文件位于install/lib目录下,测试程序位于install/usr/bin目录下,硬件驱动模块位于modules目录。<br>
+
Generated library files are under the "install/lib" directory. The test program is under the "install/usr/bin" directory.<br>
硬件驱动模块位于modules目录下,对应的驱动源码都包含在在NanoPi 2的Linux内核仓库里:https://github.com/friendlyarm/linux-3.4.y.git <br>
+
The modules are under the "modules" directory. The driver's source code is in github: https://github.com/friendlyarm/linux-3.4.y.git <br>
  
===拷贝测试程序===
+
===Copy Test Program===
将带有Debian系统的SD卡插入一台运行Linux的电脑,可以挂载SD卡上的boot和rootfs分区。<br>
+
Insert a TF card which is flashed with Debian into a Linux host and mount its boot and rootfs sections.<br>
假设rootfs分区的挂载路径为/media/rootfs,执行以下命令将Matrix的硬件驱动、库文件和测试程序拷贝到NanoPi 2的文件系统上。<br>
+
We assume the rootfs is mounted to /media/rootfs then run the following commands to copy the module, library and test program to the card.<br>
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
$ cp modules /media/rootfs/ -r
 
$ cp modules /media/rootfs/ -r
Line 172: Line 247:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
===测试LCD显示===
+
===Test LCD===
将SD卡重新插入NanoPi 2,上电启动,在Debian的shell终端中执行以下命令。<br>
+
Insert this TF card to your NanoPi 2 Fire, power on and run the following commands.<br>
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
$ cd /modules
 
$ cd /modules
Line 179: Line 254:
 
$ sudo FRAMEBUFFER=/dev/fb-st7735s startx &
 
$ sudo FRAMEBUFFER=/dev/fb-st7735s startx &
 
</syntaxhighlight>
 
</syntaxhighlight>
fbtft_device是LCD驱动,成功加载驱动后,可以看到LCD被清屏。<br>
+
"fbtft_device" is the LCD's driver.After it is loaded the LCD will be initialized.<br>
startx命令会将1寸屏作为桌面显示设备,运行效果如下:<br>
+
"startx" sets the LCD to the output device. Here is what you should expect:<br>
 
[[File:03.jpg|frameless|600px|03]]
 
[[File:03.jpg|frameless|600px|03]]
  
===测试蜂鸣器===
+
===Test Buzzer===
将蜂鸣器的跳线接到ON,执行以下命令控制蜂鸣器:<br>
+
Jump the buzzer to "ON" and run the following commands:<br>
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
$ cd /modules
 
$ cd /modules
Line 190: Line 265:
 
$ matrix-buzzer
 
$ matrix-buzzer
 
</syntaxhighlight>
 
</syntaxhighlight>
运行效果如下:<br>
+
Here is what you expect to observe:<br>
 
[[File:matrix-buzzer_result.png|frameless|600px|matrix-buzzer_result]] <br>
 
[[File:matrix-buzzer_result.png|frameless|600px|matrix-buzzer_result]] <br>
可以听到蜂鸣器在响,默认输出的PWM频率为1KHz,占用比为50%
+
You will hear the buzzer beeping and the PWM's default frequency is 1KHz and the duty cycle is 50%.
  
===控制LED===
+
===Access LED===
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
|LED  || CPU GPIO        || Linux索引号 || 物理索引号
+
|LED  || CPU GPIO        || Linux ID(used in the Linux Kernel) || ID on the Compact Kit B board
 
|-  
 
|-  
|红色LED1 || GPIOB28    || 60          || 28
+
|Red LED1 || GPIOB28    || 60          || 28
 
|-  
 
|-  
|绿色LED2 || GPIOC7    || 71          || 31
+
|Green LED2 || GPIOC7    || 71          || 31
 
|-  
 
|-  
|蓝色LED3 || ALIVEGPIO3 || 163          || 37
+
|Blue LED3 || ALIVEGPIO3 || 163          || 37
 
|-  
 
|-  
|黄色LED4 || GPIOC11    || 75          || 35
+
|Yellow LED4 || GPIOC11    || 75          || 35
 
|}
 
|}
以LED1为例,执行以下命令控制LED:
+
Take LED1 as an example, run the following commands:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
$ cd /sys/class/gpio/
 
$ cd /sys/class/gpio/
Line 214: Line 289:
 
$ echo 1 > gpio60/value
 
$ echo 1 > gpio60/value
 
</syntaxhighlight>
 
</syntaxhighlight>
1表示点亮LED1,0表示熄灭LED1。
+
"1" turns on LED1 and "0" turns off LED1.
  
===读按键值===
+
===Read User Key Value===
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
|按键 || CPU GPIO  || Linux索引号 || 物理索引号
+
|User Key || CPU GPIO  || Linux ID(used in the Linux Kernel) || ID on the Compact Kit B board
 
|-  
 
|-  
 
|KEY1 || GPIOC10    || 74  || 36
 
|KEY1 || GPIOC10    || 74  || 36
Line 227: Line 302:
 
|KEY3 || GPIOC9      || 73  || 40
 
|KEY3 || GPIOC9      || 73  || 40
 
|}
 
|}
以KEY1为例,执行以下命令读取按键值:
+
Take KEY1 as an example run the following commands:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
$ cd /sys/class/gpio/
 
$ cd /sys/class/gpio/
Line 234: Line 309:
 
$ cat gpio74/value
 
$ cat gpio74/value
 
</syntaxhighlight>
 
</syntaxhighlight>
当KEY1按下时value=0,KEY1弹起时value=1。
+
When KEY1 is pressed "value" is 0 otherwise "value" is 1.
  
===测试AD转换===
+
===Test AD===
执行以下命令获得Channel0的AD转换值:
+
Run the following command to get Channel 0's value:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
$ cd /modules
 
$ cd /modules
Line 243: Line 318:
 
$ matrix-adc
 
$ matrix-adc
 
</syntaxhighlight>
 
</syntaxhighlight>
通过旋转可调电阻可以改变AD转换值,运行效果如下:<br>
+
When you turn the resistor the AD value will change. Here is what you should expect:<br>
 
[[File:matrix-cpt_kit_result2.png|frameless|600px|matrix-cpt_kit_result_ad]]
 
[[File:matrix-cpt_kit_result2.png|frameless|600px|matrix-cpt_kit_result_ad]]
  
===测试指南针===
+
===Test Compass===
执行以下命令获得当前方向:
+
Run the following command to activate the compass:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
$ matrix-compass
 
$ matrix-compass
 
</syntaxhighlight>
 
</syntaxhighlight>
通过改变开发板的朝向可以获得不同的方向值,运行效果如下:<br>
+
When you change the module's direction you will get a changing value. Here is what you should expect:<br>
 
[[File:matrix-cpt_kit_result3.png|frameless|600px|matrix-cpt_kit_result_cps]]
 
[[File:matrix-cpt_kit_result3.png|frameless|600px|matrix-cpt_kit_result_cps]]
  
===测试温度传感器===
+
===Test Temperature Sensor===
  
执行以下命令操作温度传感器:
+
Run the following commands to test the temperature sensor:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
$ cd /modules
 
$ cd /modules
Line 263: Line 338:
 
$ matrix-temp_sensor
 
$ matrix-temp_sensor
 
</syntaxhighlight>
 
</syntaxhighlight>
gpio=72表示使用引脚GPIOC8,72是该引脚在Linux里的索引号。<br>
+
gpio=72 means pin GPIOC8 is used. 72 is the index number used in the Linux kernel.<br>
运行效果如下:<br>
+
Here is what you should expect:<br>
 
[[File:matrix-temperature_sensor_result.png|frameless|600px|matrix-temperature_sensor_result]]
 
[[File:matrix-temperature_sensor_result.png|frameless|600px|matrix-temperature_sensor_result]]
  
===测试红外接收头===
+
===Test IR Receiver===
  
执行以下命令操作红外接收头:
+
Run the following commands to test the IR receiver:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
$ cd /modules
 
$ cd /modules
 
$ insmod matrix_ir_recv.ko gpio=92
 
$ insmod matrix_ir_recv.ko gpio=92
 
</syntaxhighlight>
 
</syntaxhighlight>
gpio=92表示使用引脚GPIOC28,92是该引脚在Linux里的索引号。<br>
+
gpio=92 means pin GPIOC28 is used. 92 is the index number used in the Linux kernel.<br>
成功加载驱动后,会在/dev/input/目录下生成一个event设备节点,这里假设生成的设备节点为event1。<br>
+
After the driver is successfully loaded a device node will be generated under /dev/input/. We assume it is event1 in our example.<br>
  
开源软件input-utils可以读取event设备的数据,它的使用方法如下:<br>
+
An open source utility "input-utils" can be used to read a device's data. Here is how to do it:<br>
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
$ apt-get install input-utils
 
$ apt-get install input-utils
 
$ input-events 1
 
$ input-events 1
 
</syntaxhighlight>
 
</syntaxhighlight>
1表示读设备节点event1。<br>
+
"1" stands for device node event1.<br>
  
用一个普通的遥控器往模块发送数据,可看到运行效果如下:<br>
+
If you send data to the IR receiver with a remote control you will be able to see this:<br>
 
[[File:matrix-ir_receiver_result.png|frameless|600px|matrix-ir_receiver_result]]
 
[[File:matrix-ir_receiver_result.png|frameless|600px|matrix-ir_receiver_result]]
  
===通过Python控制===
+
===Code Samples in Python===
  
==与NanoPi连接使用==
+
==Connect to NanoPi==
  
==与Tiny4412连接使用==
+
==Connect to Tiny4412==
  
==与RaspberryPi连接使用==
+
==Connect to Raspberry Pi==
  
==与Arduino连接使用==
+
==Connect to Arduino==
 
+
--->
==相关资料==
+
==Resources==
 
*[Schematic]([http://wiki.friendlyarm.com/wiki/images/9/90/SCHEMATIC1_martix_compact_B.pdf Matrix - Compact Kit B-Schematic.pdf])
 
*[Schematic]([http://wiki.friendlyarm.com/wiki/images/9/90/SCHEMATIC1_martix_compact_B.pdf Matrix - Compact Kit B-Schematic.pdf])
 +
*[0.9'LCD datasheet]([http://wiki.friendlyarm.com/wiki/images/3/3b/0.9inch_TFT_ST7735S.pdf Matrix - Compact Kit B-0.9'LCD datasheet.pdf])
 +
 +
==Update Log==
 +
===May-23-2016===
 +
* Released English version
 +
===June-19-2016===
 +
* Re-organized and simplified wiki

Latest revision as of 10:33, 19 June 2016

查看中文

1 Introduction

Matrix-Compact Kit B.png
  • The Matrix Compact Kit B is a FriendlyARM developed compact board with various hardware resources, interfaces and ports. It contains user keys, LEDs, buzzer, ADC, compass, temperature sensor, IR receiver and TFT interface. It works with FriendlyARM's NanoPi 2 Fire and NanoPi M2 via its 40 pin male connector and is compatible with Raspberry Pi and Arduino boards. In addition you can connect various devices to its IO pin-header.

2 Features

Matrix - Compact Kit B contains the following components:

  • 0.9 TFT LCD
  • 3 x Switch
  • 4 x 5mm LED
  • Buzzer
  • ADC
  • Potentiometer
  • 40pin Female Connector
  • 4pin pin-header – I2C
  • 4pin pin-header – UART
  • 3pin double pin-header – 3.3V and GND
  • 18B20 Temperature Sensor
  • IR Receiver
  • 10 x 3pin pin-header – 3 x AIO & 7 x DIO (two can be configured to PWM and four can be configured to SPI)
  • Compass

3 Dimensional Diagram and Pin Description

  • PCB Dimension(mm):64 x 40

Matrix-Compact Kit B PCB.png

  • 40 pin female connector's pin description
Pin# Name Pin# Name
1 SYS_3.3V 2 VDD_5V
3 I2C0_SDA 4 VDD_5V
5 I2C0_SCL 6 DGND
7 GPIOD8/PPM 8 UART3_TXD/GPIOD21
9 DGND 10 UART3_RXD/GPIOD17
11 UART4_TX/GPIOB29 12 GPIOD1/PWM0
13 GPIOB30 14 DGND
15 GPIOB31 16 GPIOC14/PWM2
17 SYS_3.3V 18 GPIOB27
19 SPI0_MOSI/GPIOC31 20 DGND
21 SPI0_MISO/GPIOD0 22 UART4_RX/GPIOB28
23 SPI0_CLK/GPIOC29 24 SPI0_CS/GPIOC30
25 DGND 26 GPIOB26
27 I2C1_SDA 28 I2C1_SCL
29 GPIOC8 30 DGND
31 GPIOC7 32 GPIOC28
33 GPIOC13/PWM1 34 DGND
35 SPI2_MISO/GPIOC11 36 SPI2_CS/GPIOC10
37 AliveGPIO3 38 SPI2_MOSI/GPIOC12
39 DGND 40 SPI2_CLK/GPIOC9
  • 30 pin header's pin description
Pin# Name Pin# Name Pin# Name
1 GND 2 VDD_5V 3 A1_PCF
4 GND 5 VDD_5V 6 A2_PCF
7 GND 8 VDD_5V 9 A3_PCF
10 GND 11 VDD_5V 12 D1_Pi11
13 GND 14 VDD_5V 15 D2_Pi33
16 GND 17 VDD_5V 18 D3_Pi16
19 GND 20 VDD_5V 21 D4_Pi19
22 GND 23 VDD_5V 24 D5_Pi21
25 GND 26 VDD_5V 27 D6_Pi23
28 GND 29 VDD_5V 30 D7_Pi24
18B20 and IR Receiver's Layout
  • DS18B20 and IR receiver's pin description
Module Pin# Name Pin# Name Pin# Name
18B20 1 VDD_5V 2 DATA 3 GND
IR Receiver 1 DATA 2 GND 3 VDD_5V


4 Applications

4.1 Connect to NanoPi M1

Refer to the following connection diagram to connect the module to the NanoPi M1:
Matrix-Compact_Kit_B_nanopi_m1

4.2 Connect to NanoPi M2 / NanoPi 2 Fire

Refer to the following connection diagram to connect the module to the NanoPi M2/ NanoPi 2 Fire:
Matrix-Compact_Kit_B_nanopi_m2

5 Compile & Run Test Program

Boot your ARM board with Debian and copy the matrix code:

$ apt-get update && apt-get install git
$ git clone https://github.com/friendlyarm/matrix.git

If your cloning is done successfully a "matrix" directory will be generated.

Compile and install Matrix:

$ cd matrix
$ make && make install

Run test program:

$ matrix-compact_kit

Note: this module is not plug and play therefore before running the module please make sure it is connected to an ARM board.
Here is what you should observe:

LED blinking 1
LED blinking 2
Button:  1 1 1
The channel0 value is 2070
The angle is 336.3
Pwm start
Pwm stop

Run Qt program to test the TFT LCD:

cd matrix/demo/nanopi-status
./build.sh
./run.sh /dev/fb-st7735s

The program will present the system's basic information. Here is what you expect to observe:
st7735s-status

6 Code Sample

This Matrix code sample can work with all the ARM boards mentioned in this module's wiki. The name of this code sample is "matrix-compact_kit". Here is its source code:

int main(int argc, char ** argv)
{
    int board;
 
    if ((board = boardInit()) < 0) {
        printf("Fail to init board\n");
        return -1;
    }
    testLED(board);
    readButton();
    readADC();
    readCompass();
    testPWM(board);
    // readTemp();
    // testIR();
 
    return 0;
}

For more details about this APIs called in this code sample refer to Matrix API reference manual

7 Resources

8 Update Log

8.1 May-23-2016

  • Released English version

8.2 June-19-2016

  • Re-organized and simplified wiki