# ESP32 - connect to Losant

**URL:** <https://forums.losant.com/t/esp32-connect-to-losant/2865>\
**Category:** Help\
**Tags:** mqtt, edge, device\
**Created:** [April 25, 2020, 12:26pm UTC](https://forums.losant.com/t/esp32-connect-to-losant/2865 "2020-04-25T12:26:09Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Uri\_Bear](https://avatars.discourse-cdn.com/v4/letter/u/f1d935/32.png) [@Uri\_Bear](https://forums.losant.com/u/Uri_Bear)\
**Post date:** [April 25, 2020, 12:26pm UTC](https://forums.losant.com/t/esp32-connect-to-losant/2865/1 "2020-04-25T12:26:10Z")

</div>

Hello oh wise people of Losant!  
I have now started dabbing into LoRa and the ESP32, specifically the “TTGO LORA ESP32 with display” board

> **[LILYGO® TTGO LORA V1.3 by Lilygo on Tindie](https://www.tindie.com/products/ttgo/lilygor-ttgo-lora-v13/)**
>
> LILYGO® TTGO LORA V1.3 868Mhz ESP32 Chip SX1276 Module 0.96 Inch OLED Screen WIFI And Bluetooth Development Board(G711)

  

> **[LilyGO/TTGO-LORA32](https://github.com/LilyGO/TTGO-LORA32/tree/LilyGO-V1.3-868)**
>
> ESP32-TTGO-T3. Contribute to LilyGO/TTGO-LORA32 development by creating an account on GitHub.

I followed the ESP32 coding, some (A little old) from Losant at:

> **[Connecting the ESP32 to the Internet with Arduino and Losant](https://www.losant.com/blog/connecting-the-esp32-to-the-internet-with-arduino-and-losant)**
>
> In this tutorial, we provide step by step instructions to show how to connect an ESP32 device to the cloud using the Arduino IDE. Read more.

  

> **[Getting Started with ESP32 and PlatformIO](https://www.losant.com/blog/getting-started-with-esp32-and-platformio)**
>
> A getting started guide to flashing an ESP32 microcontroller with PlatformIO.

I tried compiling the latest example you sent me for ESP8266, and it is failing compilation on

BearSSL::WiFiClientSecure wifiClient;

It seems that Bear SSL is native to the ESP8266 branch of the Arduino compiler, but does not exist for other branches and specifically to the ESP32. Direct adding of the BearSSL c code from it’s website to the libraries directory of Arduino did not help.

Can your engineers help me connect to Losant once again?

Many thanks

Uri

---

<div class="post-metadata">

**Author:** ![JuliaKempf](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/juliakempf/32/2446_2.png) [@JuliaKempf](https://forums.losant.com/u/JuliaKempf)\
**Post date:** [April 27, 2020, 2:58pm UTC](https://forums.losant.com/t/esp32-connect-to-losant/2865/3 "2020-04-27T14:58:12Z")

</div>

Hi @Uri_Bear,

We are currently looking into this and will get back to you shortly with further information.

In the meantime, please let me know if you have any additional questions!

Thanks,  
Julia

---

<div class="post-metadata">

**Author:** ![anaptfox](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/anaptfox/32/873_2.png) [@anaptfox](https://forums.losant.com/u/anaptfox)\
**Post date:** [April 27, 2020, 4:07pm UTC](https://forums.losant.com/t/esp32-connect-to-losant/2865/4 "2020-04-27T16:07:34Z")

</div>

@Uri_Bear,

Since we are all working from home, I just ordered an ESP32 for testing on this. However, in the meantime, you don’t have to use our libraries to connect.

Our libraries are just tiny wrappers around MQTT Clients. In this case, if you can find an MQTT client that supports the ESP32, you can use that as well. Like this one:

> **[knolleary/pubsubclient](https://github.com/knolleary/pubsubclient)**
>
> A client library for the Arduino Ethernet Shield that provides support for MQTT. - knolleary/pubsubclient

You can find all the details on how to connect to the Losant Broker here:

> **[MQTT Protocol](https://docs.losant.com/mqtt/overview/#the-losant-message-broker)**
>
> Learn about communicating with the Losant platform over MQTT.

---

<div class="post-metadata">

**Author:** ![Uri\_Bear](https://avatars.discourse-cdn.com/v4/letter/u/f1d935/32.png) [@Uri\_Bear](https://forums.losant.com/u/Uri_Bear)\
**Post date:** [April 27, 2020, 8:01pm UTC](https://forums.losant.com/t/esp32-connect-to-losant/2865/6 "2020-04-27T20:01:14Z")

</div>

Hi  
Thank you for answering. I have used this library in the past for ESP8266 (based on Losant’s demo) but since Losant moved to SSL auth with a certificate, That solution has ceased working.

I am not much of a programmer, I need a complete solution that works. I am on the IoT device side… Please help!

I too am working from home, thank you for your support.

Uri

---

<div class="post-metadata">

**Author:** ![Uri\_Bear](https://avatars.discourse-cdn.com/v4/letter/u/f1d935/32.png) [@Uri\_Bear](https://forums.losant.com/u/Uri_Bear)\
**Post date:** [June 18, 2020, 3:36pm UTC](https://forums.losant.com/t/esp32-connect-to-losant/2865/9 "2020-06-18T15:36:32Z")

</div>

Hello  
Is there any update on the ESP32 Losant demo?  
reminder: The code on your official ESP32 walkthrough is old and does not support your new certificate based SSL.  
Thanks  
Uri

---

<div class="post-metadata">

**Author:** ![Heath](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/heath/32/3036_2.png) [@Heath](https://forums.losant.com/u/Heath)\
**Post date:** [June 18, 2020, 4:06pm UTC](https://forums.losant.com/t/esp32-connect-to-losant/2865/11 "2020-06-18T16:06:32Z")

</div>

Hey @Uri_Bear,

Thanks for reaching back out.

It’s actually in our content pipeline to have that updated next couple of weeks! I’ll be sure to update this thread with the link to it when it’s out!

Thank you,  
Heath

---

<div class="post-metadata">

**Author:** ![Uri\_Bear](https://avatars.discourse-cdn.com/v4/letter/u/f1d935/32.png) [@Uri\_Bear](https://forums.losant.com/u/Uri_Bear)\
**Post date:** [July 23, 2020, 7:50am UTC](https://forums.losant.com/t/esp32-connect-to-losant/2865/13 "2020-07-23T07:50:26Z")

</div>

Hello  
Is there any update on the ESP32 Losant demo?

My ESP32 project involves one ESP32 capturing data, transferring it to a second ESP32 which will serve as a LoRa aggregator. This will be the base for many other devices. The central ESP32 will connect to Losant … if you help me.  
Most other SW and HW are ready & waiting for this final piece.  
Uri

---

<div class="post-metadata">

**Author:** ![Heath](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/heath/32/3036_2.png) [@Heath](https://forums.losant.com/u/Heath)\
**Post date:** [July 23, 2020, 2:41pm UTC](https://forums.losant.com/t/esp32-connect-to-losant/2865/17 "2020-07-23T14:41:31Z")

</div>

Hi @Uri_Bear,

We do have new example software for the ESP32 on [github](https://github.com/Losant/losant-mqtt-arduino/blob/master/examples/esp32/esp32.ino) that connects to and sends state to the Losant platform with arduinojson v6.

Let me know if you have any other questions!

Thank you,  
Heath

---

<div class="post-metadata">

**Author:** ![Uri\_Bear](https://avatars.discourse-cdn.com/v4/letter/u/f1d935/32.png) [@Uri\_Bear](https://forums.losant.com/u/Uri_Bear)\
**Post date:** [July 26, 2020, 7:02am UTC](https://forums.losant.com/t/esp32-connect-to-losant/2865/20 "2020-07-26T07:02:41Z")

</div>

Thanks Heath!  
The example seems to be working. I will start integration with my operational code.  
My code does SSL accesses to Google cloud. Is there a way to shut down the Losant SSL tunnel (I don’t think 2 can exist simultaneously), then reopen it once the Google access is done?  
I will need to loop through this process every a minute or so (One access to Losant, one to google … lather, rinse, repeat)  
Thanks  
Uri

---

<div class="post-metadata">

**Author:** ![anaptfox](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/anaptfox/32/873_2.png) [@anaptfox](https://forums.losant.com/u/anaptfox)\
**Post date:** [July 27, 2020, 12:58pm UTC](https://forums.losant.com/t/esp32-connect-to-losant/2865/23 "2020-07-27T12:58:45Z")

</div>

@Uri_Bear,

Happy the example worked for you! For your second question, for that level of control of the connection, I’d suggest using an MQTT library directly over the Losant Arduino Library.

> **[256dpi/arduino-mqtt](https://github.com/256dpi/arduino-mqtt)**
>
> MQTT library for Arduino. Contribute to 256dpi/arduino-mqtt development by creating an account on GitHub.

You may also find information about how to connect to the broker here:

> **[MQTT Protocol](https://docs.losant.com/mqtt/overview/#the-losant-message-broker)**
>
> Learn how to leverage the Losant IoT Platform through MQTT.
