HackerBox 0094: Port Authority

by HackerBoxes in Circuits > Arduino

2475 Views, 7 Favorites, 0 Comments

HackerBox 0094: Port Authority

HB0094 Whole Box.png

Welcome to HackerBox 0094. Explore the VGA32 Single Board Computer. Configure the Arduino IDE for programming the VGA32. Interface video displays, keyboards, and mice to create retro computing emulation platforms and various graphic user interfaces. Experiment with the FabGL ESP32 Arduino Graphics Library. Interface the MAX3232 RS232-to-TTL serial module to implement a VT100 compatible ANSI display terminal. Output video to a modern television or computer monitor from the VGA32 using a VGA-to-HDMI video conversion kit. Sample positioning input from an analog joystick module. Explore OpenGL - the cross-platform API for rendering 2D and 3D vector graphics.

HackerBox is the original monthly subscription box for electronics, computer technology, and hacker culture. Each HackerBox is a discovery box, which means all members await and enjoy a new surprise each month. Tech, toys, knowledge, and fun. It's like having a hacker convention, your birthday, and the first day of school - every month - right in your mailbox.

There is a wealth of information for current and prospective members in the HackerBoxes FAQ. Almost all of the non-technical support emails that we receive are already answered there, so we'd really appreciate it if you can take a few minutes to read the FAQ.

Supplies

This Instructable contains information for getting started with HackerBox 0094. The full box contents are listed on the product page for HackerBox 0094 where the box is also available for purchase while supplies last. If you would like to automatically receive a HackerBox like this right in your mailbox each month, you can subscribe at HackerBoxes.com and join the party. Subscribers save at least $15 every month and get each new HackerBox shipped immediately off of the production line.

A soldering iron, solder, and basic assembly tools are generally needed to work on the monthly HackerBox. A computer for running software tools is also required. Have a look at the HackerBox Workshops for tools and supplies along with a wide array of introductory activities and experiments.

The most import thing you will need is a sense of adventure, hacker spirit, patience, and curiosity. Building and experimenting with electronics, while very rewarding, can be tricky, challenging, and even frustrating at times. The goal is progress, not perfection. When you persist and enjoy the adventure, a great deal of satisfaction can be derived from this hobby. Take each step slowly, mind the details, and don't be afraid to ask for help.

WEAR SAFETY GLASSES WHEN SOLDERING, WHEN TRIMMING WIRE LEADS, OR WHEN CUTTING, DRILLING, ETC.

VGA32 Single Board Computer

TTGO VGA.png

The VGA32 Single Board Computer features the T-Micro32 SiP (System-in-Package). The T-Micro32 SiP is the castellated device with a large metal shield showing a TTGO logo. The T-Micro32 SiP integrates an ESP32 Dual Core Processor, 520KB of RAM, 4MB of Flash, Wi-Fi, Bluetooth, a chip antenna, and a u.FL (IPEX) RF connector.

The VGA32 Single Board Computer features three additional chips:

  • CP2104 (USB To TTL)
  • 8MB (64Mb) PSRAM
  • NS4150 (3W Class-D Audio Amplifier)

The VGA32 Single Board Computer features several additional ports and interfaces:

  • MicroUSB for Power and Programming
  • VGA Video Output
  • PS/2 Keyboard Input
  • PS/2 Mouse Input
  • MicroSD (TF Card) Slot
  • 3.5mm Audio Output Jack
  • I/O Header (2x4 pin)
  • Two Buttons: Reset and GPI036

HELLO WORLD

When the VGA32 Single Board Computer is first power on using the MicroUSB port, the blue LED will illuminate.

The VGA32 comes with the Audio example sketch preloaded. As shown in this video, the Audio sketch will run when the module is first powered on. To explore the Audio sketch, hook up a VGA display (or an HDMI display using the converter discussed in the next step) and a mouse.

The Audio demo is a multichannel audio generator, so it will also help to connect speakers, headphones, or use the HDMI audio link. The GUI allows us to enable/disable each channel, set its volume, and then select its "type" from the list of different wave forms, a rhythm loop, Mario Brothers soundtrack, and a synthesized voice output.

VGA-to-HDMI Video Conversion

VGA to HDMI.png

VGA/Audio to HDMI Conversion: The VGA-to-HDMI video conversion kit included in this HackerBox allows the VGA32 single board computer to feed most modern televisions and computer monitors which commonly have HDMI signal inputs. The conversion device features the Macro Silicon MS9288A chip.

The MS9288A is configured by an internal microcontroller core and embedded ROM code. The MS9288A comprises three 10-bit audio-to-digital converters - one each for red, green, and blue. There is also a stereo audio encoder.  The digital outputs from these converters/encoders are combined to feed an HDMI transmitter block. Accordingly, the input video and audio signals, in their entirety, are encoded onto the output HDMI signal.

Other video conversion solutions found in previous HackerBoxes include:

HDMI to Audio/Video Conversion: an HDMI2AV conversion box was featured in HackerBox 0092. As presented in the associated box guide, the HDMI2AV conversion box features the Macro Silicon MS1836S chip.

Audio/Video to HDMI Conversion: an AV2HDMI conversion box was featured in HackerBox 0075. As presented in the associated box guide, the AV2HDMI conversion box features the Macro Silicon MS1858E chip.

Audio/Video to PC (via USB): a USB Audio/Video Capture device was featured in HackerBox 0061. As presented in the associated box guide, the USB A/V Capture device features the Macro Silicon MS2106 chip.

These various video conversion solutions are useful tools for any hardware hacker, hobbyist, or retro enthusiast to keep on hand.

USB-to-PS/2 Adapter

Keyboard Adapter.png

Possibly the world's most misunderstood port adapter for two reasons...

The adapter is a simple passive solution.

There is no active conversion going on here. The adapter simply connects the two different plugs together using four wires. The actual intelligence to "speak" PS/2 must be baked into the mouse or keyboard being used. Such a mouse or keyboard is sometimes called a "combination device" and the packaging or specification usually specifies that it is a USB device that is also PS/2 compatible. If you happen to have a USB device that is not also PS/2 signaling compatible, then this type of adapter is not supposed to work.

The adapters for keyboards and mice are interchangeable.

They may be different colors (usually green and purple) but the four wire connections inside the two different colored adapters are usually the same. In either case however, the USB keyboard or mouse must still internally also support PS/2 signaling for this type of passive adapter to work at all.

So how does the PS/2 interface work?

Enjoy this video from Ben Eater.

FabGL Graphics Library

FabGL Space Invaders.png

If you do not already have the Arduino IDE set up and ESP32 support configured, now is the time.

The Random Nerd Tutorial covers the necessary steps, but stop at the heading Testing the Installation and instead continue here...

We'll be using the FabGL Graphics Library for ESP32 by Fabrizio Di Vittorio.

Install the library through the Arduino IDE, by navigating to Tools > Manage Libraries

From there, search for and install FabGL.

In the IDE, select Tools > Board > esp32 > ESP32 Dev Module

Navigate to File > Examples > FabGL > VGA to see a list of interesting projects to play around with.

SpaceInvaders is a nice one to try first. It's a real classic. Audio is the project that came preinstalled on the hardware should you ever wish to revert. Vic20 is quite a flashback, as is PCEmulator. Bon appetit!

RS-232 Serial Terminal

RS232 Terminal.png

The VGA32 can be connected to a MAX3232 RS232-to-TTL module to implement an ANSI-VT100 compatible display terminal. The AnsiTerminal project from the FabGL examples implements the most common ANSI, VT52, VT100, VT200, VT300, VT420 and VT500 escape codes.

The VT100 (wikipedia) was a video terminal, introduced in 1978 by Digital Equipment Corporation (DEC). It was one of the first terminals to support ANSI escape codes for cursor control and other tasks, and added a number of extended codes for special features like controlling the status lights on the keyboard. This led to rapid uptake of the ANSI standard, which became the de facto standard for hardware video terminals and later terminal emulators. Over six million terminals in the VT series were sold, based largely on the success of the VT100.

ASSEMBLY

  • Cut a 2x4 section of pins from the dual header
  • Insert the 2x4 Header onto the VGA32 with the pins extending on the same side as the PS/2 connectors
  • Solder the 2x4 Header into place from the opposite side (with the TTGO module and MicroUSB port)
  • Connect four FEMALE-FEMALE jumpers to the MAX3232 module as shown above
  • Run the AnsiTerminal sketch
  • Hit F12 (is necessary) to adjust the settings
  • If you don't have a serial device to test your new terminal against, you can perform a loopback test by shorting the TX and RX pins of the RS-232 port together. Any transmitted key (from your PS/2 keyboard) will loopback and display on the terminal as through it came over the RS-232 port.

This video demonstrates a setup using this project and shows how to operate the terminal with an IMSAI 8080 microcomputer.

Analog Joystick

Joystick.png

An analog joystick is simply two potentiometers mounted perpendicularly in order to track the X and Y motion of the central stick. This one also has a switch button (denoted SW) that is grounded when the central stick is depressed into the module with a satisfying click.

Wire up the joystick module to the VGA32 module as shown and test out the FabGL_Jostick sketch attached here.

Consider this series of challenges in order of increasing levels of difficulty:

  1. Detect the switch button closure and change the display color in response.
  2. Translate the X and Y values into the position of a dot on the screen.
  3. Mark the track of the dot as it moves in tribute to the Etch A Sketch.
  4. Use the drawing entered by the Etch A Sketch to seed Conway's Game of Life.
  5. Spawn Gliders, or other ships/oscillators, into the Game of Life. The glider is an emblem often used to represent the hacker subculture. The concept of the glider was born at almost the same time as the Internet and Unix.

Downloads

Exploring OpenGL

Welcome to OpenGL

Open Graphics Library (OpenGL) is a cross-language, cross-platform application programming interface (API) for rendering 2D and 3D vector graphics. The API is typically used to interact with a graphics processing unit (GPU), to achieve hardware-accelerated rendering. Silicon Graphics, Inc. (SGI) began developing OpenGL in 1991. Applications use it extensively in the fields of computer-aided design (CAD), virtual reality, scientific visualization, information visualization, flight simulation, and video games. Since 2006, OpenGL has been managed by the non-profit technology consortium Khronos Group. (wikipedia)

LearnOpenGL is an online book for learning OpenGL. Whether you are trying to learn OpenGL for academic purposes, to pursue a career or simply looking for a hobby, this book will teach you the basics, the intermediate, and all the advanced knowledge using modern (core-profile) OpenGL. The aim of LearnOpenGL is to show you all there is to modern OpenGL in an easy-to-understand fashion with clear examples, while also providing a useful reference for later studies.

GLFW is an Open Source, multi-platform library for OpenGL

Download GLFW source code or binaries for Windows, macOS, or Linux

Setting up OpenGL and Creating a Window in C++ (video)

An introduction to Shader Art Coding (video) leverages OpenGL Shading Language

Hack the Planet

DEF CON 31 - Top Tips for new DEF CON Attendees - video team

We hope you are enjoying this month's HackerBox adventure into electronics, computer technology, and hacker culture. Reach out and share your success in the comments below or on other social media. Email support@hackerboxes.com anytime with questions or whenever you need some help.

Want more? Surf over to HackerBoxes.com and join us as a monthly HackerBox subscription member. You'll get a cool box of hackable gear delivered right to your mailbox every month and you'll enjoy a generous member discount.

Please consider sharing this free Instructable with others who may be interested in learning about these subjects. We really appreciate your support and "word of mouth advertising" is the greatest compliment that we can receive.