Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
ESP8266 Transparent bridge to J5

#ESP8266 Transparent bridge to J5

How to use an ESP8266 as a transparent bridge to enable wifi between your arduino and johnny five. AKA, how to get rid of your serial cable and use WiFi instead!

Update: For a long time, this process used 5shekel's TCP transparent bridge which works okay but hasn't been updated much and with Johnny Five, TCP isn't the best protocol for this type of messaging.

As a result there was a desire to move to UDP instead for performance and this has been accomplished thanks to the hard work of Riven from MakeBlock, Mark Wolfe, Andy Gelme and Luis Montes.

ESP8266 Config

You need to make sure you have both esptool.py as well as esptool-ck. The first will help with testing you can talk to the board and erasing it and the second does a better job flashing to the ESP8266 module.

Put your ESP8266 in flash mode then

esptool.py --port /dev/ttyDEVICE erase_flash

It's important to wipe it clean so it gets rid of any user settings you might have. After that it's time to write the bins to the clean memory. The bins are attached to this gist and are built from Mark Wolfe's project.

esptool -cp /dev/ttyDEVICE -cd ck -ca 0x00000 -cf 0x00000.bin \
 -ca 0x40000 -cf 0x40000.bin

Reset the ESP8266 and drop out of flash mode and you should see an AP come up called NBD_XXXXXX where XXXXXX is the last 6 hex values of the mac address. So mine looks like NBD_FBE7C3. By default the network is open however you can configure that by connecting to the AP and then pointing a web browser at 192.168.4.1

Johnny Five setup

From Johnny Five we use the UDP-serial project to create a virtual serial port across UDP.

Dependencies:

npm install johnny-five firmata udp-serial

By default the address we want to talk to is 192.168.4.1 and the UDP port is 1025 so confiure them in the options.

Arduino setup

Load standard firmata and change the firmata speed to 115200 instead of 57600 ( search 57600 in the standardfirmata sketch - it's the only instance). Compile and upload to arduino.

Connect TX / RX pins to arduino and ESP01, add power to each one, grounds together.

Running it all

After that, run the script ncluded in this gist and it should work quite well you should get a nicely blinking light. Now use this structure to go make awesome wireless robots.

Acknowledgments:

Putting this together was made much easier by the people laid the foundations and also put up with me asking questions, asking for builds as my environment was toasted and generally being demanding due to the lead up to NodeBots Day.

  • Riven from MakeBlock who started down this path as part of NodeBots Day China but we ran out of time. This baseline is excellent to have worked from.
  • Luis Montes who provided insight on how the Johnny Five network stream would work and who quickly produced UDP-Serial such that the whole nodebots community can now work with this as an IO transport method.
  • Mark Wolfe who spent considerable time debugging what was happening and refined the build process so we now have a stable and replicable build environment to work on this further.
  • Andy Gelme who debugged a gnarly bridge issue that looked to be a critical blocker and refined the bridge code so that things are nice and zippy.

If you use this code and you like it, ping a message to those listed above because they have done an awesome job producing this in a very short time period.

'use strict';
var VirtualSerialPort = require('udp-serial').SerialPort;
var firmata = require('firmata');
var five = require("johnny-five");
//create the udp serialport and specify the host and port to connect to
var sp = new VirtualSerialPort({
host: '192.168.4.1',
type: 'udp4',
port: 1025
});
//use the serial port to send a command to a remote firmata(arduino) device
var io = new firmata.Board(sp);
io.once('ready', function(){
console.log('IO Ready');
io.isReady = true;
var board = new five.Board({io: io, repl: true});
board.on('ready', function(){
console.log('five ready');
//Full Johnny-Five support here:
var led = new five.Led(13);
led.blink();
});
});
@dziemid

This comment has been minimized.

Show comment Hide comment
@dziemid

dziemid Jul 26, 2015

Hello,

Thank you for putting this together :-)

I've got this to work (led over wifi), with a SimpleBot kit from NodeBots.

I've also got five.Proximity sensor running over wifi.

However, I can't get Servos to run. Any ideas how I could debug it?

Here are my attempts:

var left_wheel  = new five.Servo({ pin:  9, type: 'continuous' });

Above causes Servo to run for a split second (brief sound of engine, and immediately stop)

Nothing works then, tried both left_wheel.to(170); and left_wheel.cw();

>> lleefftt__wwhheeeell..ttoo((117700));;
{ board:
   { io:
      { domain: [Object],
        _events: [Object],
        _maxListeners: undefined,
        isReady: true,
        MODES: [Object],
        I2C_MODES: [Object],
        STEPPER: [Object],
        HIGH: 1,
        LOW: 0,
        pins: [Object],
        analogPins: [Object],
        version: [Object],
        firmware: [Object],
        currentBuffer: [],
        versionReceived: true,
        name: 'Firmata',
        settings: [Object],
        transport: [Object],
        sp: [Object],
        reportVersionTimeoutId: [Object] },
     timer:
      { '0': null,
        _idleTimeout: -1,
        _idlePrev: null,
        _idleNext: null,
        _idleStart: 390671997,
        _onTimeout: null,
        _repeat: false,
        domain: [Object] },
     isConnected: true,
     isReady: true,
     register: [ [Circular], [Object], [Object], [Object] ],
     occupied: [ [Object], [Object] ],
     Drivers: {},
     id: '545E607C-E7B9-48EE-83E3-EB05107D67E3',
     debug: true,
     repl: { context: [Object], ready: true, cmd: [Object] },
     sigint: true,
     pins:
      { '0': [Object],
        '1': [Object],
        '2': [Object],
        '3': [Object],
        '4': [Object],
        '5': [Object],
        '6': [Object],
        '7': [Object],
        '8': [Object],
        '9': [Object],
        '10': [Object],
        '11': [Object],
        '12': [Object],
        '13': [Object],
        '14': [Object],
        '15': [Object],
        '16': [Object],
        '17': [Object],
        '18': [Object],
        '19': [Object],
        '20': [Object],
        '21': [Object] },
     transport:
      { type: 'udp4',
        host: '192.168.4.1',
        port: 1025,
        client: [Object],
        _events: [Object] },
     port: 'Firmata',
     type: 'OTHER',
     _events: {},
     MODES:
      { INPUT: 0,
        OUTPUT: 1,
        ANALOG: 2,
        PWM: 3,
        SERVO: 4,
        SHIFT: 5,
        I2C: 6,
        ONEWIRE: 7,
        STEPPER: 8,
        IGNORE: 127,
        UNKOWN: 16 } },
  io:
   { domain:
      { domain: null,
        _events: [Object],
        _maxListeners: undefined,
        members: [] },
     _events: { string: [Object] },
     _maxListeners: undefined,
     isReady: true,
     MODES:
      { INPUT: 0,
        OUTPUT: 1,
        ANALOG: 2,
        PWM: 3,
        SERVO: 4,
        SHIFT: 5,
        I2C: 6,
        ONEWIRE: 7,
        STEPPER: 8,
        IGNORE: 127,
        UNKOWN: 16 },
     I2C_MODES: { WRITE: 0, READ: 1, CONTINUOUS_READ: 2, STOP_READING: 3 },
     STEPPER: { TYPE: [Object], RUNSTATE: [Object], DIRECTION: [Object] },
     HIGH: 1,
     LOW: 0,
     pins:
      [ [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object] ],
     analogPins: [ 14, 15, 16, 17, 18, 19, 20, 21 ],
     version: { major: 2, minor: 4 },
     firmware: { version: [Object], name: 'network_simplebot_firmata.ino' },
     currentBuffer: [],
     versionReceived: true,
     name: 'Firmata',
     settings:
      { reportVersionTimeout: 20000,
        samplingInterval: 19,
        serialport: [Object] },
     transport:
      { type: 'udp4',
        host: '192.168.4.1',
        port: 1025,
        client: [Object],
        _events: [Object] },
     sp:
      { type: 'udp4',
        host: '192.168.4.1',
        port: 1025,
        client: [Object],
        _events: [Object] },
     reportVersionTimeoutId:
      { '0': null,
        _idleTimeout: -1,
        _idlePrev: null,
        _idleNext: null,
        _idleStart: 390615431,
        _onTimeout: null,
        _repeat: false,
        domain: [Object] } },
  id: 'E72742BB-AEC4-43C0-8DB1-A2196860841B',
  pin: 9,
  range: [ 0, 180 ],
  deadband: [ 90, 90 ],
  fps: 100,
  offset: 0,
  mode: 4,
  interval: null,
  value: 170,
  type: 'continuous',
  invert: false,
  specs: { speed: 0.17 },
  startAt: 90 }
>
{ board:
   { io:
      { domain: [Object],
        _events: [Object],
        _maxListeners: undefined,
        isReady: true,
        MODES: [Object],
        I2C_MODES: [Object],
        STEPPER: [Object],
        HIGH: 1,
        LOW: 0,
        pins: [Object],
        analogPins: [Object],
        version: [Object],
        firmware: [Object],
        currentBuffer: [],
        versionReceived: true,
        name: 'Firmata',
        settings: [Object],
        transport: [Object],
        sp: [Object],
        reportVersionTimeoutId: [Object] },
     timer:
      { '0': null,
        _idleTimeout: -1,
        _idlePrev: null,
        _idleNext: null,
        _idleStart: 390671997,
        _onTimeout: null,
        _repeat: false,
        domain: [Object] },
     isConnected: true,
     isReady: true,
     register: [ [Object], [Circular], [Object], [Object] ],
     occupied: [ [Object], [Object] ],
     Drivers: {},
     id: '545E607C-E7B9-48EE-83E3-EB05107D67E3',
     debug: true,
     repl: { context: [Object], ready: true, cmd: [Object] },
     sigint: true,
     pins:
      { '0': [Object],
        '1': [Object],
        '2': [Object],
        '3': [Object],
        '4': [Object],
        '5': [Object],
        '6': [Object],
        '7': [Object],
        '8': [Object],
        '9': [Object],
        '10': [Object],
        '11': [Object],
        '12': [Object],
        '13': [Object],
        '14': [Object],
        '15': [Object],
        '16': [Object],
        '17': [Object],
        '18': [Object],
        '19': [Object],
        '20': [Object],
        '21': [Object] },
     transport:
      { type: 'udp4',
        host: '192.168.4.1',
        port: 1025,
        client: [Object],
        _events: [Object] },
     port: 'Firmata',
     type: 'OTHER',
     _events: {},
     MODES:
      { INPUT: 0,
        OUTPUT: 1,
        ANALOG: 2,
        PWM: 3,
        SERVO: 4,
        SHIFT: 5,
        I2C: 6,
        ONEWIRE: 7,
        STEPPER: 8,
        IGNORE: 127,
        UNKOWN: 16 } },
  io:
   { domain:
      { domain: null,
        _events: [Object],
        _maxListeners: undefined,
        members: [] },
     _events: { string: [Object] },
     _maxListeners: undefined,
     isReady: true,
     MODES:
      { INPUT: 0,
        OUTPUT: 1,
        ANALOG: 2,
        PWM: 3,
        SERVO: 4,
        SHIFT: 5,
        I2C: 6,
        ONEWIRE: 7,
        STEPPER: 8,
        IGNORE: 127,
        UNKOWN: 16 },
     I2C_MODES: { WRITE: 0, READ: 1, CONTINUOUS_READ: 2, STOP_READING: 3 },
     STEPPER: { TYPE: [Object], RUNSTATE: [Object], DIRECTION: [Object] },
     HIGH: 1,
     LOW: 0,
     pins:
      [ [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object] ],
     analogPins: [ 14, 15, 16, 17, 18, 19, 20, 21 ],
     version: { major: 2, minor: 4 },
     firmware: { version: [Object], name: 'network_simplebot_firmata.ino' },
     currentBuffer: [],
     versionReceived: true,
     name: 'Firmata',
     settings:
      { reportVersionTimeout: 20000,
        samplingInterval: 19,
        serialport: [Object] },
     transport:
      { type: 'udp4',
        host: '192.168.4.1',
        port: 1025,
        client: [Object],
        _events: [Object] },
     sp:
      { type: 'udp4',
        host: '192.168.4.1',
        port: 1025,
        client: [Object],
        _events: [Object] },
     reportVersionTimeoutId:
      { '0': null,
        _idleTimeout: -1,
        _idlePrev: null,
        _idleNext: null,
        _idleStart: 390615431,
        _onTimeout: null,
        _repeat: false,
        domain: [Object] } },
  id: '9A09C253-14DF-4FBC-BD50-6834A5A42A17',
  pin: 9,
  range: [ 0, 180 ],
  deadband: [ 90, 90 ],
  fps: 100,
  offset: 0,
  mode: 4,
  interval: null,
  value: 170,
  type: 'continuous',
  invert: false,
  specs: { speed: 0.17 },
  startAt: 90 }
>>

I am getting output above, however servo is not running.

Thank you,
Greg

dziemid commented Jul 26, 2015

Hello,

Thank you for putting this together :-)

I've got this to work (led over wifi), with a SimpleBot kit from NodeBots.

I've also got five.Proximity sensor running over wifi.

However, I can't get Servos to run. Any ideas how I could debug it?

Here are my attempts:

var left_wheel  = new five.Servo({ pin:  9, type: 'continuous' });

Above causes Servo to run for a split second (brief sound of engine, and immediately stop)

Nothing works then, tried both left_wheel.to(170); and left_wheel.cw();

>> lleefftt__wwhheeeell..ttoo((117700));;
{ board:
   { io:
      { domain: [Object],
        _events: [Object],
        _maxListeners: undefined,
        isReady: true,
        MODES: [Object],
        I2C_MODES: [Object],
        STEPPER: [Object],
        HIGH: 1,
        LOW: 0,
        pins: [Object],
        analogPins: [Object],
        version: [Object],
        firmware: [Object],
        currentBuffer: [],
        versionReceived: true,
        name: 'Firmata',
        settings: [Object],
        transport: [Object],
        sp: [Object],
        reportVersionTimeoutId: [Object] },
     timer:
      { '0': null,
        _idleTimeout: -1,
        _idlePrev: null,
        _idleNext: null,
        _idleStart: 390671997,
        _onTimeout: null,
        _repeat: false,
        domain: [Object] },
     isConnected: true,
     isReady: true,
     register: [ [Circular], [Object], [Object], [Object] ],
     occupied: [ [Object], [Object] ],
     Drivers: {},
     id: '545E607C-E7B9-48EE-83E3-EB05107D67E3',
     debug: true,
     repl: { context: [Object], ready: true, cmd: [Object] },
     sigint: true,
     pins:
      { '0': [Object],
        '1': [Object],
        '2': [Object],
        '3': [Object],
        '4': [Object],
        '5': [Object],
        '6': [Object],
        '7': [Object],
        '8': [Object],
        '9': [Object],
        '10': [Object],
        '11': [Object],
        '12': [Object],
        '13': [Object],
        '14': [Object],
        '15': [Object],
        '16': [Object],
        '17': [Object],
        '18': [Object],
        '19': [Object],
        '20': [Object],
        '21': [Object] },
     transport:
      { type: 'udp4',
        host: '192.168.4.1',
        port: 1025,
        client: [Object],
        _events: [Object] },
     port: 'Firmata',
     type: 'OTHER',
     _events: {},
     MODES:
      { INPUT: 0,
        OUTPUT: 1,
        ANALOG: 2,
        PWM: 3,
        SERVO: 4,
        SHIFT: 5,
        I2C: 6,
        ONEWIRE: 7,
        STEPPER: 8,
        IGNORE: 127,
        UNKOWN: 16 } },
  io:
   { domain:
      { domain: null,
        _events: [Object],
        _maxListeners: undefined,
        members: [] },
     _events: { string: [Object] },
     _maxListeners: undefined,
     isReady: true,
     MODES:
      { INPUT: 0,
        OUTPUT: 1,
        ANALOG: 2,
        PWM: 3,
        SERVO: 4,
        SHIFT: 5,
        I2C: 6,
        ONEWIRE: 7,
        STEPPER: 8,
        IGNORE: 127,
        UNKOWN: 16 },
     I2C_MODES: { WRITE: 0, READ: 1, CONTINUOUS_READ: 2, STOP_READING: 3 },
     STEPPER: { TYPE: [Object], RUNSTATE: [Object], DIRECTION: [Object] },
     HIGH: 1,
     LOW: 0,
     pins:
      [ [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object] ],
     analogPins: [ 14, 15, 16, 17, 18, 19, 20, 21 ],
     version: { major: 2, minor: 4 },
     firmware: { version: [Object], name: 'network_simplebot_firmata.ino' },
     currentBuffer: [],
     versionReceived: true,
     name: 'Firmata',
     settings:
      { reportVersionTimeout: 20000,
        samplingInterval: 19,
        serialport: [Object] },
     transport:
      { type: 'udp4',
        host: '192.168.4.1',
        port: 1025,
        client: [Object],
        _events: [Object] },
     sp:
      { type: 'udp4',
        host: '192.168.4.1',
        port: 1025,
        client: [Object],
        _events: [Object] },
     reportVersionTimeoutId:
      { '0': null,
        _idleTimeout: -1,
        _idlePrev: null,
        _idleNext: null,
        _idleStart: 390615431,
        _onTimeout: null,
        _repeat: false,
        domain: [Object] } },
  id: 'E72742BB-AEC4-43C0-8DB1-A2196860841B',
  pin: 9,
  range: [ 0, 180 ],
  deadband: [ 90, 90 ],
  fps: 100,
  offset: 0,
  mode: 4,
  interval: null,
  value: 170,
  type: 'continuous',
  invert: false,
  specs: { speed: 0.17 },
  startAt: 90 }
>
{ board:
   { io:
      { domain: [Object],
        _events: [Object],
        _maxListeners: undefined,
        isReady: true,
        MODES: [Object],
        I2C_MODES: [Object],
        STEPPER: [Object],
        HIGH: 1,
        LOW: 0,
        pins: [Object],
        analogPins: [Object],
        version: [Object],
        firmware: [Object],
        currentBuffer: [],
        versionReceived: true,
        name: 'Firmata',
        settings: [Object],
        transport: [Object],
        sp: [Object],
        reportVersionTimeoutId: [Object] },
     timer:
      { '0': null,
        _idleTimeout: -1,
        _idlePrev: null,
        _idleNext: null,
        _idleStart: 390671997,
        _onTimeout: null,
        _repeat: false,
        domain: [Object] },
     isConnected: true,
     isReady: true,
     register: [ [Object], [Circular], [Object], [Object] ],
     occupied: [ [Object], [Object] ],
     Drivers: {},
     id: '545E607C-E7B9-48EE-83E3-EB05107D67E3',
     debug: true,
     repl: { context: [Object], ready: true, cmd: [Object] },
     sigint: true,
     pins:
      { '0': [Object],
        '1': [Object],
        '2': [Object],
        '3': [Object],
        '4': [Object],
        '5': [Object],
        '6': [Object],
        '7': [Object],
        '8': [Object],
        '9': [Object],
        '10': [Object],
        '11': [Object],
        '12': [Object],
        '13': [Object],
        '14': [Object],
        '15': [Object],
        '16': [Object],
        '17': [Object],
        '18': [Object],
        '19': [Object],
        '20': [Object],
        '21': [Object] },
     transport:
      { type: 'udp4',
        host: '192.168.4.1',
        port: 1025,
        client: [Object],
        _events: [Object] },
     port: 'Firmata',
     type: 'OTHER',
     _events: {},
     MODES:
      { INPUT: 0,
        OUTPUT: 1,
        ANALOG: 2,
        PWM: 3,
        SERVO: 4,
        SHIFT: 5,
        I2C: 6,
        ONEWIRE: 7,
        STEPPER: 8,
        IGNORE: 127,
        UNKOWN: 16 } },
  io:
   { domain:
      { domain: null,
        _events: [Object],
        _maxListeners: undefined,
        members: [] },
     _events: { string: [Object] },
     _maxListeners: undefined,
     isReady: true,
     MODES:
      { INPUT: 0,
        OUTPUT: 1,
        ANALOG: 2,
        PWM: 3,
        SERVO: 4,
        SHIFT: 5,
        I2C: 6,
        ONEWIRE: 7,
        STEPPER: 8,
        IGNORE: 127,
        UNKOWN: 16 },
     I2C_MODES: { WRITE: 0, READ: 1, CONTINUOUS_READ: 2, STOP_READING: 3 },
     STEPPER: { TYPE: [Object], RUNSTATE: [Object], DIRECTION: [Object] },
     HIGH: 1,
     LOW: 0,
     pins:
      [ [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object] ],
     analogPins: [ 14, 15, 16, 17, 18, 19, 20, 21 ],
     version: { major: 2, minor: 4 },
     firmware: { version: [Object], name: 'network_simplebot_firmata.ino' },
     currentBuffer: [],
     versionReceived: true,
     name: 'Firmata',
     settings:
      { reportVersionTimeout: 20000,
        samplingInterval: 19,
        serialport: [Object] },
     transport:
      { type: 'udp4',
        host: '192.168.4.1',
        port: 1025,
        client: [Object],
        _events: [Object] },
     sp:
      { type: 'udp4',
        host: '192.168.4.1',
        port: 1025,
        client: [Object],
        _events: [Object] },
     reportVersionTimeoutId:
      { '0': null,
        _idleTimeout: -1,
        _idlePrev: null,
        _idleNext: null,
        _idleStart: 390615431,
        _onTimeout: null,
        _repeat: false,
        domain: [Object] } },
  id: '9A09C253-14DF-4FBC-BD50-6834A5A42A17',
  pin: 9,
  range: [ 0, 180 ],
  deadband: [ 90, 90 ],
  fps: 100,
  offset: 0,
  mode: 4,
  interval: null,
  value: 170,
  type: 'continuous',
  invert: false,
  specs: { speed: 0.17 },
  startAt: 90 }
>>

I am getting output above, however servo is not running.

Thank you,
Greg

@ajfisher

This comment has been minimized.

Show comment Hide comment
@ajfisher

ajfisher Aug 12, 2015

@dziemid apologies - I don't get notifications for Gists for some reasons.

Can you post your code so I can have a look at it - is probably something scope related I'd suggest.

Owner

ajfisher commented Aug 12, 2015

@dziemid apologies - I don't get notifications for Gists for some reasons.

Can you post your code so I can have a look at it - is probably something scope related I'd suggest.

@JerksonS

This comment has been minimized.

Show comment Hide comment
@JerksonS

JerksonS Aug 13, 2015

Hey, great work! I cant wait to try this out and remove the serial hardwire to my Pi :)

Regarding this statement:
"Connect TX / RX pins to arduino and ESP01, add power to each one, grounds together."

Are we assuming the user is running a 3.3v Arduino? Because the pins on the ESP's aren't 5v tolerant. My understanding is we either need a 3.3v arduino or a level shifter on the serial lines. Also, since the RX pin on the Arduino is held high on boot, the level-shifter should be used on both the RX and TX and not just the TX from the Arduino as some resources may suggest.

Thoughts?

Hey, great work! I cant wait to try this out and remove the serial hardwire to my Pi :)

Regarding this statement:
"Connect TX / RX pins to arduino and ESP01, add power to each one, grounds together."

Are we assuming the user is running a 3.3v Arduino? Because the pins on the ESP's aren't 5v tolerant. My understanding is we either need a 3.3v arduino or a level shifter on the serial lines. Also, since the RX pin on the Arduino is held high on boot, the level-shifter should be used on both the RX and TX and not just the TX from the Arduino as some resources may suggest.

Thoughts?

@ajfisher

This comment has been minimized.

Show comment Hide comment
@ajfisher

ajfisher Sep 9, 2015

@JerksonS well on an ESP01 you can probably get away with a direct connection on the TX/RX pins. Really it's only the TX line from the arduino that's a problem and at 115200 baud and low rates of chatter back from firmata you're not pulling it high for very long.

Personally I don't bother mostly because the price of a level shifter is actually higher than the price of an ESP01 and I haven't destroyed any yet after months of playing with these.

From an engineering perspective though, use a level shifter or a voltage divider to convert the TX line to 3.3V...

Owner

ajfisher commented Sep 9, 2015

@JerksonS well on an ESP01 you can probably get away with a direct connection on the TX/RX pins. Really it's only the TX line from the arduino that's a problem and at 115200 baud and low rates of chatter back from firmata you're not pulling it high for very long.

Personally I don't bother mostly because the price of a level shifter is actually higher than the price of an ESP01 and I haven't destroyed any yet after months of playing with these.

From an engineering perspective though, use a level shifter or a voltage divider to convert the TX line to 3.3V...

@rodrigoadachi

This comment has been minimized.

Show comment Hide comment
@rodrigoadachi

rodrigoadachi Sep 14, 2015

Hello, very good job, then I change the mode to season, how can I set the ip since it does not catch from dhcp. Thank you ...

Hello, very good job, then I change the mode to season, how can I set the ip since it does not catch from dhcp. Thank you ...

@JerksonS

This comment has been minimized.

Show comment Hide comment
@JerksonS

JerksonS Sep 23, 2015

@ajfisher, While I do agree that the ESP's are cheap and therefore not a big deal if they have to be replaced, I would disagree that the TX line is the only one of concern. Actually, I would suggest the opposite to be more true; the RX line on the Arduino will be more damaging. It is held high for quite a few seconds during Arduino boot whereas the standard serial comms, as you say, hold it high for a very minimal duration.

I'll live on the wild side and just connect them directly for now and see how long my ESP-12 lasts. Thanks again.

@ajfisher, While I do agree that the ESP's are cheap and therefore not a big deal if they have to be replaced, I would disagree that the TX line is the only one of concern. Actually, I would suggest the opposite to be more true; the RX line on the Arduino will be more damaging. It is held high for quite a few seconds during Arduino boot whereas the standard serial comms, as you say, hold it high for a very minimal duration.

I'll live on the wild side and just connect them directly for now and see how long my ESP-12 lasts. Thanks again.

@Shane-Lester

This comment has been minimized.

Show comment Hide comment
@Shane-Lester

Shane-Lester Nov 30, 2015

Can someone help me, please. I'm trying to use esptool-ck on Windows 10 and can't move forward. Do I need to build it? I've installed MinGW and tried using the make utility but I'm having no luck.

Any help would be appreciated- the README.md just tells me it can be used for Windows.

Thanks

Can someone help me, please. I'm trying to use esptool-ck on Windows 10 and can't move forward. Do I need to build it? I've installed MinGW and tried using the make utility but I'm having no luck.

Any help would be appreciated- the README.md just tells me it can be used for Windows.

Thanks

@raskaman

This comment has been minimized.

Show comment Hide comment
@raskaman

raskaman Feb 4, 2016

On WIndows, you havr to use this tool https://github.com/themadinventor/esptool
Install python27, then run as explain in the post

raskaman commented Feb 4, 2016

On WIndows, you havr to use this tool https://github.com/themadinventor/esptool
Install python27, then run as explain in the post

@raskaman

This comment has been minimized.

Show comment Hide comment
@raskaman

raskaman Feb 4, 2016

@ajfisher, I got everything working as explained, was able to control arduino over wifi, the only problem I am having is the esp8266 is not connecting to some access points with WPA/WPA2 security or any kind of password protected like WEP, it did connect initially, but after connecting to other network, it does not connect again to the first network, even after updating with the correct credentials.

raskaman commented Feb 4, 2016

@ajfisher, I got everything working as explained, was able to control arduino over wifi, the only problem I am having is the esp8266 is not connecting to some access points with WPA/WPA2 security or any kind of password protected like WEP, it did connect initially, but after connecting to other network, it does not connect again to the first network, even after updating with the correct credentials.

@rajy4683

This comment has been minimized.

Show comment Hide comment
@rajy4683

rajy4683 Apr 9, 2016

,
I have added the images to the ESP8266. I am able to see that the ESP8266 is able to come up with the image and it also connects to my WiFi network and acquires a local IP such as 192.168.0.10.
When I connect to the WIFI AP, I don't get an IP, however, I have managed using a static IP such as 192.168.4.20. I am also able to access the webpage @192.168.4.1 after that.
However, when I run the sample js application bundled with the package, I am unable to connect to the ESP-8266. Below are my queries:

  1. What IP should I input in the host section below?
    var sp = new VirtualSerialPort({
    host: '192.168.4.1',
  2. Should I be connected to the ESP_xxxx network and have the default IP i.e 192.168.4.1 in the host part i.e
  3. Should I connect to my other wifi network and input the IP that ESP_xxxx received from my wifi network i.e 192.168.0.10

Please advise as I am kinda stuck while completing this exciting project.

rajy4683 commented Apr 9, 2016

,
I have added the images to the ESP8266. I am able to see that the ESP8266 is able to come up with the image and it also connects to my WiFi network and acquires a local IP such as 192.168.0.10.
When I connect to the WIFI AP, I don't get an IP, however, I have managed using a static IP such as 192.168.4.20. I am also able to access the webpage @192.168.4.1 after that.
However, when I run the sample js application bundled with the package, I am unable to connect to the ESP-8266. Below are my queries:

  1. What IP should I input in the host section below?
    var sp = new VirtualSerialPort({
    host: '192.168.4.1',
  2. Should I be connected to the ESP_xxxx network and have the default IP i.e 192.168.4.1 in the host part i.e
  3. Should I connect to my other wifi network and input the IP that ESP_xxxx received from my wifi network i.e 192.168.0.10

Please advise as I am kinda stuck while completing this exciting project.

@sarkarstanmoy

This comment has been minimized.

Show comment Hide comment
@sarkarstanmoy

sarkarstanmoy May 3, 2016

hi,

I am able to follow all your steps and able to browse 192.168.4.1 by connecting ESP_**** AP. After that I configure my ESP module by providing SSID and password. So now I having two ip address 192.168.2.6 assigned by my router and 192.168.4.1. Which ip address to use in nodejs ? Both the ip is not working.

Please help me out on this.

sarkarstanmoy commented May 3, 2016

hi,

I am able to follow all your steps and able to browse 192.168.4.1 by connecting ESP_**** AP. After that I configure my ESP module by providing SSID and password. So now I having two ip address 192.168.2.6 assigned by my router and 192.168.4.1. Which ip address to use in nodejs ? Both the ip is not working.

Please help me out on this.

@Pierrecl

This comment has been minimized.

Show comment Hide comment
@Pierrecl

Pierrecl May 10, 2016

Hi ajfisher, thank you very much, i have found all i want.

@sarkarstanmoy, 192.168.4.1 is the default IP address assigned to ESP, it should be work.
But did you tried to setup a static IP ? For exemple you need to create a LUA file with ESPlorer to define your configuration, like this :

 wifi.setmode(wifi.STATION)
 wifi.sta.config("YOUR SSID","YOUR KEY")
 wifi.sta.connect()
 wifi.sta.setip({ip="IP ADRESS HERE",netmask="NETMASK HERE",gateway="GATEWAY HERE"})
 print("ESP8266 mode is: " .. wifi.getmode())
 print("The module MAC address is: " .. wifi.ap.getmac())
 print("Config IP is "..wifi.sta.getip())

and Send commands into ESP, if it works , you find the new IP assigned to ESP.

Pierrecl commented May 10, 2016

Hi ajfisher, thank you very much, i have found all i want.

@sarkarstanmoy, 192.168.4.1 is the default IP address assigned to ESP, it should be work.
But did you tried to setup a static IP ? For exemple you need to create a LUA file with ESPlorer to define your configuration, like this :

 wifi.setmode(wifi.STATION)
 wifi.sta.config("YOUR SSID","YOUR KEY")
 wifi.sta.connect()
 wifi.sta.setip({ip="IP ADRESS HERE",netmask="NETMASK HERE",gateway="GATEWAY HERE"})
 print("ESP8266 mode is: " .. wifi.getmode())
 print("The module MAC address is: " .. wifi.ap.getmac())
 print("Config IP is "..wifi.sta.getip())

and Send commands into ESP, if it works , you find the new IP assigned to ESP.

@LabN36

This comment has been minimized.

Show comment Hide comment
@LabN36

LabN36 Apr 28, 2017

can jonny-five run only on ESP8266 (ESP-12) without arduino ?

LabN36 commented Apr 28, 2017

can jonny-five run only on ESP8266 (ESP-12) without arduino ?

@relief-melone

This comment has been minimized.

Show comment Hide comment
@relief-melone

relief-melone May 22, 2017

Hey guys. I've tried alot now but i can't seem to get io to the state ready. my esp8266 is connected to my lan, it responds to ping but it just won't ready up. Would be great if anyone had an idea how to get this to work.

Hey guys. I've tried alot now but i can't seem to get io to the state ready. my esp8266 is connected to my lan, it responds to ping but it just won't ready up. Would be great if anyone had an idea how to get this to work.

@rikyoshiro

This comment has been minimized.

Show comment Hide comment
@rikyoshiro

rikyoshiro May 26, 2017

Thank you for what you did. It is very easy now for me as a new-leaf to javascript to communicate with arduino etc.
But hey, I have a problem when I have to use temperature sensor ds18b20 that should use a configurable firmata. Is that somethingI can do about this?? It works well when I use the connector cable connected.

Thank you for what you did. It is very easy now for me as a new-leaf to javascript to communicate with arduino etc.
But hey, I have a problem when I have to use temperature sensor ds18b20 that should use a configurable firmata. Is that somethingI can do about this?? It works well when I use the connector cable connected.

@Cayce2514

This comment has been minimized.

Show comment Hide comment
@Cayce2514

Cayce2514 Jan 6, 2018

Thank you for what you've done with this! I've incorporated this into a slightly re-engineered version of the simplebot from your “Building Robots with Lo-tech Materials” contribution to Make: JavaScript Robotics. (my adaptation here) We used your design and code, coached a bunch of kids through building their own bots and we sumoed with them for nodebot day 2017. Here's a video of them working

There are some occasions where the bot looses connectivity, it seems, and we have to break out of the script and re-run it to gain control of the bot. Have you experienced this? Any ideas for how best to ensure that the bot doesn't go AWOL?

Thank you again!!

Thank you for what you've done with this! I've incorporated this into a slightly re-engineered version of the simplebot from your “Building Robots with Lo-tech Materials” contribution to Make: JavaScript Robotics. (my adaptation here) We used your design and code, coached a bunch of kids through building their own bots and we sumoed with them for nodebot day 2017. Here's a video of them working

There are some occasions where the bot looses connectivity, it seems, and we have to break out of the script and re-run it to gain control of the bot. Have you experienced this? Any ideas for how best to ensure that the bot doesn't go AWOL?

Thank you again!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment