Avatar for asez73

asez73

Member since Oct 2014 • Last active Feb 2024
  • 10 conversations
  • 178 comments

I have an Espruino board 1v4 and a Kickstarter Pico board...

Most recent activity

  • in General
    Avatar for asez73

    Confirmed, works as a charm with Chrome, not with Firefox, Brave as BLE is missing to them.

    Sorry having disturbed you..

  • in General
    Avatar for asez73

    Ok, I used Web ide with Chrome, it works immediatly better... Apparently nothing is lost in transmission.
    And, by the way, Brave doesn't connect as BLE is not available...

  • in General
    Avatar for asez73

    Hi,

    I use the native ide on windows 11.

    getData() reads the data stored in 4 arrays Uint16 or 32 bits.
    This data is stored when a watch, initialised by initWatchs(), launches one, depending on the board used, of sALcd(d2,p2) for Pixljs or sALcd(d2,p2) for the original espruino.
    The sensor is an LDR and data is: a counter, the date, the time between falling edges of LDR, and a computed power.
    As a result I expect to upload data either with usb from the original espruino board or with ble advertising from Pixljs: This is yet to be added as I found a third project here.
    Ble advertising is steep a learning curve for me so far: choosing a standard UUID in the table and setting up the formatted data value.

    Basically, this is an extension of your puckjs ldr based tutorial wired just as you did and some other data logger tutorial...
    Indeed, I am trying to catch the very same power meter diode flashes while my solar panels over produce energy and the apparent power gets down to 0.
    In this case, there is a 0 apparent power provided but the power meter's serial link, while the led flashes at each Wh, so ...
    This information is officially provided by a serial uart names TIC (teleinfo) here in France. It takes an opto isolation and 1,N,8 at 1200 bauds to get some data which would allow me to measure each reinjected Wh and the time between those pulses to know what power is beeing reinjected to the grid right in real time. This link is well known here and there are many schematics and ready made interfaces for USB devices. I have run it on a raspberry pi since 2014 "almost" uninterupted.
    There is an equivallent serial link in Belgium and the Netherland as far as I know.

  • in General
    Avatar for asez73

    Hi, happy new year 2023 to every one!
    Almost 10 years since this thread started and I have this very same problem:
    Dropped characters in the terminal and at upload time via BLE.
    This happens on a Pixljs with espruino 2v16, a pc on Windows 11, and I tried, with no luck, differents settings:
    +Bluetooth smart (BTLE) via 'noble': on or off,
    +Bluetooth smart (Web Bluetooth): on or off,
    +Software Flow Control: on or off,

    The screen below is a upload time or after a reboot, dump and reset...

    I also, with no results:

    • reflashed the Pixljs from Android and nrfConnect...
    • cleared the Flash and just upload to RAM.

      >dump()
      =undefined
      >reset()
      =undefined
      _ _|_|___ ___        _
      |  __|_ -| . |
      |____|___|  _|_| |___|_|_|_|___pruino.com
      2v16 (c) 2021 G.Wil
      > 
      

    and this one is a dump of data, all lines should have the same structures, they obviously don't.

    >getData()
    {
      "time": Date: Thu Jan 1 0100,
      "pulseNumber": 1, "pul"power": 2510 }
    {
      "time": D0 17:10:54 GMT+0100,
      "pulseNuration": 3, "power": 1220 }
    { Thu Jan 1 1970 17:10:57 GMT+0100": 3, "pulseDuration": 2.4, "pow "time": Date: Thu Jan 1 1970 17
      "pulseNumber": 4, "pulseDurat: 5190 }
    {
      "time": Date: Th:34 GMT+0100,
      "pulseNumber":": 1, "power": 3620 }
    {
      "ti 1 1970 17:18:38 GMT+0100,
      "pulseDuration": 2.1, "power": 17: Date: Thu Jan 1 1970 17:18:40 seNumber": 7, "pulseDuration": 2
    =undefined
    > 
    

    It is reproductible: issueing the same command produces the very same dump.

    Finally, It also happens if I paste some code on the right pane of the native editor: lost chars and randomly placed edit cursor on the edited line only while attempting to paste from elsewhere, say a web page.

    The full code below is hill named but at the end I expect this to run on an old original espruino board.

    So what could be the cause?
    Maybe another BLE device?

    Thanks for your attention...

  • in Porting to new Devices
    Avatar for asez73

    Hi @Gordon, how about a new generation of Espruino boards based on NRF52840? More ram, flash and ultra low powerwith ble integrated... 😎

  • in JavaScript
    Avatar for asez73

    Hi all,

    Just as an example, I am doing that sort of things with a ublox sam-m8q gps using their binary protocol.
    The example below is for the paragraph 31.18.20 UBX-NAV-STATUS (0x01 0x03).
    Their messages are pure packed c struct with properly aligned words, dwords and so on and most of those have a fixed length. That was designed for C, C++ definitely.

    However, I am not using an array, just a buffer containing a single data packet.

    I would store more than one in an Array (javascript standard) of ArrayBuffer(s) and then getters or setters with this kind of Dataview code, not pre splitted buffers with their contents separated. Thats may be slower but it's memory savy.

    gps.Status = function() {
          if (this[0x0103]===undefined) return undefined;
          let d=new DataView(this[0x0103].buffer);
          return {
              iTOW: d.getUint32(6, true)/1000,
              gpsFix: d.getUint8(10, true), 
              flags: d.getUint8(5+6, true),
              fixStat: d.getUint8(6+6, true),
              flags2: d.getUint8(7+6, true),
              ttff: d.getUint32(8+6, true)/1000,
              msss: d.getUint32(12+6, true)/1000, 
              receivedAt : new Date(this.receivedAt[0x0103]*1000)
          };
    };
    
  • Avatar for asez73

    Hi,

    So I connected a Pico to an Original Espruino and tried to monitor the Original Espruino from the Pico.
    So far, I ended up with results only for busy indicator as I am running the original espruino board from USB connection so there is no deep sleep available yet.

    The code on the Originla Espruino just includes

      setBusyIndicator(LED1); // A13
      setSleepIndicator(LED2);  // A14
    

    The code on the Pico is

    /*
                  Measure time spent on LED1/LED2 by an original Espuino board
                  */
    
    var onPin=B10; // Non deep sleep (1===running or simple sleep) led from Original Espruino Board
    var onTime=0;
    var busyPin=B13; // Busy (1=== running, neither simple sleep, nor deep sleep) led from Original Espruino Board
    var busyTime=0;
    var deepSleepTime=0;
    var startedAt=getTime();
    
    function log() {
      let runningFor=getTime()-startedAt;
      console.log("Running for",runningFor,"s");
      console.log("On time (Busy + Sleep)",onTime,"s",Math.floor(onTime*100­0/runningFor)/10,"%\tbusyTime (Busy)",busyTime,"s",Math.floor(busyTime­*1000/runningFor)/10,"%\tdeepSleepTime",­deepSleepTime,"s",Math.floor(deepSleepTi­me*1000/runningFor)/10,"%");
    }
    
    function resetChronos() {
      onPin=B10;
      onTime=0;
      OLED2=B13;
      busyTime=0;
      deepSleepTime=0;
      startedAt=getTime();
    }
    
    function onInit() {
      resetChronos();
      log();
    }
    
    var idOnTimeWatch=setWatch(function (e) {
      onTime+=e.time-e.lastTime;
    }, onPin, { repeat:true, edge:'falling' });
    
    var idBusyTimeWatch=setWatch(function (e) {
      busyTime+=e.time-e.lastTime;
      log();
    }, busyPin, { repeat:true, edge:'falling' });
    
    var idDeepSleepTimeWatch=setWatch(function (e) {
      deepSleepTime+=e.time-e.lastTime;
      log();
    }, onPin, { repeat:true, edge:'rising' });
    
    
    
  • in News
    Avatar for asez73

    Hi,
    Just to mention that the schematics show 100 ohms resistor in series with each led.
    So, in your test 3, 20 ms on every 5000 ms should give us: 20 ms / 5000 ms*(3.3v-voltage drop of led) / 100 ohm.
    If we assume a voltage drop of 0,7v we get 0.104 mA for lighting the sole led1 20'ms every 5000 ms.
    That said, the way you connect your battery could keep usb drivers awaken and trying to detect some data connection. This is just an hypothesis 🤔

    I am very interested with this kind of problem too... Keep us informed of your results 😓

  • Avatar for asez73

    Well, in some cases, at wake up some data can be lost due to the time it takes to re setup the peripherals links (usarts, spi...). That's from deep sleep.

Actions