PDA

View Full Version : Wired remote for Pioneer HU



fratello
- 28th July 2011, 17:38
Hi ! I try to build one wired remote for HU Pioneer , using remote control stalk near the steering wheel, from Renault. I wrote the code ; in simulation work fine. But...I don't know how setting ports "b" and what to do when push_button it's press.
In "original" remote, the command are given by putting resistors "to ground". How can I do this with my PIC ? Thanks in advance !

@ DEVICE pic16F628A, INTRC_OSC, WDT_OFF, PWRT_OFF, BOD_OFF, MCLR_ON, LVP_OFF, CPD_OFF, PROTECT_OFF


Include "modedefs.bas" ' Serial Protocol
Define OSC 4 ' 4MHz
CMCON = 7 ' Disable on-chip comparator, PORTA in digital mode

'// Define port pins as inputs and outputs ...
TRISA = %00000111
TRISB = %11111100

portb = 1
include "c:\pbp\keypad2.pbp" ' see http://www.picbasic.co.uk/forum/showthread.php?t=3250

main:
gosub keypadscan
gosub check
goto main

check:
select case key
case 1 ; volume down
trisb.2=0 ; ?????
pause 200 ;
trisb.2=1 ' ?????

mister_e
- 28th July 2011, 18:01
one thing I would make sure before connecting this to the car... measure the .spurious/floating) voltage on the tip pin when nothing it pluged.. if it's 12 volt you want to change some part of your hardware. Case it's 5 volts (or so), well there's no problem with your current solution

What you need to do is to clear the PORTB bits (to 0) and set your TRISB bits to 0 when you want to set a resistor to ground, and to 1 when you want to disconnect the resistor from the circuit. The more you clear TRSIB bits, the more resistor you add in parrallel. You should know how to calculate/evaluate resistors in parrallel, so, just etablish some value and work around this. Maybe you don't need more than 3-4 resistor to reproduce the whole value in the table above. If you feel lazy, then use 8 resistor and assign them to a whole 8 bits port. easier, need a bit more I/O... but easier. BTW you already get the idea as per your code.

8 resistors, 6 button = 14 I/O, a PIC 16F628 will do the trick without any need for a matrix keypad.


Button1 VAR PORTA.0
Button2 VAR PORTA.1

IF Button1=0 then set your resistor on portb
If Button2=0 then set your resistor on portb
.....or

Button var PORTA
Select Case Button
Case xyz
Set yourresistor
Case abc
Set another resistor
....
How about that?

fratello
- 28th July 2011, 18:29
Thank You verry much for support !
I use matrix keypad because the Renault remote act like one (see picture) !

What you need to do is to clear the PORTB bits (to 0) and set your TRISB bits to 0 when you want to set a resistor to ground, and to 1 when you want to disconnect the resistor from the circuit.
So, it's enough (?) something like this :

case 1
portb.2=0
trisb.2=0
pause 500 ; i put the resistor on portb.2 to ground for 0.5 sec
portb.2=1
trisb.2=1The "portb" it's OK to set in header "PORTB=%11111100" ?

pedja089
- 28th July 2011, 19:06
Set all pin to low, and then just change tris registers, instead of changing port and tris.
Also add 5.1V zener between resistor common wire and ground.

fratello
- 28th July 2011, 19:43
Now it's ok ?

'// Define port pins as inputs and outputs ...
TRISA = %00000111
TRISB = %00000000


include "c:\pbp\keypad2.pbp" ' see http://www.picbasic.co.uk/forum/showthread.php?t=3250

main:
gosub keypadscan
gosub check
goto main

check:
select case key
case 1 ; volume down
portb.2=0
pause 500 ; i put the resistor on portb.2 to ground for 0.5 sec
portb.2=1

mister_e
- 28th July 2011, 20:13
PORTB=0
TRISB = 255 ' Disconnect all resistors from the circuit
' Some code here
DoItAgain:
SELECT CASE XYZ
CASE ABC
TRISB.0 = 0 ' Connect PORTB.0 resistor to the circuit
CASE DEF
TRISB.0 = 0 ' Connect PORTB.0 resistor to the circuit
TRISB.1 = 0 ' Connect PORTB.1 resistor to the circuit
CASE GHI
TRISB.0 = 0 ' Connect PORTB.0 resistor to the circuit
TRISB.2 = 0 ' Connect PORTB.2 resistor to the circuit
TRISB.3 = 0 ' Connect PORTB.3 resistor to the circuit
END SELECT
PAUSE 500
TRISB = 255 ' Disconnect all resistors
GOTO DoItAgain

fratello
- 28th July 2011, 20:37
THANK YOU ALL !

@ DEVICE pic16F628A, INTRC_OSC, WDT_OFF, PWRT_OFF, BOD_OFF, MCLR_ON, LVP_OFF, CPD_OFF, PROTECT_OFF


Include "modedefs.bas" ' Serial Protocol
Define OSC 4 ' 4MHz
CMCON = 7 ' Disable on-chip comparator, PORTA in digital mode

'// Define port pins as inputs and outputs ...
TRISA = %00000111
PORTB=0
TRISB = 255 ' Disconnect all resistors from the circuit


include "c:\pbp\keypad2.pbp" ' see http://www.picbasic.co.uk/forum/showthread.php?t=3250

main:
gosub keypadscan
gosub check
goto main


check:
select case key
case 1 ; volume down
trisb.2=0

case 2 ; track -
trisb.3=0

case 3 ; volume up
trisb.4=0

case 4 ; mute
trisb.5=0

case 5 ; source
trisb.6=0

case 6 ; track +
trisb.7=0

end select
Pause 500 ' do it for 0.5 sec
TRISB = 255
Return

end 'of story !

mister_e
- 28th July 2011, 21:13
Time to celebrate!

http://toons.artie.com/alphabet/words/arg-dancin-wo0hoo-url.gif


This code is...

http://www.cdloanmod.com/images/articles/tips-get-approved-for-loan-modification.jpg

fratello
- 22nd May 2012, 13:52
Scheme, as conceived above, does not work !!! I put opto-couplers at PIC outputs and work fine ...
What could cause it does not work in this hardware ? Need to manage some (others) PIC registers ? Regards !

ScaleRobotics
- 22nd May 2012, 14:25
I'm confused. So, your big thank you a year ago, (and the happy dance by Steve) was for code you couldn't get working? Or you didn't try the code until now? Perhaps more explanation is required, at least for me. :)

fratello
- 22nd May 2012, 15:19
Yes, I have not tested this scheme until yesterday ... and how I say, I found that does not work ! Even if my ohm-meter show "right" value of resistances ( at every press of buttons) the HU not react ; with optocouplers all are ok. Strange for me...The hardware it's finished, but remains my astonishment about this. Thanks for reply !

Archangel
- 27th May 2012, 23:27
Welllll Fratello, it seems you've been bitten by a simulator ?
One hint from Steve's code's comments . . . " MUST USE MPASM " . . . Your configs indicate PB assembler.

fratello
- 28th May 2012, 07:24
Thanks for reply !
I do not think I understood very well ...What that means "MUST USE MPASM" ?!
Trisx.y in PBP it's not like trisx.y in assembler ?

mackrackit
- 28th May 2012, 15:28
Read
http://www.picbasic.co.uk/forum/showthread.php?t=543

And stop using the simulator, or at least let everyone kow that you are when you post a problem.

fratello
- 28th May 2012, 16:37
Thanks You so much for support ! Are some thinks I dont understand (too ...) ...
1. I dont use MPASM in code.
2. My astonishment it's about non-function of this hardware ! If I connect JUST the resistor on jack, the HU react ! If I use same resistor -via optocoupler - the HU react ! But with PIC, dont !
I increased the time for each tris command, but without results !


case 1 ; volume down
trisb.2=0
Pause 5000 ; I try even with this huge pause !
trisb.2=1
...
endcase

mackrackit
- 28th May 2012, 16:48
I am not familiar with the HU, but if you post the current hardware schematic (PIC, opto, HU) someone may be able to spot the problem.

fratello
- 28th May 2012, 18:53
So...with schematic from post #1 - no results !
With a simple resistor - good results ; with optocouplers - good results too.

fratello
- 28th May 2012, 19:58
...and how an "original" remote work :

HenrikOlsson
- 29th May 2012, 06:16
Hi,
I haven't studied this thread in detail but if the idea is to "place a resistance" across the plug then I don't think you can run the same code (if that's what you're doing) with the two different hardware designs. When using the circuit with the opto-isolators you drive the PIC-pin high in order to turn on the opto-isolator and connect the associated resistor across the plug - and if I read your posts correct this works fine.

It's not exactly clear to me how the plug is connected to the circuit in post#1 but it looks to me as if this circuit doesn't work the same way as the one with the opto-isolators. So, if you're trying to run the same code with the two circuits my guess is that's where your problem is.

/Henrik.

fratello
- 29th May 2012, 06:40
Thanks for support, Mr.Henrik !
When I switch to optocouplers, I changed code :


case 1 ; volume down
Portb.2=1
Pause 100
Portb.2=0
My "sources of inspiration" was here : http://www.panuworld.net/minidisc/fordsony/index.htm & http://www.fiatforum.com/marea/29682-marea-steering-wheel-remote-2-sony-adapter-finished.html

Archangel
- 29th May 2012, 06:54
Thanks for reply !
I do not think I understood very well ...What that means "MUST USE MPASM" ?!
Trisx.y in PBP it's not like trisx.y in assembler ?
Must use the MPASM assembler from Microchip, and not the PB assembler supplied with PBP. I am betting the simulator defaults to using MPASM and simply ignores the PB configs altogether. So when you run it, it knows what to do with Steve's keypad code whereas PB does not.Most of Steve and Darrel's code samples require MPASM, and when you upgrade to PBP3 it ONLY uses MPASM, so it is a worthwhile change.

Sandiki
- 11th April 2013, 11:40
Hi,

did any of you build adapter for stalk steering wheel controls on renault (tuner list stereo instalation, mine laguna year 2002) for pioneer? I saw scheme above but i dont know how to wire it in little yellow miniISO 6-pin jack that is connected on steering wheel controls? Any help?

Thank You in advance.

jamie_s
- 19th April 2013, 05:44
the reason the original design doesnt work is due to parallel resistors not giving the required voltage at the stereo plug (due to voltage divider effects), by using opto's you are supplying discreet resistances which results in the correct voltages