GPIO support


#1

I know there’s probably not that many people doing this but it’s been fun playing around with RPi controlling ableton with juce over OSC and then to midi.

Has anyone managed to get GPIO working. I know of the wiringPi library but there hasn’t been an update to that in 5 years and can’t seem to find much else. I like the look of it as it’s more like Arduino code than anything else.

My other option would be to write a control surface in python as it supports GPIO and OSC (python-osc) well. But I don’t like python and UI stuff is a bit of a pain…

GPIO in Juce for custom embedded controllers anyone?


#2

I haven’t done it myself, but a in a recent project that used a RPI as a prototyping platform someone else in the team implemented the gpio and I2C access via plain POSIX calls. Shouldn’t be too hard, all you need is the register base address for the GPIOs and then you can access them as a memory mapped file. Shouldn’t be too hard to build a nice looking JUCE-style API around that and encapsulate that into a module. I‘d start with this right away if I had the time :grin:

A quick google search gave this as a first result, maybe a good starting point?

https://elinux.org/RPi_GPIO_Code_Samples


#3

We’ve had to do an embedded project were we had to write an I2C interface on a SiliconLabs chip from scratch and that was a real headache to get working. So for audio stuff which is more for me I think I’ll avoid having to do anything to low level.

I not particularly bothered about using I2C I just wanted to read some pot values to prototype my own custom controller / mixing desk that integrates with ableton and avoid using python if possible. Just realised ableton has OSCLive lib which is handy to bypass having a host app. but still want to use juce.

Will dig through those samples now though cheers.


#4

Oh I don’t think you necessarily need I2C, I just meant that I2C as well as GPIOs are no very big deal thanks to the Linux drivers that encapsulate the ultra low level work and deliver you a more high level Posix Interface to access those features of the ARM (of course a JUCE-style API is a lot cleaner again)


#5

Yeah I’ve just been looking at the sysFs example and didn’t realise that it would be that easy. Familiar with RPi.GPIO and have worked with UWP and GPIO…

I am actually curious on your background. Don’t really come across many people who have worked on embedded systems


#6

I’ve come from the other side - I’m just reaching the end of my electrical engineering studies at master degree. In this context I first learned C programing for bare metal micro controllers. The need for the massive power of modern CPUs for some heavy signal processing tasks brought me over from the embedded world to high level applications and my former work as a live sound engineer brought me the interest in audio - so this ultimately lead me to JUCE :grinning:


#7

Yeah I’ve been working with an EE this last year as the company I was working with who do lots of startups decided to go into medical apps and sensors. So had to learn bit of e-engineering + my dev team were either interns or in Islamabad so all the firmware writing and interfacing landed on my desk as chief eng.

As much of a headache as it was I have learnt all I wanted from it and realise how easy it is to build my stuffs (for lack of a better word). Quit that to work on my audio mastering software…


#8

FWIW I’ve used the wiringPi library in a JUCE rPi project recently and it was relatively easy to integrate and use.

The tricky part was actually working out which pins did what as we were using a relay board that plugs into the Pi.