MDBT42 - BLE Transceiver

Posted on
  • Hey there! Long time lover of JavaScript and backed the original Epsruino back in 2013. Great job!
    Time flies when you are having fun.

    I'm looking at the MDBT42 and wondering if it can be a transceiver.
    If not, is it feasible to alternate between modes fast enough to almost act like a transceiver?

    I want to advertise it as a BLE Beacon but also detect the presence of other Beacons and get their RSSI.
    I'm okay with using two MDBT42's or an MDBT42 and Puck.js, whatever you think is the best combination for this.

    Thank you,
    Trey A.

  • That's totally fine. Especially for advertising.

    You can just to NRF.setScan to scan for advertising, and the MDBT42's advertising will continue as normal.

    Scanning can take a lot of power (12mA?) if you do it all the time, so I'd advise not using the Puck as you might run your battery down quite quick. Other stuff should be fine :)

  • I plan on using a MDBT42 with a larger battery. I do need it to scan almost all the time. I would prefer to know when another MDBT42 is within range as soon as possible.

    Do you recommend an example that shows how to set the MDBT42 as both a Scanner and broadcaster?

    Thank you for your help,
    Trey

  • Literally all you need is:

    // change advertising
    var data = {a:1,b:2};
    NRF.setAdvertising({},{
      showName:false,
      manufacturer:0x0590,
      manufacturerData:JSON.stringify(data)
    });
    
    // start scanning
    NRF.setScan(function(d) {
      console.log(d.manufacturerData);
    }, { filters: [{ manufacturerData:{0x0590:{}} }] });
    

    Now it'll automatically pick up only other devices advertising with that manufacturer data

  • Wow! That is so awesome!
    Thank you!

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

MDBT42 - BLE Transceiver

Posted by Avatar for Invisibleman1002 @Invisibleman1002

Actions