Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Ascending descending one push light dimmer

Status
Not open for further replies.

lotfi17

New Member
Any hint thanks: Probably wil use the triac dimmer shema but without potencimeter, but how to? one push botton power on will increase(light) from expl. 20% and up to 100% and when release botton power off (light) decreases from 100% to back 20%.

Regards
 
Thanks I would use the pic16f877 and I may have the codes but how controlling triac with digital pot I guess? when power on=power increase simultinus and stops when reachs 100%, and when power Off= power decrease simultinus and stop when reach 0% or off.
 
Here is a link you may want to check out.
https://www.lsicsi.com
They have several custom IC products that may fit your needs in the dimming department, and price is not too bad, around +- $2.50 each thru one of their distributors.
Dialtone
 
lotfi17 said:
Thanks I would use the pic16f877 and I may have the codes but how controlling triac with digital pot I guess? when power on=power increase simultinus and stops when reachs 100%, and when power Off= power decrease simultinus and stop when reach 0% or off.

Bit big for a light dimmer :lol: how about a 12F675 instead?.

If you check the MicroChip application notes, there are details about light dimmers!.
 
try this simple PIC12F675
maxbright is "full light" and minbright is 'low light"
you can change repeat ... until loop, depending on you PIC skils and make the proper changes
have fun
' 1MHz*64=64usec ca si tact
' 0.01/64usec=156,25 pasi
' deci Mindelay=0 si maxdelay=156 pentru 50Hz
' in acest caz prescallerul este 64 deci OPTION_REG=0x0x0101
' in acest caz bitul de overflow este INTCON.2 si se curata soft
' resetul TMR0 se face soft
' incarcarea TMR0 se face soft
' merge face sesizare intreruperi si tot restul! E FAIN!
' INITIALIZARE MCU
'
' initializare TS pe porturi
TRISIO = %00001111
'
OPTION_REG=%10000101 ' Enable pull-ups a fost 11000101
WPU=%00000111 ' Enable pull-ups on GP0, GP1
CMCON=7 ' Disable analog comparator
ANSEL=0 ' Disable analog converter
IOC.2=1
' initializare intreruperi la start numai cele pe GPIO2/INT
INTCON=%01011000
Pb_Inc var GPIO.0 ' Input for INCREMENT/ON push button
Pb_Dec var GPIO.1 ' Input for DECREMENT/OFF push button
ACline var GPIO.2 ' Input for the FullWave rectify AC line
Triac var GPIO.5 ' Output to TRIAC gate
Led var GPIO.4 ' Led output
delay var byte
onoff var bit
count_up var byte
count_dn var byte
maxbright var byte
minbright var byte
pas var byte
stare var bit
var1 var byte
prag var byte
pas1 var byte

maxbright=230
minbright=90 ' a fost 100
triac=0
delay=minbright
pas=20 ' a fost 25
pas1=2
onoff=0
count_up=0
count_dn=0
stare=0
var1=0
prag=6
on interrupt goto intrerupere
'
loop0:
gosub sunet1
triac=1
pause 500
triac=0
pause 500
triac=1
pause 500
triac=0
gosub sunet2
'
loop1:
' rutina de lighton
if pb_inc=0 or pb_dec=0 then
gosub sunet1
onoff=1
repeat
if stare=0 then
delay=delay+1
stare=1
endif
until delay=maxbright
else
goto loop1
endif
'
start:
' rutina de dimmon si dimmoff
if delay<=minbright then
onoff=0
'goto loop1
else
onoff=1
endif
if pb_inc=0 and delay<maxbright then
if stare=0 and count_up>=pas then
var1=var1+1
if var1=prag then
delay=delay+1
var1=0
endif
count_up=25
stare=1
else
endif
else
if count_up>pas1 and count_up<pas and delay<maxbright then
' count_up=0
goto lighton
else
endif
endif

if pb_dec=0 and delay>minbright then
if delay=(minbright+1) then
goto start
endif
if stare=0 and count_dn>=pas then
var1=var1+1
if var1=prag then
delay=delay-1
var1=0
endif
count_dn=25
stare=1
else
endif
else
if count_dn>pas1 and count_dn<pas and delay>minbright then
' count_dn=0
goto lightoff
else
endif
endif
goto start
'
'
'
lighton:
repeat
count_up=0
if stare=0 then
delay=delay+1
stare=1
endif
until delay=maxbright
goto start

'
lightoff:
repeat
count_dn=0
if stare=0 then
delay=delay-1
stare=1
endif
until delay=minbright
onoff=0
gosub sunet2
goto loop1


sunet1:
sound led,[102,5,104,5,106,5,108,5,110,5,112,5,114,5,116,5,118,5,120,5,122,5,124,5,126,5]
return
'
sunet2:
sound led,[126,5,124,5,122,5,120,5,118,5,116,5,114,5,112,5,110,5,108,5,106,5,104,5,102,5]
return
'
disable
intrerupere:
' pe acline
if INTCON.1=1 then
INTCON.7=0
INTCON.1=0
TMR0=delay
INTCON.5=1
INTCON.4=0
INTCON.7=1
stare=0
led=not onoff
else
endif
' pe TMR0
if INTCON.2=1 then
INTCON.7=0
INTCON.2=0
if onoff=1 then
triac=1
else
triac=0
endif
if pb_inc=0 then
count_up=count_up+1
else
endif
if pb_dec=0 then
count_dn=count_dn+1
else
endif
if pb_inc=1 and pb_dec=1 then
count_up=0
count_dn=0
endif
triac=0
else
endif
INTCON.7=1
resume
enable
 
i think there was an application note for PIC12C508...
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top