Avatar for countxerox

countxerox

Member since Feb 2016 • Last active May 2017
  • 6 conversations
  • 44 comments

I'm an Aerospace Engineer from Cambridge and I'm learning JavaScript as a hobby.

Most recent activity

  • in Electronics
    Avatar for countxerox

    Hi furuskog,

    You could make a simple soil moisture sensor using two wires stuck in the soil and connected to 3.3v and A7, then just measure the voltage at A7 by doing something like..

    var n=0,i=100;
    while (i--) n+=analogRead(A7);
    

    Then you can log the data from your soil meter and any other sensors in a google spreadsheet like this example espruino.com/Logging+to+Googl­e+Sheets

    You could handle the alerts from google sheets as the there are add-ons which can email you etc

    I made a similar garden thing which has sensors for light intensity, temperature, humidity and soil moisture http://forum.espruino.com/conversations/­302202/

    Hope that helps
    Rob

  • in Puck.js
    Avatar for countxerox

    I found the accuracy to the more like +/- 10m but this was with cheap copies of the neo-m8 off ebay but I did get some really good results (+/- 1m) using the same gps modules with rtklib.

  • in Pico / Wifi / Original Espruino
    Avatar for countxerox

    Yes, two typos there. I do mean CH_PD and it's hardwired to VCC with a 10k resistor (not 1k). GPIO0 and GPIO2 are disconnected. GPIO15 is hardwired to GND with a 10k resistor.

    It does seem to me like it should work since when I pull CH_PD to GND or VCC manually with a wire everything works as expected i.e. when CH_PD is connected to GND the ESP8266 powers down and when connected to VCC it powers up.

  • in Pico / Wifi / Original Espruino
    Avatar for countxerox

    Here's a picture of it

  • in Pico / Wifi / Original Espruino
    Avatar for countxerox

    Hi, I want to turn my ESP8266 off to save power.

    When I try to pulling the CH_PIN pin high with digitalWrite(B9,1) it doesn't power up and I see Uncaught No 'ready' after AT+RST.

    I tried using a timeout to give it some time to boot up and also tried pulsing the reset pin.

    Also it seems my ESP8266 board has the CH_PD pin hardwired to Vcc via a 1k resistor. If I connect the CH_PD pin to GND, it powers down and if I connect it to the Picos 3.3v pin or leave it dangling it powers up.

    • 12 comments
    • 252 views
  • in JavaScript
    Avatar for countxerox

    Thanks for that advice @oesterle. I've had a go and I think it's improved but I can't close the wifi connection. wifi.disconnect() isn't recognised.

    Serial1.setup(115200, { rx: B7, tx : B6 });
    
    I2C3.setup({sda:B4,scl:A8});
    var bh=require("BH1750").connect(I2C3);
    
    var dht = require("DHT11").connect(B5);
    
    function read_sensors(callback) {
      var n=0,i=100;
      while (i--) n+=analogRead(A7);
      bh.start(3);
      light_intensity = Math.round(bh.read()).toString();
      soil_moisture = (100-Math.round(n)).toString();
      dht.read(function (a) { 
        temp = a.temp.toString();
        humidity = a.rh.toString();
        callback (light_intensity, soil_moisture, temp, humidity);
      });
    }
    
    function send(l,m,t,h) {
      wifi = require("ESP8266WiFi_0v25").connect(Seri­al1, function(err) {  
        if (err) throw err;
        wifi.connect("Xxx", "xxx", function(err) {
          if (err) throw err;
          LED2.set();
          sendForm(l,m,t,h);
        });
      });
    }
    
    function onInit() {
      USB.setConsole(1);
      clearInterval();
      setInterval(function() {
        read_sensors(send);
      },30000);
    }
    
  • in JavaScript
    Avatar for countxerox

    Hi, I let the program run for 25 hrs, sending to google every 2 minutes but when I look at google for the responses only 417 responses have been logged. It didn't crash but after the first few successful sends it either has the memory error, handshake failed or it works.

    >Connecting with TLS...
    Loading the CA root certificate...
    Loading the Client certificate...
    Loading the Client Key...
    Performing the SSL/TLS handshake...
    Verifying peer X.509 certificate...
    it works
    >Connecting with TLS...
    Loading the CA root certificate...
    Loading the Client certificate...
    Loading the Client Key...
    ERROR: Failed! mbedtls_ssl_setup: Not enough memory
    ERROR: Unable to create socket
    Connecting with TLS...
    Loading the CA root certificate...
    Loading the Client certificate...
    Loading the Client Key...
    ERROR: Failed! mbedtls_ssl_setup: Not enough memory
    ERROR: Unable to create socket
    >Connecting with TLS...
    Loading the CA root certificate...
    Loading the Client certificate...
    Loading the Client Key...
    Performing the SSL/TLS handshake...
    ERROR: Failed! mbedtls_ssl_handshake returned -0x4290
    >Connecting with TLS...
    Loading the CA root certificate...
    Loading the Client certificate...
    Loading the Client Key...
    Performing the SSL/TLS handshake...
    ERROR: Failed! mbedtls_ssl_handshake returned -0x4290
    >process.memory();
    ={ "free": 3920, "usage": 1180, "total": 5100, "history": 1,
      "stackEndAddress": 536958120, "flash_start": 134217728, "flash_binary_end": 377416, "flash_code_start": 134234112, "flash_length": 393216 }
    >Connecting with TLS...
    Loading the CA root certificate...
    Loading the Client certificate...
    Loading the Client Key...
    Performing the SSL/TLS handshake...
    Verifying peer X.509 certificate...
    it works
    

    Is there something wrong with my code again?

    function onInit() {
      USB.setConsole(1);
      var lastTemp = "";
      var lastHumidity = "";
      var lastLight = "";
      var lastmeasure ="";
      
      I2C3.setup({sda:B4,scl:A8});
      var bh=require("BH1750").connect(I2C3);
    
      var dht = require("DHT11").connect(B5);
      
      clearInterval();
      
      setTimeout(function() {   
        Serial1.setup(115200, { rx: B7, tx : B6 });
        wifi = require("ESP8266WiFi_0v25").connect(Seri­al1, function(err) {  
          if (err) throw err;
          wifi.connect("xxx", "xxx", function(err) {
            if (err) throw err;
              LED2.set();
              setInterval(function() {
                dht.read(function (a) {
                  lastTemp = a.temp.toString();
                  lastHumidity = a.rh.toString();
                });
                bh.start(3,1);
                lastLight = Math.round(bh.read()).toString();
      
                var n=0,i=100;
                while (i--) n+=analogRead(A7);
                lastmeasure = (100-Math.round(n)).toString();
      
                setTimeout(function() {
                  sendForm(lastTemp, lastHumidity, lastLight, lastmeasure);
                }, 5000);
              }, 120000); // once every 2min
          });
        });
      }, 2000); 
    }
    
Actions