Trying to bitbang i2c oled screen, using SSD1306Ascii library
-
@mfalkvidd Yes, that's what I ran into too.
Screens that can be controlled through software serial might be an option. So far though it seems that most Aliexpress shops call I2C screens "serial"..
-
I don't quite follow. Do you mean I should use the SPI version of the screen?
Since I am using NRF24 as a radio I thought that might not be possible, since it already occupies the Arduino Nano's SPI interface? -
Another idea might be to connect all analog sensors to I2C Analog-digital converters like the ADS1115:
https://www.aliexpress.com/store/product/I2C-ADS1115-16-Bit-ADC-4-channel-Module-with-Programmable-Gain-Amplifier-2-0V-to-5/324775_32903062908.htmlAs you can hook up multiple devices to the same i2c bus, simply attach the OLED and two of those ADS1115 boards (apparently you can assign up to 7 different I2C addresses to the ADC boards...) to the I2C bus.
-
If you insist on connecting the analog sensors to the arduino and switch to a software I2C implementation on non-hardware I2C pins, you might simply extend the SSD1306Ascii library. It currently has classes for the SSD1306 over the AVR hardware i2c, another class for generic Wire implementations (not tailored to atmel chips; e.g. I'm using it on nrf51822), and the SPI devices.
Looking at the SoftwareI2CLibrary docs, it appears that they even provide a Wire interface (SoftWire.h), so you might even get away with the SSD1306AsciiWire class for the OLED.
If that does not work, you'll have to write your own software I2C implementation for the SSD1306Ascii class (e.g. takt SSD1306AsciiWire, rename it to SSD1306AsciiSoftI2C and adjust it to use the SoftwareI2C library for all I2C communication).)
-
I don't quite follow. Do you mean I should use the SPI version of the screen?
Since I am using NRF24 as a radio I thought that might not be possible, since it already occupies the Arduino Nano's SPI interface? -
Thanks everyone. That's a lot to think about.
-
This looks interesting: a completely serial screen for $4:
https://www.aliexpress.com/item/1-77-1-8-128-160-HMI-Intelligent-Smart-USART-UART-Serial-TFT-LCD-Module-Display/32908921322.html -
For anyone finding this: I got that 'smart' LCD screen that can be controlled with serial commands. It's awesome!
The screen now displays a bar graph for all 6 moisture sensors (irrigation controller).