Monday, June 1, 2015

Retrofitting an analog power supply with a digital meter



Intro

I bought an old an HP 6294A DC power supply from the Dayton Ham fest back in 2013.  The guy I bought it from promised that it worked fine, and I took it home for pretty cheap.  The supply did work, but the dual voltage/current meter on the front didn't.  It was surprisingly hard to find a replacement meter, and it was going to be very expensive.  Instead, I continued to use the supply (with an attached multimeter). I recently came across a cheap digital display, and I decided to swap it in.  

The meter

The meter.  DROK 100V, 10A, internal shunt.  ~$12 from amazon.  Probably could have found it cheaper elsewhere.

DROK® Small Digital Amperemeter Voltmeter Multimeter 0.28" DC 100V 10A Car Voltage Ampere Meter 2in1 with Built-in Shunt Red/Blue 2-color LED Display 12V 24V Motorcycle Battery Monitoror
DROK meter


DROK meter with wire colors explained.  The two small wires (black and red) power the meter.  The meter power can be any DC supply from 4.5 to 30V.  The three larger wires (red, yellow, black) are the inputs for the meter.  

DROK wiring schematic.  The red wire is the voltage sense and attaches the high voltage side of the load.  The yellow wire is the negative side of the load.  The black wire connects to the HP Power supply common.  

The Supply

As it turns out, the HP 6294A DC power supply is a purely analog DC power supply.  This means that there are NO convenient 5V, 12V, etc. rails to tap into for the meter.  Therefore, I had to use a wall wart (see below) to power the meter.

Safety

Before I did ANYTHING, I unplugged the supply from the wall and gave the capacitors (there was one really big one) time to discharge.   

The Install


I pulled out the old meter, and soldered in the new meter using the wiring diagram I showed before.  The wires that connected to the old meter were useless for the new meter.  Therefore, I enclosed the exposed wire ends with electrical tape so they wouldn't accidentally touch something.  

A closer look.  

I wired the wall wart with a stiff piece of copper wire to the AC input of the supply.  I twisted the wire with pliers until taunt and then soldered everything together.  The wall wart was quite secure.  

I tapped a hole and added a screw through the top plate of the supply to clamp the meter in place. 

The Final Product

Both the volt meter and current meter work!
The downside to this build is that the meter stays lit even when the supply is turned off.  This is because the wall wart is attached to the AC input of the supply.  Oh well.  There are certainly worse problems to have.  

Wednesday, April 1, 2015

Vulcan-CFD MATLAB files

I've written a number of MATLAB files to assist my work in Vulcan-CFD.  Below, I've listed the code for each of these files.


Convert Plot3D files to Plot2D

clc; close all; clear all;

% input
d='C:\Users\John\Documents\Pointwise\backwardStepEx';
filename='backwardStepEx_rev1.x';


%% read in 2D(x=m,y=n,z=1) data
cd(d)
inputFile=filename;
outputFile=[filename(1:end-2) '_Plot2D.x'];
A0 = importdata(inputFile);  %raw data
A=A0;  %raw data to be trucated

% number of blocks in data
numBlocks=A(1);

% grab matrix sizes from the header
for i = 1:numBlocks
    m(i)=A(2+(i-1)*3);
    n(i)=A(3+(i-1)*3);
end

% throw away header info from A
A=A(2+numBlocks*3:end);

% grab x and y data from A and ignore z
for i = 1:numBlocks
    N=m(i)*n(i);
    x{i}=A(1:N);
    A=A(N+1:end);
    y{i}=A(1:N);
    A=A(N+1:end);
    A=A(N+1:end); %delete z
end

% set origin to bottom left.  
xmin=x{1}(1);
ymin=y{1}(1);
for i = 1:numBlocks
    for j=1:length(x{i})
        if xmin > x{i}(j);
            xmin = x{i}(j);
        end
        if ymin > y{i}(j);
            ymin = y{i}(j);
        end
    end
end
for i = 1:numBlocks
    x{i}(:)=x{i}(:)-xmin;
    y{i}(:)=y{i}(:)-ymin;
end
%% plot data
% figure; hold on
% colors=['brkgc'];
% for i = 1:numBlocks
%     plot(x{i},y{i},[colors(i),'+'])
% end


%% write 2D(x=m,y=n) data (with the single z value stripped out)
fileID = fopen(outputFile,'w');

% write number of blocks
fprintf(fileID,[num2str(numBlocks) '\r\n']);

% write matrix sizes for each block
for i = 1:numBlocks
    fprintf(fileID,[num2str(m(i)), '\t', num2str(n(i)), '\r\n']);
end

% write x and y data for each block
for i = 1:numBlocks
    p=x{i};
    for k=1:2
        if k==1
            p=x{i};
        else
            p=y{i};
        end
        
        while(length(p)>=4)
    %         fprintf(fileID,[num2str(p(1)), '\t', num2str(p(2)), '\t', num2str(p(3)), '\t',num2str(p(4)), '\r\n']);
            fprintf(fileID,'%1.15e\t%1.15e\t%1.15e\t%1.15e\r\n',p(1),p(2),p(3),p(4));
            p=p(5:end);
        end
        if p~=0
            for j=1:length(p)
                fprintf(fileID,'%1.15e\t', p(j));
            end
            fprintf(fileID,'\r\n');
        end
    
    end
end

fclose('all');

beep


Add Zeros to Time History Files

% The time_merge script with Vulcan-CFD puts writes the files names with numbers that are not padded with zeros.  (E.g.  file_7.f instead of file_0007.f).  Tecplot, however, has trouble determining the correct file order when importing if the buffer zeros are not present.  This code adds the buffer zeros.
clc; close all; clear variables;

cd(uigetdir)
% cd('\\crunch6\John\circleVortexShedding\Time_files\Plot3d_files')
% read in all files with a *.f extension
firstFileList = dir('*.f');

% this next section of code further filters the list of files without a
% single '_' character.  
j=1;
for i=1:length(firstFileList)
    if length(findstr(firstFileList(i).name,'_'))==1
        secondFileList(j)=firstFileList(i);
        j=j+1;
    end
end

files=secondFileList;

n=length(files);
m=length(num2str(n));


for i=1:n
    oldname=files(i).name;
    % find number between the '_' and '.' characters
    num=oldname(findstr(oldname,'_')+1:findstr(oldname,'.')-1);
    
    % buffer with zeros
    while length(num)<m
        num=['0',num];
    end
    
    %rename file
    newname=[oldname(1:findstr(oldname,'_')),num,'.f'];
    if strcmp(oldname,newname)==0
%     dos(['rename "' oldname '" "' newname '"']); % (1)
        movefile(oldname,newname);
    end
end

Tuesday, January 20, 2015

Chop saw table, DIY

Intro

For an upcoming project, I needed a way to cut long material (aluminum structural pieces) to very precise lengths.  To this end, I made a chop saw table.  

Research

After scouring the internet for a bit, I found a design that I liked.  The design that you'll find below is heavily influenced by this design.

Design

I've recently started dabbling in with Google SketchUp, a free CAD program.  I drew up a quick mockup of my design as shown below.  The shown dimensions are close but don't exactly match my final product.  I also added beams to the bottom for added rigidity that's not shown here.  



In this design, I'm using 0.75" thick plywood, originally a 4' x 8' sheet, four 2x3's, and a bunch of 3" drywall screws.

Final Product

After a relatively quick assembly, I have the following:





I still need to add shims to raise the chop saw a few mm, and I need a fence and stop.  The shims will be added soon, but the fence and stop are not top priority.