Test and Measurement Forum

BUFFERS/ISOLATORS FOR DrDAQ/1012/1016 DATALOGGERS PART 5

Post discussions on projects you are working on

BUFFERS/ISOLATORS FOR DrDAQ/1012/1016 DATALOGGERS PART 5

Postby Glovisol » Sun Apr 24, 2016 12:04 pm

I2C COMMUNICATIONS EXAMPLE - I2C TEMP SENSOR

General
What follows is a demonstration example of I2C transfer data from a digital sensor to a Picolog DA (DrDAQ in this case). The enclosed sketch is only valid for the LM75 Digital Temperature Sensor. With I2C communications the Micro acts as Master, while the sensor is the Slave, so there cannot be an “universal sketch” in I2C. For each sensor a special sketch must be prepared: luckily in most cases the vendors of the sensors make available on line simplified sketches that provide a starting point.

For details on I2C comms please consult the exhaustive literature available . The data sheet of the LM75 IC can be downloaded here:
Data sheet : http://esd.cs.ucr.edu/labs/temperature/LM75.pdf

The use of this module is straightforward, because of the Library that can be downloaded here.
Library: https://github.com/thefekete/LM75


Once you have downloaded and de-compressed the Library, you will have a “LM75-master” folder, which stores file cpp and file h. In the folder you will find two TEXT files named “LM75”. You must open: SYSTEM (C:) – PROGRAMS - ARDUINO – LIBRARIES. Here make a folder named “LM75” and place the two files inside. Later when you open the enclosed sketch you will note “#include <LM75.h>": this is the Library you have just inserted in the Libraries folder. Our demonstration sketch uses two libraries: Wire.h for I2C Communications and L75.h for reading the sensor digital outut.

Wiring
With reference to Photos Micro Shield 4 (M) and LM75 Module(L) disconnect the two wires going from the Test Voltages Board (TSB) and terminals A4 (G) and A5 (H) of the Shield. Now wire the LM75 Module as shown in the photo.


Operation
Download the sketch: sketch_Analog_&_I2C_°C and paste it on an open blank Arduino IDE, as directed per previous Analogue sketch. Compile it. If compiles, load it and open the Serial Monitor. The SM will display: sensor equivalent voltage, ambient temperature and two Analogue channels. The correspondence between ambient temperature, as read by the L75.h Library and equivalent sensor voltage is 10 mV/°C: e.g., 0 @ 0 °C and 1V @100 °C.

Sketch_Analog_&_I2C_°C has been written by merging the Sensor Sketch contained in the “examples” – “Basic Usage” folders of the LT75-master directory with the previously discussed sketch_Analog_IN_PWM_OUT, while removing the Analogue functionality of Micro pins A4 & A5 and corresponding outputs.

With this sketch the PWM carrying the temperature data is connected to pin D10 of the Micro: to see temperture on Picolog, connect one of the DA input channels (example: EXT. 3 on the DrDAQ) to pin D10, then open a Math channel to convert voltage into temperature.

The enclosed PC screen shows the Picolog data display. Picolog receives the PWM and reads the corresponding temperature equivalent voltage. Then a Math channel is used to convert this voltage back to temperature. More data and the PLW file in the next post.

Operation is well illustrated in the enclosed Photos & PC screens.
Attachments
Isol. Pict. D15.jpg
Picolog display
Test Voltages board 1 (L).JPG
Test Voltages Board details
Micro Shield 5 (L).JPG
Modified connections to the Micro Shield
LM75 Module (L).JPG
Temperature sensor module
I2C Complete lineup (M).JPG
Overall I2C/Analogue system Lineup
Last edited by Glovisol on Sun Apr 24, 2016 1:30 pm, edited 2 times in total.
Glovisol
Advanced User
Advanced User
 
Posts: 114
Joined: Sat May 11, 2013 10:03 am
Location: San Marzano Oliveto, Asti, Italy

Re: BUFFERS/ISOLATORS FOR DrDAQ/1012/1016 DATALOGGERS PART 5

Postby Glovisol » Sun Apr 24, 2016 12:14 pm

MORE DATA ON THE I2C COMMUNICATIONS EXAMPLE

Herewith enclosed I2C Sketch and additional illustrations.
Attachments
I2CLineup (M).JPG
I2C interconnection detail
sketch_Analog_&_I2C_°C.doc
This is the Analogue-I2C sketch
(36 KiB) Downloaded 40 times
Isol. Pict. D13.jpg
Data readings by the System Testing Laptop
I2C DrDAQ DATA 7.PLW
PLW FILE OF I2C TEST
(23 KiB) Downloaded 26 times
Glovisol
Advanced User
Advanced User
 
Posts: 114
Joined: Sat May 11, 2013 10:03 am
Location: San Marzano Oliveto, Asti, Italy


Return to Projects

Who is online

Users browsing this forum: No registered users and 0 guests