• Hello everyone,

    First off - really excited about Espruino boards and their capabilities given extremely low power consumption.

    I came up with a simple idea of getting better control of the grilling temperature by using 2 espruinos: one takes the measurements with MAX31855 + thermocouple and advertises temperature; another one collects the temp and shows the stuff using Sharp memory display; there will be a piezo beeping in case temperature gets too high.

    So the setup is quite simple, I did some quick and dirty testing with Puck.js I had already and connected both screen and thermocouple amplifier to it (and thermocouple to amplifier to get temp measurements).

    Everything works like a charm as you can see from the pic attached. As a next step I ordered MDBT42Q as a second device, which will work with a screen, and Puck is expected to take measurements.

    So here are some qqs that I'd appreciate help with

    1. The screen shows inverted image currently, what's the way to get black text / white background?
    2. In advertising mode only (no screen connected) with MAX31855 attached power consumption seemed close to zero = it kept around 100% for a couple days I kept it on. With the screen attached additionally it was draining roughly 0.5-1% per hour, which is not bad, but it can be better I believe. How to do so? Reducing baud rate? Less frequent screen updates? If so, how to manage do it?
    3. Is there any way to completely switch off the screen with a command, given it is attached to power (I guess no)?
    4. Is there any way to completely switch off Puck.js with an external switch without removing a battery?

    So far the plan I have is to use for the "screen" device

    • MDBT42Q
    • battery holder
    • kill switch
      So that let's say after temperature gets low, the device turns off automatically, but I'm still very interested in making both "screen" and "sensor" parts work as long a possible without changing the battery.

    Thanks!


    1 Attachment

    • 12345.jpg
  • here's the code btw - very quick and dirty as i was experimenting late at night :)

    var temperatura;
    var spi = new SPI();
    spi.setup({mosi:D2, miso:D1, sck:D27});
    
    SPI1.setup({ sck:D31, mosi:D30, order: "lsb", baud: 4000000 });
    
    //SPI1.setup({ miso:D1, sck:D27, baud:60000 });
    var sensor=require("MAX31855").connect(spi,D­2);
    var temper= sensor.getTemp();
    console.log(temper);
    console.log(temper.temp);
    
    var g = require("MemoryLCD").connect(SPI1, D29/*SCS*/, D28/*EXTCOMIN*/, 144/*width*/, 168/*height*/);
    
    
    
    function onTimer() {
      temper= sensor.getTemp();
      temperatura= temper.temp.toFixed(1);
      g.clear();
      g.setFontVector(50);
    //  g.drawString("Hello WORLD",30,70);
      g.drawLine(0,30,g.getWidth(),30);
      g.drawLine(0,31,g.getWidth(),31);
      g.drawLine(0,137,g.getWidth(),137);
      g.drawLine(0,138,g.getWidth(),138);
      g.drawString(temperatura, 0, 55);
      g.setFontVector(20);
      g.drawString("Battery: "+Puck.getBatteryPercentage(), 0, 143);
      g.flip();
    }
    
    // Update temperature every 2 seconds
    setInterval(onTimer,10000);
    // Update temperature immediately
    onTimer();
    
  • Looks like a great idea!

    The screen shows inverted image currently, what's the way to get black text / white background?

    g.setColor(0);g.setBgColor(1) and a redraw should do it!

    In advertising mode only (no screen connected) with MAX31855 attached power consumption seemed close to zero = it kept around 100% for a couple days I kept it on. With the screen attached additionally it was draining roughly 0.5-1% per hour, which is not bad, but it can be better I believe. How to do so? Reducing baud rate? Less frequent screen updates? If so, how to manage do it?

    The battery indicator isn't too accurate so might be misleading, but yes, with standard advertising it should be pretty good - 20uA or so.

    How often were you updating the screen? I'd have thought the biggest power draw would actually be in listening on the radio to advertisements (it might actually be better to use NRF.setLowPowerConnection(true) and to then actually connect directly to the other device, as that'll reduce the current draw of the receiver.

    Is there any way to completely switch off the screen with a command, given it is attached to power (I guess no)?

    I'm not aware of one - if you dig in the datasheet for the display you might find something though. They're so low power you could always power it off a GPIO though.

    Is there any way to completely switch off Puck.js with an external switch without removing a battery?

    Not super-easily, but if you look below the IR LED on the PCB you'll see two small pads (next to one big one for the battery holder). If you cut the track on the PCB between those 2 pads, that should separate the battery holder and the power. You can then either connect a switch to those 2 pads, or connect it between the battery holder's pin and the 3V pin.

    Having said that, if you do NRF.sleep() to turn advertising off and have no intervals, it'll draw 3uA which is pretty small.

    You could also poke the system power registers directly in order to force the system into OFF mode (0.3mA) but then your only way to restart is to disconnect and reconnect the battery.

    edit: ahh - every 10 seconds. That shouldn't be too bad. I notice you're using D28. If that's pulled high when power is applied then Puck.js will enable the Serial port, which will really suck power (http://www.espruino.com/Puck.js#serial-c­onsole). You could try using another pin if that's the case (although having used both D28 and D29 for other things it should have automatically disabled it again.

    Honestly, I'd try and set up a slightly more accurate way of measuring power consumption. Do you have an oscilloscope? If so you could measure the voltage drop across a resistor when powering Puck.js and that should give you a pretty clear idea of when power is drawn and how much.

  • @Gordon This is super helpful, thank you!

    A couple quick questions:

    • so you would recommend not to use D28/D29 to make sure I do not enable serial? There are plenty pins available, so I can easily do that.
    • What's the way to tune screen refresh rate? Do I get it right it is 5 sec by default?
  • so you would recommend not to use D28/D29 to make sure I do not enable serial? There are plenty pins available, so I can easily do that.

    If you have spare pins then it's easier to avoid them just to be sure. On the MDBT42 breakout the pin numbers are different though (they're labelled as RX and TX and D28/29 are fine to use).

    What's the way to tune screen refresh rate? Do I get it right it is 5 sec by default?

    Yes - it's 5 seconds. At the moment there isn't any way to do it. You could just copy the module itself into your code and then change it there, or could guess the interval's ID and use changeInterval. Honestly though I don't think it'll make any real difference to power consumption.

    I'd be pretty sure the most power is either used when the display is completely static, or when Puck.js wakes up to update the display.

  • @Gordon awesome, thanks!

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

Making a grilling station: a few Puck.js questions

Posted by Avatar for user92397 @user92397

Actions