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.


Saturday, 26 January 2019

Scripts with PSoC Creator (Powershell)

Summary
In a previous post, command line scripting was used to increment the build number for a PSoC Creator Project. The option to use command line 'cscript.exe' remains supported in Windows 10 although other scripting systems have made significant ingress into the corners of build scripts. This blog illustrates a quick alternative by using trusty PowerShell.

Why PowerShell
In companies where software deployment on desktop machines is not micromanaged, PowerShell can be a useful tools for scripting. Certainly Perl, Ruby, JavaScript or similar languages should not be excluded by IT support or software developers. PowerShell is offered for scripting with PSoC Creator as it is been available from Microsoft since 2006 and therefore available on the Windows operating system.

This blog will look only at Windows machines with PSoC Creator and not attempt to review the impact of scripts with virtual machines.

Example Scripts
The two scripts detailed in the sections below perform the action of copying a 'hex' file to a release directory in a parent folder. For the purposes of illustration the HelloWorld_Blinky program was used from the PSoC Creator examples.


PSoC Creator Hello World Blinky Example
PSoC Creator Hello World Blinky Example

Cscript

The example script below uses the File System Object with a few methods to copy the output file to another folder. If the release folder does not exist then it is first created. 

REM Release Directory Example for PSoC Creator

REM Setup file system access
Set fso = CreateObject("Scripting.FileSystemObject")

REM Setup operating parameters
ProjectMainFolder=fso.GetAbsolutePathName(".")
ReleaseMainFolder=fso.GetParentFolderName(ProjectMainFolder)
ReleasePath = ReleaseMainFolder & "\Release\"
SourceFile = ProjectMainFolder & "\DP8051_Keil_951\Release\*.hex"

Sub Create_Folder(intReleasePath)
 If fso.FolderExists(ReleasePath) Then
  WScript.Echo ("Folder exists...skipping")
 Else
  fso.CreateFolder(ReleasePath) 
  WScript.Echo ("Folder created")
 End If
End Sub

Sub Copy_File(intReleasePath)
 fso.CopyFile SourceFile,intReleasePath
End Sub

REM Duplicating required files
WScript.Echo ("Duplicating files at:" & ReleasePath &vbCrLf)
Create_Folder(ReleasePath)
Copy_File(ReleasePath)
WScript.Echo ("Completed")

The script ReleaseDirectory.vbs is copied to the PSoC projects directory HelloWorld_Blinky.cydsn. A modification is made in the PSoC Creator project to the Build Settings under the Project menu. For this example the call, cscript ReleaseDirectory.vbs is placed in the post build section.


PSoC Creator Post Build Cscript
PSoC Creator Post Build Cscript
After the change above to the build settings the Hello World project is built resulting in the output below.


PSoC Creator Post Build Cscript in Output Window
PSoC Creator Post Build Cscript in Output Window

The Output window shown above details the creation of the folder and completion of the file copy.

PowerShell
The example script below uses PowerShell commands to achieve the same functionality as the above Cscript. As this is for illustrative purposes only the operation of the two scripts may not be exact.

' Release Directory Example for PSoC Creator '

' Setup operating parameters '
$ProjectMainFolder=(Get-Item -Path ".\").FullName
$ReleaseMainFolder=(Get-Item -Path ".\").parent.FullName
$ReleasePath=$ReleaseMainFolder+’\Release\’
$SourceFile = $ProjectMainFolder+'\DP8051_Keil_951\Release\*.hex'

function Create_Folder($intReleasePath)
{
    if((Test-Path -Path $intReleasePath )){
        Write-Output "Folder exists...skipping";
    }

    if(!(Test-Path -Path $intReleasePath )){
        New-Item -ItemType directory -Path $intReleasePath
        Write-Output "Folder created";
    }
}


function Copy_File($intReleasePath)
{
 Copy-Item $SourceFile -Destination $intReleasePath
}

Write-Output "Duplicating files at:"
Write-Output $ReleasePath
Create_Folder($ReleasePath)
Copy_File($ReleasePath)

Similar to the previous example, the script ReleaseDirectory.ps1 is copied to the PSoC projects directory HelloWorld_Blinky.cydsn. In addition to calling the PowerShell script a parameter is passed to bypass the execution policy, PowerShell -executionpolicy bypass -File ReleaseDirectory.ps1

For this example the call is again placed in the post build section.


PSoC Creator Post Build Powershell
PSoC Creator Post Build Powershell

After the change above to the build settings the Hello World project is built resulting in the output below.

PSoC Creator Post Build PowerShell in Output Window
PSoC Creator Post Build PowerShell in Output Window
In the event that the policy to execute the PowerShell script was not allowed a security error message will be shown in the output window.

PSoC Creator Post Build PowerShell Error in Output Window
PSoC Creator Post Build PowerShell Error in Output Window
The execution policy can be checked using PowerShell ISE and amended with due consideration for local machine security and safety.

PowerShell Execution Policy
PowerShell Execution Policy
As a side note, some virus or firewall software may detect the invoked script as a potential threat, see the Comodo exception shown below. Exclusions should be made for these scripts only.


Comodo HIPS Alert Script in PSoC Creator
Comodo HIPS Alert Script in PSoC Creator

Downloads
The downloads available below use the PSoC Creator 4.2 with projects saved as a minimal archive.


Hello Blinky PSoC Creator 4.2 Project
Hello Blinky PSoC Creator 4.2 Project
ReleaseDirectory.vbs
ReleaseDirectory.vbs
ReleaseDirectory.ps1
ReleaseDirectory.ps1



Saturday, 1 December 2018

Isolation Transformer Build Medical Grade 240V

Summary
This blog details the build process of an enclosure for isolation transformer using a medical grade toroidal transformer.

Medical Grade Transformer
There are significant benefits in using a medical grade toroidal transformer over a standard type. These include multiple layers of winding insulation, reduced leakage currents and certain types of internal transformer failures can lead to a winding short to mains earth resulting in protected equipment and operators. Such a short to mains earth is achieved because a medical transformer contains a dedicated mains earth connection. Medical transformers are usually made to a international standard such as IEC / UL 60601-1.

Transformer Selection
A transformer manufactured by Triad Magnetics (China) was selected for mains 240VAC. The Triad Magnetics parts VPM240-670 is rated at 160VA which is usually ample for fault finding equipment or powering small pieces of test equipment. 


Triad Magnetics VPM240-670
Triad Magnetics VPM240-670
The transformer features a number of winding options for 110VAC or 240VAC.

Triad Magnetics VPM240-670 Side View
Triad Magnetics VPM240-670 Side View
For this design the primary and secondary will be configured for 240VAC operation.

Hardware Selection
In addition to the transformer are a number of key components such as the enclosure, IEC connectors, fuses and switch. A standard plastic enclosure was chosen to house the transformer as the expected operational time was low. For long operating periods a vented case would be used.


Enclosure
Enclosure
Shown below are the fuse holders and IEC inlet outlet chassis mount connectors.


Associated Isolation Transformer Hardware
Associated Isolation Transformer Hardware
Hardware Mounting
The hardware required for the design was measured and the mark-ups were made on opposite ends of the enclosure.


Inlet and Fuse holder Mounting
Inlet and Fuse holder Mounting
Outlet and Fuse holder Mounting
Outlet and Fuse holder Mounting
Standalone 3AG fuse holders were chosen over IEC connectors with integrated M205 type fuses however either is suitable for this design.


Transformer Mounting
Transformer Mounting
Mounting for a double pole rocker switch and the transformer were added.

Hardware Dry Fit
Each piece of hardware was mounted to ensure that fitting was suitable and clearances were sufficient.


Hardware Dry Run
Hardware Dry Run
Enclosure Wiring
Salvaged mains 300V AC rated cable was used to wire between the IEC connectors and the fuses.


300V Mains Cables
300V Mains Cables
All mains connections were soldered and the mains wire was passed through the eyelet as shown below.


IEC Mains Cable Connection
IEC Mains Cable Connection
All connections were insulated with heat shrink tube.


Fuse with Heatshrink
Fuse with Heat shrink
 
The image below shows the rather snug wiring prior to testing. Additionally, while tightening the IEC fixings the case cracked meaning the entire case would need to be replaced after some initial testing.


Wired Isolation Transformer
Wired Isolation Transformer
Regulation Testing
The transformer was wired for 240V AC on the primary and secondary.


Transformer Input and Output Options
Transformer Input and Output Options
 
Shown in the image below are the transformer windings as detailed on the Triad Magnetics datasheet.

Transformer Windings
Transformer Windings
Using the wiring configuration for 240VAC, regulation measurements were performed to approximately 130VA using a Fluke 325.


Triad Magnetics Transformer Regulation
Triad Magnetics Transformer Regulation
 
With a load of 130VA the transformer regulation was approaching the 7.2% maximum quoted regulation of the transformer at full load.

Comments 
With very small loads the transformer secondary voltage is almost 10% higher than the primary voltage. For voltage sensitive equipment this differential may be a limiting factor although for standard bench testing this transformer is more than suitable.