PIR Sensor with LED Blink issue

Just recently caught the Aurdino bug and just finished my first project. I created a wireless PIR motion sensor to control the lights in my room. The project works good but I am trying to improve the functionality of the LED. Right now when the PIR sensor picks up motion it turns on an LED and opens a relay connected to another arduino to turn the overhead light on. I have the PIR sensor delay set to about 30 seconds and the trigger potentiometer set to retrigger. Right now when motion is detected, the LED light turns on and stays on for the entire 30 seconds.

My long term goal is to run this off external AA batteries so I am trying to find a way to have the LED just blink a couple of times at the start of the motion cycle and then blink a couple of times at the end of the motion cycle right before the overhead light turns off. Ideally I would like the PIR sensor to just blink a couple of times everytime it detects motion in its field of view. However, I don’t think the HC-SR501 PIR sensor will allow this capability. There does not seem to be a way to capture when the sensor retriggers. Am I wrong?

I am using a sketch that is commonly found on numerious Arduino sites to include this one. Below is the code.

// Include VirtualWire library
#include <VirtualWire.h>

int led_pin = 13;
int transmit_pin = 12;
int pir_pin = 2;
int val = 0; 
int pir_state = LOW;

void setup()
{
   Serial.begin(9600);
   vw_set_tx_pin(transmit_pin);
   vw_setup(4000);
   pinMode(led_pin, OUTPUT);
   pinMode(pir_pin,INPUT);
}
 
void loop()
{
  char msg[1] = {'0'};
  // Get sensor value
  val = digitalRead(pir_pin);
  // Change message if motion is detected
  if (val == 1)
  {
      msg[0] = '1';
      digitalWrite(led_pin, HIGH);
      vw_send((uint8_t *)msg, 1);
      vw_wait_tx();
      if (pir_state == LOW) 
      {
      Serial.println("Motion detected!");
      pir_state = HIGH;
      }
   }
 else
 {
   msg[0] = '0';
   digitalWrite(led_pin, LOW);
   vw_send((uint8_t *)msg, 1);
   vw_wait_tx();
   if (pir_state == HIGH)
   {
      Serial.println("Motion ended!");
      pir_state = LOW;
   }
  }
}

I have done some extensive research into the various functions, variables, and control structures found in the Arduino Language reference but I am not sure which route I should take to accomplish this task.

Thanks in advance for any hints to get this project going forward again.

Sean