I have a Pioneer XR-A550 hifi system that I use as an amplifier for sound / music from my pc. This works great, however at the end of the day I switch the power of my bench off, this includes the Pioneer. When I switch on the power again the Pioneer has lost all its settings, so I have to enter it in aux mode and turn the volume back up. After doing this for a few years it was time to automate this.
To do this I decided to replicate the IR remote commands with my own circuit. For the board I used a spare board from my Solder / SMD inspection Camera project, this board has a microcontroller and a mosfet to drive a higher current load. So it makes it ideal to drive the IR LED.
The enclosure is 3D printed and is designed to clip onto the aluminium of my LED light.
To get the IR commands I connected a IR receiver to a logic analyser. The signals I then decoded in a spreadsheet and made some quick and dirty code to reproduce them.
The signal for the IR LED needs to be modulated at 38Khz, for this I used a PWM module in the microcontroller. I send duty-cycle 0 for off and 50% for on. LATAbits.LATA6 I used for debug to compare the signal to the original. This results in folowing code:
void main(void) { uint8_t Buffer, Counter, VolumeCounter; // initialize the device SYSTEM_Initialize(); //************************************************************************** //Startup delay __delay_ms(2000); __delay_ms(2000); //************************************************************************** //Send Aux Irheader(); Buffer = 0b10011010; for (Counter = 0; Counter < 8; Counter++) { if (Buffer & 0x80){ IrOne(); }else{ IrZero(); } Buffer = Buffer << 1; } Buffer = 0b01100101; for (Counter = 0; Counter < 8; Counter++) { if (Buffer & 0x80){ IrOne(); }else{ IrZero(); } Buffer = Buffer << 1; } Buffer = 0b11001101; for (Counter = 0; Counter < 8; Counter++) { if (Buffer & 0x80){ IrOne(); }else{ IrZero(); } Buffer = Buffer << 1; } Buffer = 0b00110010; for (Counter = 0; Counter < 8; Counter++) { if (Buffer & 0x80){ IrOne(); }else{ IrZero(); } Buffer = Buffer << 1; } IrZero(); //************************************************************************** //Delay after power on __delay_ms(2000); __delay_ms(2000); //************************************************************************** //Volume ++ 10x for (VolumeCounter = 0; VolumeCounter < 10; VolumeCounter++){ Irheader(); Buffer = 0b10011010; for (Counter = 0; Counter < 8; Counter++) { if (Buffer & 0x80){ IrOne(); }else{ IrZero(); } Buffer = Buffer << 1; } Buffer = 0b01100101; for (Counter = 0; Counter < 8; Counter++) { if (Buffer & 0x80){ IrOne(); }else{ IrZero(); } Buffer = Buffer << 1; } Buffer = 0b10101111; for (Counter = 0; Counter < 8; Counter++) { if (Buffer & 0x80){ IrOne(); }else{ IrZero(); } Buffer = Buffer << 1; } Buffer = 0b01010000; for (Counter = 0; Counter < 8; Counter++) { if (Buffer & 0x80){ IrOne(); }else{ IrZero(); } Buffer = Buffer << 1; } IrZero(); __delay_ms(1000); } //************************************************************************** //Infinite loop, don't do anything while (1) { } } void Irheader(void){ LATAbits.LATA6 = 0; PWM1_LoadDutyValue(127); __delay_us(8550); LATAbits.LATA6 = 1; PWM1_LoadDutyValue(0); __delay_us(4200); } void IrOne(void){ LATAbits.LATA6 = 0; PWM1_LoadDutyValue(127); __delay_us(550); LATAbits.LATA6 = 1; PWM1_LoadDutyValue(0); __delay_us(550); } void IrZero(void){ LATAbits.LATA6 = 0; PWM1_LoadDutyValue(127); __delay_us(550); LATAbits.LATA6 = 1; PWM1_LoadDutyValue(0); __delay_us(1560); }
A video of the circuit working:
Please accept YouTube cookies to play this video. By accepting you will be accessing content from YouTube, a service provided by an external third party.
If you accept this notice, your choice will be saved and the page will refresh.
Related products: