Sunday, 10 November 2024

TDR Pulse Generator (Microchip)

Introduction 
This post continues a previous blog that used a microcontroller driver design to generate a fast-rising edge for educational and bench-testing purposes. The microcontroller (PSoC) in the earlier blog was replaced with a microcontroller from Microchip (ATmega16U2). The board uses the Microchip part and is powered by USB.

Pulse Generator PCB
Pulse Generator PCB

Why Another Generator
While the previous design using a PSoC microcontroller was received well, the price of a PSoC microcontroller has become twice that of a competing device such as the Microchip ATmega16U2. Consequently, a design was produced to utilise the Microchip microcontroller.

Circuit Board Design
As featured in the previous design, a pulse train is initiated from a microcontroller (ATmega16U2).

ATmega 16U2 for Pulse Generation
ATmega 16U2 for Pulse Generation

The same output driver arrangement was reused on this design however the output driver was changed to a Nexperia 74AHC04 because of the 5 V supply rail (USB). A linear regulator was considered to maintain the supply rails at 3.3 V but was ultimately not included to keep the total cost as low as possible. Five outputs of the 74AHC04 driver are still connected in parallel to individual 249 R resistors. All five outputs are tied together thus providing a calculated 49.8 R at the output, CN2.

Buffered Output for Pulse Generator
Buffered Output for Pulse Generator


Software Design for Output Pulsing

A minimal software (code) project was prepared in Microchip Studio. This application generates a pulse by direct and continuous writes to the microcontroller port. The code to generate the pulses is shown below
.

int main(void)
{
DDRD = 0x08;
PORTD = 0x00;
for (;;)
{
PORTD |= _BV(PD3);
PORTD &= ~(_BV(PD3));
}
}


USB hardware connections were made to the ATmega to allow developers or users to enhance the code further. The ATmega software could be developed to support USB-controlled commands. Below are some links for software that may allow for HID solutions with the USB.

https://github.com/NicoHood/HoodLoader2

https://gitlab.com/arksine.code/HID/-/tree/2.0

A Note on Programming
The post includes details regarding the programming of the Microchip part because this design is intended for the educational system or illustrative purposes.

The 6-way programming connector on the pulse board interfaces with the ATmega. The connections are designed for SPI programming. See Table 3-6 in the Atmel ICE document for information concerning connections between the programmer and Microchip microcontrollers.

Pulser SPI Connector Pinouts
SPI Connector Pinouts

For programming of the microcontroller in this blog, the ‘Atmel squid’ connections were made to the pulse generator board as shown below.

SPI 'Squid' to Pulser Board
SPI 'Squid' to Pulser Board

PCB pad jumper J1 should be shorted with solder to power the external oscillator.

Powering External Oscillator J1
Powering External Oscillator J1

The settings displayed below are taken from the Microchip Studio's, Tools menu, and the Device Programming item. The settings can be adapted based on the functionality needed on the board. For example, the onboard 8 MHz oscillator could be replaced with a different frequency device or the board could be redesigned to suit a crystal.

Microchip Studio ISP Clock Settings
Microchip Studio ISP Clock Settings

Microchip Studio Oscillator Settings
Microchip Studio Oscillator Settings
 
Microchip Studio Fuse Settings
Microchip Studio Fuse Settings

Microchip Studio Fuse Settings Continued
Microchip Studio Fuse Settings Continued

Testing the Board
Since the output driver voltage rails were changed from 3.3 V to 5 V, the output rise time (10% - 90%) was predicted to be slower.

Prototype Pulser PCA
Prototype Pulser PCA

Drive Voltage from Pulse Tester (Microchip)
Drive Voltage from Pulse Tester (Microchip)
 
Period from Pulse Tester (Microchip)
Period from Pulse Tester (Microchip)

Signal measurements were again performed on a Keysight oscilloscope with a 20 GSa/s resolution. This board showed a rise time of 1.11 ns when measuring for a rise time of 10% to 90%.

Output Waveform Rise Time from Pulse Tester
Output Waveform Rise Time from Pulse Tester

Reflectometry Testing
Reflectometry tests were performed with a benchtop oscilloscope. The pulse was connected to the oscilloscope with a BNC Tee adaptor, and the other side of the BNC Tee was connected to a length of coaxial cable.

Pulse Tester as TDR Test Setup
Pulse Tester as TDR Test Setup

The initially launched and reflected pulses were captured as shown in the image below.

TDR Capture
TDR Capture

Engineering Files
The Atmel Studio project, schematic, Gerber and BOM files are available for download using the links below.

Pulse Generator Microchip Studio Project

Pulse Generator Schematic Rev2










Pulse Generator Bill of Materials Rev2























Thursday, 31 October 2024

Amazon 9.8" Pottery Wheel Foot Speed Control Change

Introduction 
This short blog shows how to replace the speed control device in the foot controller on the Amazon 9.8” pottery wheel. This change may be required for anyone with irregular speed control or a damaged foot speed controller.

Determining the Part Replacement
With the pottery wheel unpowered, the internals of the foot speed controller are accessed by removing three plastic screws located in the base of the foot controller. The foot control mechanism consists of a potentiometer for setting the speed and two gears.

Internals of foot speed controller
Internals of Foot Speed Controller

 To remove the potentiometer, the locking nut was loosened. This allowed removal and part identification.

Original Potentiometer
Original Potentiometer

As shown in the above image, the potentiometer was rated at 4.7 k 2 W. A similar device was located from TE Connectivity part 3-1625931-0 and sourced online.

Replacement TE Connectivity Potentiometer
Replacement TE Connectivity Potentiometer

Items to Address with the Replacement Part
The TE Connectivity potentiometer is a direct replacement for its value (resistance); however, there are mechanical differences with the potentiometer, specifically the solder pins and smooth shaft. Since the original potentiometer was supplied with a D-shaped shaft, the original spur gear could not be reused, so a new spur gear needed to be created.

Original D-Shaft Spur Gear
Original D-Shaft Spur Gear

Down the Spur Gear Road
The spur gear script feature in Fusion 360 was chosen to create a compatible gear. Alternative tools are available for creating a spur gear however these alternatives were not tested for this blog. Two alternative sites may be STL Gears and Gear Generator.

Fusion 360 Spur Gear Script
In Fusion 360, the Spur Gear script is accessed from the Utilities tab under the Add-Ins icon.

SpurGear Script in Fusion360
SpurGear Script in Fusion360

The settings in the image below were chosen after measuring the original gear, applying them to the spur gear script followed by 3D-printed prototypes. Some important items for the spur gear were the number of teeth, shaft diameter and Fusion 360 calculated Pitch Diameter.

SpurGear Settings in Fusion 360
SpurGear Settings in Fusion 360

Fusion 360 Spur Gear Modification
To ensure that the spur gear would not rotate on the round potentiometer shaft, two cutouts were added inside the spur gear shaft area for glue. The cutout changes were made to the spur gear sketch generated by the Fusion 360 script.

Editing the SpurGear Sketch
Editing the SpurGear Sketch

The images below show the edit to the sketch and updated 3D model.


SpurGear Sketch with Cutouts Added
SpurGear Sketch with Cutouts Added

SpurGear 3D with Cutouts Added
SpurGear 3D with Cutouts Added

Ultimaker Cura was used to generate a print with a 100 % fill. The Fusion 360 file and STL files are available for downloaded at the end of this blog.

Replacing the Potentiometer
The wiring layout for the potentiometer was recorded. Using a soldering iron, the three wires from the original potentiometer were desoldered.

Potentiometer Wiring Connections
Potentiometer Wiring Connections

For the replacement potentiometer, the centre pin of the new potentiometer was determined to be the wiper (red wire). In the configuration shown in the image below, pressing the control pedal to the angled position increased the speed. For reverse operation, the yellow and green wire positions on the potentiometer should be swapped. All connections were soldered and covered with a piece of heatshrink.

Wiring for New Potentiometer
Wiring for New Potentiometer

The replacement spur gear was printed in PLA and then it was placed onto the potentiometer shaft without glue to ensure it aligned with the other mechanism inside the pedal.

Positioning the Spur Gear
Positioning the Spur Gear

To ensure the gear did not rotate on the potentiometer shaft, glue was added.

Replacement Potentiometer with Round Shaft
Replacement Potentiometer with Round Shaft

Fitting and Setting the Potentiometer Home Position
With the connections finalised and the gear positioned, the locking nut on the potentiometer was hand-tightened.

Mounted Potentiometer with Threadlocker
Mounted Potentiometer with Threadlocker

The pottery wheel was powered and set up to operate from the foot control. In the horizontal position, the potentiometer was rotated so that the pottery wheel did not turn. This corresponds to a speed of 000 on the pottery wheel display. The potentiometer was tightened further. Pressing the foot control to the angled position resulted in a speed of 320.

Maximum Speed Value on Pottery Wheel
Maximum Speed Value on Pottery Wheel

Loctite 222 was applied to the thread on the potentiometer to reduce the chance of the potentiometer coming loose.

Lastly, the base plate for the foot control was reattached and secured with the three plastic screws.

Downloads

SpurGear.f3d

SpurGear.stl

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