Interfacing externals

In this section you will find articles to understand how to drive external peripherals with STM32 development kit using ChibiOS.

All the articles of this section require a background knowledge about ChibiOS and STM32 provided in a series of articles provided in the section Getting Started.

A look to the Basic Knowledge section is also recommended.

Wide box Tiny box List
Ascent Descent

Detecting obstacles using an ultrasonic sensor HC-SR04

Detecting obstacles using an ultrasonic sensor HC-SR04

HC-SR04 is a commonly used ultrasonic sensor which is capable to detect obstacles in a range of 2-300cm. The sensor looks like a small PCB having two metal cylinders on the front-side and a small circuit on the back-side (see Fig.1).

In this article we will provide a simple demo to use HC-SR04. This requires a preliminary read of the sensor user manual: HC-SR04 User Manual

The sensor has 4 PIN:

VCC, which must be connected to 5V; Trig, which is an input PIN to trigger the measurement; Echo, which is an output PIN which sent out a square wave; GND, which must be continue reading...

How to drive a HD44780 with I2C backpack with a STM32

How to drive a HD44780 with I2C backpack with a STM32

The HD44780 is a de-facto standard controller for display. We have already use it providing a source code to use a 16×2 LCD with a STM32. In this article we will step over introducing an I2C backpack for that display. Of course we will explain how to edit old code in order to get it work with this new hardware configuration.

Even if it is still popular, this controller was made commercially available in the late eighties. At that time serial communications were not so widespread because their were costly and involved constraint about clock speed. Because of that, the continue reading...

Reading a Joystick on STM32 using ChibiOS

Reading a Joystick on STM32 using ChibiOS

The joystick proposed here is much known between makers. It provides two axis and a key button and every axis is actually a potentiometer: that means axis data is analogue and we need to use ADC to read its positioning.

Potentiometers are provided of springs so, without forcing, wipers are approximately positioned in the centre of the two resistive elements. As this device is very simple to use, it is not easy find a related datasheet. Indeed, for the most of the applications, it would be useless. Anyway, joystick used in this demo is a very cheap one marked as continue reading...

7-segment display and STM32 using ChibiOS

7-segment display and STM32 using ChibiOS

We have already introduced MAX7219 in STM32, ChibiOS and a 8×8 LED Matrix, so we are going to jump directly to code section. For convenience we just report link to documentation:

MAX7219 Datasheet

Note that even if pins are arranged in a different way, pin-out remains the same of the 8×8 LED matrix.

In this demo we are going to use Code-B decode to write with ease some number on our 8 digit 7-segment display.

In the demo shown in the video above we set up MAX7219 as normal operation mode, Code-B decode mode for each digit, scanning the whole display with the maximum continue reading...

IR Remote and STM32 using ChibiOS

IR Remote and STM32 using ChibiOS

Using Infra-Red for remote control is a technology born in the 70’s and after 40 years it is still used because the good ratio performances-costs and low power consumption. IR remote require a line of sight, because of that latest remote includes bluetooth technology.

Today it is possible to buy a small remote and receiving circuitry spending a few dollars. In Embedded system using IR could be a fast and cheap solution for remote control even if nowadays RF, Bluetooth and WiFi modules are very affordable.

Searching documentation for cheap devices is often not easy at continue reading...