Arduino on Cloud 9?


#1

Probably another question that the answer can’t be done, but has anyone used Cloud 9 with a java plugin to access a users serial port? This would be for Cloud 9 & Arduino communication. I know that BeagleBone and the Particle.io Photon can use Cloud 9 since they work through Wifi. Any chance of a direct USB serial connection with Cloud 9?


#2

You can do it using ChiliPeppr’s Serial Port JSON Server. The new Arduino Web IDE, that isn’t quite launched yet, is based on ChiliPeppr’s SPJS. So, if you install SPJS you can speak to it over websockets from Cloud9. It has an avrdude and bossac embedded so you can program. However, if you’re going to compile the code you’ll need to install the compiling toolchain inside cloud9 via the command line. Then you can talk to the serial port via SPJS. I’ve not set it all up either, but in theory it’s totally doable.

As it stands I currently build and deploy SPJS inside Cloud9. SPJS is built in Go. You don’t need to build it as you can just use the appropriate binary available from https://github.com/chilipeppr/serial-port-json-server/releases


#3

So to get started with serial on my Cloud 9 site do these commands make sense to install it

wget https://github.com/chilipeppr/serial-port-json-server/releases/download/v1.88/serial-port-json-server-1.88_linux_amd64.tar.gz -O /home/ubuntu/workspace/serial-port-json-server-1.88_linux_amd64.tar.gz

tar -xvzf /home/ubuntu/workspace/serial-port-json-server-1.88_linux_amd64.tar.gz -C /home/ubuntu/workspace/

rm serial-port-json-server-1.88_linux_amd64.tar.gz

#4

You got it. Now, keep in mind SPJS has to be running on the host that has your serial port. So you have to run it on your local box. Then when you are developing in Cloud9 the browser window has to connect to ws://localhost:8989 which is possibly only in a non-SSL window. So what I do is run a mini nodeserver in cloud9 so i can dish content up via non-ssl from the cloud9 workspace. Then open that preview in a new non-ssl window, i.e. by using http instead of https. Then that window can connect to spjs.

Check out any of the widgets or in particular the javascript widget that talks direct to spjs. https://github.com/chilipeppr/widget-spjs

Or, better yet, just look at forking a sample workspace in the videos at the bottom of chilipeppr.com’s homepage. The sample workspace for cloud9 has the runme.js nodeserver as part of it. It also lets you visually see and connect to your serial port.