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).
@@ -35,15 +37,111 @@ Reach out to the [community](https://mbientlab.com/community/) if you encounter
35
37
36
38
## Getting Started
37
39
40
+
### Pre-Installation
41
+
42
+
#### Node and NPM
43
+
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.
44
+
45
+
We are currently supporting Node 10.23.0. Here are steps to install Node on Linux (Ubuntu). You have 3 options:
46
+
47
+
##### 1. You can install Node from the repositories:
48
+
```
49
+
sudo apt install nodejs
50
+
sudo apt install npm
51
+
nodejs -v
52
+
```
53
+
This will install the latest Node. You may need to alias nodejs to node.
This will install node v10.23.0 (latest stable release of node 10). You can replace the 10 with 12 if you want to install node 12. You may need to alias nodejs to node.
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.
75
+
76
+
##### Using sudo - a Warning
77
+
It is important to note that because our scripts use OS level Bluetooth libraries, it may be 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.
78
+
79
+
You also need to check that the version of node you are using is as expected for sudo:
80
+
```
81
+
$ node -v
82
+
v0.10.23
83
+
$ sudo node -v
84
+
v0.11.8-pre
85
+
```
86
+
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). You can google-fu more about this topic.
87
+
38
88
### 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
89
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.
90
+
You have two options for installation:
42
91
43
-
Then you can simply install the MetaWear NPM module with command line:
44
-
```javascript
92
+
#### 1. Use NPM
93
+
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.
94
+
95
+
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). Make sure you use our versions of these libraries as the original packages have been abandoned.
96
+
97
+
Then you can simply install the MetaWear package lib with NPM using the command line:
98
+
```
45
99
npm install metawear
46
100
```
101
+
This step takes a long time as all the packages are installed and the MetaWear CPP library will be compiled on your machine. You may or may not need to update.
102
+
```
103
+
npm update metawear
104
+
```
105
+
106
+
#### 2. Use our Repository
107
+
We packaged everything for you already in this repository with the package.json file ready to be installed with npm.
108
+
109
+
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:
115
+
```javascript
116
+
npm install
117
+
```
118
+
This step takes a long time as all the packages are installed and the MetaWear CPP library will be compiled as well.
119
+
120
+
Once the install is success, you can run our example scripts in the example folder:
121
+
```javascript
122
+
node led.js
123
+
```
124
+
125
+
Please note that depending on your node and npm installation, you may need to run sudo:
126
+
```javascript
127
+
sudo node led.js
128
+
```
129
+
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).
130
+
131
+
Please note that the examples in our examples folder will use the local metawear libraries (as this repository is meant for development):
132
+
```javascript
133
+
var MetaWear =require('../index')
134
+
```
135
+
This would be using the local metawear code. You will probably never need this unless you are planning to change our internal libraries.
136
+
137
+
Simply change it to this:
138
+
```javascript
139
+
var MetaWear =require('metawear');
140
+
```
141
+
This would be using the metawear code in your local npm `node_modules` directory as installed. This is the prefered way.
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