create new tag
view all tags

Arduino Sensor Circuit

A simple temperature and humidity sensor has been set up to monitor the environmental conditions of the testing chamber. This page goes over the hardware and software of the monitor system, if you want to know about running the dry air and cooling system refer to the environmental controls TWiki page.


Arduino Uno

The monitor system is run by the Arduino microcontroller, currently using the Arduino Uno. The Arduino is connected to the computer with a USB A to B cable, and communicates with the computer through a serial port.


The Arduino is connected to 2 identical SHT75 sensors. Each has 4 pins: a clock pin (sck), a 5V power pin (VDD), a Ground pin (GND), and a data pin (SDA). The pinout is shown below,

  1. SCK --->
  2. VDD --->
  3. GND --->
  4. SDA --->
All of the sensors are connected to the same ground and 5V power pins on the Arduino. Currently they both have seperate SDA and SCK connections, however as the circuit gets updated (e.g. if more sensors are needed) the SHT75's should all be able to share an SDA bus and have seperate SCK connections. Since the Arduino can only communicate with one at a time there should be no problem sharing a data connection.

These sensors have a similar protocol to I2C for communication, but note that it is not an I2C connection. The seperate sensors do not have individual addresses.


There are two major component programs, one is loaded to the Arduino itself, and one reads the output.


The Arduino code for reading the SHT75 sensors, this code is largely copied from this site. There are a few updates to the code, most of which revolve around having multiple sensors.

To avoid sensor self heating the sensors cannot be running more than 10% of the time. The combined time of querying the temperature and the humidity takes 0.400 seconds per sensor, therefore the sensors can only read once every 4 seconds. However the current program actually only reads the sensors once every 10 seconds as we do not need more data than that.

The temperature and humidity are measured separately in degrees Centigrade and percent relative humdity. added in a line of code (getDewPoint) that calculates the dew point from these measurements using the following formula

dewpoint = 243.04*(log(RH/100) + ((17.625*temp)/(243.04 + temp)))/(17.625 - log(RH/100) - ((17.625*temp)/(243.04+temp)))

This is derived here and given in equation (8).


This code is old and has been improved

The improved code is run through the Console.py script. It has combined the data coming from the Arduino and the power supplies and has completely replaced this code. Refer to the documentation for that instead.

The Arduino communicates through a serial port (ttyACM0)to the computer. It is very simple to read a serial port with a python script, however there are 2 possible problems to run into.

  • The serial port itself does not exist until the Arduino is plugged into the computer, so running the python script will not work unless the Arduino is connected.
  • The serial port has automatic protections on it that make it unreadable. To remedy this enter sudo chmod 666 /dev/ttyACM0 to change the permissions on the port as the superuser (this will require the password)

The Arduino is restarted whenever the serial connection is opened, so the header labels for the Arduino data will be printed whenever Read_Serial.py is run, and the reading does not happen when the serial port is not open.

The python script reads the serial port and waits for the first output from the Arduino (which is "Begin"). This is because there is often some left over gibberish that is read right when the serial port is open, so now it waits until the serial communication is actually ready. The python script also adds a timestamp to the data output, so the output should look like this:

hour minute second temp1 temp2 dewpoint1 dewpoint2

This is all saved to a file, titled "Output_Month_Day.dat" where month and day are the month and day when the script was run. Running the script multiple times on the same day will just append to the current file for that day and not recreate it.

-- Tom-Erik Haugen - 2016-10-12


Topic attachments
I Attachment History Action Size Date Who CommentSorted ascending
Texttxt README.txt r1 manage 1.8 K 2016-10-12 - 18:40 TomErikHaugen  
Texttxt Read_Serial.py.txt r3 r2 r1 manage 0.7 K 2016-10-18 - 19:05 TomErikHaugen  
Unknown file formatino temp_humidity.ino r2 r1 manage 4.7 K 2016-10-18 - 19:08 TomErikHaugen  
Edit | Attach | Watch | Print version | History: r5 < r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r5 - 2016-11-17 - TomErikHaugen
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2020 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback