Hello all!

I’m hoping to connect a type of device called an iButton which can be used for providing a 64bit ID on contact. This is also referred to as 1-wire.

There already exists an Arduino library called OneWire for communicating with these devices, and I was wondering if there is guidance on porting/using Arduino libraries on Bela. It is C after all, right?

There’s a further complication in that I’m operating primarily in Pure Data. Should I implement this as an external in PD? Is that even possible to access the pins? Or is it better to keep it separate from PD somehow and send the iButton ID information using OSC or something?

I’m not looking for a complete solution, just some of your experienced intuitions on where to investigate next. Thanks everyone!

Best,
M

    LetItLearn

    I JUST realized that the simplest approach may be to process the iButtons with a small Arduino then output their IDs to the Bela board. Derr.

    I’d still prefer something fully Bela-based, so the question still stands. 🙂

    A link to the library and datasheet of the device?

    5 days later

    Sure!

    The DS1990R datasheet:
    https://datasheets.maximintegrated.com/en/ds/DS1990R-DS1990R-F5.pdf

    The OneWire library:
    https://github.com/PaulStoffregen/OneWire

    Since posting this, I located guide to generic C code for interfacing with iButtons:
    https://www.maximintegrated.com/en/design/technical-documents/app-notes/1/126.html
    https://www.maximintegrated.com/en/design/technical-documents/app-notes/1/187.html (Looks like this is the key to getting each iButton’s IDs… and it seems like a nightmare, but c’est la vie!)

    My Bela board is still in the mail so I can’t dive into hands on iterating, but for now I’m just looking for a Bela-related tutorial which may help me connect the dots between this demo code and implementing it on Bela.

    OK so let me get this straight: this is a device you read once (e.g.: at boot or program start) whose sole purpose is to provide you with a unique ID, is that correct?

    If the code needs to run only once at the beginning of a Bela program, that should be no problem; if it requires to run several times while the audio is running, then you either sacrifice a bit of CPU time and accept a lower bandwidth by reading one bit per audio callback or you do all of this on the on-board PRU microcontroller. Maybe let us know more about the use case and requirements and I can suggest the easiest approach?

    14 days later

    Yes! You’ve summed it up correctly. Being that there’s a clear path forward using C++ to interact with the device, I’m most interested in examples of how, say, after I’ve grabbed and processed this ID in C++, to pipe it over to another process like Faust or PD. Thanks for your thorough replies btw. I’m impressed 🙂

    Just got the board working (had a scare haha) and found the osc-send and osc-receive examples for Pure Data — I’ll play around with those.