Go Down

Topic: x-band motion sensor and arduino uno, help to connect (Read 1 time) previous topic - next topic


Hi! I've had problems to connect my new x-band sensor with my Arduino uno. I have a PIR sensor that works just fine, but i cannot get it work with the new sensor. Does anyone here have the knowledge of why it doesn't work. It seems as if the output from the x-band sensor is an oscillating signal and I think the PIR-sensor just give HIGH/LOW signal. The code I've used so far is presented below - my intention is to trigger my GoPro Hero 3 camera via the WI-FI-remote control.

As a note, I'm a complete beginner on electronics.

Cheers Martin


#include <avr/sleep.h>
int sensorpin = 0; //interrupt number 0, actually digital pin 2
int input = 2;
int film = 12; // output to control film, digital pin 13
volatile int state = LOW;

void setup()
  pinMode(film, OUTPUT);
  pinMode(13, INPUT);
  attachInterrupt(sensorpin, startfilm, RISING);

void sleepNow()         // here we put the arduino to sleep
    set_sleep_mode(SLEEP_MODE_PWR_DOWN);   // sleep mode is set here
    sleep_enable();          // enables the sleep bit in the mcucr register
    /* Now it is time to enable an interrupt. We do it here so an

     * accidentally pushed interrupt button doesn't interrupt
     * our running program. if you want to be able to run
     * interrupt code besides the sleep function, place it in
     * setup() for example.
     * In the function call attachInterrupt(A, B, C)
     * A   can be either 0 or 1 for interrupts on pin 2 or 3.   
     * B   Name of a function you want to execute at interrupt for A.
     * C   Trigger mode of the interrupt pin. can be:
     *             LOW        a low level triggers
     *             CHANGE     a change in level triggers
     *             RISING     a rising edge of a level triggers
     *             FALLING    a falling edge of a level triggers
     * In all but the IDLE sleep modes only LOW can be used.
    attachInterrupt(sensorpin,startfilm, RISING); // use interrupt 0 (pin 2) and run function
                                                  // startfilm when pin 2 gets HIGH
    sleep_mode();            // here the device is actually put to sleep!!
    sleep_disable();         // first thing after waking from sleep:
    detachInterrupt(sensorpin);      // disables interrupt 0 on pin 2 so the

                            // wakeUpNow code will not be executed
                             // during normal running time.

void loop()
//  delay(100000);
  if( state == HIGH){
    digitalWrite(film, HIGH);
    delay(200); //standard 200 ms, start recording
    digitalWrite(film, LOW);
    delay(6000); //filmad tid i ms
    state = LOW;
    digitalWrite(film, HIGH);
    delay(200);//standard 200 ms, stop recording
    digitalWrite(film, LOW);
    digitalWrite(film, state);

void startfilm()
  state = HIGH;

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131