non blocking I2C library ? or I2C OLED display alternative ?

emmanuel63

Well-known member
Hello,

For various audio projects, I sometimes use small and cheap 0,96" I2C OLED displays. But they are a pain to integrate in audio projects. Here are my problems :
- the I2C communication protocol blocks the program when the display is refreshed. It is a known issue. It is OK with slow refresh rates. But is there any work around ?
- these little displays tend to introduce noise, even with additional capacitor. How do you cope with that ?

What kind of display could I use for my next projects to avoid these problems ?

Emmanuel
 
For Teensy 3.x, there is an I2C library (i2c_t3) that can do non-blocking transmit.
From the documentation:
Wire.sendTransmission(^i2c_stop); - non-blocking routine, starts transmit of Tx buffer to slave. i2c_stop parameter can be optionally specified to indicate if command should end with a STOP (I2C_STOP) or not (I2C_NOSTOP). Use done(), finish(), or onTransmitDone() callback to determine completion and status() to determine success/fail. Note that sendTransmission() does not currently support timeouts (aside from initial bus acquisition which does support it).

return: none
parameters:
^i2c_stop = I2C_NOSTOP, I2C_STOP (default STOP)
This library is included with the TeensyDuino installation.

For Teensy 4.x, found this non-blocking library: [url]https://github.com/Richard-Gemmell/teensy4_i2c[/URL].

Haven't used this library myself but I remember having issues using I2C and audio. I had cracks in the audio when the display was refreshed.
It turned out to be not an issue with I2C perse but the IntervalTimer, calling a display routine, having the same priority as audio library.
Solved it this way:
Code:
...
IntervalTimer DisplayTimer;
...
void setup() {
  ...
  DisplayTimer.begin(UpdateDisplay, 100000);  // UpdateDisplay to run every 100 msecs
  DisplayTimer.priority(255);                 // set IntervalTimer priority lower than audio library priority [= 128]
}

void loop() {
  ...
}

void UpdateDisplay() {   
  ...
}

Perhaps this helps.
Paul
 
Thank you for your answer.
I have found that the oled charge pump circuit is responsible for the noise. I think I am going to use other displays.
Do you know some "quiet" alternatives ? LCD ?
Emmanuel
 
Sorry, can't recommend a quiet alternative because I did not (yet) run into a noise issue with those 0.96" Oled's (or other displays for that matter).
But how did you find out that the Oled charge pump circuit is responsible for the noise? Were you eventually able to suppress that noise? Was noise induced on the power lines? And with noise you mean noise on the analog signal from the DAC?
I also don't know what hardware you are using. Is it a Teensy 4 with audio adapter? Or perhaps Teensy 3? Or an external DAC?

Paul
 
I have also the problem with the noise of these displays.

I am not sure if a DC-DC-converter could help to reduce the noise. Costs more than the display. Needs a minimum load (current draw from display could be too little). For the data connection the ground has the be connected which possibly reduces the separation.

When I find the time I will try that.

Edit: I am using Teensy 4.0 with the audio adaptor board.

I have setups where the problem seems to be smaller. Possibly it is also a matter of powering. In one setup I am using one battery pack (18V) for the amplifier and a second power bank (5V) for the Teensy and everthing except the amplifier. Using a step down converter (18V to 5V) caused so much noise that I didn't put more time to looking for a solution.
Another thing could be to power the display from 5V and not over the 3V from the Teensy. As far as I understand there is a step down converter on the display anyway which makes everything running with 3V.
 
Back
Top