So you're a Noob? Post your questions here until you graduate! Don't be shy.

User avatar
By elmessiry
#88438 Hello community,

This is my first hopefully not my last post here :).
so basically i'm a noob when it comes to the esp. i'm an embedded developer with a desire to build an IoT device with all its accessories ( Mob App, server, etc .. ).

I have been searching for the available ESP modules and already bought NodeMCu and seen what it can do.

so here are my noob questions:

a) Communication Protocols:
what is your recommendation for a secure communication protocol ?
I've read about the MQTT and how it's light weight and easy to use and i read that Arduino IDE have some libs that support Mqtt like ADA_Fruit.
i also seen some examples of Thingspeak using Http which is not secure .
so basically i want a protocol that is secure for E2E encryption also has a good support related to esp8266.


b) SDKs :
what SDK do u recommend ?
by searching i found arduino IDE to be straight forward and easy to use with a good documentation .
but i also read that it does not support multi threading and i'm coming from an embedded environment so threads are simpler for me to design Software with so i also found RTOS SDK but i'm lacking the support .
also what other SDK available that you would recommend ?


the questions may be very unspecific but that's how lost i am right now.

also what books do you recommend i've seen some books but they all scratch the surface i want to do lots of reading so throw everything you might see help me to have a more clearer vision .

thanks all
User avatar
By btidey
#88458 a)
ESP8266 does support secure comms using for example bearSSL.

Have a look at https://github.com/tsi-software/Secure_ESP8266_MQTT_poc for an example of a secure MQTT client.

b) On the environment but here are some considerations

Arduino IDE or platformIO equivalent). Very popular and simple model. The IDE is pretty crude but I just use it as a compile, link and upload shell and use external editing. As it is popular there is a large collection of libraries supporting both peripheral components and services. It uses a very simplistic single thread model with a main loop that just executes forever. If one wants reasonably structured code then one technique is to use state machines to service the various activities in a controlled fashion. This can work quite well for IoT applications where normally the device is performing a well-defined and limited role.

RTOS provides a much more sophisticated real time threaded model which more advanced developers may prefer. However, it don't think it enjoys so much support as the Arduino version with respect to plugging in off the shelf library solutions.

There are other options as well like python, but I have not gone down that path myself.
User avatar
By elmessiry
#88467 Thanks for the clarification :D

so basically Arduino IDE is widely supported but does not support multi-thread .

and for RTOS SDK does not have that much support.

but does arduino support having multi files ? if iam talking Modular approach having a modules with detecated function and only the super loop would basically be running over these modules

Code: Select allmain (){
   while(1){

      function_1_main();    //module 1
      function_2_main();    //module 2
      etc.....
   }
}
}
User avatar
By davydnorris
#88471
btidey wrote:b) On the environment but here are some considerations

Arduino IDE or platformIO equivalent). Very popular and simple model. The IDE is pretty crude but I just use it as a compile, link and upload shell and use external editing. As it is popular there is a large collection of libraries supporting both peripheral components and services. It uses a very simplistic single thread model with a main loop that just executes forever. If one wants reasonably structured code then one technique is to use state machines to service the various activities in a controlled fashion. This can work quite well for IoT applications where normally the device is performing a well-defined and limited role.

RTOS provides a much more sophisticated real time threaded model which more advanced developers may prefer. However, it don't think it enjoys so much support as the Arduino version with respect to plugging in off the shelf library solutions.

There are other options as well like python, but I have not gone down that path myself.


I am not, in general, an Arduino user however I do make use of it at times when I am testing out a new sensor or porting one of their sensor libraries to NonOS. I use Eclipse as my editor and I have to say the Sloeber plug in for Eclipse is a really nice way to do Arduino - it gives you the full IDE but adds the boards and library management of the Arduino platform. I really like it and if I was doing Arduino it would be how I would use it.

NodeMCU is another similar platform, which uses Lua as the language. I don't know of many people using it but it's a pretty simple option. Personally if I were going down that path I would choose Arduino as it's C++ and so I wouldn't have to learn another language, but that's me. There's a topic here devoted to that so check it out.

As mentioned, the RTOS SDK is a decent way to go if you want more control over everything, at the additional overhead of learning the system. It's based on FreeRTOS though and there are a lot of resources out there to learn about that so, while it's a jump form Arduino, it's not impossible. It's also C++ so going from Arduino to RTOS is not a change of language.

The lowest level down is the NonOS SDK, which is not getting the love it used to from Espressif and is only occasionally maintained. This has caused a lot of stir amongst the developer community as it provides the best control over the chip and is also what the Arduino team have used underneath. This is what I use because I have found I can't immediately get the level of performance I need out of the RTOS and so porting my code would be a lot of work.

Other platforms that I believe are also based on the NonOS platform are the MicroPython port, which is actually very nice, a BASIC interpreter, a JavaScript interpreter, the SMING framework and multiple others.