Functional Programming with IOT (FIOT) – Day 12 – Firmata Success !!!

Alhamdulilah ! Success! After 12 days of continuous struggle of trying to make Firmata work with ESP-01, it is finally working. The following screenshot is a working proof.

Firmata Test Program Screenshot
Firmata Test Program Screenshot

So here is how i did it, I cleaned up all the Firmata instances from Arduino. This means i deleted Firmata from Libraries folder, in my case the path was :

/Users/<username>/Documents/Arduino/libraries/Firmata

and another location was:

/Applications/Arduino.app/Contents/Java/libraries/Firmata

Then i followed the solution presented in the firmata arduino github issue 257 which i interpreted as following steps :

  1. You need to install ESP8266 board in our arduino, follow installing the ESP8266 Arduino addon
  2. Clone the ESP8266 Firmata repository onto your local machine.
  3. Open the boards.h file into your editor.
  4. Add the ESP-01 board support by copy/pasting the following lines on Line 165 of the boards.h specified in step 2.
    // ESP8266 generic
    #elif defined(ARDUINO_ESP8266_ESP01)
    #define TOTAL_ANALOG_PINS 0
    #define TOTAL_PINS 17
    #define VERSION_BLINK_PIN 4
    #define IS_PIN_DIGITAL(p) ((p) == 0 || (p) == 2 || (p) == 4 || (p) == 5 || (p) == 12 || (p) == 13 || (p) == 14 || (p) == 15 || (p) == 16)
    #define IS_PIN_ANALOG(p) (false)
    #define IS_PIN_PWM(p) (false)
    #define IS_PIN_SERVO(p) ((p) >= 0 && (p) < MAX_SERVOS)
    #define IS_PIN_I2C(p) (false)
    #define IS_PIN_SPI(p) (false)
    #define PIN_TO_DIGITAL(p) (p)
    #define PIN_TO_ANALOG(p) ((p) - 17)
    #define PIN_TO_PWM(p) PIN_TO_DIGITAL(p)
    #define PIN_TO_SERVO(p) p
  5. Run the ./release.sh which will generate the Firmata-2.5.0.zip
  6. Open Arduino, go to Sketch -> Include Library -> Add Zip and add that zip.
  7. Then go back to the repository folder and open StandardFirmata example into Arduino.
  8. Upload it onto ESP-01.
  9. Open Firmata Test program.
  10. Select the correct port and you will see the result as shown in the screenshot above.

Next step is to use Clojure to control ESP-01 (which has StandardFirmata firmware).

Leave a Reply