heltec-aaron-lee / wifi_kit_series Goto Github PK
View Code? Open in Web Editor NEWArduino source codes and toolchain for WiFi_Kit_series made by HelTecAutomation.
License: GNU Lesser General Public License v2.1
Arduino source codes and toolchain for WiFi_Kit_series made by HelTecAutomation.
License: GNU Lesser General Public License v2.1
The WiFiScan example is throwing the following in the Serial Monitor:
Exception (3):
epc1=0x40100473 epc2=0x00000000 epc3=0x00000000 excvaddr=0x4001022c depc=0x00000000
ctx: cont
sp: 3ffef6d0 end: 3ffefa20 offset: 01a0
>>>stack>>>
3ffef870: feefeffe feefeffe feefeffe feefeffe
3ffef880: feefeffe feefeffe feefeffe 3ffef980
3ffef890: 00000484 00000484 000003fe 401004f4
3ffef8a0: 00000000 00001000 000003fe 401079b8
3ffef8b0: 40004b31 3ffef8e0 0000001c 40228c1d
3ffef8c0: 40105212 40228d05 3fff0b0c 000003ff
3ffef8d0: 000003fd 3ffef980 3fff0b0c 000003fd
3ffef8e0: ffffff01 55aa55aa 00000009 0000001c
3ffef8f0: 0000001c 000000ef 000000ef 000003ff
3ffef900: 402290f4 3fff0b0c 3fff0b0c 000000ff
3ffef910: 00000001 3ffef9a0 4022927b 00000008
3ffef920: 3fff0b0c 000000ff 3ffef980 00000000
3ffef930: 3fff0bcc 3ffef9e1 00000001 40229308
3ffef940: 3ffef980 3fff0b0c 3fffdad0 3ffee9ec
3ffef950: 3ffef9a0 3fff6e44 3fff0b0c 3fffdad0
3ffef960: 40229344 3ffee9c0 00000000 feefeffe
3ffef970: 402021f0 feefeffe feefeffe feefeffe
3ffef980: feefef00 feefeffe feefeffe 00000000
3ffef990: 402018cc 00000100 00000001 40201380
3ffef9a0: 40201b00 3fff0a04 3fff09d4 40201c88
3ffef9b0: 0001c200 0000001c 00000003 3fff09ec
3ffef9c0: feefeffe feefeffe feefeffe 3ffee9ec
3ffef9d0: 40228956 00000001 3ffee7c8 3fffdad0
3ffef9e0: 4020204b 0000001c 00000000 feefeffe
3ffef9f0: feefeffe 3ffee7c8 3ffee9c0 40201ece
3ffefa00: feefeffe 00000000 3ffee9e4 40202b84
3ffefa10: feefeffe feefeffe 3ffeea00 40100718
<<<stack<<<
ets Jan 8 2013,rst cause:2, boot mode:(1,6)
ets Jan 8 2013,rst cause:4, boot mode:(1,6)
wdt reset
What should i be looking for?
Blink:18: error: 'LED_BUILTIN' was not declared in this scope
digitalWrite(LED_BUILTIN, LOW); // Turn the LED on (Note that LOW is the voltage level
^
exit status 1
'LED_BUILTIN' was not declared in this scope
when I am compiling BLEnotify following error is occuring
In file included from C:\Users\Pravin\Documents\Arduino\hardware\espressif\esp32\libraries\BLE\src/BLEClient.h:18:0,
from C:\Users\Pravin\Documents\Arduino\hardware\espressif\esp32\libraries\BLE\src/BLEDevice.h:19,
from C:\Users\Pravin\Documents\Arduino\hardware\espressif\esp32\libraries\BLE\examples\BLE_notify\BLE_notify.ino:21:
C:\Users\Pravin\Documents\Arduino\hardware\espressif\esp32\libraries\BLE\src/BLEExceptions.h:13:2: error: #error "C++ exception handling must be enabled within make menuconfig. See Compiler Options > Enable C++ Exceptions."
#error "C++ exception handling must be enabled within make menuconfig. See Compiler Options > Enable C++ Exceptions."
^
exit status 1
Error compiling for board WIFI_LoRa_32.
before that esp_bt.h is not available error prompted, I solved it by renaming all bt.h to esp_bt.h
Board: Heltec HTIT-WB32LA
Espressif: ESP32 Arduino 0.0.1 (Latest as of Mar19th 2018)
Heltec: most recent as of Mar 19th 2018)
Arduino IDE: 1.8.5
I'm trying to create a sketch which uses both LoRA and BLE Notify. when I try to compile the SDK examples for both BLE Notify and LoRa REceiver OLED.
when trying the examples, the BLE notify will not work with the board types defined in the heltec version of the board definitions and fails with an "esp_bt.h: No such file or directory" error.
if I change the board type to the one defined in the Espressif SDK the BLE Notify example it will work. however if I use the board definition in the Espressif SDK, the LoRa REceiver example will fail with "LoRa.h: No such file or directory
compilation terminated."
There is no board definition which has both working.
Hi,
I have updlaed the eeprom_extra example onto the Wifi Lora 32
First time with the below:
int address = 0;
char gratitude[] = "Thank You Espressif!";
EEPROM.writeString(address, gratitude);
Serial.println(EEPROM.readString(address));
Output: Thank You Espressif!
Second time with:
int address = 0;
char gratitude[] = "Thank You Espressif!";
Serial.println(EEPROM.readString(address));
Output: 0
Board info:
ets Jun 8 2016 00:22:57
rst:0x1 (POWERON_RESET),boot:0x17 (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:0x3fff0018,len:4
load:0x3fff001c,len:956
load:0x40078000,len:0
load:0x40078000,len:13076
entry 0x40078a58
API.md indicates default for spreading factor is 7. From LoRa.cpp, it is set to 9:
setSpreadingFactor(9);
Actually my new Heltec ESP32 LoRa board with 470MHz stamp on the envelope cannot talk with a AiThinker Ra 02 433Mz module.
Is this due to the different frequencies? Can I change the frequncy to 433?
Thanks
Hello,
I just purchased two ESP32-LoRa Boards with antenna etc (915MHz).
The boards when powered on works and they transmit & receive packets from each board.
But the problem is that I am not able to setup the board drivers etc on Arduino IDE.
I followed your description for installing these on Windows
as mentioned here : http://www.heltec.cn/the-installation-method-of-wifi-kit-series-products-in-arduino-development-environment/?lang=en
After these procedures no board info found in Tools/Board menu of Arduino IDE.
I also reinstalled CP210x drivers as you mentioned in the blogs. But still no WiFi Kit info.
My PC is Windows-7 x64.
I also tried on Ubuntu Linux (16.04) but still could n't get to work. Same problem.
Please advice why the board is not detected and info not displayed in Arduino IDE.
Thanks,
Chak
Hi!
I'm trying to use the WiFiClientSecure to post a request using HTTP 2, but I guess the underlying http client doesn't support this new standard (I got HTTP/2 client preface string missing or corrupt)
Do you know if it's possibile to get this for our esp32?
Thank you in advance
Hey just started using this board for the first time and noticed that the BAT LED always seems to be blinking when I have the board plugged into USB. I decided to remove all code (except the Serial Output indicating that the code had started) and the LED is still blinking. I have no code in the loop and just the initialization for serial in the setup. I am sure that this is probably to indicated that there is no battery connected but I dont know how to turn it off. Thanks, and so far this looks like a great board I am just irritated by the constant flashing.
Hardware:
Board: Heltec ESP32 WiFi Lora Board Core
Installation/update date: 25/nov/2017
IDE name: Arduino IDE
Flash Frequency: 80Mhz
Upload Speed: 921600
Description:
I want to set the esp32 to deep sleep mode and measure the power consumption. The esp32 specification says that the power consumption should be in the µA range. My measurement is between 3mA and 10mA in deep-sleep mode. I'm powering the board with 3.7V lipo on the 3.3V input pin.
Sketch:
#include "esp_sleep.h"
#define uS_TO_S_FACTOR 1000000 /* Conversion factor for micro seconds to seconds */
#define TIME_TO_SLEEP 60 /* Time ESP32 will go to sleep (in seconds) */
void setup() {
Serial.begin(115200);
delay(1000);
esp_sleep_enable_timer_wakeup(TIME_TO_SLEEP * uS_TO_S_FACTOR);
esp_sleep_pd_config(ESP_PD_DOMAIN_MAX, ESP_PD_OPTION_OFF);
esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_OFF);
esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_SLOW_MEM, ESP_PD_OPTION_OFF);
esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_FAST_MEM, ESP_PD_OPTION_OFF);
}
void loop(){
delay(5000);
esp_deep_sleep_start();
}
display.print(WiFi.localIP().toString(),3,0);
when i compile with this code get this error
/tmp/arduino_modified_sketch_829310/AdvancedWebServer.ino: In function 'void setup()':
AdvancedWebServer:129: error: no matching function for call to 'OLED::print(String, int, int)'
display.print(WiFi.localIP().toString(),3,0);
^
/tmp/arduino_modified_sketch_829310/AdvancedWebServer.ino:129:46: note: candidate is:
In file included from /tmp/arduino_modified_sketch_829310/AdvancedWebServer.ino:35:0:
/home/arduino-1.8.5/hardware/heltec/esp8266/libraries/OLED/OLED.h:32:8: note: void OLED::print(char*, uint8_t, uint8_t)
void print(char s, uint8_t r=0, uint8_t c=0);
^
/home/arduino-1.8.5/hardware/heltec/esp8266/libraries/OLED/OLED.h:32:8: note: no known conversion for argument 1 from 'String' to 'char'
exit status 1
no matching function for call to 'OLED::print(String, int, int)'
Quite a few people, including myself, are a bit disappointed with the low battery charge current of the Heltec Wifi Kit 32.
I am designing a high-volume project using the Heltec Wifi Kit 32 in combination with a 3400 mAh 3.7 V Panasonic 18650 LiPo battery.
The charge chip on the Heltec Wifi Kit 32 is a Microchip MCP73831. According to the datasheet, the charge current of this chip can be programmed with a resistor between pins 2 and 5.
On the Heltec Wifi Kit 32, a resistance of 10 kΩ is measured between these pins.
My question: What modification do I need to do in order to increase the charge current to its maximum 500 mA?
I bought 3 heltec modules. One has a broken oled module. Any suggestions for solving this issue?
When compiling as a idf component got the error:
C:/dev/espressif/heltec/esp32-arduino/libraries/ESPmDNS/src/ESPmDNS.h:110:3: error: 'mdns_server_t' does not name a type
mdns_server_t * mdns;
problem is, that mdns.h from esp-idf sdk is differ then from heltec sdk...
\espressif\heltec\esp32-arduino\tools\sdk\include\mdns\mdns.h has mdns_server_t declaration
\espressif\esp-idf\components\mdns\include\mdns.h has not
compiler try to use from esp-idf
With the Heltec board, how should I be setting the power level and PA boost to get the maximum range?
Hello
In Espressifn ESP32 doc (http://esp-idf.readthedocs.io/en/latest/api-guides/jtag-debugging/configure-other-jtag.html) , Jtag adapter must be connected to GPIO12, GPIO13, GPIO 14 and GPIO15 ESP32 pins.
But Heltec wifi LoRa board, GPIO14 is used for LoRa_RST and GPIO15 is used for OLED_SCL. In Heltec pinout diagram we can see these two pins must not be used for other purpose unless you know what you are doing.
Does it mean we cannot JTAG debug Heltec board or is there a workaround by assigning other pins to JTAG signals ?
Thanks in advance for your answer
The OLED I2C clock and SPI clock are on the same pin GPIO14, so is there a way that I can use an SPI device like the MCP 2515 CAN controller and the display together?
Hey,
I am using ESP32 loRa board with arduino IDE. while uploading program i am getting error that
A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header
before this it was working properly and I am using CP210x_Windows_Drivers this usb drivers and installed drivers for ESP32 . I have tried to reset the board but the same problem is occurred after resetting the board.
Any help would be appriciated ?
Thanks in advance!
Having the schematic is great for us users, but knowing i should change R17 to change the charging current doesn't help when i cannot find R17 on the board.
Please consider uploading .brd file, complete gerbers or images of the board layout with the component identifiers visible for both layers.
Thank you!
Trying to get my LoRa/WiFi Heltec board running but I'm facing problems uploading code to it. When trying something simple like "Example -> ESP8266 -> WiFiScan" or "Example -> WiFi -> ScanNetworks" I get this back:
Archiving built core (caching) in: C:\Users\osbe\AppData\Local\Temp\arduino_cache_931122\core\core_esp8266_esp8266_nodemcu_CpuFrequency_80,UploadSpeed_115200,FlashSize_4M3M_01696216298cb0bf10a7299dfddad9bf.a
Sketch uses 228797 bytes (21%) of program storage space. Maximum is 1044464 bytes.
Global variables use 32372 bytes (39%) of dynamic memory, leaving 49548 bytes for local variables. Maximum is 81920 bytes.
warning: espcomm_sync failed
error: espcomm_open failed
error: espcomm_upload_mem failed
error: espcomm_upload_mem failed
Have tried to push the PRG button in all kinds of ways, played around with the baud rate and tried other examples as well, but the communication seems to be broken. The board is responding to uploads (it's rebooting), so there is some level of communication there.
Any suggestions?
BR
Oscar
First, there seems to be virtually no documentation on the WiFi classes IPv6 capabilities, so I'm guessing as best I can from the source code and some trial and error. Apologies in advance for anything I may have missed in the process.
I found the call for WiFi.localIPv6() which will return the Link Local address, but I couldn't find any calls that would allow me to {retrieve, obtain, set} a global address through any of {static, SLAAC, DHCPv6}.
Are these capabilities missing from the library altogether and only LinkLocal addresses are supported? If so, will that be changing soon? I'd really like to be able to use IPv6 for my applications.
If the capabilities are present, it would be great if someone could produce a basic IPv6 client Example (or dual-stack client example) along the lines of one or more of the existing IPv4 WiFi examples. Especially (e.g.) WiFiClientBasic, SimpleWiFiServer, and WIFiUDPClient.
Thanks
The connector type for the battery is not published. What is the connector type? Thank you.
This isn't really an issue, more like a documentation snippet which I didn't find anywhere else.
I got 2 ESP32 Wifi Kit 32 boards. Fantastic little boards. One of the projects was to interface with an existing RS232 device (aka "serial port"). One of the strengths of the ESP32 is that it has 3 UART modules. So first I tried to see which ones were available on this board.
TL;DR: One must realize that on this particular board, UART1 and UART2 cannot be used and UART0 has limitations.
Source: ESP32 datasheet here
https://www.espressif.com/sites/default/files/documentation/esp32_datasheet_en.pdf
Compared with the Heltec Schematic Diagram for the Wifi module:
https://github.com/Heltec-Aaron-Lee/WiFi_Kit_series/raw/master/SchematicDiagram/WIFI_Kit_32_Schematic_diagram.PDF
What we need to do is look at the ESP32 datasheet to see where U0/U1/U2 are listed and cross-reference that with the Wifi Kit 32 schematic to see how the pins are used.
ESP32 pin number, pin name, alternate function | Wifi Kit 32 Pin name and usage |
---|---|
UART0 | |
38, GPIO19: U0CTS | 19, available |
39, GPIO22: U0RTS | 22, available (see note below) |
40, U0RXD: GPIO3 | RX, to CP2102 TXD |
41, U0TXD: GPIO1 | TX, to CP2102 RXD |
UART1 | |
28, SD_DATA_2: GPIO9, U1RXD | FLASH_SHD |
29, SD_DATA_3: GPIO10, U1TXD | FLASH_SWP |
30, SD_CMD: GPIO11, U1RTS | FLASH_SCS |
31, SD_CLK: GPIO6, U1CTS | FLASH_SCK |
UART2 | |
25, GPIO16: U2RXD | OLED RST |
27, GPIO17: U2TXD | 17, available |
32, SD_DATA_0: GPIO7, U2RTS | FLASH_SDO |
33, SD_DATA_1: GPIO8, U2CTS | FLASH_SDI |
Note: U0RTS is listed in the ESP32 datasheet as ESP32 pin 22, GPIO22. In the Wifi Kit 32 Pinout graphic, it is also listed as GPIO22. However it is listed in the Wifi Kit 32 schematic as pin 21, GPIO15, shared with the OLED SCL.
So, voilà, bottom line:
I hope this will help others.
Board: Heltec WiFi Kit 8, ESP8266 development board
date: 19-dec-2017
Using the board with Arduino IDE, at 80 MHZ, speed 115200. Board istalled and flashed, No Issues.
I am not clear with the document (MiniDK Pinout Diagram) against the working pins when using onboard OLED display (and later on I will need to use WiFi). Therefore I am unsure how many pins left to be used as user I/O, mode and other considerationsfor each of them.
Documents stated that 12 digital pins can be configured to read, write, IIC, SPI, the middle, PWM and other functions ADC, {1 Analog + 11 Digital} as GPIO0-5 (6 pins), 12-16 (5 pins).
I used the example code OLED_091_128x32_SSD1306 that comes with the board installation (following instuctions published by Aaron Lee installation english version).
This example stated that SDA -- GPIO4 -- D2, SCL -- GPIO5 -- D1, RST -- GPIO16 -- D0. Seems using Serial/I2C/SPI wiring.
Which clearly differs from the brown arrows in the Pinout document, that shows: OLED_SDA -- GPIO2 -- D3, OLED_SCL -- GPIO14 -- SCL, OLED_RST -- GPIO16 -- D0.
Then I got lost on which pins are left for user.
It got this note: Pins with this arrow are used by on-board OLED, they must not be used
for other purpose unless you know what you are doing!
Now how can I know what I am doing when the working pins does not mach the one I expected to be meaning of the brown arrow warnings one , at least seems to me they does not match the clk, data and rst functions as stated, maybe OLED piece use them for other comms functions.
I later on added the Analog input (using as calibration variable 0-1023), two Digital Output (LEDs) at GPIO15 and GPIO13 (D8 and D7) all while using OLED and Works fine. Problems start when I need to add another Digital Input, a button to read if pushed. I try on Pin 12 (GPIO12) and get HIGH all time.
Any Ideas ?
Example of code: Draft for remote shooting target control
// GLOBAL DEFINITION
#include <Wire.h>
#include "OLED.h"
// Development Board pins to be used. Available: A0,GPIO: 0 (CS2),15,13,12, 16(Wake),5,1(TXD0),3 (RXD0),4
#define RST_OLED 16 // RST -- GPIO16 -- D0
int OLED_SDA = 4; // SDA -- GPIO4 -- D2
int OLED_SCL = 5; // SCL -- GPIO5 -- D1
int Green = 15; // GREEN Led port D8
int Red = 13; // RED Led port D7
int HitSensor = 12; // HIT Sensor port GPIO12
int Debounce;
int hits;
bool reset=false;
OLED display(OLED_SDA, OLED_SCL); // OLED display(SDA, SCL)
void Target(int tin, int tac, int h2d){
int k=0;
int hit=0;
int kmax=1000*tac;
Serial.println("kmax seg = ");
Serial.print(kmax);
digitalWrite(Red, LOW);
digitalWrite(Green, LOW);
//display.clear();
display.print("Target Ready ",0,0);
Serial.println("Target Ready");
Serial.println("Espera de : ");
Serial.print(tin);
delay(1000*tin); // Initial Target Delay
digitalWrite(Green, HIGH); //Turn on GREEN (Can shoot)
Serial.println("Activo por: ");
Serial.print(tac);
display.print("---------------",1,0);
do {
k++;
display.print("Shoot now ",0,0);
if (digitalRead(HitSensor) == HIGH) {
delay(Debounce);
hit++;
Serial.println(" Hit! so far: ");
Serial.println(hit);
display.print("Hit !",2,1);
k=k+Debounce-4;
k=k+80; // milis that takes this portion of code
delay(80);
if (hit == h2d) {
digitalWrite(Red, HIGH); //Turn on RED (Dead)
Serial.println("TARGET DOWN!");
display.print("Dead !",3,1);
}
}
}
while (k < kmax); // Habilitado del target por aprox tac segundos (default)
digitalWrite(Green,LOW);
Serial.println("TARGET Deactivated ");
display.print("Target Inactive ",0,0);
Serial.println("Function Target set to value = ");
Serial.println(hit);
hits=hit;
return;
}
void setup() {
Serial.begin(115200); // Serial interface for debugging
Debounce = analogRead(A0); // Read actual calibration directly from board potentiometer. 0-1023 Digital value used directly as milliseconds withn delay function
pinMode(RST_OLED, OUTPUT); // OLED Reset WAKE
pinMode(A0,INPUT); // ADC Analog for external debounce time calibration (fixed by library)
pinMode(Red,OUTPUT); // RED LED
pinMode(Green,OUTPUT); // GREEN LED
pinMode(HitSensor,INPUT); // Hit Sensor
// OLED SetUp
digitalWrite(RST_OLED, LOW); // turn D2 low to reset OLED
delay(50);
digitalWrite(RST_OLED, HIGH); // while OLED is running, must set D2 in high
// Initialize display
display.begin();
display.print("TARGET v1.0");
digitalWrite(Red,LOW);
digitalWrite(Green,LOW);
delay(1000);
}
void loop() {
Target(3,5,2);
Serial.println(hits);
delay(10000);
}
Hello
When compiling BLE_server example for Heltec HTIT board, i get the following error (see below)
April 30 Addendum
When using regular espressif software distribution ( by selecting by example MH et LIVE DEV KIT board) there is no error and software is working well)
Kind regards
Daniel
PS: I am using the last commit done 12 days ago
heltec\esp32\libraries\BLE\src\BLEClient.cpp: In member function 'bool BLEClient::connect(BLEAddress)':
heltec\esp32\libraries\BLE\src\BLEClient.cpp:115:2: error: too many arguments to function 'esp_err_t esp_ble_gattc_open(esp_gatt_if_t, uint8_t, bool)'*
);
^
In file included from heltec\esp32\libraries\BLE\src\BLEClient.cpp:13:0:
heltec\esp32/tools/sdk/include/bluedroid/esp_gattc_api.h:293:11: note: declared here
esp_err_t esp_ble_gattc_open(esp_gatt_if_t gattc_if, esp_bd_addr_t remote_bda, bool is_direct);
^
Notice in BLEClient.cpp file a change has been made line 113 in the last commit
errRc = ::esp_ble_gattc_open(
getGattcIf(),
*getPeerAddress().getNative(), // address
BLE_ADDR_TYPE_PUBLIC, // Note: This was added on 2018-04-03 when the latest ESP-IDF was detected to have changed the signature.
1 // direct connection
);
Is it possible to understand when the board is powered by battery rather than usb, and when it switches as well?
Board: Heltec HTIT-WB32LA
Espressif: ESP32 Arduino 0.0.1 (Latest as of Mar19th 2018)
Heltec: most recent as of Mar 19th 2018)
Arduino IDE: 1.8.5
I've tried several ways to configure the OnReceive Call back, but it never gets called.
LoRa.onReceive(cbk);
LoRa.receive();
even tried the suggestions to attach an interrupt to pin 26 DIO0
pinMode(26, INPUT);
attachInterrupt(digitalPinToInterrupt(26), cbkCallback, CHANGE);
but the callback never gets called..
(If I try the polling mechanism there is data and it can be read, so I know it's receiving data from the sender)
WiFi_Kit_series-master\esp32/tools/xtensa-esp32-elf/bin/xtensa-esp32-elf-g++": file does not exist
Sicne this board has a li-pol charger, i was wondering, if it's possible to retrieve the charge status (charging/not charging) and also, how to retrieve the current battery percentage/level using Arduino?
Hello,
The battery LED always flashes. I do not plan to use battery. How do I stop the flashing and just leave it off?
Hi, I was wondering if anyone else has had the same problem, I can use LoRa.onReceive on any of my boards without issue until I try to also use Wifi. As soon as I do that the boards will work just fine until the onReceive function is called at which point the boards crash with an "Interrupt timeout on CPU1". I have tried various delays, yields to correct the problem but nothing seems to work ?
Interestingly if I also try to use the OLED from within the onReceive function I also experience the same problem.
Any help or advice would be much appreciated. cheers
#include <WiFi.h>
#include <SPI.h> // include libraries
#include <LoRa.h>
#include <PubSubClient.h>
#define SS 18
#define RST 14
#define DI0 26
#define BAND 433E6
#define PABOOST true
const char* ssid = "";
const char password = "";
String outgoing; // outgoing messages
String incoming; //incoming messages
byte msgCount = 0; // count of outgoing messages
byte localAddress = 0x01; // address of this device
byte destination = 0x02; // destination to send to
long lastSendTime = 0; // last send time
int interval = 2000; // interval between sends
const char mqtt_server = "mymqtt.server.com";
const char topic1 = "lora/slave1/led";
const char mqttusername = "";
const char* mqttpassword = "*****";
const char mqttclientname = "LoraMaster";
int mqttport = 1883;
int ledpin1 = 17;
String strTopic;
String strPayload;
String switch1;
int button1 = 21;
WiFiClient espClient;
PubSubClient client(espClient);
void reconnect() {
while (!client.connected()) {
if (client.connect(mqttclientname,mqttusername,mqttpassword)) {
client.subscribe(topic1);
client.publish("slave1/switch", "idle", true);
} else {
delay(5000);
}
}
}
void callback(char* topic, byte* payload, unsigned int length) {
payload[length] = '\0';
strTopic = String((char*)topic);
if(strTopic == topic1)
{
switch1 = String((char*)payload);
if(switch1 == "on")
{
digitalWrite(ledpin1, HIGH);
outgoing = "slave1led1on";
sendMessage(outgoing);
LoRa.receive();
}
else
{
digitalWrite(ledpin1, LOW);
outgoing = "slave1led1off";
sendMessage(outgoing);
LoRa.receive();
}
}
yield();
}
void setup() {
pinMode(ledpin1, OUTPUT);
digitalWrite(ledpin1, LOW);
pinMode(button1, INPUT_PULLUP);
//pinMode(26, INPUT);
delay(10);
Serial.begin(9600); // initialize serial
WiFi.enableSTA(true);
delay(2000);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
client.setServer(mqtt_server, mqttport);
client.setCallback(callback);
Serial.println("LoRa Duplex with callback");
// override the default CS, reset, and IRQ pins (optional)
SPI.begin(5,19,27,18);
LoRa.setPins(SS,RST,DI0);
if (!LoRa.begin(BAND,PABOOST)) {
Serial.println("LoRa init failed. Check your connections.");
while (true); // if failed, do nothing
}
LoRa.onReceive(onReceive);
LoRa.receive();
Serial.println("LoRa init succeeded.");
}
void loop() {
if (!client.connected()) {
reconnect();
}
client.loop();
yield();
}
void sendMessage(String outgoing) {
LoRa.beginPacket(); // start packet
LoRa.write(destination); // add destination address
LoRa.write(localAddress); // add sender address
LoRa.write(msgCount); // add message ID
LoRa.write(outgoing.length()); // add payload length
LoRa.print(outgoing); // add payload
LoRa.endPacket(); // finish packet and send it
msgCount++; // increment message ID
}
void onReceive(int packetSize) {
if (packetSize == 0) return; // if there's no packet, return
//read packet header bytes:
int recipient = LoRa.read(); // recipient address
byte sender = LoRa.read(); // sender address
byte incomingMsgId = LoRa.read(); // incoming msg ID
byte incomingLength = LoRa.read(); // incoming msg length
String incoming = ""; // payload of packet
while (LoRa.available()) { // can't use readString() in callback, so
incoming += (char)LoRa.read(); // add bytes one by one
}
if (incomingLength != incoming.length()) { // check length for error
Serial.println("error: message length does not match length");
return; // skip rest of function
}
if (recipient != localAddress && recipient != 0xFF) {
Serial.println("This message is not for me.");
return; // skip rest of function
}
// if message is for this device, or broadcast, print details:
Serial.println("Received from: 0x" + String(sender, HEX));
Serial.println("Sent to: 0x" + String(recipient, HEX));
Serial.println("Message ID: " + String(incomingMsgId));
Serial.println("Message length: " + String(incomingLength));
Serial.println("Message: " + incoming);
Serial.println("RSSI: " + String(LoRa.packetRssi()));
Serial.println("Snr: " + String(LoRa.packetSnr()));
delay(50);
yield();
}
Error compiling for board NodeMCU 0.9 (ESP-12 Module). Invalid library found in G:\ArDu\arduino-nightly_01\libraries\esp32: G:\ArDu\arduino-nightly_01\libraries\esp32 Invalid library found in G:\ArDu\arduino-nightly_01\libraries\esp8266: G:\ArDu\arduino-nightly_01\libraries\esp8266 Invalid library found in G:\ArDu\arduino-nightly_01\libraries\esp32: G:\ArDu\arduino-nightly_01\libraries\esp32 Invalid library found in G:\ArDu\arduino-nightly_01\libraries\esp8266: G:\ArDu\arduino-nightly_01\libraries\esp8266
Do to the fact that the packages.json file points to arduino.esp8266.com, it fails. There is more detail here: esp8266/Arduino#3198
Do you know of any remote control buttons that will work with the SX1278 in this module?
Good day
I am trying to connect to ESP32 LoRa device but get A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header. This is on a Mac.
I have done the following:
Nothing works. Please help.
I try to convert CayenneLPP TTN lib with Heltec
https://github.com/sabas1080/CayenneLPP/tree/master/examples/Basic_library_TTN
lpp.reset();
lpp.addTemperature(1, 22.5);
lpp.addBarometricPressure(2, 1073.21);
lpp.addGPS(3, 52.37365, 4.88650, 2);
// Send it off
ttn.sendBytes(lpp.getBuffer(), lpp.getSize());
your LoRa lib can send byte and Size
what do you recommend?
With Adafruit boards, you can disable the battery charging circuit by tying their EN pin to ground. This allows you to add a slide switch that will turn off the device; the battery doesn't power the device, and does not drain either. With my first prototype using the esp8266, I tried the same thing, but the EN pin is actually Chip Enable. Tying it to ground still allows the battery to supply power to external sensors on the 3.3 regulated pin.
I had to route the negative lead of the battery through a slide-switch before connecting it to the battery socket on the board. Is there a better way to do this?
Hi!
Please change component.mk in root directory this way:
from
COMPONENT_ADD_INCLUDEDIRS := cores/esp32 variants/esp32 $(ARDUINO_CORE_LIBS)
COMPONENT_SRCDIRS := cores/esp32/libb64 cores/esp32 variants/esp32 $(ARDUINO_CORE_LIBS)
to
COMPONENT_ADD_INCLUDEDIRS := cores/esp32 variants/wifi_lora_32 $(ARDUINO_CORE_LIBS)
COMPONENT_SRCDIRS := cores/esp32/libb64 cores/esp32 variants/wifi_lora_32 $(ARDUINO_CORE_LIBS)
otherwise it did not compile under esp-idf
Is there any kind of connection between the battery and one of the ADC pins for monitoring battery level?
Would you be able to point me towards the source code for the "Hello World" application that is installed on WIFI_Kit_32 out of the box? The one with scan of Wifi that ends "Even scrolling is working"
Hi
I connected DHT31 temp & humidity sensor via i2c (using pin 21 & 22) but it won't work when OLED is initiated (display.init(); ) - I get NaN from DHT31. When I comment out display.init(); sensor works...
How to use i2c with enabled OLED>?
Hello,
I have been scratching my head trying to get the Heltec LoRa WiFi ESP32 board to talk to a MicroSD card properly using the Arduino IDE. I am using a breakout board I have used with a 32u4 & 328p and verified those can write to the SD card. I've also tried a few other breakout boards and cards to rule those out as well as a few different heltec lora esp32 boards (I own about a half dozen of them now). I have tried both your example code (which appears to use the same chip select pin as the onboard LoRa SPI), have tried passing a different CS in SD.begin, have tried using the "mySD" library for the ESP32 where you can specify all lines (MOSI, MISO, SCK and CS) in SD.begin.... all to no avail. When I've tried scoping the MOSI, MISO, SCK & CS line it seems like the ESP32 is attempting to communicate with the MicroSD MUCH faster than it does with the onboard LoRa chip. Do you have a working example for using MicroSD with this LoRa board? I noticed that you use a few unconventional pins compared to the standard ESP32 pinout on the LoRa board. I am curious if that might be causing any potential issues. For instance to get another hardware UART working I had to modify...
Documents\Arduino\hardware\espressif\esp32\cores\esp32\HardwareSerial.cpp
if(_uart_nr == 1 && rxPin < 0 && txPin < 0) {
rxPin = 13;
txPin = 21;
}
...in order to get a functional second hardware serial line I needed. I really want to use this board as the centerpiece of a project I am working on but this is unfortunately quite the hangup at the moment.
Sorry if this is not the right place to request this.
I am trying to write a function like Serial.Print that will output to the display. It is harder than originally thought but maybe making it too difficult. Scroll the text? Copy existing display to memory, clear screen, write text, delay, restore display from memory.
Can someone throw something together for me?
I think this would be a handy example.
I bought your two great 2 modules kit.
I managed to setup them using your libraries and I the leds showing the send and receive packets sucessfully.
But when I switch the code between the modules one keeps sending, but the other doesn't report receive.
Is this expected or some sort of malfunction? what can I do?
So, to compile this SDK as component of esp-idf you have to:
ARDUINO_CORE_LIBS :=
it works
Hi!
I have two Heltec WiFi Lora Esp32 boards, #1 with this small wire wrapped antenna and #2 without this antenna.
I use the Lora example LoraSender/LoraReceiver from this git with band 433E6.
Problem:
#1 send and #2 receive works fine, #2 send and #1 receive does not work at all.
After looking into it with a SDR it looks like #1 is sending fine and #2 does not send at all or with very low power. Changing the antenna did no change.
Any idea where the problem is and how to fix it?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.