Автора пока нетВзять себе
- Лицензия
- CC BY-SA 4.0По материалам www.appropedia.org
- Языки
- English
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 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. 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.

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:
| Part | Function |
|---|---|
| R8 | Sets the display's contrast; the value depends on the display, so a 1M Ohm potentiometer can first be installed to find it |
| R7 | Series resistor for the backlight; if the backlight need not be adjustable, another resistor goes here |
| R1 | Series resistor for the transistor; removed if the transistor is left off |
| 2N5551 | NPN 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).
Комментарии

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


