HB100 doppler radar sensor. RF link communication.

As a group project we are building a motion sensor that will detect cars around a blind corner. We built a nice doppler radar motion sensor using the instructions based by this website.
http://www.limpkin.fr/index.php?post/2013/08/09/Making-the-electronics-for-a-%247-USD-doppler-motion-sensor

We attached the sensor to an arduino board and found code so that displays both the frequency and and the speed in mph in the serial port.

Now we want to sent the data from one arduino uno to another uno via a 355MHz transmitter/receiver and display the data. I researched the transmitter and receiver and found info on how to code this but even though the codes compile, it doesn’t transmit the data from one to other. I’m guessing the code I wrote is more for simple programs and I’m making too many assumptions in it I shouldn’t be making. Bare with me as I am a beginner and I don’t know completely on what I am doing. Can someone please look at the transmitter and receiver code and help me learn how to fix it. I will also place the code for just the sensor if you want to see how to data is coming out. Thanks in advance! :slight_smile:

Transmitter Code

#include <VirtualWire.h>
const uint16_t TICK_CNT = 3;
static uint16_t freq = 0;
double sped = 0;
char HBSCharMsg[10];

void setup()
{
  pinMode (13, OUTPUT);
  Serial.begin(115200);
  vw_setup(2000);
  vw_set_tx_pin(12);

  noInterrupts();
  TCNT1   = 0;
  TCCR1B  |= _BV(CS12) |_BV(CS11) | _BV(CS10);

  TCNT2   = TICK_CNT;
  TIMSK2  = _BV(TOIE2);
  TCCR2B  |= _BV(CS22) |_BV(CS21) | _BV(CS20);
  interrupts();

  Serial.println("Ready...");
}  

ISR(TIMER1_OVF_vect);
ISR(TIMER2_OVF_vect)
{
  freq = TCNT1;
  TCNT1 = 0;
  TCNT2 = TICK_CNT;
}

void loop()
{

  itoa(freq, HBSCharMsg, 1);
  delay(1000);

  digitalWrite(13, HIGH);
  vw_send((uint8_t *) HBSCharMsg, strlen(HBSCharMsg));
  vw_wait_tx();
  digitalWrite(13, LOW);
  delay(1000);
}
]

Receiver Code

#include <VirtualWire.h>
int ledPin = 13;
int HBSData;
char HBSCharMsg[10];
double sped = 0;

void setup()
{
  Serial.begin(115200);
  pinMode(ledPin, OUTPUT);
  vw_set_ptt_inverted(true);
  vw_setup(2000);
  vw_rx_start();
}

void loop()
{
  uint8_t buf[VW_MAX_MESSAGE_LEN];
  uint8_t buflen = VW_MAX_MESSAGE_LEN;
  
  if(vw_get_message(buf, &buflen))
  {
    int i;
    digitalWrite(13,true);
    
    for(i = 0; i < buflen; i++)
    {
      HBSCharMsg[i] = char(buf[i]);
    }
    
    HBSCharMsg[buflen] = '\0';
    HBSData = atoi(HBSCharMsg);
    
    if (HBSData != 0) {
      HBSData = HBSData * 62;      // multiple the frequency * 4, 250ms*4 = 1 sec.
      sped = HBSData * .03225;  // multiplying freq * 0.03225 will give speed in mph, 31Hz = 1 mph.
                             
      Serial.print("Freq: ");
      Serial.print(HBSData, DEC);
      Serial.print(" Hz, Speed: ");
      Serial.print(sped, 0);
      Serial.println(" mph");
      HBSData = 0;
  }}}

Code for hb100 Sensor Output

const uint16_t TICK_CNT = 3; // 255-(16MHz/1024/62Hz)  
static uint16_t freq = 0;
double sped = 0; //"speed" seems to be a reserved term

void setup() {

  pinMode(13, OUTPUT);
  digitalWrite(13, HIGH);
  
  Serial.begin(115200);

  noInterrupts();                     // disable all interrupts while we configure  
  
  // init Timer1 - 16-bit timer/counter
  TCNT1   = 0;                                  // start count at zero.        
  TCCR1B  |= _BV(CS12) | _BV(CS11) | _BV(CS10); // Increment T1 input on each positive edge 
                                                // using an external source, pg 139.
  
  // init Timer2 - 8-bit timer/counter
  TCNT2   = TICK_CNT;                 // preload Timer2 to interrupt every 250 ms
  TIMSK2  = _BV(TOIE2);               // enable the Timer2 overflow interrupt 
  TCCR2B  |= _BV(CS22) |_BV(CS21) | _BV(CS20);   // init clock prescaler to 1024, page 164.
  interrupts();                       // enable all interrupts
  
  Serial.println("Ready...");
}

ISR(TIMER1_OVF_vect) {
  // do nothing. this is just a dummy ISR in case it actually overflows.
  Serial.println("Inside Timer1 Overflow Interrupt.");
}

ISR(TIMER2_OVF_vect) {
  //Serial.print("TCNT1: ");
  //Serial.println(TCNT1);
  
  freq = TCNT1;
  //Serial.println(freq);
  
  TCNT1 = 0;  //starts count at zero again           
  TCNT2 = TICK_CNT;  //reloads Timer2 to interrupt every 250ms
}

void loop() 
{
  if (freq != 0) 
  {
      freq = freq * 62;      // multiple the frequency * 4, 250ms*4 = 1 sec.
      sped = freq * .03225;  // multiplying freq * 0.03225 will give speed in mph, 31Hz = 1 mph.
                             
      Serial.print("Freq: ");
      Serial.print(freq, DEC);
      Serial.print(" Hz, Speed: ");
      Serial.print(sped, 0);
      Serial.println(" mph");
      freq = 0;
  }
}

Hi, I would like to build a radarduino with HB100.
I know that for calculate the distance from radar to target, i need to do the FFT (T Fourier) of th signal output of mixer.
if i use the hb 100 and arduino how can I do?

can i send the signal from mixer to arduino and from arduino to PC for to process the signal?

Example:

I know that for calculate the distance from radar to target, i need to do the FFT (T Fourier) of th signal output of mixer.

It's a CW Doppler device, isn't it?
There is no range information.

Yes hb 100 is doppler device, but the schema is the radar FMCW

a don't know, CW doppler device and radar FMCW is different?

With FMCW you can get distance. When you sweep the output frequency upward the round-trip time causes the received signal to be at a lower ('older') frequency than the current outgoing signal. The frequency difference is measured the same as a doppler-induced frequency difference. Knowing how rapidly the output frequency is changing allow you to measure the round-trip time and thus the distance.

If you alternate between sweeping up in frequency and sweeping down (triangle wave modulation) any speed induced doppler shift will always shift the frequency down when receding and up when approaching. This causes one distance measurement to be low and one to be high. The difference in distance measurement sweeping up and down should let you calculate the speed and averaging the two distances should get you close to the true distance.