Arduino Nano or Uno with RH_ASK with Radiohead and SSD1306ASCII

Hello everyone

I tried to test the range of a 433MHz sensor with the Radiohead library. For easier handly I wanted to have a small message printed to an OLED screen.

Because the Adafruit library wouldn't work because it is too big, I tried the SSD1306ASCII library which still seems to be too big. As it wouldn't compile:

#include <Wire.h>
// 0X3C+SA0 - 0x3C or 0x3D
#define I2C_ADDRESS 0x3C

#include "SSD1306Ascii.h"
#include "SSD1306AsciiAvrI2c.h"

SSD1306AsciiAvrI2c oled;

#include <RH_ASK.h>
#include <SPI.h>

//RH_ASK driver;
RH_ASK driver(2000, 2, 11, 0); // Speed 2000, RxPin 2, TxPin 11, pttPin 0 - ESP8266 or ESP32: do not use pin 11 or 2
// RH_ASK driver(2000, 3, 4, 0); // ATTiny, RX on D3 (pin 2 on attiny85) TX on D4 (pin 3 on attiny85), 

void setup() {

  Serial.begin(9600);    // Debugging only
  // initialize display
  oled.begin(&Adafruit128x64, I2C_ADDRESS);
//  oled.clearDisplay();

}

void loop()
{
   uint8_t buf[RH_ASK_MAX_MESSAGE_LEN];//[18];//[RH_ASK_MAX_MESSAGE_LEN];
   uint8_t buflen = sizeof(buf);

    //if (driver.recv(buf, &buflen)) // Non-blocking
//    if (rf_driver.recv(buf, &buflen)) // Non-blocking
    {
      Serial.print("Message Received: ");
      Serial.println((char*)buf);
  /*int i;

  // Message with a good checksum received, dump it.
  driver.printBuffer("Got:", buf, buflen);*/
  oled.clear();
  oled.setFont(System5x7);
  oled.print("Message Received: ");
  oled.print((char*)buf);
  oled.print(buflen);
  }

}

Is there any way to make this work on a Nano or Uno? As far as I know there is no smaller library than the SSD1306ASCII. Is it possible to reduce the size of the Radiohead library or is there a smaller library to reliably send text and sensor data?

Thank you!

moses

Print your post. Use a highlighter to highlight the facts. You didn't need to take the cap off, did you?

Post a link to the libraries you are trying to use. Post your code. Post a link to the OLED device you are trying to write to. Post the results of compiling the code, where you claim to have determined that some library is too big.

There are Mega clones that are the same size as the Uno, with 4 times the SRAM and much more program space, if that is really the issue.

Hello PaulS

Thank you for the reply. Which code would you like me to post? I posted the receiver code in the initial post. BTW if I comment the RH constructor out the compiling works.

The error message from the IDE is in the attachment.

This is the SSD1306ASCII library:

This SSD1306 library I haven't tried yet:
https://tenbaht.github.io/sduino/api/Mini_SSD1306/

The code compiles fine with this 433MHz library and a OLED library, but it gives me a poor range, no matter what:

This is the link to the OLED:
https://www.amazon.de/gp/product/B00NHKM1C0/ref=ppx_yo_dt_b_asin_title_o09_s00?ie=UTF8&psc=1

If you need any more information I am happy to post more.

Thanks

moses

Error msg ssd1306ascii.txt (108 KB)

Have you tried downloading and installing the IDE locally? The results of compiling just might be different.

I always use it locally. Would I need to try to use the online version?

moserroger:
Because the Adafruit library wouldn't work because it is too big, I tried the SSD1306ASCII library which still seems to be too big. As it wouldn't compile:

The SSD1306ASCII library is indeed very memory efficient.

Your program compiles, on a working IDE, for a UNO to 27% of Flash and 36% of memory, plenty of spare space.

Is it possible to reduce the size of the Radiohead library or is there a smaller library to reliably send text and sensor data?

You can try using VirtualWire, which was the precedent library to RadioHead.

The equivalent library sketches compile with a little less memory usage with VW.

I always use it locally. Would I need to try to use the online version?

It seems bizarre to see

C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.21.0_x86__mdqgnx93n4wtt\hardware\tools\avr/bin

in the path, if you downloaded the IDE and tools from the Arduino.cc site, since the current version is 1.8.9.

Where DID you get the IDE and tools you are using?

PaulS:
Where DID you get the IDE and tools you are using?

I will need to check. I do believe downloaded it on Windows 10 from the "windows app store".

I was always convinced that it was installed locally. As I have an icon on the desktop and dont need to open a browser.

srnet:
Your program compiles, on a working IDE, for a UNO to 27% of Flash and 36% of memory, plenty of spare space.

Is there something wrong with my IDE?

Is there something wrong with my IDE?

Sound like that is possible. Download the current version from here.

Thank you all for the help!

It works much better now! But I am surprised that the Windows 10 App Arduino IDE (1.8.21.0) works not as good as the download version.

Is the download version always the one to prefere?

Thank you.

moses