You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 20, 2025. It is now read-only.
SDK for creating MetaWear apps that run on node.js. Supported mainly on Linux but can also work on Windows, OS X and the Browser (web-bluetooth support not widespread yet, but growing) if Noble is setup correctly. This is a thin wrapper around the [MetaWear C++ API](https://github.com/mbientlab/Metawear-CppAPI) so you will find the C++ [documentation](https://mbientlab.com/cppdocs/latest/) and [API reference](https://mbientlab.com/docs/metawear/cpp/latest/globals.html) useful.
9
+
SDK for creating MetaWear apps that run on node.js. Supported on Linux only.
10
10
11
-
Also, check out the JavaScript [examples](https://github.com/mbientlab/MetaWear-SDK-JavaScript/tree/master/examples). Again, supported on Linux only out-of-the-box.
11
+
This is a thin wrapper around the [MetaWear C++ API](https://github.com/mbientlab/Metawear-CppAPI) so you will find the C++ [documentation](https://mbientlab.com/cppdocs/latest/) and [API reference](https://mbientlab.com/docs/metawear/cpp/latest/globals.html) useful.
12
12
13
-
Under the hood it uses [Noble](https://github.com/mbientlab/noble) for Bluetooth Low Energy communications.
13
+
Also, check out the JavaScript [examples](https://github.com/mbientlab/MetaWear-SDK-JavaScript/tree/master/examples).
14
+
15
+
Under the hood it uses [Noble-Device](https://github.com/mbientlab/noble-device) and [Noble](https://github.com/mbientlab/noble) for Bluetooth Low Energy communications. These third party libraries have been abandoned and we are currently supporting a custom fork (with help from @abandonware).
14
16
15
17
> ADDITIONAL NOTES
16
-
You can try to get our JS SDK running on OSX or Windows at your own risk as this requires that you get Noble to work under those OSs yourself. We do not provide examples or support for this. Please see the Noble README.
18
+
You can try to get our JS SDK running on OSX or Windows at your own risk. This requires that you get Noble to work under those OSs yourself. We do not provide examples or support for this; experts ONLY. Please see the Noble README.
17
19
18
20
### Overview
19
21
20
22
[MetaWear](https://mbientlab.com) is a complete development and production platform for wearable and connected device applications.
21
23
22
-
MetaWear features a number of sensors and peripherals all easily controllable over Bluetooth 4.0 Low Energy using this SDK, no firmware or hardware experience needed!
24
+
MetaWear features a number of sensors and peripherals all easily controllable over Bluetooth 4.0/5.0 Low Energy using this SDK, no firmware or hardware experience needed!
23
25
24
26
The MetaWear hardware comes pre-loaded with a wirelessly upgradeable firmware, so it keeps getting more powerful over time.
25
27
26
28
### Requirements
27
29
-[MetaWear board](https://mbientlab.com/store/)
28
-
- A linux machine with Bluetooth 4.0 (or the other OSs w/ Bluetooth support at your own risk)
30
+
- A linux machine with Bluetooth 4.0/5.0
29
31
30
32
### License
31
33
See the [License](https://github.com/mbientlab/MetaWear-SDK-JavaScript/blob/master/LICENSE.md).
@@ -36,14 +38,110 @@ Reach out to the [community](https://mbientlab.com/community/) if you encounter
36
38
## Getting Started
37
39
38
40
### Installation
39
-
The Mbient JavaScript SDK relies on [Noble](https://github.com/mbientlab/noble) for Bluetooth Low Energy communications. You need to setup the relevant [prerequisites for Noble](https://github.com/mbientlab/noble#prerequisites) and then [install Noble](https://github.com/mbientlab/noble#install).
40
41
41
-
You should familiarize yourself with this README and our tutorials since there a few limitiations and other gotchas spelled out, such as the maximum number of simultaneous Bluetooth connections.
42
+
#### Requirements
43
+
44
+
##### 0. Node and NPM
45
+
You need to make sure you have node and npm installed on your machine. Here's a quick rundown but you should google-fu proper steps for your specific OS and Node version.
46
+
47
+
We are currently supporting Node 10.23.0. Here are steps to install Node on Linux (Ubuntu). You have 3 options:
Check the latest version of NVM before you install (it might be higher than v0.35.3). You can go online to learn how to use NVM to switch node versions on the fly.
81
+
82
+
It is important to note that because our scripts use the Bluetooth libraries of the OS, it is required to use sudo (or you will get a warning and the scripts won't work). You need to decide if you are ok to use sudo or not.
83
+
84
+
You also need to check that the version of node you are using is as expected for sudo:
85
+
```
86
+
$ node -v
87
+
v0.10.23
88
+
$ sudo node -v
89
+
v0.11.8-pre
90
+
```
91
+
As you can see here, the sudo node version is not the same as the current user version. Here's a [workaround](https://stackoverflow.com/questions/21215059/cant-use-nvm-from-root-or-sudo).
92
+
93
+
You have two options for installation:
94
+
95
+
##### 1. Use NPM
96
+
The Mbient JavaScript SDK relies on [Noble](https://github.com/mbientlab/noble) and [Noble-Device](https://github.com/mbientlab/noble-device) for Bluetooth Low Energy communications.
97
+
98
+
You need to setup the relevant [prerequisites for Noble](https://github.com/mbientlab/noble#prerequisites) and then [install Noble](https://github.com/mbientlab/noble#install).
99
+
100
+
Make sure you use our versions of these libraries as the original packages have been abandoned.
42
101
43
-
Then you can simply install the MetaWear NPM module with command line:
102
+
Then you can simply install the MetaWear package lib with NPM using the command line:
44
103
```javascript
45
104
npm install metawear
46
105
```
106
+
This step takes a long time as all the packages are installed and the MetaWear CPP library will be compiled on your machine.
107
+
108
+
##### 2. Use our Repository
109
+
We packaged everything for you already in this repository with the package.json file ready to be installed with npm.
110
+
111
+
Make sure that when you clone this repository, that you clone the submodule with it.
Then you can simply install all the dependencies you need by building the npm project with command line:
117
+
```javascript
118
+
npm install
119
+
```
120
+
This step takes a long time as all the packages are installed and the MetaWear CPP library will be compiled as well.
121
+
122
+
Once the install is success, you can run our example scripts in the example folder:
123
+
```javascript
124
+
node led.js
125
+
```
126
+
127
+
Please note that depending on your node and npm installation, you may need to run sudo:
128
+
```javascript
129
+
sudo node led.js
130
+
```
131
+
This can be avoided with proper installation steps but it will depend on whether or not your application and requirements are ok with sudo or not (to each their own).
132
+
133
+
Please note that the examples in our examples folder will use the local metawear libraries (as this repository is meant for development):
134
+
```javascript
135
+
var MetaWear =require('../index')
136
+
```
137
+
138
+
Simply change it to this:
139
+
```javascript
140
+
var MetaWear =require('metawear');
141
+
```
142
+
143
+
##### Notes
144
+
You should familiarize yourself with this README and our tutorials since there a few limitiations and other gotchas spelled out, such as the maximum number of simultaneous Bluetooth connections.
0 commit comments