New Program available – Display Example

There’s a new program in the repository, a Display Example, showing how to connect miniMO to OLED displays via I2C.

miniMO is a modular system where all modules are identical, which raises the question of how to tell who-is-who. I’ve always thought that it would be great if I could use an OLED screen as a tag, and after some tinkering (and with a bit of luck), I’ve found just the way to do it.

Above you can see miniMO connected to a 64×48 OLED screen, a soil moisture sensor, and a LED light. There are no other wires, as miniMO is powering the screen through the external power pin.

It only takes four wires to drive the screen: power, ground, data, and clock. I use solid-core wires, and the screen stands on its own without any issues whatsoever.

By default, miniMO comes with a jumper to select two out of three pins for either battery or external power, but if you connect all three pins together, the battery gets re-routed to the external pin, which becomes the screen’s power source. I haven’t found a three-pin jumper anywhere, but it is really simple to fashion one from a female header.

I never thought of using the power pins in this way, so this is a very fortunate hack!

Software-wise, I adapted Neven Boyanov’s library for Tinusaur (great project -you should check it out!). I modified the code so that it works with screens of different sizes and orientations, and made it easy for anyone to set them up. Other than that, I rearranged a few things and did my best to add meaningful comments everywhere.

On the subject of the screens, I am using SSD1306 OLEDs. These screens are very popular and easy to source online; you will find them both in SPI and I2C versions, of which I use the latter because it needs less wires. The first screen I bought came with a dedicated reset pin, so I breadboarded it adding a capacitor and a resistance to do the reset automatically:

Since miniMO is not designed to use a display, you can not use at the same time with a regular program. What I’ve found, however, is that I can set a module to use the screen once (in the setup phase), then revert it to its normal behavior. In this way, if you turn the module ON with the screen connected, the screen can (for instance) show the name of the module; if you then turn it OFF and ON again, this time without the screen, the module will operate as usual. I think this is a very acceptable trade-off between being able to use everything at once, and not being able to use a display at all; furthermore, it serves my original purpose and is a transparent modification to the existing programs.

Leaving the scope of the synthesizer programs, there’s plenty that can be done with miniMO and a display; the I/O 1, 2, and 3 are always available, and depending on how you configure the connections in the program, you can also use either I/O 4, or the push button.

The Display Example program reads the value of an input signal in I/O 3 (adjusted with the potentiometer, which acts as a trim pot), and lights an LED connected to the output when the input reaches a threshold. In the setup above, the input is coming from a moisture sensor: with the screen connected, I took readings from several planters around the house, and thanks to the display I could decide on a value for when they need watering. I could use the screen to display a message in that situation, but I turn the LED light ON to that same effect, so in this particular program you don’t have to use the screen after you’ve found a meaningful value.

In all, the Display example shows a bit of what’s possible; I’m focused in sound modules and the “tag” function already suits my needs, but lots more can be done.

Since I want to keep the programs lean, I haven’t added any capabilities beyond displaying text and a few auxiliary functions; coincidentally, David Johnson-Davies has done a lot of work on OLED screens lately, and he demonstrates an oscilloscope which I might bring to miniMO at some point. Also of note is Ilya Titov’s ATtiny arcade kit, a great kit which has a lot in common with miniMO.

Posted in Blog, Programs and tagged , .

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.