Logging temperatur and ground moisture

Posted on
  • I'm working on my lessons for JavaScript.
    I want to show to students that JAvaScript is not only for web,
    but also for robotics.

    I want them to program with MicroBit when the plant needs the water and log it to csv file.
    I found tutorial on: https://www.dendrite.me/media/output/med­iaid/5a13f86908d73406ab61317c
    BUT the https://github.com/Microsoft/pxt-filesys­tem don't work.

    I tried with python and that works fine, but with JavaScript it doesn't work.
    I just want to log some data and then take data and upload to FireBase database.

    I did come many times to espruino website, but I don't get what can I do with espruino ide, can I use it with MicroBit and can I write log file on microbit and then take it to laptop or something like that?

  • Wed 2018.11.21

    Welcome @user95697 to Espruino!

    'but I don't get what can I do with espruino ide'

    Have you by chance seen these videos:

    BBC micro:bit with Espruino JavaScript and Web Bluetooth



    How to set up the IDE
    Look at around 01:08

    Setting up the IDE



    The tutorials page has several examples using a temperature sensor

    http://www.espruino.com/Tutorials



    Are you planning on using 'Blockly' the graphical editor?
    Look at around 04:44 at the 'Setting up the IDE' link above

  • Hello Robin,

    Thnx for quick respond. Yes I will go and install espruino ide. That will go smoothly I think.

    But main question is:
    Is it possible to leave microbit (disconnected from bluetooth and cable) to log temperature with javascript on microbit memory. Then after day or two to connect to microbit and download that logging file (log.csv) to pc?

  • I can not give you a definitive yes @user95697, as I do not have experience with Micro:bit

    Guess here: As long as power is not interrupted, and you don't run out of memory while data logging, I don't see why not.

    I would wait for confirmation from others that do have practical experience.


    EDIT: On p.6 of the 'dendrite' tutorial link provided in #1 heading 'Download and run the program' although a bit vague, it does state:

    '(you can disconnect the USB and do this with battery power)'

    then

    'Reconnect the micro:bit to the computer via the USB'

    It's not clear to me how the data is stored. Appears to be a string of text appended to an existing string. So that tutorial implies yes you can.



    Example how text data is sent to a Micro:bit

    https://www.espruino.com/MicroBit+Text

    Start page if you haven't found that yet

    http://www.espruino.com/MicroBit

  • @user95697, micro:bit is extremely memory stricken... so, not much to the point to log data in memory for even decent time. Yes, you can apply all kinds of trickery / technology to compress the information (delta recording, etc), but that just grows the amount of code, which eats into the memory too.

    Not for nothing are peripherals available on busses.

    Therefore, I suggest that you look into external memory to log data onto. Some serial memory - which is also quite cheap and has plenty of space - where you can log the data, and even then pull and read it directly in some other device. Since you have plenty of target memory and it is time series, you can think of do round-robin / ring storage. You have enough memory for storing the meta / management data to efficiently handle the logging and communication.

  • Is it possible to leave microbit (disconnected from bluetooth and cable) to log temperature with javascript on microbit memory

    Yes. In fact this is almost exactly what you want I think - including export to CSV (well, tab-separated): http://www.espruino.com/Data+Collection#­simple-example

    As others have said the micro:bit is very low on memory - there's 3.6kB of memory for code and data - so the amount of logging you can do is quite small. However you could still do some useful things with it - especially as if you're saving just the time you're probably not going to end up saving more than 20 or so entries.

    Hope that helps!

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

Logging temperatur and ground moisture

Posted by Avatar for user95697 @user95697

Actions