DIY Remote Control for Everyone

Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.
DIY Remote COntrol for Everyone

Azira,
Unfortunately, I do not have a very cool remote control case for this. However, the IR section is designed to decode standard Sony TV remote control codes. This means that every universal remote control on the planet should work. Therefore, it would be easy to take apart any old remote control and build a cool looking case for it or buy a cool universal remote
Cheers -ALBQ
 
hi,
i modified Albq's program to work with my pic 16F74 using PicBasicPro,and i am stuck at one line of the program!!
here is the program and a detalied picture of the error :

program:


@ DEVICE PIC16F877, XT_OSC
@ DEVICE PIC16F877, WDT_ON
@ DEVICE PIC16F877, PWRT_OFF
@ DEVICE PIC16F877, PROTECT_OFF


DEFINE OSC 4
DEFINE LCD_DREG PORTB ' Set LCD Data port
DEFINE LCD_DBIT 4 ' Set starting Data bit (0 or 4) if 4-bit bus
DEFINE LCD_RSREG PORTB ' Set LCD Register Select port
DEFINE LCD_RSBIT 1 ' Set LCD Register Select bit
DEFINE LCD_EREG PORTB ' Set LCD Enable port
DEFINE LCD_EBIT 3 ' Set LCD Enable bit
DEFINE LCD_RWREG PORTB
DEFINE LCD_RWBIT 2
DEFINE LCD_BITS 4 ' Set LCD bus size (4 or 8 bits)
DEFINE LCD_LINES 2 ' Set number of lines on LCD
DEFINE LCD_COMMANDUS 1500 ' Set command delay time in us
DEFINE LCD_DATAUS 100 ' Set data delay time 100 us
DEFINE SHIFT_PAUSEUS 2000 ' Slow clock by an additional 2000 us
DEFINE BUTTON_PAUSE 50 ' Set button debounce delay to 100ms

declarations:

i con 254
clr con 1
line1 con 128
line2 con 192
IR_in VAR PORTB.0
IR_detect var bit
IR_pulse var word(8)
IR_word var byte
index var byte
TRISA=%111111
TRISB.0=1
CS VAR PORTC.7 : high CS ' Chip select pin
SDI VAR PORTC.6 : high SDI ' Data out pin
SCLK VAR PORTC.5 : high SCLK ' Clock out pin
prev var byte
counter var BYTE
mute var BYTE
tapemon var BYTE
power var BYTE
volume var byte
setting var byte
IN2 VAR PORTA.1
IN3 VAR PORTA.2
drc var BYTE
new var BYTE
old var BYTE


'--------------------------------------------
initialize:

old.bit0=in2
old.bit1=in3

pause 2000
volume = 0
LCDOUT I,clr
prev = 99
LOW CS
pause 10
shiftout SDI,SCLK,1, [volume\8,volume\8]
pauseUS 100
high CS
PAUSEUS 100
HIGH SDI

'--------------------------------------------
main:

gosub encoder
gosub ir_scan

goto main

'--------------------------------------------
ir_scan:

IR_detect = PORTB.0
if IR_detect = 1 then end_ir_scan
gosub startbit
gosub get_pulse_stream
gosub decode
gosub function

end_ir_scan

return

'--------------------------------------------
encoder:

new.bit0=in2
new.bit1=in3
if new=old then end_encoder
drc=(new^old)&3
if power = 0 then end_encoder
if drc = 1 then countdown
if drc = 2 then countup

countdown:
if volume=0 then continue
volume = volume - 1
old=new
goto set_volume
goto end_encoder

countup:
if volume=255 then continue
volume = volume + 1
old=new
goto set_volume
goto end_encoder

continue:
old=new
goto end_encoder

end_encoder:

return

'--------------------------------------------
startbit:

for counter = 0 to 15
pulsin IR_in,0,IR_pulse(0)
if IR_pulse(0) > 900 then startbit_detected
next

startbit_detected

return

'---------------------------------------------
get_pulse_stream:

find_stopbit:
pulsin IR_in,1,IR_pulse(0)
if IR_pulse(0) > 1400 and IR_pulse(0) <> 0 then decodebits
goto find_stopbit

decodebits:
pulsin IR_in,0,IR_pulse(0)
pulsin IR_in,0,IR_pulse(1)
pulsin IR_in,0,IR_pulse(2)
pulsin IR_in,0,IR_pulse(3)
pulsin IR_in,0,IR_pulse(4)
pulsin IR_in,0,IR_pulse(5)
pulsin IR_in,0,IR_pulse(6)
pulsin IR_in,0,IR_pulse(7)

return

'---------------------------------------------
decode:

for counter = 0 to 7
lookdown IR_pulse(COUNTER), [400,800], IR_WORD.Lowbit(counter)

next

if (IR_word > 191) then main 'ignore codes to high
if (IR_word < 128) then main 'ignore code to low
if (IR_word = 128) then valid_code 'one
if (IR_word = 129) then valid_code 'two
if (IR_word = 130) then valid_code 'three
if (IR_word = 131) then valid_code 'four
if (IR_word = 132) then valid_code 'five
if (IR_word = 133) then valid_code 'six
if (IR_word = 134) then valid_code 'seven
if (IR_word = 135) then valid_code 'eight
if (IR_word = 136) then valid_code 'nine
if (IR_word = 137) then valid_code 'zero
if (IR_word = 144) then valid_code 'channel up
if (IR_word = 145) then valid_code 'channel dn
if (IR_word = 146) then valid_code 'volume up
if (IR_word = 147) then valid_code 'volume dn
if (IR_word = 148) then valid_code 'mute
if (IR_word = 149) then valid_code 'power
if (IR_word = 187) then valid_code 'Back - Tapemon
if (IR_word = 191) then valid_code 'Info
goto main

valid_code:
index=IR_word & %01111111

return

'---------------------------------------------
set_volume:

setting = abs((1 */ 8192) - (127 - abs(128 */ volume)))
LCDOUT " ", "Volume = ", dec setting, ".", dec1 setting, dec2 setting, " ", "dB"
low CS
pauseUS 100
shiftout SDI, SCLK, 1, [volume\8,volume\8]
pauseUS 100
high CS
HIGH SDI
LCDOUT i,192, "Volume"
LCDOUT i,201, "-", dec setting,".",dec1 setting,"dB"

return

'---------------------------------------------
function:

if (index ^ 21 = 0) | (power = 0) then complete
if (index < 10) then numb_keys
if (index > 10) then func_keys

numb_keys:
lookdown index, [0,1,2,3,4,5,6,7,8,9], index
if (index = prev) then complete
if (index > 2) then complete
prev = index
branch index, [S0,S1,S2,S3,S4,S5,S6,S7,S8,S9]

func_keys:
lookdown index, [11,16,17,18,19,20,21,59,63], index
branch index, [S10,S11,S12,S13,S14,S15,S16,S17,S18]

S0:
LCDOUT "P10 - input one"
LCDOUT i,clr
LCDOUT i,128,"Button One"
high PORTD.1
goto complete

S1:
LCDOUT "P11 - Input Two"
LCDOUT i,clr
LCDOUT i,128,"Button Two"
high PORTD.2
goto complete

S2:
LCDOUT "P12 - Input Three"
LCDOUT i,clr
LCDOUT i,128,"Button Three"
high PORTD.3
goto complete

S3:
goto complete

S4:
goto complete

S5:
goto complete

S6:
goto complete

S7:
goto complete

S8:
goto complete

S9:
goto complete

S10:
goto complete

S11:
index = prev + 1
pause 250
LCDOUT i,clr
LCDOUT "Channel Up"
goto numb_keys

S12:
index = prev - 1
pause 250
LCDOUT i,clr
LCDOUT "Channel Down"
goto numb_keys

S13:
if (volume >= 255) then complete
volume = volume + 1
goto set_volume

goto complete

S14:
if (volume <= 1) then complete
volume = volume - 1
goto set_volume

goto complete

S15:
mute = mute + 1
if mute = 2 then mute_off
LCDOUT i,line2,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32
LCDOUT i,192,"Mute"
high PORTC.4
LCDOUT "mute on"
return

mute_off:
mute = 0
LCDOUT i,line2,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32
LCDOUT i,192, "Volume"
LCDOUT i,201, "-", dec setting,".",dec1 setting,"dB"
low PORTC.4
LCDOUT "mute off"
goto complete

S16:
power = power + 1
if power = 2 then power_off
LCDOUT "Power On"
HIGH PORTD.0
LCDOUT i,clr
high PORTC.4
pause 1000
high PORTD.4
LCDOUT i,128,"Hello"
pause 1000
LCDOUT i,clr
LCDOUT i,128,"MY TRUE"
LCDOUT i,192,"MASTER!"
prev = 0
pause 1000
low PORTC.4
goto S0

power_off:
LCDOUT "Power Off"
LCDOUT i,clr
LCDOUT i,128,"Good Bye"
pause 100
LCDOUT i,clr
pause 100
LOW PORTD.4
volume = 0
low CS
pauseUS 100
shiftout SDI, SCLK, 1, [volume\8,volume\8]
pauseUS 100
high CS
power = 0
return

S17:
tapemon = tapemon + 1
if tapemon = 2 then tapemon_off
LCDOUT "Tapemon - On"
LCDOUT i,line2,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32
LCDOUT i,192,"Tape Monitor"
high PORTD.0
goto complete
tapemon_off:
LCDOUT "Tapemon - Off"
tapemon = 0
LCDOUT i,line2,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32
LCDOUT i,192, "Volume"
LCDOUT i,201, "-", dec setting,".",dec1 setting,"dB"
low PORTD.0
goto complete

S18:
goto complete

complete

return


and i atached the picture!
Hope u can help me with this code...cheers.
 
Summary,
Suggestion was to build a remote controlled preamplifier using a Basic microcontroller such as a BasicStamp, BasicAtom or BasicX microcontroller. Although slower than a PIC or Ubicom, the controller can be programmed in basic using free downloadable software. The advantage of such a solution for the DIY community is that it takes minimal software knowledge to get it working and, can be easily modified at by the end user. This means that once a basic design is developed, people are free to build upon it.

Oh, on your question, was thinking more along the lines of IR remote but, hey - its for everyone so, why not

Cheers -ALBQ

An externally hosted image should be here but it was not working when we last tested it.

Hello,
I would like to build this Controller, Would appreciate if you could pass the details of pcb layout, bom and any updates.

Thank you
 
Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.