Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 12:32 07 Jul 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : uM2(+): Constant Current/Voltage PSU

     Page 1 of 5    
Author Message
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10215
Posted: 09:59am 05 Mar 2016
Copy link to clipboard 
Print this post

In this thread I'll provide the code and circuit of the PSuM2, a full Micromite touch-screen controlled constant current/constant voltage power supply. The code also supports full control from the serial port if required.

The PSU can provide voltages of 0-23 volts and 0-1.2 amps and provides very accurate control. The circuit is based on Dave's unfinished design on the EEVBlog.

I've strip-boarded the design using a 28-pin uM2 but have also done a PCB layout.

First some pics:

Breadboard and voltage input



Main status screen with output switched off



Constant voltage mode



Constant current mode



Current input



Lots more details to follow.


Edited by matherp 2016-03-06
 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2932
Posted: 10:59am 05 Mar 2016
Copy link to clipboard 
Print this post

WOW - this is absolutely brilliant. And yet another example of how you could use Geoff's awsome LCD BackPack!

Be very interested in the accuracy of this for general use at 3v3 and 5v unto about 1A

Some chunky heatsinks there - do they get warm/hot?

Can't wait for your future posts regarding this project . . . .
 
centrex

Guru

Joined: 13/11/2011
Location: Australia
Posts: 320
Posted: 12:03pm 05 Mar 2016
Copy link to clipboard 
Print this post

Excellent Peter cant wait to see the details.

Cliff
Cliff
 
astroboy
Regular Member

Joined: 28/12/2014
Location: Australia
Posts: 41
Posted: 03:49pm 05 Mar 2016
Copy link to clipboard 
Print this post

Yes please Peter! I'm very interested in this.

John
 
Zonker

Guru

Joined: 18/08/2012
Location: United States
Posts: 767
Posted: 04:32pm 05 Mar 2016
Copy link to clipboard 
Print this post

Excellent Looking project Peter..!

I love your GUI screen layouts...

How do you control the voltage and current settings..? Will keep an eye on this one..!
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10215
Posted: 11:08pm 05 Mar 2016
Copy link to clipboard 
Print this post

First a bit about the key design element of the circuit. The design is strongly based on Dave Jones's uSupply . The problem with this though is it was never finished and no uP code was ever released. In fact the project became a bit like the Oozlum bird (check google if you don't know the reference). The first 3 videos in the series explain the basics of the circuit. Video 4 explains using PWM as an accurate DAC. After that......

The issue is that the design is based on a linear regulator LT3080 or LT3083 and that creates heat based on the formula:

watts = (input voltage - output voltage) * current

So if we have a 24V input supply and want a 1-V output at 1-amp we need to loose 23W.

The regulator chip has a die to case temperature rise of 3degC/W and a maximum die temperature of 125degC.

These are the critical values we need to understand. If we assume ambient at 25degC, then even with a perfect heatsink (0degC/W) the die will be at 94degC in our extreme example. To keep the die at or below 125degC in our example then we need a heatsink of (125-94)/23 = 1.33deg/W

So our supply, assuming a 24V input, will need a 1degC/W heatsink. Something like this should do the job. You probably have something suitable lying around off some piece of decommissioned electronics like an old amplifier.

In Dave's series he tries to get round this power dissipation problem with variable controlled supplies and it all gets too complex and too expensive. He also moves towards a battery powered supply where wasting power matters.

In my design, I am assuming the incoming power is one of those old laptop power supplies you have lying around.

The circuit includes a 5V output and USB charging capability. In my version of the design it is certainly worth replacing the 5V 7805 regulator with one of cheap ebay LM2577 modules if you want to use the 5V output or charger. Look for the versions with the second level of filtering like this:



The choice of the 3.3V regulator should not be changed as this supplies the reference for the ADC.

The circuit drawn up in Designspark is attached:

2016-03-06_090341_PSuM2.pdf

and here is the stripboard layout




More details on the working of the circuit to come






 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10215
Posted: 02:32am 09 Mar 2016
Copy link to clipboard 
Print this post

I've now finished the code for the power supply. Unfortunately things got delayed while I waited for a new LT3080 regulator chip following an unfortunate solder-bridge whilst trying a mod on the circuit. It now works well and regulates both voltage and current (down to 0.008A) accurately - see pic




The final code is below (no CFunctions ). If anyone builds this I will write up the calibration instructions. Let me know. I've also done a PCB layout for anyone interested





'
' Constant current /constant valtage programmable power supply
' Touch screen and serial input control
'
option explicit
option default none
option autorun on
cpu 48
'
' OPTION LCDPANEL ILI9341,L,24,16,23
' OPTION TOUCH 10,9
'
const T_IRQ = 9 'pin for touch interrupt
const I_LIMIT=15 'pin for current control
const VOUT_ADC=26 'pin to measure outgoing voltage
const VIN_ADC=2 'pin to measure incoming voltage
const IIN_ADC=7 'pin to measure current flow
CONST PWM_VOLT=4 'pin to output PWM voltage control
CONST PWM_AMP=5 'pin to output PWM current control
const IIN_CAL=0.4113 'Set to calibrate current measurement
const VIN_CAL=10.0 'set to calibrate input voltage measurement
const VOUT_CAL=9.94 'set to calibrate output voltage measurement
const VOLT_PWM_CAL=3.07 ' set to calibrate PWM voltage control
const AMP_PWM_CAL=74.43 ' set to calibrate PWM current control
const diode=0.730 'measured drop on input diode to calibrate input voltage
const dropout=3.0 'excess of input voltage over output for control
const LowAmpAdjust = 0.003 'adjustment to get correct output of low amperage values


' set up the coordinates of the buttons
dim INTEGER pos1(3)=(2,180,57,57)
dim INTEGER pos2(3)=(61,180,58,57)
dim INTEGER pos3(3)=(121,180,57,57)
dim INTEGER pos4(3)=(2,121,57,57)
dim INTEGER pos5(3)=(61,121,58,57)
dim INTEGER pos6(3)=(121,121,57,57)
dim INTEGER pos7(3)=(2,62,57,57)
dim INTEGER pos8(3)=(61,62,58,57)
dim INTEGER pos9(3)=(121,62,57,57)
dim INTEGER pos0(3)=(180,180,57,57)
dim INTEGER possign(3)=(2,260,57,57)
dim INTEGER posdel(3)=(180,62,57,57)
dim INTEGER pospoint(3)=(180,121,57,57)
dim INTEGER posenter(3)=(239,121,78,116)
dim integer posdisp(3)=(2,2,315,58)
dim integer poscancel(3)=(239,62,78,57)
DIM Integer power(3)=(2,180,159,59)
DIM INTEGER modamps(3)=(160,60,159,59)
DIM INTEGER modvolts(3)=(160,120,159,59)
'
DIM INTEGER ON_OFF=0 'Output control variable, 0=off, 1=On
DIM integer mode=0 'Output status, 0=to be determined, 1=constant voltage, 2=constant current
dim integer page=1 ' page to be displayed, 1=main page, 2=current input, 3=voltage input
dim touched$ length 10 = "" 'variable for storing touch input
DIM integer dp 'variable to indicate a decimal point has been input
DIM INTEGER ret 'variable to indicate serial input status, 0=incomplete, 1=complete
dim float VOUT,VIN,IIN 'currrent values of output voltage, input voltage and measured current
dim istr$ length 10 ="" 'variable for storing serial input
dim float AMPPWM=0 ,VOLTPWM=0, SetVolts, SetAmps, DriveAmps 'current values of PWM levels and voltage and current set values
'
' Set up all I/O pins
'
setpin I_LIMIT,DIN
SETPIN VOUT_ADC,ain
SETPIN VIN_ADC,ain
SETPIN IIN_ADC,ain
PIN(PWM_VOLT)=0
SETPIN PWM_VOLT,DOUT
PIN(PWM_AMP)=0
SETPIN PWM_AMP,DOUT
PAUSE 1000
'
VIN=pin(VIN_ADC)*VIN_CAL+diode 'get input voltage for first output voltage validation
VAR RESTORE 'restore voltage and current set values if previously set
if SetVolts > VIN-dropout then SetVolts=VIN-dropout ' ensure set voltage is valid
'
' Main program
'
DIM float INP
do
if page=1 then mainpage 'display main status page
if page=2 then 'display and process touch screen current input
INP=numberpad(0,1.2,"Amps")
IF INP<>999 then
SetAmps=INP
DriveAmps=SetAmps-LowAmpAdjust
AMPPWM=DriveAmps*AMP_PWM_CAL
VAR SAVE SetAmps,SetVolts
IF ON_OFF then pwm 1,10000,voltpwm,amppwm
ENDIF
mode=0
TIMER=0
endif
if page=3 then 'display and process touch screen voltage input
INP=numberpad(0,VIN-dropout,"Volts")
IF INP<>999 then
SetVolts=INP
voltPWM=SetVolts*VOLT_PWM_CAL
VAR SAVE SetAmps,SetVolts
IF ON_OFF then pwm 1,10000,voltpwm,amppwm
endif
mode=0
TIMER=0
endif
loop
end

sub mainpage 'Display main status page and set up interrupts
colour RGB(WHITE),RGB(BLUE)
FONT 9
CLS
BOX (MM.HRES-40)\2,0,40,180,,,RGB(gray)
box 0,0,mm.hres-1,mm.vres-1,2
LINe 0,60,(MM.HRES-40)\2,60,2
LINe 0,120,(MM.HRES-40)\2,120,2
LINe 0,180,MM.HRES,180,2
LINE (MM.HRES+40)\2,60,MM.HRES-1,60,2
LINE (MM.HRES+40)\2,120,MM.HRES-1,120,2
line (mm.hres-40)\2,0,(mm.hres-40)\2,MM.VRES-60,2
line (mm.hres+40)\2,0,(mm.hres+40)\2,MM.VRES-60,2
TEXT 70,30,"Actual",CM
TEXT 250,30,"Set",CM
TEXT MM.HRES\2,86,"u",CM,9,,RGB(yellow),RGB(gray)
TEXT MM.HRES\2,118,"M",CM,9,,RGB(yellow),RGB(gray)
TEXT MM.HRES\2,150,"2",CM,9,,RGB(yellow),RGB(gray)
TEXT MM.HRES\2,24,"P",CM,9,,RGB(yellow),RGB(gray)
TEXT MM.HRES\2,58,"S",CM,9,,RGB(yellow),RGB(gray)
if NOT ON_OFF then
BOX 0,180,161,mm.vres-181,2,RGB(white),RGB(green)
text 80,210," OFF ",CM,,,,RGB(GREEN)
endif
settick 250,monitor,1
settick 5,SERIALIO,2
SETPIN T_IRQ, INTb, MainTouchInt
do
PAUSE 10
loop while page=1
SETPIN T_IRQ, OFF
end sub

sub MainTouchInt 'Touch input interrupt for main status page
if testtouch(power()) then
if ON_OFF then
pwm 1,STOP
ON_OFF=0
BOX 0,180,161,mm.vres-181,2,RGB(white),RGB(green)
text 80,210," OFF ",CM,,,,RGB(GREEN)
mode = 0
else
ON_OFF=1
AMPPWM=DriveAmps*AMP_PWM_CAL
voltPWM=SetVolts*VOLT_PWM_CAL
pwm 1,10000,voltpwm,amppwm
TIMER=0
endif
endif
IF testtouch(modamps()) then
SETPIN T_IRQ, OFF
page=2
endif
IF testtouch(modvolts()) then
SETPIN T_IRQ, OFF
page=3
endif
end sub

sub SERIALIO 'Serial IO interrupt routine
local s$ length 10, p$ length 10, t$ length 1
local integer i,j
local float temp
s$=""
do 'get any waiting characters
p$=inkey$
s$=s$+p$
loop while p$<>""
if s$<>"" THEN
if istr$="" and (left$(s$,1)="A" or left$(s$,1)="V" or left$(s$,1)="P") THEN 'start of valid input
istr$=s$
print s$;
else
if istr$<>"" then istr$=istr$+s$ ' continuing input
print s$;
endif
endif
i= instr(istr$,chr$(13))
if i then 'must be valid input
print ""
p$=left$(istr$,i-1)
t$=left$(p$,1)
p$=right$(p$,len(p$)-1)
if t$="A" then
temp=val(p$)
if temp>=0 and temp<=1.2 then
SetAmps=val(P$)
DriveAmps=SetAmps-LowAmpAdjust
AmpPwm=DriveAmps*Amp_Pwm_Cal
VAR SAVE SetAmps,SetVolts
TIMER=0
endif
elseIF t$="V" THEN
temp=val(p$)
if temp>=0 and temp<VIN-dropout then
voltPWM=temp*VOLT_PWM_CAL
SetVolts=temp
VAR SAVE SetAmps,SetVolts
timer=0
endif
else
if val( p$) then
ON_OFF=1
AMPPWM=DriveAmps*AMP_PWM_CAL
voltPWM=SetVolts*VOLT_PWM_CAL
TIMER=0
else
pwm 1,STOP
ON_OFF=0
BOX 0,180,161,mm.vres-181,2,RGB(white),RGB(green)
text 80,210," OFF ",CM,,,,RGB(GREEN)
mode = 0
endif
endif
IF ON_OFF then pwm 1,10000,voltpwm,amppwm
j=len(istr$)
istr$=right$(istr$,j-i) 'remove the new string
if left$(s$,1)<>"A" OR left$(s$,1)<>"V" OR left$(s$,1)<>"P" then istr$=""
endif


end sub

sub monitor 'Status measurement and update interrupt
local a$ length 10
IIN=pin(IIN_ADC)*IIN_CAL+lowampadjust
a$=str$(IIN,2,3)
if page=1 then text 70,90,a$+"A",CM,9
if page=1 then TEXT 250,90,str$(SetAmps,2,3)+"A",CM,9
vout=pin(VOUT_ADC)*VOUT_CAL
a$=str$(VOUT,2,3)
if page=1 then text 70,150,a$+"V",CM,9
if page=1 then TEXT 250,150,str$(SetVolts,2,3)+"V",CM,9
VIN=pin(VIN_ADC)*VIN_CAL+diode
a$=str$(VIN,2,1)
if page=1 then text 240,210,"VIN"+a$+"V",CM,9
IF ON_OFF and page=1 then
if NOT pin(I_LIMIT) then
if mode<>2 then
BOX 0,180,161,mm.vres-181,2,RGB(white),RGB(red)
text 80,210,"Current",CM,,,,RGB(RED)
mode=2
endif
if abs(SetAmps-IIN)>0.001 and timer>500 then
AmpPwm=AmpPwm*SetAmps/IIN
if AmpPwm>100 then AmpPwm=100
if AmpPwm< 0 then AmpPwm=0
pwm 1,10000,voltpwm,amppwm
endif
else
if mode<>1 then
BOX 0,180,161,mm.vres-181,2,RGB(white),RGB(magenta)
text 80,210,"Voltage",CM,,,,RGB(magenta)
mode=1
endif
if abs(SetVolts-vout)> 33.3/4096 and timer>500 then
Voltpwm=voltpwm*SetVolts/vout
if voltpwm>100 then voltpwm=100
if voltPwm< 0 then voltPwm=0
pwm 1,10000,voltpwm,amppwm
endif
endif
endif
end sub

sub touchint 'touch interrupt for voltage and current setting pages
if touched$="0" or touched$="-0" then dp=0 'decimal point always zeroed on empty string
if len(touched$)<9 then 'add a character to the string if not full
if testtouch(pos0()) and touched$<>"0" AND touched$<>"-0" then touched$=touched$+"0"
if testtouch(pos1()) then addchar("1")
if testtouch(pos2()) then addchar("2")
if testtouch(pos3()) then addchar("3")
if testtouch(pos4()) then addchar("4")
if testtouch(pos5()) then addchar("5")
if testtouch(pos6()) then addchar("6")
if testtouch(pos7()) then addchar("7")
if testtouch(pos8()) then addchar("8")
if testtouch(pos9()) then addchar("9")
endif
'
if testtouch(possign()) then 'change sign, can't go negative if string full
if left$(touched$,1)="-" then
if len(touched$)<9 then touched$=right$(touched$,len(touched$)-1)
else
touched$="-"+touched$
endif
endif
'
if testtouch(posdel()) and touched$<>"" then ' delete a character
if right$(touched$,1)="." then dp=0
touched$ = left$(touched$,len(touched$)-1)
if touched$="" or touched$="-" or touched$="0." or touched$="." then touched$="0"
endif
'
if testtouch(pospoint()) and dp=0 and len(touched$)<8 then 'add a decimal point, can't add if no room for at least one digit after
if touched$="" then touched$="0"
touched$=touched$+"."
dp=1
endif
text 204,posdisp(1)+posdisp(3)\2,space$(9-len(touched$))+touched$,RM,9,,RGB(blue),RGB(green)
'
if testtouch(posenter()) then ' return with valid string
ret=1
endif
if testtouch(poscancel()) then 'return with null string
touched$=""
ret=1
endif
end sUB
'
function testtouch(position() as integer) as integer 'check touch input against screen area
if touch(x)>=position(0) and touch(y)>=position(1) and touch(x)<=position(0)+position(2) and touch(y)<=position(1)+position(3) then
testtouch=1
else
testtouch=0
endif
end function
'
sub drawbutton(posn() as integer, s$)
box posn(0),posn(1),posn(2),posn(3),,,rgb(blue):text posn(0)+posn(2)\2,posn(1)+posn(3)\2,s$,CM,9
end sub

sub addchar(s$)
if touched$<>"0" AND touched$<>"-0" then
touched$=touched$+s$
else
if touched$="0" then: touched$=s$: else: touched$="-"+s$:endif
endif
end sub

function numberpad(min as float, max as float,prompt$)as float
cls
colour rgb(white),rgb(black)
BOX posdisp(0),posdisp(1),posdisp(2),posdisp(3),,,RGB(green)
colour rgb(white),rgb(blue)
drawbutton(pos0(),"0")
drawbutton(pos1(),"1")
drawbutton(pos2(),"2")
drawbutton(pos3(),"3")
drawbutton(pos4(),"4")
drawbutton(pos5(),"5")
drawbutton(pos6(),"6")
drawbutton(pos7(),"7")
drawbutton(pos8(),"8")
drawbutton(pos9(),"9")
drawbutton(posdel(),">")
drawbutton(possign(),"+-")
drawbutton(pospoint(),".")
drawbutton(posenter(),"Ent")
drawbutton(poscancel(),"Can")
BOX 0,0,320,240
SETPIN T_IRQ, INTb, TouchInt
do
touched$="0"
text 204+16*(len(prompt$)+1),posdisp(1)+posdisp(3)\2," 0 "+prompt$,RM,9,,RGB(blue),RGB(green)
ret=0 'marker to return from function - set in interrupt
dp=0 'marker to indicate decimal point used
do
pause 10
loop while ret=0
loop while touched$<>"" and (val(touched$)<min OR val(touched$)>max)
SETPIN T_IRQ, OFF
if touched$="" then
numberpad=999
else
numberpad=val(touched$)
endif
page=1
end function
'
DefineFont #9
5F202010 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 C0010000 C001C001 C001C001 C001C001 C001C001 C001C001
C001C001 C001C001 0000C001 00000000 00000000 C001C001 C001C001 00000000
00000000 00000000 18061806 380E380E 701C781E 701C701C 701C701C 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 8C010000 8C038C03 18031C03 FF3F1803 FF3FFF3F 30063806
300E3006 600C700C FEFFFCFF E01CFEFF C018E018 C038C018 C031C039 00000000
00000000 80008000 80008000 F80FF003 8C1CFC1F 80388018 80388038 801F801C
F807F00F 9C00FC01 8E008E00 8E008E00 9C388C30 F01FF83F 8000C001 80008000
80008000 00000000 00000000 007F003E 80E30077 80C180C1 826380C1 3E3E0F7F
E003F81C 383E800F FEE07C78 8301C601 83018301 EE00C701 7800FC00 00000000
00000000 00000000 F007C003 301EF00F 001C001C 001C001C 000E001C 001F000E
873B001F C771C771 E760E760 7E607660 1C703E70 7E3C1C78 E70FFE1F 00000003
00000000 00000000 C000E000 C001C001 8003C001 80038003 80038003 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 E0006000 C000C000 8001C001 80038003 00038003 00070003 00070007
00070007 00070007 00070007 00030003 80038003 80018003 C001C001 E000C000
00006000 00070006 00030003 80018003 C0018001 C001C001 C000C000 E000E000
E000E000 E000E000 E000E000 C001C000 C001C001 80018001 00038003 00070003
00000006 00000000 00000000 00000000 80018001 80018001 8E798661 F80F9C3D
C003E007 F80FE007 8E79BC3D 82018671 80018001 80008001 00000000 00000000
00000000 00000000 00000000 00000000 C0018001 C001C001 C001C001 C001C001
FE7FFE7F C001FE3F C001C001 C001C001 C001C001 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 C003C003 C003C003 C003C003 80078007 00070007
000E0007 00000000 00000000 00000000 00000000 00000000 00000000 00000000
FE7FFE7F 0000FE7F 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 C0070000 C007C007 C007C007 C007C007 00000000
00000000 00000000 00000000 1C000C00 38001800 70003800 E0007000 C000E000
C001C001 80038003 00070003 000E0006 001C000E 0018001C 00300038 00000000
00000000 00000000 E007C001 781EF00F 1C1C381C 3C383C38 7C387C38 CE38CC38
8E39CE39 0C3B8E3B 1C3E0C3F 1C3C1C3E 1C1C1C3C 780E381C E007F00F 00008001
00000000 00000000 E0010000 E01FE007 E01CE01F E000E010 E000E000 E000E000
E000E000 E000E000 E000E000 E000E000 C000E000 FC0FC000 FC0FFE1F 00000000
00000000 00000000 F01FC007 3C3CF83F 0E001C30 0E000E00 0E000E00 1C001C00
38003800 E0007000 C001E001 00078003 001E000E FE3F003C FE3FFE3F 00000000
00000000 00000000 F01FC007 783CF83F 1C003C00 1C001C00 1C001C00 F0073800
F007E007 1C003800 0E001C00 0E000E00 1C000E00 FC3F3C20 F03FF83F 00008003
00000000 00000000 70000000 F000F000 B001F001 30033003 70067007 700C700E
7018701C 30307038 FE7F3070 FE7FFE7F 30007000 70007000 30007000 00000000
00000000 00000000 F81F0000 F81FF81F 001C001C 001C001C C01F001C F81FF01F
3C007C18 0E001C00 0E000E00 0E000E00 1C000E00 F83F3C20 E03FF83F 00008007
00000000 00000000 F807F001 180FF80F 001C001C 00380018 E0390038 F83FF033
1C3C3C3E 0C381C38 0E380E38 0E380E38 1C180C38 381E1C1C F007F80F 0000C001
00000000 00000000 FE3F0000 FC3FFE3F 1C001C00 38003800 70003800 70007000
E0006000 E000E000 C001C001 8003C001 80038003 00070007 000E0007 00000000
00000000 00000000 F00FC003 381EF81F 1C381C1C 1C381C38 1C1C1C38 F00F381C
F00FE007 1C1C781E 0E381C38 0E380E38 1C380E38 7C1E1C3C F00FF81F 0000C001
00000000 00000000 F00FC003 781CF01F 1C383838 1C381C38 1C301C30 1E381C38
3E381E38 EC1F7E1E 8C03CC0F 1C001C00 38001C00 F01F3800 E01FF01F 00000003
00000000 00000000 00000000 00000000 C0030000 C003C003 C003C003 C003C003
00000000 00000000 00000000 C003C003 C003C003 C003C003 00000000 00000000
00000000 00000000 00000000 00000000 C0030000 C003C003 C003C003 C003C003
00000000 00000000 00000000 C003C003 C003C003 C003C003 80078003 00078007
00000007 00000000 00000000 00000000 02000000 3E000E00 F003FC00 003FC00F
0078007C 803F007E F803E00F 3E00FE00 02000E00 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 FE7FFE7F 0000FE7F
00000000 00000000 FE7FFE7F 0000FE7F 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00600000 007E0078 E00F803F FE00F803
0E003E00 FC003E00 C00FF003 007C003F 00600070 00000000 00000000 00000000
00000000 00000000 F00FE003 3C1CF81F 1C001C18 1C001C00 38001C00 F0007800
C001E000 C001C001 C0018001 0000C001 00000000 80038003 80018003 00000000
00000000 00000000 F0030000 3C1EF80F 0E380C1C 06700630 FE61F660 0EC3FEE3
06C606C7 06C606C6 06C706C6 9EE30EC7 F661FE63 00306070 001C0038 FC0F001E
FC00FE07 00000000 C0030000 C007C003 E006C007 600EE006 700E600E 700C700C
381C301C 3818381C FC3FF83F FC3FFC3F 0C701C70 0E700E70 0EE00EE0 00000000
00000000 00000000 E03F0000 F83FF03F 1C383C38 1C381C38 38381C38 F03FF83F
7838F03F 1C381C38 0E380C38 0E380E38 1C380E38 F83F3C38 E03FF83F 00000000
00000000 00000000 F807F001 1C0FFC0F 001C041C 00380038 00380038 00700078
00700070 00700070 00380038 00380038 001C0038 3C0F0C1E F803FC07 0000E000
00000000 00000000 C07F0000 F07FE07F 38707870 1C703C70 1C701C70 1C701C70
1C701C70 1C701C70 1C701C70 1C701C70 38703870 F07FF870 803FE07F 00000000
00000000 00000000 FC3F0000 FC3FFC3F 00380038 00380038 00380038 FC3FF83F
0038FC3F 00380038 00380038 00380038 00380038 FC3F0038 FC3FFC3F 00000000
00000000 00000000 FC1F0000 FC1FFC1F 001C001C 001C001C 001C001C FC1FF81F
001CFC1F 001C001C 001C001C 001C001C 001C001C 001C001C 001C001C 00000000
00000000 00000000 F807E001 1C1EFC0F 00380C1C 00380038 00700038 00700070
7C700070 7C707C70 0C700C70 1C381C38 0C381C38 3C1F1C1C F807FC0F 0000C000
00000000 00000000 1C700000 1C701C70 1C701C70 1C701C70 1C701C70 FC7FFC7F
1C78FC7F 1C701C70 1C701C70 1C701C70 1C701C70 1C701C70 1C301C70 00000000
00000000 00000000 F83F0000 F83FF83F 80038003 80038003 80038003 80038003
80038003 80038003 80038003 80038003 80038003 F83F8003 F83FF83F 00000000
00000000 00000000 F00F0000 F007F00F 70003000 70007000 70007000 70007000
70007000 70007000 70007000 70003000 70407000 F0797060 C03FE07F 00000007
00000000 00000000 0E700000 3C701C70 70703870 E071E070 8073C071 007F0077
807F807F C079C079 E070E070 70707070 3C703870 1E701C70 0F300E70 00000000
00000000 00000000 00380000 00380038 00380038 00380038 00380038 00380038
00380038 00380038 00380038 00380038 00380038 FE3F0038 FE1FFE3F 00000000
00000000 00000000 3CF00000 3CF83CF0 7CF83CF8 6CEC6CF8 CCECCCEC CCE6CCEC
8CE7CCE7 8CE38CE7 0CE00CE3 0CE00CE0 0CE00CE0 0CE00CE0 0CE00CE0 00000000
00000000 00000000 1CF00000 1CF81CF0 1CFC1CF8 1CEC1CFC 1CEE1CEE 1CE71CE6
9CE31CE7 9CE19CE3 DCE1DCE1 FCE0DCE0 7CE0FCE0 7CE07CE0 3CE03CE0 00000000
00000000 00000000 E00FC003 781EF01F 1C38383C 1C381C38 1C701C30 0E701C70
1E701E70 1C701E70 1C701C70 1C381C38 1C381C38 781E381C E007F00F 00008001
00000000 00000000 F03F0000 FC3FF83F 1E381C38 0E380E38 0E380E38 1C380E38
FC3F3C38 E03FF83F 00380038 00380038 00380038 00380038 00380038 00000000
00000000 00000000 F00FC003 781CF01F 1C383838 1C381C38 1C701C70 0E701C70
1E701E70 1C700E70 1C701C70 1C381C38 38381C38 F01F781C E003E00F 38007000
10003800 00000000 E03F0000 F83FF03F 3C383830 1C381C38 1C381C38 38301C38
F03FF83F F03FE03F 38387030 1C383838 1C381C38 0E380E38 07300E38 00000000
00000000 00000000 F80FE003 383CF81F 00380838 00700030 00380070 803F003C
F00FE01F 7C00F803 1C001C00 0C001C00 1C001C00 783C3C30 F01FF83F 00008003
00000000 00000000 FFFF0000 FE7FFFFF 80038001 80038003 80038003 80038003
80038003 80038003 80038003 80038003 80038003 80038003 80018003 00000000
00000000 00000000 1C380000 1C381C38 1C381C38 1C381C38 1C381C38 1C381C38
1C381C38 1C381C38 1C381C38 1C381C38 1C381C38 781E1C38 F00FF81F 00008001
00000000 00000000 0E700000 0E700E70 1C380E70 1C381C38 18181C38 381C381C
381C381C 700E300C 700E700E 60066006 E0076006 C003E007 C003C003 00000000
00000000 00000000 07E00000 07E007E0 07E007E0 86610660 C663C663 CE73CE73
CE72CE73 6C366E76 6C366C36 7C3E6C36 3C3C3C3C 3C3C3C3C 381C381C 00000000
00000000 00000000 0E700000 1C380E38 381C1C1C 700E380E E0077006 C003E003
C003C001 E007E003 700E6007 381C300E 1C38381C 0E701C38 07E00E70 00000000
00000000 00000000 0E700000 1C300E70 18381C38 381C381C 700E700E E0076006
C003C003 80018003 80038003 80038003 80038003 80038003 80018003 00000000
00000000 00000000 FE3F0000 FE3FFE3F 1C001C00 38003800 70007000 E000E000
C001C001 80038003 00070007 000E000E 001C001C FE3F0038 FE3FFE3F 00000000
00000000 F801F801 C001C001 C001C001 C001C001 C001C001 C001C001 C001C001
C001C001 C001C001 C001C001 C001C001 C001C001 C001C001 F801F801 00000000
00000000 00000000 00000000 00380070 001C0038 000C001C 000E000E 00070007
80038003 C0018001 E000C001 7000E000 30007000 38003800 1C001C00 00000000
00000000 C00F800F C001C001 C001C001 C001C001 C001C001 C001C001 C001C001
C001C001 C001C001 C001C001 C001C001 C001C001 C001C001 800FC00F 00000000
00000000 00000000 00000000 00000000 00000000 C003C003 F007E007 781E700E
1C38381C 0E700E70 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 FFFF0000 FFFFFFFF 00000000
00000000 00000000 C001C000 C001C001 80038003 80038003 80038003 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 E01F0001 783CF03F 18003830
1C001C00 FC1FFC07 1C38FC3F 1C701C30 3C701C70 FC3C3C38 DC1FDC3F 00000007
00000000 00000000 00380038 00380038 00380038 E03B8038 783EF03F 1C38383C
1C381C38 0C380C38 0C380C38 1C380C38 1C381C38 783E383C F03BF03F 0000C001
00000000 00000000 00000000 00000000 00000000 F8034000 1C0FFC07 001C0C1E
00380018 00380038 00380038 00380038 001C0018 1C0F041E F803FC07 0000E000
00000000 00000000 1C001C00 1C001C00 1C001C00 DC0F1C01 FC1EFC1F 3C383C38
1C301C38 1C701C70 1C701C70 1C301C70 3C381C30 7C1C3C38 DC0FFC1F 00000003
00000000 00000000 00000000 00000000 00000000 E0078000 781EF00F 1C381C1C
0E300C38 FE7FFE7F 0070FC7F 00300070 00380038 3C1E041C F807FC0F 0000C001
00000000 00000000 FC01FC00 8003F801 80038003 FC3F8003 F81FFC3F 80038003
80038003 80038003 80038003 80038003 80038003 80038003 80038003 00000000
00000000 00000000 00000000 00000000 00000000 DC0F0001 7C1CFC1F 1C383C38
1C701C30 1C701C70 1C301C70 3C381C30 FC1F3C3C 9C07DC0F 18001C00 F01C3800
C00FF01F 00000000 00380038 00380038 00380038 F03B4038 F83FF03B 1838383C
1C381C38 1C381C38 1C381C38 1C381C38 1C381C38 1C381C38 1C381C38 00000000
00000000 00000000 C000C000 C000C000 00000000 C00F0000 C00FC00F C000C000
C000C000 C000C000 C000C000 C000C000 C000C000 FC0FC000 FE1FFE1F 00000000
00000000 00000000 C0018000 C001C001 00000000 C01F0000 C001C01F C001C000
C001C001 C001C001 C001C001 C001C001 C001C001 C001C001 C001C000 801FC001
003F803F 00000000 001C001C 001C001C 001C001C 1C1C001C 381C3C1C E01C701C
C019C019 C01F801F E01CC01F 7018E01C 381C701C 1C1C1C1C 0E180E1C 00000000
00000000 800F0000 801F801F 80018001 80018001 80018001 80018001 80018001
80018001 80018001 80018001 80018001 C0018001 FC00C001 7C00FE00 00000000
00000000 00000000 00000000 00000000 00000000 786F1000 DC7BFC7F 8E718E73
8E618E71 8E718E71 8E718E71 8E718E71 8E718E71 8E718E71 8E618E71 00000000
00000000 00000000 00000000 00000000 00000000 F03B4000 F83FF03B 1838383C
1C381C38 1C381C38 1C381C38 1C381C38 1C381C38 1C381C38 1C381C38 00000000
00000000 00000000 00000000 00000000 00000000 E0070001 781EF00F 1C38383C
1C301C38 1C701C30 0C701C70 1C301C30 1C381C38 781E383C E00FF00F 00008001
00000000 00000000 00000000 00000000 00000000 F03B8000 383EF83F 1C381C3C
0C381C38 0C380C38 1C380C38 1C381C38 783E383C E03BF03F 00380038 00380038
00380038 00000000 00000000 00000000 00000000 DC0F0001 7C1CFC1F 1C383C38
1C301C30 1C701C70 1C301C70 3C381C38 FC1E3C38 9C07FC0F 1C001C00 1C001C00
1C001C00 00000000 00000000 00000000 00000000 7E061000 FE0FFE0E 000F820F
000E000F 000E000E 000E000E 000E000E 000E000E 000E000E 0006000E 00000000
00000000 00000000 00000000 00000000 00000000 F0078000 381EF80F 0018081C
001C0018 E01F001E F803F00F 18007800 18001C00 781C3810 E01FF01F 00008003
00000000 00000000 00000000 00070007 00070007 F83F0007 F83FF87F 00070007
00070007 00070007 00070007 00070007 00070007 F8038003 F800F803 00000000
00000000 00000000 00000000 00000000 00000000 1C380000 1C381C38 1C381C38
1C381C38 1C381C38 1C381C38 1C381C38 1C181C38 7C1E3C1C DC0FFC1F 00000003
00000000 00000000 00000000 00000000 00000000 0E700000 1C300C70 1C381C38
381C1818 301C381C 700E300C 6006700E E0076006 C003E007 C003C003 00000000
00000000 00000000 00000000 00000000 00000000 03C00000 07E007E0 066007E0
8E718661 CE73CE73 CC33CC33 4C324C32 7C3E7C3E 381C781E 381C381C 00000000
00000000 00000000 00000000 00000000 00000000 0C300000 381C1C38 700E381C
E007700E C003C003 C003C003 6006E007 381C700E 1C38381C 0E701C38 00000000
00000000 00000000 00000000 00000000 00000000 0E700000 0C380E30 1C181C38
381C181C 300E380C 7006700E E0036007 C003E003 C001C001 80038001 001F0003
003C003E 00000000 00000000 00000000 00000000 FC1F0000 FC1FFC1F 38003800
E0007000 C001E000 8003C001 00070007 000E000E F83F001C FC1FFC3F 00000000
00000000 FC007800 C001E001 C001C001 C001C001 C001C001 C001C001 003F8003
001F003E C0018003 C001C001 C001C001 C001C001 E001C001 7C00FC00 00000000
00000000 C001C001 C001C001 C001C001 C001C001 C001C001 C001C001 C001C001
C001C001 C001C001 C001C001 C001C001 C001C001 C001C001 C001C001 00000000
00000000 001F001E 80038007 80038001 80038003 80038003 C0018001 FC00C001
FC007C00 C001C001 80038001 80038003 80018003 80078003 001E001F 00000000
00000000 00000000 00000000 00000000 00000000 000C0000 003F003E 8763027F
CEC1C7E1 7C00FE40 00003800 00000000 00000000 00000000 00000000 00000000
00000000
End DefineFont


Edited by matherp 2016-03-10
 
viscomjim
Guru

Joined: 08/01/2014
Location: United States
Posts: 925
Posted: 01:12am 10 Mar 2016
Copy link to clipboard 
Print this post

Matherp, this is AWESOME. What a great project. I really like the LCD layout on this.
 
centrex

Guru

Joined: 13/11/2011
Location: Australia
Posts: 320
Posted: 11:46pm 11 Mar 2016
Copy link to clipboard 
Print this post

Hi Peter
Do you have a bom for the power supply.
Cliff
 
MicroBlocks

Guru

Joined: 12/05/2012
Location: Thailand
Posts: 2209
Posted: 12:01am 12 Mar 2016
Copy link to clipboard 
Print this post

This is great stuff. I would like to make something a bit simpler and only control the current.
I only have the high side available for measuring current.
Which parts do i need to be able to make it only current limiting.
It will be a fixed input. 5v from either the USB or a voltage regulator.

What process do you use to calibrate the PWM to get the right current?
Do you measure it against another instrument? How?
Edited by MicroBlocks 2016-03-13
Microblocks. Build with logic.
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10215
Posted: 12:45am 12 Mar 2016
Copy link to clipboard 
Print this post

  Quote  Do you have a bom for the power supply.


Just the circuit diagram above. There are just three unusual components:

INA139 (or INA169) high side current shunt amplifier for current measurement
LM334 current source to provide a minimum load to maintain voltage regulation
LT3080 linear regulator

In addition there are a couple of 2N3904 npn transistors, an LM358 opamp, the Micromite, the ILI9341 display and a bunch of passives

  Quote  I only have the high side available for measuring current.


No issue this is what the circuit uses

  Quote  Which parts do i need to be able to make it only current limiting.


Pretty much everything except the PWM output that sets the voltage and one half of the opamp

  Quote  What process do you use to calibrate the PWM to get the right current?


You can set it theoretically first. The INA139 is set for a gain of 5 and uses a 0.5ohm shunt resistor (2 x 1-ohm in parallel). Therefore at 1 amp I drop 0.5V across the shunt so I get an output of 2.5V to the Micromite. To limit at this I set the PWM to output 2.5V. i.e. a duty cycle of 2.5/3.3.

If the measured current gets above 1 amp the opamp switches the transistor which reduces the input to the regulator.

So to set 0.1 amp I use a pwm duty cycle of 0.25/3.3

I then use my multimeter in series with a load resistor on the output to fine tune things
 
centrex

Guru

Joined: 13/11/2011
Location: Australia
Posts: 320
Posted: 11:13pm 15 Mar 2016
Copy link to clipboard 
Print this post

Hi Peter

Are you able and or willing to put the Gerber files for the power supply on the forum.

Thanks
Cliff.
Cliff
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10215
Posted: 11:52pm 15 Mar 2016
Copy link to clipboard 
Print this post

  Quote  Are you able and or willing to put the Gerber files for the power supply on the forum.


yes of course but they haven't been built/tested other than that the netlist when converted to stripboard works. The other issue is that I just made the board a default 10x10 size. It really should be made to fit a specific box.

2016-03-16_095253_PSuM2.zip
 
centrex

Guru

Joined: 13/11/2011
Location: Australia
Posts: 320
Posted: 02:29pm 18 Mar 2016
Copy link to clipboard 
Print this post

Hi Peter
I have been comparing the gerbers in particular the top layer and the picture of the pcb layout you posted.
The tracks around the INA139 do not appear to follow the circuit diagram or the gerber.

I know you are probably more interested in the ahrs but if you could spare a moment to have a look and comment it would be appreciated.
Thanks








Edited by centrex 2016-03-20
Cliff
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10215
Posted: 10:36pm 18 Mar 2016
Copy link to clipboard 
Print this post

Cliff

I made a minor change to the circuit diagram during development

2016-03-19_082852_PSuM2.pdf

to power the INA139 from VIN rather than 3.3V. This just reduces the common mode voltage of the shunt resistors relative to the chip.

The gerbers should have been inline with the version of the diagram above. Anyway here they are again

2016-03-19_083338_PSuM2.zip

My working stripboarded version is definitely in-line with this version of the diagram and the PCB layout has been checked against the schematic in DesignSpark which produced the gerbers.Edited by matherp 2016-03-20
 
centrex

Guru

Joined: 13/11/2011
Location: Australia
Posts: 320
Posted: 12:25pm 19 Mar 2016
Copy link to clipboard 
Print this post

Thanks Peter
But I cannot get the pin layout of the INA139 to fit the gerber.
This is the pin layout I have, top view according to the data sheet from TI



Doesnt seem to matter which way I position the chip nothing makes sense.
Please enlighten me.Edited by centrex 2016-03-20
Cliff
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10215
Posted: 11:40pm 19 Mar 2016
Copy link to clipboard 
Print this post

I've found the problem. The component that Designspark downloaded from RS had the PCB footprint pins incorrectly labelled relative to the schematic. I'm using a sot32 DIL adapter on the stripboard so made my own footprint in VEECAD to match the pin assignment as per the TI datasheet. It didn't occur that the download was incorrect although this isn't the first time - never trust relay layouts!!!!

Great catch

Try this version

2016-03-20_093422_PSuM2.zip Edited by matherp 2016-03-21
 
centrex

Guru

Joined: 13/11/2011
Location: Australia
Posts: 320
Posted: 11:44pm 19 Mar 2016
Copy link to clipboard 
Print this post

Thanks Peter
Now to see about getting some boards made.
Cliff
 
bigmik

Guru

Joined: 20/06/2011
Location: Australia
Posts: 2949
Posted: 07:44pm 20 Mar 2016
Copy link to clipboard 
Print this post

Hi Peter,

  matherp said   I'm using a sot32 DIL adapter


I assume this part is SOT23 not SOT32? From my searching SOT-32 is a package like a BD139 transistor would come in. (Vertical Through hole 3 leg in line)

Regards,

Mick
Mick's uMite Stuff can be found >>> HERE (Kindly hosted by Dontronics) <<<
 
centrex

Guru

Joined: 13/11/2011
Location: Australia
Posts: 320
Posted: 10:51pm 20 Mar 2016
Copy link to clipboard 
Print this post

Hi Mick yes it is a SOT23 with 5 legs, the gerbers now make sense.
There is a pm for you.

Cheers
Cliff
 
     Page 1 of 5    
Print this page
The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025