Wide box Tiny box List
Ascent Descent

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...

Reading a Slider

Reading a Slider

Widely used in sound mixers, the slider can be used as input for many applications. There isn’t so much to say as this device is made by two potentiometers working together. Indeed, when the cursor slides, it changes the position of two side potentiometers.

The slider shown in Fig.1 has six pins:

VCC, (are two connected together) connected to power supply 3.0V DC; GND, (are two connected together) connection to ground; OTA, middle pin of potentiometer #1; OTB, middle pin of potentiometer #2.

We can sample both OTA and OTB making mean to better evaluate slider continue reading...

Sampling and dimming (ADC and PWM)

Sampling and Dimming

An Analog to digital converter is a device that converts a continuous physical quantity (usually voltage) to a digital number that represents the quantity’s amplitude.

In this demo, we are sampling voltage across a potentiometer to establish its position. A potentiometer is a three-pin knob that provides a variable resistance between W-A and W-B pins (Fig.1). Amount of resistance between A and B is constant, but by turning the shaft of the potentiometer, we change the amount of resistance on either side of W.

Connecting A to 3 V, B to GND (or vice versa) and sampling continue reading...