Arduino Pro Micro + Apple CarPlay Voice command button mapping

Hello everyone!

I'm working on a project for my car, which has an Android screen with Apple CarPlay, and I'd like to map a physical button to activate Siri's voice control instead of having to touch the screen.

I'm using an Arduino Pro Micro and the NicoHood/HID library to control the music, but I want to add voice control. With the noise while driving or the music playing, the "Hey Siri!" voice command often isn’t picked up correctly, and I end up having to manually touch the screen to activate it, which could lead to an accident due to distraction or a fine for touching a GPS-like device while driving.

I imagine, like with everything, there might be a special keyboard key ID assigned that activates voice control in Apple CarPlay, but it’s not listed in the indicated library. Could anyone provide more information or guide me on how to add this function?

Thanks in advance.

Best regards!

If CarPlay interprets a long press of certain media buttons (like Play/Pause) as a Siri activation, you might be able to simulate this with the HID library.
https://docs.arduino.cc/libraries/hid-project/

maybe this might be easier to implement :wink:

Most CarPlay-enabled vehicles I know of allow you to press and hold the voice command button, usually located on the steering wheel, to enable Siri without needing to touch the CarPlay screen.

Don’t you have one ?

This vehicle did not come with any control for voice commands. Let me delve a bit more into my situation:

My vehicle is a 2003 Lexus IS200, which came equipped with the factory radio. I bought a generic Android radio and an adapter frame to place it where the GPS navigation system is typically installed in models with more features. The sound output from the Android radio is amplified by the original factory radio in the vehicle since the amplifier quality is miles better than the Chinese Android radio.

Thanks to a CD changer emulator from AliExpress, I was able to reverse-engineer and map the buttons on the original radio to work with the Android radio. This lets me skip songs, pause and play music, and even stop or play a song if I turn off or on the factory radio. Currently, I'm working on improving this to read directly from Toyota/Lexus’s AVC-LAN protocol, which is the protocol my vehicle uses to communicate multimedia units. For those who don’t know, my vehicle is equipped with three main protocols:

  • BEAM MPX: Toyota's communication protocol. It’s similar to CAN Bus but slower. It’s used for communication throughout the vehicle, from the engine ECU to raising the windows, managing ABS/TRC brake systems, airbags, and much more. This protocol is the slowest but one of the most critical.

  • AVC-LAN: Toyota/Lexus and NEC’s communication protocol for multimedia and infotainment units such as the radio, GPS, CD changer, steering wheel controls, etc. This protocol is faster than BEAM but slower than CAN Bus.

  • CAN Bus: This uses two types of protocol: K-Line ISO 9141-2 and ISO 14230-4. It’s mainly used for vehicle diagnostics, although early models had a Toyota/Lexus OBD-I connector under the hood, allowing diagnostics and access to certain vehicle parameters like older systems (though the communication was done via BEAM protocol, unlike other Toyota vehicles).

My idea is to install the GPS control knob in my car and control the Android radio as if it were a BMW "iDrive" knob, for example. I’d reverse-engineer it or look for a way to modify it for use with Arduino by replacing the internal board with a simpler system since I don’t know the protocol this knob uses and haven’t been able to decode it. (This knob has a microcontroller that sends information encoded in some format, unlike knobs in other vehicles that work through voltage division with resistors as I initially thought. It has two cables to transmit the signal: Signal (RE1) and Ground (SGND) or negative voltage). This signal is approximately 5V.

One idea I had yesterday was to try emulating a mouse and make it so that when I press a button, it simulates holding down the button that appears in Apple CarPlay to activate Siri. It’s a bit of a hack (I know), but I haven’t had any luck since the Android Pro Micro is not recognized as a mouse (for some unknown reason). I’m not sure if it’s because the radio lacks drivers to control a mouse or if it’s simply not compatible. I used NicoHood's library for the test.

I also tried doing the same with the “KEY1” and “KEY2” cables used to map steering wheel buttons using voltage division with resistors. No button mapped this way activates Siri.

I’m unsure if I can update my ZLink 5 software (the one I use for Apple CarPlay) to map a button for Siri activation since I’ve seen some people can do this with their Android radios and certain ZLink versions.

I don't know if this extra info would help to solve my issue.

Thanks in advance to everyone!

My idea is to forget about wires. All I have to do when I get into the car is to turn on the key and leave the iPhone over the wireless charger mat that I also installed. Apple CarPlay works wirelessly :grin:

Is there any library to emulate a touch screen or something 100% Android capable? I don't know why but I can't get my 3.3v Arduino Pro Micro to work as a mouse on my Android head unit. On my PC it works fine (Windows 10), but on the Android radio looks like it's all the time trying to bootup without success, since the LED light is blinking all the time, and this happens when you plug the Pro Micro on the USB and bootloader is loading. It keeps in an endless bootloop.

I found that what causes Pro Micro to crash when connected to Android HU is the Absolute Mouse library.
Is there any other way to move a mouse cursor to XY position on the screen quickly, and hold the left button for a couple of seconds, and then release?

have you tried without the NicoHood/HID library and just the plain old boot loader that came with the Arduino Pro Micro?

I don't use android so can't be of much help there...

I think I've found a solution. I'm using MoveTo library by "per1234" (Link to GitHub). It allows you to move the cursor to desired position on the screen (like with the NikoHood HID Absolute Mouse), and it seems that Android like it.

This is the code that I'm using:

// Demonstrates the effect of different MouseTo.setMaxJump() settings.

#if ARDUINO > 10605
#include <Mouse.h>
#endif  //ARDUINO > 10605
#include <MouseTo.h>

const byte pin = 2;
byte maxJump;

void setup() {
  Mouse.begin();
  Serial.begin(9600);
  pinMode(pin, INPUT_PULLUP);
  MouseTo.setTarget(15, 1000);
}

void loop() {
  if(digitalRead(pin) == LOW) {

    Serial.print(F("maxJump="));
    Serial.println(maxJump);
    MouseTo.setMaxJump(maxJump);

    while (MouseTo.move() == false) {}
    Mouse.press();
    delay(500); //Change this to 1000/1500/2000 or desired delay to simulate holding the home button press
    Mouse.release();
  }

My next goal is to decode the Lexus GPS remote controller protocol and connect it to Arduino