MetaSensors, comes in a small package that includes motion and environmental sensors. Our Sensors communicate to Devices including Smartphone, Tablets, Computers, Gateway Hubs and RaspberryPis using Bluetooth Low Energy.
1. Fitbit Sense手表
EDA(即皮肤电活动)传感器基本上可以跟踪皮肤汗液中的电变化,可以用来测量压力;PurePulse 2.0,CG传感器首次可以跟踪心房颤动(AFib)的征兆;皮肤温度变化(这可能表明疾病,发烧或新月经的开始);SpO2血氧跟踪,Premium用户将其数据包括在趋势中。当然,还有睡眠追踪功能,以及用于追踪运动过程的车载GPS;添加了内置扬声器和麦克风,用于免提语音呼叫和响应消息(如果您使用的是Android设备),并且还集成了Amazon Alexa和Google Assistant。
-
https://dev.fitbit.com/build/guides/sensors/ 开发文档 比较详细
-
fitbit pushed:>2018-10-10 1728
-
https://dev.fitbit.com/build/guides/command-line-interface/
- Fitbit user account. Sign up here.
- A Fitbit OS device, or the Fitbit OS Simulator for Windows or macOS.
- The latest Fitbit mobile application for Android, iOS or Windows Phone, paired with your Fitbit device.
- A computer with access to Fitbit Studio.
- A wireless network to provide the Fitbit device a connection to the internet.
1.1. FileStructure
Appliaction:
- /app/: Code in this folder has access to the Device API and is capable of interacting
directly with the presentation layer
,communicating with the companion
, orreading and writing settings
. - /common/: contains the
companion logic
which executes on the mobile device. Code in this folder has access to the Companion API and is capable ofmaking direct requests to the internet
, andcommunicating with the application
. - /resources/index.view :
Fitbit SVG file
where the application user interface markup is define - /resources/widget.defs: which system widgets are available for use within the
index.view
file. - /resources/*.css: creating a
<link>
in theindex.view
file; - /resouces/*.png: referencing them within an
<image>
element in theindex.view
.
1.1.2. Communication
- using mobile
- using Messaging: websocket api; provides a
synchronous socket based communications channel
for sending and receiving simple messages while the app is running on the device. - file transfer: an
asynchronous mechanism for sending binary or text files from the companion
, and receiving them on the device, even if the app is not currently running on the device.
1.1.3. Companion
- Communicate with Web APIs.
- Download images or other resources from the internet.
- Utilize the mobile device GPS sensor.
- Persist data on the mobile device.
- Perform functions whilst the device application is not active.
- Utilize the Settings API
- Periodic Wake Interval
import { me as companion } from "companion";
if (!companion.permissions.granted("run_background")) {
console.warn("We're not allowed to access to run in the background!");
}
const MILLISECONDS_PER_MINUTE = 1000 * 60;
// Cancel the wakeInterval timer
//companion.wakeInterval = undefined
// Tell the Companion to wake after 30 minutes
companion.wakeInterval = 30 * MILLISECONDS_PER_MINUTE;
// Listen for the event
companion.addEventListener("wakeinterval", doThis);
// Event happens if the companion is launched and has been asleep
if (companion.launchReasons.wokenUp) {
doThis();
}
function doThis() {
console.log("Wake interval happened!");
}
- Location change listener
import { me as companion } from "companion";
if (
!companion.permissions.granted("access_location") ||
!companion.permissions.granted("run_background")
) {
console.error("We're not allowed to access to GPS Position!");
}
// Don't monitor for significant changes in physical location
//companion.monitorSignificantLocationChanges = false
// Monitor for significant changes in physical location
companion.monitorSignificantLocationChanges = true;
// Listen for the event
companion.addEventListener("significantlocationchange", doThis);
// Event happens if the companion is launched and has been asleep
if (companion.launchReasons.locationChanged) {
doThis(companion.launchReasons.locationChanged.position);
}
function doThis(position) {
console.log(`Significant location change! ${JSON.stringify(position)}`);
}
1.1.4. Geolocation
import { geolocation } from "geolocation";
//monitor location
//var watchID = geolocation.watchPosition(locationSuccess, locationError, { timeout: 60 * 1000 });
geolocation.getCurrentPosition(locationSuccess, locationError, {
timeout: 60 * 1000
});
function locationSuccess(position) {
console.log(
"Latitude: " + position.coords.latitude,
"Longitude: " + position.coords.longitude
);
}
function locationError(error) {
console.log("Error: " + error.code, "Message: " + error.message);
}
1.1.5. app Gallery
- https://dev.fitbit.com/build/guides/publishing/
1.1.6. Sensors
import { Accelerometer } from "accelerometer";
import { display } from "display";
if (Accelerometer) {
const accel = new Accelerometer({ frequency: 1 });
accel.addEventListener("reading", () => {
console.log(
`ts: ${accel.timestamp}, \
x: ${accel.x}, \
y: ${accel.y}, \
z: ${accel.z}`
);
});
display.addEventListener("change", () => {
// Automatically stop the sensor when the screen is off to conserve battery
display.on ? accel.start() : accel.stop();
});
accel.start();
}
- 具体函数api
- app 市场
- example
- develop 文档
- Comprehensive Guides
- Reference Documentation
- SDK Example Apps
- Open Source Community Examples
2. 三星Tizen 开发
- https://developer.tizen.org/development/sample/native/System/Sensor
- Tizen pushed:>2018-10-10 667
3. MetaSense 系列
- metasense pushed:>2018-10-10 6repository
預測發生心肌梗塞後的死亡率指標,以及末期肝癌病患的預後。皮膚的電阻值取決於皮膚的潮濕度、血管收縮與舒張、角質層的厚薄、化學物質及塵埃等因素,當個體處於緊張、憂慮及恐懼的情緒狀態時,可能因腎上腺素分泌而使交感神經的作用增強,促進汗腺的分泌與血管收縮,使皮膚電阻下降。因此MetaGSR不但可以用來測量配戴者的心情,甚至可以做為簡易測謊儀器。
3.1. MetaSensors
- MetaSensors include the MetaMotionC (MMC), MetaMotionR (MMR), and MetaTracker (MTR).
- MetaSensors can stream and/or log sensor data using BluetoothLE.
- MetaSensors work with the free MetaBase App.
- MetaSensors are API programmable using our open-source SDKs.
- MetaSensor firmware is closed source.
1.1. MetaMotionR - MMR
mainly used in movement recognition applications such as a golf swing tracker.
1.2. MetaMotionC - MMC
mainly used in clinical trials where a coin cell battery is safe and disposable.
1.3. MetaTracker - MTR
3.2. MetaBase
- MetaBase is a free iOS, Android, or Windows App available on the App store.
- MetaBase can connect up to 3 sensors at the same time.
- Sensor data is timestamped and easy to sync.
3.3. MetaWear APIs
accessing sensor data, setting up recordings, turning on LEDs and so on.
MetaWear APIs can program the Sensors to do things such as
log accelerometer data at 10Hz for 1 hour
.The following languages are supported: Swift, C++, Javascript, Java, C# and Python.
The following platforms are supported: Windows, iOS, Android, and Linux.
3.4. MetaHub Gateway
MetaHub is a Bluetooth to WiFi/LAN hub gateway that is built on the RaspberryPi.
MetaHub is a link between MetaSensors and other systems (usually a cloud/server).
MetaHub can communicate with up to 10 MetaSensors at the same time using multiple Bluetooth dongles.
graph sensor data live on screen, store sensor data locally, or push sensor data to the Cloud (if connected to the internet).
树莓派+像店家索要镜像
3.5. MetaCloud
- MetaCloud stores all of your MetaSensor data in the cloud (backed by Amazon AWS).
- MetaCloud is optional (you can use your own cloud if you want).
- MetaCloud is a Cloud based subscription service starting at $5 per month.
3.6. Python API
- MetaWear-SDK-Cpp -> The C++ metawear library pointer
- examples -> This is where we have many Python examples for you to look at
- mbientlab -> This is where the bindings reside
- Raspbian Buster with desktop 或者ubuntu 镜像
hcitool dev #查看蓝牙设备
sudo apt install bluetooth pi-bluetooth bluez blueman bluez-utils
systemctl status bluetooth
sudo /etc/init.d/bluetooth restart
lsusb #查看是否检测到蓝牙设备
agent on #allow us to search for and pair with other Bluetooth devices.
scan on #By scanning for devices, we can retrieve their MAC address and begin the process of pairing
#使用python3.6 进行开发
#relative developing dependency
sudo apt-get install build-essential
sudo apt-get install bluez
sudo apt-get install libboost-all-dev
sudo apt-get install libbluetooth-dev
#查看是否有编译工具,如果没有则使用apt进行下载
which g++
which gcc
which make
sudo apt-get install -y gcc-6 g++-6 clang-3.8
sudo apt-get install git-core
#use pip to install the metawear python package.
pip3 install metawear
pip3 install metawear --upgrade
pip3 list --user warble (local)
pip3 list warble (global / sudo)
# Download the Python API Code Repository
git clone https://github.com/mbientlab/MetaWear-SDK-Python.git
# example
from mbientlab.metawear import MetaWear, libmetawear
from mbientlab.metawear.cbindings import *
from mbientlab.warble import *
from mbientlab.metawear import *
from threading import Event
e = Event()
address = None
def device_discover_task(result):
global address
if (result.has_service_uuid(MetaWear.GATT_SERVICE)):
# grab the first discovered metawear device
address = result.mac
e.set()
BleScanner.set_handler(device_discover_task)
BleScanner.start()
e.wait()
BleScanner.stop()
device = MetaWear(address)
device.connect()
pattern= LedPattern(repeat_count= Const.LED_REPEAT_INDEFINITELY)
libmetawear.mbl_mw_led_load_preset_pattern(byref(pattern), LedPreset.BLINK)
libmetawear.mbl_mw_led_write_pattern(device.board, byref(pattern), LedColor.GREEN)
libmetawear.mbl_mw_led_play(device.board)
公司网址:
- https://github.com/mbientlab
- https://mbientlab.com/store/ 商店链接国内无法购买
4. 小米
硬件使用的是Miband3,用小米手环3来获取用户的睡眠数据。因为小米并没有提供小米手环的接口供开发者来调用 ,所以得多一步周转环节,利用小米手环的配套运动App:小米运动(MiFit)关联到谷歌健康(GoogleFit)上,当MiFit同步到手环上的数据之后,便会将数据同步到GoogleFit上面,如此便能够利用GoogleFit 提供给开发者的请求接口,将需要的数据从GoogleFit上获得到。
- https://dev.mi.com/docs/micloud/health/
5. GoFit
- https://github.com/GO-LiFE/GoFIT_SDK_Android 記錄包括步數、行走距離、熱量消耗及睡眠時間及品質