Ford CD Changer Emulator - Arduino Mega

25,504

32

42

Posted

Introduction: Ford CD Changer Emulator - Arduino Mega

Well.. I've Ford Focus, and one day my original radio, Ford 6000, have stopped receiving any FM station. It turned up that the FM proccessor is down. I had another Ford radio - 5000, with a cassettes player.
I've started wondering - ok, there is a sign "changer support", let's check our polish ebay for changer. I've found the emulator of changer, but it was quite expensive, so I thought - there has to be the way, to build it on my own.
And then I've started to googling - I've found the yampp project, customized by Andrew Hammond, with ACP for Ford. But it was build 10 years ago, many of files wasn't available, links were down. But - I had a code and some instructions, and that was enough. I've ported Andrews code to Arduino Mega and made a Ford emulator for my own.

Check the progress:
http://www.youtube.com/watch?v=e6wNowo8DjE
and working beta version:
http://www.youtube.com/watch?v=FykGC-gzuNc

Step 1: Let's Get This Party Started!

Ok, so let's begin.

I've read about communication - radio is using RS485 protocol, so we need a MAX485 for communication. In included datasheet was basic schematic - everything is included on my schematic - I've used an led just as a indicator of communication.

You should use serial port no 1 (not 0) - RX1 and TX1 ports (18 and 19 pins of Mega) - basicly because of blocking ports etc.

Remember - don't include and don't use Serial library of Arduino - it's slowing things down (even for debbuging - it's better to use the lcd for that, but about lcd I'll mention later).

The basic problem was to get things synchronized - Yampp was prepared to use external oscilator with 7.37MHz clock, Arduino have 16MHz oscilator. And as I mentioned before - debugging with Serial library and arduino serial monitor on PC was causing errors while handshakes between radio and arduino.

After I've decided to resigne from using Serial library at all, I've discover (only by mistake) that handshakes are almost ok. It tourned up that even one more or less character on lcd may be a cause of synchro errors. That's why you shouldn't change the code.

My project looks like shield for Arduino - I've made it on universal pcb.

Step 2: Parts & Soft

Parts youre gonna need:
  • Arduino Mega (you can always use another, but remember to read manuals about blocking PORT etc.)
  • 100ohm resistor
  • 5v LED
  • transisotr L78509CV (this is an option)
  • two capacitors (I've used 10uF, but should be .. I don't know, 470uF was good ;) )
  • Ford 12pin multilock (search on the internet)
  • LCD compatibile with hd44780 (mine was jhd162a)
  • MAX485
I've decided to use L78509CV only to get 9V, you can get 12V from radio straight ahead.

Remember - check the code - on schematic pins for LCD may be diffrent, than settings in the code (I've created schematic first, then soldierd universal pcb).

"Why do I need capacitors?", you may ask. Well, you need them between your jack connection and L+ and R+ - I've got nice sound from my iPhone after adding capacitors. I have plans to build or use opamp (OPA! Amp should work fine).

I've used Arduino 1.0.5 software.

You need an TimerOne library:
http://playground.arduino.cc/Code/Timer1
(http://code.google.com/p/arduino-timerone/downloads/list)

Step 3: Finito

Full code is in the attachment.

Things to do:

  • nice box :)
  • better cable (I've used ethernet cabel, its sucks)
  • AND gate - you can get 8V or 9V from radio (pin CD ENABLE) when radio is on, I don't know how (right now of course) what to use to build AND gate, because 12V from radio is constantly alive, so you have to put on/off switch, or and gate (when 9V is on, put 12V into circuit)
  • use OP AMP ?

3 People Made This Project!

Recommendations

  • Epilog Challenge 9

    Epilog Challenge 9
  • Sew Warm Contest 2018

    Sew Warm Contest 2018
  • Gluten Free Challenge

    Gluten Free Challenge
user

We have a be nice policy.
Please be positive and constructive.

Tips

Questions

35 Comments

hi,

I tried to compile using the version of arduino avr boards 1.6.20 and I got the following error:

[Build] C:/Users/Virgilio/Documents/Arduino/FordFocus...

[Step 1] Check Toolchain.

[Step 2] Find all source files.

[Step 3] Start building.

[3.3%] Compiling FordACP.ino.cpp...

"C:/Users/Virgilio/AppData/Local/Arduino15/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.4-arduino2/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -flto -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=20000 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR "-IC:/Users/Virgilio/Documents/Arduino/FordACP" "-IC:/Users/Virgilio/AppData/Local/Arduino15/packages/arduino/hardware/avr/1.6.20/cores/arduino" "-IC:/Users/Virgilio/AppData/Local/Arduino15/packages/arduino/hardware/avr/1.6.20/variants/mega" "-IC:/Program Files (x86)/Arduino/libraries/LiquidCrystal/src" "-IC:/Users/Virgilio/Documents/Arduino/libraries/TimerOne" "C:/Users/Virgilio/AppData/Local/Arduino15/build/FordFocus/sketch/FordACP.ino.cpp" -o "C:/Users/Virgilio/AppData/Local/Arduino15/build/FordFocus/sketch/FordACP.ino.cpp.o"

In file included from C:/Users/Virgilio/Documents/Arduino/FordFocus/FordACP.ino:16:0:

C:/Users/Virgilio/Documents/Arduino/FordFocus/FordACP.ino:70:1: error: conflicting declaration of 'void __vector_36()' with 'C' linkage

SIGNAL(USART1_RX_vect)

^

C:/Users/Virgilio/Documents/Arduino/FordFocus/FordACP.ino:24:6: note: previous declaration with 'C++' linkage

#ifndef cbi

^

[Build] Error occurred.

Hi, firstly let me say how awesome this is, I have made it using a mega and it works like a dream so thank you so much. Thing is I'd like to shrink this onto a pro mini, loose the LCD and pop it into a small project box to live behind my dash for ever more. Could you tell me if it is possible to install this onto a pro mini, I thought I'd port the code but I don't have a clue, obviously when you set the IDE to pro mini and try to compile you get the errors other people are mentioning. Before I try and overcome these errors and re-write the code to circumvent them, could you tell me if it's even possible, else I will waste hours researching :( Thanks again for a great project !!

Hey, I'm really happy and glad, that you've build your own emulator :)
I've made a software for you - it's attatched to last step - hope I've choosen right board for you. Switch pin for you is no. 23 on your Arduino Pro. Good luck with that and please llet me know if it's working.

Wow, thank you very much :) Sadly, I tried to compile it for the following board:

Arduino Pro or Pro mini(5v 16 Mhz) w/ ATmega 328

and I got the following errors,

FordACP.ino: In function 'void acp_txenable(boolean)':
FordACP:122: error: 'PC0' was not declared in this scope
FordACP:125: error: 'PC0' was not declared in this scope

I'm sorry I can't figure out the errors, I do appretiate what you have done for me, is there any chance you might be able to suggest why we are getting these errors please? I feel like a dope so I'm going to try and figure it out as well :)

Hi, the amended code compiles and uploads to the pro mini ! :) Unfortunately, when I connect the pro mini to the radio via the board I made for the mega with the max485 chip, the radio doesn't talk to it :( I don't know if this is a speed issue but when I substitue the pro mini for the mega it works again using the same little circuit with the max485. I'm using TX1, RX0 and A0 on the mini. This is the board I'm using

http://arduino.cc/en/Main/ArduinoBoardProMini#.UwI...

Thank you for all your help so far, I really need to read up on ports and bit masks etc, I noticed we are using pin 28 on the mega for switching which is a digital pin, but A0 on the pro mini which is analog, should we not use a digital pin on the pro mini instead of an analog one?

Hi, you're right ! I've used analog-in in previous code :)

http://arduino.cc/en/Hacking/PinMapping168#.UwIUOv... - check this out
So maybe lets try to use another pin, it has to be from other port, than RX and TX - try with portB, so maybe PB0 pin ?
( PORTB |= (1<<PB0); ) ? Don't forget to change "switchPin" in code. Let me know if it's working.

Ok, I've rewritten the code as follows :

int switchPin = 8;

void acp_txenable(boolean enable)
{
if (enable){
PORTB |= (1<<PCINT0); //set high state on D8
}
else {
PORTB &= ~(1<<PCINT0); // set low state on D8
}
asm volatile("nop");
}

I assume from the pin mapping that PB0 is PCINT0, it still is not recognised by the player though :( Is there something else I'm missing?

hmmm.. maybe you should start with basic solutions, like:
- check if the max485 is on when board is unplugged from radio
- try to make very simple circuit only with led, which will toggle led on and off on D8, which we try to use as gate for max485... I've never had an Arduino Mini (honestly - this was my first project with Arduino :-) ) so it's hard for me to be your advisor :)

Hey, I've found something really interesting, if I power the mega from the usb, this project works but if I try and power it from the jack plug or the vin, it doesn't work. I think this may be why the pro mini didn't work.