Avatar for ClearMemory041063


Member since Apr 2016 • Last active May 2017
  • 43 conversations

Retired. Just having fun now.
I'm running an Espruino Board connected to ESP8266 via serial port.

Working on a program derived from the SD card file server example.
When you request a file from the displayed list, it looks at the file extension and modifies the MIME header field.
This causes files with the extension .HTML to load the Web page.
Files with the extension .js allow an .HTML file to include scripts.
Files with the extension .csv cause Excel to load the file into a spreadsheet, which can be saved on your hard drive.

I'm having problems with another part that accepts POSTs from a client.

Most recent activity

  • in Projects
    Avatar for ClearMemory041063

    You can identify an interval by naming it
    and use the name to clear only that interval

    var id = setInterval(function () { print('foo'); }, 1000);



  • in Interfacing
    Avatar for ClearMemory041063

    Thanks for the input @allObjects
    Your expertise in JavaScript is greatly appreciated.
    As with all projects and programming each author brings to the task a collection of familiarity with subjects and blind spots to other subjects. As a project develops new knowledge is revealed as ignorance retreats.
    So your input has led me to search for more information on modules.
    The CommonJS paradigm expressed in the following link seems to fit the pattern you are proposing for the Rodrigues.js module.
    So far I haven’t found a reference (other than Espruino) to the methods used for hardware module using the Connect method.
    That which I knew of JavaScript was obtained from using it in HTML and using Espruino. The opposite problem seems to show up in this @trusktr

  • in Interfacing
    Avatar for ClearMemory041063
    Correction to AGMagtest1

    The index values were corrected in the displayAg() function when set to display Accelerometer and Magnetometer values. AGMagtest2.js is attached.

    Adding the Rodrigues.js module to level the compass

    The background for this module is described here:

    The basic idea is to take the accelerometer readings and determine the vector transformation needed to level the compass. This is done with the function A=FF.Setup(AA,[0,0,1]); where FF is an instance of Rodrigues. The tilt angle theta is then available and subsequent calls to the function BB=FF.RotVector(t) will transform other vectors (magnetometer) into level coordinates.
    The attached Rodrigues.js should be placed in the modules subdirectory of your WebIDE project.
    The attached program AGMagCompass1.js will then produce the following output when autocalc=2 and W.AGwrite(W.REGval.ODR_G,1);//do gyro and acceleration.


    Changing W.AGwrite(W.REGval.ODR_G,0);//do acceleration only produces the following output:



  • in Interfacing
    Avatar for ClearMemory041063

    Now that's an interesting idea. The flywheel shaft is 10mm long with a crank on each end, so there's not much room for the Puck. Perhaps a photo interrupter with a tab on the flywheel would be easier for RPM sensing.
    The LTD (Low Temperature Differential) Stirling is right up against the wall to work using hot coffee and small design changes can move the needed temperature differential.
    One idea to pursue is a pressure sensor tapped into the displacer chamber. This would allow one to study the differences in displacer designs such as size, materials and motion of the displacer.

  • in Interfacing
    Avatar for ClearMemory041063


    The attached program AGmagtest.js uses the LSM9DS1.js module and the preceding calibrations to produce data in engineering units.

    The variable autocalc controls the type of units displayed.

    //autocalc 0=raw, 1=raw-offset, 2 Engineering Units
    var autocalc=2;

    In the function setupAG() the gyro ODR determines if gyro data are available.

    W.AGwrite(W.REGval.ODR_G,1);//do gyro and acceleration
    //W.AGwrite(W.REGval.ODR_G,0);//do acceleration only.

    Here is sample output with autocalc=2 and ODR_G=1

    M magnetometer values are in Gauss,
    G gyroscope values are in degrees per second
    A acceleration values are in g, (1= Earth gravity)

    Changing ODR_G to 0 produces:
  • in Interfacing
    Avatar for ClearMemory041063
    MPU6050 Try this code
    function start(){
    var mpu = require("MPU6050").connect(I2C1);
    setInterval(() => {
        '\nAcceleration:', mpu.getAcceleration(), // returns an [x,y,z] array with raw accl. data
        '\nGravity:', mpu.getGravity(),  // returns acceleration array in G's
        '\nRotation:', mpu.getRotation(), // returns an [x,y,z] array with raw gyro data
        '\nDegress per second:', mpu.getDegreesPerSecond() // returns gyro array in degrees/s
    }, 1000);
    }//end start
    //Wait for program to load
    setTimeout(function () {
    }, 1000);

    Without an MPU6050 connected to the PICO I get the following:

    1v92 Copyright 2016 G.Williams
    Uncaught InternalError: Timeout on I2C Write Transmit Mode 2
     at line 1 col 29
    this.i2c.writeTo(this.addr,a);return this.i2c.readFrom(this....
    in function "readBytes" called from line 1 col 25
    var g=this.readBytes(a,1)[0],h=(1<<b)-1<<c-b­+1,g=g&~h|d<<c-b...
    in function "writeBits" called from line 2 col 41
    in function "setClockSource" called from line 1 col 38
    in function "initialize" called from line 1 col 103
    in function "b" called from line 1 col 10
    new b(a,c)
    in function "connect" called from line 3 col 42
    var mpu = require("MPU6050").connect(I2C1);
    in function "start" called from line 1 col 7
    in fun

    Please try it with your chip connected.
    As for the connections, I use similar prototype connections for testing. For long term reliability soldered connections are the best. Loose connections cause headaches.

  • in Interfacing
    Avatar for ClearMemory041063

    No experience with the MPU6050 module here.
    Here are some I2C suggestions to try:

    Pullup resistors on the scl and sda lines are one thing to check.
    Does your MPU6050 breakout board provide these?
    Are the jumpers on the breakout board used to engage the pullup resistors?

    var MPU6050 = require("MPU6050");
    You might try
    var MM= require("MPU6050"); (and subsequent references to MPU6050 in your code)
    as the MPU6050 may already used by the module.

     I2C3.setup({ scl :A8, sda: B4} );
     var xgAddress= 0x6B;// Would be 0x1C if SDO_M is LOW
     var mAddress= 0x1e;// Would be 0x6A if SDO_AG is LOW 
    // W=new LSM9DS1(I2C3,xgAddress,mAddress);
     W.run();//Get it started

    For PICO
    //I2C1 sda=B7 scl=B6
    //I2C1 sda=B9 scl=B8 shim pins
    //I2C3 sda=B4 scl=A8
    //I2C2 sda=B3 scl=B10

  • in Interfacing
    Avatar for ClearMemory041063

    The Accelerometer and Gyroscope Calibrations

    Accelerometer May12 2017 2g scale using average R

    Culled Range = 2230.842

    Offset A B C
    X -987.2736361 0.995549457 0.140149893 2.11449E-05
    Y 272.0992136 -0.042589517 0.991729217 0.00020329
    Z 446.896968 -0.24363696 -0.291923385 1
    Accelerometer May12 2017 2g scale using target value

    Culled Range = 2159.087

    Offset A B C
    X -1068.093899 0.981090704 0.127644011 4.11128E-05
    Y 185.8088179 -0.013882693 0.989541404 3.62454E-05
    Z 193.6596862 -0.268744893 -0.20999626 1
    Gyroscope May12 2017 245deg per s.

    Offsets Only as I’m not set up to spin the sensor and collect data.
    Culled Range = 2506.073

    Offset A B C
    X -780.9157638 1 0 0
    Y 214.1401801 0 1 0
    Z -0.657364084 0 0 1

    See attached files