External devices management

Posted on
  • Hi @Gordon,

    1) I would like a Magnetventil to be controlled through Puck. In general if a certain voltage is passed to the device it is opened, if there is no, it is closed.

    My question is, suppose you have all needed from additional elements standpoint, on which pins should I connect the device and how from code standpoint will be able to open/close it ?

    2) I would like to receive impulses from impulse water meter. In general you give some power the device and on certain quantity of water you receive an impulse.

    My question is, how could I power such an external device, on which pins should I connect the device and how from code standpoint will be triggered once I have an impulse (change in the voltage i guess) ?

    Thank you.

  • Ahh, by Magnetventil, you mean 'solenoid valve'?

    You'd probably find that this is exactly what you're after: https://makezine.com/projects/use-puck-j­s-automate-your-gardening-tasks/

    Do you have a link to the impulse water meter you're considering getting?

    If the water meter is basically just a switch (with 2 wires), then you could connect one wire to GND, and the other wire to any free data pin on Puck.js.

    Then it's just a matter of:

    var meterPin = D1; // or whatever pin
    pinMode(meterPin,"input_pullup"); // this makes the pin a `1` unless the switch is on
    setWatch(function() {
    }, meterPin, {repeat:true,edge:"falling"});
  • Hi @Gordon,

    Thank you for the solenoid valve link!

    Concerning the impulse water meter, I do not have a link, but in short, it is based on Hall Sensor and has an output of one LIYCY 4x0.14 cable with 4 wires.
    1)White - Vs : 2,4V-5V
    2) Green - 0
    3) Brown - 0
    4) V output

    Thank you.

  • Both green and brown are ground?

    You should be able to just connect between the 3V and GND pins on Espruino, and then use pin D1 or D2?

    You may not need pinMode(meterPin,"input_pullup") - try first without it and see.

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

External devices management

Posted by Avatar for user73560 @user73560