Wednesday, 26 February 2014

CD Changer emulator

PIC version based on vwcdpic project

 Edit: better look for this
 
UPDATE: simple boards are for sale (1Euro for board + shipping), also asembled emulators + simple cable with jack (tested wvcdpic + audio cable = 10euros + shipping ), contact me on email if you are interested, also I can send preprogramed pic +2E



I sell on Tindie

originaly this was on fritzing project page. There is lot of "files" so i make it clear here, I hope:

whole project is build around www.k9spud.com/vwcdpic/ project (mirror,mirror of devel site) , which was realease under gpl (2 I thing ...)

There are 3 firmware version:
v1: for large 16pin pic ... don't care
v2:
  • for pic12f629
  • source code provided
  • serial output, easy to handle with arduino
  • has bug with serial comuniaction, selecting CD3,4,5,6 send always command 0xd3 (cd3 selected), but fix is sipple,fixed pic asm is on my github
  • is buggy(don't use it!) on blaupunkt chorus1 and  concert1 not on philips concert1
v3:
  • for pic12f629
  • just hex
  • serial output but with bug in serial communication (can't fix, no source code)
  • is buggy(don't use it!) on blaupunkt chorus1 and  concert1 not on philips concert1

I don't know what's real diffrence in v2 and v3 code, except used pins.

I use buggy version 3 of fimrware only for emulating CD changer, without controling anything else and fixed version 2 to comunicate with arduino, which then I used to controling HTC phone and BT module.

When I start to search about this, I found that guys form cz skoda forum are doing this fake changer, they add power control to "switching" permament +12V ...... so I take their design and used it. After some builds, and research how to use this emulator with old audi chorus unit, I realize that BSP452 which is used to switch and provide stable 12V on ACC pin is capable of 0.7A as minimum, so I remove whole "power switch" and drive it whole directly from radio ACC pin.

Also audio amlifier is better not to be used, lot of noise etc... I try a lot of shielding, koax kables and design , and then I just give up. Best is to use simple emulator made on universal board, just like next picture, and connect audio directly to coresponding pins on radio CD changer connector. If you relly want to use regural PCB go with smd version down there and just "cut" audio part.
 
Simple version
for compiling pic asm: gpasm xxxx.asm

for burning I use http://rweather.github.io/ardpicprog/

Emulators with audio amlifier

kicad files
fritzing files
Schematics, for firmware v3
PCB is just remake of PCB which was on k9 site:


kicad version build


fritzing version

Separated audio ground filling, to try killing the noise comming from comunication PIC<->radio. but it don't fix it :(. This can be easy converted to "just emulator" version.
edit: after a while I connect audio ground with separate cable to chassis and it fix noise problem, so as always, problem was ground loop. ...




HTC support

files on gitbut, also with instruction

this use v3 of firmware, because there is just "play/pause" on headphone remote control, so bug in firmware is not problem

Bluetooth support

files on gitbut, also with instruction

problem with this BT module is in handling incoming call (or its bug in my HTC) after "pickup" it disconected from phone.




only pic I have :)


currently im doing "sniffer" for pic version,  so I can update shyd version of emulator on atmega. I do this because on chorus1 and concert1, there is som sort of bug, which some time lock radio in strance mode, when radio still send one command and do not want to recognize fake changer :)

ATMEGA version


based on SHYD work, ported to arduino (ATMEGA168,328 and also works with ATMEGA8 -1$ on ebay). Works with 16MHz Xtal and also with internal 8MHz RC oscilator (tested) - set CPU_SPEED to cpu clock value in MHz more about this in newer post

connection of arduino to HU


code on github

53 comments:

  1. Hi
    Great project, much respect :)
    Im wondering, will it work with Alfa Romeo/Fiat radio units?
    Pinouts are basically the same. I need to build sth like this for Alfa Romeo since there is no possibility to play any external source

    ReplyDelete
    Replies
    1. look at this

      https://github.com/Andrea81/CDCemu

      Delete
    2. Thank you, I saw this before.
      If im right this is orginal site of that project http://forum.stiloclub.it/viewtopic.php?f=15&t=25667#wrapheader
      but I wanted something on avr or pic to be as simple as your project :)

      Delete
  2. Hi
    Great project, much respect :)
    Im wondering, will it work with Alfa Romeo/Fiat radio units?
    Pinouts are basically the same. I need to build sth like this for Alfa Romeo since there is no possibility to play any external source

    ReplyDelete
  3. Dobry den mal by som zaujem o ten cd changer simulator na passat radio je delta 6. Potreboval by som vediet ci k hotovemu simulatoru je este potrebne pripojit kabel s jack conektorom osobitne dakujem.

    ReplyDelete
    Replies
    1. Ahoj,

      vidim, ze si uz zadal objednavku na tindie, poriesime to teda tam.

      t.

      Delete
  4. hi,
    will it work with Renault Megane 2 Tuner list radio units?

    ReplyDelete
    Replies
    1. take a look on this post: http://www.instructables.com/id/AUX-Cable-for-Renault-Megane/

      I have green connector, so If you want one .....

      Delete
  5. Hi Tomas! I tried your code with arduino and 3 button control android headphone. The code is very good, but the control android headphone do not work. I have to enable any line of your code to operate the buttons? What is my error?
    Thanks

    ReplyDelete
  6. Hi Tomas! I tried your code with arduino and 3 button control android headphone. Your code is very good but the android buttons do not work. I have to enable any line of your code to operate the buttons? What is my error?

    ReplyDelete
  7. Please tell me which code and schematics you used then i can help you

    ReplyDelete
    Replies
    1. I use arduino uno with your code "cdc_arduino_ported_k9spud_vwcdpic_just_8bit_timers.ino", radio audi concert 1 and htc hd with headphone 3 button control. Thanks!

      Delete
    2. ok, and schematics? this one? https://github.com/tomaskovacik/hw/tree/master/kicad/arduino_based_cdc_emulator/atmegax8_dip

      cose, there is used 4066 powered with 5V, this need to by changed to 12V, just for 4066, to have lover switch resistance. otherwise it should works. I made it on bench.

      Delete
    3. Ok. Your code that I use is:
      https://github.com/tomaskovacik/arduino/blob/master/VWCDCemu/CDC_emulator/cdc_arduino_ported_k9spud_vwcdpic_just_8bit_timers/cdc_arduino_ported_k9spud_vwcdpic_just_8bit_timers.ino
      but my problem is that arduino no signal output pins 5 (play button), 9 (previous button) and 6 (next button). It is that the code I have to use?

      Delete
  8. did you change //#define ANDROID_HEADPHONES to

    #define ANDROID_HEADPHONES
    ?

    ReplyDelete
    Replies
    1. Yes. but it still does not output signal.

      Delete
    2. ok, and other connection to radio? which radio do you have?

      Delete
  9. I have the radio audi concert 1. I connect cables data out, clock and data in, to pins 2,12,13 with the Arduino Uno.

    ReplyDelete
    Replies
    1. https://www.youtube.com/watch?v=rS1MFRZy9Uw

      here you have video of that feature working on bench, I use radio_emulator for emulating radio.

      2diodes are "prev" and "play" output, led on pin 13 of green arduino is "next"

      this is configuration in cdc_arduino_ported_k9spud_vwcdpic_just_8bit_timers.ino:

      * ANDROID HEADPRONES SUPPORT
      * HTC: 3buttons, 220ohm previous|0ohm play/pause|470ohm next
      */
      -//#define ANDROID_HEADPHONES
      +#define ANDROID_HEADPHONES

      /*
      * ANDROID HEADPHONES SUPORT
      @@ -134,9 +134,9 @@
      */
      //#define ANDROID_HEADPHONES_ONE_BUTTON

      -#ifdef ANDROID_HEADPHONES_ONE_BUTTON //just to be shure
      -#define ANDROID_HEADPHONES
      -#endif
      +//#ifdef ANDROID_HEADPHONES_ONE_BUTTON //just to be shure
      +//#define ANDROID_HEADPHONES
      +//#endif

      #if defined(__AVR_ATtiny85__)
      #include

      Delete
    2. I moved all code here: https://github.com/tomaskovacik/vwcdavr/

      Delete
    3. Ok. I'm sorry for my late answer. Thanks for your help.
      Your code work very well making the modifications indicated by you.
      https://youtu.be/tNRmCUwH-es

      but it does not work well on my radio concert 1.
      https://youtu.be/HvF-jwfxhLg

      What can I do?

      Delete
    4. ok. try use this code

      https://github.com/tomaskovacik/vwcdavr/tree/master/CDC_emulator/cdc_arduino_ported_k9spud_vwcdpic

      DATAOUT on pin 8

      but this one is withou headphone support, need to make patch to this one

      loks like, INT0 code is somehow buggy make lot of dataerr, I try to look into it

      Delete
    5. Also check ground, "just 8bit timers" works, but is buggy .... Or is just bad wire connection, i will try to test it tomorow

      Delete
    6. Yes. Arduino gnd pin is connected to ground radio concert.
      Your code is very good. I do not think your code has some error. I think my radio concert has different pulse.

      I'll use the code: https://github.com/tomaskovacik/vwcdavr/tree/master/CDC_emulator/cdc_arduino_ported_k9spud_vwcdpic
      to see if it works on my radio without buttons.

      Thanks!

      Delete
    7. https://www.youtube.com/watch?v=LWpjHIddfwc

      I put it on bench and it works, i do make same changes to tweek it, but changes are minor, check it out, also i used 16Mhz version. Is your standard arduino?

      everything works :)

      Delete
  10. Yes, i used Arduino uno 16Mhz version. I'm sorry for my late answer.

    I used the code:https://github.com/tomaskovacik/vwcdavr/tree/master/CDC_emulator/cdc_arduino_ported_k9spud_vwcdpic

    and the code: https://github.com/tomaskovacik/vwcdavr/tree/master/CDC_emulator/cdc_arduino_ported_k9spud_vwcdpic_just_8bit_timers

    with the two codes, the display only show: CD1 TR01
    I think my radio concert works differently and the pulse signal is different but your code is correct and very well.
    thanks for the help!


    ReplyDelete
    Replies
    1. Connect andruido based logic analyzer on that line and chceck what you see

      Delete
  11. I do not have oscilloscope but I'll seek an alternative to arduino.
    Your code (https://github.com/tomaskovacik/vwcdavr/tree/master/vw_cd_changer_sniffer) would help me check the signals?

    ReplyDelete
    Replies
    1. https://github.com/gillham/logic_analyzer

      Delete
  12. Hi, great job! I would like to build only cd changer emulator for aux in (no amplifier). Do you have info if this emulator could work with Audi Symphony 1 head unit. Basically cd changer is the same for all head units from this year, correct?

    ReplyDelete
  13. Hi,great job!
    Do you know if cd changer emulator could work with Audi Symphony I head unit? I think cd changer stayed the same no matter which head unit was used (in that range of year).

    ReplyDelete
  14. Hi, I have an Audi A4 B6 with Concert 2 unit. I have connected a bluetooth module on the CD-R/L/GND pins, it starts, I can connect to it with my phone, but I cannot select it. Pressing CD button - no luck, pressing CD + starting the HU I get message "NO CDC". Is there any gadget that you built that can help me with that? I would really like to also connect a microphone to it, if possible

    ReplyDelete
    Replies
    1. Hi, you need emulator, buy one or make one with arduino

      T.

      Delete
  15. Hello congratulations nice application software can you modify it this way

    https://plus.google.com/photos/photo/101899105574100522850/6450115710770141154?icm=false&authkey=CN_-i8XHirX3vAE

    ReplyDelete
    Replies
    1. sorry, but I'm not into PIC assambly, but i actualy do something similar here: https://github.com/tomaskovacik/hw/tree/master/fritzing/vwcdpic/HTC

      Delete
  16. It is possible to do it with Windows Phone Lumias?

    ReplyDelete
  17. Hi Tomas. What to do/check if Gamma IV shows No CD when i press CD button and wcdcpic is conected? I have ISO 10 pin connector on the back and i have connected wcdcpic in this way : 1 - Data In, 2 - CLK, 3 - GND, 4 - Data Out and 6 - +12V. Thanks.

    ReplyDelete
    Replies
    1. what are numbers you mentioned? pins in iso or on my vwcdpic ? Also I do not know about radio which has cdchanger interface on 10pin connector, only on 20pin. Please drop me message on my product page on tindie https://www.tindie.com/products/tomaskovacik/vwcdpic-audio-interface-adapter/

      Delete
  18. Hi. I an trying to get this working with a Arduino nano and a bt module. I only get no cd. I have your pic emulator and when I use that and send data out to the nano I get the button commands. So it seems that the problem is white the emulation part. I am using cdc_arduino_ported_k9spud_vwdpic firmware and I have data out to pin 8 data in to pin 11 and clock to pin 13. What could be wrong?
    Best regards

    ReplyDelete
    Replies
    1. pic module is cdchanger emulator, you are trying to replicate same functionality on arduino, so you must connect arduino to radio and test it against it. Or use another arduino with radio emulator firmware from my github

      Delete
    2. Hi. That is what I have done but when the Arduino is connected up which the clock and data in pins I get no cd. So I tried with your pic board for data on and clock and the data out is send to Arduino. I can see the button presses on the computer when I do this. But I can not get the emulation part work on Arduino. I have tried all of your firmwares but the same no cd comes up.

      Delete
  19. this sketch? https://github.com/tomaskovacik/vwcdavr/blob/master/radio_emulator/radio_emulator.ino

    if so try change this two lines

    https://github.com/tomaskovacik/vwcdavr/blob/c7778aafee8e6937d881a1903571cc6c45152957/radio_emulator/radio_emulator.ino#L128

    to this:

    pinMode(Clk, INPUT_PULLUP);
    pinMode(DataIn, INPUT_PULLUP);

    ReplyDelete
    Replies
    1. i am using this: https://github.com/tomaskovacik/vwcdavr/blob/master/CDC_emulator/cdc_arduino_ported_k9spud_vwcdpic/cdc_arduino_ported_k9spud_vwcdpic.ino but maybe this dont emulate cd changer? i have all working with my Bt module and arduino with your pic emulator to trigger the changer option, and i can change songs and everything from the stereo this way but would be nice to only have one microcontroller to do both.

      Delete
    2. so u have arduino connected to radio? anyway, which BT you are using? I have FW for pic which controls BK8000L,BK3254 and BK3266 based bluetooth modules using serial@9600bps

      Delete
    3. yes the arduino is connected to radio and can have everything working except the emulation. i am using XS3868 module but saw that you stoped using it, why? i am about to order a BK8000L module soon so if you have the pic firmware for that i would be grateful.

      Delete
    4. I used 1 time XS3868, then I switched to bk8000L(bt2.1) and later to bk3254(bt4.1) and then to bk3266 (bt4.2). One not you must power arduino same time as radio, you cannot have it running from 5V(USB) and then expect to work when you later power up radio. Try powering arduino from switched output of radio.

      Delete
    5. ok, yes i have it connected to switched power, i guess i doing something wrong, which BT module do you recommend and what of your PCB do you recommend. i have your old PCB for the XS3868 module but never got that to work either. Thanks for trying to help.

      Delete
    6. https://github.com/tomaskovacik/vwcdavr/tree/master/HW/arduino_based_cdc_emulator/atmegax8_with_F6188

      and use BK3266 module

      regarding CDemulator code, what arduino send to serial?

      Delete
    7. Thanks, last question, which firmware to use with that PCB/Module. I used a arduino nano running at 16mhz, do i need to change parameters in code maybe? or can i just upload code to the Nano and connect it to the radio and it should work. Again thanks for trying to help me with this. And the code should do the emulation and controlling the BT module on one microcontroller?

      Delete
    8. ok I found problem :) I probably accidentally I uploaded code with changed pin definition, I change it to change it to correct ones and it is uploaded to github:
      https://github.com/tomaskovacik/vwcdavr/blob/26f3da0335c80c2008c3c54768527e0a1737956e/CDC_emulator/cdc_arduino_ported_k9spud_vwcdpic/cdc_arduino_ported_k9spud_vwcdpic.ino#L138

      Delete
    9. I have now tried the changed firmware, still not working, i have also tested with a digispark without any luck too, still only no Cd so i think i give up on this, your pic board works flawlessly so i have everything working with that. Maybe my Delta 6 radio is sensitive.But thanks for all the help.

      Delete
    10. drop me email, I have few pcb wih BT+pic I will probably make the available on tindie soon , but I do not have a lot of free time to set up product page ...

      Delete