Перейти к содержимому
Hub Nexus

Автора пока нетВзять себе

Версия 2Обновлено 3 мин чтения

Поддержка

A treasure chest at the end of an escape room opens only when players have solved every puzzle and collected a three-digit code from each. The project behind this page aims to bring problems from measurement and control technology to a broad audience by presenting them as game-like puzzles. The chest holds explanations of all the puzzles, and the idea is to draw a diverse group of people toward measurement and control technology, or engineering and science in general.

The frequency analysis puzzle

The group behind this page contributed one puzzle: a game-like frequency analysis in the audio range. Because the signals are audio, the case is styled like a synthesizer.

The puzzle's case, with LEDs, buttons, display and speaker visible

The case, showing the LEDs, buttons, display and speaker. Photo: Fiete on Appropedia, CC BY-SA 4.0.

LEDs in the case show how many tones are still to be detected, which have been detected and which tone is being processed. To reproduce the signals, the player can pick sine, square, triangle or sawtooth waves and set their frequencies with a shifter. The display shows a DFT (discrete Fourier transform) of the signal.

The authors do not expect anyone to rebuild the whole project, so the article describes the construction stages in more detail so they can be reused. The stage it covers is the display.

How the display works

The display is a 128x64 pixel LCD, a DEM128068B. It is made of two segments, A and B, each an independent 64x64 pixel display. It is programmed in blocks of 8 pixels vertically, which gives eight rows of sixty-four 8-pixel segments, and pixel by pixel horizontally, starting from pixel 0,0. The rows are traversed one after another, for both halves, or, to make a plain white or black image, both halves can be addressed at once.

A 128x64 pixel display with one pixel line enlarged

A 128x64 pixel display with one pixel line enlarged. Photo: Fiete on Appropedia, CC BY-SA 4.0.

How it is wired

The project uses an STM32-L476RG microprocessor and connects the display through its GPIO pins. Another microprocessor could be used, but the source code would then have to change. The display needs at least 13 GPIO pins, or 14 with an adjustable backlight.

Connection diagram between the display and the microcontroller

The connection diagram between the display and a microcontroller. The labels C14 to A4 stand for registers and GPIO pins on the microcontroller. Photo: Fiete on Appropedia, CC BY-SA 4.0.

The circuit's parts do these jobs:

PartFunction
R8Sets the display's contrast; the value depends on the display, so a 1M Ohm potentiometer can first be installed to find it
R7Series resistor for the backlight; if the backlight need not be adjustable, another resistor goes here
R1Series resistor for the transistor; removed if the transistor is left off
2N5551NPN transistor that controls the backlight by PWM; optional, since the display's LED- pin can instead go straight to GND

The display is robust, but it needs a very strong GND connection and data lines that are not too long and pass through as few vias as possible. The GPIO pins are configured as "Output Push Pull" with output level "Low" and maximum speed "Medium." Pins DB0-DB7 carry the display's 8 data bits, which is why 8 pixels are always written at once. CS1 and CS2 select the display side, and RST, DI and E start and end write cycles and distinguish a command from data.

The driver

The driver is written for the STM32CubeIDE. Once the GPIO pins are configured and the driver files (LCD128x64.c, LCD128x64.h and Font_Header.h) are added to the program, the main program tells the driver which pins to use through an initialization call and can then use its functions. The main ones clear or fill the whole display and place text centered, left or right aligned, up to one line long. The driver can also draw graphs and show pictures, and the font header maps letters to hex codes.

Sources

  • Appropedia contributors (the project group), Escape room, Appropedia, licensed under CC BY-SA 4.0. Changed here: rewritten in hubnx's own words and shortened; code listings and references left out. Photos are credited in their captions: Fiete on Appropedia (CC BY-SA 4.0).

Комментарии

Spinner Logo

Ещё на тему «Природа»

Автор: Hub Nexus Nomad
From the glowing waves of the ocean to fireflies lighting up the night sky, bioluminescence is one of nature’s most mesmerizing phenomena. This article dives into the science behind bioluminescence, its role in nature, and how this glowing phenomenon has inspired both innovation and awe in the human world.
CC0 1.0 (общественное достояние)
Flood streamflow is typically measured in person, infrequently and usually after the peak. TOADS, a USGS system on a vertical I-beam at the riverbank, profiles water velocity at five depths automatically.
CC0 1.0 (общественное достояние)
Smoke Across North America
CC0 1.0 (общественное достояние)
Volunteers plant native trees at Wuda Ogwa, site of the 1863 Bear River Massacre
CC BY 4.0
Adaptive Evolution
CC0 1.0 (общественное достояние)
FEQinput helps hydrologists read, search, edit and run input files for FEQ, the USGS model of unsteady flow in open channels, showing descriptions of input lines to help new users overcome a steep learning curve.