Sunday, 5 May 2019

Multipole switch debouncing PSoC

Summary
This post looks at a solution using PSoC components to debounce a multipole switch. For testing, an industrial roller lever switch from German switch manufacturer Bernstein was used with a Cypress CY8CKIT-049 development board.


Bernstein Switch
Bernstein Switch
Single pole vs Multipole 
Single pole switches and buttons are commonly used in applications which are non-critical, require no redundancy or have no specific safety requirement. Consider examples such as the reset button on the Cypress CY8CKIT-049 development board or the light switch in a house.

The multipole switch usually contains multiple contact options for various industrial applications. The contact options are Normally Open 'NO' and Normally Closed 'NC' with various brake and make, effectively open and close, options. Consider an example such as the changeover switch for an electric railway signal box or the end stop switch on a gantry crane.

Signal Bouncing
Multipole switches may use the same mechanical actuation design as their single pole counterparts which gives rise to similar signal characteristics. One difference however is that the contacts in a multipole switch may not actuate at the same time.


Bernstein Switch PSoC Test Setup
Bernstein Switch PSoC Test Setup
The test setup in the image above shows the connections between the CY8CKIT-049 development board and the Bernstein switch. Both contacts use a 5V DC supply.


Multipole Switch with Bounce
Multipole Switch with Bounce
Shown in the capture above are the NO and NC contacts of the Bernstein switch when actuated. No bounce is shown for the NC signal (Yellow channel 1) as it switches OFF and the NO signal (Green channel 2) shows signal bounce for less than 5msec as it switches ON.

To remove the unwanted bounce in this design without using external filtering or other components, the two switch signals were debounced in the PSoC using digital 'components' built from Cypress termed Universal Digital Blocks (UDB).

Simple Multipole Glitch Filter (PSoC)
Simple Multipole Glitch Filter (PSoC)
In the example above the Glitch Filter component was used to debounce the two input signals from the switch. The outputs of these filters was combined to drive the on-board LED. For illustrative purposes the filters were not been combined into a single component with a bus.

The filter component was configured for 20ms for both filter components.


Glitch Filter Configuration
Glitch Filter Configuration
Running the example project in the PSoC development kit produces a clean debounced waveform as shown in the capture below. Note the 20ms delay between input and output waveforms.


Multipole Switch Debounce Turn ON
Multipole Switch Debounce Turn ON
The connections for channel 1 and 2 to the switch remain the same as the previous capture. The additional connections for Blue channel 3 show the filtered NO signal and the Pink channel 4 shows the NC signal.

Shown below is the turn OFF waveforms.


Multipole Switch Debounce Turn ON
Multipole Switch Debounce Turn OFF
Fault Blocking
The dual pole switch in this example uses contacts, which in resting condition, are in the opposite state. The addition of another gate and an enable control to the output LED connections provides some fault detection. That is, the two inputs must be in opposite states for the LED to be active.


Simple Multipole Glitch Filter with Fault Detection (PSoC)
Simple Multipole Glitch Filter with Fault Detection (PSoC)

Final Thoughts
Debouncing multipole switches with a PSoC can be achieved using only a digital solution (UDB). The filter components used in the solution require no code however some 25% of the available resources are utilised. Where practical, multiple switches with multipole contacts could be debounced using a suitable multiplexer.

Downloads
The PSoC Creator 4.2 project below with the glitch filters was saved as a minimal archive.
Mutlipole Checker PSoC Creator 4.2 Project
Multipole Checker PSoC Creator 4.2 Project


Thursday, 25 April 2019

ARP -SCAN for MAC Address Lookup

Summary
This post highlights how the arp (Win) or arp-scan (Linux) commands can be used in conjunction with online MAC address lookup tools, to assist in hardware identification of Ethernet devices.

Predicament
For a software development project a boxed cluster of Single Board Computers (SBC) was provided. The SBC cluster contained systems configured with static and dynamic IP addressing. No issue I mused, each SBC could be powered individually, the SBC that needed to be upgraded could then be identified. The real issue then presented itself, the cluster was boxed hardware and could not be opened and individual boards could not be powered or unpowered. One of the solutions that came to mind was the sometimes overlooked ARP command.

ARP Command (Windows)
Using ARP in the Windows command line may not be the most operator friendly solution, especially if a GUI based application is more your flavour. There are plenty of Windows applications such as the well-known Angry IP Scanner, Nmap or Free IP Scanner which will do a similar task. Some of these applications detail the OEM or hardware manufacturer in the scan results.

For testing with ARP, the SBC box was powered and networked directly to a development computer.

The arp -a command was issued from the Windows command line.


ARP Results
ARP Results
A doctored copy of the results from the arp are shown above. A few dynamic devices were listed. 

The first six characters of the MAC address were used to identify the vendors.


ARP Scan Command (Linux)
The arp-scan command used in Linux terminal produces similar results, usually including the hardware vendor.


ARP Scan Results
ARP Scan Results

MAC Lookup
For this SBC project the AskApache website was utilised for identification of the hardware vendor using the MAC addresses. A Google search will throw up numerous sites with similar search functionality, such as MAC Vendor Lookup.

On the AskApache site, the MAC address starting with b8 yielded the target SBC.


AskApache MAC Address Lookup
AskApache MAC Address Lookup
Results from the website show the target SBC was a Raspberry Pi.


AskApache MAC Address Lookup Result
AskApache MAC Address Lookup Result
Using the command line serves as handy reminder to the tools available in most operating systems.


Thursday, 11 April 2019

Diode charging supercap solar battery

Summary
This post investigates the ideal diode my Maxim Integrated, part MAX40203, as a possible replacement for low forward voltage diodes.


Example Diode SuperCapacitor Charger
Example Diode SuperCapacitor Charger
Forward Voltage
When deciding on a suitable diode for a circuit, such as the basic diode supercapacitor charger shown above, a Schottky is a usual choice. The lower forward voltage of the Schottky diode is more beneficial to ensure that the load operating voltage is closer to the supply voltage. There is also the benefit of lower losses as a result of the lower forward voltage.

Some examples of different Schottky diodes include the Toshiba CUS10S30 with a voltage drop of 230mV at 100mA, the Panasonic DB2S30800L has a drop of 420mV at 100mA or the Nexperia PMEG10020 with a drop of 500mV at 100mA.

Ideal Diode
Released in the middle of 2018 the MAX40203 is targeted as a replacement for the Schottky diode and it does not disappoint in regards to forward voltage.


MAX40203
MAX40203 - Courtesy Maxim Integrated
Diode Testing (Reverse leakage)
To begin the tests, reverse leakage was measured. The MAX40203 was bench tested against two general Schottky diodes, the Nexperia PMEG10020 and an ST STPS2L40U. To perform tests with the Schottky diodes, the devices were connected in reverse bias with a 100k resistor. The MAX40203 leakage test was performed with 100k resistors to measure leakage through Anode and GND as shown in the device datasheet.


MAX40203 Leakage - Courtesy Maxim Integrated
MAX40203 Leakage - Courtesy Maxim Integrated
Voltage measurements were made across the resistor as the supply voltage was increased in one volt increments. Since the maximum operating voltage of the Maxim part is 5.5VDC the test voltage was limited to 5V.

Reverse leakage Schottky vs MAX40203
Reverse leakage Schottky vs MAX40203
Graphing the above table of results was certainly not necessary although illustrates the leakage difference between devices. Note the reverse leakage on the PMEG diode is magnitudes lower than the Maxim part. At 5V DC the PMEG diode leakage was 30nA compared to the 207nA for the Maxim part.


Graphed reverse leakage Schottky vs MAX40203
Graphed reverse leakage Schottky vs MAX40203
Maxim Part Enable
The MAX40203 datasheet does state that the Enable pin should be pulled high however it also states that there is an internal weak pullup.

Reverse leakage tests were performed with only the Maxim device and the leakage through the Anode was measured. Once again the power supply voltage was increase in a range of 1C to 5V DC.


MAX40203 Reverse Leakage Test Setup
MAX40203 Reverse Leakage Test Setup
These tests were to replicate a circuit, such as the example above, using a solar panel.


MAX40203 Enable On/Off Reverse Leakage Measurements
MAX40203 Enable On/Off Reverse Leakage Measurements
Some difference in measurements was noted when the Enable input was connected to the supply. 

Diode Testing (Forward Voltage)
The MAX40203 was subsequently tested with the diodes from the previous test in forward bias. Resistive loads were changed with a fixed supply voltage of 5V DC to achieve test currents from 1mA to 1A.


Forward Voltage Schottky vs MAX40203
Forward Voltage Schottky vs MAX40203
Graphing the above data illustrates the usual curves for diode forward voltage with the almost linear voltage drop against forward current across the MAX40203 internal FET.


Graphed forward voltage Schottky vs MAX40203
Graphed forward voltage Schottky vs MAX40203
MAX40203 Load Testing
Measurements were taken to verify the forward voltage of the Maxim part against the device datasheet to a current of 1A. These were similar to the specifications for a room temperature of 25°C and not recorded.

For the final set of tests the MAX40203 was powered up and down with varying resistive loads with a fixed supply voltage of 5V DC. A repurposed board served as the carrier for the test device.


MAX40203 Test Setup
MAX40203 Test Setup
Tests were performed with various wirewound resistors and initially the power supply current limited to 1A. Final tests were conducted with a current limit at 2A.
MAX40203 Load Test Results
MAX40203 Load Test Results
The first three tests shown in the results above were relatively normal. For the last test with a 0.1Ω resistor the power supply current limit was increased to 2A. After power was supplied to the device, it warmed considerably then the current reduced to around 180mA so power to the device was removed. The internal protection was suspected to be active. After cooling the device did not output the supply voltage of 5V, instead it was around 4V DC. Furthermore the quiescent current was 32mA which had also increased.

MAX40203 Short Testing
A new MAX40203 was placed on a new test board as the device from the prior test was suspect. In the last test the output of the device was shorted to 0V to test the short circuit protection.

After applying power the supply showed that the device was passing and holding 1A. The current limit on the supply was then increased to 2A, still ok, then 3A; after 3A the current dropped to several hundred milliamps. The device was allowed to cool but never returned to normal operation.

Comments
Testing showed that the low forward voltage drop of the MAX40203 makes it ideal for specific charging applications. For a charging current of 100mA the test Schottky's 481mV was over ten times larger than the Maxim devices 35mV.

Conversely the reverse leakage of the Schottky 30nA was significantly lower than the 316nA for the Maxim device.

Testing of the Maxim device short circuit protection was incomplete and would warrant additional further review.


Friday, 8 March 2019

Altium Unable to cast COM object type

Summary
This blog describes how Altium users can resolve the "Unable to cast COM object type" which can be caused as a result of installing / uninstalling Office (32 bit) software together with Office (64 bit).

Altium Dialog Message
The "Unable to cast COM object type" message can be displayed when there is a requirement for Altium to use Excel libraries, such as generating a Bill of Materials (BOM).


Altium Dialog Message
Altium Dialog Message
The message identifies a registry entry which is located at HKCR\TypeLib.

Causes
One Microsoft blog explains that the message may be displayed within Office applications when a mixture of Office 32/64 bit applications are installed on the same machine. The Microsoft blog suggests removing the HKCR key 
00020813-0000-0000-C000-000000000046 although applying this change with Altium did not resolve the issue.


Registry 00020813-0000-0000-C000-000000000046 Entry
Registry 00020813-0000-0000-C000-000000000046 Entry
Office Repair
To remedy the issue in Altium, an Office Repair was required. With the Altium application closed, may not be necessary, the Apps and Features application was opened from the 'Start' menu and the relevant Office installation selected.


Windows 10 Apps and Features
Windows 10 Apps and Features
The Modify button was selected followed by the Quick Repair.


Office Quick Repair
Office Quick Repair
Quick Repair Started
Quick Repair Started
In a few minutes the repair finished.


Quick Repair Finished
Quick Repair Finished
After the repair Altium was launched and a BOM generated without any issues.

Other Altium Messages
While replicating the "Unable to cast COM object type" Altium message for this blog, the process of installing 32 bit Office software did interfere with another Microsoft redistributable. This resulted in Altium displaying a dialog detailing the missing redistributable. Fortunately the Altium dialog provided a link to the Microsoft website where an installation of the redistributable resolved the issue.

Saturday, 23 February 2019

Light Table using BenQ GL2430 Backlight

Summary
This blog illustrates how the salvaged LCD backlight from a BenQ model GL2430 monitor could be used in the design of a light table. 


GL2430-B  BenQ Monitor
GL2430-B BenQ Monitor
Just Another Light Table
Online suppliers such as Amazon have amazing light tables at prices which would force one to question why salvaged electronics should be used. In reply, this is a blog relates to salvaging, reusing electronic waste and my requirement was for dual purpose light table, home and workshop - this meant a robust and repairable solution.

LED Driver
In a previous blog relating to the salvaging of parts from a BenQ monitor, the LED driver and backlight were confirmed operational before starting the salvaging operation.

Further bench testing was needed to determine how the LED controller could be reused. At the core of the controller board sits a Monolithic Power System LED controller - MP3389. After perusing the datasheet a section on dimming on page 9 caught my interest.


MP3389 Typical Application
MP3389 Typical Application (Courtesy Monolithic Power Systems)

This section of the MP3389 datasheet describes dimming control using a PWM signal or a DC signal. Dimming was not an immediate requirement for this project, although it was advantageous to know if such a feature could be added if required.

MP3389 DC Dimming Control
Further on page 13 of the MP3389 datasheet is a figure displaying the DBRT (Brightness Control) input. In order to use dimming with an external DC input voltage, a capacitor must be connected to the BOSC (Dimming Repetition Set) pin.


MP3389 Dimming
MP3389 Dimming (Courtesy Monolithic Power Systems)
Checking the LED controller PCB it was apparent there was a resistor, R801, connected to the BOSC pin. This resistor was replaced with a small ceramic capacitor 0.033uF to set the required frequency.


MP3389 LED Controller Change R801 to Capacitor
MP3389 LED Controller Change R801 to Capacitor
The MP3389 datasheets lists the minimum operating voltage for the device as 5VDC. After the power connections were determine from the old BenQ loom, a benchtop power supply was set to 5VDC with a 500mA current limit.


BenQ Controller and Backlight
BenQ Controller and Backlight
With the power supply limited to 500mA the intensity of the backlight was comfortable to look at in a room with fluorescent lights. Full current was close to 1.2A at 5V DC. With a variable resistor attached to the BRBT pin, the dimming voltage to the DRBT pin of the MP3389 was adjusted until the power supply indicated around 480mA.

Control PCB Mounting
By some odd chance the controller fit neatly into a plastic enclosure. This was a UB5 plastic enclosure from a local supplier.


Boxed MP3389 Controller
Boxed MP3389 Controller
The variable resistor was measured between wiper and external terminals. This converted the variable resistor into two fixed resistors, 68k and 22k. As seen in the image below, the larger value resistor connected between the 5V supply and the dimming pin. The smaller value resistor connected between the dimming pin and supply 0V.


Boxed and Modified MP3389 Controller
Boxed and Modified MP3389 Controller
A chassis mount DC jack was added to one side of the enclosure away from the PCB. Also a small slot was added for the loom and connector which attaches to the backlight assembly.

Frame Construction
An aluminium lipped tube was used for the construction of the frame. The lip was used to retain the backlight.


Lipped Aluminium Tube
Lipped Aluminium Tube
To connect the frame together, plastic corner pieces were utilised.


Tube Corners
Tube Corners
The aluminium tube was cut into four pieces. Two at 555mm and the other at 325mm. A circular saw made light work of the tube.


Cut Aluminium Tube
Cut Aluminium Tube
Fitting the plastic tube corners was achieved with an engineer's square to check for square and a rubber mallet to massage the aluminium frame over the tube corners.


Aluminium Tube Corners Fitted
Aluminium Tube Corners Fitted
The remaining frame parts were assembled.


Aluminium Frame Assembled
Aluminium Frame Assembled
A cut-out was required for the cable assembly which connected between the backlight controller and backlight. An area on the frame was marked out then removed with a Dremel.


Aluminium Frame Backlight Connector Markup
Aluminium Frame Backlight Connector Markup
Aluminium Frame Backlight Connector Cutout
Aluminium Frame Backlight Connector Cutout
Control PCB
Two self-tapping screws were used to mount the control PCB enclosure to the aluminium frame.


Control PCB Enclosure Mounted to Aluminium Frame
Control PCB Enclosure Mounted to Aluminium Frame
For the connections to the control PCB, the original cable from the BenQ monitor was reused. The red, orange and green wires were connected to the 5V centre pin of the DC jack. These were the main supply and enable pins to the MP3389. The brown and black were connected to 0V of the DC jack. The white wire dimming connection was left floating and terminated in heatshrink.

To complete the control PCB assembly the cable to the backlight was plugged into the controller and the plastic lid attached.


Mounted Control PCB Enclosure
Mounted Control PCB Enclosure
The exposed backlight cable was to be protected with flexible plastic trunking. 

USB Power Lead
The current limit set by the dimming resistors on the control PCB was less than 500mA. This value allowed off the shelf USB chargers or USB ports to power the light table.

A standard USB cable was modified so that only the USB power connected to the centre of the DC jack and the black to the outside of the jack.


USB Power Lead for Light Table
USB Power Lead for Light Table
Acrylic Cover Sheet
A removable acrylic cover, 3mm thick, was cut out to cover the backlight. Having a removable cover sheet was necessary with the light table being used around home and in the workshop. 


Acrylic Cover for Light Table
Acrylic Cover for Light Table
Securing the Backlight
To secure the backlight into the frame, a bead of silicon was used between the four corners of the frame and the backlight body.


Fixing LED Backlight
Fixing LED Backlight
Acrylic Mounting and Feet
Four self-tapping screws and Nylon washers were used to secure the acrylic sheet.
Securing the Acrylic Cover
Securing the Acrylic Cover
On the rear side of the light table, four rubber feet were added to each corner.


Rubber Feet or Light Table
Rubber Feet or Light Table
Backlight Diffuser
Using only the backlight diffuser which appears to be a type of translucent plastic film produces good uniformity. There were other optical sheets layered on the front of the original LCD although these were not used.


Light Table Test
Light Table Test
During cleaning of the acrylic with a dry cloth, the backlight diffuser became attracted to the acrylic and lifted off the backlight. An application of silicon helped reduce the lift of the backlight.