sinricpro / esp8266-esp32-sdk

Library for https://sinric.pro - simple way to connect your device to Alexa, Google Home, SmartThings and cloud
https://sinric.pro
Other
234 stars 124 forks source link

Arduino Pro Micro and ESP8266-01 #205

Closed Dragontamer333 closed 3 years ago

Dragontamer333 commented 3 years ago

Hello, I don't know if this is the correct place to put this in, but is there anyway to use a pro micro and an ESP8266-01 with some of the sinric code? How would this be implemented?

sivar2311 commented 3 years ago

Hi Dragontamer,

this SDK is designed to run directly on the ESP chip itself. Surely you could implement an interface to the Arduino Micro. However, the effort involved is outweighed by the benefit. It is better to do without the Arduino Micro and rather use an ESP developer board like the D1mini, NodeMCU directly. However, I would recommend switching to the ESP32 right away.

What is the usecase for the combination of the Arduino micro with the ESP-01?

Dragontamer333 commented 3 years ago

Thanks for the quick reply. The reason I want to use the micro is because it had the 32u4 chip that would allow the device to use the Keyboard library. I want to use sinric pro in order the activate macros on my computer. Maybe I could instead use a serial connection between a micro and a D1 mini to get a small form factor device that plugs into my computer.

sivar2311 commented 3 years ago

For this use case a serial connection between the ESP and the Arduino is the best solution.

sivar2311 commented 3 years ago

Another solution could be to use an ESP32 as a [Bluetooth keyboard] (https://github.com/T-vK/ESP32-BLE-Keyboard). In this case you don't need an Arduino and everything can run directly on the ESP.

sivar2311 commented 3 years ago

Hello again. I made a small test to use an ESP32 module with BLE keyboard in combination with SinricPro.

Since the standard BLE libraries consume a lot of memory in RAM and ROM, I modified the keyboard library to use the Arduino NimBLE library.

Result: It works!

Let me know if you are interested.

Dragontamer333 commented 3 years ago

That would be great if I could get some more information on that. I had purchased this ESP32 since it has 16mb of flash, but if I could get it smaller still that would be much appreciated.

sivar2311 commented 3 years ago

I'm sorry, but this is not an ESP32 but an ESP-8266EX. The 16 MB refers only to the FLASH (ROM not RAM). But you can use e.g. an ESP32 DevKit C.

sivar2311 commented 3 years ago

The example I have prepared can be found here

Dragontamer333 commented 3 years ago

So I'm trying to get the code to work. I have installed the NimBLE library and the keyboard library, but how do I differentiate between the two keyboard libraries. I still get the sketch is too big error when I compile. I also want to say thank you for all your help. I much appreciate it.

sivar2311 commented 3 years ago

NimBle is the ble library, used by my modified NimBleKeyboard library. Which ESP Module do you use? The sketch fits in the 1MB (standard partition)

sivar2311 commented 3 years ago

Remove the original keyboard library

Dragontamer333 commented 3 years ago

I am compiling with using the ESP32 Board library and using the Lolin D32 Pro. I deleted the original library and it went down in size considerably. I think I should be good now and can play around with my board. I don't want to say you're wrong, but unless I put the link in wrong, I think I have the correct board on order.

sivar2311 commented 3 years ago

Great that it is compiling now. Yes, you are right, the module is the correct one. There seems to be an issue on amazon (different datasheet on different languages). Here is the same page in german (left) and english (right): image

Dragontamer333 commented 3 years ago

If you don't mind me asking how did you learn all of this information? I have some basic understanding of this stuff, but how did you learn all this information? The issue should be solved now, but let me play with my board and see if I can get it to work.

sivar2311 commented 3 years ago

I do not know how to answer this question ;) I like to program and I learned how to do it. In the time before the Internet from books, today with the help of the Internet... Youtube etc etc.

Dragontamer333 commented 3 years ago

Ok thanks

Dragontamer333 commented 3 years ago

I was able to get it working and everything works great. Thanks for all the help.