This is only a preview of the May 2026 issue of Silicon Chip. You can view 44 of the 112 pages in the full issue, including the advertisments. For full access, purchase the issue for $10.00 or subscribe for access to the latest issues. Items relevant to "Power Amp Clipping Indicator":
Items relevant to "Simple LC Meter":
Items relevant to "WiFi Alarm Monitor":
Articles in this series:
Items relevant to "μDCC Decoder":
Purchase a printed copy of this issue for $14.00. |
Review by Tim Blythman
BrisbaneSilicon
ELM11 Microcontroller Board
The inexpensive ELM11 development board from BrisbaneSilicon uses the Lua
programming and scripting language and is fairly inexpensive. It’s great to see this
type of thing being designed in Australia, so we were curious to try it out.
T
he folks from BrisbaneSilicon
(https://brisbanesilicon.com.au)
work in FPGA (field programmable
gate array) and embedded systems
engineering. They contacted us to see
if we were interested in trying out their
ELM11 microcontroller board.
ELM stands for Embedded Lua
Machine and, as you might expect, it
can be programmed using the Lua language. BrisbaneSilicon sent us a couple of ELM11 boards to experiment
with; here is what we found.
Lua
Lua is an interpreted scripting language that was originally developed
to streamline data entry at a Brazilian
petrochemical company.
It has developed into a simple yet
powerful language that is used in
many places where a scripting language is needed. That includes games
and embedded (microcontroller) environments.
Scripting languages are generally
easier to use and develop for, especially for particular applications, with
the trade-off being that they are usually slower and more memory intensive than compiled languages like C
or C++.
Lua is the Portuguese word for
moon; one of Lua’s predecessors was
named SOL, or sun. Lua’s interpreter
is written in the C programming language, so is easy to port to platforms
that have a C compiler. It is also
designed to easily interface with C
code, so it can be used to add scripting to projects written in C. You can
read more at https://lua.org/about.html
We’ve written a separate panel about
the Lua language for those who want
to know more. The ELM11 presents a
REPL interface, where REPL stands for
The ELM11 is a compact and tidy development board that provides an
embedded interpreter for the Lua programming language. There isn’t much on
the underside of the board apart from pin markings. All the components are on
the top of the board, including two tactile pushbuttons and numerous LEDs. The
ELM11 includes a Gowin GW1NR FPGA and a separate microcontroller that
provides a virtual USB-serial port and can also reprogram the FPGA chip.
90
Silicon Chip
Australia's electronics magazine
read, evaluate, print and loop. You can
also write and then run complete programs for more complex tasks.
In this regard, it is similar to devices
like the PicoMite running MMBasic.
MicroPython is similar; it can run on
many microcontroller boards, including the Raspberry Pi Pico. All these
devices and languages allow you to
enter simple commands or write and
run complex programs.
The ELM11
The ELM11 measures 60 × 26mm
and has two rows of 18 pins on a 0.1inch (2.54mm) pitch with 0.9 inches
(22.86mm) between the rows. This is
a fairly standard layout for modern
development boards, allowing them
to be easily used with breadboards or
prototyping PCBs. The pin headers are
provided loose and need to be soldered
to the module.
The ELM11 is shown in the photos.
It has a USB-C socket, which is good,
since they are much more robust than
the micro-B USB sockets that are sometimes seen on boards like this.
Interestingly, the large chip that
you might expect to be the microcontroller is in fact a Gowin Semiconductor GW1NR FPGA. An FPGA
is made of many logic elements that
can have the connections between
them rerouted after production. It can
be compared to how you might program a microcontroller to customise
its operation.
Microcontrollers are also made of
logic elements, so an FPGA can be
programmed to behave as a microcontroller, among many other things.
The GW1NR comes in a QFN-88
siliconchip.com.au
package (quad-flat no-leads with 88
pins) and incorporates 8640 LUTs
(lookup tables) with 8MiB (64Mib)
of RAM. It also has a smaller amount
of BRAM (block RAM) and includes
flash memory to store the configuration bit stream.
There is a separate Puya P25Q32SH
4MiB (32Mib) flash memory chip in a
SOIC-8 package, which is available as
non-volatile storage for the Lua interpreter. The smallest QFN chip is a
TMI7003 three-channel power management IC that incorporates a buck
regulator controller. It provides the
multiple supply rails needed by the
FPGA chip.
The remaining QFN chip is a BL702
RISC-V microcontroller that is used
to provide a USB interface to implement a virtual serial port interface for
communicating with the Lua interpreter. It also provides a JTAG programmer that can be used to reprogram the FPGA.
There are 36 pins available on
the two headers, four of which are
for power: 3.3V, 5V and two ground
pins. The remaining pins are numbered from one to 32. Sixteen (1-16)
of these pins are for general purpose
I/O, while the remainder are labelled
as an I/O bus. The I/O pins operate
at 3.3V levels.
Fig.1 shows the pin mapping of
the ELM11, including the peripherals that can be mapped to each pin.
The mapping is set by the FPGA configuration, and it appears that different ‘hardware overlays’ are possible.
This can change which peripherals
are available on which pins, amongst
other features.
There are also several LEDs on the
board with different functions. Three
are configured to reflect the status of
I/O pins 1, 2 and 3, making it straightforward to start blinking the LEDs with
Lua, without connecting any external
hardware. There are two small tactile
switches. One can be used to reset
the ELM11, while the other can be
detected on I/O pin 1.
This combination of a GW1NR
FPGA and a BL702 microcontroller
can also be found on the Tang Nano
9K development board. More information on the Nano 9K can be found
at siliconchip.au/link/ac9z
Using the ELM11
The ELM11 presents a virtual
serial port to communicate
with the Lua REPL
interface. It operates at 115,200 baud, 8
bits, no parity and one stop bit. Screen
1 shows the prompt after booting, plus
a few commands and their responses.
We used the Tera Term terminal program under Windows.
We found it easy to enter Lua statements at the terminal prompt; the
results are printed back to the terminal. The import statement is needed
to load the functions used to access
features like the GPIO pins. A simple
import(“all”) can be used to quickly
load all extra functions, although you
can also import individual functions
to reduce memory usage.
BrisbaneSilicon has provided some
simple code examples that can be
used in the REPL. They are set up to
be copied and pasted directly into a
terminal program and can be found at
https://brisbanesilicon.scrollhelp.site/
emblua/example-usage
We found that we had to set a 100ms
per line delay in TeraTerm to allow
the processor to complete the import
command for multi-line examples;
this appeared to be more than sufficient for other commands. This setting
can be found in TeraTerm’s menu
under Setup → Serial
port… → Transmit
SPI
UART
PWM
Function
Pin
Pin
Function
TX
TX
PWM
GPIO
1
19
I/O BUS
CS, CLK, TX
RX
PWM
GPIO
2
20
I/O BUS
CS, CLK, TX
TX
PWM
GPIO
3
21
I/O BUS
CS, CLK, TX
RX
PWM
GPIO
4
22
I/O BUS
CS, CLK
TX
PWM
GPIO
5
23
I/O BUS
CS, CLK
RX
PWM
GPIO
6
24
I/O BUS
CS, CLK, RX
TX
PWM
GPIO
7
25
I/O BUS
CS, CLK, RX
RX
PWM
GPIO
8
26
I/O BUS
CS, CLK, RX
TX
PWM
GPIO
9
27
I/O BUS
CS, CLK, RX
RX
PWM
GPIO
10
28
I/O BUS
CS, CLK
TX
PWM
GPIO
11
29
I/O BUS
CS, CLK
RX
PWM
GPIO
12
30
I/O BUS
TX
PWM
GPIO
13
31
I/O BUS
RX
PWM
GPIO
14
32
I/O BUS
TX
PWM
GPIO
15
33
I/O BUS
RX
PWM
GPIO
16
34
I/O BUS
GND
17
Fig.1: The data sheet includes this I/O pin
5V
18
map that also shows the layout of the main
features of the board. The button at upper left is RST and the other
one to its right is BTN1. Note that the pin numbering shown here is
different to that printed on the PCB silkscreen.
35
GND
36
3.3V
siliconchip.com.au
May 2026 91
Australia's electronics magazine
delay. The GPIO and PWM examples
are designed to use the onboard LEDs.
Even without having much knowledge of the Lua language, it was simple
to copy and paste example code from
the BrisbaneSilicon website and see
the results on the LEDs and console
immediately. The library functions
are detailed at https://brisbanesilicon.
scrollhelp.site/emblua/api
There is also a so-called Command
Mode, which is used to access system
and configuration settings. You can
also use it to do things like upload
programs.
A Python program is required on the
host computer to upload the program
over the serial port. Programs can also
be run from Command Mode.
We tested the program upload utility and found it worked well enough,
although it is necessary to disconnect
the terminal program to allow it to
access the serial port.
Complete programs can be found at:
https://brisbanesilicon.scrollhelp.site/
emblua/example-programs
The reset button can be easily used
to reset the processor to get back to a
known state. A running command or
program can be interrupted by pressing the ‘q’ key.
The ELM11 data sheet has more
detail on the interface; see https://
brisbanesilicon.com.au/docs/ELM11_
Datasheet.pdf
ESR Test Tweezers
Complete Kit
SC6952: $50
June 2024
siliconchip.au/Article/16289
This kit includes everything needed to build the ESR Test Tweezers. The three resistors and single
capacitor needed for calibration are also included. But this kit does not include the CR2032 (or
CR2025) coin cell or optional 5-pin header CON1.
The board we received is a beta
(pre-production) release of the ELM11,
and the data sheet notes that some
of the SPI and I2C functions are not
implemented yet. We were able to
bit-bang I2C data using GPIO pins to
(slowly) drive a small OLED module.
Other I/O features such as PWM
(pulse-width modulation) and UART
(asynchronous serial) worked as
expected. There is also a help statement that prints out a user guide on
the serial terminal.
The ELM11 platform
The ELM11’s architecture has been
optimised for working with Lua. BrisbaneSilicon refers to this as ‘hardware
acceleration’. The advantage of using
an FPGA is that the processor core can
be tweaked to improve performance
for the intended use; in this case, as a
Lua interpreter.
The ELM11 data sheet notes that
different so-called hardware overlays are available. These appear to
include options like different I/O features and processor characteristics.
It also appears that it may be possible to configure it with a multi-core
processor.
Using an FPGA also enables the
ability to add other so-called IP
cores. These are modular features
that can be added to the FPGA fabric and could include things like display and communication drivers or
other processors. Some examples are
listed at https://brisbanesilicon.com.
au/ipcores
With its similarity to the Tang Nano
9K, it may also be possible to use the
ELM11 as a general-purpose FPGA
development board, although we have
not investigated this in detail.
Conclusion
Screen 1: the interactive Lua prompt can be used to enter commands and see
responses. The last three commands are all that are needed to light one of the
LEDs on the board.
92
Silicon Chip
Australia's electronics magazine
The ELM11 combines several interesting features. Lua is simple yet
powerful, making the Embedded Lua
Machine easy to use and versatile. The
FPGA platform offers a lot of flexibility in that it can be configured with
different capabilities using hardware
overlays.
Even though we rarely use the Lua
language, we found the ELM11 easy
to use, with many examples that can
be run on just the bare board or with
some components on a breadboard.
It’s an inexpensive way to learn Lua
in general and to provide an embedded environment.
The ELM11 is available online from
BrisbaneSilicon for US$14.95 (about
AU$21) before shipping – see https://
SC
brisbanesilicon.com.au/elm11
siliconchip.com.au
The Lua Language
This is not the first time we have
encountered Lua; the Mini Wireless Webserver (using the OpenWRT firmware) in the November &
December 2012 issues (siliconchip.
au/Series/20) was configured and
programmed using Lua.
Its utility as a scripting language is well-established, and the
open-source OpenWRT router firmware uses Lua extensively. OpenWRT’s web configuration interface is called LuCI (Lua Control
Interface) and, as we saw from the
Mini Wireless Webserver, Lua can
even be used to generate custom
web pages.
Lua has been used for scripting and automation in computer
games since at least 1997, when
it was used by LucasArts in the
framework of their Grim Fandango
adventure game. It is estimated
that about half of all Lua users are
involved with game development.
The NodeMCU project for Espressif microcontrollers (such as the
ESP8266 and ESP32) allows boards
based on these chips to be programmed using the Lua language.
See https://github.com/nodemcu/
nodemcu-firmware
In these applications, Lua is used
similarly to the likes of Micromite
BASIC, PicoMite MMBasic or even
MicroPython. If you have seen
some Lua code, you might think
it doesn’t look very different from
these languages. It does have subtle differences, but it is fairly forgiving and easy to learn. Some background is provided at www.lua.org/
history.html
The designers have aimed for
simplicity of the language, so it
is not surprising that it looks like
other languages. The webpage
above indicates that the optional
use of semicolons (as statement
separators) in Lua came about to
appease users of both C and FORTRAN! A minimal Hello world program looks like this:
print(“Hello World”)
Lua implements well-understood
control structures like if/then/else/
end and while and for loops. The for
loop uses the keywords for, do and
end; each control structure has a
siliconchip.com.au
corresponding end statement, so the
scope is clear.
Interestingly, variables do not
have a type, but values do. The types
include number, string, function and
table. There is also a nil type, which is
understood to be the default value of
an uninitialised variable. Functions
can be defined and can return one or
more values; a function can even be
assigned to a variable. Lua supports
multiple variable assignments in the
same statement.
Tables are associative arrays; this
means that the index does not have
to be a number. Tables can be used
to implement ordinary arrays, sets,
lists, dictionaries, trees and queues.
There is a variant of the for loop that
can be used to iterate over the items
in a table. One thing to watch is that
numeric array indexes are 1-based,
unlike many other languages (eg C/
C++ are 0-based).
So-called meta-tables can be
used to override the behaviour of
mathematical operators when non-
numeric arguments are provided.
Thus, they can be used to emulate
object-oriented methods. The developers of Lua call these features meta-
mechanisms. The intent is to keep the
underlying language quite simple, but
provide a means for a programmer
to create complex behaviours when
required.
These advanced language features
might sound intimidating, but if you
are looking to use Lua for straightforward scripting, you don’t need
to use them. If you are comfortable
with the likes of MMBasic, you’ll
probably need to do little more than
learn a few different keywords and
some minor syntax differences.
If you have worked with BASIC,
C or Python, aspects of Lua like
expressions and mathematical
operators will appear familiar.
Numerical values are typically
stored as floating point, but some
implementations (including the
ELM11) use 32-bit signed integers.
It’s worth remembering that Lua
code is case-sensitive.
Like Python, the language can
be extended with the import keyword. For example, the interface
for the I/O features of the ELM11 is
simply a set of functions that can
be imported to make them available
to the interpreter. Lua’s simplicity
also means that is also renowned
amongst interpreted languages for
its speed.
Summary
Lua is an interesting language,
and we found it easy to learn
the basics. Despite this, it can be
extended in multiple ways to provide advanced programming features. Here is a relatively simple
sample program:
#!/usr/bin/lua
print(“Content-type: text/html\n”)
print(“<HTML><HEAD><TITLE>Relay control</TITLE>“)
print(“</HEAD><BODY>“)
local f = io.open(“/dev/ttyACM0”, “r+”)
f:write(“quiet\n”)
if os.getenv(“QUERY_STRING”):upper() == “ON” then
f:write(“D0=1\n”)
print(“Relay is now on.”)
elseif os.getenv(“QUERY_STRING”):upper() == “OFF” then
f:write(“D0=0\n”)
print(“Relay is now off.”)
else
print(“Error.”)
end
f:close()
print(“</BODY></HTML>\n”)
This snippet of Lua code was presented in the series on a Mini Wireless
Webserver to generate a web page and send data over a serial port to
control a relay. Even if you haven’t used Lua before, it’s fairly clear how
the program works.
Australia's electronics magazine
May 2026 93
|