Data Not Appearing On MongoDB
Describe the bug
Wisp units are not uploading data to MongoDB, despite sending successful packets to the server. This issue occurs on specific days, around February 6th-7th, 2025, and affects all current Wisp units.
Hardware in Use
The following hardware is currently in use:
- Feather M0
- Hypnos
- Sparkfun LTE Board
- SHT31
- SEN55
To Reproduce
To reproduce this behavior, follow these steps:
- Use the hardware listed above and the code attached.
- Set up the MQTT credentials using the provided JSON file.
- Run the device for approximately 75 minutes, allowing a batch to be reached.
- Observe the device uploading data to MongoDB.
Expected behavior
The expected behavior is that the data collected by the Wisp sensors should be uploading to MongoDB.
Code
The code used in the Arduino IDE is as follows:
#include <Loom_Manager.h>
#include <Hardware/Loom_Hypnos/Loom_Hypnos.h>
#include <Sensors/Loom_Analog/Loom_Analog.h>
#include <Sensors/I2C/Loom_SEN55/Loom_SEN55.h>
#include <Sensors/I2C/Loom_SHT31/Loom_SHT31.h>
//#include <Sensors/Analog/ACS712/Loom_ACS712.h>
#include <Logger.h>
#include <Internet/Connectivity/Loom_LTE/Loom_LTE.h>
#include <Internet/Connectivity/Loom_Wifi/Loom_Wifi.h>
#include <Internet/Logging/Loom_MongoDB/Loom_MongoDB.h>
Manager manager("Whisp_brd_v0p4_",13); //change
Loom_Hypnos hypnos(manager, HYPNOS_VERSION::V3_3, TIME_ZONE::PST, true);
Loom_Analog analog(manager);
//Main Air Quality, Temperature, and Humidity Sensing
Loom_SEN55 SEN55(manager);
Loom_SHT31 sht(manager);
//Connectivity
Loom_LTE lte(manager, "hologram", "", "");
Loom_MongoDB mqtt(manager, lte);
//A batch is logged every 5 minutes, so 12 per hour (12 * 6 = 72) so mqtt will publish at batch size of 72/ every 6 hours
Loom_BatchSD batchSD(hypnos, 15);
void isrTrigger()
{
hypnos.wakeup();
}
void setup() {
ENABLE_SD_LOGGING;
ENABLE_FUNC_SUMMARIES;
// Wait 20 seconds for the serial console to open
manager.beginSerial();
// Set the LTE board to only powerup when a batch is ready to be sent
lte.setBatchSD(batchSD);
// Both power rails should be on when awake
hypnos.setWakeConfiguration(POWERRAIL_CONFIG::PR_3V_ON_5V_ON);
// Only the 5V rail should be on during sleep
hypnos.setSleepConfiguration(POWERRAIL_CONFIG::PR_3V_OFF_5V_ON);
// Enable the hypnos rails
hypnos.enable();
//Time Sync Using LTE
hypnos.setNetworkInterface(<e);
// Read the MQTT creds file to supply the device with MQTT credentials
mqtt.loadConfigFromJSON(hypnos.readFile("mqtt_creds.json"));
// Initialize all in-use modules
manager.initialize();
// Register the ISR and attach to the interrupt
hypnos.registerInterrupt(isrTrigger);
hypnos.networkTimeUpdate();
}
void loop() {
// Measure and package the data
manager.measure();
manager.package();
// Print the current JSON packet
manager.display_data();
// Log the data to the SD
hypnos.logToSD();
// Pass in the batchSD to the mqtt obj to check/ publish a batch of data if ready
mqtt.publish(batchSD);
//mqtt.publish();
// Set the interrupt duration for 5 minutes
hypnos.setInterruptDuration(TimeSpan(0,0,5,0));
// Reattach the interrupt
hypnos.reattachRTCInterrupt();
// Set the hypnos to sleep, but with power still being supplied to the 5v rail (wait for serial when testing from a computer)
hypnos.sleep(false);
hypnos.networkTimeUpdate();
//manager.pause(2000);
}
Additional context
The issue appears to be related to the Wisp units not uploading data to MongoDB, despite sending successful packets to the server. This issue occurs on specific days, around February 6th-7th, 2025, and affects all current Wisp units.
Troubleshooting steps
To troubleshoot this issue, follow these steps:
- Check the serial output to ensure that the Wisp units are sending successful packets to the server.
- Verify that the MQTT credentials are correct and that the Wisp units are able to connect to the MongoDB server.
- Check the MongoDB server to ensure that it is receiving data from the Wisp units.
- Review the code to ensure that it is correctly configured to upload data to MongoDB.
Potential solutions
Based on the troubleshooting steps, potential solutions to this issue include:
- Checking the serial output to ensure that the Wisp units are sending successful packets to the server.
- Verifying that the MQTT credentials are correct and that the Wisp units are able to connect to the MongoDB server.
- Checking the MongoDB server to ensure that it is receiving data from the Wisp units.
- Reviewing the code to ensure that it is correctly configured to upload data to MongoDB.
Conclusion
Q: What is the issue with the Wisp units not uploading data to MongoDB?
A: The Wisp units are not uploading data to MongoDB, despite sending successful packets to the server. This issue occurs on specific days, around February 6th-7th, 2025, and affects all current Wisp units.
Q: What hardware is currently in use with the Wisp units?
A: The following hardware is currently in use with the Wisp units:
- Feather M0
- Hypnos
- Sparkfun LTE Board
- SHT31
- SEN55
Q: What is the expected behavior of the Wisp units?
A: The expected behavior of the Wisp units is that they should be uploading data to MongoDB.
Q: What is the code used in the Arduino IDE for the Wisp units?
A: The code used in the Arduino IDE for the Wisp units is as follows:
#include <Loom_Manager.h>
#include <Hardware/Loom_Hypnos/Loom_Hypnos.h>
#include <Sensors/Loom_Analog/Loom_Analog.h>
#include <Sensors/I2C/Loom_SEN55/Loom_SEN55.h>
#include <Sensors/I2C/Loom_SHT31/Loom_SHT31.h>
//#include <Sensors/Analog/ACS712/Loom_ACS712.h>
#include <Logger.h>
#include <Internet/Connectivity/Loom_LTE/Loom_LTE.h>
#include <Internet/Connectivity/Loom_Wifi/Loom_Wifi.h>
#include <Internet/Logging/Loom_MongoDB/Loom_MongoDB.h>
Manager manager("Whisp_brd_v0p4_",13); //change
Loom_Hypnos hypnos(manager, HYPNOS_VERSION::V3_3, TIME_ZONE::PST, true);
Loom_Analog analog(manager);
//Main Air Quality, Temperature, and Humidity Sensing
Loom_SEN55 SEN55(manager);
Loom_SHT31 sht(manager);
//Connectivity
Loom_LTE lte(manager, "hologram", "", "");
Loom_MongoDB mqtt(manager, lte);
//A batch is logged every 5 minutes, so 12 per hour (12 * 6 = 72) so mqtt will publish at batch size of 72/ every 6 hours
Loom_BatchSD batchSD(hypnos, 15);
void isrTrigger()
{
hypnos.wakeup();
}
void setup() {
ENABLE_SD_LOGGING;
ENABLE_FUNC_SUMMARIES;
// Wait 20 seconds for the serial console to open
manager.beginSerial();
// Set the LTE board to only powerup when a batch is ready to be sent
lte.setBatchSD(batchSD);
// Both power rails should be on when awake
hypnos.setWakeConfiguration(POWERRAIL_CONFIG::PR_3V_ON_5V_ON);
// Only the 5V rail should be on during sleep
hypnos.setSleepConfiguration(POWERRAIL_CONFIG::PR_3V_OFF_5V_ON);
// Enable the hypnos rails
hypnos.enable();
//Time Sync Using LTE
hypnos.setNetworkInterface(<e);
// Read the MQTT creds file to supply the device with MQTT credentials
mqtt.loadConfigFromJSON(hypnos.readFile("mqtt_creds.json"));
// Initialize all in-use modules
manager.initialize();
// Register the ISR and attach to the interrupt
hypnos.registerInterrupt(isrTrigger);
hypnos.networkTimeUpdate();
}
void loop() {
// Measure and package the data
manager.measure();
manager.package();
// Print the current JSON packet
manager.display_data();
// Log the data to the SD
hypnos.logToSD();
// Pass in the batchSD to the mqtt obj to check/ publish a batch of data if ready
mqtt.publish(batchSD);
//mqtt.publish();
// Set the interrupt duration for 5 minutes
hypnos.setInterruptDuration(TimeSpan(0,0,5,0));
// Reattach the interrupt
hypnos.reattachRTCInterrupt();
// Set the hypnos to sleep, but with power still being supplied to the 5v rail (wait for serial when testing from a computer)
hypnos.sleep(false);
hypnos.networkTimeUpdate();
//manager.pause(2000);
}
Q: What are the troubleshooting steps to resolve the issue?
A: To troubleshoot this issue, follow these steps:
- Check the serial output to ensure that the Wisp units are sending successful packets to the server.
- Verify that the MQTT credentials are correct and that the Wisp units are able to connect to the MongoDB server.
- Check the MongoDB server to ensure that it is receiving data from the Wisp units.
- Review the code to ensure that it is correctly configured to upload data to MongoDB.
Q: What are the potential solutions to resolve the issue?
A: Based on the troubleshooting steps, potential solutions to this issue include:
- Checking the serial output to ensure that the Wisp units are sending successful packets to the server.
- Verifying that the MQTT credentials are correct and that the Wisp units are able to connect to the MongoDB server.
- Checking the MongoDB server to ensure that it is receiving data from the Wisp units.
- Reviewing the code to ensure that it is correctly configured to upload data to MongoDB.
Q: What is the conclusion of the issue?
A: The Wisp units are not uploading data to MongoDB, despite sending successful packets to the server. This issue occurs on specific days, around February 6th-7th, 2025, and affects all current Wisp units. To troubleshoot this issue, follow the steps outlined above and review the code to ensure that it is correctly configured to upload data to MongoDB.