Avatar for user106712

user106712

Member since Dec 2019 • Last active Apr 2022
  • 7 conversations
  • 21 comments

Most recent activity

  • in Projects
    Avatar for user106712

    I have been able to use the standard module to get readings. I'm interested in exploring the true capabilities of the sensor.

    Has anyone been able to change the speed/accuracy parameter on the VL53L0X lidar?

    Any experience to share on its calibration? Variability between one unit and the next?

    • 5 comments
    • 2,873 views
  • in ESP8266
    Avatar for user106712

    Using hubSerial.available() - rather than hubSerial.data('on') - to chunk the input stream seems to make some difference (fewer errors) at 4800 baud. But no difference at 2400 (mostly good) or 9600 (bad transmission). See code below (both .available and .on('data') fragments are included:

    var d0 = console.log;
    var debug = console.log;
    
    var hubSerial = new Serial();
    var usbSerial = new Serial();
    
    function onInit() {
    	hubSerial.setup(4800, { // problematic when baud rate=9600
    		rx: NodeMCU.D5,
    		tx: NodeMCU.D6
    	});
    	usbSerial.setup(9600, {
    		rx: NodeMCU.D9,
    		tx: NodeMCU.D10
    	});
    
        usbSerial.on('data', function (data) {
            try {
                hubSerial.print(data);
            } catch (e) {
                d0("failed to send on hub's data");
            }
        });
      
        //*
    	hubSerial.on('framing', function (data) {
    		d0("framing error");
    	});
    	
    	setInterval(() => {
    		let n = hubSerial.available();
    		if (n > 0) {
    			//d0(n);
    			let d = hubSerial.read(0);
    			usbSerial.print(d);
    		}
    	}, 200);
        //*/
    
    	/*
    	hubSerial.on('data', function (data) {
    		try {
             // d0(data.length);
    			usbSerial.print(data);
    		} catch (e) {
    			d0("failed to send on usb's data");
    		}
    	});
    	//*/
    }
    
  • in ESP8266
    Avatar for user106712

    I am using two soft serials, taking input from one UART and passing it to the USB UART.

    var hubSerial = new Serial(); 
    	hubSerial.setup(2400, { // problematic when baud rate=9600
    		rx: NodeMCU.D5,
    		tx: NodeMCU.D6
    	});
        var usbSerial = new Serial(); 
    	usbSerial.setup(9600, {
    		rx: NodeMCU.D9,
    		tx: NodeMCU.D10
    	});
    
    	usbSerial.on('data', function (data) {
    		try {
    			hubSerial.print(data);
    		} catch (e) {
    			d0("failed to send on hub's data");
    		}
    	});
    	hubSerial.on('data', function (data) {
    		try {
    			usbSerial.print(data);
    		} catch (e) {
    			d0("failed to send on usb's data");
    		}
    	});
    

    d0() is essentially console.log over port 23.

    The PIN assignment cannot be changed hence the use of soft serial. I think the issue is that .on('data',..) is coming back 1 or 2 bytes at a time. I will experiment using .available().

  • in ESP8266
    Avatar for user106712

    From http://www.espruino.com/USART

    "As software serial doesn't use dedicated hardware there are some compromises:

    Baud rates significantly above 9600 baud are unlikely to be reliable
    Sending more than one or two characters will block execution of other JavaScript code until completion (hardware serial ports have a ~100 byte transmit buffer)
    Software serial reception will become increasingly unreliable the higher the CPU load."

    In my application, I use soft serial (rx=D5, tx=D6). I get bursts of 60+ bytes (5x a second) from an external source. I find that anything beyond 2400 baud increases errors in the data received. What's the experience of others?

    Using an Amica 8266 board.

  • in ESP8266
    Avatar for user106712

    The socket object returned from createServer() shows (using JSON.stringify(sock)):

    {"type":0,"sckt":15,"conn":true}

    Are the above the only key/value pairs available?

    sock.remoteAddress and sock.remotePort are both undefined.

    Can these be discovered somehow?

    • 6 comments
    • 2,241 views
  • in Puck.js, Pixl.js and MDBT42
    Avatar for user106712

    Not as far as I know. Both Pucks now behave well. Thanks.

Actions