NRF51822 Generic iBeacon

Posted on
  • I picked up a cheap generic iBeacon that uses the nrf51822. You can see a listing on Ali Express at https://www.aliexpress.com/item/2V-3-3V-­NRF51822-Bluetooth-4-0-Wireless-Module-F­or-iBeacon-Base-Station-Intelligent-Cont­rol-System/32824004498.html

    Since it's running on the same chip as the micro:bit, is it safe to assume that if I were to get a programmer and connect it, I could potentially run espruino on this thing? I looked on the forums, and it appears that no one has brought this up before, or my search skills are lacking.

    If so, that would be incredible, but I have no idea where to start. I've already mangled this beacon a bit, so if I damage it in the process, it'll be no big loss.

    I'm already started on integrating my puck into my home automation system, which will perform context-aware actions based on what room it's in when the button is pressed (and potentially more complex actions based on sensor data). If it can be ported to run on this cheap a device, I can imagine having a set of various beacons attached to devices that would trigger specific actions in certain places (like a beacon that turns on the lights in whatever room you're in when you press it, or a beacon that controls my music system and sets it to the room I'm in).

  • if I were to get a programmer and connect it, I could potentially run espruino on this thing?

    Yes, absolutely. There's an image for NRF51TAG (you'd have to follow the build instructions at https://github.com/espruino/Espruino to build it), but that may just run as-is. Otherwise you may have to tweak the pin assignments in NRF51TAG.py to match your tag.

    Realistically the best way to program these is to use an nRF52832DK board and then connect GND, SWD and SWCLK. The DK is £30 or so so does put a bit of a dent in the cost savings of a cheap beacon though :)

    If you're interested it is possible to flash Espruino onto cheap fitness trackers as well: http://forum.espruino.com/conversations/­280747/

    However there's a whole new breed of nRF52 trackers and beacons out there that I'd recommend. You get 4x more RAM which really helps (because of fixed overheads that actually means 10x more JS code space).

  • That's great news! I'll look for a beacon based on the nrf52 and see if I can't get it to work as well.

    Would this cheap-o programmer work? That would keep costs much lower.

    Thanks for your help!

  • Would this cheap-o programmer work?

    Maybe? It doesn't list Nordic as one of the chips it supports though :)

  • I had Espruino running on that device a few months back using the micro:bit image.

    It gave errors about I2C in the console but otherwise worked fine. Tiny memory tho, so a lot of examples don't work.

    I programmed it with this cheapo SWD dongle: https://www.ebay.ie/itm/Brand-New-J-Link­-OB-ARM-Debugger-Programmer-Downloader-r­eplace-V8-SWD-M74-MO/152480021834?hash=i­tem2380847d4a:g:neoAAOSwOgdY0L8m

  • What software did you use with that programmer? The limited memory shouldn't be a problem for me, I'm not planning on doing anything extreme.

  • I used the free version of Segger J-Flash. It complains about the dongle being faulty but still works.

  • 3 years later.... I have a dozen nrf51-based tags. Is NRF51TAG still supported. I don't see it in boards dir. I tried using:
    BOARD=NRF51822DK
    DEFINES+= -DNRF51822DK
    PROJ_NAME=espruino_2v08.281_nrf51822
    EMBEDDED=1
    FAMILY=NRF51
    CHIP=NRF51822
    OPTIMIZEFLAGS+=-Os
    USE_BLUETOOTH?=1
    USE_GRAPHICS?=1
    SAVE_ON_FLASH=1
    DEFINES+=-DCONFIG_GPIO_AS_PINRESET
    DEFINES += -DUSE_DEBUGGER -DUSE_TAB_COMPLETE
    DEFINES += -DBOARD_PCA10028

  • Try the UNMAINTAINED_BOARDS branch?

  • Thanks Gordon.
    I assume it targets nRF5_SDK version 12 or less.

  • check this link NRF51TAG.py

  • Yes, it's SDK12 I believe. You don't get a bunch of code space on the 16k parts, but 32k should be reasonably usable

  • check this link NRF51TAG.py

    In case the space is tight it should be possible to remove GRAPHICS from there as it may not be that much useful on beacon/tag? Also there are 16 pages reserved for bootloader. If flashing via SWD is possible, removing that from line 55 and 58 could give more space for code or storage.

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

NRF51822 Generic iBeacon

Posted by Avatar for OpenSourceTeacher @OpenSourceTeacher

Actions