Raspberry PI iC880A shield now have sensors and dashboard

Dear all,

Following this post and this one about a shield for Ic880A concentrator board, I took some time to install sensors using on board dedicated connectors

In the box you can see a BME280 (purple on the middle-top) for Pressure/Humidity/Temperature and below right (bottom for outside) a SI7021 into dedicated sleeve

And now, here sensors data on Cayenne, pretty isn’t it ?

I’ve updated building and setup repos to add these features

5 Likes

Nice work. Might be something that I can follow for my first real gw. One minor error (?) that you have linked to a 3.3 voltage regulator, should be a 5V?

thank you @sa5bke

There is no 3V3 regulator on board, just a 6-28V DC/DC step down to 5V. Where do you think there is 3.3V reg ?

Sorry. Should have been more precise. The ebay link on github is to a 3.3v regulator. :slight_smile:

I built the Gateway and it works fine, but sensors-js.service does not work. I receive the following messages:

● sensors-js.service - CH2i TTN Gateway Sensors service
Loaded: loaded (/lib/systemd/system/sensors-js.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Fri 2018-02-23 11:30:16 CET; 12s ago
Process: 671 ExecStart=/usr/bin/node /opt/ttn-gateway/bin/sensors.js (code=exited, status=1/FAILURE)
Main PID: 671 (code=exited, status=1/FAILURE)
Feb 23 11:30:16 ttn-gateway systemd[1]: sensors-js.service: Main process exited, code=exited, status=1/FAILURE
Feb 23 11:30:16 ttn-gateway systemd[1]: sensors-js.service: Unit entered failed state.
Feb 23 11:30:16 ttn-gateway systemd[1]: sensors-js.service: Failed with result ‘exit-code’.
Feb 23 11:30:16 ttn-gateway systemd[1]: sensors-js.service: Service hold-off time over, scheduling restart.
Feb 23 11:30:16 ttn-gateway systemd[1]: Stopped CH2i TTN Gateway Sensors service.
Feb 23 11:30:16 ttn-gateway systemd[1]: sensors-js.service: Start request repeated too quickly.
Feb 23 11:30:16 ttn-gateway systemd[1]: Failed to start CH2i TTN Gateway Sensors service.
Feb 23 11:30:16 ttn-gateway systemd[1]: sensors-js.service: Unit entered failed state.
Feb 23 11:30:16 ttn-gateway systemd[1]: sensors-js.service: Failed with result ‘exit-code’.

What goes wrong?

@HaSch
Been long not playing with this, did you enabled i2c with raspi-config ?

Also you can try to start the script by hand and put result here ?

sudo systemctl disable sensors-js.service
cd /opt/ttn-gateway/bin/
sudo node sensors.js

Yes, I enabled i2c.

Starting the script by hand succeeded:

ttn@ttn-gateway:~ $ sudo systemctl disable sensors-js.service
Removed /etc/systemd/system/multi-user.target.wants/sensors-js.service.
ttn@ttn-gateway:~ $ cd /opt/ttn-gateway/bin/
ttn@ttn-gateway:/opt/ttn-gateway/bin $ sudo node sensors.js
Cayenne connected
Si7021 reset failed: Error: , Remote I/O error
Found BMx280 chip ID 0x60 on bus i2c-1, address 0x76
BME280 initialization succeeded
BME280 data = {
“temperature_C”: 22.56,
“humidity”: 34.62856683736186,
“pressure_hPa”: 761.903171283745
}

What’s going wrong?

could you create a file nodejs.sh in /etc/profile.d/ that contains

NODE_PATH=/usr/lib/nodejs:/usr/lib/node_modules:/usr/share/javascript
export NODE_PATH

just to be sure ?

I did but the result is the same (see error message above)

Just a curiosity… if the box is sealed…how you can think to measure external humidity, pressure and temperature? :grinning:

Alex

there is an inside and an outside sensor

Ops sorry… Charles, what kind of material surrounding the SI7021?

https://www.aliexpress.com/item/Temperature-and-humidity-sensor-shell-protective-sleeve-SHT11-SHT21-SHT20-SHT30-SHT10/32776146080.html

It looks like the script automaticly first started and then quits unexpectedly:

ttn@ttn-gateway:~/ic880a-gateway/src/sensors_js $ sudo systemctl status sensors-js
● sensors-js.service - CH2i TTN Gateway Sensors service
Loaded: loaded (/lib/systemd/system/sensors-js.service; enabled; vendor preset: enabled)
Active: active (running) since Sun 2018-02-25 12:42:06 CET; 358ms ago
Main PID: 8841 (node)
CGroup: /system.slice/sensors-js.service
└─8841 /usr/bin/node /opt/ttn-gateway/bin/sensors.js

Feb 25 12:42:06 ttn-gateway systemd[1]: Started CH2i TTN Gateway Sensors service.
ttn@ttn-gateway:~/ic880a-gateway/src/sensors_js $ sudo systemctl status sensors-js
● sensors-js.service - CH2i TTN Gateway Sensors service
Loaded: loaded (/lib/systemd/system/sensors-js.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sun 2018-02-25 12:42:09 CET; 2s ago
Process: 8864 ExecStart=/usr/bin/node /opt/ttn-gateway/bin/sensors.js (code=exited, status=1/FAILURE)
Main PID: 8864 (code=exited, status=1/FAILURE)

Feb 25 12:42:09 ttn-gateway systemd[1]: sensors-js.service: Main process exited, code=exited, status=1/FAILURE
Feb 25 12:42:09 ttn-gateway systemd[1]: sensors-js.service: Unit entered failed state.
Feb 25 12:42:09 ttn-gateway systemd[1]: sensors-js.service: Failed with result ‘exit-code’.
Feb 25 12:42:09 ttn-gateway systemd[1]: sensors-js.service: Service hold-off time over, scheduling restart.
Feb 25 12:42:09 ttn-gateway systemd[1]: Stopped CH2i TTN Gateway Sensors service.
Feb 25 12:42:09 ttn-gateway systemd[1]: sensors-js.service: Start request repeated too quickly.
Feb 25 12:42:09 ttn-gateway systemd[1]: Failed to start CH2i TTN Gateway Sensors service.
Feb 25 12:42:09 ttn-gateway systemd[1]: sensors-js.service: Unit entered failed state.
Feb 25 12:42:09 ttn-gateway systemd[1]: sensors-js.service: Failed with result ‘exit-code’.

Maybe it’s helpful to look into the system log, here is the depending part:

Feb 28 12:56:52 ttn-gateway systemd[1]: Started CH2i TTN Gateway Sensors service.
– Subject: Unit sensors-js.service has finished start-up
– Defined-By: systemd
– Support: Debian -- User Support

– Unit sensors-js.service has finished starting up.

– The start-up result is done.
Feb 28 12:56:52 ttn-gateway sudo[3730]: pam_unix(sudo:session): session closed for user root
Feb 28 12:56:53 ttn-gateway sensors-js[3736]: /opt/ttn-gateway/bin/node_modules/bindings/bindings.js:88
Feb 28 12:56:53 ttn-gateway sensors-js[3736]: throw e
Feb 28 12:56:53 ttn-gateway sensors-js[3736]: ^
Feb 28 12:56:53 ttn-gateway sensors-js[3736]: Error: Module version mismatch. Expected 46, got 48.
Feb 28 12:56:53 ttn-gateway sensors-js[3736]: at Error (native)
Feb 28 12:56:53 ttn-gateway sensors-js[3736]: at Object.Module._extensions…node (module.js:434:18)
Feb 28 12:56:53 ttn-gateway sensors-js[3736]: at Module.load (module.js:343:32)
Feb 28 12:56:53 ttn-gateway sensors-js[3736]: at Function.Module._load (module.js:300:12)
Feb 28 12:56:53 ttn-gateway sensors-js[3736]: at Module.require (module.js:353:17)
Feb 28 12:56:53 ttn-gateway sensors-js[3736]: at require (internal/module.js:12:17)
Feb 28 12:56:53 ttn-gateway sensors-js[3736]: at bindings (/opt/ttn-gateway/bin/node_modules/bindings/bindings.js:81:44)
Feb 28 12:56:53 ttn-gateway sensors-js[3736]: at Object. (/opt/ttn-gateway/bin/node_modules/i2c-bus/i2c-bus.js:4:28)
Feb 28 12:56:53 ttn-gateway sensors-js[3736]: at Module._compile (module.js:409:26)
Feb 28 12:56:53 ttn-gateway sensors-js[3736]: at Object.Module._extensions…js (module.js:416:10)
Feb 28 12:56:53 ttn-gateway systemd[1]: sensors-js.service: Main process exited, code=exited, status=1/FAILURE
Feb 28 12:56:53 ttn-gateway systemd[1]: sensors-js.service: Unit entered failed state.
Feb 28 12:56:53 ttn-gateway systemd[1]: sensors-js.service: Failed with result ‘exit-code’.
Feb 28 12:56:53 ttn-gateway systemd[1]: sensors-js.service: Service hold-off time over, scheduling restart.
Feb 28 12:56:53 ttn-gateway systemd[1]: Stopped CH2i TTN Gateway Sensors service.
– Subject: Unit sensors-js.service has finished shutting down
– Defined-By: systemd
– Support: Debian -- User Support

– Unit sensors-js.service has finished shutting down.

No idea what’s going wrong?

What sensor did you used ?

would you min stop the service and start it by hand as indicated above to see what’s the output ?

looks like sensor not recognized, a clone one ?

As I wrote above: Starting by hand succeeded (see #7). I use a BME280 and it‘s not a clone.

Ok let’s restart from scratch

cd /opt/ttn-gateway
sudo systemctl stop sensors-js
sudo rm -rf node_modules
sudo npm install -g --unsafe-perm bme280-sensor
sudo npm install -g --unsafe-perm si7021-sensor
sudo npm install -g --unsafe-perm cayennejs
sudo npm link bme280-sensor
sudo npm link si7021-sensor
sudo npm link cayennejs
sudo systemctl start sensors-js

Does this works ?

BTW what nodejs version do you have ?

I tested on my new GW and this is working fine

loragw@ttn-gw04:/opt/loragw $ sudo systemctl status sensors-js.service
● sensors-js.service - CH2i Lora Gateway Sensors service
   Loaded: loaded (/lib/systemd/system/sensors-js.service; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2018-04-13 18:35:31 CEST; 21min ago
 Main PID: 10352 (node)
   CGroup: /system.slice/sensors-js.service
           └─10352 /usr/bin/node /opt/loragw/sensors.js

Apr 13 18:56:28 ttn-gw04 sensors-js[10352]: }
Apr 13 18:57:00 ttn-gw04 sensors-js[10352]: BME280 data = {
Apr 13 18:57:00 ttn-gw04 sensors-js[10352]:   "temperature_C": 38.67,
Apr 13 18:57:00 ttn-gw04 sensors-js[10352]:   "humidity": 18.941909695408516,
Apr 13 18:57:00 ttn-gw04 sensors-js[10352]:   "pressure_hPa": 997.5175459059838
Apr 13 18:57:00 ttn-gw04 sensors-js[10352]: }
Apr 13 18:57:00 ttn-gw04 sensors-js[10352]: SI7021 data = {
Apr 13 18:57:00 ttn-gw04 sensors-js[10352]:   "humidity": 32.761138916015625,
Apr 13 18:57:00 ttn-gw04 sensors-js[10352]:   "temperature_C": 29.759372558593746
Apr 13 18:57:00 ttn-gw04 sensors-js[10352]: }
loragw@ttn-gw04:/opt/loragw $ node -v
v9.11.1

I’ve also updated new setup (take care it’s no more /opt/ttn-gateway but /opt/loragw so may be you’ll need to adapt to reflect your old setup)

Thank you for your response. I will try as soon as I can but now I’m away from my GW until end of April.
Hans