• Hello,
    I want to scan and save a list of my devices around me
    this is what I get :

    [
      BluetoothDevice: {
        "id": "16:81:e2:2a:3a:21",
        "rssi": -84,
        "data": new Uint8Array([30, 255, 6, 0, 1, 9, 32, 2, 50, 141, 254, 49, 137, 64, 152, 204, 169, 29, 27, 46, 84, 132, 252, 5, 163, 119, 196, 51, 11, 17, 122]).buffer,
        "manufacturer": 6,
        "manufacturerData": new Uint8Array([1, 9, 32, 2, 50, 141, 254, 49, 137, 64, 152, 204, 169, 29, 27, 46, 84, 132, 252, 5, 163, 119, 196, 51, 11, 17, 122]).buffer
       },
      BluetoothDevice: {
        "id": "19:28:83:ac:a2:12",
        "rssi": -88,
        "data": new Uint8Array([30, 255, 6, 0, 1, 9, 32, 2, 42, 141, 40, 247, 194, 40, 168, 87, 141, 136, 125, 152, 127, 146, 236, 253, 134, 225, 51, 85, 107, 62, 248]).buffer,
        "manufacturer": 6,
        "manufacturerData": new Uint8Array([1, 9, 32, 2, 42, 141, 40, 247, 194, 40, 168, 87, 141, 136, 125, 152, 127, 146, 236, 253, 134, 225, 51, 85, 107, 62, 248]).buffer
       },
      BluetoothDevice: {
        "id": "6f:00:ce:b4:2c:8b",
        "rssi": -90,
        "data": new Uint8Array([2, 1, 26, 2, 10, 12, 10, 255, 76, 0, 16, 5, 81, 28, 74, 203, 201]).buffer,
        "manufacturer": 76,
        "manufacturerData": new Uint8Array([16, 5, 81, 28, 74, 203, 201]).buffer
       }
     ]
    

    so I see that I have 3 devices around me

    I have sevral queesion about it :

    1. why I don't see the name of the device "david-Iphone", "My-computer" ? like I see when I scan using my phone?
    2. I have try to add time using

      getTime()
      

      but he gave me

      821.90802001953

    the MDBT42Q doesn't have an internal clock? , can I add to it RTC devcie to get the time?
    or maybe there is another device that already have rtc inside of it?
    4.is there any way I can save the data as text\json ? and then upload it to my device ?

    1. after I save the wanted devcies after scan , is there any way to know how much free space I got left on the devcie?

    Thanks ,

  • why I don't see the name of the device "david-Iphone", "My-computer" ? like I see when I scan using my phone?

    "My-computer"/etc is probably using Bluetooth, not bluetooth LE

    getTime() but he gave me 821.90802001953

    Turn on Set time on upload in the IDE comminications settings and upload some code. The default is 'on' so I'm surprised it's not ok.

    (new Date()).toString() should then give you a nice date

    is there any way I can save the data as text\json ? and then upload it to my device ?

    I just answered this in one of your other posts

    after I save the wanted devcies after scan , is there any way to know how much free space I got left on the devcie?

    process.memory()

  • Great
    but after reboot the device , I'm getting 1970 .
    I'm guessing it's because the device dons't have a RTC on it .
    so my question is - can I connect RTC to it?
    I have RTC module that I use to work with him on Arduino? can I connect it ?
    and if yes - can you share a link "howto"?

    Thanks ,

  • The nRF52 has an RTC but it's only 24 bit which means it can't store the full date (since 1970). As long as you don't do a hard reboot or unplug power it'll be fine.

    Yes you can add an RTC. If you just search the Espruino site for RTC you'll get http://www.espruino.com/DS3231

  • I probelly will reboot the unit and remove the battery every few days,
    this is why I need the clock.
    I looked at the page you link me and saw I need to use this pins:

    3V3 VCC
    GND GND
    B6 (SCL) DIO
    B7 (SDA) AIO

    you rcommand to use pullup resistors , will 10K is good for this job?

    also I want to connect an external storage (that way I will be sure that it save me the data even if the power is down\unplug)

    and this is the pinout you suggest:

    SD Card Espruino
    DI/CMD B5
    DO/DAT0 B4
    SCLK/CLK B3
    CD/CS/DAT3 B6
    VDD 3.3v
    VSS/GND GND

    again will 10K resistors will be good here also? (when I search google ,many examples for pullup 3.3V where 10K ).

    another question is can I use RTC and external storage at the same time on the same device?
    because I can see that both of them are using B6
    can I change one of them to use B8 (for example)?
    maybe for the exteranl CS? and then just change it also at the code ?

    // Wire up up MOSI, MISO, SCK and CS pins (along with 3.3v and GND)
    SPI1.setup({mosi:B5, miso:B4, sck:B3});
    E.connectSDCard(SPI1, B8 /*CS*/);
    // see what's on the device
    console.log(require("fs").readdirSync());
    

    Thank you for the answers in all the posts :-) ,


    by the way - maybe I'm working too hard and there is another solution for me ?
    a bluetooth5 BLE with RTC and SD card device?

  • Yes, 10k is fine - however if you use software I2C then there is no need for pullup resistors :) It's still an idea for SD cards though (at least on CS)

    You don't actually need to use B3/4/5/etc - on the nRF52 chip you're using you can use any pins.

    maybe I'm working too hard and there is another solution for me ?

    In terms of RTC, I think you are. The RTC will need its own battery or it will lose time too, so why not just permanently connect a battery to the MDBT42? Even a supercap on the 3.3v line should provide enough power for the main battery to be unplugged for a minute or so.

    The MDBT42Q draws so little power it seems there is no real reason to turn it off.

    Also you have 40k of nonvolatile storage on the MDBT42Q - so if that's enough you could avoid the SD card. SD cards can draw a lot of power when on so you may have difficult running from a small battery

    1. what do you mean by "software I2C"?
      isn't the code should be 'backup" by electronic?

    and what do you mean by this ?

    It's still an idea for SD cards though (at least on CS)

    1. I will check and run my test about the 40k ,

    Thanks ,

  • what do you mean by "software I2C"?

    This should help: http://www.espruino.com/I2C

    Software I2C (vs hardware) can apply internal pull-up resistors so doesn't need external ones

  • OK , I will try it
    why it said that it's recommand to use physical pull up resistors?

    and about the SD card ,

    1. if I power it using the MDBT42Q (3.3V) meaning the the data ill also work on 3.3V (this is what I know - is this ture? am I correct?
    2. if the above is true . will you still recomand to use the pullups?
    3. I found in the SD datasheet , that the operation is 3.3V\10uA - do you know if this really the value of the Amper? can I use this to calculate the neeeded battery?

    Thanks ,

  • if I power it using the MDBT42Q (3.3V) meaning the the data ill also work on 3.3V (this is what I know - is this ture? am I correct?

    Yes.

    if the above is true . will you still recomand to use the pullups?

    Only on the CS pin - which stops the SD card getting potentially corrupted if there's electrical noise.

    I found in the SD datasheet , that the operation is 3.3V\10uA - do you know if this really the value of the Amper?

    I don't know. The best way is to measure it for sure when it is working. 10uA is pretty low though.

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

MDBT42Q,2v04 run a scan every second and save wanted resault

Posted by Avatar for David1234321 @David1234321

Actions