Sunday 29 September 2024

Dual Colour LED Matrix Shield (Educational)

Introduction 
This blog shows the hardware used for an Arduino-compatible shield featuring a dual-colour matrix LED.

LED Matrix Shield Mounted on Arduino Uno
LED Matrix Shield Mounted on Arduino Uno

Purpose of the LED Matrix
The design was created for educational purposes and to train school-aged programmers. For hobbyists looking for an off-the-shelf solution using LEDs, some related products featuring RGB LEDs are the NeoPixel or for an LED matrix, the D1 Mini from Wemos.

Technology Used
Three shift registers, part 74HC595, were used to drive the 8 rows and 10 columns (matrix 5 red and 5 green LEDs) of the LED matrix from the Arduino Uno. To maintain the design simplicity, no LED buffers were included which would increase the drive current. The 74HC595 from Nexperia fitted to the prototype could provide 25 mA per pin although the maximum current of the shift register is limited to approximately 70 mA.

A buck converter, TI part LMR51606YDBVR was chosen to provide 5V power to the shift register and LED matrix. A higher current DC-DC converter and LED drivers could be utilised for a brighter LED matrix.

Kingbright Dual Colour LED Matrix
Kingbright Dual Colour LED Matrix

For the LED matrix, Kingbright part TBC24-11EGWA was used. At the time of writing the LED Matrix from Kingbright part had become End of Life.

Connections to Arduino
Details are provided on the Arduino website for connecting shift registers such as the 74HC595 to the Uno board. One such example with connections and code is shown in the tutorials.

The shift register connections to the Arduino are the same as the tutorial with the addition of the output enable signal.

To adjust the LED matrix intensity and depending on the characteristics of LEDs, the value of the resistor packs could be changed. During testing the values 68 R and 56 R for red and green LEDs respectively achieved a good balance between current consumption and light output.

LED Matrix Shift Register Connections
LED Matrix Shift Register Connections

Shown in the image below are the pins used on the Arduino Uno for the shift registers and power.

LED Matrix Shift Register to Arduino Connections
LED Matrix Shift Register to Arduino Connections 

Lastly, a DC-DC converter was used instead of the linear regulator on the Arduino Uno. This meant less heat dissipation on the Uno board.

LED Matrix Power Supply
LED Matrix Power Supply

Printed Circuit Board (PCB)
The PCB for the LED matrix shield was designed with four layers however the board layer count could be reduced. Shown below are the external power and internal signal layers. The top layer was a solid copper pour for the 0 V layer and therefore not shown.

LED Matrix Bottom Layer PCB
LED Matrix Bottom Layer PCB

LED Matrix Mid Layer PCB
LED Matrix Mid Layer PCB

LED Matrix Mid Layer PCB
LED Matrix Mid Layer PCB

Populated LED Matrix
The completed prototype board used pin headers for the LED matrix although the PCB was designed to allow flush mounting of the LED matrix.

Populated LED Matrix Shift Register Side
Populated LED Matrix Shift Register Side

Populated LED Matrix (Display) Side
Populated LED Matrix (Display) Side

When connecting the LED matrix shield to an Uno or similar board, a space between the two boards of at least 13 mm was required. This spacing ensured the LED matrix pins did not cause a short against the USB B connector housing.

Arduino Uno and LED Matrix Fitted Together
Arduino Uno and LED Matrix Fitted Together

LED Matrix Operation & Code
For the example below the Arduino pin mapping shown below was used.

void setup() 
{
  pinMode(latchPin, OUTPUT);
  pinMode(clockPin, OUTPUT);
  pinMode(dataPin, OUTPUT);
  pinMode(oePin, OUTPUT);
  digitalWrite(oePin, LOW);
}

Some videos of the operation with example code are shown below.

Counting with Rows

  for (int numberToRows = 0; numberToRows < 255; numberToRows++) 
  {
    digitalWrite(latchPin, LOW);
    shiftOut(dataPin, clockPin, MSBFIRST, 0);           // red = 0, all off 31 show green
    shiftOut(dataPin, clockPin, MSBFIRST, 0);           // green = 0, all off 31 show red
    shiftOut(dataPin, clockPin, MSBFIRST, numberToRows);   // turn on all columns
    digitalWrite(latchPin, HIGH);
    delay(100);
  }

Counting with Columns


for (int numberToColumns = 0; numberToColumns < 32; numberToColumns++) 
  {
    digitalWrite(latchPin, LOW);                                
    shiftOut(dataPin, clockPin, MSBFIRST, numberToColumns);   // red = 0, all off 31 show green
    shiftOut(dataPin, clockPin, MSBFIRST, numberToColumns);   // green = 0, all off 31 show red
    shiftOut(dataPin, clockPin, MSBFIRST, 255);        
                // turn on all rows               
    digitalWrite(latchPin, HIGH);   
    delay(100);
  }

Dual Colour Change

 
  digitalWrite(latchPin, LOW);
  shiftOut(dataPin, clockPin, MSBFIRST, 0);   // red = 0, all off 31 show green
  shiftOut(dataPin, clockPin, MSBFIRST, 31); // green = 0, all off 31 show red
  shiftOut(dataPin, clockPin, MSBFIRST, 255); // turn on all rows
  digitalWrite(latchPin, HIGH);
  delay(200);
  digitalWrite(latchPin, LOW);
  shiftOut(dataPin, clockPin, MSBFIRST, 31);    // red = 0, all off 31 show green
 
shiftOut(dataPin, clockPin, MSBFIRST, 0);     // green = 0, all off 31 show red
  shiftOut(dataPin, clockPin, MSBFIRST, 255); // turn on all rows
  digitalWrite(latchPin, HIGH);
  delay(200);
 


Downloads

LED Matrix Gerber 

LED Matrix Schematic

LED Matrix Top Overlay

LED Matrix Bottom Overlay

Saturday 31 August 2024

Making Amazon 9.8" Pottery Wheel Foot Switch Detachable

Introduction 
In this blog, a modification was made to the generic 9.8” pottery wheel supplied by Amazon. A connector was fitted to allow the foot pedal to be removed.

Amazon Pottery Wheel (Courtesy Amazon)
Amazon Pottery Wheel (Courtesy Amazon)

Pottery Wheel Foot Switch Cable Location
Protruding from the underside of the pottery wheel is a white cable that connects the foot pedal to the pottery wheel’s electronic controls. The connection of the white cable was altered to fit a connector allowing disconnection for movement or storage of the pottery wheel.

Underside View of 9.8" Pottery Wheel
Underside View of 9.8" Pottery Wheel

The white cable passes through a hole in the pottery wheel's metal chassis. The hole's internal diameter is approximately 14.8 mm. Depending on the type of chassis mount connector selected, the hole may already be suitable for that connector. Alternatively, an inline pluggable connector could be fitted instead of the chassis mount connector.

An M12 chassis mount and an inline connector set from TE Connectivity was chosen for this project.

Pluggable Connectors
Fitting the M12 chassis mount socket connector started with cutting the white cable. Sufficient cable length was left protruding through the hole to allow for connecting to the chassis mount connector. The cable was moved to the side temporarily while the hole was made larger with a stepped drill bit.

The three wires in the foot pedal cable, red, yellow and green were stripped and tinned. A small length of heatshrink was fitted on each wire. The cable was passed through the retaining nut and then the hole in the chassis. The wires protruding through the hole were soldered to the M12 socket.

Pottery Wheel Side - M12 Chassis Mount Socket
Pottery Wheel Side - M12 Chassis Mount Socket

For the mating side of the connector, an M12 plug was fitted to the cable attached to the foot pedal.

Foot Switch Side - M12 Inline Plug
Foot Switch Side - M12 Inline Plug

The M12 TE Plug used screw terminals instead of solderable pins. The stripped wires were connected in the same order as the socket.

An operational test was performed before finalising the heatshrink and tightening the M12 nut.

Pottery Wheel M12 Connector Test Fit
Pottery Wheel M12 Connector Test Fit

The assembled foot switch is pictured below.

Updated Foot Switch Assembly
Updated Foot Switch Assembly

The connected assembly of M12 connectors is shown below.

Completed M12 Connector Assembly
Completed M12 Connector Assembly

 

Sunday 21 July 2024

MAX22191 with Periodic Signals

Introduction 
This blog provides measurement information on the maximum input frequency of the Analog Devices digital input device MAX22191. Measurements were taken for the periodic signal types square, sine and sawtooth.

Functional Block Diagram of MAX22191 (Courtesy Analog Devices)
Functional Block Diagram of MAX22191 (Courtesy Analog Devices)

Device Behaviour with Steady State Signals

A small test board was designed for testing the MAX22191.

Circuit for MAX22191 Test Board
Circuit for MAX22191 Test Board

The circuit for the MAX22191 followed the datasheet example, consisting of a protection diode (TVS) on the input and an LED on the output. The test board was configured so that the MAX22191 was powered from an external supply.

MAX22191 Development Board
MAX22191 Development Board

With the MAX22191 powered, the input voltage to the MAX22191 was adjusted to verify the board functionality. The supply (DC 5 V) and input voltages for MAX22191 were controlled using two supplies on a Rigol DP832 power supply.

MAX22191 Setup for Input Voltage Level Tests
MAX22191 Setup for Input Voltage Level Tests

Measurements with the test board showed that the upper input threshold voltage (ON) was approximately DC 9.5 V and the lower threshold voltage (OFF) was DC 7.9 V, giving a hysteresis of DC 1.6 V. These values are similar to the device datasheet values for the maximum input upper threshold voltage (ON) of DC 10 V and the lower threshold voltage (OFF) of DC 7 V.


Device Behaviour with Periodic Signals

The output of a function generator Rigol DG1022 was connected to the input of the MAX22191 to test the maximum operating frequency. For the periodic signals, the duty cycle was set and then the frequency of the function generator varied. This process was repeated for three duty cycles. The test board was powered with DC 5 V.

MAX22191 Setup for Periodic Signal Tests
MAX22191 Setup for Periodic Signal Tests

The function generator output was set to High Impedance (High Z). An oscilloscope was connected to the input and output of the test board to capture the waveforms. The images in this section show the input waveform as the yellow trace and the output waveform as the blue trace.


Tests - Square
A square wave with a 10 V amplitude (loaded) was driven into the device.

MAX22191 Output Capture for Square Wave Input Signal
MAX22191 Output Capture for Square Input Signal

For the three duty cycle settings the frequency of the function generator was increased until the output LED controlled by the MAX22191 switched OFF. The maximum frequency was measured when the output voltage from the MAX22191 dropped below 2.0 V. This was an arbitrary TTL limit for comparative purposes only.

For a 20 % duty, the LED switched OFF at 34 kHz however the output signal fell below the threshold at approximately 30 kHz.

MAX22191 Output Capture for Square Wave Input Signal 20 % Duty
MAX22191 Output Capture for Square Input Signal 20 % Duty

For a 50 % duty, the LED switched OFF at 180 kHz and the output signal fell below the threshold at the same frequency.

For an 80 % duty, the LED switched OFF at 260 kHz and output signals fell below the threshold at approximately 230 kHz. Some unexpected waveform behaviour was seen. This did not occur at lower frequencies such as 150 kHz. This could be an artefact of the test setup.

MAX22191 Output Capture for Square Wave Input Signal 80 % Duty
MAX22191 Output Capture for Square Input Signal 80 % Duty
 

Test - Sine
The LED switched OFF at 123 kHz and the output signal fell below the threshold at approximately 125 kHz.

MAX22191 Output Capture for Sine Wave Input Signal 50 % Duty
MAX22191 Output Capture for Sine Input Signal 50 % Duty
 

Tests – Sawtooth
For a 20 % symmetry setting, the LED switched OFF at 34 kHz and the output signal fell below the threshold at the same frequency.

MAX22191 Output Capture for Sawtooth Input Signal 20 % Duty
MAX22191 Output Capture for Sawtooth Input Signal 20 % Duty

For a 50 % symmetry, the LED was still active at 120 kHz (function generator limit) and the output waveform was still measurable.

For an 80 % symmetry, the LED was still active at 150 kHz (function generator limit) and the output waveform was still measurable.

MAX22191 Output Capture for Sawtooth Input Signal 80 % Duty
MAX22191 Output Capture for Sawtooth Input Signal 80 % Duty

Detection Levels
The periodic signals were captured as shown in the images below to aid in visualising the voltage detection thresholds for the MAX22191.

MAX22191 Input Output Levels Compared to Output for Square Input Signal
MAX22191 Input Output Levels Compared to Output for Square Input Signal

MAX22191 Input Output Levels Compared to Output for Sine Input Signal
MAX22191 Input Output Levels Compared to Output for Sine Input Signal

MAX22191 Input Output Levels Compared to Output for Sawtooth Input Signal
MAX22191 Input Output Levels Compared to Output for Sawtooth Input Signal

Tuesday 4 June 2024

Arduino Uno R4 Wifi Flash Reprogramming

Introduction 
This short post covers the reprogramming process on the Arduino Uno R4 WiFi (Arduino R4) firmware. The information in this post supplements the content available from the Arduino website with a few additional images. This post is targeted at installations using Windows machines.

The discussions in the Arduino forums for the detection and programming issues on the Arduino R4 can be viewed here.

Reason for Reprogramming the Arduino R4
During software development, a debug message in the Arduino IDE stated that a firmware update was available for the Arduino R4 WiFi. Using the steps below, the module type detected by the Arduino IDE was changed from an Arduino R4 to a WiFiduinoV2 following a firmware update. Reprogramming the
Arduino R4 resulted in incorrect operation.

Steps Resulting in Incorrect Firmware Programming
To begin, the computer running the Arduino IDE was connected to the Arduino R4. The Firmware Updater was selected from the Tools menu in the IDE.

Arduino IDE Displaying Correct Board Type
Arduino IDE Displaying Correct Board Type

The Arduino R4 was recognised in the IDE as the correct board.

Arduino IDE Firmware Updater
Arduino IDE Firmware Updater

The firmware update process was initiated in the IDE by clicking the Install button.

Arduino IDE Firmware Selection
Arduino IDE Firmware Selection

Firmware version 0.4.1 update on the Arduino R4.

Arduino IDE Firmware Update of Arduino R4
Arduino IDE Firmware Update of Arduino R4

After updating the Arduino R4 firmware, the IDE recognised the R4 as a WiFiduinoV2. This behaviour has been noted in Arduino forums.

Arduino IDE Detecting Different Board
Arduino IDE Detecting Different Board

When attempting to build using the WiFiduino2 this results in various compiler issues. The firmware needed reversion.

Arduino IDE Error with Incorrect Board Type
Arduino IDE Error with Incorrect Board Type

Attempting to repeat the flash process for the Arduino R4 firmware not possible as the board was not recognised as the correct type.

Arduino R4 not Recognised After Flash Update
Arduino R4 not Recognised After Flash Update

Using the ESP32 Flash Tool to Restore the Firmware
Fortunately, the Arduino website provides the firmware and tools to reprogram the ESP32 on the Arduino R4 board to restore the type. Some details are contained on the ESP32 Upload page and the main details are available on an associated page here.

Capture from Arduino Website
Capture from Arduino Website

The Arduino website describes the steps required to reprogram the Arduino R4 flash which, begins with removing the USB (power).
A jumper was fitted to the 3x2 header on the Arduino R4 board.

Arduino R4 WiFi Header with Jumper Fitted
Arduino R4 WiFi Header with Jumper Fitted

With the Arduino R4 board reconnected to the computer, the batch file for reprogramming was downloaded from the Arduino website here. When executing the batch file, there was an issue detecting the Arduino R4 board and the batch file operation was terminated.

The ESPflash tool was initiated from the command line following the settings shown on the Arduino website. The results of executing the ESPflash tool are listed below.

C:\********\unor4wifi-update-windows\unor4wifi-update-windows\bin>espflashwrite-bin -b 115200 0x0 
C:\********\unor4wifi-update-windows\unor4wifi-update-windows\firmware\UNOR4-WIFI-S3-0.4.1.bin
[2024-06-01T07:32:00Z INFO ] 🚀 A new version of espflash is available: v3.1.0
[2024-06-01T07:32:00Z INFO ] Serial port: 'COM8'
[2024-06-01T07:32:00Z INFO ] Connecting...
[2024-06-01T07:32:00Z INFO ] Using flash stub
Chip type:         esp32s3 (revision v0.2)
Crystal frequency: 40MHz
Flash size:        8MB
Features:         WiFi, BLE
MAC address:   <hidden>
[00:00:17] [========================================]    877/877     0x0 
C:\********\unor4wifi-update-windows\unor4wifi-update-windows\bin>

Closing the command line and opening the Arduino IDE, confirmed that the Arduino R4 board type was restored correctly. This process mentioned in this post was repeated numerous times during testing without any issues.

If the jumper was left in the Arduino R4 and restarted, the board type is detected as a Deneyap Kart G in the IDE.

Arduino IDE Detecting Deneyap Kart G Board
Arduino IDE Detecting Deneyap Kart G Board

Wednesday 29 May 2024

PCB Artwork - Model Rocket

Introduction 
In this blog the circuit board tool, Altium Designer, was used to create circuit board artwork in the form of a model rocket keyring. The recent prototype of the Wi-Fi rocket launcher post inspired this blog.

Model Rocket Keyring
Model Rocket Keyring

PCB Artwork
To start the project, a black-and-white image of the rocket keyring was downloaded from a suitable website. An image called SpaceShipOne was downloaded from CleanPNG (all credits).

Scaled Rocket Image (Courtesy CleanPNG)
Scaled Rocket Image (Courtesy CleanPNG)

The original image was scaled by 25% before importing into Altium. Shown below is the result of the import. As can be seen by the imported image, the image did not produce solid lines which was required for the keyring.

Imported Rocket Image
Imported Rocket Image

Rather than manipulating the PNG file for an improved import result within Altium, the outline of the imported PNG was drawn over with circuit board tracks (traces). For simple shapes such as the rocket, using Altium is relatively easy however many other packages could be used to achieve the same drawing.

Drafting Rocket Primitives
Drafting Rocket Primitives

The image below shows the imported image and the hand-drawn image side by side. Minor changes can be noticed on the rocket fins compared to the original image.

Comparison of Drawn and Imported Rocket Designs
Comparison of Hand Drawn and Imported Rocket Designs

One item not included in the circuit board file was the board outline. This is commonly added on a mechanical layer but this was not added to the design. It has been noted that many other free software tools are being used to create circuit board artwork. Therefore, with the alternative software in mind, the board manufacturer was asked to add a circuit board outline.

Manufacturing

For the circuit board manufacturing, the company JLCPCB was used. JLC included a board outline 0.1 mm from the circuit board trace. The final product is shown below.

Model Rocket Keyring
Model Rocket Keyring


Download

For anyone interested in producing a keyring, the Gerber file pack is available below. A board outline should be spaced at least 0.1 mm from the outermost circuit board traces.

Rocket Keyring Gerbers
Rocket Keyring Gerbers