Avatar for jakedempsey

jakedempsey

Member since Sep 2015 • Last active Apr 2017
  • 6 conversations
  • 28 comments

Most recent activity

    • 15 comments
    • 7,207 views
    • 23 comments
    • 6,240 views
  • in Interfacing
    Avatar for jakedempsey

    I got frustrated so I unplugged everything from the espruino and rewired it all and ran it again and it worked fine.. so my guess is I just had a bad connection on pin 4 of the maxbotix.

  • in Interfacing
    Avatar for jakedempsey

    I am calling it a day now... I figured out the problem. After trying 3 espruinos and multiple NRF modules I kept getting 255 on one board and 30 on the other board. I read somewhere that the 255 was an issue with maybe the MOSI but I checked wiring at least 10 times. I ended up putting all new cables on the NRF to espurino and I'm back in action.

  • in Interfacing
    Avatar for jakedempsey

    I am having all kinds of trouble today lol.

    I am trying to get these two radios working again. I had them working in the past but have not been successful today even when trying the most basic example.

    https://www.espruino.com/NRF24L01P

    I have one espurino attached to a macbook pro USB plugged into the web ide with the following code:

    SPI1.setup({sck:A5, miso:A6, mosi:A7});
    var nrf = require("NRF24L01P").connect( SPI1, B0, B1 );
    function onInit() {
      nrf.init([0,0,0,0,1], [0,0,0,0,2]);
    }
    onInit();
    setInterval(function() {
      nrf.slaveHandler();
    }, 50);
    

    On another macbook pro I have an espurino plugged into the usb with the web ide open. On that one I have the following code:

    SPI1.setup({sck:A5, miso:A6, mosi:A7});
    var nrf = require("NRF24L01P").connect( SPI1, B0, B1 );
    function onInit() {
      nrf.init([0,0,0,0,2], [0,0,0,0,1]);
    }
    onInit();
    setInterval(function() {
      nrf.masterHandler();
    }, 50);
    

    On the master once I pushed the code I then try the following from the console:

    nrf.sendCommand("1+2", function(r) { print("=="+r); });
    

    When I do that I get the error:

    TX not received 30
    

    If I swapped the two pieces of code and make the first the master I get this error:

    TX not received 255
    

    I have checked my wiring at least 10 times on both NRF24L01P. I used the pin instructions found here https://www.espruino.com/NRF24L01P for my two original espruino boards.

    Any insight or tips to debug would be really appreciated.

  • in Interfacing
    Avatar for jakedempsey

    Please ignore - it was user error

  • in Interfacing
    Avatar for jakedempsey

    I am using the following Maxbotix sensor:

    http://www.maxbotix.com/Ultrasonic_Senso­rs/MB7334.htm

    I have it working where I connect to Serial3 and have a callback attached on the 'data' and I am console logging the returned value from the sensor.

    The problem I have having is I have PIN 4 connected to B10 and PIN 5 connected to B11. Their document has that PIN 4 is internally pulled high so if it will continually ping for a reading. If you pull the pin low it will not and if you pull it high for a short period of time it will take a reading.

    Am I pulling the pin B10 low incorrectly? My goal was to connect via Serial, pull the pin low, then every 60 seconds pull the pin high which would cause it to read data and then after 10 readings it would send off the reading and set the pin back to low. In production the 60 second interval may be something more like 5 or 10 minutes. I wanted it to not be reading, then take 10 measurements every X mins and use that last one then turn it back off.

    I just can't get the LOW/HIGH pin stuff right on B10 for their PIN4. Am I missing something simple?

    var interval = 60000;
    var readingInterval = 10; 
    var fullReading = "";
    var readingCount = 0;
    
    Serial3.setup(9600, { rx: B11, tx: B10, bytesize: 8, parity: false, stopbits: 1 });
    B10.write(false);
    
    var pulseLed = function(){
        digitalPulse(LED1,1, 100);
    };
    
    var handleData = function(data){
        if(data == 'R'){
            console.log("NG:", fullReading);
            ++readingCount;
            pulseLed();
            if(readingCount == readingInterval){
                B10.write(false);
                readingCount = 0;
                console.log("Got final Result:", fullReading);
            }
            fullReading = "";
        } else {
            fullReading = fullReading + data;
        }
    };
    
    Serial3.on('data', handleData);
    
    setInterval(function(){
        console.log("Run Interval");
        B10.write(true);
    }, interval);
    

    From their document:

    Pin 4- Ranging Start/Stop: This pin is internally pulled high. If this pin is left unconnected or held high, the sensor will
    continually measure and output the range data. If held low, the HRXL-MaxSonar-WRS will stop ranging. Bring high for
    20uS or longer to command a range reading.
    Filtered Range Data: When pin 4 is left high on the sensors, the sensors will continue to range. The data that is output
    includes a filter for increased accuracy. The sensors will output the range based on recent range information. The filter
    does not affect the speed at which data is made available to the user but instead allows for more consistent range
    information to be presented. For sensor specific timing and filter information refer to pages # and #.
    Real-time Range Data: When pin 4 is low and then brought high, the sensor will operate in real time and the first reading
    output will be the range measured from this first commanded range reading. When the sensor tracks that the RX pin is low
    after each range reading, and then the RX pin is brought high, unfiltered real time range information can be obtained. For
    timing information please refer to pages # and #.

  • in Interfacing
    Avatar for jakedempsey

    So if the AT+FOO would return 3 lines and you really just cared about FOOTwo you would just maybe issue a wait or a SetTimeout for the AT+BAR command to ensure all of the AT+FOO response lines have been either handled or flushed?

    It is just weird that the callback handler for AT+BAR may get a response from AT+FOO. I would have thought the returned lines from the AT+FOO would be somehow indexed to that cmd and only that callback could/would get called for its returned lines. I guess though that can't happen because you don't know what response from the modem is tied to what command... now that I type this out I get why it works the way it does.

    Now that I have a deeper understanding of this.. I may just go ahead and tackle a rewrite on the SIM900 module.

Actions