1

I followed this tutorial to connect the ESP8266 to a wifi network using AT commands. I used the below schematics (without the connection between ESP's CPIO 0 and Arduino's Ground):

enter image description here

After that, I was able to follow through the tutorial and got this response in the Serial Monitor:

enter image description here

That means my ESP8266 has successfully connected to my Wifi named W3. However, I decided to switch the mode of my ESP8266 from Network Device (mode 1) to Both network device AND Access Point (mode 3) (at this point I called AT+CWJAP? and can still see that it's connected to W3 wifi). I then was able to see the ESP wifi in my wifi list as (AI-THINKER_4C8CF2) but when I connected to it, I cannot connect to the internet. I'm wondering what the problem is and would appreciate any help.

Note: The reason why I switched to mode 3 is because I want to control an Arduino Pro Mini (instead of Arduino Pro) using NodeJS. I followed another tutorial and I figured that I need to connect to an ESP8266 access point.

I uploaded the StandardFirmataSketchPlus to my Arduino Pro Mini, with the baud rate set to 115200 (which is the same baud rate with my ESP8266). The schematic I used is similar to the one below, except I used a 3.3V Pro Mini and a Lipo battery, instead of a 5V:

enter image description here

The nodejs code is below:

var VirtualSerialPort = require('udp-serial').SerialPort;
var firmata = require('firmata');
var five = require("johnny-five");
var sp = new VirtualSerialPort({
  host: '192.168.1.243' //I got this number from the AT command (STAIP above)
 });

var io = new firmata.Board(sp);

io.once('ready', function(){
    io.isReady = true;

    var board = new five.Board({io: io, repl: true});

    board.on('ready', function(){
        var led = new five.Led(12);
        led.blink(3000);
    });
});

This code is to test the connection between Arduino and Nodejs and when I run this file, it doesn't work.

  • just leave esp and your computer connected to your W3 – Juraj Dec 7 '17 at 5:00
  • @ Juraj I tried that. I connected my esp and computer to the W3 wifi and run the javascript code (that I added to my question) and it still can't connect to the internet. – luuhd Dec 7 '17 at 5:05
  • what has internet to do with what you try to do? – Juraj Dec 7 '17 at 8:15
  • you missed this line in the tutorial "I assume you have already flashed standard firmata on your Arduino" – Juraj Dec 7 '17 at 8:34
  • 2
    Spend some time researching what each line of your Arduino sketch does. If you're using that sketch with that schematic you clearly don't understand the most basic principles of what it's intended to do. You're just using the Uno as a USB-serial adapter and the sketch on the Uno is doing absolutely nothing useful. – per1234 Dec 7 '17 at 8:34
1

you have Firmata in Atmega, AT firmware in ESP and the 'blink led' js on computer.

you did not follow the tutorial properly. it requires jonny-five firmware in esp8266

  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - From Review – Michel Keijzers Dec 8 '17 at 9:57
  • I edited the answer – Juraj Dec 8 '17 at 10:23
  • @Juraj I did upload the johnny-five firmware on my first ESP8266 but then I couldn't connect to an existing wifi network using the method that the author mentioned in the article. I then tried to use AT command but failed. I figured that maybe when I flashed the Johnny-five firmware on the ESP, I wiped the firmware that needed to run the AT command. Then I bought another ESP8266 just to test. This time I used AT commands to connect to an existing network, but as you can see, it cannot connect to the internet, or my arduino. – luuhd Dec 10 '17 at 18:23
  • AT firmware, jonny-five or your sketch. those are only programs in the esp. what you flash there, runs there. I do not know the johnny-five firmware. – Juraj Dec 10 '17 at 19:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.