@nrfcloud/device-simulator

simulates nRF Connect for Cloud devices

Usage no npm install needed!

<script type="module">
  import nrfcloudDeviceSimulator from 'https://cdn.skypack.dev/@nrfcloud/device-simulator';
</script>

README

Device Simulator npm version

Build Status
Greenkeeper badge semantic-release Commitizen friendly

Command line utility for simulating a device connecting to and pairing with nRFcloud.com.

CLI Usage

Installation

mkdir simulator
cd simulator
npm init -y
npm i --save @nrfcloud/device-simulator

Usage

npx @nrfcloud/device-simulator \
  -c <configuration file from nrfcloud-cli> \
  -n <file with GPS NMEA sentences> \
  -a <file with accelerometer recording> \
  -t <file with thermometer recording> \
  -d <file with device info>

Example:

npx @nrfcloud/device-simulator \
  -c my-device.json \
  -n /tmp/nmea-recording.txt \
  -a __tests__/sensors/accelerometer-recording.txt \
  -t __tests__/sensors/thermometer-recording.txt \
  -d __tests__/sensors/device-info-recording.txt

Sensor Data

NMEA sentences

A GPS recording of NMEA sentences can be found here.

If you have curl installed:

curl -L -o /tmp/nmea-recording.txt "https://drive.google.com/uc?export=download&id=0BxDUQnmvFeMNOXM1ZmFFNHZZU2s"

If you want to make your own GPS data, head over to https://nmeagen.org. The "Multi-point line" seems to work best. Lay some points and then click the "Generate NMEA file" button.

Accelerometer samples

An accelerometer recording can be found here.

Thermometer samples

A thermometer recording can be found here here.

Device samples

A device info sample can be found here here.

Creating Devices and Certs

Use STAGE=dev STACK=dev node scripts/register-simulator.js to create a new certificate.

For more info see https://projecttools.nordicsemi.no/confluence/display/IRIS/nRF91+Simulator

Device configuration

To create a device configuration use nrfcloud-cli.

Example usage for adding a device to nRF Cloud (this is not associating a device with a tenant):

npx dist/cli.js device-register -t nsrn:devices:types/device/nordicsemi/nRF91/PCA10074/gpsFlipDemo/0 <your device id>