We are unable to integrate sensor and image data in Edge Impulse; both work separately but not together on NodeMCU. and ESP32 Cam

Question/Issue:
[I am facing an issue when integrating sensor data (MQ-2, MQ-3, MQ-135, temperature, and humidity) with image data (captured by the ESP32-CAM) in Edge Impulse.]
Project ID:
[867263]
[835630]
Context/Use case:
[ system is designed to predict the early stages of food spoilage. We are using components such as NodeMCU, ESP32-CAM with baseboard, MQ gas sensors (MQ-2, MQ-3, MQ-135), a DHT22 sensor, ADS1115, breadboard, jumper wires, and resistors. We have successfully established POST HTTP communication between the NodeMCU and ESP32-CAM. Sensor readings were collected using the Arduino IDE and saved as CSV files with proper labels, including: fresh_apple, spoiled_apple, fresh_banana, spoiled_banana, fresh_chikoo, and spoiled_chikoo. Additionally, we used Edge Impulse to collect image data of the same fruits, completed the deployment stage, and generated the ZIP file. Our current task is to integrate the sensor data (CSV files) with the image data and accurately predict food spoilage. We seek guidance on performing this integration and prediction process for our project]

Steps Taken:

  1. [ Collected sensor data (MQ-2, MQ-3, MQ-135, temperature, humidity) using NodeMCU and DHT22, and saved it as labeled CSV files (fresh_apple, spoiled_apple, etc.) via Arduino IDE.]
  2. [ Captured image data of fruits using ESP32-CAM and uploaded it to Edge Impulse for processing.]
    3.[Trained and deployed a model in Edge Impulse for sensor-based classification and generated the deployment ZIP file.]

Expected Outcome:
[The system is expected to accurately detect and predict food spoilage by combining gas sensor data, temperature and humidity readings, and image data using an Edge Impulse–based AI model, enabling early spoilage detection and reduced food wastage]

Actual Outcome:
[Although sensor-based spoilage detection was achieved, integrating multimodal data (sensor and image) within Edge Impulse posed implementation challenges]
Reproducibility:

  • [ ] Always
  • [✓] Sometimes
  • [ ] Rarely

Environment:

  • Platform: [ESP32-CAM, Nodemcu.]
  • Build Environment Details: [ Arduino IDE 2.3.6 ]
  • OS Version: [ Windows 11]
  • Edge Impulse Version (Firmware): [not used]
  • To find out Edge Impulse Version:
  • if you have pre-compiled firmware: run edge-impulse-run-impulse --raw and type AT+INFO. Look for Edge Impulse version in the output.
  • if you have a library deployment: inside the unarchived deployment, open model-parameters/model_metadata.h and look for ei-fruit_smell_classifier-arduino-1.0.2, ei-food_vision_model-arduino-1.0.5
  • Edge Impulse CLI Version: [Not used]
  • Project Version: [e.g., 1.0.0]
  • Custom Blocks / Impulse Configuration: [Time-series sensor data processing using gas sensors (MQ-2, MQ-3, MQ-135) and DHT22 with a classification learning block.]
    Logs/Attachments:
    [ https://mail.google.com/mail/u/0?ui=2&ik=e66de27088&attid=0.1&permmsgid=msg-f:1853673608678814709&th=19b992536ed133f5&view=att&disp=safe&realattid=f_mjqw2m8h3&zw and https://mail.google.com/mail/u/0?ui=2&ik=e66de27088&attid=0.2&permmsgid=msg-f:1853673608678814709&th=19b992536ed133f5&view=att&disp=safe&realattid=f_mjqw2m862&zw ]
    Additional Information:
    [ We tried to integrate both sensor data and image data using Google Gemini and ChatGPT, but these approaches did not work as expected. Therefore, we created two separate projects in Edge Impulse: the image project (ID: 835630) and the sensor project (ID: 867263). We completed the deployment and generated separate ZIP files for both image( ei-food_vision_model-arduino-1.0.5 )and sensor data(ei-fruit_smell_classifier-arduino-1.0.2). These libraries were installed in the Arduino IDE, but the sensor ZIP library failed to upload—the processing bar got stuck, even though all sensors are connected to the NodeMCU. Currently, we are getting outputs separately for images and sensors. We need suggestions on how to integrate both types of data, and we are open to making any necessary changes to improve the system.]

If you are looking to run multiple project models that use different data sources on the same device unfortunately it is not as simple as loading both libraries. This is possible on MCU, but it requires combining the two output C++ libraries : Run multiple impulses (C++) - Edge Impulse Documentation

It is also possible (however it is an advanced technique) to combine image and sensor data into one single model which utilises the information in both data types using an embeddings approach: Use embeddings for sensor fusion - Edge Impulse Documentation

Both of these approaches assume you’re working with the C++ Library deployment, if you want to take a C++ library from Edge Impulse and convert it to work as an Arduino Library I suggest the following approach:

  • Use one of your existing Edge Impulse Arduino libraries as a starting template
  • In your Arduino library replace the contents of /src with the folders in your newly combined C++ library
  • navigate to /src/edge-impulse-sdk and download this script to this location https://github.com/edgeimpulse/inferencing-sdk-cpp/blob/master/create-arduino-library.sh
  • run create-arduino-library.sh from this path, it will convert your library to be compatible with the Arduino IDE
  • import this newly created library as normal, it should work as expected