Babylon.js serial port communication

Does anyone know if it’s possible to get BJS to communicate with an Arduino over a serial port, and separately, a motion control board over USB? I want wired connections, rather than wireless ones so there’s no WiFi setup or complications.

With respect to Arduino comms over serial, I can only find Node.js serial port examples - I’m not sure how to get this working with BJS.

With respect to the moco board over USB, I’ve got no idea where to start.

this is a good question for @PirateJC

Oh man I LOVE this question. I’m a huge fan of connecting IOT devices and microcontrollers to Babylon.

Unfortunately I only have experience messing around with the wireless methods of communication.

That said I know that we’ve had a few community members who have had success with wired communication.

@ilhamachmada showed off a pretty awesome project in this vein here:

Also if I remember correctly, I think @bigrig showed off a cool project with a wired boxing glove controlling a virtual one at one point.

1 Like

Yep. Here’s the demo using wired:

Wireless:

And here, using camera to track motion:

1 Like

Hello! It is possible to connect BJS with Arduino over a serial port using Node JS. You could use node-serialport package (About SerialPort | Node Serialport), it is easy to understand. Node-serialport will allow you to send and recieve data from arduino to node js. You will also need to socket.io to stream your data from the serial port into your BJS page. I hope it helps you.

1 Like

@PirateJC It was your YouTube video that inspired me! Thank you for that. I looked at the Arduino Robot Arm example, but couldn’t figure it out as there are lots of files and bits and bobs.

@benrigby Knockout! I’ll take a look at your work for sure.

@ilhamachmada Thank you for pointers for serial port use - this helps a lot.

1 Like