2015年7月31日 星期五

微信設備開發LOG

1. 硬件平台文檔: http://iot.weixin.qq.com/document-2_11.html
2. 設備 device_id 更新例子: http://www.6fcall.com/index.php?s=/Home-Index-content-id-31.html
3. 微信 advdata example: http://blog.csdn.net/haozi0_0/article/details/46878575
4. 微信開發歷程: 他人經驗: http://blog.csdn.net/haozi0_0/article/details/46790483
5. 到底可不可以連多個設備, 實測是可以的; 但通常其中一個不容易被連上; 以下內容真讓人CONFUSE, 有相互衝突; ???
6. 用户关注公众号的通知,和绑定设备的通知,到达的先后顺序不定。  確實, 向後台發送的訊息, 若多個訊息在發送, 間隔很短的時間, 通常小於一秒, 有可能不會照順序到達.


二、 微信客户端连接 BLE 设备
1. 微信扫描二维码,记录设备的 MAC 地址
2. 打开公众号,如果此时 BLE 设备开启了,则会自动连接
3. 如果微信再次扫描 BLE 设备(与第一个设备 MAC 地址不同),并添加到公众号,两个设备都开启,则微信客户端可以连接两个设备,微信客户端可以同时向两个设备发数据,但是仅限窗口模式,网页模式不可以用

Q:一个用户只能绑定一个设备吗? 
A:是。在已绑定设备且未解绑的情况下,再扫描绑定另一设备时,前者会被取代,绑定的
是后一设备。 
微信不建议允许同一用户绑定多个设备,若一定需要绑定多个设备,微信能在自定义菜单中
提供“添加设备”功能,由厂商负责管理。此时,通过扫描二维码的方式不能绑定新设备,
而需要用户在公众号内输入新设备的deviceID,由厂商在后台处理。 

Q:同一设备是否能被多个用户扫描绑定吗? 
A:是。 

Q:能否实现以下情况:用户A 与用户B都同时绑定设备 1和设备2? 
A:否。

7. 下載中心, 有很多好料的, 一點要看: http://iot.weixin.qq.com/download.html
8. 當然微信論壇也可以找到一些資訊, 只是可能會有問題石沈大海, 多爬一些文, 可能可以找到前人問過的問題和答案;

GPRS solution example:
http://www.letime.cn/news_show.asp?pageid=556&big_id=64&topid=5

三. 微信設備參數範例:
設備更新授權-
{
    "device_num": "1",
    "device_list": [
        {
            "id": "gh_76a56d632614_5091274d819bd813fb4853fa55a382cc",
            "mac": "BC6A2924EF78",
            "connect_protocol": "3",
            "auth_key": "1234567890ABCDEF1234567890ABCDEF",
            "close_strategy": "1",
            "conn_strategy": "1",
            "crypt_method": "0",
            "auth_ver": "0",
            "manu_mac_pos": "-1",
            "ser_mac_pos": "-2"
        }
    ],
    "op_type": "1"
}



Intel HEX - F/W burn code

https://en.wikipedia.org/wiki/Intel_HEX

example:
:1000830002243BE5C754F84401F5C7790122000077


  1. Start code, one character, an ASCII colon ':'.
  2. Byte count, two hex digits
  3. Address, four hex digits
  4. Record type (see record types below), two hex digits, 00 to 05 
  5. Data
  6. Checksum, two hex digits

Hex codeRecord typeDescriptionExample
00DataContains data and a 16-bit starting address for the data. The byte count specifies number of data bytes in the record. The example shown to the right has 0B (decimal 11) data bytes (6164647265737320676170) located at consecutive addresses beginning at address 0010.:0B0010006164647265737320676170A7
01End Of FileMust occur exactly once per file in the last line of the file. The data field is empty (thus byte count is 00) and the address field is typically 0000.:00000001FF
02Extended Segment AddressThe data field contains a 16-bit segment base address (thus byte count is 02) compatible with 80x86 real mode addressing. The address field (typically 0000) is ignored. The segment address from the most recent 02 record is multiplied by 16 and added to each subsequent data record address to form the physical starting address for the data. This allows addressing up to one megabyte of address space.:020000021200EA
03Start Segment AddressFor 80x86 processors, specifies the initial content of the CS:IP registers. The address field is 0000, the byte count is 04, the first two bytes are the CS value, the latter two are the IP value.:0400000300003800C1
04Extended Linear AddressAllows for 32 bit addressing (up to 4GiB). The address field is ignored (typically 0000) and the byte count is always02. The two encoded, big endian data bytes specify the upper 16 bits of the 32 bit absolute address for all subsequent type 00 records; these upper address bits apply until the next 04 record. If no type 04 record precedes a 00 record, the upper 16 address bits default to 0000. The absolute address for a type 00 record is formed by combining the upper 16 address bits of the most recent 04 record with the low 16 address bits of the 00 record.:02000004FFFFFC
05Start Linear AddressThe address field is 0000 (not used) and the byte count is 04. The four data bytes represent the 32-bit value loaded into the EIP register of the 80386 and higher CPU.:04000005000000CD2A

2015年7月30日 星期四

Is it possible to wake up phone by NFC when lock mode?

from http://stackoverflow.com/questions/10733723/launching-nfc-when-screen-is-locked-in-android.
According to Google, Android-powered devices must be unlocked in order to scan an NFC tag [1]. Also the Google Wallet concerns privacy and security, and works only in unlocked state [2].


2015年7月29日 星期三

iOS External Accessory Programming Topics

https://developer.apple.com/library/ios/featuredarticles/ExternalAccessoryPT/Introduction/Introduction.html

from https://developer.apple.com/hardwaredrivers/BluetoothDesignGuidelines.pdf
Third-party accessories can use the iPod Accessory Protocol (iAP) to access advanced features of iOS devices. One such feature is the ability to communicate securely with third-party iOS applications via the iOS External Accessory Framework. For information about the External Accessory Framework, see http://developer.apple.com/library/ios/#featuredarticles/ExternalAccessoryPT/Introduction/Introduction.html on the Apple iOS Developer site. To incorporate iAP into an accessory design, the accessory developer must be a member of the Apple MFi licensing program and integrate specific MFi hardware into the accessory. For further information about MFi, see developer.apple.com/programs/mfi.

iOS devices do not implement the Bluetooth RFCOMM (SPP) profile. from Bluegiga.
Instead Bluetooth accessories can use iAP profile to exchange data with iOS devices – iAP is RFCOMM based connection (similar to SPP) – It uses Apple proprietary iAP application protocol – Allows data exchange between Apps and the accessory • Audio, Human Interface (HID), PAN accessories and Bluetooth Smart devices are outside MFi program

Bluegiga:
iWRAP also implements 13 other Bluetooth profiles – Serial Port Profile – A2DP – Hands-Free Profile – Human Interface Device Profile – Health Device Profile – etc.
– Uses SPP to communicate with an Android App
– Uses iAP to communicate with an iOS App

2015年7月28日 星期二

CCC 第一批实施强制性产品认证的产品目录 - SRRC

http://www.ccc-cn.org/ccccatalog.htm

http://www.boot.com.tw/ccc/folder03/f03o.htm



http://www.srrccn.org/chinese.htm

关于明确移动通信模块强制性认证有关要求的通知
关于明确移动通信模块强制性认证有关要求的通知
各直属检验检疫局,各省、自治区、直辖市质量技术监督局:
随着移动通信技术的广泛应用,越来越多的产品中集成了移动通信模块。近日,我委收到部分地方质检部门和相关企业关于带有移动通信模块的产品(如采用CDMA/GSM/GPRS等移动通信方式实现远程数据监控的“用电管理终端”、“GPS监控终端”等产品)是否属于强制性认证范围,以及如何实施认证的问询。根据《强制性产品认证管理规定》和《第一批实施强制性产品认证的产品目录》,采用GPRS、GSM、CDMA、TD-SCDMA、WCDMA、CDMA2000五种制式的移动用户终端产品应当申请3C认证。现将上述五种制式移动通信模块及相关产品的强制性认证有关要求明确如下:
一、移动通信模块或者带有移动通信模块的产品(以下简称模块及相关产品)可接入公共通信网,具备3C目录内移动用户终端产品的功能,应申请3C认证,符合移动用户终端的3C认证检测要求。实施认证时,如模块可从产品上分离,则模块单独申请认证即可,检测在模拟最终使用环境状态下进行;如模块不可分离,则应送带有移动通信模块的产品或已能建立通信功能的中间产品进行检测认证。
二、如带有移动通信模块的产品除移动通信功能外,还具备3C目录内其他产品的功能,则还应符合相应产品强制性认证实施规则的要求。
三、预定在工业环境中和预定在室外环境中使用的模块及相关产品目前不属3C认证范围。
二○一一年七月十四日
备注:强制性产品认证管理规定:http://cccwto.com/1690.html
移动通信模块申请3C认证指南:http://cccwto.com/944.html

GSM双频GPRS手机进网(CTA)介绍
http://wenku.baidu.com/view/18cdc679a26925c52cc5bf73.html?re=view

http://www.atl-lab.com.tw/images/news/03_CTA091029.pdf

CCC、CTA认证流程介绍
http://sgststatics.sgst.cn/uploadfile/2013/1025/20131025051524948.pdf

2015年7月14日 星期二

USB pin define

http://chunchaichang.blogspot.tw/2012/06/usb.html

採光罩 survey

玻璃建議:
1. 玻璃水平施工 最低安全標準應用5mm+ 5m m膠合安全玻璃 
    (5mm光強化玻璃+5mm光白膜膠合安全玻璃)

結構:
1. 採用10H型鋁鋼構
2. 橫樑立柱是採用12×20H型鋁鋼構(單位:cm)
http://yp.518.com.tw/product-prod_info.html?rid=2&a=1269025&sr=2050
3. 鋁鋼構介紹: here

第一代的H型鋁鋼構為實心鋁擠型,並不是作為採光罩用途,而是做為建物表面飾材。
第二代的H型鋁鋼構著眼於第一代實心鋁擠型成本太高,故製作空心模。
第三代的H型鋁鋼構正式進入採光罩計畫,由於鋁料的厚度不能太薄,且為求達到同等鋼構的組織架構,所以製作成本高。故早期規劃製作H型鋁鋼構者,以專題建案及H型鋁鋼構鍾愛者居多。

其實H型鋁鋼構的擠型模,是非常難以擠型的料;就因為它的工型翅膀,在擠型抽出的同時,必須克服鋁擠型變形!H型鋁鋼構的料厚、空心,若擠型抽出變形對於施工者與現場施工,會產生主架料與連結副架料的接觸面無法完全吻合! 
傳統PC採光罩:易碎 易氧化 不耐擊 不安全 無防盜功能 不美觀。
南方松:雖然美觀耐撞擊不生鏽的優點,但是長久下來,所吸收的雨水將導致與玻璃接合面鬆脫;加上是木造材質,容易有腐蝕的危險存在。
白鐵:耐撞擊、質硬、不易生鏽的優點,但是並非完全不生鏽,如果烤漆,漆也容易脫落。
鐵材:耐撞擊、耐強壓的優點,缺點是容易生鏽,無法達到美觀之效果。

相較之下,H型鋁鋼構綜合了以上幾種材料的優點,並且改善了以上材質的缺點,取代了以往材質之採光罩,而成為了新一代採光罩,並被業界所廣泛使用!

2015年7月8日 星期三

RSSI signal for CC2541

from http://e2e.ti.com/support/wireless_connectivity/f/538/p/212876/809168
The panel is placed a std. distance away from a BLE gateway that's also based upon the CC2541 chip.   The RSSI is monitored with an internal .net application.  Most of the advertisers consistently display RSSI values in the -29 to -32 range on all three channels.  A few, however, will display in that range for two of the channels, but in the -48 to -52 for the other channel... and it's not any one specific channel that's always the "bad" channel.  And if I "spin" the panel in 90 degree increments, the same advertisers are inconsistent, so it's not related to position on the panel or orientation.  I also see "good" advertisers go "bad" for awhile, then go back to "good"... this testing is taking place in an isolated test bed so interference is minimal.

Sometime, the value is not changed.
http://e2e.ti.com/support/wireless_connectivity/f/538/p/407118/1443292


  • Excellent link budget (up to 96 dB), enabling long-range applications. 
  • Accurate digital received signal-strength indicator (RSSI) 
Sensitivity -96 dBm
High/Standard Gain Mode -70 dBm (BT spec)
http://pideu.panasonic.de/pdf/168Datasheet.pdf 

RSSI for distance indicator: comment from TI engineer:
http://e2e.ti.com/support/wireless_connectivity/f/538/p/311434/1086588
Unfortunately, RSSI is not a good indicator of distance or location because there are so many environmental factors that can affect the signal strength. The BT-SIG is working on some modifications to the BLE protocol that will allow for location and distance calculations; however those are based on very low-level changes to the protocol and are probably a few years away from being adopted.

You likely won't be able to see much difference in the RSSI value between 0-10 ft and the results will not be consistent.  The Proximity profile defines the behavior when a device moves away from a peer device so that the connection is dropped or the path loss increases above a preset level, causing an immediate alert.  It is not meant to distinguish between gradual distance changes.


Improving RSSI Readout Accuracy It is important to be aware that in a real system, the output power from the transmitter and variations in the transmission path will contributes to the RSSI inaccuracy. However, there are certain steps one can do, to improve the RSSI readout accuracy 1) Calculate an average RSSI value based on several readouts. (From TI document) 
http://www.ti.com/lit/an/swra114d/swra114d.pdf


RSSI calculation for CC254x: (From https://e2e.ti.com/support/wireless_connectivity/f/538/t/140189)
After connecting to a peripheral device.  I'm able to call the HCI_ReadRSSI (0x1405) command.  The RSSI values that I get are ranging from 0xB7 (183) to 0xCA (202).  I have set the RxGain to High using the HCIExt_SetRxGain, so the RX sensitivity is -93 dBm. 
The number is signed (2's complement), so 0xB7 means -73 and 0xCA means -54. If your design differs from the reference design, you may need to compensate for differences in the balun gain, other than that, you can take the number directly as a dBm number.
When you call the HCI_ReadRSSI command, the software calculates the RSSI in dBm. The packet sniffer output, which was used in the original question, is a raw number. It is still in dB, but with a different reference. To find the dBm number, a value such as -93 must be added. The number depends on the receiver gain mode, which is taken into account when using HCI_ReadRSSI.
For raw data, should do the calculation:
Packet index: 5
Length: 48
Raw data (hex): D6 BE 89 8E 00 25 30 B2 00 FF EE CC 02 01 06 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 92 E2 95 3AA5
RSSI [dBm]: -36
CRC OK: 1
I assume 3A is the rssi value.
Sensitivity Best (-93 dBm).
-93d + 58d = -35 --> (0 to -35) = -36

About dB & dBm (Chinese)
http://zhidao.baidu.com/question/14279833.html

2015年7月7日 星期二

Serial to USB chip solution

If you need to transmit at higher baudrates to transfer data faster, you will need to connect the MSP430 through a USB to serial (UART) converter. There are many converter solutions, and you can certainly find complete cables, but many of these are based on two devices which are very popular:
  • FT232RL and similar devices from FTDI chip are a complete USB to UART solution that integrates the EEPROM and oscillators. Basically with one chip and a few external passives you can have reliable UART communications.
  • CP210x from Silicon Labs (Silabs) is another popular device that provides a USB to UART bridge. A few of the devices are also highly integrated
Both of these solutions are easy to use and their drivers are simple and widely available. They can easily support over 1Mbaud.

These two solutions also have mobile or embedded system driver support.

Reference from http://www.argenox.com/library/msp430/msp430-uart-peripheral-chapter-8/

Android / iOS devices connector to flash drive (mass storage)

Consider two public operation systems: iOS and Android.

1. Hardware connection: Use cables for different connectors.

iOS device connects lightning interface to USB mass storage.
App: iFile.
https://www.youtube.com/watch?v=VyeWy1Q_buU

iOS device connects to Android device. (Connector)
http://gadgetsin.com/lightning-cable-with-micro-usb-connector-for-sharing-photos-videos-and-power.htm

iOS 30 pins connector to micro-USB.
http://www.bidorbuy.co.za/item/176648234/Micro_USB_Male_to_Apple_30_Pin_Female_Charge_and_Sync_Cable_for_iPad_iPhone_and_iPod_Black.html

Micro USB Male to Male Adapter Cable For MHL Mobilephone Power supply Charger
http://www.bidorbuy.co.za/item/176648234/Micro_USB_Male_to_Apple_30_Pin_Female_Charge_and_Sync_Cable_for_iPad_iPhone_and_iPod_Black.html

Micro USB Male to Mini USB Male Adapter Cable
http://www.miniinthebox.com/micro-usb-male-to-mini-usb-male-adapter-cable-for-samsung-galaxy-s3-i9300-and-others_p504541.html

2. OS supports USB mass storage?
The OS needs to support USB-OTG.
The USB On-The-Go introduces the concept of a device performing both master and slave roles .
Android version 3.1 or newer supports USB On-The-Go, but not on all devices
(App USB OTG Checker (Android) could tell you.)
Android OTG compatibility list:
http://www.corsair.com/zh-tw/landing/otg-compatibility-list
http://www.kingston.com/us/usb/otg

For iOS, Apple limits the function not for all devices.
USB OTG Connect kit 
Funtion 1: iPad mini/4th/air for Photos/Videos and connect with USB PC Keyboard, USB Piano Keyboard.

Funtion 2: in case of iPhone 5/5S, Only connect with USB PC Keyboard, USB Piano Keyboard. Not Photos/videos (refer to https://www.youtube.com/watch?v=Gig4sCA0vK8)
http://www.mobilefun.co.uk/blog/2014/06/the-complete-guide-to-usb-otg-adapters/

USB flash drive for all iOS.
http://www.amazon.in/i-Flashdrive-16GB-pendrive-iPhones-iPhone/dp/B00P4WAY5K#productDetails
http://buy.ezship.com.tw/street/fb_store_prod_main.jsp?store_id=ezship_bctd&pd_id=169798


3. Support App
Android - ES File Explorer

2015年7月6日 星期一

中國互聯網如何布局移動醫療?

http://wechat.fingerdaily.com/thread-116103-1-1.html

BAT如何布局移動醫療?

[Marketing] report

WeChat 2015 user report [marketing] - Chinese
http://www.wusiwei.com/post-1062.html

Frequency Shift Keying



從iPhone到Arduino的,你可以從阿爾杜伊諾到iPhone發送數據。通訊速率為1225bps(實際數據傳輸速率※是有點低)。它適用於少量的數據通信的諸如傳感器的信息和切換輸入。
請使用4針微型插孔(L / R / GND / MIC)的電纜連接到iPhone。常見的立體聲電纜,以便3極迷你插孔(L / R / GND),給我你的。串擾是由電纜產生的,它可能會導致通信錯誤。建議採用鍍金端子屏蔽電纜。電纜的長度是一個很好的短。

FSK Modem

Example circuit in Japanese.
https://code.google.com/p/arms22/wiki/SoftModemBreakoutBoard

iOS framework and Ardunio solution (code):
https://github.com/jensmeder/FSKModem
https://github.com/ezefranca/FSK-Arduino-iOS

Android sample code:
https://github.com/hitesh24by365/AudioJackTransfer
https://github.com/cytecbg/android-fskmodem

Androino:
https://code.google.com/p/androino/

Smart phone with real voice demo:
https://www.youtube.com/watch?v=kb_e3DPPdsU



FSK or similar modulated-audio communication via audio-jack (no MFi needed)

You would have to implement hardware FSK modem on the RPi side and a software one on the iOS side. It is a bit tricky but by no means impossible.

Of course you could implement software modem on the RPi side, too. But since RPi doesn't have audio input you would have to use an USB audio card or something. Or complicate your life trying to sample an analog pin fast enough.

Dongle type of blood glucose meter

Gmate smart

https://www.youtube.com/watch?v=WI4GEtjm9dE
http://mobihealthnews.com/35934/philosys-receives-fda-clearance-for-iphone-connected-glucometer/


Dario
http://mydario.com/

糖护士
http://www.leiphone.com/news/201501/ITLU1T4OvNBxHFxA.html

 shift keying (FSK) modulation
http://scholarworks.uni.edu/cgi/viewcontent.cgi?article=1009&context=agss

FDA medical device apply note (Chinese)

http://www.hbmsp.sipa.gov.tw:9090/itri/tw/images/Legal3_1.htm

http://www.hbmsp.sipa.gov.tw:9090/itri/tw/images/NewsList1030905_04.htm
以下內容來自這個網頁:

在2011年2月,美國食品藥物管理局(Food and Drug Administration,以下簡稱FDA) 宣布將醫療器材資訊系統(Medical Device Data Systems,分類分級代碼880.6310,以下簡稱MDDS)由法規管制最嚴格的第三等級醫療器材降為只需一般管制的第一等級.

FDA對MDDS定義為傳輸、儲存、格式轉換、顯示醫療器材資料的軟體,MDDS本身並不改變數據、或影響其他醫療器材之功能及系統參數,不控制儀器、或對儀器功能或參數提出警告,舉例如下:
  1. 傳輸或交換其他醫療器材得到之資料。如收集從呼吸器CO2濃度數據,並傳輸到患者呼吸資料庫的軟體。
  2. 儲存紀錄或取回其他醫療器材之電子數據。如擷取患者歷史血壓資訊,並傳送給健康照護者進行評估的軟體。
  3. 根據特定規格,轉換其他醫療器材之資料格式。如轉換由血氧濃度計成為數位格式的軟體。
  4. 顯示醫療器材數據的軟體。如顯示儲存在機器中前一位患者心電圖的軟體。
最後,該草案對2013.9.25發布的移動醫療應用指南(移動應用指引)提出一些變更建議。如取消顯示、保存、或傳輸病人特定醫療數據的APP這類器材管制,也包括評估心血管疾病的風險或擬在糖尿病管理中使用的APP。
藉由取消這些低風險產品的監管,不分析數據或提供病人具體建議,而只是呈現,檢索和顯示數據的軟體都被歸納為低風險的產品。此舉也更降低了軟體研發業者的負擔,也可刺激新產品開發上市。

2015年7月2日 星期四

BLE CC2540 data rate


CC2540 Data Throughput


This is example modification of CC2540 SimpleBLEPeripheral application to measure user data throughput. Initial testing shows we can reach 5.9K bytes per second. This is using a 10ms connection interval and 20 user data bytes sent in GATT notifications. 4 notifications are sent every 7ms, based on an OSAL timer. When sending the notifications, a check is made to see if a buffer is available. In all, 1000 notifications are sent. This is 20K bytes, which are sent over 3.35 seconds.  __(from TI)
http://processors.wiki.ti.com/index.php/CC2540_Data_Throughput


In real case, it's not possible use 10 ms interval to transmit data, need to consider the UART interface.
My experience is about 40~ 60 ms and not including actual payload without header, checksum, packet bytes, etc.

https://learn.sparkfun.com/tutorials/bluetooth-basics
Other compare table is quite interesting from sparkfun.com.
NameBluetooth ClassicBluetooth 4.0 Low Energy (BLE)ZigBeeWiFi
IEEE Standard802.15.1802.15.1802.15.4802.11 (a, b, g, n)
Frequency (GHz)2.42.40.868, 0.915, 2.42.4 and 5
Maximum raw bit rate (Mbps)1-310.25011 (b), 54 (g), 600 (n)
Typical data throughput (Mbps)0.7-2.10.27 (TI package throughtput)0.27 (b), 25 (g), 150 (n)
Maximum (Outdoor) Range (Meters)10 (class 2), 100 (class 1)5010-100100-250
Relative Power ConsumptionMediumVery lowVery lowHigh
Example Battery LifeDaysMonths to yearsMonths to yearsHours
Network Size7Undefined64,000+255

9 Free Business Productivity Tools For Startups [share]

http://tweakyourbiz.com/technology/2013/04/08/9-free-business-productivity-tools-for-startups/?utm_source=outbrain&utm_medium=promo&utm_content=outbrain&utm_campaign=Outbrain

Some of internet tools for project management, activity, calendar, fax service, financial counting, etc.