Avatar for asez73

asez73

Member since Oct 2014 • Last active Nov 2018
  • 7 conversations
  • 147 comments

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

Most recent activity

  • in JavaScript
    Avatar for asez73

    HI @Robin and @Gordon,

    Thanks for your help, it did worked and I globally saved some time AND events stack depth.
    Now I don't have to separate in time, by emiting events, concatenation, slicing and storing from the Serial.on handler: it just happens fast enough without throwing any event to my Gps object.
    In some cases, I could receive enough messages and emit one event per messages, which stopped the program with strange corrupted data in the line received. The result was a buffer way too long (32Kb) and other mysterious unvalid gps data.

    Now, I am more on 2 colateral problems:
    1-one in Javascript (Serial.pipe chunk parameter in order to limit the number of calls to handler of the input data and get at least any message header at once),
    2-one in hardware (Pico powered by 3.7 V battery, deep sleeping as long as possible, using the B0 mosfet with the supplied 3.7 V)

    So I think we are far enough of flat strings and should open 2 other threads to handle those points.

    Thanks again!

  • in JavaScript
    Avatar for asez73

    Hi,
    As a complementary question to those flat strings handling, I wonder if there is an efficient way to store a standard string (coming from usart for instance) to a pre-allocated flat string without using looping technics?.
    This is in order to avoid the allocation time each time my pico receives some complete data packets.

    More explicitely, the pico receives some data from usart.
    These chuncks are concatenated in Serial.on('data',...) event handler.
    So far, these are standard javascript strings.
    Once there is enought data, it is sliced and can then be used in a flat string to create an ArrayBuffer resliced itself and finally accessed internally through a Dataview.

    The thing is an Ublox M8U gps device using their binary protocol: very c structs friendly and only bytes/words/long words properly aligned. You can see this to get a clear idea. Here, the interest is that payloads are almost all of a fixed length (DMA in sight), very compact (less bytes on usart fro more data) and no fancy sexagesimally odd computations on latitudes/longitudes and so on!

    My goal is to preallocate a few different dataviews of predefined length and then copy the incoming data from its string format to the dataview after all checksums and length controls of course.
    The gps data will be accessed through getters using v.getUint32(buffer, true) and others as usual with dataviews.

    A side approach would be to use inline C for setters and getters but what in Espruino (javascript)?

    A dream would be to receive data from serial to an ArrayBuffer (kind of DMA) and only wake up when the serial buffer has enough bytes to analyse: so sleep walking while the interpreter is in deep sleep mode.

  • in Puck.js, Pixl.js and MDBT42
    Avatar for asez73

    Hi,
    All of this is why I do use LiFePo4 batteries after, as far as possible, any ldo.
    You just don't need them as the batteries will go down from 3.6 V to 3.1 V and charging, as I do it, is at 3.65 V max out of the circuit (removing it from the project and charging separately).
    This becomes very important when your main power consumption device is finally close to the ldo quiescent amperage...
    Now, some peripherals do have an ldo integrated, and it can be a problem as the LiFePo4 batteries wil dye at 3.1 V while the ldo will reduce its supplied voltage by 0.25 V easily. Not to talk about secondary batteries, poorly designed, which are consuming 13 mA almost permanently. Drones don't care much about nA while we do in this case!

  • in Pico / Wifi / Original Espruino
    Avatar for asez73

    Hi,
    Thanks again: the gps has its own voltage regulator so I am just using it as is with the mosfet switching it on & off from time to time.
    I expect to use a cheap non protected battery design to recharge a smartphone with a usb connector on its output and a micro usb for recharging it from main. This won't happen while the pico is inserted in the battery.

  • in Pico / Wifi / Original Espruino
    Avatar for asez73

    Hi,
    Thank's but I am looking for what happens at partially turned on, not fully on... :)
    That said, you are right, almost everything is written but finding it can be more difficult. Gordon is doing a very important job to document and structure this knowledge. However it is a huge task!

  • in Pico / Wifi / Original Espruino
    Avatar for asez73

    I hope so!
    Thanks!
    Still need to,make sure I wont't have random failures: Data sheets don't always give the needed figures or very undirecly:)!

  • in Pico / Wifi / Original Espruino
    Avatar for asez73

    Hi,
    I'd like to use the mosfet of the pico to control power of a GPS (60 mA at 3.3V, 5V tolerant, own ldo regulator integrated).
    So, I got confused somehow from the documentation...
    That is, after bridging the jumper B0/Fet, I should use the example provided here we have

    digitalWrite(B0,1); // Partially turn on the 'Bat' output (this produces 3.3v on the FET, meaning it has just 1.4v between Gate and Drain)
    digitalRead(B0); // turn off the output (also check if USB powered)
    

    a-Does that mean that I will get a 3.3V on VBAT?
    b-What would be the max amperage in this case?
    c-Would the mosfet get hot?
    d-On this Pinout, which pin should I use to connect a load that will be powered through B0 controlled mosfet : VBAT, BAT_IN?

    As a separate problem, I need to connect the GPS on a UART AND an I2C (addtionnal sensor here).
    e-What would the best pins to use: B6 & B7 for UART, which ones for I2C?

    Thank's a lot.

  • in Puck.js, Pixl.js and MDBT42
    Avatar for asez73

    Hi,
    Sure you can put it wherever you like...
    That said I faced difficulties to join it as a simple file from Firefox: for instance I can select the file to be joined but it doesn't appear in the files under my post.
    However, it works from Chrome! So...

  • in Puck.js, Pixl.js and MDBT42
    Avatar for asez73

    Hello,
    So I did started a 3D model of the Pixl.js based on the Eagle files.
    So far it's more or less complet and accurate.
    See it below:

    // Written in 2018 by Alain Sézille
    // Any license defined in the librairies used rule their use herein
    // Any license about the Pixl.js board is applyable
    // The following termes apply exclusively to my own work and do not overrule any other licenses and copyrights for the components and informations used below
    // To the extent possible under law, the author(s) have dedicated all
    // copyright and related and neighboring rights to this software to the
    // public domain worldwide. This software is distributed without any
    // warranty.
    //
    // You should have received a copy of the CC0 Public Domain
    // Dedication along with this software.
    // If not, see <http://creativecommons.org/publicdomain­/zero/1.0/>.
    
    // Following libraries should be installed into Openscad libraries directory
    // eagle-pcb from https://github.com/triffid/eagle-pcb.git­
    // MCAD from https://github.com/openscad/MCAD.git
    // Magpie from https://github.com/sjkelly/Magpie.git
    include </home/alain/.local/share/OpenSCAD/libra­ries/eagle-pcb/common.scad>
    include </home/alain/.local/share/OpenSCAD/libra­ries/eagle-pcb/resistor.scad>
    include </home/alain/.local/share/OpenSCAD/libra­ries/eagle-pcb/SparkFun-Connectors.scad>­
    include </home/alain/.local/share/OpenSCAD/libra­ries/eagle-pcb/diode.scad>
    include </home/alain/.local/share/OpenSCAD/libra­ries/eagle-pcb/Eagle-Library.scad>
    
    // Missing colors used below
    blue=[0,0,1];
    grey=[0.5,0.5,0.5];
    
    // General size of the Pixl.js board
    board_thickness = 1.600000;
    board_origin = [0.000000,0.000000];
    
    eta = 0.1;
    fn = 18;
    
    module downside() {
        rotate([180,0,0])  children();
    }
    
    module transrot(tr = [0,0,0], rt = 0) {
        translate(tr) rotate([0,0,rt]) children();
    }
    
    module C0603K(tr = [0,0,0], rt = 0) {
       transrot (tr,rt) downside()    resistor_C0603K("C0603K", 10603);
    }
    
    module R0603(tr = [0,0,0], rt = 0) {
       transrot (tr,rt) downside()  resistor_R0603("R0603", 10603);
    }
    
    module R1210(tr = [0,0,0], rt = 0) {
       transrot (tr,rt) downside()  rcsmd([12 * 0.254, 10 * 0.254], "R0603", 10603);
    }
    
    module SOT23_5(tr = [0,0,0], rt = 0) {
        transrot (tr,rt) downside()  Eagle_Library_SOT23_5L("SOT23_5", 23.5);
    }
    module SOD323_W(tr = [0,0,0], rt = 0) {
       transrot (tr,rt)  downside()  diode_SOD323_R("SOD323_W", 23.5);
    }
    
    module USB_MICROB(tr = [0,0,0], rt = 0) {
       transrot (tr,rt) downside() rotate([0,0,-90]) SparkFun_Connectors_USB_AB_MICRO_SMD();
    }
    
    module SMT_JUMPER_3_1_NC_TRACE_NO_SILK(tr = [0,0,0], rt = 0) {
        // transrot (tr,rt) 
    }
    
    module SMT_JUMPER_3_NO_NO_SILK(tr = [0,0,0], rt = 0) {
        // transrot(tr,rt) 
    }
    
    module COINCELL(thickness = 3.5, diameter = 20.0) {
            color(silver) translate([0,0,thickness/2]) cylinder(r=diameter/2, h=thickness, center=true);
    }
    module CR2032_SMD(tr = [0,0,0], rt = 0) {
      transrot(tr,rt) downside()  COINCELL(3.64,20);
    }
    
    module TACT_MEDI_RIGHT_ANGLE(tr = [0,0,0], rt = 0) {
        transrot(tr,rt) 
        downside()
        rotate([0,0,180])
        translate([0,2.45/2,3.4/2]) 
        union() {
            // body
            color(white)
            cube([7.8, 2.45, 3.4], center=true);
            // button
            color(black)
            translate([0, (2.45/2), 0])
            cube([3, 1.05, 1.5], center=true);
        }
    }
    
    module MDBT40(tr = [0,0,0], rt = 0) {
        transrot(tr,rt) 
        downside()
        rotate([0,0,90])
        translate([0,0,1.38/2])
        union() {
            // pcb of module Dimensions: 16mm x 10mm x 2.2mm thick
            color(blue)
            cube([16.3, 10, 0.7], center=true);
            // ceramic antenna
            color(white)
            translate([0.8-16.3/2,0,2.15-1.38])
            cube([1,8,1], center=true);
            // main shield of module
            color(silver)
            translate([(16.3-11.65)/2,0,2.15-1.38])
            cube([11.65,8.25,1.38], center=true);
        }
    }
    
    module JHD12864_G176BSW(tr = [0,0,0], rt = 0) {
        transrot (tr,rt) 
        translate([0,0,board_thickness])
        union() {
            // pcb of module Dimensions: 16mm x 10mm x 2.2mm thick
            color(silver)
            cube([59.2,41.4,4.7], center=false);
            // main shield of module
            color(grey)
            translate([(59.2-55.6)/2,41.4-32.3,0.1])­
            cube([55.6,32.3-2.5,4.7], center=false);
            // viewable lcd part
            color(white)
            translate([(59.2-50)/2,41.4-25.4-5.2,0.2­])
            cube([50,25.4,4.7], center=false);
        }
    }
    
    module M3(tr = [0,0,0], rt = 0) {
       transrot(tr,rt) translate(board_origin) color(red) cylinder(r=3/2, h=board_thickness);
    }
    
    
    module PINNED_CONNECTOR(headerHeight = 9, headerWidth = 2.54,headerNbPins = 8, headerPinHeight = 11.5) {
        // defaults valeus are for arduino sized connectors
        union() {
            // main body
            color(black)
            cube([headerWidth, headerWidth * headerNbPins, headerHeight], center=false);
            // pins through PCB
            color(silver)
            for (a = [ 1 : 1 : headerNbPins ])
              translate([2.54/2, a*2.54-2.54/2, headerHeight-headerPinHeight])
              cylinder(d1=0.64, d2=0.64, h=headerPinHeight, center=false);
        }
    }
    
    
    module ARDUINO_CONNECTORS(tr = [0,0,0], rt = 0) {
        transrot(tr,rt) 
        downside()
        union () {
            // 10 pins connector,
            translate([0, 17.526, 0])        
            PINNED_CONNECTOR(headerNbPins = 10);
            // 8 pins connector,
            translate([0, 44.45, 0])
            PINNED_CONNECTOR(headerNbPins = 8);
            // 8 pins connector,
            translate([49.53-1.27, 26.67, 0])
            PINNED_CONNECTOR(headerNbPins = 8);
            // 6 pins connector
            translate([49.53-1.27, 49.53, 0])
            PINNED_CONNECTOR(headerNbPins = 6);
        }
    }
    
    
    
    module 1X02_S(tr = [0,0,0], rt = 0) {
        transrot (tr,rt) 
        downside()
        color(white)
        translate([0,-1,3])
        cube(6,4.5,3, center=true);
    }
    
    //Created by generate-scad.ulp version 0.1
    module pixljs(){
        board_thickness = 1.600000;
        eta = 0.1;
        board_size = [60.000000,52.500000,board_thickness];
        fn = 18;
        board_origin = [0.000000,0.000000];
        board_downside=0; //-(board_thickness);
        union(){
            // Board without components holes
            color("black")
            difference(){
                //Board
                translate(board_origin)
                cube(board_size); 
                // Holes
                translate([2.400,41.750,-eta])cylinder(r­=0.500000, h=board_thickness+eta*2,$fn=fn); //hole
                translate([2.400,39.450,-eta])cylinder(r­=0.500000, h=board_thickness+eta*2,$fn=fn); //hole
                translate([57.600,39.450,-eta])cylinder(­r=0.500000, h=board_thickness+eta*2,$fn=fn); //hole
                translate([57.600,41.750,-eta])cylinder(­r=0.500000, h=board_thickness+eta*2,$fn=fn); //hole
                translate([57.600,18.050,-eta])cylinder(­r=0.500000, h=board_thickness+eta*2,$fn=fn); //hole
                translate([57.600,20.350,-eta])cylinder(­r=0.500000, h=board_thickness+eta*2,$fn=fn); //hole
                translate([2.400,20.350,-eta])cylinder(r­=0.500000, h=board_thickness+eta*2,$fn=fn); //hole
                translate([2.400,18.050,-eta])cylinder(r­=0.500000, h=board_thickness+eta*2,$fn=fn); //hole
                translate([1.945,7.375,-eta])cylinder(r=­0.750000, h=board_thickness+eta*2,$fn=fn); //hole
                translate([58.295,7.375,-eta])cylinder(r­=0.750000, h=board_thickness+eta*2,$fn=fn); //hole
                translate([58.295,45.700,-eta])cylinder(­r=0.750000, h=board_thickness+eta*2,$fn=fn); //hole
                translate([1.945,45.700,-eta])cylinder(r­=0.750000, h=board_thickness+eta*2,$fn=fn); //hole
                translate([3.000,3.000,-eta])cylinder(r=­1.600000, h=board_thickness+eta*2,$fn=fn); //hole
                translate([3.000,49.500,-eta])cylinder(r­=1.600000, h=board_thickness+eta*2,$fn=fn); //hole
                translate([57.000,49.500,-eta])cylinder(­r=1.600000, h=board_thickness+eta*2,$fn=fn); //hole
                translate([57.000,3.000,-eta])cylinder(r­=1.600000, h=board_thickness+eta*2,$fn=fn); //hole
                translate([6.387,14.438,-eta])cylinder(r­=0.508000, h=board_thickness+eta*2,$fn=fn); //1X04-S 1
                translate([8.927,14.438,-eta])cylinder(r­=0.508000, h=board_thickness+eta*2,$fn=fn); //1X04-S 2
                translate([11.467,14.438,-eta])cylinder(­r=0.508000, h=board_thickness+eta*2,$fn=fn); //1X04-S 3
                translate([14.007,14.438,-eta])cylinder(­r=0.508000, h=board_thickness+eta*2,$fn=fn); //1X04-S 4
                translate([50.600,3.950,-eta])cylinder(r­=0.400000, h=board_thickness+eta*2,$fn=fn); //H2-2.0-6X4.5MM +
                translate([48.600,3.950,-eta])cylinder(r­=0.400000, h=board_thickness+eta*2,$fn=fn); //H2-2.0-6X4.5MM -
                translate([48.300,1.870,-eta])cylinder(r­=0.508000, h=board_thickness+eta*2,$fn=fn); //1X02-S 1
                translate([50.840,1.870,-eta])cylinder(r­=0.508000, h=board_thickness+eta*2,$fn=fn); //1X02-S 2
                translate([45.510,7.150,-eta])cylinder(r­=0.400000, h=board_thickness+eta*2,$fn=fn); //JHD12864-G176BSW LEDA
                translate([14.720,7.150,-eta])cylinder(r­=0.400000, h=board_thickness+eta*2,$fn=fn); //JHD12864-G176BSW LEDK
                translate([7.660,50.003,-eta])cylinder(r­=0.450000, h=board_thickness+eta*2,$fn=fn); //ARDUINO 0
                translate([10.200,50.257,-eta])cylinder(­r=0.450000, h=board_thickness+eta*2,$fn=fn); //ARDUINO 1
                translate([12.740,50.003,-eta])cylinder(­r=0.450000, h=board_thickness+eta*2,$fn=fn); //ARDUINO 2
                translate([15.280,50.257,-eta])cylinder(­r=0.450000, h=board_thickness+eta*2,$fn=fn); //ARDUINO 3
                translate([35.600,1.743,-eta])cylinder(r­=0.450000, h=board_thickness+eta*2,$fn=fn); //ARDUINO 3.3V
                translate([17.820,50.003,-eta])cylinder(­r=0.450000, h=board_thickness+eta*2,$fn=fn); //ARDUINO 4
                translate([20.360,50.257,-eta])cylinder(­r=0.450000, h=board_thickness+eta*2,$fn=fn); //ARDUINO 5
                translate([33.060,1.997,-eta])cylinder(r­=0.450000, h=board_thickness+eta*2,$fn=fn); //ARDUINO 5V
                translate([22.900,50.003,-eta])cylinder(­r=0.450000, h=board_thickness+eta*2,$fn=fn); //ARDUINO 6
                translate([25.440,50.257,-eta])cylinder(­r=0.450000, h=board_thickness+eta*2,$fn=fn); //ARDUINO 7
                translate([29.504,50.003,-eta])cylinder(­r=0.450000, h=board_thickness+eta*2,$fn=fn); //ARDUINO 8
                translate([32.044,50.257,-eta])cylinder(­r=0.450000, h=board_thickness+eta*2,$fn=fn); //ARDUINO 9
                translate([34.584,50.003,-eta])cylinder(­r=0.450000, h=board_thickness+eta*2,$fn=fn); //ARDUINO 10
                translate([37.124,50.257,-eta])cylinder(­r=0.450000, h=board_thickness+eta*2,$fn=fn); //ARDUINO 11
                translate([39.664,50.003,-eta])cylinder(­r=0.450000, h=board_thickness+eta*2,$fn=fn); //ARDUINO 12
                translate([42.204,50.257,-eta])cylinder(­r=0.450000, h=board_thickness+eta*2,$fn=fn); //ARDUINO 13
                translate([20.360,1.997,-eta])cylinder(r­=0.450000, h=board_thickness+eta*2,$fn=fn); //ARDUINO A0
                translate([17.820,1.743,-eta])cylinder(r­=0.450000, h=board_thickness+eta*2,$fn=fn); //ARDUINO A1
                translate([15.280,1.997,-eta])cylinder(r­=0.450000, h=board_thickness+eta*2,$fn=fn); //ARDUINO A2
                translate([12.740,1.743,-eta])cylinder(r­=0.450000, h=board_thickness+eta*2,$fn=fn); //ARDUINO A3
                translate([10.200,1.997,-eta])cylinder(r­=0.450000, h=board_thickness+eta*2,$fn=fn); //ARDUINO A4
                translate([7.660,1.743,-eta])cylinder(r=­0.450000, h=board_thickness+eta*2,$fn=fn); //ARDUINO A5
                translate([47.284,50.257,-eta])cylinder(­r=0.450000, h=board_thickness+eta*2,$fn=fn); //ARDUINO AREF
                translate([44.744,50.003,-eta])cylinder(­r=0.450000, h=board_thickness+eta*2,$fn=fn); //ARDUINO GND
                translate([27.980,1.997,-eta])cylinder(r­=0.450000, h=board_thickness+eta*2,$fn=fn); //ARDUINO GND.
                translate([30.520,1.743,-eta])cylinder(r­=0.450000, h=board_thickness+eta*2,$fn=fn); //ARDUINO GND..
                translate([40.680,1.743,-eta])cylinder(r­=0.450000, h=board_thickness+eta*2,$fn=fn); //ARDUINO I/OREF
                translate([43.220,1.997,-eta])cylinder(r­=0.450000, h=board_thickness+eta*2,$fn=fn); //ARDUINO N/C
                translate([38.140,1.997,-eta])cylinder(r­=0.450000, h=board_thickness+eta*2,$fn=fn); //ARDUINO RESET
                translate([52.364,50.257,-eta])cylinder(­r=0.450000, h=board_thickness+eta*2,$fn=fn); //ARDUINO SCL
                translate([49.824,50.003,-eta])cylinder(­r=0.450000, h=board_thickness+eta*2,$fn=fn); //ARDUINO SDA
                translate([25.440,1.743,-eta])cylinder(r­=0.450000, h=board_thickness+eta*2,$fn=fn); //ARDUINO VIN
                translate([57.251,33.405,-eta])cylinder(­r=0.600000, h=board_thickness+eta*2,$fn=fn); //USB-MICROB P$3
                translate([57.200,26.420,-eta])cylinder(­r=0.600000, h=board_thickness+eta*2,$fn=fn); //USB-MICROB P$4
            }
            // Components added 
            TACT_MEDI_RIGHT_ANGLE([2.400,40.600,0],9­0);  //BTN1 
            TACT_MEDI_RIGHT_ANGLE([57.600,40.600,0],­270);  //BTN2 
            TACT_MEDI_RIGHT_ANGLE([57.600,19.200,0],­270);  //BTN3 
            TACT_MEDI_RIGHT_ANGLE([2.400,19.200,0],9­0);  //BTN4 
            C0603K([24.400,21.800,board_downside],90­);  //C1 1uF 25v
            C0603K([27.800,22.800,board_downside],18­0);  //C2 1uF 25v
            C0603K([13.800,36.300,board_downside],0)­;  //C3 10uF 6.3v
            C0603K([47.000,14.400,board_downside],90­);  //C4 1uF 25v
            C0603K([19.400,26.200,board_downside],27­0);  //CTUNE1 TBD
            C0603K([18.100,25.300,board_downside],27­0);  //CTUNE2 TBD
            SOD323_W([50.300,17.100,board_downside],­0);  //D1 
            SOD323_W([41.200,17.200,board_downside],­270);  //D2 NO_FIT
            //translate([10.197,14.438,board_downsid­e])1X04_S();  //DBG 
            SOT23_5([44.200,14.500,board_downside],9­0);  //IC2 MIC5225-3.3  //translate([49.600,3.200,board_downside­])rotate([0,0,180])H2_2_0_6X4_5MM();  //J1 2p-2.0
            SMT_JUMPER_3_1_NC_TRACE_NO_SILK([44.800,­17.100,board_downside],180);  //JP1 COINCELL_VREG
            SMT_JUMPER_3_NO_NO_SILK([40.920,5.540,bo­ard_downside],0);  //JP2 5VSRC
            1X02_S([49.570,1.870,board_downside],0);­  //PWR 
            R0603([11.100,22.400,board_downside],270­);  //R1 100
            JHD12864_G176BSW([0.620,5.750,0],0);  //U$1 JHD12864
            MDBT40([8.400,29.880,board_downside],90)­;  //U$2 MDBT42Q
            CR2032_SMD([41.500,33.050,board_downside­],90);  //U$3 CR2032-SMD
            ARDUINO_CONNECTORS([2*35.600-0*2.54,2*26­.000,board_downside],270);  //U$4 ARDUINO
            USB_MICROB([57.200,29.900,board_downside­],90);  //U$5 USB-MICROB
            R1210([52.750,14.600,board_downside],180­);  //U$6 PTCFUSE
            M3([3.000,3.000,0],0);  //U$7 
            M3([3.000,49.500,0],0);  //U$8 
            M3([57.000,49.500,0],0);  //U$9 
            M3([57.000,3.000,0],0);  //U$10 
        }
    }
    
    pixljs(); //Show module
    
    
Actions