Friday, 20 May 2016

Python interfacing with MSP430G2(IR sensor)


                   
              Python interfacing with MSP430G2(IR sensor)

I have done an interfacing with Python with MSP430G2.
 Why python and MSP430G2?
I think MSP430G2 is one of the  best development board by TI (Texas Instruments) with ultra low power microcontroller which is have 5 low powered mode by which battery life can be extended, which is also having 16 bit RISC CPU .So it is more preferable that other MCU’s where you need less battery consumption and maximum code efficiency.
Python is easy language to start with and it can be used for many application  its supports many domains like internet protocols, web developments, Scientific and Numeric Comuting,Desktop GUI,Software development etc.,
In this project I try to read the physical world using programming language called python.
I think you are confused!
Let me explain it. I just try to read the physical world by using the IR sensor. This IR sensor communicates with your controller through serial communication.IR sensor gives the distance of the objects/obstracle, which can be seen in serial monitor. Now I try to display the same values what we are getting in serial monitor in python using pyserial, for this you need python software along pyserial library.
Step1:Msp430 serial communication:
First I Wrote a small code to display the values in serial monitor as shown in the figure
My code and board is working good, I try to print the obstacle distance in serial monitor



Step2: communicating with python
Now I have to import the pyserial library in to python and need to write a small code that can catch value of that is being displayed in serial monitor.
without obstacle IR range:



with obstacle IR range:

                                           



Hurray it’s working …!

You’re always welcome to give me your valuable suggestion through comments, if you need more information regarding this please leave a comment so that I can answer you.









No comments:

Post a Comment