Using the Web IDE from Raspberry Pi

Posted on
of 2
/ 2
  • Hi. I'm trying to figure out how to control puck via Raspberry Pi Zero W, connected to my desktop PC (which doesn't have Bluetooth btw) via usb, connected to Internet by sharing local area network with it (not WiFI). I followed the steps on the EspruinoHub page and (after tons of problems with installing nodered due to some problem with the time/date on the Pi) finally I am at the point where typing "./" on putty finds and displays the 2 pucks I have.

    I am totally at a loss now how to start the Web IDE on the Raspbian Stretch Lite using putty. How/where do I run espruino-server, it says command not found. Would I need to upgrade to "Stretch with desktop" version so I can run Chromium using VNC? Is there any magical way I can run Web IDE from my desktop PC? Thanks.

  • So you installed from here, and you're running Putty on your PC communicating with the Pi over SSH?

    If so, just open a Web Browser (preferably Chrome as it's what I've tested with) and point it at http://yourdevice:1888/ide while is still running

    You shouldn't need espruino-server or anything else.

  • Yes exactly, that's what I did. By 'yourdevice' do you mean 'localhost', the ip of the Pi, or the name of the puck? The first two didn't work on Chrome.

  • It will need to be the IP address of the raspberry pi. This might work:

  • @Wilberforce thanks. I tried that but it still says the site can't be reached. I used "ping raspberrypi.local" on windows cmd and it works, if that means anything. I disabled also the antivirus, no luck still.

    Do I need to add something to PuTTY maybe for this to work?

  • When you run on the Pi, does it mention about port 1888 in the log messages that it shows?

    What commands are you currently using in PuTTY to get this to work? You mention that you're connected via USB, and I guess there may well be something odd about the way that works. Do you have link to the instructions you followed?

    Is there a reason you wouldn't just set it up to use WiFi?

  • @Gordon I just tried it now and it worked on Chrome at "raspberrypi.local:1888/ide/". Maybe resetting the router and PC did it. Of course now I don't have internet on the Pi for some reason, oh well, you can't have it all. I followed the instructions at­i-zero-ethernet-gadget/, but used ethernet instead of Wi-Fi.

    The reason I cannot connect it via Wi-Fi is that when my wife was pregnant she didn't like the idea having the router so near in the living room and we use ethernet cables on desktop and laptop from then, 2 years later we still use them.


  • Great! I guess it's not such a big deal if the Pi doesn't have Ethernet, since if the IDE needs anything it'll get it via the browser on your PC - which does have it.

    If you wanted to set something up long-term you could try something like this on the Pi Zero:­-port-usb-hub-with-ethernet-and-microb-c­onnector

    I've got one here and they're really neat. No config, you just put it in the micro USB socket and you've got proper Ethernet as if the Pi was right on the house's network, plus a bunch of USB Type A connectors free.

    ... or obviously there's the Pi 3 as well, but that's significantly more expensive.

  • That looks nice, I went ahead and ordered a similar one, thanks.

  • After seeing your video Gordon, I had to go set up a Pi3 with the Hub software! I'm hoping it gets rid of all my Windows BLE/Puck issues.

    However I've hit a glitch. When I access localhost:1888/ide and try to connect to my Puck, Chromium reports no ports available. But if I go to the usual, it works fine and I see the Web Bluetooth port. I've obviously enabled experimental web features on Chromium on the Pi.

    Is the online IDE running a slightly different version of the code or am I misunderstanding something?

  • I'm hoping it gets rid of all my Windows BLE/Puck issues.

    Try the new Web IDE download from­ive-application as well as one of the absolute latest firmwares (1v95.150something) - that should make life loads better.

    When I access localhost:1888/ide and try to connect to my Puck, Chromium reports no ports available

    Does it say anything in the debug console of Chromium? All you should need is Websockets - no fancy experimental features.

    You could also try running Chrome on your PC and going to http://raspberrypi.local:1888/ide - which is hopefully a bit easier. That's the idea really - chuck the Pi in the corner and then use your normal PC with the IDE :)

  • Ooh I hope so re Windows! Do I have to still re-pair every time I take the battery out of the Puck?

    If I can get the Pi method working, I'm definitely sticking with that.

    Ah the problem is http vs https. Chromium on Pi (and Chrome on PC) refusing to use Web Bluetooth when accessing IDE over http. Anything we can do with self-signed certs or something?

    Also has something changed in the online IDE very recently? I'm only getting Mac addresses now, not names. It still connects on Chrome/Windows. But on Chromium/Pi I get "Error NotFoundError: No services matching UUID blah-blah-blah found in device" in console.

  • Do I have to still re-pair every time I take the battery out of the Puck?

    I don't think so. You'll have to test though :)

    Web Bluetooth when accessing IDE over http

    Shouldn't be a problem - you don't need Web Bluetooth. That's the whole point - it all happens via Websockets.

    has something changed in the online IDE very recently? I'm only getting Mac addresses now, not names.

    On what platform? do you have a screenshot?

    If you're using Web Bluetooth on the Pi I have no control over what's displayed - that connection windows is 100% in Chrome.

  • A few websocket errors in console on Pi too. Screenshot attached.

    The mac address thing is happening on Windows/Chrome with the Web Bluetooth Polyfill. I'm not having a good Bluetooth day. The existing standalone IDE isn't even listing Web Bluetooth any more. Time to update it.

    1 Attachment

    • 2018-01-26-152851_1824x984_scrot.png
  • Quick update when testing on OSX:

    • It sees the names properly in the Web Bluetooth pop-up on the online IDE, not just hex
    • It can connect fine to the two devices using the online IDE
    • It gives same failure as Pi and Windows trying to use http://raspberrypi.local:1888/ide and can't see any ports

    So I guess the issue may be on something to do with the config of the Pi itself? This was an all new clean install of latest Raspbian from this morning and following all the steps for setting up Hub and WebIDE.

  • I'd expect those WebSocket errors accessing the main site. Also I have no idea on the status of Web Bluetooth on the Pi, but it's not guaranteed - Google's official position is 'not supported on Linux'.

    Can you post a picture of the console when accessing http://raspberrypi.local:1888/ide from OSX or Windows?

  • ... just to add, those Web Bluetooth errors on the Pi might be because you're trying to use Web Bluetooth at the same time as EspruinoHub is running?

  • I cleared a lot of the errors in Chromium on the Pi with a good old reboot. Now saying "Websockets> Connected" in Chromium console but still showing "Searching...No Ports Found" in the connection pop-up if I try to connect to anything (same on OSX and Windows trying to access http://raspberrypi.local:1888/ide)

  • Not much useful on Windows or OSX in the console.

    2 Attachments

    • Screenshot 2018-01-26 16.02.13.jpg
    • Screenshot 2018-01-26 16.04.18.jpg
  • What if you:

    • Reboot the Pi
    • don't run Chromium on it at all, since that could mess with BLE
    • Make sure the EspruinoHub server is running
    • Check http://raspberrypi.local:1888/status from another computer (does it show any BLE devices at all?)

    It feels like Noble is broken on the Pi somehow. Are you sure you followed the instructions about using setcap?

  • I did all of that (and disabled Web Bluetooth and rebooted). I also re-ran setcap to be sure.

    I also stopped the Hub service and ran it manually. It's showing 3 BLE devices including the two Espruino ones. But nothing appearing in IDE.

    Do I have to add anything to the IDE config to make the websockets-based "ports" appear?

    Or could it be related to the Pi not being able to see the Puck's name (and the generic nrf device running the DK firmware)? Does it filter by name to show the connection list?

    I'll update Puck now to latest firmware just in case. It's on official 1v95.

    1 Attachment

    • 2018-01-26-165935_1824x984_scrot.jpg
  • Is it because you've reprogrammed your Espruino devices to not name themselves 'Espruino' or 'Puck.js' any more? Try resetting one of them by holding the button when powering it on.

  • Progress! The Puck update to 1v95.153 caused it to be correctly identified by EspruinoHub (once) and it appeared as a connectable device on Windows. Unfortunately then it disappeared again and was just showing "?" for name, as above. Reboot of Pi didn't help.

    Then I did a full reset of the Puck and now all seems to be fine. Running Led on/off as we speak :-)

    But there is definitely some issue with names. I just tried a NodeConf EU badge running a pretty old version of the firmware from the event and it's showing up as "?" too. But a Garmin that came into the room immediately showed up in the Hub logs with the correct name.

    Does this new approach only work with 1v95.150+?

  • I tried an old 1v95 on the generic nRF device. It still appears as "?". When I try NRF.setAdvertising({},{name:"Puck 2"}) it stays as "?" on EspruinoHub but switches to the new name in the IDE on OSX.

    I've also tried some of the very new 1v95 nrf52832 builds but they refuse to connect at all (unrelated to this thread, I just noticed it last weekend).

    I'll try updating the badge now to see how that fares with latest 1v95.

  • Not 100% sure I've got a consistent answer but relatively new 1v95 on both nRF device and badge causes the Hub to see them with proper names. Everything seems to be working now. Could be all user error so thanks for your patience Gordon!

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

Using the Web IDE from Raspberry Pi

Posted by Avatar for Pi @Pi