You are reading a single comment by @allObjects and its replies. Click here to read the full conversation.
  • The product you are talking about is like that - http://www.towelrads.com/collections/ele­ctric/mccarthyelectric/ - with brochure at http://www.brittens-bathtime.com/wp-cont­ent/uploads/2017/04/Towelrads-2017-Broch­ure.pdf - w/ pages 101 / 102 show and describe the switch you took a pic of. ...pretty close to what I imagined.

    In your picture I see gray power cored... if this goes to a wall outlet, you consider an alternative to the actual, physical pressing of a button: putting a box w/ Espruino and a 5V relay between the wall outlet and the radiator. You can then even integrate a 5V phone wall outlet power supply and never have to worry about power again. I used a pico to do my tests, but you may find the puck.js the better solution, because it has connectivity... and you need a driver N MOS FET anyway...

    Btw, alternative to servo, a stepper w/ gear - see this post - or micro stepper with a lead screw for linear movement (pic attached) would do as well... and there are even more alternatives, food for future posts.

    Took a look at the idea of driving a 9g micro/nano servo with 5 pins from a PICO. PICO as chip can handle a total of 120ma. Each pin can handle up to 25mA up to the combined total of the chip. With 5 pins I maxed out... Even though the pins could handle easily the 3.4mA standby power consumption of the servo and on move could provide the no-load of roughly 60..70 mA, the servo did not move: the voltage was too low: 2.7V something, which is typical for a loaded pin... and still way in the limit of 1 / HIGH output.

    Resorting to a N MOS FET did the trick... put in the LOW side... When fed by USB through PICO's diode on vBat/USB puts the USB 5V down to 4.3V, still good enough . Connecting directly to rail up to 6V (4x1.5V... or 4x1.2V=4.8V w/ rechargeables) gives it a bit more umph. 1S LiPo may not be enough and 2S directly connected is probably too much, and it could also be an issue with PICO. a 5V bost converter w/ 1S and a bucket converter w/ 2S would do as well

    Holding the servo to get an idea of the blocking current shows quite a draw, briefly over 200ma...

    Attached is a still and a clip.

    In clip it can be servo moves a bit odd: it goes very briefly in the wrong direction to then turn and to in the right direction to the desired position. Also weird is the start up... may be my servo is an out-layer...

    The code was quite interesting to write, since all is timed. I added a command fifo in the logical servo, that handles the times and also manages the power up and power down of the FET... btw, the FET is from @DrAzzy 's shop - any equal will do as well, just make sure the gate-on voltage is low enough so it can be driven by 3...3.3V logic. For details I placed one on the bread board at the bottom right corner. The multi-meters are cheapo's - free on the numerous sales events throughout the year - which I modified: I pushed in - with hot solder iron - two machined pin sockets and wired them internally, in order to use the meters w/ jumper wires. The left one shows 0..200ma and the right one 0..20V.

    The code has a test procedure that indefinitely every 6.5 seconds makes three :button pushes:...

    So far I have only straight horns on the servo axle. For push a switch I would use a cam. Only little stroke is used, so it can be of very small high/low diameter and therefore can produces enough force over a 'leaf spring' onto an actual push button.

    // servoFETPowered.js
    //
    // on demand powered servo w/ FET for moving it.
    //
    
    var pCP = B3 // power contol pin - control N-FET gate
      , sCP = B4 // servo control pin  (PICO)
      , servoMod = require("servo")
      , servo    = null
      ;
    
    var s = // servo that switches it self on and then off
    { pCP: null // power control pin
    , sCP: null // servo control pin
    , s: null // actual servo
    , i: null // power off timeout id
    , cs: []  // fifo of commands - [p,t], if p falsy, just wait t
    , setup: function(pCP,sCP,range) { // setup w/ power and servo control pins
       this.pCP = pCP;
       this.sCP = sCP;
       this.s = servo = servoMod.connect(this.sCP,{range:range})­;
      }
    , m: function(p,t) { // move command as like move of actual servo
        if (this.i) this.i = clearTimeout(this.i);
        this.cs.push([p,t]);
        if (this.cs.length===1) {
          this.pCP.set(); LED2.set();
          pinMode(this.sCP,"output");
          setTimeout(this.x,100);
      } }
    , x: null // xu bound
    , xu: function() { // exec command in fifo[0] - unbound
        var c = this.cs[0], p = c[0];
        if (p>=0) this.s.move(p,c[1]);
        setTimeout(this.c,c[1]);
      }
    , c: null // cu bound
    , cu: function() { // conclude current command and continue or power off - unbound
        this.cs.splice(0,1);
        if (this.cs.length>0) { this.xu();
        } else { this.i = setTimeout(this.o,100); }
      }
    , o: null // ou bound
    , ou: function() { // switch power off
        pinMode(sCP,"input");
        this.pCP.reset(); LED2.reset();
      }
    , bs: function() { // do binds
        this.x = this.xu.bind(this);
        this.c = this.cu.bind(this);
        this.o = this.ou.bind(this);
      } 
    }; s.bs();
    
    var st = 500; // stroke time
    var ht = 100; // hold time
    function t() { // toggle switch - press and release 
      s.m(1,st);s.m(-1,ht);s.m(0,st);s.m(-1,ht­);
    }
    
    var iId = null; // interval Id ( issue 'clearInterval(iId)' to stop)
    var iTm = 6500; // interval Time
    function ts() { // continuously/every iTm seconds 3 toggles
      t();t();t();
      iId = setInterval(function(){ t();t();t(); },iTm);
    }
    
    function onInit() {
      s.setup(pCP,sCP,2);
      s.m(1,st);
      setTimeout(ts,300);
    }
    
    setTimeout(onInit,500); // while dev'g / comment for upload for save()
    

    3 Attachments

About

Avatar for allObjects @allObjects started