External Sensors on Thingy:52

Posted on
  • Hi All,

    i was hoping to be able to use Espruino to query some external sensors on Thingy:52

    The basic idea is to connect an external analogue sensor, say soil moisture, to Thingy and let Thingy broadcast the sensor readings.

    Very much like a combination of what is done with the Pico here to connect an external light sensor: https://www.espruino.com/Pico+Light+Sens­or and the Thingy here to let it broadcast sensor values: https://www.espruino.com/Pixl.js+Wireles­s+Weather+Station

    The Espruino-Thingy page at https://www.espruino.com/Thingy52#on-boa­rd-peripherals
    seems to suggest this is possible (Section "On BOard Peripherals") via
    // External IO outputs
    IOEXT0/1/2/3

    However, I can find no further documentation/ tutorials on how to actually read the sensor values.

    Any pointers to further information would be very much appreciated!

    Thanks.

    Bernd

  • Good question!

    So in terms of IO you have:

    • IOEXT0/1/2/3 from the IO expander - good for digital IO, but not very fast as they go through the expander
    • MOS1/2/3/4 - which control 4 MOSFETs for high power stuff
    • D2/D3/D4 - analog capable IO from the MCU

    On the rear of the thingy D2/D3/D4 are labelled as P0.02/etc.

    So basically all you need is to use D2 3 or 4 exactly like you would on the Pico (analogRead(D2)) and you're sorted.

  • Thanks for the swift reply, Gordon!
    Very cool, I didn't realise you could do this without using anything Thingy-specific!
    Just flashed one of my Thingies with Espruino. Exciting!

  • ...fortunately... or unfortunately... it all depends... first for you, latter 'not-for'-for @Gordon... but it speaks for what @Gordon does: powerful solutions easy to apply!

    So fare I stayed with having Espruino only on Espruino boards and could abstain from putting Espruino onto something else but Espruino board... but with my most recent tinkering - Espruino on the mini 10 x 10 [mm] ESP-09 - if feel like a traitor... :/

    The fact that I was unable to update my aged ESP-09 with new AT version from espressif... but it was a breeze to get Espruino onto it and it worked right of the bat (after properly connecting CP_PD), speaks even more for the quality and ease of use what comes out of @Gordon's 'Schmiede'.

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

External Sensors on Thingy:52

Posted by Avatar for Bernd @Bernd

Actions