I'm not sure if I'm in the right place with this kind of question, but here goes:
I have a Xaio SEED ESP32C6 programmed with Arduino IDE to utilize VEML7700, BME280 and LTR390-UV. I wanted to get this outside so ordered proper kits and whatnot to provide protection from elements. As part of that, I got a DFRobot 5V/1A Solar Power Manager. Link is here: Solar Power Manager with Panel (5V 1A) - DFRobot
When I run the project plugged into my PC's USB port it works just fine. When I plug it up to the Solar Power Manager, the red LED on the C6 stays on for around a minute and then shuts off. No activity whatsoever after that unless I unplug and replug. The boot button on the Solar Manager gets no response from the ESP32C6. I thought this thing fit my requirements for the project, but something is amiss and I don't know what. Any help appreciated!
Sorry. It's a 3.7v 2000 mAh battery that is plugged into the Solar Manager. The Solar Manager is supposed to keep that battery charged.via the solar panel.
The battery is fully charged and Ive tried two different batteries, including two 18650s in place of the standard lipos that connect to the solar manager. I may have to add Bluetooth Serial to see what is happening but Ive not played around with that library much.
The manager will warn you if your polarity is wrong on the battery or solar panel and has very clear markings for positive and negative connections. That was a good thought though.
That's why I asked.. So if all the LEDs are indication OK, you need to start playing with multimeter. Measure continuity for common ground in every point, measure Manager regulated 5V output V, Esp 5V input, Esp operating voltage etc.
Crap usb cable? Solder bridges somewhere?
I really see only wires on photos, not where they go...
Will break out the multimeter tomorrow and report back. The circuitboard is miniature breadboard type, so didnt have a lot of area to work with but everything is working correctly when using PC-powered USB port. Haha.
Does your sketch (not posted) have your unit stuck waiting for Serial Monitor?
Put another way - does it "work" if it's running from a 5V_cube (charger)?
I measured this morning and there's no difference whether plugged into Solar Power Manager or into PC USB port. When powered, the used ports of the SEED are getting about 3.24V along with everything attached to them. The unused ports are in the low mV range.
//* Based on the work of http://randomnerdtutorials.com with my own addition of VEML7700 and LTR390-UV.
#include <Adafruit_BusIO_Register.h>
#include <Adafruit_I2CDevice.h>
#include <Adafruit_I2CRegister.h>
#include <Adafruit_SPIDevice.h>
#include "Adafruit_LTR390.h"
//#include "Arduino.h"
#include "Adafruit_VEML7700.h"
#include <WiFi.h>
#include <Wire.h>
#include <SPI.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>
#include "secrets.h"
#define SEALEVELPRESSURE_HPA (1013.25)
//define BME280
Adafruit_BME280 bme; // I2C
unsigned long delayTime;
//define VEML7700
Adafruit_VEML7700 veml = Adafruit_VEML7700();
//define LTR390
Adafruit_LTR390 ltr = Adafruit_LTR390();
//WiFi Creds stored securely in secrets.h
const char* ssid = SECRET_SSID;
const char* password = SECRET_PASS;
// Set web server port number to 80
WiFiServer server(80);
// Variable to store the HTTP request
String header;
// Current time
unsigned long currentTime = millis();
// Previous time
unsigned long previousTime = 0;
// Define timeout time in milliseconds (example: 2000ms = 2s)
const long timeoutTime = 2000;
void setup() {
Serial.begin(115200);
Serial.println(F("BME280 WX Monitoring"));
//initialize BME280
if (! bme.begin(0x76, &Wire)) {
Serial.println("Could not find a valid BME280 sensor, check wiring!");
while (1) delay (10);
}
Serial.println();
//begin initialize LTR-390 UV Detection
Serial.println("Adafruit LTR-390 test");
if ( ! ltr.begin() ) {
Serial.println("Couldn't find LTR sensor!");
while (1) delay(10);
}
Serial.println("Found LTR sensor!");
//set LTR390 mode
ltr.setMode(LTR390_MODE_UVS);
if (ltr.getMode() == LTR390_MODE_ALS) {
Serial.println("In ALS mode");
} else {
Serial.println("In UVS mode");
}
//set LTR390 gain
ltr.setGain(LTR390_GAIN_3);
Serial.print("Gain : ");
switch (ltr.getGain()) {
case LTR390_GAIN_1: Serial.println(1); break;
case LTR390_GAIN_3: Serial.println(3); break;
case LTR390_GAIN_6: Serial.println(6); break;
case LTR390_GAIN_9: Serial.println(9); break;
case LTR390_GAIN_18: Serial.println(18); break;
}
//set ltr resolution
ltr.setResolution(LTR390_RESOLUTION_16BIT);
Serial.print("Resolution : ");
switch (ltr.getResolution()) {
case LTR390_RESOLUTION_13BIT: Serial.println(13); break;
case LTR390_RESOLUTION_16BIT: Serial.println(16); break;
case LTR390_RESOLUTION_17BIT: Serial.println(17); break;
case LTR390_RESOLUTION_18BIT: Serial.println(18); break;
case LTR390_RESOLUTION_19BIT: Serial.println(19); break;
case LTR390_RESOLUTION_20BIT: Serial.println(20); break;
}
//set ltr threshold && interrupt
ltr.setThresholds(100, 1000);
ltr.configInterrupt(true, LTR390_MODE_UVS);
while (!Serial) { delay(10); }
Serial.println("Adafruit VEML7700 Auto Lux Test");
//initialize VEML7700 Lux Sensor
if (!veml.begin()) {
Serial.println("Sensor not found");
while (1);
}
Serial.println("Sensor found");
// Connect to Wi-Fi network with SSID and password
Serial.print("Connecting to ");
Serial.println(ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
// Print local IP address and start web server
Serial.println("");
Serial.println("WiFi connected.");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
server.begin();
}
void loop() {
WiFiClient client = server.available(); // Listen for incoming clients
if (client) { // If a new client connects,
currentTime = millis();
previousTime = currentTime;
Serial.println("New Client."); // print a message out in the serial port
String currentLine = ""; // make a String to hold incoming data from the client
while (client.connected() && currentTime - previousTime <= timeoutTime) { // loop while the client's connected
currentTime = millis();
if (client.available()) { // if there's bytes to read from the client,
char c = client.read(); // read a byte, then
Serial.write(c); // print it out the serial monitor
header += c;
if (c == '\n') { // if the byte is a newline character
// if the current line is blank, you got two newline characters in a row.
// that's the end of the client HTTP request, so send a response:
if (currentLine.length() == 0) {
// HTTP headers always start with a response code (e.g. HTTP/1.1 200 OK)
// and a content-type so the client knows what's coming, then a blank line:
client.println("HTTP/1.1 200 OK");
client.println("Content-type:text/html");
client.println("Connection: close");
client.println();
// Display the HTML web page
client.println("<!DOCTYPE html><html>");
client.println("<head><meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">");
client.println("<link rel=\"icon\" href=\"data:,\">");
// CSS to style the table
client.println("<style>body { text-align: center; font-family: \"Trebuchet MS\", Arial;}");
client.println("table { border-collapse: collapse; width:35%; margin-left:auto; margin-right:auto; }");
client.println("th { padding: 12px; background-color: #0043af; color: white; }");
client.println("tr { border: 1px solid #ddd; padding: 12px; }");
client.println("tr:hover { background-color: #bcbcbc; }");
client.println("td { border: none; padding: 12px; }");
client.println(".sensor { color:white; font-weight: bold; background-color: #bcbcbc; padding: 1px; }");
// Web Page Heading
client.println("</style></head><body><h1>BellDOTnet Outdoor WX Station</h1>");
client.println("<table><tr><th>MEASUREMENT</th><th>VALUE</th></tr>");
client.println("<tr><td>Temp. Celsius</td><td><span class=\"sensor\">");
client.println(bme.readTemperature());
client.println(" *C</span></td></tr>");
client.println("<tr><td>Temp. Fahrenheit</td><td><span class=\"sensor\">");
client.println(1.8 * bme.readTemperature() + 32);
client.println(" *F</span></td></tr>");
client.println("<tr><td>Pressure</td><td><span class=\"sensor\">");
client.println(bme.readPressure() / 100.0F);
client.println(" hPa</span></td></tr>");
client.println("<tr><td>Approx. Altitude</td><td><span class=\"sensor\">");
client.println(bme.readAltitude(SEALEVELPRESSURE_HPA));
client.println(" m</span></td></tr>");
client.println("<tr><td>Humidity</td><td><span class=\"sensor\">");
client.println(bme.readHumidity());
client.println(" %</span></td></tr>");
client.println("<tr><td>UV Data</td><td><span class=\"sensor\">");
client.println(ltr.readUVS());
client.println("</span></td></tr>");
client.println("<tr><td>LUX Data</td><td><span class=\"sensor\">");
client.println(veml.readLux(VEML_LUX_AUTO));
client.println("</span></td></tr>");
client.println("</body></html>");
// The HTTP response ends with another blank line
client.println();
// Break out of the while loop
break;
} else { // if you got a newline, then clear currentLine
currentLine = "";
}
} else if (c != '\r') { // if you got anything else but a carriage return character,
currentLine += c; // add it to the end of the currentLine
}
}
}
// Clear the header variable
header = "";
// Close the connection
client.stop();
Serial.println("Client disconnected.");
Serial.println("");
}
}
Just delete those? And could you explain to me what is happening? Why the code is causing the problem? haha I appreciate your help! Is it expecting that Serial connection to even continue with the code is what the problem is?
Explanation - it's waiting for the Serial Monitor terminal (your PC) to become active (present). When it's on the PC, it finds it - when it's not, it's stuck trying to find it.
That explains it. So just change code to straight init and not wait on the Serial connection and I'm g2g. I really appreciate the help! As you can probably tell, I'm still pretty new at all this. haha
Basically, yes.
There are 'better' ways to do it, but I just place a delay(3500) after the Serial.begin which gives it time enough for things to sync up.
That way if it's there it's there - and if it's not we go on with life anyway.