Now the next step… Figuring out what this code does exactly
Just tried the deep sleep mode of the heltec esp32 lora board and measured power consumption. The result is 12mA in deep sleep and 50mA in “normal” mode. I thought that power consumption is much lower. Any idea how to lower it down? This little led is alway blinking too. I don’t know how much power it consumes. But I can’t belief that this is the main reason.
This is my little test-program:
RTC_DATA_ATTR int bootCount = 0;
void setup() {
Serial.begin(115200);
delay(1000); //Take some time to open up the Serial Monitor
//Increment boot number and print it every reboot
++bootCount;
Serial.println("Boot number: " + String(bootCount));
esp_sleep_enable_ext0_wakeup(GPIO_NUM_0, 0); //1 = High, 0 = Low
pinMode(GPIO_NUM_0, INPUT);
}
void loop(){
int buttonState = digitalRead(GPIO_NUM_0);
if (buttonState == HIGH) {
Serial.println("Stay online for 5 seconds");
delay(5000);
Serial.println("Going to sleep now");
esp_deep_sleep_start();
}
}
Did you connect a battery? Then it would be charging it, which obviously explains the power consumption. Without a battery it might still be trying to detect a battery all the time; I’ve no clue but @Epyon posted some schematics earlier in this topic.
I am powering the esp32 using 4 AA batteries via the 5V and GND pin. I don’t have the correct JST connector right now.
Okay, it seems that my 5V are used to run the charging-unit MCP73831. Perhaps it is the main power consumer. I will retry my measurement im I have mi LiPo battery attached. I’m still waiting for my micro JST adapters
Wondering if one could somehow fool that charging thing into thinking a fully charged battery is attached. But again, I have no clue…
Extract from http://ww1.microchip.com/downloads/en/DeviceDoc/20001984g.pdf
So if I get it right shorting the “prog” pin to the Input power supply should disable the charger ?
Also the datasheet says the input current should be a maximum of 200 μA when no battery or charge complete. So this might not be @rmh78 current hog in sleep mode…
Best to use a high value series resistor (e.g. 10k) between PROG and VDD to limit leakage current, or better just remove the current programming resistor if you’re never going to use it.
I received my 868Mhz TTGO order, and was pleasantly surprised to get a pair while the sale seemed to be for one only. At 12.36 € shipping included that’s a real bargain.
Some unboxing pictures eye candy :
It seems to use a different battery charger, which I believe is an LTC4054 :
First test against my Lopy one channel gateway is positive, using LMIC and the same pin mapping as for the Heltec version as described earlier in BIG ESP32 / SX127x topic part 1 by @nicbkw - and originally @bluejedi :
What puzzles me is I can’t see anything looking like a wifi antenna anywhere on the board. I’ll have to test if it works…
The tiny metall plate with the slot is the wi-fi antenna.
Ah, I was wondering about that. Thanks.
I’ve also received mine, and running the Wifi scanner sketch doesn’t seem that the antenna is very efficient…
The board only can find very strong networks (above -72db) below that it doesn’t find anything, but this is with the limited testing that I’ve done.
The Lora part works flawlessly and sends data to TTN just fine.
How to switch off the battery LED when no battery is connected
Which lmic version/source are you using for ESP32?
Which IDE and which (ESP32) board have you selected in the IDE?
When trying to compile your code in PlatformIO (board: Heltec Wifi LoRa 32, platform: Arduino,
library dependencies: ‘IBM LMIC framework v1.51 for Arduino’ and ‘U8g2’) I get several errors that seem to be caused by the fact that the ‘architecture’ (board) is not being recognized in the lmic library:
.piolibdeps\IBM LMIC framework v1.51 for Arduino_ID842\src\hal\hal.cpp:26:2: error: #error unrecognized architecture
#error unrecognized architecture
.
After doing some more checking:
‘IBM LMIC framework v1.5 for Arduino’ is the following library:
‘IBM LMIC framework v1.51 for Arduino’ is the following library:
I assume that you probably used v1.5(?)
When using v1.5 I still get some compile errors but the ‘unrecognized architecture’ has disappeared.
I am using yet another version by Matthijs:
But it’s very likely that I installed it manually. As its library.properties
has not been updated for years, while the code has, I don’t know if the Arduino library manager can handle installation through the GUI.
Thanks, I already had found it (yesterday late). That one works without problems.
A search for lmic in PlatformIO gives 3 results (in this order):
- name=IBM LMIC framework v1.51 for Arduino
version=1.51 -
name=IBM LMIC framework
version=1.5.0+arduino-1 - name=IBM LMIC framework v1.5 for Arduino
version=1.5
The display order makes sense from a version perspective, but the one without a version number in its name (and URL) seems the one to use. I did not try ‘1.5.0+arduino-1’ at first because the version number looks like an experiment and ‘1.51’ appeared like the newer version of ‘1.5.0+arduino-1’ but it is not.
I have added the following line to your code:
u8x8.clearLine(7);
Just before:
switch (ev) {
This fixes an issue that the remainder of old event messages was left on the display when a new message is shorter than the previous.
The link says 868/915MHz.
How can I select that I want the 868MHz version? Does it mean that input filters are from 868…915 - or there are no filters at all?
Two for the price of one was probably a mistake from the seller, because the description does not mention ‘2 pieces’ and the same seller also has a link for two pieces, these however cost €24.08 (incl. shipping).
https://www.aliexpress.com/item/2pcs-of-868MHz-915MHz-SX1276-ESP32-LoRa-0-96-Inch-Blue-OLED-Display-Bluetooth-WIFI-Kit/32840618066.html
As I said before, I’m getting 10.2mA in deep sleep, with LoRa in sleep mode and Oled displayoff().
I’m directly powering the unit from 3.3v pin, without LiPo connected (not charging, no led blinking).
Don’t know what is draining the power.