Featured post

Arduino FreeRTOS Mutex Examples

In this section, we will explain using an example to demonstrate mutexes in Arduino using freeRTOSThere are two freeRTOS Mutex examples in this tutorial, the first example demands some hardware (LCD) While the second does not need any hardware, you can try out both if you have the resources.

In the last tutorial, we considered in detail: semaphores and mutexes and we also established the difference between binary semaphores and mutexes.
Just for a review:Recall that a mutex is a locking mechanism that implements the take and gives functionality in itself, unlike a binary semaphore. See this tutorial if you have not before continuing.
Example 1: Protecting the LCD Resource Using Mutex in freeRTOS
Program Description

In this program, we Demonstrated the use a 16x2 LCD display to implement a mutex.

The LiquidCrystal library works with all LCD displays that are compatible with the Hitachi HD44780 driver. you can usually tell them by their 16-pin interface.


* LCD RS pin to digital…

Arduino FreeRTOS Tutorial 05: Binary Semaphores and Mutexes

Semaphores and Mutexes are interesting operating system concept that is used for synchronization, resource management and protecting access to resources.

So far in our FreeRTOS Tutorial series, we have dealt with tasks and scheduling algorithms. In the process of the tutorial, we stumbled across an Operating system's concept called Semaphores and Mutexes, though you may not have noticed it.

The Idea

You might have observed while playing around with task priorities, that a high priority task could pre-empt a lower priority task at any time whether or not the low priority task has completed its execution. This is a common feature in a multi-tasking environment and it can cause data corruption, data integrity losses, etc. Thus, there is a need to protect resources, and control access using semaphores and mutexes.

Students usually find it difficult to understand this concept so I will be given an explanation using some illustrations, and also provide a code snippet for implementation o…

Arduino FreeRTOS Tutorial 04: Understanding Task Scheduling and Control

In the last Free RTOS Arduino tutorial, we were able to show how a task can be implemented and executed. We also saw how to delete a task that we no longer need after a while.

In this tutorial, we are going to learn and understand how task scheduling and execution work.

To properly understand this, we will be using an example to illustrate this.

In this example, we are creating two tasks with the same priority and in the second example, with two different priorities.
#include <Arduino_FreeRTOS.h> void setup() { Serial.begin(9600); xTaskCreate(Task1, "Task 1", 100, NULL, 1, NULL); xTaskCreate(Task2, "Task 2", 100, NULL, 1, NULL); vTaskStartScheduler(); // hands over control to kernel. Task execution begins } void loop(){ } ============================== void Task1(void* pvParameters) { for(;;) { Serial.println("Task1 is currently being executed"); vTaskDelay(500/portTICK_PERIOD_MS); } } void Task2(void* pvParameters) { for(;…

Arduino FreeRTOS Beginner Tutorial: Task Creation, Scheduling, Deleting

Tasks are basically functions that you want to execute. A task can be as simple as blinking a led, printing a string on an LCD.

Your program or embedded application is a combination of various tasks.

In the previous tutorial, we showed how to install freeRTOS in Arduino and we have also covered a quick introduction to RTOS.

In this tutorial we will be considering the following:

How to create tasks
Prioritizing tasks
How to delete tasks
How to run the scheduler
Features of tasks in freeRTOS.
In free RTOS, tasks have some features that you must adhere to when creating them.

It must not have an end. There should be no terminating statement (return statement)
A task should run continuously. To implement this, you will need to use an infinite loop in the tasks
Tasks have priorities. The priority of a task determines its pre-emptive nature. A task of higher priority can pre-empt one of lower priority. This is useful to enable you to achieve your hard and soft real-time requirements.
How to Create …

Arduino FreeRTOS Tutorial: Getting Started

For the next week, we will be starting a FreeRTOS series, we have already completed a basic introduction to RTOS. In this tutorial series, we will be implementing an RTOS (Real-Time Operating Systems) using FreeRTOS.

To better appreciate this tutorial, we will be taking a project that will encompass all we need to understand in FreeRTOS, I will propose a simple project to help us digest the concept of RTOS using FreeRTOS.

This tutorial series will cover the following contents:

Basic Introduction to FreeRTOS
FreeRTOS Installation
Task Creation, States, Scheduling and Deleting
Semaphores and Mutexes
FreeRTOS is to RTOS what windows OS is to OS. FreeRTOS provides the implementation of an RTOS for embedded application, however, freeRTOS is not a full OS, it is more accurately called freeRTOS Kernel because its functions is limited to kernel services of core real time scheduling functionality, inter-task communication, timing and synchronization only.
Why should you use FreeRT…

CyberSpace Security: How to protect yourself from Attacks

Cyberspace Threats and how to protect yourself from these attacks.

Recent studies have shown that a new type of threat is emerging on a global scale. Due to the proliferation and adoption of computer technology in various parts of the world, every data leaves a digital footprint, Cyber threats and attacks are being launched on-a-second basis: attacking financial institutions, tech companies, web servers, hosting companies, websites, applications, IoT services, etc.

Your inability to understand and mitigate yourself from these Cyber attacks will make you very vulnerable and insecure. For instance, your mobile bank app is at risk if you cannot protect your Android device from these attacks.

In this post we intend to achieve the following objectives:

Explain what these threats are and peculiar casesHow these threats can be mitigated and checkedSafety measures you should take in protecting yourself and your organization

CyberSpace and CyberSpace Threats

Cyberspace is a recent word in the En…

Digital Systems and Stability Analysis using Jury's Stability Test

In this post, we will be introducing digital control systems, their advantages, and disadvantages, we will also perform a comparison between digital and analog control systems. Then we will proceed to sampling and Shannons sampling theorem and how it is applied practically, we will also see some sampling circuits and review Zero Order Hold DAC. Finally, we will look into analysis of the response of digital systems using difference equations and Stability analysis of Digital Control Systems using Jury's stability criterion, we will explain how to plot the Jury's table using an example to illustrate the process and how to make statements about the stability of the system.

So many theories and analytical tools exist in classical analog control system analysis, however, due to the shifts in technology, control algorithms are now been implemented using digital systems and microprocessor-based controllers, this is because of its numerous advantages, recent studies have shifted focus…