# I2c Opcode for Csound on Bela

**URL:** <https://forum.csound.com/t/i2c-opcode-for-csound-on-bela/1464>\
**Category:** Developers\
**Created:** [November 27, 2023, 2:22pm UTC](https://forum.csound.com/t/i2c-opcode-for-csound-on-bela/1464 "2023-11-27T14:22:21Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Keyi\_Ding](https://forum.csound.com/user_avatar/forum.csound.com/keyi_ding/32/451_2.png) [@Keyi\_Ding](https://forum.csound.com/u/Keyi_Ding)\
**Post date:** [November 27, 2023, 2:22pm UTC](https://forum.csound.com/t/i2c-opcode-for-csound-on-bela/1464/1 "2023-11-27T14:22:21Z")

</div>

Hi all, I am doing a project with Dr.B for my senior thesis right now. Basically what I am doing is running a granular instrument on the Bela controller and using sensors to control the parameters, and I wonder if we could have a opcode for general sensors using i2c (like a gyroscope). I do know that Csound has a number of Opcodes for reading datas on the Trill sensors, and the trills use i2c as well. It might be achieved by modify the Trill opcodes, but I don’t know how to do that. Bela and Csound is a perfect match and having a opcode like that would open a lot more possibilities and conveniency. Does anyone have any thoughts on that? 😃

---

<div class="post-metadata">

**Author:** ![rory](https://forum.csound.com/user_avatar/forum.csound.com/rory/32/7_2.png) [@rory](https://forum.csound.com/u/rory)\
**Post date:** [November 28, 2023, 4:25pm UTC](https://forum.csound.com/t/i2c-opcode-for-csound-on-bela/1464/2 "2023-11-28T16:25:37Z")

</div>

I’ve no experience with the Bela, or the Trill opcodes, but as far as I recall, building for the Bela is not as straightforward as other platform. So the chances of getting a new opcodes developed for it might be a little low. Is there no other way of accessing the data from the controllers? Do any of the serial opcodes work?

---

<div class="post-metadata">

**Author:** ![luisantunespena](https://forum.csound.com/user_avatar/forum.csound.com/luisantunespena/32/48_2.png) [@luisantunespena](https://forum.csound.com/u/luisantunespena)\
**Post date:** [November 29, 2023, 11:00am UTC](https://forum.csound.com/t/i2c-opcode-for-csound-on-bela/1464/3 "2023-11-29T11:00:54Z")

</div>

I’ve been working with the Bela for some time and I use the trill opcode only for basic applications since it doesn’t work when sensoring more than one finger.  
I also think it would be a great step to have a general purpose I2C opcode. This would open new possibilities for using lots of widely spread digital sensors.  
@rory: which serial opcodes do you mean? serialRead? I never tried this one. I’ll try this next week.

---

<div class="post-metadata">

**Author:** ![rory](https://forum.csound.com/user_avatar/forum.csound.com/rory/32/7_2.png) [@rory](https://forum.csound.com/u/rory)\
**Post date:** [November 29, 2023, 11:39am UTC](https://forum.csound.com/t/i2c-opcode-for-csound-on-bela/1464/4 "2023-11-29T11:39:48Z")

</div>

Hi @luisantunespena, I’ve no idea how the Bela board transfers data from its controls. I know it’s possible to communicate with Arduino controls over a serial connection, so I thought perhaps it’s also possible here. Probably not though, as otherwise new opcodes wouldn’t need to have been written!

---

<div class="post-metadata">

**Author:** ![Keyi\_Ding](https://forum.csound.com/user_avatar/forum.csound.com/keyi_ding/32/451_2.png) [@Keyi\_Ding](https://forum.csound.com/u/Keyi_Ding)\
**Post date:** [November 29, 2023, 10:13pm UTC](https://forum.csound.com/t/i2c-opcode-for-csound-on-bela/1464/5 "2023-11-29T22:13:56Z")

</div>

Hi @rory , thank you very much for the reply! Csound Bela do has an opcode for sending and receiving OSC data. I was intended to using an arduino to read the i2c data and send to Bela via OSC, but my arduino board is in short of memory and I am waiting for a board with larger memory to arrived. I’ll test and update in this thread once my new board has arrived. But I’m still looking forward to any thoughts and advices on Csound i2c!
