Global Sources
EE Times-India
Stay in touch with EE Times India
 
EE Times-India > Interface
 
 
Interface  

5 ways to simplify sensor interfacing

Posted: 02 Nov 2015     Print Version  Bookmark and Share

Keywords:sensor  but tool  Python  MCU code 

Sensors abound in many electronic devices found in public spaces and at homes, supplying us with tons of data. With these inexpensive sensors, the Internet of Things and the digital revolution have come into reality. However, acquiring data from and connecting to sensors is not always easy or simple.

Sensors have proliferated across the surface of our planet and surrounding space, supplying the world with data. These inexpensive sensors are one of the driving forces behind the Internet of Things and the digital revolution our society now faces. Connecting to and acquiring data from sensors is not always straightforward or easy, however.

Here are five tips to help ease engineers' struggle with interfacing to a sensor for the first time.

Tip #1 – Start with a bus tool

The first step any engineer should take when interfacing to a sensor for the first time is to limit the unknowns by using a bus tool. A bus tool connects to a PC and then to the sensor via I2C, SPI or any other protocol that the sensor might talk on. The PC application associated with the bus tool provides a known and working source for sending and receiving data and NOT an unknown, untested embedded MCU driver. Within the working environment of the bus tool, developers can send and receive messages to get an understanding of how the part works before ever trying to operate it at the embedded level.

Tip #2 – Write the interface code in Python

Once a developer has experimented with the sensor using the bus tool, the next step is to write the application code for the sensor. Instead of jumping straight to the MCU code, though, first write the application code in Python. Many bus tools come with plug-ins and example code for writing scripts. Python is usually one of the available languages along with .Net. Writing the application in Python is quick and easy and provides a way to once again test the sensor in an application environment without the intricacies of the embedded environment getting in the way. Having high-level code then makes it easy for non-embedded engineers to dig through the script and experiment with the sensor without the need for an embedded software engineer to babysit.

Tip #3 – Test the sensor with Micro Python

One of the advantages to writing the first cut application code in Python is that the application calls to the bus tool API can easily be replaced by calls to Micro Python. Micro Python operates within the real-time embedded software constraints that many sensor engineers have come to appreciate. Micro Python runs on a Cortex-M4 processor and is a great environment from which to debug the application code. Not only is it simpler, there is no need to write I2C or SPI drivers because they are included as part of the Micro Python library. (Read Using Micro Python for real-time software development and/or 5 Advantages of using Micro Python for Embedded Software Programming for more details)


1 • 2 Next Page Last Page



Comment on "5 ways to simplify sensor interfacin..."
Comments:  
*  You can enter [0] more charecters.
*Verify code:
 
 
Webinars

Seminars

Visit Asia Webinars to learn about the latest in technology and get practical design tips.

 

Go to top             Connect on Facebook      Follow us on Twitter      Follow us on Orkut

 
Back to Top