All Projects

TicTacToe Design with React Native

Greetings to all TicTacToe fans! Some time ago I designed classes for the game in this post using C++ and it was quite interesting. However, to play it, there is one more step to go. In this post I will show you the front-end design that you can play on your browser, on your Android device or even iOS since React Native enables all….

Custom C++ Memory Pool for Fast Allocation from Heap

Today I will present custom memory pool design which can cut significant allocation time since performance is the greatest concern in C++ programs. The idea is pre-allocating a large block and giving fixed-size pieces to consumers later. This especially comes handy when your objects are of same size. Stay tuned for the details 😎 1 Memory Manager Design2 Test Drive3 Conclusion Memory Manager Design…

TicTacToe Design in C++

After some time, I have a fun idea! Let’s design tic-tac-toe game (or XO-game) in C++ with an object oriented approach. For the ones who don’t know it, just play a turn here directly. It is very simple, you see. In my design, you play versus a computer. You make the first move and the computer player moves after you. 1 Implementation in C++1.1…

Make Your Own Twitter in C++ with Redis

Just like a wise person said, Don’t like twitter? Design your own 😃 Believe me, it is quite interesting to code a working skeleton of the popular messaging platform on your desktop. You can use the back-end API services to send tweets, follow users and see your time-line. In this journey, you will have chance to work with several technologies such as Redis, the…

Machine Learning by Least Squares and Scikit Learn

Prediction of unknown values by making use of historical data is the core of machine learning. As a warm-up to machine learning, let’s work on global warming data to estimate future values in this post. All you need to have is up and running Python environment i.e. Anaconda with Jupyter notebook, with some pip packages installed. Rest is explained in details here 🐧 1…

Multi-Threaded Watchdog Class in C++

When dealing with critical systems such as user interfaces, headless servers or embedded systems, you must define a maximum response time of your software. However, there is no system that works as expected all the time and this is the reason you must use watchdog mechanism to take down and restart your program when this is necessary. In this post I will show how…

Four Ways of Inter Process Messaging

Well done! You have your first Linux program running. Now you are ready to code the second one but stop! You noticed that they have to communicate and send/receive messages. At that moment, I will tell you about four possible ways of Inter Process Communication on Linux 😎 1 Shared Memory1.1 Creating Shm1.2 Messaging over Mapped Shared Memory in C++2 First In First Out…

Quick Start Your REST Client with CppREST

Online services are getting more and more popular as the demand grows exponentially. Millions of connected devices already take advantage of cloud and edge services using REST. Representational State Transfer is a highly scalable and easy to use API protocol. In this post you will find the details for building your very simple C++ client that talks to any RESTful service using Microsoft’s C++REST…

How to IoT: MQTT on Nucleo and ESP8266

Have you ever heard of Internet of Things? How about MQTT protocol? I think so. But maybe you didn’t start an IoT project of your own yet. If yes, the time is now. In this post you will find the details of my project on STM32F103 Nucleo board running FreeRTOS and ESP8266 WiFi module, logging temperature data to Eclipse MQTT broker using Paho Embedded…

Semaphore and Mutex on ARM Cortex-M

Once you go deep in microcontroller low-level stuff, concurrent tasks make you need mutex and semaphores for multi-thread synchronization or preventing race conditions. Here is how to implement mutual exclusion and semaphores on ARM Cortex-M3/M4 in C/C++ since it is not available on bare-metal 😆 1 Exclusive Access2 Cortex-M Solution3 Implementation3.1 Exclusive Read-Modify-Write3.2 Testing the Exclusive Monitor3.3 Mutex and Semaphore (Binary/Counting) Exclusive Access Synchronization…

PushME Keypad Reader for FreeRTOS

My fancy, event-based keypad reader library PushME is on my website for a while and its time to add FreeRTOS support now. Since reading multiple buttons and keeping track of events like long-press or repetitive-press is a critical task for many embedded projects, the FreeRTOS version will help you on medium to large scale FreeRTOS projects. Let’s get hands dirty ? 1 Design with…

How To Debug Microcontroller Easily

You are an embedded firmware developer, you have a board and there is a problem as always, and you want to know what is wrong in there. Welcome to the club of desperate engineers! And good news, there is a solution that can make your life much easier ✨✨✨ Using BigBug you can print messages to track your software, as many as you want,…

Transistor-101: Practical Common Emitter Amplifier Design

The universe started with a big-bang, just like the story of electronics started with transistors. I dedicate this page to the most common application of bipolar transistors (BJT), specifically NPN transistor. You will find a practical design and analysis of a class-A, common-emitter amplifier in this post. My favourite SPICE software is LTspice and I will use it for simulation and design verification. Ready,…

Embedded MCU on Eclipse Setup

If you are into ARM microcontroller programming, you will notice the complexity of setting up a working environment and toolchain unless you are using a limited version of a non-free IDE like Keil MDK ARM or trial version of IAR Embedded Workbench but nothing is like using a totally free environment. GNU MCU Eclipse project is a life-saver at this point and here is…

STM32 Project From Scratch on Eclipse

If you want to use the popular STM32 ARM series of microcontrollers but you don’t like using example projects or templates and want to create your development environment from scratch, you are at the correct page. I will explain step by step how to create a project on Eclipse. 1 Brief2 Prerequisites3 Hands-on3.1 Creating an empty project3.2 MCU Peripheral Libraries3.3 Create Source Files3.4 Startup…

Convenient Way of Reading Keypad Buttons

Most of microcontroller coding tutorials’ second page is dedicated to reading pin or buttons. But for sure, that never means this is a trivial task and a keypad reader is easy to implement for a well designed MCU program that you should never underestimate. With this C keypad reader, you don’t have to struggle. 1 The Best Practice2 Features of PushME2.1 Key Definitions2.2 Debounce…

Getting Started with BananaPI Linux

Single board computers have been very popular in the community due to their low price and high flexibility and Banana Pi board, which is powered by Allwinner A20, is no exception. In this blog post you will find everything you need to prepare a Banana Pi Linux image from scratch. 1 Board setup2 Build environment2.1 Build OS2.2 Required packages3 Banana Pi BSP building3.1 U-boot…

Timebase for Everything: Ticker Real-Time

I covered the basics for making an embedded project which is also portable in the previous post Part1. Now it’s time to go one step further and implement a portable Ticker (a.k.a. system tick timer) for Porty. It will be the timebase of the system and may come in handy for basic time scheduling. 1 Features of the Ticker2 Project files3 Download Features of…

Create MCU Independent Embedded Code

One of the struggles in the embedded world is writing software that is reusable in other projects with different microcontrollers. The reason to that is every microprocessor has its own I/O and hardware structures. Good news! you can still write fully portable MCU software with the Porty framework 🙂 1 What is Porty?2 What does it offer?3 Project files4 Blinky example5 Download6 Compilation7 Conclusion What…

Simple and Efficient Task Scheduler

In embedded applications, punctuality is very critical. You always need to put the tasks on schedules and run them on specific moments. This is why some applications use a real-time operating system such as FreeRTOS or at least a task scheduler. If you are looking for a small-footprint task scheduler, you hit the jackpot because Punctual covers all of your needs! 1 What is…

Control The Lights with Any IR Remote

Have you ever wanted to turn off the lights without moving, especially when you started a film on TV or when you felt asleep after a busy day? If the switch is out of reach, it is most likely to leave the lights on. I inspired from that idea and built the perfect solution; an IR remote controlled light switch!? 1 The solution2 Key…