motion sensor interfacing with MSP430G2 LaunchPad

In this tutorial, you will learn how to interface motion sensor with MSP430G2 LaunchPad . There are many types of motion sensors available in market, But in this tutorial, we be using PIR motion sensor. We will see how to detect motion of any object around this PIR motion sensor and how to interface it with MSP430G2 LaunchPad  to detect motion. This tutorial can also be used as a motion detector project. This is a fourth tutorial on series of tutorials on MSP430G2 LaunchPad.  To understand this guide completely, you should know about general purpose input/ output pins of MSP430G2 LaunchPad . You should also know how to use energia IDE to program MSP430G2 LaunchPad . If you have no knowledge about how to use MSP430G2 LaunchPad and how to program it using Energia IDE, you should read following two articles first:

Now lets start with a introduction of motion detector sensor or motion sensor. I have already mentioned about the sensor which we are using in this tutorial. In this tutorial,  we will use PIR sensor to sense the motion (movement) of human being and turns ON an LED to indicate about the detection of motion. Movement of human will be detected by the PIR sensor. PIR Sensor provides a triggering pulse to MS430G2 launchPad  . MS430G2 launch Pad generates output at Pin No. 14 to turn ON the LED.

Introduction to motion sensor MOTION SENSOR

PIR motion sensors are basically  passive infrared receivers what you would more commonly call a motion sensor.  So what it actually has in it is a underneath  plastic dome is a very sensitive infrared sensor that receives and measures the general temperature of the room around it. When you move it senses the change in the average temperature to enough precision that it can actually identify when you’re moving around. These modules are pretty impressive because it only have three pins
  • five volts
  • ground
  • in the middle it has a pulse output so that every time it sees motion it pulses out 3.3 voltsmotion sensor working
This module happens to have two adjustment potentiometers on it. So you can turn up or down the sensitivity and the pulse duration. Because obviously when it senses motion it’s going to send out a pulse but then it after the pulse it does a hold off. It will then not send another pulse until it waits a certain amount of time. These things are really kind of impressive setting. I can be 20 feet away from it and move over 6 inches and it’ll detect it.

Motion sensor interfacing with MSP430G2 LaunchPad

In this circuit we are using pin number 13 as digital input pin which is connected with output pin of PIR sensor. Because PIR sensor gives logic high whenever it detects motion around and there is no motion around it will give logic low output. Terminal of PIR sensor is connected with ground and terminal three is connected with 5 volt TPI pin. I told you earlier about TPI pin.  PIR sensor works on 5 volt so if you connect less than 5 volt to power supply pin of PIR sensor, it will not work properly.  LED is used for indication. LED is connected with pin number 14 which will be initialized as a digital output pin in program.

MOTION SENSOR INTERFACING WITH MSP430G2 LaunchPad

Code of MSP430G2 LaunchPad interfacing with motion sensor

Code for PIR sensor is same as code for Push button interfacing with MS430G2 LaunchPad

int ledpin = 14;
int motion_sensor = 13;
int sensor_state;

void setup()
{
pinMode(ledpin, OUTPUT);
pinMode(motion_sensor, INPUT);
}

void loop()
{
sensor_state = digitalRead(motion_sensor);
if (sensor_state == HIGH)
{
digitalWrite(ledpin, HIGH);
delay(1000);
}
else
{
digitalWrite(ledpin, LOW);
}
delay(1000);

1 thought on “motion sensor interfacing with MSP430G2 LaunchPad”

  1. Energia: 1.8.11E23 (Windows 10), Board: “MSP-EXP430G2 w/ MSP430G2553”

    Sketch uses 918 bytes (5%) of program storage space. Maximum is 16384 bytes.
    Global variables use 26 bytes (5%) of dynamic memory, leaving 486 bytes for local variables. Maximum is 512 bytes.
    MSPDebug version 0.24 – debugging tool for MSP430 MCUs
    Copyright (C) 2009-2016 Daniel Beer
    This is free software; see the source for copying conditions. There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    —————– NOTE ——————
    Modified version of mspdebug for Energia
    Do not use standalone
    —————————————–
    Chip info database from MSP430.dll v3.3.1.4 Copyright (C) 2013 TI, Inc.

    Using new (SLAC460L+) API
    MSP430_GetNumberOfUsbIfs
    MSP430_GetNameOfUsbIf
    Found FET: HID0002:COM4
    MSP430_Initialize: HID0002:COM4
    Firmware version is 20409001
    MSP430_VCC: 3000 mV
    MSP430_OpenDevice
    MSP430_GetFoundDevice
    Device: MSP430G2xx3 (id = 0x00de)
    2 breakpoints available
    MSP430_EEM_Init
    Chip ID data:
    ver_id: 5325
    ver_sub_id: 0000
    revision: 00
    fab: 60
    self: 0000
    prog: ‘C:\Users\ravib\AppData\Local\Temp\arduino_build_995363/sketch_sep11a.ino.hex’: The filename, directory name, or volume label syntax is incorrect.
    config: 00
    Device: MSP430G2xx3
    MSP430_Run
    MSP430_Close
    An error occurred while uploading the sketch

    can you help me to solve this problem. i’m ussing msp-exp430g2553

    Reply

Leave a Comment