How to use Firmata Builder (Wi-Fi) with ESP8266

How to use Firmata Builder (Wi-Fi) with ESP8266…

If you want to communicate with micro-controllers from a PC especially via Wi-Fi, Firmata is very interesting. And Firmata Builder makes things easier.

How to use Firmata Builder (Wi-Fi) with ESP8266
How to use Firmata Builder (Wi-Fi) with ESP8266

What is Firmata?

Firmata is a generic protocol for communicating with micro-controllers from software on a host computer. It is intended to work with any host computer software package.

For instance, the ESP8266 and Relay in the Main Image above is being controlled using keyboard commands via a JavaScript Script, Johnny Five JS and Node JS on a Windows 10 PC, all via Wi-Fi.

Trying not to go off on a tangent, I really like the simplicity of Firmata. You just simply edit the script and run to instantly see the results. Great for remote control, robotics, etc.

But back to the subject at hand.

What you will need.

esp8266

ESP8266 Development Board.

win10 logo

Windows 10 PC with internet connection.

Arduino logo

Arduino IDE installed and working with the ESP8266.

Create a Firmata Builder script.

OK, what is going to happen is that the Firmata Builder will take all our input and make a ZIP file. This zip file will contain a single, ‘ino’ file, which you will compile and upload with Arduino-IDE to your ESP8266. This then makes the ESP8266 listen for commands sent via Wi-Fi from our Windows PC, for example, a Node.js script sending Johnny Five JS commands to make an LED blink.

So, lets do it..

iotxplain logo iotxplain.com.au

Open your favourite Web Browser, navigate to:

http://firmatabuilder.com/

how to use firmata builder

NB: take note of the information about installing the latest version on Configurable Firmata into the Arduino-IDE.

And, as we are going to be setting up our device for Wi-Fi, note the comment about Wi-Fi being available.

Select & Configure your client.

firmata builder config

First thing is to select and configure your client. I entered the following settings –

→ Connection type Wi-Fi

→ Board ESP8266

→ Security WPA

→ SSID Your Wi-Fi SSID (You can enter this now)

→ WPA passphrase Your Wi-Fi Password (Add this later in the Arduino IDE)

Leave the remainder as they are for now, you can investigate these when you are ready.

Core Features.

Just check all the boxes, and go to the next step.

core features

Contributed Features.

All of these features are optional.

I suggest you leave them all unselected until you know you need them and how they affect the performance of Firmata.

Contributed Features

Name Package, Build & Download.

Enter a name for your file, in this case I used ‘iotxfirmata’ ; Click → Build and Download. You will receive a file called iotxfirmata.zip (or whatever you named your file).

name package

Create a Directory (say c:\iotxfirmata), unzip the .ino file to that directory.

Open the Arduino IDE; make sure you have the latest version of the Configurable Firmata library installed and your ESP8266 board is connected.

Now open the .ino file

Make sure you edit the wpa_passphrase[]

char ssid[] = “Your Wi-Fi SSID”;

char wpa_passphrase[] = “Your Wi-Fi Password”;

And…

Uncomment (remove //) to enable debugging over Serial (9600 baud)

// #define SERIAL_DEBUG should be

#define SERIAL_DEBUG

Save your work, compile the code and upload.

Testing

Open the Serial Monitor, in the Arduino-IDE.

Open the Serial Monitor

Make sure to set it for 9600 baud.

set it for 9600 baud

If all went well this is what you should see, remember you will see your ssid.

Note the IP Address, you will need that for scripting.

Should you not get this outcome, try leaving the Serial Monitor open. Then press the RST Button on your ESP8266 Development Board.

If it’s just not working it means something has gone screwy, and you need to find it (oh. what fun)… go back to the beginning and start again.

Prologue

How to use Firmata Builder (Wi-Fi) with ESP8266

By AL McDivitt.

iotxplain logo

I hope this guide helps anyone who may need it.

The world of IoT, Robotics, JavaScript applications, Remote Control, Web Interface, and on and on Awaits….

iotxplain.com.au

Cheer’s Al