Raspberry PI 2 EspruinoHub install errors

Posted on
  • I have a Raspberry Pi 3 and 2 and have successfully installed the EspruinoHub software on the Pi 3, but am having real problems in compiling the code on the Pi2. The following is an extract of the install and errors following the compile. Any help to diagnose why it is failing to compile would be very gratefullly received.

    Thank you.

    pi@raspberrypi2:~/EspruinoHub $ npm install
    npm WARN npm npm does not support Node.js v0.10.29
    npm WARN npm You should probably upgrade to a newer version of node as we
    npm WARN npm can't make any promises that npm will work with this version.
    npm WARN npm You can find the latest version at https://nodejs.org/
    
    > usb@1.2.0 install /home/pi/EspruinoHub/node_modules/usb
    > node-pre-gyp install --fallback-to-build
    
    node-pre-gyp ERR! Tried to download: https://github.com/tessel/node-usb/relea­ses/download/1.2.0/usb_bindings-v1.2.0-n­ode-v11-linux-arm.tar.gz 
    node-pre-gyp ERR! Pre-built binaries not found for usb@1.2.0 and node@0.10.29 (node-v11 ABI) (falling back to source compile with node-gyp) 
    make: Entering directory '/home/pi/EspruinoHub/node_modules/usb/b­uild'
      CC(target) Release/obj.target/libusb/libusb/libusb/­core.o
    
    --- Snip ---
    
    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: xpc-connection@~0.1.4 (node_modules/bleno/node_modules/xpc-con­nection):
    npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for xpc-connection@0.1.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"arm"})
    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: xpc-connection@~0.1.4 (node_modules/noble/node_modules/xpc-con­nection):
    npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for xpc-connection@0.1.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"arm"})
    npm WARN EspruinoHub@0.0.0 No repository field.
    npm WARN EspruinoHub@0.0.0 license should be a valid SPDX license expression
    pi@raspberrypi2:~/EspruinoHub $ 
    pi@raspberrypi2:~/EspruinoHub $ cd ..
    pi@raspberrypi2:~ $ node -v
    v0.10.29
    pi@raspberrypi2:~ $ sudo setcap cap_net_raw+eip $(eval readlink -f `which node`)
    pi@raspberrypi2:~ $ 
    pi@raspberrypi2:~ $ 
    pi@raspberrypi2:~ $ cd EspruinoHub/
    pi@raspberrypi2:~/EspruinoHub $ ./start.sh 
    setterm: terminal xterm-256color does not support --blank
    
    /home/pi/EspruinoHub/node_modules/mqtt/l­ib/connect/index.js:100
        const isSecure = ['mqtts', 'wss'].indexOf(opts.protocol) !== -1
        ^^^^^
    SyntaxError: Use of const in strict mode.
        at Module._compile (module.js:439:25)
        at Object.Module._extensions..js (module.js:474:10)
        at Module.load (module.js:356:32)
        at Function.Module._load (module.js:312:12)
        at Module.require (module.js:364:17)
        at require (module.js:380:17)
        at Object.<anonymous> (/home/pi/EspruinoHub/node_modules/mqtt/­mqtt.js:12:15)
        at Module._compile (module.js:456:26)
        at Object.Module._extensions..js (module.js:474:10)
        at Module.load (module.js:356:32)
    pi@raspberrypi2:~/EspruinoHub $ 
    
    
  • I installed first on an RPi2 and the Hub install went well. Lots of warnings and all that but it did start up in the end.

    Just curious, are you on the latest OS build for the Pi? Did you update and upgrade all packages before the install? That's one place where I deviated from the instructions.

  • Yes - I think it's possible that you could be using an old version of the OS? I'd re-install the latest version of Raspbian onto the SD card.

  • Yes, I did what most guidelines recommend and that is to apt-get update / upgrade etc.

    So the sequence as far as I remember I tried twice was:

    1) Download latest minimal Raspberry jessie, followed by apt-get update and apt-get upgrade.

    For the node, nodered, npm, mosquitto and bluetooth installs I did each stage one at a time and followed any recommendations to run apt-get autoremove.

    Each stage was straight forward with one or two warnings all the way except for EspruinoHub.

    Prior to git cloning, I needed to run apt-get install git as it was not included on the jessie image.

    The rest of the problems appeared following the node install of EspruinoHub.

    The fact that it was exactly the same on two clean attempts made me think it could be the hardware platform was out of step. It uses a third party bluetooth USB dongle, but the OS was happy with the dongle in the full graphics install of Raspbian as I could see the Pucks in the list of devices to pair to.

    If anyone else has any clues or needs a fuller description of what I did, I have included the entire install log in this response. Perhaps it will give some clues as to where I have gone wrong.


    1 Attachment

  • Following on from some online searching I decided to upgrade node from 0.10.12 to the latest version using the following commands:
    npm cache clean -f
    npm install -g n
    n stable

    After a re-compile it all worked!
    I was under the understanding that the latest version of npm would not work on the Pi and is why you enter:

    sudo npm -g install npm node-gyp

    I think this is where node goes down to 0.10??

    Anyway, the package complied with lot's of depreciated warnings but now runs.
    I will now try to re-produce the install without ending up with node at 0.10.nn. This may also be the root cause of the other problems I have with EspruinoHub crashing when connecting to a Puck.

  • Interesting that our experiences were so different in virtually the same environment. Only possible difference I see is that I don't think I downloaded a 'minimal' Jesse. I don't recall the link but the image file I downloaded was 2016-11-25-raspbian-jessie.img with a file size of 4,269,056 KB as reported by Win7. I checked my terminal history so I know for sure I did not have to separately install git. The version of node on my working system is v0.10.29

  • Yes - that could be it. Maybe the docs should be more explicit not to install the minimal version.

    I wonder what other packages the minimal version is missing that make installing fail though

  • I am working on this now @gordon.
    I wanted the lite version to enable max disk space for data logging. The only missing package was git on the lite Raspian build. It was included on the full version, which also includes node-red and nodejs installed.

    I am trying to work out exactly what the right sequence is for getting a Pi working correctly and it is proving to be a challenge.

    The problem I am having now is that the EspruinoHub builds and runs but any write attempt to a Puck produces a connection error:

    MQTT>/ble/write/c6:62:41:ed:7f:9a/nus/nu­s_tx => "LED1.set();\n"
    Service 	6e400001b5a3f393e0a9e50e24dcca9e
    Characteristic 	6e400002b5a3f393e0a9e50e24dcca9e
    <Connect> Error Connecting
    MQTT>/ble/write/c6:62:41:ed:7f:9a/nus/nu­s_tx => "LED1.set();\n"
    Service 	6e400001b5a3f393e0a9e50e24dcca9e
    Characteristic 	6e400002b5a3f393e0a9e50e24dcca9e
    <Connect> Error Connecting
    
    Mon Jan 09 2017 19:56:22 GMT+0100 (CET)
    
    0d:25:f9:7c:fc:bd - ? (RSSI -90)
    51:48:02:6a:53:7f - ? (RSSI -57)
    63:ca:e3:eb:70:13 - ? (RSSI -68)
    6c:44:6f:bd:c8:68 - ? (RSSI -90)
    77:e3:27:ba:50:5e - ? (RSSI -65)
    7a:db:3d:87:00:b6 - ? (RSSI -77)
    b4:18:d1:ea:c6:9c - ? (RSSI -59)
    b8:27:eb:09:dd:d5 - EspruinoHub (RSSI -81)
    b8:e8:56:34:55:03 - ? (RSSI -92)
    c6:62:41:ed:7f:9a - Puck.js 7f9a (RSSI -77)
    c8:69:cd:5f:da:d4 - ? (RSSI -87)
    f2:0f:7b:b3:b2:70 - Puck (RSSI -89)
      1809 => {"temp":4}
      180f => {"battery":100}
      2a00 => {"type":"Buffer","data":[80,117,99,107,7­8,97,109,101]}
    fd:f9:15:7f:43:07 - Puck.js 4307 (RSSI -85)
      2a00 => {"type":"Buffer","data":[3]}
    

    I am not completely happy with nodejs at version 0.10.12 and have just managed to find a way to upgrade it to 7.4 on the Pi, but I have yet to build the rest of the packages based on this version.
    Everything was retrospectively patched just to get the EspruinoHub compiled without errors.
    I need to find a workflow that builds everything correctly and it's taking multiple attempts to work this out.

    I will report back when I have an update.

  • Ok, thanks for the update!

    Is this on the Pi 2? Have you ever had it working?

    I guess potentially there may be some problem with the Bluetooth Dongle you're using?

  • Hi Gordon,
    Yes this is the Pi2 with a third party USB bluetooth dongle.
    It appears to work as a receiver, but not as a transmitter. It is new bluetooth dongle but I guess it could be faulty or incompatible.

  • What's the type of dongle? It's unlikely to be broken, but I guess there could be some driver issues with it.

    And exactly the same install steps work fine on a Raspberry Pi 3?

  • The dongle is a Trust 18187 bluetooth 4 dongle.

    I have now duplicated a working install flow for the Pi3 and Pi2 that throws virtually no errors and installs more up to date versions of node and npm and node-red.

    The first thing I did is NOT use the Raspian Lite build. Instead I installed Raspian Jessie full version to the sd card and proceeded with the following steps:

    node-red-stop
    sudo apt-get remove nodered
    sudo apt-get remove nodejs nodejs-legacy
    sudo apt-get remove npm # if you installed npm

    curl -sL https://deb.nodesource.com/setup_4.x | sudo bash -
    sudo apt-get install -y build-essential python-rpi.gpio nodejs

    node -v
    v4.7.2

    npm -v
    2.15.11

    sudo npm -g install npm node-gyp
    npm -v
    4.0.5

    sudo npm cache clean
    sudo npm install -g --unsafe-perm node-red

    sudo apt-get install mosquitto mosquitto-clients
    sudo apt-get install bluetooth libbluetooth-dev libudev-dev

    git clone https://github.com/espruino/EspruinoHub
    cd EspruinoHub
    npm install
    sudo setcap cap_net_raw+eip $(eval readlink -f `which node`)
    ./start.sh

    To get node-red running from the command line:

    node-red-pi --max-old-space-size=128

    Both Pi's ran and could see all the devices, but the Pi2 could not write any data.
    I will now try another bluetooth dongle to see if that is the problem.

  • Please could you try updating EspruinoHub again (the Espruino version). I just made some changes that might help, or at least might give some error more helpful than Error Connecting.

    What I think could have been happening is that the recent stuff started listening for advertisements again before the connection had completed, which then broke the connection.

  • Hi @Gordon,
    The new build for the Rp2 I have, reports:

    Error Connecting: Error: Command Disallowed

    The Rp3 build using exactly the same OS and versions of node etc, does not return an error as it does connect OK, but is still very flakey.

    The scan stopped and scan started messages are displayed as you hinted to, but it will possibly work once on first launch, but after a few unsuccessful attempt to write, it exits due to no scan results:

    Scanning stopped.
    disconnected!
    Scanning started.
    Scanning started.
    Scanning stopped.
    Scanning stopped.
    Scanning stopped.
    Scanning stopped.
    Timed out getting services. Disconnecting.
    Scanning started.
    BLE broken? No advertising packets in 10 seconds - restarting!

    BTW, was this update intended to help fix the RP2 disconnection thread
    http://forum.espruino.com/conversations/­297940/ or this thread?

  • I'd hoped it might help with either. I forget what I did but I managed to get 'Error Connecting', and this fixed it.

    I am however still using Node v0.10.29 though - I wonder if there was some kind of difference. Strange thing is in the stuff you mention above it's as if node-red came pre-installed, and I was pretty certain it didn't when I did the instructions.

  • Just to add, how near are your Puck.js devices to the Pi? If they're some distance away or on the other side of walls the connection might be bad just because there's bad radio reception

  • It's a bit of a mix of fortunes really.
    Raspian has been shipping node-red for some time and it comes with node 0.10.29 pre-installed. The Rpi3 compiled and ran using v0.10.27 but the disconnection errors were creating problems as reported in the other thread.

    The older Rpi2 would not compile EspruinoHub using v0.10.27 hence the drive to go up in revision. Now its on node v4.7.2 everything compiles and works in read mode, but not write. I still think you may have something about the dongle drivers etc. I think it's worth getting a second BLE dongle and re-try.

    Thank you for all your efforts. It must be a nightmare trying to juggle so many OS versions and hardware revisions.

    FYI When we spoke about this during the Kickstarter funding, I did ask about doing this as a bridge to get the Pucks into an IoT system that is web connected. node-red does a good job at bridging this technology, but you also recommended backing the new Onion project, which I did. I expect my Onion to be in Spain next week, so am intrigued to know if EspruinoHub will work for the Onion also.

  • Forgot to add that the Pucks are on the same table as the Pi's. All within a metre or two. One thing did come to mind in that in the scan there are around 10 advertising devices near the Pi. If there are so many, could they be delaying the responses, or blocking the responses from the Puck that is trying to respond?

    Perhaps I should increase the power to 0dBm to see if it improves the results?

    Also, having the EspruinoHub report the results of the scan does seem an additional overhead in the timing. I wonder if it's possible to mute the scan results to see if the writing to console may be making a difference?

  • wrt Onion: I got mine about the same time as everyone else and haven't had time to get it working yet. It should work about the same, but as there's no BLE I imagine you'll have the exact same BLE dongle issues!

    EspruinoHub does provide the HTTP proxy service (if enabled in the config), so you can use it to send stuff to the net. It's quite limited at the moment due to the size of the URL/data being limited to 20 chars, but I hope to fix that at some point.

    Also, eventually I will be adding proper IPv6 support to Puck.js, which will then give you proper internet access (however that'll require some other software to be set up on the Pi!).

    EspruinoHub only reports once a second or so (advertising is handled silently as it comes in), so it's unlikely to be a problem I think. I wouldn't have thought 10 devices cause trouble, however if they are all advertising quickly (100ms or so) I guess it's more likely they'd interfere.

    Bluetooth LE uses 3 distinct channels and spreads advertising over all 3 of them - I'm starting to wonder if maybe some Bluetooth LE adaptors only listen on one channel, which would make connecting far worse.

    If you can log into your Pucks from another device, maybe you could use NRF.setAdvertising to set the advertising interval to 100ms (it's usually 375ms) - it'll run the battery down a bit quicker but I wonder whether it'd make connections more reliable for you.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Raspberry PI 2 EspruinoHub install errors

Posted by Avatar for Eric @Eric

Actions