ToF Sensor and I2C Display (Follow up issue)

Sensors / code stops
Feb 02, 2021, 01:47 pm
Hello, I seriously think that there is the possibility for some other issues with this setup (memory ....)!?

My setup uses a ToF VL53L1X and an 0.96" OLED (Adafruit_GFX.h, Adafruit_SSD1306.h and VL53L1X.h libraries) a Nano V3.0 host and a 400 kHz I2C bus intended to communicate with the two devices. By them selves they work fine.

I add code stepwise to verify the functionality and I use the serial monitor to basically output the same info as to the OLED.

A version with minimal functionality using both devices works fine and it did also without the mod described below. However very consistently when adding display.* code (OLED writings) it stops executing.

To combat the level issue above I disabled the internal pullup's with; digitalWrite(SDA, LOW), digitalWrite(SCL, LOW); and connected them externally to 3.3V via 10k resistors. With this mod...

  • ...it was possible to run the code (enabled display.* writings) a few times before it stopped executing. Without the mod it never executed! The mod had some effect but didnt solve the whole problem!. Obs! It is still a bread board solution which would cause more randomness behaviour than what I see if that was the real problewm.
  • ...it never displays anything on the OLED. Works fine with the minimum code.
  • ...a variable intended to be displayed on OLED aswell serial gets messed up. No problems when display.* code is disabled.

I am thinking of having an SPI display instead but if it is a memory, or something similar, problem than that might not be a solution.

Any thoughts?

Cheers /ripan

I am thinking of having an SPI display instead but if it is a memory, or something similar, problem than that might not be a solution.

The SSD1306 uses more than half the RAM of the Nano for the buffering of the image data. Use a board with more memory or adapt your code to save RAM (start by using the F() macro).

Ok, thanks pylon, I take it you definitely see a memory problem. I kind of lived in a world were I thought the compiler would raise an issue in that sense ;-).

I have a number of Nano's around and I like the foot print. I started to read about the f macro and have to admit I did not understand much of that description :slight_smile: .

Anyone know of a small sized display with onboard memory/buffer?

What does "small size" mean? What resolution? Graphic or character? Color or monochrome? What interface (I2C, SPI, serial, ...)?

Ok, its actually stated in the initiating post 0,96" 128x64, something of that ~size. Could use any of the interafces of a Nano i.e. the ones you listed :wink:

Cheers /ripan

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.