Giter Club home page Giter Club logo

etherport-client's Introduction

etherport-client

Client-side virtual serial port for Rick Waldron's Etherport. Etherport-client is used to implement firmata-compatible boards and tethering hubs to control a board by a remote entity.

Usage Examples

The following usage examples can also be found in the examples directory of this package/project. Note, you'll need to manually install the required packages to run the examples (see require statements in the example code).

Tethering a Johnny Five IO-Plugin

Create an EtherPortClient with host and port properties referring to the peer transport endpoint of the EtherPort instance. Next, bind the resulting object to an IO-plugin using remote-io (see example below).

var EtherPortClient = require('etherport-client').EtherPortClient;
var RemoteIO = require('remote-io');
var RaspiIO = require('raspi-io');
var io = new RaspiIO();

io.on('ready', function() {
    console.log("ready");

    var sp = new EtherPortClient({
        host: '192.168.178.70',
        port: 41234
    });


    //listen for remote firmata messages
    var remoteIO = new RemoteIO({
        serial: sp,
        io: io
    });
});

Tethering a Serial Port (Chaining)

You can also simply chain Serial Port objects. For example, if you have a host with an Arduino board connected via USB and you want to access the Arduino board from a remote computer, you chain the Serial Ports on the host as follows.

var EtherPortClient = require('etherport-client').EtherPortClient;
var chainSerialPorts = require('etherport-client').chainSerialPorts;
var SerialPort = require("serialport").SerialPort;

chainSerialPorts(
    new EtherPortClient({
        host: '192.168.178.70',
        port: 41234
    }),
    new SerialPort("/dev/ttyUSB1", {
        baudrate: 57600
    })
);

Using StandardFirmataWiFi with ESP8266

By default, StandardFirmataWiFi with ESP8266 is a TCP Server. Thus, you'll need a TCP client transport for J5.

var five = require("johnny-five");
var EtherPortClient = require("etherport-client").EtherPortClient;
// update host to the IP address for your ESP board
var board = new five.Board({
    port: new EtherPortClient({
        host: "10.0.0.17",
        port: 3030
    }),
    timeout: 1e5,
    repl: false
});

board.on("ready", function() {
    console.log("READY!");
    var led = new five.Led(2);
    led.blink(500);
});

Debugging

For debugging purposes the debug package with topic "etherport-client" is used.

License

The MIT License (MIT), Copyright (c) 2015-2019 Marcus Wittig

etherport-client's People

Contributors

greenkeeper[bot] avatar mwittig avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

etherport-client's Issues

Etherport Not Running

Hi, I am traying to connect a ESP8266 D1 Mini and i am having timeout issues.
This is a chineese version:
http://www.aliexpress.com/item/Smart-Electronics-D1-mini-Mini-NodeMcu-4M-bytes-Lua-WIFI-Internet-of-Things-development-board-based/32628017688.html

I installed latest version of the Arduino Library (Firmata Version 2.5.3) https://github.com/firmata/arduino and i was able add the parameters to wifiConfig.h and finally I uploaded the firmware to my ESP8266 Board (StandardFirmataWiFi.ino).

I also uncommented the line #85, so I enabled the serial debugging. And I was able to see when the board connects to my house SSID and I get a decent signal strength (-66 dBm), I can actually specify the local static IP Address or let the routher assign a Dynamic IP address from the DHCP. So its actually connecting to my WiFi Network.

The problem that I have right now is that I have timeout error when I run the Javascript file in nodeJS. And I tried with 4 different boards already. Is there anything i can do to troubleshoot this?

var five = require("johnny-five");
var EtherPortClient = require("etherport-client").EtherPortClient;
var board = new five.Board({
     port: new EtherPortClient({
          host: "192.168.1.64",
          port: 3030
     }),
     timeout: 1e5,
     repl: false
});

board.on("ready", function() {
     console.log("READY!");
     var led = new five.Led(2);
     led.blink(500);
});

All I am trying to do is run the board as a Client and the server is a local host in my PC (192.168.1.64), I installed the NodeJS as well. Actually I run multiple Arduino's MEGA and Particle and I haven got any issues, for some reason I am having problems with the D1 Mini. I already read all the comments in this forum and I think I was able to troubleshoot everything but still is not working :-(

Any help would be appreciated.

Regards,

Alfredo Borrero

Version 10 of node.js has been released

Version 10 of Node.js (code name Dubnium) has been released! 🎊

To see what happens to your code in Node.js 10, Greenkeeper has created a branch with the following changes:

  • Added the new Node.js version to your .travis.yml

If you’re interested in upgrading this repo to Node.js 10, you can open a PR with these changes. Please note that this issue is just intended as a friendly reminder and the PR as a possible starting point for getting your code running on Node.js 10.

More information on this issue

Greenkeeper has checked the engines key in any package.json file, the .nvmrc file, and the .travis.yml file, if present.

  • engines was only updated if it defined a single version, not a range.
  • .nvmrc was updated to Node.js 10
  • .travis.yml was only changed if there was a root-level node_js that didn’t already include Node.js 10, such as node or lts/*. In this case, the new version was appended to the list. We didn’t touch job or matrix configurations because these tend to be quite specific and complex, and it’s difficult to infer what the intentions were.

For many simpler .travis.yml configurations, this PR should suffice as-is, but depending on what you’re doing it may require additional work or may not be applicable at all. We’re also aware that you may have good reasons to not update to Node.js 10, which is why this was sent as an issue and not a pull request. Feel free to delete it without comment, I’m a humble robot and won’t feel rejected 🤖


FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Any I2C component class not working with esp8266

Hi,

This works great with the esp8266 using FimataWifi. I have multiple boards report to a single Tessel 2 as well as it working on my laptop. My issue is when i try to add an i2c sensor to my project (specifying the board.byId ()) nothing happens. The event listener never fires on change or data. There is no error kicked.

I have tried this with the BME280 as well as an i2c accelerometer.

Tried with a single esp8266 controlled by my laptop with the same results.

Notify connection lost

Hi,

I'm wondering @mwittig if we could propagate some information to johnny five board when the connection is lost? Currently we try to reconnect, but I just tested with an ESP 8266, if I press RST ou I unplug the ESP, board.on('error') is not called. And it seems that the connection is also lost forever.

I'm wondering about adding emit("error") at some point to the EtherportClient instance. This could be another nice way to detect such interruption, but this does not fix the real network interrupt…

What do you think.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.