Difference between revisions of "BakeBit Starter Kit with NanoPi NEO/NEO2/NEO Air/zh"

From FriendlyELEC WiKi
Jump to: navigation, search
(使用方法)
(updated by API)
 
(46 intermediate revisions by 4 users not shown)
Line 1: Line 1:
==介绍BakeBit==
+
[[BakeBit Starter Kit with NanoPi NEO/NEO2/NEO Air|English]]
[[File:NeoHUB.png|thumb|frameless|300px|NeoHUB]]
+
BakeBit是一套传感器连接的解决方案,包括硬件(NEO-Hub扩展板)和软件(BakeBit)。<br />
+
BakeBit可以让众多传感器可以非常便捷灵活地连接到各个型号的NanoPi开发板上, 支持数字、模拟接口,支持I2C与串口连接,所有的传感器都使用固定的插座,从此远离那些乱糟糟的杜邦线与焊锡。
+
  
==产品特点==
+
==介绍BakeBit==
* 完美兼容NanoPi NEO, NanoPi Air
+
BakeBit是一套传感器连接的解决方案,包括硬件(NanoHat Hub扩展板)和软件(BakeBit)。<br />
* 即插即用
+
BakeBit可以让众多传感器可以非常便捷灵活地连接到各个型号的NanoPi开发板上, 即插即用,支持数字、模拟接口,支持I2C与串口连接,所有的传感器都使用统一规格的连接线,从此远离那些乱糟糟的杜邦线与焊锡。<br />
* 带3个I2C接口,3个模拟接口,2个UART接口,4个数字接口
+
::[[File:BakeBit2.png| frameless|400px|Bakebit]]
 
<br />
 
<br />
::[[File:Bakebit.png| frameless|400px|Bakebit]]
 
  
 
==如何在开发板上使用BakeBit==
 
==如何在开发板上使用BakeBit==
堆叠连接NEO-Hub扩展板到你的NanoPi NEO上
+
目前支持的开发板有NanoPi NEO, NanoPi Air,<br />
::[[File:NEOHubConnect.png| frameless|600px|NEOHubConnect]]
+
连接方法是简单地堆叠[http://wiki.friendlyelec.com/wiki/index.php/BakeBit_-_NanoHat_Hub]扩展板到你的NanoPi NEO上即可:
 +
::[[File:NEOHubConnect.jpg| frameless|600px|NEOHubConnect]]<br />
 +
 
 +
==支持BakeBit的开发板型号及固件列表==
 +
下表中列出了当前已支持BakeBit的开发板型号,以及对应的固件文件,固件文件位于下载链接的officail-ROMs目录,在安装BakeBit软件之前,请确否你所使用的系统固件是下表中列出的版本: <br />
 +
 
 +
::{| class="wikitable"
 +
|-
 +
  | 开发板型号
 +
  | 固件文件名
 +
  | 下载
 +
|-
 +
  | NanoPi NEO2
 +
  | nanopi-neo2_friendly-core-xenial_4.11.0_YYYYMMDD.img.zip
 +
  | [http://download.friendlyelec.com/NanoPiNEO2 下载地址]
 +
|-
 +
  | NanoPi NEO2
 +
  | nanopi-neo2_friendly-core-xenial_3.10.65_YYYYMMDD.img.zip
 +
  | [http://download.friendlyelec.com/NanoPiNEO2 下载地址]
 +
|-
 +
  | NanoPi NEO
 +
  | nanopi-neo_friendly-core-xenial_4.11.0_YYYYMMDD.img.zip
 +
  | [http://download.friendlyelec.com/NanoPiNEO 下载地址]
 +
|-
 +
  | NanoPi NEO
 +
  | nanopi-neo_friendly-core-xenial_3.4.39_YYYYMMDD.img.zip
 +
  | [http://download.friendlyelec.com/NanoPiNEO 下载地址]
 +
|-
 +
  | NanoPi NEO Air
 +
  | nanopi-neo-air_friendly-core-xenial_4.11.0_YYYYMMDD.img.zip
 +
  | [http://download.friendlyelec.com/NanoPiNEOAir 下载地址]
 +
|-
 +
  | NanoPi NEO Air
 +
  | nanopi-neo-air-ubuntu-core-qte-sd4g-YYYYMMDD.img.zip
 +
  | [http://download.friendlyelec.com/NanoPiNEOAir 下载地址]
 +
|}
 +
 
 +
==安装BakeBit软件==
 +
 
 +
* 第1步 - 通过ssh,或者串口终端进入开发板的命令行,从 github 上下载BakeBit代码:
 +
<syntaxhighlight lang="bash">
 +
cd  ~
 +
git clone https://github.com/friendlyarm/BakeBit.git
 +
</syntaxhighlight>
 +
 
 +
* 第2步 - 设置使用国内源:
 +
安装BakeBit需要在线下载并安装一系列的软件包,国内大陆的用户为了获得更快的安装速度,可以在安装之前先将软件包的源设置为国内源,执行以下命令,使用我们提供的脚本进行设置:<br />
 +
<syntaxhighlight lang="bash">
 +
wget http://112.124.9.243/aptsouce.sh
 +
chmod 755 aptsouce.sh
 +
sudo ./aptsouce.sh
 +
sudo apt-get update
 +
</syntaxhighlight>
 +
 
 +
* 第3步 - 使用如下命令在开发板上安装BakeBit:
 +
<syntaxhighlight lang="bash">
 +
cd BakeBit/Script
 +
chmod +x install.sh
 +
sudo ./install.sh
 +
</syntaxhighlight>
 +
 
 +
* 第4步 - 重启开发板:
 +
<syntaxhighlight lang="bash">
 +
reboot
 +
</syntaxhighlight>
 +
 
 +
==运行Python示例==
 +
以LED配件为例,将LED配件连接到NanoHat Hub上的D3插座,在命令行执行以下命令操作LED: <br />
 +
<syntaxhighlight lang="bash">
 +
python ~/BakeBit/Software/Python/bakebit_led_blink.py
 +
</syntaxhighlight>
 +
LED将会闪烁,更多的Python示例源代码,可进入~/BakeBit/Software/Python/目录查看。
 +
 
 +
==运行C语言示例==
 +
将LED配件连接到NanoHat Hub上的D4插座,执行以下命令编译并运行C语言的Demo: <br />
 +
<syntaxhighlight lang="bash">
 +
cd ~/BakeBit/Software/C/
 +
gcc bakebit_digital_write.c bakebit.c -Wall
 +
./a.out
 +
</syntaxhighlight>
 +
LED将会闪烁,更多的Python示例源代码,可进入~/BakeBit/Software/C/目录查看。
 +
 
 +
==BakeBit Starter Kit==
 +
 
 +
BakeBit Starter Kit是一个基础套件,包含了适用于NanoPi NEO的NanoHat Hub扩展板及12个传感器。<br />
 +
下表列出了该套件所包含的传感器:
 +
 
 +
::{| class="wikitable"
 +
|-
 +
|1    || '''BakeBit-Button'''<br />[[File:BakeBit - Button01.jpg |frameless|150px]]    || '''按钮开关模块'''<br />
 +
'''连接方式''': 连接到数字接口 D2~D5<br />
 +
'''示例源代码''': https://github.com/friendlyarm/BakeBit/blob/master/Software/Python/bakebit_button.py <br />
 +
'''WiKi网址''': http://wiki.friendlyelec.com/wiki/index.php/BakeBit_-_Button <br />
 +
|-
 +
|2  || '''BakeBit-Buzzer'''<br />[[File:BakeBit - Buzzer.jpg |frameless|150px]]    || '''蜂鸣器模块'''<br />
 +
'''连接方式''': 连接到数字接口 D3 或D5<br />
 +
'''示例源代码''': https://github.com/friendlyarm/BakeBit/blob/master/Software/Python/bakebit_buzzer.py<br />
 +
'''WiKi网址''': http://wiki.friendlyelec.com/wiki/index.php/BakeBit_-_Buzzer <br />
 +
|-
 +
|3    || '''BakeBit-Green LED'''<br />[[File:BakeBit_-_Green_LED.jpg |frameless|150px]]    || '''绿色的LED发光二极管模块,亮度可调节'''<br />
 +
'''连接方式''': 连接到数字接口 D2~D5<br />
 +
'''示例源代码''': https://github.com/friendlyarm/BakeBit/blob/master/Software/Python/bakebit_led_blink.py <br />
 +
'''WiKi网址''': http://wiki.friendlyelec.com/wiki/index.php/BakeBit_-_Green_LED <br />
 +
|-
 +
|4  || '''BakeBit-JoyStick'''<br />[[File:BakeBit_-_JoyStick.jpg |frameless|150px]]    || '''摇杆模块'''<br />
 +
'''连接方式''': 连接到模拟接口 A0~A2<br />
 +
'''示例源代码''': https://github.com/friendlyarm/BakeBit/blob/master/Software/Python/bakebit_prj_UIControl_via_Joystick.py <br />
 +
'''WiKi网址''': http://wiki.friendlyelec.com/wiki/index.php/BakeBit_-_JoyStick <br />
 +
|-
 +
|5  || '''BakeBit-LED Bar'''<br />[[File:BakeBit_-_LED_Bar.jpg |frameless|150px]]    || '''多彩LED模块,由五个多彩LED发光二极管组成'''<br />
 +
'''连接方式''': 连接到数字接口D3或D5<br />
 +
'''示例源代码''': https://github.com/friendlyarm/BakeBit/blob/master/Software/Python/bakebit_ledbar.py <br />
 +
'''WiKi网址''': http://wiki.friendlyelec.com/wiki/index.php/BakeBit_-_LED_Bar <br />
 +
|-
 +
|6  || '''BakeBit-Light Sensor'''<br />[[File:BakeBit - Light Sensor.jpg|frameless|120px]]    || '''光敏电阻模块'''<br />
 +
'''连接方式''': 连接到模拟接口A0~A2<br />
 +
'''示例源代码''': https://github.com/friendlyarm/BakeBit/blob/master/Software/Python/bakebit_light_sensor.py <br />
 +
'''WiKi网址''': http://wiki.friendlyelec.com/wiki/index.php/BakeBit_-_Light_Sensor <br />
 +
|-
 +
|7  || '''BakeBit-OLED 128X64'''<br />[[File:BakeBit_-_OLED.jpg |frameless|150px]]    || '''单色OLED屏幕 (0.96寸、128x64分辨率)'''<br />
 +
'''连接方式''': 连接到I2C接口<br />
 +
'''示例源代码''': https://github.com/friendlyarm/BakeBit/blob/master/Software/Python/bakebit_128_64_oled_test.py<br />
 +
'''WiKi网址''': http://wiki.friendlyelec.com/wiki/index.php/BakeBit_-_OLED_128x64 <br />
 +
|-
 +
|8  || '''BakeBit-Red LED'''<br />[[File:BakeBit_-_Red_LED.jpg |frameless|150px]]    || '''红色LED模块,亮度可调节'''<br />
 +
'''连接方式''': 连接到数字接口 D2~D5<br />
 +
'''示例源代码''': https://github.com/friendlyarm/BakeBit/blob/master/Software/Python/bakebit_led_blink.py <br />
 +
'''WiKi网址''': http://wiki.friendlyelec.com/wiki/index.php/BakeBit_-_Red_LED <br />
 +
|-
 +
|9  || '''BakeBit - Rotary Angle Sensor'''<br />[[File:BakeBit_-_Rotary_Angle_Senso.jpg |frameless|150px]]    || '''电位器'''<br />
 +
'''连接方式''': 连接到模拟接口 A0~A2<br />
 +
'''示例源代码''': https://github.com/friendlyarm/BakeBit/blob/master/Software/Python/bakebit_rotary_angle_sensor.py <br />
 +
'''WiKi网址''': http://wiki.friendlyelec.com/wiki/index.php/BakeBit_-_Rotary_Angle_Sensor <br />
 +
|-
 +
|10  || '''BakeBit - Servo'''<br />[[File:BakeBit - Servo.jpg|frameless|120px]]    || '''舵机模块'''<br />
 +
'''连接方式''': 连接到数字接口 D3或D5<br />
 +
'''示例源代码''': https://github.com/friendlyarm/BakeBit/blob/master/Software/Python/bakebit_servo.py<br />
 +
'''WiKi网址''': http://wiki.friendlyelec.com/wiki/index.php/BakeBit_-_Servo <br />
 +
|-
 +
|11    || '''BakeBit - Sound Sensor'''<br />[[File:BakeBit_-_Sound_Sensor.jpg |frameless|150px]]    || '''声音检测模块,用于检测声音信号'''<br />
 +
'''连接方式''': 连接到模拟接口A0~A2<br />
 +
'''示例源代码''': https://github.com/friendlyarm/BakeBit/blob/master/Software/Python/bakebit_sound_sensor.py<br />
 +
'''WiKi网址''': http://wiki.friendlyelec.com/wiki/index.php/BakeBit_-_Sound_Sensor <br />
 +
|-
 +
|12    || '''BakeBit - Ultrasonic'''<br />[[File:BakeBit_-_Ultrasonic.jpg |frameless|150px]]    || '''超声波模块,用来探测障碍物,并计算到障碍物距离'''<br />
 +
'''连接方式''': 连接到数字接口D2~D5<br />
 +
'''示例源代码''': https://github.com/friendlyarm/BakeBit/blob/master/Software/Python/bakebit_ultrasonic.py<br />
 +
'''WiKi网址''': http://wiki.friendlyelec.com/wiki/index.php/BakeBit_-_Ultrasonic_Ranger <br />
 +
|-
 +
|}
 +
 
 +
==其它相关资源==
 +
github项目网址: https://github.com/friendlyarm/BakeBit <br />
 +
PDF手册: http://wiki.friendlyelec.com/bakebit/bakebit_starter_kit_manual_cn.pdf <br />
 +
 
 +
==更新日志==
 +
===2017-05-27===
 +
修正C语言版本未能正常工作的问题
 +
 
 +
===2017-05-19===
 +
修正oled示例中的温度显示问题
  
==运行BakeBit示例==
+
===2017-04-28===
===示例项目:LED Blink===
+
增加对NEO2/NEO Plus2/M1 Plus的支持
lease note that all contributions to FriendlyARM WiKi may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.<br />
+
===示例项目:LED Fade===
+
lease note that all contributions to FriendlyARM WiKi may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.<br />
+
===示例项目:Button And Buzzer===
+
lease note that all contributions to FriendlyARM WiKi may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.<br />
+
===示例项目:Ultrasonic And Relay===
+
lease note that all contributions to FriendlyARM WiKi may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.<br />
+
  
==其它相关资料==
+
===2017-04-26===
test
+
* 用WiringNP代替WiringPi
 +
* 增加对NanoHat OLED配件的Python示例

Latest revision as of 07:17, 21 February 2022

English

1 介绍BakeBit

BakeBit是一套传感器连接的解决方案,包括硬件(NanoHat Hub扩展板)和软件(BakeBit)。
BakeBit可以让众多传感器可以非常便捷灵活地连接到各个型号的NanoPi开发板上, 即插即用,支持数字、模拟接口,支持I2C与串口连接,所有的传感器都使用统一规格的连接线,从此远离那些乱糟糟的杜邦线与焊锡。

Bakebit


2 如何在开发板上使用BakeBit

目前支持的开发板有NanoPi NEO, NanoPi Air,
连接方法是简单地堆叠[1]扩展板到你的NanoPi NEO上即可:

NEOHubConnect

3 支持BakeBit的开发板型号及固件列表

下表中列出了当前已支持BakeBit的开发板型号,以及对应的固件文件,固件文件位于下载链接的officail-ROMs目录,在安装BakeBit软件之前,请确否你所使用的系统固件是下表中列出的版本:

开发板型号 固件文件名 下载
NanoPi NEO2 nanopi-neo2_friendly-core-xenial_4.11.0_YYYYMMDD.img.zip 下载地址
NanoPi NEO2 nanopi-neo2_friendly-core-xenial_3.10.65_YYYYMMDD.img.zip 下载地址
NanoPi NEO nanopi-neo_friendly-core-xenial_4.11.0_YYYYMMDD.img.zip 下载地址
NanoPi NEO nanopi-neo_friendly-core-xenial_3.4.39_YYYYMMDD.img.zip 下载地址
NanoPi NEO Air nanopi-neo-air_friendly-core-xenial_4.11.0_YYYYMMDD.img.zip 下载地址
NanoPi NEO Air nanopi-neo-air-ubuntu-core-qte-sd4g-YYYYMMDD.img.zip 下载地址

4 安装BakeBit软件

  • 第1步 - 通过ssh,或者串口终端进入开发板的命令行,从 github 上下载BakeBit代码:
cd  ~
git clone https://github.com/friendlyarm/BakeBit.git
  • 第2步 - 设置使用国内源:

安装BakeBit需要在线下载并安装一系列的软件包,国内大陆的用户为了获得更快的安装速度,可以在安装之前先将软件包的源设置为国内源,执行以下命令,使用我们提供的脚本进行设置:

wget http://112.124.9.243/aptsouce.sh
chmod 755 aptsouce.sh
sudo ./aptsouce.sh
sudo apt-get update
  • 第3步 - 使用如下命令在开发板上安装BakeBit:
cd BakeBit/Script
chmod +x install.sh
sudo ./install.sh
  • 第4步 - 重启开发板:
reboot

5 运行Python示例

以LED配件为例,将LED配件连接到NanoHat Hub上的D3插座,在命令行执行以下命令操作LED:

python ~/BakeBit/Software/Python/bakebit_led_blink.py

LED将会闪烁,更多的Python示例源代码,可进入~/BakeBit/Software/Python/目录查看。

6 运行C语言示例

将LED配件连接到NanoHat Hub上的D4插座,执行以下命令编译并运行C语言的Demo:

cd ~/BakeBit/Software/C/
gcc bakebit_digital_write.c bakebit.c -Wall
./a.out

LED将会闪烁,更多的Python示例源代码,可进入~/BakeBit/Software/C/目录查看。

7 BakeBit Starter Kit

BakeBit Starter Kit是一个基础套件,包含了适用于NanoPi NEO的NanoHat Hub扩展板及12个传感器。
下表列出了该套件所包含的传感器:

1 BakeBit-Button
BakeBit - Button01.jpg
按钮开关模块

连接方式: 连接到数字接口 D2~D5
示例源代码: https://github.com/friendlyarm/BakeBit/blob/master/Software/Python/bakebit_button.py
WiKi网址: http://wiki.friendlyelec.com/wiki/index.php/BakeBit_-_Button

2 BakeBit-Buzzer
BakeBit - Buzzer.jpg
蜂鸣器模块

连接方式: 连接到数字接口 D3 或D5
示例源代码: https://github.com/friendlyarm/BakeBit/blob/master/Software/Python/bakebit_buzzer.py
WiKi网址: http://wiki.friendlyelec.com/wiki/index.php/BakeBit_-_Buzzer

3 BakeBit-Green LED
BakeBit - Green LED.jpg
绿色的LED发光二极管模块,亮度可调节

连接方式: 连接到数字接口 D2~D5
示例源代码: https://github.com/friendlyarm/BakeBit/blob/master/Software/Python/bakebit_led_blink.py
WiKi网址: http://wiki.friendlyelec.com/wiki/index.php/BakeBit_-_Green_LED

4 BakeBit-JoyStick
BakeBit - JoyStick.jpg
摇杆模块

连接方式: 连接到模拟接口 A0~A2
示例源代码: https://github.com/friendlyarm/BakeBit/blob/master/Software/Python/bakebit_prj_UIControl_via_Joystick.py
WiKi网址: http://wiki.friendlyelec.com/wiki/index.php/BakeBit_-_JoyStick

5 BakeBit-LED Bar
BakeBit - LED Bar.jpg
多彩LED模块,由五个多彩LED发光二极管组成

连接方式: 连接到数字接口D3或D5
示例源代码: https://github.com/friendlyarm/BakeBit/blob/master/Software/Python/bakebit_ledbar.py
WiKi网址: http://wiki.friendlyelec.com/wiki/index.php/BakeBit_-_LED_Bar

6 BakeBit-Light Sensor
BakeBit - Light Sensor.jpg
光敏电阻模块

连接方式: 连接到模拟接口A0~A2
示例源代码: https://github.com/friendlyarm/BakeBit/blob/master/Software/Python/bakebit_light_sensor.py
WiKi网址: http://wiki.friendlyelec.com/wiki/index.php/BakeBit_-_Light_Sensor

7 BakeBit-OLED 128X64
BakeBit - OLED.jpg
单色OLED屏幕 (0.96寸、128x64分辨率)

连接方式: 连接到I2C接口
示例源代码: https://github.com/friendlyarm/BakeBit/blob/master/Software/Python/bakebit_128_64_oled_test.py
WiKi网址: http://wiki.friendlyelec.com/wiki/index.php/BakeBit_-_OLED_128x64

8 BakeBit-Red LED
BakeBit - Red LED.jpg
红色LED模块,亮度可调节

连接方式: 连接到数字接口 D2~D5
示例源代码: https://github.com/friendlyarm/BakeBit/blob/master/Software/Python/bakebit_led_blink.py
WiKi网址: http://wiki.friendlyelec.com/wiki/index.php/BakeBit_-_Red_LED

9 BakeBit - Rotary Angle Sensor
BakeBit - Rotary Angle Senso.jpg
电位器

连接方式: 连接到模拟接口 A0~A2
示例源代码: https://github.com/friendlyarm/BakeBit/blob/master/Software/Python/bakebit_rotary_angle_sensor.py
WiKi网址: http://wiki.friendlyelec.com/wiki/index.php/BakeBit_-_Rotary_Angle_Sensor

10 BakeBit - Servo
BakeBit - Servo.jpg
舵机模块

连接方式: 连接到数字接口 D3或D5
示例源代码: https://github.com/friendlyarm/BakeBit/blob/master/Software/Python/bakebit_servo.py
WiKi网址: http://wiki.friendlyelec.com/wiki/index.php/BakeBit_-_Servo

11 BakeBit - Sound Sensor
BakeBit - Sound Sensor.jpg
声音检测模块,用于检测声音信号

连接方式: 连接到模拟接口A0~A2
示例源代码: https://github.com/friendlyarm/BakeBit/blob/master/Software/Python/bakebit_sound_sensor.py
WiKi网址: http://wiki.friendlyelec.com/wiki/index.php/BakeBit_-_Sound_Sensor

12 BakeBit - Ultrasonic
BakeBit - Ultrasonic.jpg
超声波模块,用来探测障碍物,并计算到障碍物距离

连接方式: 连接到数字接口D2~D5
示例源代码: https://github.com/friendlyarm/BakeBit/blob/master/Software/Python/bakebit_ultrasonic.py
WiKi网址: http://wiki.friendlyelec.com/wiki/index.php/BakeBit_-_Ultrasonic_Ranger

8 其它相关资源

github项目网址: https://github.com/friendlyarm/BakeBit
PDF手册: http://wiki.friendlyelec.com/bakebit/bakebit_starter_kit_manual_cn.pdf

9 更新日志

9.1 2017-05-27

修正C语言版本未能正常工作的问题

9.2 2017-05-19

修正oled示例中的温度显示问题

9.3 2017-04-28

增加对NEO2/NEO Plus2/M1 Plus的支持

9.4 2017-04-26

  • 用WiringNP代替WiringPi
  • 增加对NanoHat OLED配件的Python示例