#253
Ralph S Bacon Ralph S Bacon
53.7K subscribers
20,679 views
964

 Published On Oct 28, 2022

Finally a task scheduler that is super accurate - good enough for a clock!
Ten PCBs for just $5 https://pcbway.com/
Participate in the 5th PCBWay PCB Design Contest!

Demo sketch, links and more in my GitHub:
https://github.com/RalphBacon/253-Ard...

During the course of playing about with 7-segment animation, I stumbled across a very well-written Task Scheduler for the Arduino, STM32, ESP32 and others too, from Anatoli Arkhipenko.

I used it just to display a "clock" on the 4-digit, 7-segment display I was using for the animation - and was amazed to find that it was still accurately displaying the correct time the next day. No RTC. No access to the Internet. But still accurate. Unheard of!

Anyone who has ever tried to make an accurate loop in the Arduino environment will know that "drift" is normally unavoidable. That is, the time taken to execute the loop or function has an adverse effect on the timing accuracy of the loop, especially if the loop's code does not always execute the same code. Not any more!

SOFTWARE
So Anatoli Arkhipenko's Task Scheduler is a great find, and has lots of options, not to mention examples. It's worth taking the time to read the documentation to get a better grasp of the potential of this library; not least the option to ensure that a task is effectively guaranteed to fire the correct number of times in a given time period.

Demo sketch, links and more in my GitHub:
https://github.com/RalphBacon/253-Ard...

► arkhipenko/TaskScheduler: Cooperative multitasking for Arduino, ESPx, STM32 and other microcontrollers
https://github.com/arkhipenko/TaskSch...

► Using "printf" in an Arduino environment:
   • #227 ✨printf for Arduino✨(and ESP32, ...  

► FreeRTOS on an Arduino? No way! Yes way!
   • #244 Multiple tasks on an Arduino?😲Fr...  

HARDWARE
The four-digit 74HC595-controlled device (two 2-digit devices cascaded [soldered] together) can be found here:
https://s.click.aliexpress.com/e/_DEt...
They don't make a great clock because the gap between the two sets of two digits is too big, but you could always put a couple of 1.8mm flashing LEDs in there, controlled by another task to ensure they flash accurately every second (just like in the demo sketch). But other ones are available that lend themselves better into making into a clock format.

LINKS
► Clickable list of all my videos (Special thanks to Michael Kurt Vogel for compiling this)
http://bit.ly/YouTubeVideoList-RalphB...

► If you like this video please give it a thumbs up, share it and if you're not already subscribed please consider doing so and joining me on my Arduinite (and other μControllers) journey

Demo sketch, links and more in my GitHub:
https://github.com/RalphBacon/253-Ard...

My channel, GitHub and blog are here:
------------------------------------------------------------------
•    / ralphbacon  
• https://ralphbacon.blog
• https://github.com/RalphBacon
• https://buymeacoffee.com/ralphbacon
------------------------------------------------------------------

My ABOUT page with email address:    / ralphbacon  

show more

Share/Embed