Avatar for AaronB

AaronB

Member since May 2016 • Last active Jan 2017
  • 2 conversations
  • 9 comments

Most recent activity

    • 7 comments
    • 1,034 views
  • in ESP8266
    Avatar for AaronB

    I have the same issue, it is fine with the 1v89.28 travis build but its broken with anything newer.

  • in ESP8266
    Avatar for AaronB

    user1 is written to the address for normal flashing user2 is flashed to a different address for flashing over wifi I believe. I've not flashed the latest firmware yet but use the NodeMCU firmware flasher,
    boot_v1.6.bin - 0x00000
    espruino_esp8266_user1.bin - 0x01000
    esp_init_data_default.bin - 0x3FC000
    blank.bin - 0x3FE000

  • in Interfacing
    Avatar for AaronB

    That's great thank you. I will have a play so I understand better but I have it working!

  • in Interfacing
    Avatar for AaronB

    Thanks, I had looked at the examples and have used it previously, clearly I needed to sleep on it but I think I get it now.

    I could type:

    192.168.0.13/set?23

    function onPageRequest(req, res) {
      var a = url.parse(req.url, true);
      if (a.pathname=="/set") {
    targetRoomTemp= a.query
    }
    

    to change the varible 'targetRoomTemp' to 23?

    Or with 192.168.0.13/set/23

    function onPageRequest(req, res) {
      var a = url.parse(req.url, true);
      'a.pathname'.split('/')==[1,2,3];
    
      if (a.pathname(2)=="/set") {
    targetRoomTemp= a.pathname(3);
    }
    
  • in Interfacing
    Avatar for AaronB

    Hello,

    I currently have a pico running my heating through a few 5V relays. It is not quite as simple as a thermostat; It heats a store of water and uses a pump to provide hot water and heating. I would like to be able to connect to the system over wifi, gather the data and adjust variables. I may install home-assistant so I would like to emulate a rest type interface. I am testing the wifi on a ESP8266 at the moment until I buy a shim.

    I have played with examples previously with control over wifi, I can turn on a pin and read variables but I don’t understand how to interrogate the url and move the information into a variable. I thought of using an if statement to check if the number is 1 and incrementing to by 1 if it’s not and rechecking but it seems a bit adhoc.

    I would like to be able to type something like:

    "192.168.0.13/set/room/23"

    and have the 23 move to the variable for the target room temperature. I assume I would need to use the parse function? A simple example of how to achieve this would be very much appreciated.

    Basic example that I have been using:

    // define the function beServer
    function beServer() { 
      var http = require ("http");
      var httpServer = http.createServer(function(request, response) {
        print(request);
    
        //Handle favicon requests
        if (request.url == "/favicon.ico") {
          response.writeHead(404);
          response.end();
          return;
        }
    // handle requests and serve web page
        response.write("<html><body>");
        if (request.url == "/ledOn"){
          response.write("The led is on.");
          digitalWrite(ledPin, 1);
        } else if (request.url == "/ledOff"){
          response.write("The led is off");
          digitalWrite(ledPin, 0);
        } else {
          response.write("Sorry... I didn't understand");
        }
        response.end(" ");
      }); // End of new browser request
    
      httpServer.listen(80);
      print("Now being an HTTP server!");
    } // End of beServer
    
    

    Background information about the actual system:
    A thermometer switches the boiler when the store cools below a pre-set limit currently cutting in at 62 and out at 72 deg. A valve lets water from the heating circuit into the cylinder when the flow is above 45 deg and within 10 deg of the cylinder temp and the boiler is running. The water pump starts (and pumps water through a heat exchanger) when a flowmeter picks up a flow higher than 1l/min. so lots for thermometers basically.

  • in Electronics
    Avatar for AaronB

    Hello,

    Have you considered the stm32f4stamp as a base for a new board? Are you going to keep selling the pico when the new boards go on sale? The micro-usb socket will certainly be an improvement.

  • in Interfacing
    Avatar for AaronB

    Gordon,

    I have tried your minified code from the other thread and I am receiving and I am getting the following

    >get()
    =169289
    >get()
    =169350
    >get()
    =169282
    >get()
    =169263
    >get()
    =169297
    

    Does this appear reasonable? the load cell is currently laying on the table.

    I can get a reading using digitalPulse but it is much larger at around 338642 and differs by a few hundred between readings.

    Many thanks again...

  • in General
    Avatar for AaronB

    Hi,
    I stumbled upon THIS webpage for the electric imp.
    Github link to the code
    It has implemented the read function using :

    function read_weight(){
        //This is bit banged so we 
        //bind calls to local variables
        //to speed things up.
        //Takes about 2.2mS to do the read
        local sw  = spi.write.bindenv(spi);
        local dr  = data.read.bindenv(data);
        local val = 0;
    
        for(local i = 24; i >= 0; i--){
            sw(PULSE);
            val += dr() ? math.pow(2, i) : 0;
        }
    
        return (val-ZERO_OFFSET)/GAIN;  //Value in grams
    }
    

    It does point out that I should have typed >0 in the for statement not 1...
    I will test my code again with the refinements suggested by Gordon later tonight hopefully and will report back.

    Many thanks,

    Aaron

Actions