Espruino on esp32 as greenhouse controller

Posted on
  • Hi there,

    I am new to espruino and I setup few days ago greenhouse in my garden and I want to make it autonomous as much as I can.

    So, in order to achieve that, I was thinking about using espruino as high level language, but I do not have an experience with the language partially because I am coming from Kotlin and Swift languages and I do not know how reliable espruino is.

    My question is can esp32 with espruino sustain controlling few relays, reading 2-3 dht22 sensors, reading water level meter and sending data over mqtt? How reliable is it? What problems can I expect with the language? What about multitasking/multi threading, is it possible since esp32 has 2 cors if I am not mistaken?
    Can I relay on the combination of the board and espruino?

    EDIT:
    I already did this with raspberry pi, but I think it is overkill to have raspberry pi board for turning on/off things and sending some small data as humidity level and temperature. I would rather use raspberry as mqtt server and database server with small web app so I can control green house from a distance.

    I will appreciate any help and advice.

    Thanks

  • Tue 2020.02.25

    'I do not know how reliable espruino is'

    @Svarog, Esprunio has been around for five+ years and continues to grow and improve.

    http://www.espruino.com/Features

    FYI I got involved around three years ago and there were about fifty tutorials. Today, as a testament to the success of Esprunio and the addition of the Pixl, the MDBT42Q BLE Breakout Board, and the recent Bangle watch, that list is well over one hunderd and growing.

    Tutorials and Examples
    http://www.espruino.com/Tutorials

    There is a specific list of at least ten reference links that contain pertinent detail at:

    http://forum.espruino.com/conversations/335009/

     

    . . . . and of course, check out what others have and are doing listed in the Projects forum:

    Projects
    http://forum.espruino.com/microcosms/139/

     

    'I do not have an experience with the language'

    IMO from the above statement and the minor difficulty mentioned in the post from four days ago and as newly introduced to Javascript, you will be far better off with an Official Supported Board to obtain timely responses to forum posts and execute examples with simple cut-n-paste of code blocks. The tutorials are proven, and for the most part, work on every Official board with little (pin labels) or no modification. The lost productivity from the extra datasheet searching and wasted development time debugging, in the vain attempt to save ten dollars with an unsupported board, just isn't worth it.

  • @Robin thank you

  • Wed 2020.02.26

    'for turning on/off things and sending some small data as humidity level and temperature'

    As the data payload is small, @Svarog have you considered LORA LOng RAnge, to xmit between the greenhouse and your indoor monitor?

    @allObjects documented his success, with images, in this project, which is essentially what your concept is:

    Simple LORA field tests
    http://forum.espruino.com/conversations/324051/

    http://www.espruino.com/RN2483

    I prefer the lower cost RFM69 / RFM85, but does require extra discreet parts:

    http://www.espruino.com/RFM69



    Other down the road options to utilize the WAN part of LoRaWAN using TTN perhaps:

    RAK8211
    http://forum.espruino.com/conversations/325552/

    Relax RYLR896
    http://www.espruino.com/RYLR

  • @Svarog

    What about multitasking/multi threading, is it possible since esp32 has 2 cors if I am not mistaken?

    Espruino hides all the complexity of dealing on that low level. If your events are low frequency, there is no need to even think of these things in the application - the high level of control - you intend to achieve. Espruino uses an event queue to queue and buffer up eventual low level, hardware events, and lets you 'attach' (watch with javascript event handlers) to deal with them when the processor has time to do so... and with temperature and other figures, such as moisture, etc., there is plenty of time left to do the things single threaded as Espruino on the application level in JavaScript is. Monitoring and analyzing bird tweets and chirping of crickets would not be considered low frequency events, even though Espruino has built in double buffered support for recording and processing of decently bursts of events... ;-)

    I suggest to start of with Espruino original boards and not jump into the complexity and challenges the second-class citizens ESP-only based boards are.

    As you most likely know, ESPs first ESP8266 series chips/boards had only a single processor and the communication stack required that a user thread can never hog the processor resource longer than a given time - in other words - that the application has to fit into maximum time sized windows between the times the communication stack has to be served by the processor. For a lot of applications this is plenty cycles to do what they have to do and return control to the (interrupt driven) communication stack control. If you though hog the cpu longer and the communication stack does not get control within expected time frame, the system resets and starts over.

    In the Espruino world this contention has been solved a long time ago by pairing an application dedicated chip / board with a simple/cheap ESP8266 - either wired-up or on board module - to 'leave the communication' up to dedicated resource and have dedicate resource for the application: Espruino Pico w/ ESP8266 or Espruino-Wifi. More recently, focus shifted to NRF52 based hardware that has excellent BLE Bluetooth Low Energy support the same fashion. I could easily see a mesh/star of MDBT42Q breakout modules and a Pixl.js for control / display (and as hub w/ additional ESP8266 to communicate w/ 'outside'). Both of these Espruino boards use the same core - MDBT42Q module - and keep your application code 'simple'.

    In the ESP world, the processor resource contention has been resolved with the EPS32 dual processor module. ESP goes though a bit a different route as Espruino / @Gordon. As much an underlaying OS helps to manage resources, it is more resource demanding and thus also more complex in using the underlaying hardware, since there are more layers between your application and the actual pin to control or measure, for example.

    Espruino has a rich library that connects to all kinds of sensors and bring their access and control into a simple JavaScript object that - worst case scenario - requires the application to provide a callback or use Promises - also built-in language feature - to deal with asynchronous and event driven processing and communication.

  • @Robin, thanks for response. My greenhouse is just near my hose, so I don't need LORA wan for communication. However, I will buy espruino board.

    @allObjects thanks for this elaboration, I will order a few boards and try to build the system.

    Thanks for your help guys :)

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Espruino on esp32 as greenhouse controller

Posted by Avatar for Svarog @Svarog

Actions