FreeRTOS + ArduinoMega

Hi,
As we know that Arduino hardware is limited to some features with decent processor power but some of my code need to run simultaneously even without a delay in loop some function take over 300ms to done that cause timer problem also blynk disconnect from server again and again but I found a library know as FreeRTOS that has ability to run program simultaneously.

But I don’t know how to implement with blynk
i tried FreeRTOS for led blinking that work perfectly.

Need help.

Running an RTOS on your device won’t solve these problems, as you still have a single processor core, and in reality you have slightly less memory available and the overhead of the RTOS library.
What RTOS does allow you to do is prioritise tasks to allow some to have a higher priority than others, but I’m sceptical about how that will help with the issues you’ve described - especially if your code is the one you’ve posted in your other topic.

If you do what advice about how to prioritise tasks under RTOS then you’ll need to provide much more information exactly what you’re trying to achieve, and why - which is something you haven’t done in your other topic.

It may be that you need to consider a different processor, such as an ESP32 with true multi-threading, or simply one with more processing power.
Or, you may be better using two devices - one to handle your critical task and the other to deal with everything else - as I suggested in your other topic.

Pete.

Forget my last post and RTOS, I create this thread for get knowledge about RTOS can solve or not processing (timing) type problem in mcu.As per you mentioned esp32 have real multi core cpu that sounds good.

But can you suggest me a mcu board for simple sensor data monitoring (1 - 2 virtualwrite) also for long term use without any problem (server disconnect).which one are super stable.

One more thing - I read mostly 2-3k forum on Blynk,Arduino,stackoverflow,espressif and etc over internet also tried all communication protocol spi,UART,i2c.Forum on this site show something wrong with esp32 board that could cause disconnection from server.

My final thought is which mcu board is perfect for blynk.For ex. combination (Arduino due + wiznet) ,Nodemcu(esp8266), (Stm32 + enc28j60), (Arduino nano + esp01) if none of this are stable from yours view my last choice is Raspberry Pi.I really need help🙂

I have no idea what it is that you are saying in this sentence. Maybe you should clarify where the spi, UART & i2c communication comes in to the equation, and provide links to the forum posts that discuss ESP32 problems?

The best approach is to identify your operational requirements then choose an appropriate board.
I’d suggest that for an IoT project then you should choose a board that has native IoT connectivity, rather than choosing a board like the STM32, Arduino Due/Nano/Mega + Ethernet/WiFi adapter.

My go-to board is the Wemos D1 Mini/Pro, which is in effect a NodeMCU or an ESP32 Dev Board.
In my opinion, the Raspberry Pi is best used as a Blynk or Node-Red/MQTT server rather than as a client device.

However, it doesn’t matter which board you use, you’ll still need to write code that is efficient, and tuned for use with Blynk. In your previous post you used a sketch that attempted to take ultrasonic distance measurements every 0.1 seconds, and had multiple overlapping timers. Despite asking why you needed to be taking distance readings this often, and pointing-out the overlapping timers issue, you don’t seem to have taken these comments onboard. Your approach seems to be to be to create a local server, run a multi-threaded operating system or choose a different board. In reality, cleaner code is what is needed.

If you want assistance with improving your code, and/or choosing a more appropriate board, then you need to be more forthcoming about what it is that your project is about; and what your success criteria are.
If you’ve chosen a certain type of sensor, a particular sampling frequency, and have a particular reporting/alert functionality then you need to outline the reasoning behind these choices.

Pete.

Thanks pete, meanwhile every mcu board is perfect but need to write with better code for long term use.But even with only blynk.run() in loop both Arduino and espressif board show packet loss.

If you wanna help me - this is about that my approach to connect 1xjsn sr04t + 1xds18b20 + esp32 with wifi auto reconnect function

If you want to translate this…

into this…

and not answer any of the questions I’ve asked, then I don’t think I can help any further.

Pete.

I understand your meaning :slightly_smiling_face:, I need a mcu with native iot support thanks @PeteKnight