Uno+ esp32+ ADS1115 + serial communication issue

Dears
Good morning,
It's my first time working with these communication.
So my idea is to capture some voltages from UNO + ADS1115 an send datas to ESP32 and SHARP display. And different values from voltages show different text.
But it seems that ESP 32 + SHARP don't work.
On contrary, i received this note :

rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0030,len:1344
load:0x40078000,len:13964
load:0x40080400,len:3600
entry 0x400805f0
Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled
Core 1 register dump:
PC : 0x400d1eb6 PS : 0x00060430 A0 : 0x800f37e5 A1 : 0x3ffb2130
A2 : 0x00000000 A3 : 0x00000000 A4 : 0x00000000 A5 : 0x0000ffff
A6 : 0x00000000 A7 : 0x00000000 A8 : 0x00000007 A9 : 0x00000090
A10 : 0x00000000 A11 : 0x00000000 A12 : 0x00000014 A13 : 0x00000004
A14 : 0x3ffb8188 A15 : 0x80000001 SAR : 0x00000000 EXCCAUSE: 0x0000001c
EXCVADDR: 0x00000000 LBEG : 0x40086809 LEND : 0x40086819 LCOUNT : 0xfffffffc
Backtrace: 0x400d1eb3:0x3ffb2130 0x400f37e2:0x3ffb2150 0x400d17b1:0x3ffb2170 0x400d1a32:0x3ffb21d0 0x400f3c05:0x3ffb2200 0x400d2d53:0x3ffb2220 0x400d2d65:0x3ffb2240 0x400d1538:0x3ffb2260 0x400d314e:0x3ffb2290
ELF file SHA256: 9e1bc8b0e48a62d1

with these codes :

From Uno (sender):

#include <Wire.h>
#include <Adafruit_ADS1X15.h>
#include <SoftwareSerial.h>

// Serilal communication
SoftwareSerial softPort(-1,9); //Rx not declared, TX

// Initialize the ADS1115 with the default address (0x48)
Adafruit_ADS1X15 ads;

void setup() {

  Serial.begin(9600);
 Wire.begin();
   ads.begin();

}
void loop() {

  int16_t adc0 = ads.readADC_SingleEnded(0); 
  // Read the voltage from channel 0 (A0) of the ADS1115

  float voltage = adc0 * 0.0001875; // Convert ADC value to voltage
String voltageStr = String(voltage, 2);  // Convert voltage to a string
Serial.println(voltageStr);  // Send the voltage to esp32 via serial communication
 
  delay(1000);// Wait for 1 second before taking the next reading

}

to ESP 32 (receiver):

#include <Adafruit_GFX.h>
#include <Adafruit_SharpMem.h>
#include <WiFi.h>
#include <Wire.h>

// any pins can be used
#define SHARP_SCK  13
#define SHARP_MOSI 11
#define SHARP_SS   10

//CONNECTION ARDUINO UNO AND ESP 32

#define TXp2  9


// Set the size of the display here, e.g. 240x400!
Adafruit_SharpMem display(SHARP_SCK, SHARP_MOSI, SHARP_SS, 144, 168);
// The currently-available SHARP Memory Display (144x168 pixels)
// requires > 4K of microcontroller RAM; it WILL NOT WORK on Arduino Uno
// or other <4K "classic" devices!  The original display (96x96 pixels)
// does work there, but is no longer produced.

#define BLACK 0
#define WHITE 1

int minorHalfSize; // 1/2 of lesser of display width or height

void setup()
{
  display.print ("Fungi World:");
   display.setTextSize(1);
   display.setTextColor(BLACK);
   display.setCursor(0,0);

   Serial.begin(115200);
   Wire.begin(9600, SERIAL_8N1,TXp2);
  }

  
void loop ( )
{

if(Wire.available() > 0)
{
    String voltageStr = Serial.readString(); // Read the voltage value from the serial buffer
    float voltage = voltageStr.toFloat();

    if (voltage >= 0 && voltage < 0.2) {  // Display the corresponding word based on the voltage value
  display.println("MAGIQUE");
    } 
    else if (voltage >= 0.3 && voltage < 0.7) {
      display.println("POWER");
    }
    else if (voltage >= 0.8 && voltage < 0.2) {
      display.println("POWER2");
    }
     else {
      display.println("ERROR");
    }

    // Update the display
    // display.clearDisplay(); 
     }
     }

I was inspired by this older post.

And here my connexions with pictures + drawing:




Dossier par défaut_20240427.pdf (301,4 Ko)

Thank you so much!
Best

Forget about anything else until you get the display working with the ESP32. Connect only the screen to the board, nothing else

You mean arduino's code inside esp32? For sure without serial communication.

I tested before the sharp.ino and it worked very well!

Just so it's am clear. Are you saying that you can display data on the screen using the SHARP display

If so then why did you say

I mean when i did this serial communication, there's nothing showing. So may be there's an issue with my code!

With the last test ( from adafruit to test esp 32 + display), it's working!

It is not clear whether you have the whole project working and not just the display

any particular reason to use the UNO
connect the ADS1115 and SHARP to the ESP32 and discard the UNO
make the project much simpler

got it!
(do you think esp32 will get enough memory?)

the UNO has 32KB of flash 2KB of SRAM
the ESP32-WROOM-32 has 4MB flash 520KB SRAM

have a look at Comparison table for ESP8266/ESP32/ESP32-S2/ESP32-S3/ESP32-C3/ESP32-C6

the ESP32 uses 3.3V logic so take care connecting 5V logic devices (use level converters)

edit: have a look at how-to-use-ads1115-16-bit-adc-module-with-esp32

Ok so I created one script. My sharp display has a 3V3 output.


#include <Adafruit_ADS1X15.h>
#include <Adafruit_SharpMem.h>
Adafruit_ADS1X15 ads; /* Use this for the 16-bit version */


// any pins can be used
#define SHARP_SCK  13
#define SHARP_MOSI 11
#define SHARP_SS   10

// Set the size of the display here, e.g. 400x240!
Adafruit_SharpMem display(SHARP_SCK, SHARP_MOSI, SHARP_SS, 400, 240);
// The currently-available SHARP Memory Display (144x168 pixels)
// requires > 4K of microcontroller RAM; it WILL NOT WORK on Arduino Uno
// or other <4K "classic" devices!  The original display (96x96 pixels)
// does work there, but is no longer produced.

#define BLACK 0
#define WHITE 1

int minorHalfSize; // 1/2 of lesser of display width or height
void setup() {

//sharp display
  display.print ("Fungi World:");
  display.begin();
  display.clearDisplay();
  
  display.setTextSize(2);
  display.setTextColor(BLACK);
  display.setCursor(0, 0);

//ADS1115
  Wire.begin();

  ads.begin();
Serial.begin(115200);
 
  Serial.println("FUNGI WORDS");
  //Serial.println("ADC Range: +/- 6.144V (1 bit = 3mV/ADS1015, 0.1875mV/ADS1115)");
 
  // The ADC input range (or gain) can be changed via the following
  // functions, but be careful never to exceed VDD +0.3V max, or to
  // exceed the upper and lower limits if you adjust the input range!
  // Setting these values incorrectly may destroy your ADC!
  //                                                                ADS1015  ADS1115
  //                                                                -------  -------
   ads.setGain(GAIN_TWOTHIRDS);  // 2/3x gain +/- 6.144V  1 bit = 3mV      0.1875mV (default)
  // ads.setGain(GAIN_ONE);        // 1x gain   +/- 4.096V  1 bit = 2mV      0.125mV
  //ads.setGain(GAIN_TWO);        // 2x gain   +/- 2.048V  1 bit = 1mV      0.0625mV
  // ads.setGain(GAIN_FOUR);       // 4x gain   +/- 1.024V  1 bit = 0.5mV    0.03125mV
  // ads.setGain(GAIN_EIGHT);      // 8x gain   +/- 0.512V  1 bit = 0.25mV   0.015625mV
  // ads.setGain(GAIN_SIXTEEN);    // 16x gain  +/- 0.256V  1 bit = 0.125mV  0.0078125mV
 if (!ads.begin())
  {
    Serial.println("Failed communication.");
    while (1);
  }
}


void loop() {

  // Read the voltage from channel 0 (A0) of the ADS1115

  int16_t adc0 = ads.readADC_SingleEnded(0);

  float voltage = adc0 * 0.0001875; // Convert ADC value to voltage

 // Display the corresponding word based on the voltage value

  if (voltage >= 0 && voltage < 1) {

    display.println("MAGIQUE");

  } else if (voltage >= 1 && voltage < 2) {

    display.println("POWER");
  } else {
display.println("ERROR");
  }

  // Update the display
delay(1000); // Wait for 1 second before taking the next reading
}

But again i see this message :

ELF file SHA256: 56464779b173d60a
Rebooting...
ets Jul 29 2019 12:21:46
rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:1344
load:0x40078000,len:13936
load:0x40080400,len:3600
entry 0x400805f0
Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled.
Core 1 register dump:
PC : 0x400d1f36 PS : 0x00060430 A0 : 0x800f3eb5 A1 : 0x3ffb2130
A2 : 0x00000000 A3 : 0x00000000 A4 : 0x00000000 A5 : 0x0000ffff
A6 : 0x00000000 A7 : 0x00000000 A8 : 0x00000007 A9 : 0x00000190
A10 : 0x00000000 A11 : 0x00000000 A12 : 0x00000014 A13 : 0x00000004
A14 : 0x3ffb8188 A15 : 0x80000001 SAR : 0x00000000 EXCCAUSE: 0x0000001c
EXCVADDR: 0x00000000 LBEG : 0x400867fd LEND : 0x4008680d LCOUNT : 0xfffffffc
Backtrace: 0x400d1f33:0x3ffb2130 0x400f3eb2:0x3ffb2150 0x400d21b1:0x3ffb2170 0x400d2432:0x3ffb21d0 0x400f41b9:0x3ffb2200 0x400d3dc3:0x3ffb2220 0x400d3dd5:0x3ffb2240 0x400d150b:0x3ffb2260 0x400d4102:0x3ffb2290

Any ideas?

Use the esp exception decoder to get the source lines associated with the exception. With the exception address of 0 you are probably trying to use a null pointer.

The top line of the stack will be where the exception occurred. the rest of the stack will show how you got there. The line numbers are the line after the call because the stack shows the return address.

Ok! thanks

I saw a lot of tutorial connecting I2C and ADS1115 but nothing about spi ( which is mine).
Any ideas?

If it is SPI it is not an ADS1115. The ADS1115 is an I2C device.

Ah everything is clear now!
Ok by change i get one i2C i will try it!

thank you

Good morning,
I get yet the issue. I tested with the exception decoder but it's showing nothing. That's why i don't understand. Someone could test it with his own?

Guru Meditation Error: Core  1 panic'ed (LoadProhibited). Exception was unhandled.

Core  1 register dump:
PC      : 0x400d130e  PS      : 0x00060430  A0      : 0x800f1519  A1      : 0x3ffb26c0  
A2      : 0x00000000  A3      : 0x00000000  A4      : 0x00000000  A5      : 0x0000ffff  
A6      : 0x00060220  A7      : 0x00000001  A8      : 0x00000007  A9      : 0x00000190  
A10     : 0x00000000  A11     : 0x3ffc11b0  A12     : 0x00000014  A13     : 0x00000004  
A14     : 0x3ffb8874  A15     : 0x80000001  SAR     : 0x0000001c  EXCCAUSE: 0x0000001c  
EXCVADDR: 0x00000000  LBEG    : 0x400865b9  LEND    : 0x400865c9  LCOUNT  : 0xfffffffd  


Backtrace:0x400d130b:0x3ffb26c00x400f1516:0x3ffb26e0 0x400d1589:0x3ffb2700 0x400d180a:0x3ffb2760 0x400f1915:0x3ffb2790 0x400d27f7:0x3ffb27b0 0x400d2809:0x3ffb27d0 0x400d1244:0x3ffb27f0 0x400d42f6:0x3ffb2820 

ELF file SHA256: 0000000000000000

Thank you!

Make a sketch that just reads the ads1115, no code for the display and leave the display unconnected. Get that to work first.
Then do the same with the display, without code for the ads1115 and without the adc connected. This will tell you where the problem lies so you can focus on the relevant bit.

My expectation is that the display library does something that's not compatible with the esp32 platform, but I've not looked into it.

I get this now :

PC: 0x400d130e
EXCVADDR: 0x00000000

Decoding stack results
0x400f1516: _svfiprintf_r at /builds/idf/crosstool-NG/.build/HOST-x86_64-apple-darwin12/xtensa-esp32-elf/src/newlib/newlib/libc/stdio/vfprintf.c line 1768
0x400d1589: loop() at /Users/alizeearmet/Documents/Arduino/sharp_fongical/sharp_fongical.ino line 79
0x400d180a: Adafruit_GFX::drawChar(short, short, unsigned char, unsigned short, unsigned short, unsigned char, unsigned char) at /Users/alizeearmet/Documents/Arduino/libraries/Adafruit_GFX_Library/Adafruit_GFX.cpp line 1149
0x400f1915: get_arg at /builds/idf/crosstool-NG/.build/HOST-x86_64-apple-darwin12/xtensa-esp32-elf/src/newlib/newlib/libc/stdio/vfprintf.c line 2280
0x400d27f7: i2c_slave_free_resources at /Users/alizeearmet/Library/Arduino15/packages/esp32/hardware/esp32/2.0.14/cores/esp32/esp32-hal-i2c-slave.c line 614
0x400d2809: i2c_slave_free_resources at /Users/alizeearmet/Library/Arduino15/packages/esp32/hardware/esp32/2.0.14/tools/sdk/esp32/include/hal/esp32/include/hal/i2c_ll.h line 284
0x400d42f6: setCpuFrequencyMhz at /Users/alizeearmet/Library/Arduino15/packages/esp32/hardware/esp32/2.0.14/cores/esp32/esp32-hal-cpu.c line 154

What code/sketch generates this error?

Also, are you calling the display.begin() function anywhere? This is likely part of your problem. Study the example for this display closely and see if you can get it to run on your esp32.

this one :

Adafruit_ADS1115 ads; /* Use this for the 16-bit version */
// any pins can be used
#define SHARP_SCK  13
#define SHARP_MOSI 11
#define SHARP_SS   10
// Set the size of the display here, e.g. 400x240!
//Adafruit_SharpMem display(SHARP_SCK, SHARP_MOSI, SHARP_SS, 400, 240);
// The currently-available SHARP Memory Display (144x168 pixels)
// requires > 4K of microcontroller RAM; it WILL NOT WORK on Arduino Uno
// or other <4K "classic" devices!  The original display (96x96 pixels)
// does work there, but is no longer produced.
#define BLACK 0
#define WHITE 1
int minorHalfSize; // 1/2 of lesser of display width or height
//ADS1115
void setup (void)
{
  Serial.begin(115200); //115200 avec esp32 ou 9600 uno 
 Serial.println("FUNGI WORDS");
 //Serial.println("ADC Range: +/- 6.144V (1 bit = 3mV/ADS1015, 0.1875mV/ADS1115)");
 // The ADC input range (or gain) can be changed via the following
  // functions, but be careful never to exceed VDD +0.3V max, or to
  // exceed the upper and lower limits if you adjust the input range!
  // Setting these values incorrectly may destroy your ADC!     ADS1015  ADS1115
  //                                                                -------  -------
  // ads.setGain(GAIN_TWOTHIRDS);  // 2/3x gain +/- 6.144V  1 bit = 3mV      0.1875mV (default)
  // ads.setGain(GAIN_ONE);        // 1x gain   +/- 4.096V  1 bit = 2mV      0.125mV
  ads.setGain(GAIN_TWO);        // 2x gain   +/- 2.048V  1 bit = 1mV      0.0625mV
  // ads.setGain(GAIN_FOUR);       // 4x gain   +/- 1.024V  1 bit = 0.5mV    0.03125mV
  // ads.setGain(GAIN_EIGHT);      // 8x gain   +/- 0.512V  1 bit = 0.25mV   0.015625mV
  // ads.setGain(GAIN_SIXTEEN);    // 16x gain  +/- 0.256V  1 bit = 0.125mV  0.0078125mV
 if (!ads.begin())
  {
    Serial.println("Failed communication.");
    while (1);
  }
  //sharp display
  display.print ("Fungi World:");
 display.begin();
display.clearDisplay();
  display.setTextSize(2);
 display.setTextColor(BLACK);
display.setCursor(0, 0);
}
void loop(void) {
// Read the voltage from channel 0 (A0) of the ADS1115
 int16_t adc0 = ads.readADC_SingleEnded(0);
float voltage = adc0; // Convert ADC value to voltage
  // Display the corresponding word based on the voltage value
  if (voltage >= 0 && voltage < 1) {
display.print("MAGIQUE");
} else if (voltage >= 1 && voltage < 2) {
display.print("POWER");
  } else {
display.print("ERROR");
  }
// Update the display
delay(1000); // Wait for 1 second before taking the next reading
}

Ok i did with your advice. So yes, it's the connexion with my sharp which not works. May be with one working with i2C!