Copyright ©

Mongoose OS Forum


Mongoose OS using esp32 and javascript

I would like to use my esp32 with Mongoose OS using javascript but i am having problems understanding the scale of the JS API. AWS, GPIO, HTTP, etc are all great features! but what about all my sensors and their libraries i am used to from working on arduinoIDE using C/C++? I can only use the bulky grove sensors now? no library to support lets say my common servo motor?


  • SergeySergey Dublin, Ireland

    We are working on an Arduino compat layer.
    The goal is to make arduino drivers to work with mOS, plus provide JS bindings to them.

    Currently in progress, you can try some working drivers at

    Right now, using a driver requires some manual firmware rebuild, but soon it'll be a "point & click & use" for libraries/drivers.

  • idanBMidanBM israel
    Ok, but i think you didn't understand me correctly.
    I have no intention of using arduino boards..
    I just want to use common sensors that i already have at home, with my esp32, and I want to use their libraries as well using JavaScript.
    Is it possible in any why to use any common lets say DHT22/servo/etc with javascript on mongooseOS? (not only grove sensors)

    Thank you
  • SergeySergey Dublin, Ireland

    Please re-read my answer.

  • idanBM, what might not be obvious without looking at the repro and understanding your existing driver usage in you C/C++ code is that those drivers depend on arduino's libraries (unrelated to any specific arduino hardware). So if a shim/layer can be provided to emulate that functionality then the existing device drivers will just work under mongoose-os. Writing small js wrappers can then be written to provide a better experience without using the underlying c/c++ functions.

    This directory might make things more clear:

    Sergey, are you thinking that for each supported device driver there will be a package that forks/modifies the source with a js wrapper to provide easy deployment from the web-ui? If so, that would require a re-flash/deployment to the device, correct -- that is to say it couldn't be done from the existing web prototyping interface when writing js files directly on the device? Or something else?

  • SergeySergey Dublin, Ireland
    edited May 2017

    @scotthernandez The goal is to make drivers to build as-is, with no changes. That's the case for some of them now.
    However, there is no central driver repository out there (at least to my knowledge), so to make things reliable, we plan to collect all working drivers in one place , pin versions, and make them searchable and importable for anyone.
    Wrapping an existing driver and contributing to that collection should be easy and doable by anyone - that's the plan.

  • SergeySergey Dublin, Ireland
    edited May 2017

    And yes, as part of this "wrapping" work, for each driver, a JS binding to be added, e.g. api_dht.js.
    Goal: if one wants to use DHT sensors in her project, triggering a list of libraries and ticking "DHT" checkbox, then pressing "Rebuild + Flash" button should be sufficient.

    The work is in progress, we're currently refactoring monolithic Mongoose OS functionality into "libraries" and adding an ability to "plug them in".
    Arduino drivers would be libraries which require an "arduino-core" library to work.

    Example: "mqtt support" would be a library. "blynk mobile app integration" would be a library. "aws iot compat" would be a library. And so on.

Sign In or Register to comment.