Blog

Welcome to the Gizmo For You Bolg. Any documentation, thoughts or articles related to any of the Gizmo For You projects can be found here.

  • Home
    Home This is where you can find all the blog posts throughout the site.
  • Categories
    Categories Displays a list of categories from this blog.
  • Tags
    Tags Displays a list of tags that have been used in the blog.
  • Bloggers
    Bloggers Search for your favorite blogger from this site.
  • Team Blogs
    Team Blogs Find your favorite team blogs here.
  • Login
    Login Login form

USB Sensor Reader Software

Posted by on in Gizmos
  • Font size: Larger Smaller
  • Hits: 4913
  • 0 Comments
  • Subscribe to this entry
  • Print

There are many aspects of the Sensor reader Gizmo and here we shall explain what they are and how to best understand the operation of the device and it's software. Many sensors are available in the market with different protocols and implementations. This is a description where some of the possible aspects are described for future development as well as for current implementation.

 

Sensors Point of View - Digital Sensor

When we talk about a "Digital" sensor we mean that the sensor is a simple Push button or any other type of device that basically shorts the connection either High or Low thus giving a result in the form of 1 or 0. When connected to the USB Sensor Reader the values are actually NOT 0 - 1 but from 0 - 1024 since the same input is used for an Analog Sensors as well.

You can change the output value that the Port produces from 0 - 1 to 0 - 1024 by Terminal commands

These sensors can be connected to the First position on the I/O header

Sonsors Point of View - Analog Sensor

Analog sensors are connected to the same port as the Digital ones. They could be of any sort as long as they operate in the area of 3.3 - 5V These when connected give out a value from 0 - 1024 and are read from the Terminal the same way as the Digital ones.

Sensors Point of View - I2C Sensors

Since the USB Reader already has Pull up resistors on the 2 I2C lines (SDA, SCL) there is no need for any other external hardware. Just plug the sensor in the corresponding port and you are set to go. The I2C readings for now, work only as a Master device. Thus the sensor should be the Slave. There are several types of I2C sensors out there. Simple Sensors such as the CSDX Barometer have a Hard Coded Slave address.

In order to read or to control an I2C sensor there are 2 things that need to be done:

  • Transmit the Slave Address with a Command which might me a "Read" command
  • Receive the Data

Since there are many sensors out there and they all have different command sets we have designed the software in such a way that you can configure the command you would send together with the address of the sensor. Also the Type of data which is received can also be configured.

Things that can be configured are:

  • Slave Address
  • Command
  • Data Type (8 bit, 9 bit, 10 bit, 12 bit, 14 bit)
  • MSB or LSB Data type

Sensors Point of View - 1Wire Sensor

Another type of sensor interface that is available on the USB Reader is the 1 Wire interface.

The 1-Wire bus has by definition only a single data line. Each device (master or slave) interfaces to the data line via an open drain or 3-state port. This allows each device to “release” the data line when the device is not transmitting data so the bus is available for use by another device.

This configuration is already made on the 1 Wire interface so no external components are required in order to start reading data.

Sensors such as the DS18S20 output a 9 bit data so this should be controlled and be able to be selected when reading these type of sensors.

All transactions on the 1-Wire bus begin with an initialization sequence. The initialization sequence consists of a reset pulse transmitted by the bus master followed by presence pulse(s) transmitted by the slave(s). The presence pulse lets the bus master know that slave devices (such as the DS18S20) are on the bus and are ready to operate.

The things that can be configured for a 1 Wire interface are:

  • Sensor Presence check
  • Command
  • Data Type (8 bit, 9 bit, 10 bit, 12 bit, 14 bit)
  • MSB or LSB Data type

Terminal Point of View - Commands & Configurations

When pluging in the USB Sensor Reader for the first time the default setup is used. This setup only reads the Digital/Analog port on each of the 4 sensor IC's and outputs the Data to the Terminal as follows:

D/A_1: 834 D/A_2: 0 D/A_3: 120 D/A_4: 1024

After this line it sends a 13 (Carriage Return) and does this in a loop until an ESC key is pressed or the DEC value 27 is sent.

When this Happens the Sensor Reader stops transmitting and sends the Command Line:

Command:

There you have the option to type C1, C2, C3, C4 for the according Sensor IC that you wish to configure. After typing the IC you wish to setup you hit Return in the terminal or send 13 (Carriage Return)

The command Line will change to:

IC1:

Then you select the type of input you wish to configure. The commands for each one are:

  • AD - Analog or Digital
  • 1W - 1Wire Interface
  • I2C - I2C interface

After typing the Type you wish to setup you hit Return in the terminal or send 13 (Carriage Return)

Analog Or Digital Configuration

In this Configuration the Command line will show as:

AD:

There are only 2 options to choose from in this menu:

  • By Typing "D" (Digital) you set the signal to be displayed as 0 or 1
  • By typing "A" (Analog) you set the signal to be displayed as 0 to 1024

1 Wire Configuration

In this Configuration the Command line will show as:


1W:

There are 4 options to choose from:

  • Sensor Presence check
  • Command
  • Data Type (8 bit, 9 bit, 10 bit, 12 bit, 14 bit)
  • MSB or LSB Data type
  • By Typing "SP" The Reader will check if there is a sensor present and output either 1 or 0 accordingly
  • By Typing "CM xx" where "xx" is your command, you set the command which needs to be sent in order to receive a reply. The USB reader then sends back the response requested by that command
  • By Typing "DT 8" you set the Data Type to be read from the sensor, in this case 8 bit
  • By Typing "MSB" you set the Data to be MSB first
  • By Typing "LSB" you set the Data to be LSB first

I2C Configuration

In this Configuration the Command line will show as:


I2C:

There are 4 options to choose from:

  • Slave Address
  • Command
  • Data Type (8 bit, 9 bit, 10 bit, 12 bit, 14 bit)
  • MSB or LSB Data type
  • By Typing "SA xxxxxx" You set the Address of you sensor (where xxxxx is the address
  • By Typing "CM xx" where "xx" is your command, you set the command which needs to be sent in order to receive a reply. The USB reader then sends back the response requested by that command
  • By Typing "DT 8" you set the Data Type to be read from the sensor, in this case 8 bit
  • By Typing "MSB" you set the Data to be MSB first
  • By Typing "LSB" you set the Data to be LSB first

Comments

  • No comments made yet. Be the first to submit a comment

Leave your comment

Guest
Guest Wednesday, 28 June 2017