Welcome to Our Community

Some features disabled for guests. Register Today.

CONTROL Software and Raspberry Pi

Discussion in 'Control Software' started by Gilbert Aguilar Jr, May 22, 2020.

  1. Ronald4418

    Ronald4418 Well-Known
    Builder

    Joined:
    Nov 4, 2015
    Messages:
    218
    Likes Received:
    33
    I have it and it was difficult there was a video on YouTube to get around it. Though now I am typing this on a Raspberry Pi 400. Booting off of a 256 GB. SSD.
     
  2. Ian Bevan

    Ian Bevan New
    Builder

    Joined:
    Jun 4, 2020
    Messages:
    3
    Likes Received:
    0
    Greetings

    Here to chip in with my similar experience with the rpi4 and OBC not starting. I have some logging and insights to add that will hopefully help the devs offer a fix (am software developer by trade myself but sadly not Node/JS).

    So similar to the other posters, I have started with a clean build and followed the latest instructions, and receive no errors along the way. Launching OBC seemingly does nothing - but in fact first impressions can be misleading! OBC is in fact running but an issue with the serial library is stopping Electron from launching properly.

    I can see the OBC is in fact running because I can connect to localhost:3000 from Chromium and get the UI. However the UI doesn't "work" because it says "Waiting for USB". By which I mean the buttons all work - for example I can load a gcode file - but of course OBC is near useless if it can't connect to the controller hardware.

    upload_2021-5-12_18-3-1.png


    Here's the terminal output that explains both that USB issue, and why Electron is not running (Sorry, not familiar with this forum software so don't know how to format this output better):

    pi@cnc-pi:~ $ ~/OpenBuilds-CONTROL/node_modules/.bin/electron ~/OpenBuilds-CONTROL
    App threw an error during load
    Error: The module '/home/pi/OpenBuilds-CONTROL/node_modules/serialport/node_modules/@serialport/bindings/build/Release/bindings.node'
    was compiled against a different Node.js version using
    NODE_MODULE_VERSION 72. This version of Node.js requires
    NODE_MODULE_VERSION 80. Please try re-compiling or re-installing
    the module (for instance, using `npm rebuild` or `npm install`).
    at process.func [as dlopen] (electron/js2c/asar.js:140:31)
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:1034:18)
    at Object.func [as .node] (electron/js2c/asar.js:140:31)
    at Module.load (internal/modules/cjs/loader.js:815:32)
    at Module._load (internal/modules/cjs/loader.js:727:14)
    at Function.Module._load (electron/js2c/asar.js:769:28)
    at Module.require (internal/modules/cjs/loader.js:852:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at bindings (/home/pi/OpenBuilds-CONTROL/node_modules/bindings/bindings.js:112:48)
    at Object.<anonymous> (/home/pi/OpenBuilds-CONTROL/node_modules/serialport/node_modules/@serialport/bindings/lib/linux.js:2:36)
    Error: The module '/home/pi/OpenBuilds-CONTROL/node_modules/serialport/node_modules/@serialport/bindings/build/Release/bindings.node'
    was compiled against a different Node.js version using
    NODE_MODULE_VERSION 72. This version of Node.js requires
    NODE_MODULE_VERSION 80. Please try re-compiling or re-installing
    the module (for instance, using `npm rebuild` or `npm install`).
    at process.func [as dlopen] (electron/js2c/asar.js:140:31)
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:1034:18)
    at Object.func [as .node] (electron/js2c/asar.js:140:31)
    at Module.load (internal/modules/cjs/loader.js:815:32)
    at Module._load (internal/modules/cjs/loader.js:727:14)
    at Function.Module._load (electron/js2c/asar.js:769:28)
    at Module.require (internal/modules/cjs/loader.js:852:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at bindings (/home/pi/OpenBuilds-CONTROL/node_modules/bindings/bindings.js:112:48)
    at Object.<anonymous> (/home/pi/OpenBuilds-CONTROL/node_modules/serialport/node_modules/@serialport/bindings/lib/linux.js:2:36)
    TypeError: Cannot read property 'address' of undefined
    at Server.<anonymous> (/home/pi/OpenBuilds-CONTROL/index.js:88:41)
    at Object.onceWrapper (events.js:312:28)
    at Server.emit (events.js:228:7)
    at emitListeningNT (net.js:1340:10)
    at processTicksAndRejections (internal/process/task_queues.js:80:21)
    TypeError: Cannot read property 'address' of undefined
    at Server.<anonymous> (/home/pi/OpenBuilds-CONTROL/index.js:92:41)
    at Object.onceWrapper (events.js:312:28)
    at Server.emit (events.js:228:7)
    at emitListeningNT (net.js:1340:10)
    at processTicksAndRejections (internal/process/task_queues.js:80:21)

    I took a punt and did a 'node rebuild' but it had no effect.

    Hope this helps somebody diagnose what we need to do to fix this!
     
    #32 Ian Bevan, May 12, 2021
    Last edited: May 12, 2021
  3. Ronald4418

    Ronald4418 Well-Known
    Builder

    Joined:
    Nov 4, 2015
    Messages:
    218
    Likes Received:
    33
    I wish someone would explain localhost:3000 to me so even a fool can understand it. Using an RPI 400 running the Twister OS, OBC runs like a charm and no modifications are needed.
     
  4. Ian Bevan

    Ian Bevan New
    Builder

    Joined:
    Jun 4, 2020
    Messages:
    3
    Likes Received:
    0
    Normally when you visit a website, you use something like "openbuilds.com". Localhost is a special name meaning "visit a website running on this computer" as opposed to one running on the internet for example.

    As for the 3000. When one computer connects to another, it uses what we call a "port", in this case port 3000. Think of it like a house number on a street if that helps. When you're just browsing the web you never need to worry about specifying a port, because your web browser automatically chooses port 80 for you (or port 443 if you are connecting to a secure website). So pointing your browser at "openbuilds.com" is just the same as pointing it at "openbuilds.com:80" - try it!

    So why do we need to use port 3000 for open builds control? The reason is that only one website can be exposed on any given port by your computer - much like only one house can have a particular house number in a street. Oftentimes though, you might want to have more than one website running on your computer. For example, I use cncjs on my rpi and I also use Openbuilds Control. So they don't clash, each of the picks a port number to run their website on (and hope they don't clash!). Openbuilds Control picked 3000, cncjs uses (I think) port 8080.

    So when I want to use Openbuilds Control's website, I use 'localhost:3000' in my browser - which means visit the website on this computer that's on port 3000. And when I want to use cncjs I use 'localhost:8080' instead.

    Does that help?
     
  5. Peter Van Der Walt

    Peter Van Der Walt OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Mar 1, 2017
    Messages:
    14,039
    Likes Received:
    4,123
    Try ~/OpenBuilds-CONTROL/node_modules/.bin/electron-rebuild as a test
     
  6. Ian Bevan

    Ian Bevan New
    Builder

    Joined:
    Jun 4, 2020
    Messages:
    3
    Likes Received:
    0
    I have now fixed this on my machine and OBC is running. I do get an error about autoupdate ("Error in auto-updater: Cannot check for updates: Error: Cannot find latest-linux-arm.yml [...]) but the software functions. I basically deleted all my packages, installed electron-rebuild, node -i and an electron-rebuild and it worked. I also added an explicit 'var sp = require('serialport');' to index.js but have no idea if this was actually necessary.

    I realise these are not steps that will make sense to regular users but hopefully will assist the devs with fixing the problem and providing concise instructions that are better (or different) to what I did. I was working semi-blind from a StackOverflow post so maybe some of what I did wasn't even necessary.
     
  7. David the swarfer

    David the swarfer OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Aug 6, 2013
    Messages:
    3,288
    Likes Received:
    1,837
    Ian explained most of it so I will try the next step.....

    If you click 'wizards and tools' and then 'mobile job widget' you get an address displayed, this is what I see
    http://192.168.1.81:3000/jog
    There is also a QR code, the square barcode thingy that you can scan with your smartphone.

    Connecting to that address with a phone or tablet or even a PC that is on the same network lets you use the mobile device as a jog pendant.

    So the difference here is the 'localhost:3000' would only work on the machine that is running OBControl, but the full address will work from any device on the local network.

    Knowledge is Power! (-:
     
  8. Peter Van Der Walt

    Peter Van Der Walt OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Mar 1, 2017
    Messages:
    14,039
    Likes Received:
    4,123
    Remember the codebase is multiplatform. Ignore as irrelevant to the Pi, we run from source, not from an installed package so Autoupdate is handled elsewhere (startup shortcut)

    Keep the note at the top of the Pi Wiki page in mind. Pi is still not an officially supported platform. Forever chasing an unstable dependency stack is no fun, so the instructions exist for folks willing to take a knack at it. Developers are not responsible for perfectly running Pi setups as its is NOT an official platform we support.


    If you do not want a full PC in the shop, rather get an OpenBuilds Interface

    [​IMG]
     
  9. Ronald4418

    Ronald4418 Well-Known
    Builder

    Joined:
    Nov 4, 2015
    Messages:
    218
    Likes Received:
    33
    Well many thanks to you and Ian for helping me to understand the localhost:3000, as I'd love to go back to using my RPI 400 because it is a heck of a lot faster in response time that my Windows 7 Laptop at running OBC. There is Zero Lag with the RPI. which can't be said for Windows 7.
     
  10. kth

    kth New
    Builder

    Joined:
    Aug 15, 2020
    Messages:
    20
    Likes Received:
    8
    Good job, glad you got past the install issue, it is a bit challenging but worth it 8^)

    This is my notes of my last install:

    sudo rm -r ~/OpenBuilds-CONTROL
    cd ~; git clone OpenBuilds/OpenBuilds-CONTROL
    cd ~/OpenBuilds-CONTROL; chmod 777 ~/.config
    rm ~/OpenBuilds-CONTROL/package-lock.json
    npm install -no-optional
    npm upgrade [email protected]
    npm upgrade [email protected]
    npm rebuild
    comment out startChrome(); in index.js

    As of the last several updates I get socket errors from permission issues on /var on launch from the command line but runs ok ran with sudo, not best to run like this but haven't looked into it as I run on a customized version so I only use it for reference. I run headless so I actually have a parallel install of a very slimmed down customized version with Electron and related stripped out and modified for me. I am using a 3+ and It runs at less then 10% so lots of available resources when not ran with the GUI as that would peak the CPU.

    After it is installed and running it doesn't always happen for me but when I find the 'Waiting for USB' I can refresh the web page and it will give serial options.

    It has been a great little platform for me but can be a bit finicky on installs and why it is not an official platform. Once you learn the install challenges it is not bad to maintain it. I have been trying to weaning off it and more to the interface for control but there are still some missing features that has me going back when needed.

    If you haven't checked out the interface it does not disappoint, it was a great addition!
     
    Peter Van Der Walt likes this.
  11. Peter Van Der Walt

    Peter Van Der Walt OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Mar 1, 2017
    Messages:
    14,039
    Likes Received:
    4,123
    (; make sure we know what you're missing (;
     
  12. Peter Van Der Walt

    Peter Van Der Walt OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Mar 1, 2017
    Messages:
    14,039
    Likes Received:
    4,123
    Took some of my personal, off-work time and updated the Install script, and tested against a clean install of 2021-03-04-raspios-buster-armhf.img

    So, to recap:
    - Pi4
    - 2021-03-04-raspios-buster-armhf.img
    - Followed OpenBuilds/OpenBuilds-CONTROL exactly

    Working in Electron, on first start creates the systray Icon just like Windows does:
    upload_2021-5-13_15-53-55.png

    Use this icon, or a second run of the desktop Icon to launch the Electron GUI: (doesn't open by default, because there are users that run it minimized on the Pi (less resources) and just access it over the Pi's IP from a browser on another PC.
    Serial port etc all working, connecting just fine to my test BlackBox.

    upload_2021-5-13_15-55-25.png

    Web interface works too:

    I am on my main desktop, RDP'd into the Pi, and in the foreground is a Chrome instance on my desktop, pointed at the Pi's IP:3000

    upload_2021-5-13_15-59-35.png
     
    David the swarfer and sharmstr like this.
  13. kth

    kth New
    Builder

    Joined:
    Aug 15, 2020
    Messages:
    20
    Likes Received:
    8
    Thank you again for still working on this!

    Curious, if you launch from a console do you get any errors? The last few updates (by the firmware.bin it's probably since interface was added?) I get these errors unless run with sudo

    pi@raspberrypi:~/OpenBuilds-CONTROL $ node index.js
    Running on Raspberry Pi!
    https: listening on:192.168.1.6:3001
    http: listening on:192.168.1.6:3000
    [Error: EACCES: permission denied, open '/var/local/firmware.bin'] {
    errno: -13,
    code: 'EACCES',
    syscall: 'open',
    path: '/var/local/firmware.bin'
    }
    [Error: EACCES: permission denied, open '/var/local/firmware.bin'] {
    errno: -13,
    code: 'EACCES',
    syscall: 'open',
    path: '/var/local/firmware.bin'
    }
    Created Uploads Temp Directory
    Error [ERR_STREAM_DESTROYED]: Cannot call write after a stream was destroyed
    at doWrite (_stream_writable.js:399:19)
    at writeOrBuffer (_stream_writable.js:387:5)
    at WriteStream.Writable.write (_stream_writable.js:318:11)
    at IncomingMessage.ondata (_stream_readable.js:718:22)
    at IncomingMessage.emit (events.js:314:20)
    at addChunk (_stream_readable.js:297:12)
    at readableAddChunk (_stream_readable.js:272:9)
    at IncomingMessage.Readable.push (_stream_readable.js:213:10)
    at HTTPParser.parserOnBody (_http_common.js:135:24)
    at TLSSocket.socketOnData (_http_client.js:474:22) {
    code: 'ERR_STREAM_DESTROYED'
    }
    Error [ERR_STREAM_DESTROYED]: Cannot call write after a stream was destroyed
    at doWrite (_stream_writable.js:399:19)
    at writeOrBuffer (_stream_writable.js:387:5)
    at WriteStream.Writable.write (_stream_writable.js:318:11)
    at IncomingMessage.ondata (_stream_readable.js:718:22)
    at IncomingMessage.emit (events.js:314:20)
    at addChunk (_stream_readable.js:297:12)
    at readableAddChunk (_stream_readable.js:272:9)
    at IncomingMessage.Readable.push (_stream_readable.js:213:10)
    at HTTPParser.parserOnBody (_http_common.js:135:24)
    at TLSSocket.socketOnData (_http_client.js:474:22) {
    code: 'ERR_STREAM_DESTROYED'
    }
    Error: Parse Error: JS Exception
    at TLSSocket.socketOnData (_http_client.js:474:22)
    at TLSSocket.emit (events.js:314:20)
    at addChunk (_stream_readable.js:297:12)
    at readableAddChunk (_stream_readable.js:272:9)
    at TLSSocket.Readable.push (_stream_readable.js:213:10)
    at TLSWrap.onStreamRead (internal/stream_base_commons.js:188:23) {
    bytesParsed: -939886,
    code: 'HPE_JS_EXCEPTION',
    reason: 'JS Exception',
    rawPacket: <Buffer 15 40 29 28 15 40 29 28 15 40 29 28 15 40 80 2b 15 40 29 28 15 40 1d 28 15 40 0e 28 15 40 80 2b 15 40 80 2b 15 40 80 2b 15 40 29 28 15 40 0e 28 15 40 ... 1328 more bytes>
    }
    Error: Parse Error: JS Exception
    at TLSSocket.socketOnData (_http_client.js:474:22)
    at TLSSocket.emit (events.js:314:20)
    at addChunk (_stream_readable.js:297:12)
    at readableAddChunk (_stream_readable.js:272:9)
    at TLSSocket.Readable.push (_stream_readable.js:213:10)
    at TLSWrap.onStreamRead (internal/stream_base_commons.js:188:23) {
    bytesParsed: -939886,
    code: 'HPE_JS_EXCEPTION',
    reason: 'JS Exception',
    rawPacket: <Buffer 15 40 29 28 15 40 29 28 15 40 29 28 15 40 80 2b 15 40 29 28 15 40 1d 28 15 40 0e 28 15 40 80 2b 15 40 80 2b 15 40 80 2b 15 40 29 28 15 40 0e 28 15 40 ... 1328 more bytes>
    }
     
  14. Peter Van Der Walt

    Peter Van Der Walt OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Mar 1, 2017
    Messages:
    14,039
    Likes Received:
    4,123

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice