Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Cambridge Audio Azur 540A IR/BT-remote..
#1
Tutorial+sketches (.inos):

first half of the text is here: http://essabre-90xx-rpi.sfb2.com/2018/01...diy-works/

okay..
first i had to find out which code-protocol (NEC,Sony,RC5 etc..) the original Cambridge RC-340AC/540AC/640AC RC uses..

[Image: rc-150.jpg]

i used the "IRrecvDemo"-sketch in the examples of "Arduino-IRremote-master"-package->[url= https://github.com/z3t0/Arduino-IRremotehttps://github.com/z3t0/Arduino-IRremote[/url]
and modified it a little bit..
the main problem was:
..
int RECV_PIN = XX; in the demo-sketch they used XX=11 and thats wrong on my mega 2560; according to the boarddefs.h (Arduino-IRremote) they use Timer2 and for the Mega 2560 thats on pin 9 !!
..
so, that took me hours/days..
after i solved this problem, i could see some HEX in the serial monitor..
(...)
so, next problem was on which pin should i connect the transmitter ?
also on PIN9..
so, i´ve got the HEX (410,40e and so on) but how to transmit ?
breakthrough was this : 
IRsend irsend;
irsend.sendRC5(0x0000000000000411,12); (for example)

the original CA-IR-remote (which i had here) uses the RC5-protocoll; but how many pre-data, bits and so on?

i´ve found than this wonderful LIRC-.conf->Cambridge_X40A.conf (see attachment)..

.rar   Cambridge_X40A.rar (Size: 990 bytes / Downloads: 0)
examples:
"begin codes
        Tape_Mon    0x0000000000000400
          KEY_DVD                  0x0000000000000401        #  Was: DVD
        AV_MD       0x0000000000000402
        Tuner_DAB   0x0000000000000403
        Aux_Phono   0x0000000000000404
          KEY_CD                   0x0000000000000405        #  Was: CD
          KEY_SLEEP                0x000000000000040c        #  Was: Standby
          KEY_MUTE                 0x000000000000040d        #  Was: Mute
          KEY_POWER                0x000000000000040e        #  Was: Power_On
          KEY_POWER                0x000000000000040f        #  Was: Power_Off
          KEY_VOLUMEUP             0x0000000000000410        #  Was: Vol_Up
          KEY_VOLUMEDOWN           0x0000000000000411        #  Was: Vol_Down"

there i saw the complete HEX-numbers..
used first "irsend.sendRC5(0x0000000000000411,20) and so on, but after millions of hours, i´ve found out that 12 is the right bit-count..

so, after some testing, i´ve got here problems to receive and transmit via the same pin (pin9) i didnt know how to change it in boarddefs.h i thought i use my HC-06 Bluetooth-module..

found this very good tutorial "Tutorial - Using HC06 Bluetooth to Serial Wireless UART Adaptors With Arduino"->http://www.instructables.com/id/Tutorial...ireless-U/

[Image: FXO75_JTI3_THAGV8.MEDIUM.jpg]



my wiring was "TX on the HC-06 to Pin10
                       RX on the HC-06 to Pin11"->
#include <SoftwareSerial.h>
SoftwareSerial BT(10, 11);
// creates a "virtual" serial port/UART
// connect BT module TX to D10
// connect BT module RX to D11
// connect BT Vcc to 5V, GND to GND



[Image: 20180122_003801.jpg]



so i used the sketch from the site above, write some irsend to it, and now it looks so: (see .ino also in the attachment)

.rar   tronixlabs-bluetooth-w1-works.rar (Size: 853 bytes / Downloads: 0)

---------------------------------------------------------------------------------------------------
#include <SoftwareSerial.h>

#include <IRremote.h>



IRsend irsend;

SoftwareSerial BT(10, 11); 

// creates a "virtual" serial port/UART

// connect BT module TX to D10

// connect BT module RX to D11

// connect BT Vcc to 5V, GND to GND

void setup()  

{

  // set digital pin to control as an output

  pinMode(13, OUTPUT);

  // set the data rate for the SoftwareSerial port

  BT.begin(9600);

  // Send test message to other device

  BT.println("Hello from Arduino");

  BT.println("6 -> Power ON");

  BT.println("8 -> Power OFF");

  BT.println("4 -> DVD/XMOS USB");

  BT.println("1 -> Vol - / down");

  BT.println("2 -> Vol + / up");

  BT.println("3 -> CD");

  BT.println("9 -> Mute");

  BT.println("5 -> Tuner/Dab 3/Blu-Ray Samsung");

}

char a; // stores incoming character from other device

void loop() 

{

  if (BT.available())

  // if text arrived in from BT serial...

  {

    a=(BT.read());

    if (a=='1')

    {

      digitalWrite(13, HIGH);

      BT.println("LED on/Volume Down");

      irsend.sendRC5(0x0000000000000411,12);

    }

    if (a=='2')

    {

      digitalWrite(13, LOW);

      BT.println("LED off/Volume Up");

      irsend.sendRC5(0x0000000000000410,12);

    }

    if (a=='3')

    {

      digitalWrite(13, HIGH);

      BT.println("CD");

      irsend.sendRC5(0x0000000000000405,12);

    }

    if (a=='4')

    {

      digitalWrite(13, HIGH);

      BT.println("DVD-XMOS-USB");

      irsend.sendRC5(0x0000000000000401,12);

    }    

    if (a=='5')

    {

      digitalWrite(13, LOW);

      BT.println("Tuner/Dab 3/Blu-Ray-Samsung");

      irsend.sendRC5(0x0000000000000403,12);

    }

    if (a=='6')

    {

      digitalWrite(13, HIGH);

      BT.println("Power ON");

      irsend.sendRC5(0x000000000000040e,12);

    }

    if (a=='8')

    {

      digitalWrite(13, LOW);

      BT.println("Power off");

      irsend.sendRC5(0x000000000000040f,12);

    }

    if (a=='9')

    {

      digitalWrite(13, LOW);

      BT.println("Mute !!");

      irsend.sendRC5(0x0000000000000432,12);

    }

    if (a=='?')

    {

      BT.println("Send '1' to turn LED on");

      BT.println("Send '2' to turn LED on");

    }   

    // you can add more "if" statements with other characters to add more commands

  }
}
--------------------------------------------------------------------------------
(edit: "Mute" btw. works not here..; u dont need the digitalwrite to pin13 and so on)


and how to control it via Bluetooth ?

i use this APP (not the APP they suggested)
->Arduino bluetooth controller
->https://play.google.com/store/apps/detai...itor&hl=en

used "Terminal" and it works here absolute fantastic !!  Smile

(any questions/suggestions-write it down here in the forum..hope some info would be useful for someone Wink  )
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)