Raspberry Pi I2C OLED Display

First of all thank you to the Blokas team and others who contribute and maintain this project. I was able to get MODEP up and running on my Raspberry Pi 3B in about 20 minuets. Fantastic work.

I set out to build a guitar pedalboard using an Arduino SAMD21 and a Raspberry Pi running guitarix. I was able to get it mostly working, but then I found MODEP and I knew that I needed to switch. One of the features that I am missing is my OLED display. I was able to get it working with a menu on my Arduino using this library https://github.com/neu-rah/ArduinoMenu. Here is the full project if anyone is interested https://github.com/smp4488/Guitarix-Pedalboard.

I was wondering if it would be possible to get a display working with MODEP? I searched the MOD repos for “lcd” and “display” and was not able to find anything. I was able to get my OLED display working with my Raspberry Pi using the Luma OLED pyt6hon library. All of the demos run great on my I2C display.

My end goal is to move all of the display logic off of the Arduino and on to the Raspberry Pi. The Arduino would then be a USB midi device with my foot switches and potentiometers.

Any guidance would be greatly appreciated.

2 Likes

So after some more digging I may have found something. This post https://www.moddevices.com/blog/2018/01/15/tutorial-liquidcrystal-and-control-chain explains getting LCDs working with the control chain. This led me to the arduino lib that is linked in that article. After looking through the moddevices repo list I found this https://github.com/moddevices/cc-master which may be what I need. I will update if I make any progress.

5 Likes

So I went down the road of control chain and that is for hooking up external devices. I don’t think I will be able to use it for this. I’ve been looking into mod-host and mod-ui as they seem to be the sources of information for mod. Does anyone know of any APIs or ways to hook into either of those services? Ive also been looking at the websocket as another point of interest. https://forum.moddevices.com/t/open-socket-on-modduo/761

After inspecting the network requests on the mod-ui I was able to see some of the api calls that are made to control different things. I have been able to get a list of the effects using the JSON data from “http://127.0.0.1/effect/list”. I think I may be able to build this out using just the web API. I am by no means a python expert, but i’m trying to build basic menu functionality using what I have so far.

4 Likes

I found the mother load for the API documentation! https://github.com/moddevices/mod-ui/blob/f5d16aaed8e6beb00a7e73d383be49893e23c085/mod/webserver.py#L2014.

One issue that I see with this is that this is one way communication. There would be no way for mod-ui to talk back to this pyton script. I’m thinking a websocket or tapping into the unix sockets to get live data back from the mod-ui.

5 Likes

That’s really useful, thanks! I am putting together something similar, but with a wireless pedal. I have an Adafruit Feather Huzzah (which is an ESP8266 board) with an OLED display and powered by rechargeable LiPo battery mounted in an old amp pedal-switch case. It connects wirelessly to to the Pisound and I’ve had success sending OSC messages over WiFi, but I will now also try the API.

2 Likes

Hi @smplman,

Is the I2C a requirement? With the RPi you can do much more in easier ways. For example, with HDMI and DSI displays. You could even work with touch screen if you want. From then on, you’d just access the RPi as if it were you’re desktop or create a GUI that fits your screen and your needs.

/edwillys

@a9johnson that looks awesome! It’s similar to what i have but it’s not wireless.

@edwillys I2C isn’t a requirement, but it’s what I have. No matter what display we use we still need a way to interface with MODEP.

Hi guys.

Been looking at the same. Keen to get a rotary encoder and OLED to scroll and load patches. Using the API, i’m able to list and load available patches programmtically. Here’s what I have (untested) so far. It’s not changing the title in the UI and I haven’t checked the audio part works yet, but it maybe useful to someone.

import requests
import urllib, json
from urllib import quote

# Get pedalboard list as json
pedalboardlist_url = 'http://localhost/pedalboard/list'
response = urllib.urlopen(pedalboardlist_url)
pedalboardlist = json.loads(response.read())

m = []
keypath = {}
keymenu = {}

id = 0

for p in pedalboardlist:
    #print(pedalboardlist[id]['title'])
    m.append(pedalboardlist[id]['title'])
    keypath[id] = pedalboardlist[id]['bundle']
    keymenu[id] = pedalboardlist[id]['title']
    id = id+1

print(keymenu)

#pass fileid into function to load pedalboard
def loadPedalboard(fileid):
    modepurl = 'http://localhost/pedalboard/load_bundle/'
    bundlepath = pedalboardlist[fileid]['bundle']
    callparams = {'bundlepath': quote(bundlepath), 'isDefault':0}
    requests.get('http://localhost/reset') #needed as otherwise pb loads on top of previous!
    loadPedalboard = requests.post(url = modepurl, params = callparams)
    requests.get('http://localhost/snapshot/name?id=-1')
    print(bundlepath + " Loaded...")

#Pass in Id of Pedalboard to be loaded
loadPedalboard(5)
4 Likes

@solaris76 very nice! I will have to use some of what you have so far. Here is my repo with what I have so far.

1 Like

You guys are awesome! I was also planning on doing a guitarix pedal and just discovered MODEP this week. My switches and rotary encoders arrived today and I was able to use them to send Midi controls to MODEP.

The next thing on my list is a display. I was thinking of having like 4 small screens to show the selected pedal info with a switch and some knobs, like the Line 6 HX. But I’m also considering one larger screen with the patch board, like the HeadRush Gigboard. The biggest barrier for me is that I know nothing about making a GUI, where do I start?

1 Like

Really great job smplman!

1 Like

I have a rough project here if anyone is interested:

It’s written in Node with TypeScript and is running on my RPI4; have two MCP23017 multiplexers to handle five rotary encoders as well as a TCA9584A to drive five 128x64 OLEDs. All this is done via I2C and two extra wires (for interrupt handlers) for a total of six wires to the RPI itself.

Documentation is extremely sparse, but if anyone is interested I’m happy to share more.

2 Likes

hey you guys,
I was trying to do the same thing
everything is working fine, sound card, midi pedalboard etc
the screen to change few things on the fly without the need to use the MOD-UI was what I was looking for and I ended up on this forum which the final product is fantastic
maybe will help some of you coder out there (I’m not a coder so for me is a bit too much)
pi-stomp
I’m tempted to buy the hardware but I have pretty much almost everything already
plus I’m using PI4 while this project is using a PI3 so haven’t decided yet
but it could be a good point to grab some of the code and make it useful to other projects