• Hardware
  • is anyone successfully using i2c OLED / LCD?

@kreiff I amended the post above to fix some numbers in the refresh rate computations. I will try to measure these on the scope and see what it takes in practice.

@giuliomoro - First off, thanks, as always, for the extremely detailed reply and code review.

giuliomoro Display(), however, transmits the whole buffer to the display, and this is the real bottleneck: regardless of how many pixels you changed since the last time you called Display(), calling it will always take the same time.

Ahh! Ok - I didn't realize this redrew the whole screen for each call. Presumably I can just grab a snapshot of the waveform from PD every 20ms and redraw the whole updated waveform rather they redrawing the whole screen pixel by pixel.

giuliomoro ideally I would send the whole display at one time. This way you would only call Display() when you have a handful of pixels or even a full display to draw. When sending such large buffers you may want to send OSC messages as blob instead of float. Either way, drawing the display less often is going to be a big advantage.

Yeah - this definitely seems like the best way to approach it. I'm actually kind of relieved to know that the library is fairly efficient and it was just my approach and misunderstanding of the Display() function that has been the issue.

giuliomoro it seems that it could possibly reach 1MHz or beyond.

I'll try to work within the confines of the 400kHz clock frequency for now. I clearly have to re-evaluate my approach to drawing the waveforms. I think if I can achieve 10-15 fps at 400kHz it would still be acceptable for this application.

I'll report back with my progress! Thanks again!

3 months later

This is a super interesting thread and full of all sorts of in-depth details.

@kreiff Did you manage to ever sort out your display issues?

@giuliomoro Is there any movement on an official Bela library for i2c OLEDs or was that a challenge for the community?

    @Flowdeeps - I ended up taking a different route. My goal with the oled screen was to try any get an oscilloscope that I could use to monitor modulation in real time. I attempted to implement the Display() function the way that Giulio had recommended by grabbing a screen's worth of pixel values in an array and populating them every 20ms, but I wasn't able to get the array values to populate correctly - I'm not a particularly good C / C++ coder...

    In the end, I resorted to setting up a wifi connection between my phone and the effect pedal I was building with a little wifi dongle and using the IDE oscilloscope via DAC 27. This worked really well for my application and honestly feels a little like the OP-Z use of a phone as a "screen".

    I might try my hand at it again at a later date, but this isn't on my short list of projects to come back to.

    20 days later
    10 days later

    Hey guys,

    Is it possible to use two devices at the same time (trill craft + oled screen) on the pins SDA, SCL, V+ AND GND of the bela black?

      RafaeleAndrade
      they are all I2C, so im hoping as long as they have different addresses this would be possible.
      (this is whats happening with the 2 oleds on the TT above)

      once the trill arrive, Im planning on making something with a few trill, a couple of i2c encoders and an oled !

      the guy who supplied me with the above Terminal Tedium, pointed me to these :

      https://www.tindie.com/products/saimon/i2cencoder-v21-connect-rotary-encoder-on-i2c-bus/

      they are not cheap, but the idea is Im going to add one or two to the above terminal tedium 'expander',
      and also use a few with the trill/bela 🙂

        thetechnobear they are all I2C, so im hoping as long as they have different addresses this would be possible.

        Yes. Each type of sensor has a dedicated range of address, which are non-overlapping between sensor types. You can set the sensor to a different address by applying a tiny amount of solder on the board to bridge two pads together.

          9 days later

          giuliomoro Thank you. I've got this mostly to work. However whenever the OSC2OLED program runs for the first time when the Bela is started I am getting this error:

          alt text

          If it is run again the program runs fine and there is no error message. However when running it from start up it stops the other Bela program that is enabled to run on start up.

            giuliomoro changed the title to is anyone successfully using i2c OLED / LCD? .

            giuliomoro No just the OSC2LED. The Bela program is just a simple pd sketch that is sending OSC data to the screen for testing purposes at the moment.

            insignificatother However when running it from start up it stops the other Bela program that is enabled to run on start up.

            Can we see the .service file? Also, what is the log of the Bela program that runs on startup, and what is the log of your program running at startup? You can achieve such logs with journalctl -fu SERVICENAME

            Here is the .service file

            [Unit]
            Description=OSC to IC2 Screen Launcher
            After=network-online.target
            
            [Service]
            ExecStart=/root/Bela/scripts/run_project.sh Screen_Test_Error
            Type=simple
            Restart=always
            RestartSec=1
            WorkingDirectory=/root/Bela/projects/Screen_Test_Error
            Environment=HOME=/root
            KillMode=process
            
            [Install]
            WantedBy=default.target

            Here are the logs

            root@bela:~# journalctl -fu bela_startup.service
            -- Logs begin at Thu 2016-11-03 17:16:43 UTC. --
            Nov 03 17:16:56 bela stdbuf[293]: sigmund~ version 0.07
            Nov 03 17:16:56 bela stdbuf[293]: Bela digital: channel 0 is set as input at message rate
            Nov 03 17:16:56 bela stdbuf[293]: Bela digital: channel 1 is set as input at message rate
            Nov 03 17:16:56 bela stdbuf[293]: Bela digital: channel 2 is set as input at message rate
            Nov 03 17:16:56 bela stdbuf[293]: Bela digital: channel 3 is set as input at message rate
            Nov 03 17:16:56 bela stdbuf[293]: connecting to port 7562
            Nov 03 17:17:00 bela stdbuf[293]: Makefile:570: recipe for target 'runonly' failed
            Nov 03 17:17:00 bela stdbuf[293]: make: *** [runonly] Terminated
            Nov 03 17:17:00 bela systemd[1]: Stopping Run Bela at boot...
            Nov 03 17:17:01 bela systemd[1]: Stopped Run Bela at boot.
            root@bela:~# journalctl -fu custom_program 
            -- Logs begin at Thu 2016-11-03 17:16:43 UTC. --
            Nov 03 17:17:03 bela systemd[1]: custom_program.service: Service hold-off time over, scheduling restart.
            Nov 03 17:17:03 bela systemd[1]: Stopped OSC to IC2 Screen Launcher.
            Nov 03 17:17:03 bela systemd[1]: Started OSC to IC2 Screen Launcher.
            Nov 03 17:17:04 bela run_project.sh[681]: Checking the board is up and running at root@192.168.7.2...Warning: Permanently added '192.168.7.2' (ECDSA) to the list of known hosts.
            Nov 03 17:17:03 bela run_project.sh[681]: done
            Nov 03 17:17:03 bela run_project.sh[681]: Board found at root@192.168.7.2
            Nov 03 17:17:03 bela run_project.sh[681]: Running Screen_Test_Error...
            Nov 03 17:17:03 bela run_project.sh[681]: Pseudo-terminal will not be allocated because stdin is not a terminal.
            Nov 03 17:17:04 bela run_project.sh[681]: make: Warning: File 'libraries/UdpClient/build/UdpClient.d' has modification time 96520642 s in the future
            Nov 03 17:17:05 bela run_project.sh[681]: Running /root/Bela/projects/Screen_Test_Error/Screen_Test_Error

              insignificatother ExecStart=/root/Bela/scripts/run_project.sh Screen_Test_Error

              run_project.sh is going to call make stop, thus killing the other program. You should run the program directly with /root/Bela/projects/Screen_Test_Error/Screen_Test_Error.