Just the Amiga Ball bouncing on a humble Uno with a 320x240 Touch LCD shield. Optionally also with a choice of windows showing the time.
YouTube demo
Some time in August my feed included a story about the Amiga's 40th anniversary, it included the famous bouncing ball demo. It seemed like an interesting thing to try recreating on an Arduino and LCD. This is the sort of thing I've done a few times: ElitePetite, LittleZone, Rasteroids etc.
This was all about fast rendering, so it's close to the metal. I access the LCD directly via registers, so the code is specific to the Uno and the type(s) of LCD I have access to. Jaycar has sold at least three XC4630 variations, it should work with any of them by setting the appropriate #define. The code determines the pixels to send to the screen, on-the-fly. There is no buffering, even the clipping is on-the-fly.
Extensive use is made of PROGMEM lookups. The ball is a a pair of PROGMEM data structures, created as a header file by a Python script in the resources subdir (ball_encode.py). This run-length-encodes an image made by another script (ball_render.py). The image script makes a .PNG of the faceted ball, with 8x as many faces on a layer, facets are given one of N colours, Rendering the ball is a matter of scanning rows in the data, accumulating runs of a physical colour (red or white) from runs of logical colours, then sending to the LCD. Only the background pixels exposed by the ball's movement are redrawn. The background grid is also encoded as PROGMEM data, created by grid_encode.py. This provides faster repainting. The intent to send a block of colour to the LCD from the ball, or the background rendering logic, passes through additional logic which clips it with respect to the clock window, if present.
As a raison d’etre for having the thing as a desk accessory, it can optionally show the time. I’ve added 3 "windows":
- An "analog" clock, based on the Amiga one, but small.
- A "digital" clock, not sure this existed but it is conveniently small.
- A "workbench" clock. This shows the time digitally on the workbench title bar.
All three can be moved around the screen by touching and dragging their title bars. The workbench clock has limited movement, two heights locked at the bottom of the display. Touching within the "body" of a clock will hide it (as will touching the "background" button on the title bar). Watch the ball! When hidden, touching anywhere on the screen will show the clock again.
Touching at the top-left corner will bring up a menu. The menu lets you
- switch between clocks (or no clock)
- hide/show the current clock
- set/clear daylight saving
- re-seed the randomness
- set the time
- reset the display
- view an abbreviated help
Most of this is N/A if there is no RTC present (see CFG_HAVE_RTC).
The hardware is simple: a Uno with an LCD shield, the slightly complicated part is the RTC which is squeezed between the two using the ICSP pins.
I made a simple laser-cut "monitor" facade which clamps over the LCD & Uno. The Python code for this and other resources are in the resources folder.
YouTube video with "monitor" facade
Mark
November 2025