aws / amazon-freertos

DEPRECATED - See README.md
https://aws.amazon.com/freertos/
MIT License
2.54k stars 1.1k forks source link

How to use DHT22, MQ2,BMP180 and ublox-NEO-6M on AWS FreeRTOS ESP32 #3020

Closed Yoimer closed 3 years ago

Yoimer commented 3 years ago

Hello there. How could I possibly use those sensors (DHT22, MQ2,BMP180) and ublox-NEO-6M GPS on your latest AWS FreeRTOS ESP32 version(202012.00 LTS). I successfully ran those on Arduino IDE using their respective ESP32 libraries. Is there any way I could import those ESP32 Arduino Libraries on the AWS FreeRTOS ESP32 code? Would those libraries work exactly the same on AWS FreeRTOS the same way they do on Arduino ESP32? Is there any sort of tutorial or documentation I could get that information from?. Looking forward to hearing from you soon. Thanks in advance.

lundinc2 commented 3 years ago

Hi @Yoimer,

I am investigating this and will provide some more details for you shortly.

Thanks,

Carl

Yoimer commented 3 years ago

@lundinc2 Thanks a lot for your cooperation.

Yoimer commented 3 years ago

Hello @lundinc2. Double checking here with my crew, instead of DTH22, we are using DHT11. Thanks in advance

elieDaan commented 3 years ago

I think you just need to find the equivalent esp idf (v3.3) libraries of your component. AWS Freertos for ESP32 is using esp-idf v3.3.

For example, components libraries for esp idf

Yoimer commented 3 years ago

@elieDaan Thanks a lot for commenting. Yes, you're right AWS FreeRTOS for ESP32 esp-idf v3.3. However, I was able to adapt the ESP-IDF 4.2 to compile, and even flash code to AWS FreeRTOS ESP32 V202012.00(latest one). I am attaching snapshots of the configuration.

Do you think that using the ESP-IDF 4.2 would cause any issues with the components section on FreeRTOS?

Thanks in advance.

esp-idf-4 2-freertos esp-idf-4 2-native

elieDaan commented 3 years ago

Sorry, I'm wrong. I am outdated about the last updates on AWS AFR.. It seems that AFR is now supporting esp-idf v4.2

paulbartell commented 3 years ago

@Yoimer, the libraries that @elieDaan linked to look like a good place to start.

When porting new drivers to a system using FreeRTOS, you will need to place calls to drivers that are not thread safe or are timing critical in a critical section to prevent the scheduler from interrupting them.

The DHT11 is particularly affected by this because the interface bit-banged via a gpio pin. This driver uses critical sections when necessary.

Regarding GPS / GNSS, Here's a link to an esp-idf example for parsing NMEA sentences produced by modules like the NEO-6M.

Edit: Here are a few more links to relevant drivers from some of our other team members: https://github.com/Andrey-m/DHT22-lib-for-esp-idf https://github.com/krzychb/bmp180-tests https://github.com/kosma/minmea

Yoimer commented 3 years ago

@paulbartell Thanks a lot for replying. At this stage I was able to run DHT11 and BMP180 sensor on IDF 4.2 from UncleRus. I haven't tried that on AWS FreeRTOS ESP32 (but that's my goal). Is this the right path then? I will be checking the NEO-6M link you passed me. Thanks a lot for your help and guidance.

paulbartell commented 3 years ago

@Yoimer If you are only targeting espressif platforms, the esp-aws-iot repository from espressif or the Core2-for-AWS-IoT-EduKit repository from m5stack could be better places to start.

This repository is a set of reference integrations / demos for connecting a variety of microcontroller evaluation boards to AWS and other cloud services. It's meant to give you examples of how to integrate parts of the aws iot device sdk into a cmake style project that targets platforms from multiple vendors.

I'm going to close this Issue since it's more of a general inquiry. Feel free to make a thread on the FreeRTOS forums and we can address any followup questions over there.