概述
图1——智能物联网婴儿车团队——Mark Davis, Joshua Sackos, Brian Lancaster, Jacob Wolf, Monique Tucker
本文将讨论2014年在英特尔举办的波特兰交通创客马拉松上开发的智能物联网婴儿车, 并展示如何制作一个智能物联网婴儿车。这个婴儿车具有英特尔® Edison开发板,自动刹车系统,转弯信号,云数据同步,以及用来获取云端数据的安卓*应用。
这个智能物联网婴儿车的动机来自一部YouTube*视频,在视频中一部婴儿车从火车站台上跌落至下方的轨道。这一幕激发了技术如何避免此类事件在未来发生的研究。这个项目的主要目标是防止婴儿车失控,不过,基于简单的设计,研发过程加入了更多的功能来丰富父母的婴儿车使用体验。
无论何时父母松开了婴儿车的把手前轮将锁死以防止婴儿车滑走。当父母握住把手时前轮解锁使得婴儿车能够自由移动。智能婴儿车上的转向信号是两条LED灯带,会在切换时激活。然而,当两边同时被激活时,两条LED灯带会保持点亮并且不切换到显示刹车。数据通过英特尔Edison开发板的板载Wi-Fi*上传到云上,父母之后可以通过手机访问存储在云端的婴儿车行驶信息。
你需要哪些材料
挂载在英特尔® Arduino扩展板上拥有最新版本固件的英特尔® Edison开发板。
获取最新版本固件查看:http://communities.intel.com/docs/DOC-23242
英特尔® XDK IoT Edition
3 x Grove* - 智能继电器(v 1.1)
http://www.seeedstudio.com/depot/Grove-Relay-p-769.html
4 x Grove* - 触觉传感器(v1.0)
7 x Grove* - 连接线缆(最小的)
http://www.seeedstudio.com/depot/Grove-Universal-4-Pin-20cm-Unbuckled-Cable-5-PCs-Pack-p-749.html
1 x 基础扩展板v2
http://www.seeedstudio.com/depot/Base-Shield-V2-p-1378.html
2 x LED灯带(12V)
1 x 拉式电磁阀(12V)
1 x RadioShack 276-159B板
http://www.radioshack.com/dual-general-purpose-ic-pc-board/2760159.html#.VMabo_7F8UM
1 x 12V 电池
1 x 慢跑婴儿推车
5到10英尺22AWG线缆用来扩展连接
如何工作
智能刹车
智能刹车系统包含两个电容式触觉传感器(Grove* - 触觉传感器),一个继电器(Grove* - 智能继电器),以及一个12V拉式电磁阀。电容式触觉传感器附着在婴儿车的把手上,传感器输出接入英特尔® Arduino扩展板的输入针脚上。当左右任一边的触觉传感器处于高位(父母正握着把手)时,一个输出针脚生效(被拉高)来激活控制拉式电磁阀的继电器,此时刹车失效。相反地,当两边的触觉传感器处于低位(父母没有握住把手)时,输出针脚失效(被拉低)来解除继电器,此时前轮的刹车介入。金属拉杆作为阻碍婴儿车前轮条幅行进的刹车被电磁阀收进或拉出。刹车机械和控制电路详细图示请见图2。
图2——智能刹车机械和控制电路
转向信号
转向信号系统包括两个12伏LED灯带、两个继电器和附着在婴儿车把手上的两个额外的电容式触觉传感器。跟刹车系统相似,电容式触觉传感器输出连接到英特尔Arduino扩展板上的输入针脚。每一个转向信号包括一个电容式触觉传感器、一个继电器和一条LED灯带。当父母只触碰到左边的电容式触觉传感器转向信号时,一个控制左边LED转向信号的输出针脚被激发,左边的LED转向信号开始闪烁。当父母只触碰到邮编的电容式触觉传感器转向信号时,另一个控制单独继电器的输出针脚被激发,右边的LED转向信号开始闪烁。如果父母同时触碰到左右两边的电容式触觉传感器转向信号,两边的LED灯带将闪烁并且不会切换至表明他们正在刹车。电路图详情请查看图3。
图3——转向信号电路
云端存储和安卓*应用
记录到云端的数据包括传感器数据、刹车事件、左转和右转。安卓应用包括三个表示左转、右转和刹车事件的矩形框以及一个显示每一个记录事件的文字显示区域。采用了HTTP的post写向云端的JSON编码数据结构。本文将不会涉及安卓应用的开发或云存储的设置。图4是为智能物联网婴儿车开发的安卓应用。
图4——智能物联网婴儿车安卓*应用
硬件概述
智能物联网电路原理图
图5是智能物联网婴儿车的完整电路原理图。请注意在图中英特尔Arduino扩展板和附属硬件组件(智能继电器,触觉传感器)之间的针脚连接没有显示基础扩展板v2的使用,需要Grove连接线。基础扩展板v2是一个直接插入Arduino扩展板头部的硬件模块,连接一些数字或模拟针脚到Grove连接线。
图5——智能物联网婴儿车完整硬件原理图
电力分配
继电器、LED灯带、电磁阀和英特尔Arduino扩展板(通过直流电源)都需要连接到12伏电池。因此需要一个定制的配电板。图6显示了一个未修改的RadioShack 276-159B板及为所有的智能物联网婴儿车设计中用到的硬件组件供电需要的连接。一个12伏 rail is created by soldering a connection from the positive battery terminal to node A, and then soldering jumper wires between nodes A, B, C, D, and E as shown in Figure 6. Similarly, a ground (GND) rail is created by soldering a connection from the negative battery terminal to node F and then soldering jumper wires between nodes F, G, H, I, and J. Each hardware peripheral obtains its power via the 12V rail and all share a common ground via the GND rail. This example utilizes 8 “AA” batteries in series via a RadioShack battery holder with a snap connector to supply the needed 12V power.
图6——配电板
Grove* - 智能继电器
Figure 7 is a picture of the Grove - Smart Relay with the reference designators used in the Smart IoT Stroller Complete Schematic (Figure 5). The SIG, NC, Vcc, and GND pins are part of the Grove female header shown in Figure 7. The voltage used to power peripherals controlled by the relay is input to the wire terminal block on the Grove - Smart Relay. Figure 7 shows the Vin pin located on the left side of the wire terminal block and the Vout pin located on the right side of the wire terminal block.
图7——Grove* - 智能继电器
步骤
1 – 挂载英特尔® Edison开发板和基础扩展板v2
To get started, mount both the Intel Edison board and Base Shield v2 to the Intel Arduino expansion board. The Intel Edison board should plug into reference designator J7 on the Intel Arduino expansion board. Next, secure the Intel Edison board via the small nuts and bolts provided with your expansion board. Mount the Base Shield v2 by plugging it into the Arduino headers on the expansion board and make sure that the voltage selector switch on the Base Shield v2 is set to 5V. See Figure 8 for details on mounting locations and what your hardware setup should look like after mounting the components.
Figure 8 - Intel® Edison and Base Shield v2 mounting before and after
2 – 智能刹车
Connect the positive lead of the solenoid to Vout on the relay used for controlling the solenoid. Use a Grove connector to connect the Smart Relay to Grove connector D2 on the mounted Base Shield v2.
3 – 左转信号
Connect the 12V input wire on the left turn LED strip to Vout on the relay used for switching the left turn signal. Use a Grove connector to connect the Smart Relay to Grove connector D3 on the mounted Base Shield v2.
4 – 右转信号
Connect the 12V input wire on the right turn LED strip to Vout on the relay used for switching the right turn signal. Use a Grove connector to connect the Smart Relay to Grove connector D4 on the mounted Base Shield v2.
5 – 触觉传感器
Use Grove connectors to connect the capacitive touch sensors to the mounted Base Shield v2 as outlined in Table 1.
表1. 电容式触觉传感器至基础扩展板V2的映射 | |||
---|---|---|---|
信号 | Base Shield V2 Grove* Connector | ||
Left Touch | D7 | ||
左转 | D8 | ||
Right Touch | D6 | ||
右转 | D5 |
6 – 连接配电板
- Use jumper wires to connect Vin on the Smart Relays to the 12V power rail on the power distribution board (see Figure 6).
- Similarly, the negative wires (ground wires) on the solenoid, left turn LED, and right turn LED need to be connected to the GND plain on the power distribution board (see Figure 6). Use jumper wires to connect these peripherals.
- Connect the DC barrel jack soldered to the power distribution board to jack J1 on the expansion board.
- Refer to Figure 6 above to see the connections.
7 – 连接完成
在完成上面的1-6步之后你的硬件配置将和图9中所示的类似。
图9——硬件连接完成
8 – 创建英特尔® IoT XDK项目
打开英特尔XDK IoT Edition创建一个名叫“Smart_IoT_Stroller”的新项目。查看英特尔XDK IoT Edition帮助:
- https://software.intel.com/en-us/articles/getting-started-with-intel-xdk-iot-edition-on-intel-iot-platforms
9 – 智能物联网婴儿车代码
File: main.js
Download the main.js file from the GitHub URL provided below and import it into your main.js file in the Smart_IoT_Stroller XDK project. The code sets up the general purpose input/output (GPIO) pins used in the Smart IoT Stroller design via the setupIO() function. After setting up the hardware direction and initial values of the output pins used for controlling the relays, the JavaScript* setInterval() function is used (see line 90) to call the function defined as the first argument every 500 milliseconds. This is essentially the infinite loop that one would expect in a C/C++ Arduino project; however, the function/loop code will only execute once every 500ms instead of continuously like in Arduino. To change the frequency at which the function is called simply change the argument 2 in the setInterval() function call. Argument 2 is the number of milliseconds to wait before calling the function again.
Inside the function defined as argument 1 of the setInterval() function call, each capacitive touch sensor is read and is used to control the states of the solenoid, left turn LED strip, and right turn LED strip. Any changes to the state of the capacitive touch sensors, solenoid, left turn LED, and right turn LED are logged to the cloud via the save_to_cloud() function.
Application Note: Replace the ‘CLOUD_STORAGE_URL’ variable on line 41 with your cloud storage URL.
GitHub URL: https://github.com/joshsackos/smart_iot_stroller/blob/master/main.js
File: package.json
To perform HTTP posts in the Smart IoT Stroller the request client must be included in the Intel XDK dependencies list. Open the package.json file located in the left-hand navigation of the Intel XDK IDE. In the package.json file add request:latest between the dependencies curly braces and save the document. After adding the request client to the dependency list, your package.json file should be similar to the package.json file located at the GitHub URL below.
GitHub URL: https://github.com/joshsackos/smart_iot_stroller/blob/master/package.json
10 – Build and Program your Intel® Edison board
Connect the Intel Arduino expansion board to your PC with theMicro-USB cables, and connect to your board from in the Intel XDK IDE. Build the Smart_IoT_Stroller project and upload it to the Intel Edison. Disconnect both USB cables from your expansion board. See Figure 10 for details.
Figure 10 – Intel® XDK IDE - Connect, Build, Program
11 – 云端存储和安卓应用
The cloud storage utilized in the Smart IoT Stroller project was achieved using Microsoft Azure* Mobile services. The Android cell phone application was built with Xamarin. Setting up the cloud storage and developing the Android app are not covered in this document; however, the links below should get you started with your cloud storage and Android app development.
- 云端存储:
http://azure.microsoft.com/en-us/services/mobile-services/
- 安卓应用开发:
http://developer.xamarin.com/guides/android/getting_started/
12 – 连接电池
Insert 8 “AA” batteries to power your Smart IoT Stroller. After powering your design wait about 20 seconds for the Intel Edison to boot up.
13 – Working Smart IoT Stroller Configuration
Once the Intel® Edison board has finished booting complete the different touch combinations outlined in the video below. If your Smart IoT Stroller hardware configuration is functioning properly, you are ready to mount the hardware onto your jogging stroller. If your hardware configuration is not functioning properly, work through this document again and make sure that all hardware and software configurations are correct.
14 – Working Smart IoT Stroller Configuration
Mount the working Smart IoT Stroller hardware/software configuration to your jogging stroller. Figure 11 below is the mounting configuration used for the Smart IoT Stroller project.
Figure 11 - Smart IoT Stroller with Hardware Mounted
总结
安全考虑
This design is intended to demonstrate how IoT devices can make everyday objects smarter and is not intended to be used in real-world applications as is. If the stroller is in motion and the battery used for the system reaches a critical level, the solenoid will lose power and extend the metallic rod. This is the same as applying the brake and such an event could inadvertently cause the stroller to flip over. An alternative would be to have a manual brake system that can also be controlled by the Intel® Edison board, so functionality is not lost in the event the battery loses charge.
IoT-Connected World
Integrating technology into everyday objects increases convenience, allows for data collection, provides access to cloud services, and enhances the quality of people’s lives. IoT enables the collecting of health and fitness data, communications, statuses of important systems, and scientific measurements. IoT is an emerging market with nearly endless possibilities.
你打算做什么?
关于作者
Joshua Sackos是一位波特兰州立大学电气和计算机工程研究生。他具有10年以上计算机编程经验和2.5年嵌入式系统经验。He was previously part of a team that built a single event upset mitigation system for reconfigurable devices operating in the space environment. In addition to embedded systems he also has experience in digital design using HDLs, sensors, HPC, and e-commerce web development. 他于2013年从华盛顿州立大学完成计算机工程学士学业。
你可以在http://www.joshsackos.com网站找到未来的项目。