Homebrew, open source, repurposed, hacked, software defined, open hardware

Saturday 3 April 2021

Modifiying T3 and T4 component testers for STEM and coding use in schools

The open design component tester originally by Markus Frejek and subsequently developed further by Karl-Heinz Kübbeler is available from many sellers as a "T3" or "T4" component tester, complete with laser cut acrylic case, for as little as $11AUD delivered.

These testers lend themselves to repurposing for any project that needs an Atmega328, 64x126 pixel screen with backlight, and simple I/O requirements.

The open source project for the component tester design is hosted at mikrocontroller.net and as new designs are released by vendors, new code versions have been produced that will run on new variations of the hardware.

The testers, as shipped from vendors, tend to look quite similar, and do not necessarily indicate what firmware revision they require, nor do they provide a schematic showing the pinouts, in particular, to the SPI LCD.

The first step when repurposing is to create easy access to the ICSP port. A 10mm hole drilled 38mm down and 22mm in from the side, over the ICSP port, is ideal for use with a pogo pin fixture.

The next step is make or obtain a pogo pin fixture

The GND terminal of the ICSP port is identifiable on account of it thermals, and continuity to the negative lead of the 9V battery. Here is the pinout for the currently shipping (at the time of writing) LCR-T4 v2:


Although one can disassemble the device to figure out the pinout to the display, it is easier to backup the firmware with a programmer such as a USB-ASP, and then try the various versions of the Atmega328 firmware and eeprom binaries available from the Mikrocontroller-net github repo in turn, seeing which version works.

Scripts to simplify the backing up of the original firmware are available on github. Once backed up, you have the option of writing it back to the tester at a later point in time to restore its original functionality.

Once you figure out which firmware works on your board, you will know which board revision you have, and you can then inspect the Makefile for that version to see what the pinouts are compared to other versions.

If you load Mikrocontroller-net firmware and only see a screen filled with a black rectangle, you have probably failed to install the matching eeprom code that goes with the particular firmware hex file.  

At the time of writing, currently shipping models appear to be T4-v2. These differ to the T3 with respect to the SPI pinout to the ST7565 LCD
 

               T4v2 vs T3

reset    PD0  vs PD4

SCL     PD2  vs PD2

RS/SW    PD1  vs PD3

SI/SDA    PD3  vs PD1

CE        PD5  vs PD5

and these differences have to be reflected in the ST7565 driver code, namely, stlcd.h, for the T4 v2 component tester to work.

Back in 2017, Robson Couto got Rex-Runner working on the T3 model being shipped at the time with some C code and modifications to Adafuit's ST7565 LCD library, and put his code on github.

Thanks to Robson Couto's efforts on the T3, Adafruit's LCD library, and Mikrocontroller-net's Makefiles for the various component tester designs in the the wild, I have been able to port the T3 Rex-Runner C code to the T4v2.

The code has undergone extensive refactoring, and additional code has been written to allow easy creation of custom sprites and viewing of sprites as ASCII once exported as a C header file from the GIMP.

The purpose of the exercise has been to create a cost effective and appealing platform for the delivery of coding and STEM content in the school environment.

 

 

This project is in its early stages, and the project aims to provide a platform allowing students to not only create custom sprites, but to also hold and take home embedded hardware that can be programmed to do their bidding. More adventurous students can modify the code further.

As a demonstration, the dinosaur can be replaced with a dog sprite:


This project is being undertaken with the Lobethal Lutheran School in Lobethal, South Australia, as part of their STEM (Science, Technology, Engineering, Mathematics) promotion efforts and the code is being hosted on the Lobethal Lutheran School github repository.

Design files for the pogo-pin fixture are also available on github, The pogo pin programming fixture was designed in pcb-rnd and uses custom padstacks for ease of soldering that assume pogo pins with nominally 1.3mm shafts are being used.

Wednesday 31 March 2021

How to play the Snake game on your PCB layout in pcb-rnd with a user script

This is a screen capture of a user script in pcb-rnd being used to play the classic game "snake" on the top copper layer of a compact step attenuator PCB layout...


 
The video of the snake game script demonstrates how a script written by the user can 
  • draw on the printed circuit board in real-time
  • receive keyboard commands
  • create menus, and
  • run a simple simulation
 
It implements the classic snake game, played on the currently selected layer group on the currently loaded board.
 
If the snake collides with itself or any copper feature, the game ends.
 
At the end of the video the snake is made to deliberately perform a 180 degree turn, which causes the snake to collide with its own body and end the game.

The video is a screen capture, and may have the odd broken frame, but in practice, the script ran smoothly, without artifacts on the screen and felt like a fully immersive, first person real-time snake experience!

To run this, you'll need
 
  • pcb-rnd 2.3.2 (or latest HEAD version of trunk from svn), and
  • game_snake from http://edakrill.repo.hu found at http://repo.hu/cgi-bin/edakrill.cgi?cmd=show&krill=igor2/script/pcb-rnd/game_snake.krill
 
Note: when loading as a live script, the 'persistent' checkbox must be activated. 

Disclaimer: the script is a demonstration of what is possible with user scripting -  it doesn't pretend to implement things that are useful in production but shows how the various scripting features of pcb-rnd can be used.