|
||||||||
|
||||||||
| Cette page est aussi disponible en français | ||||||||
| Project overview | [hide] |
What is it?USBTenki is an electronic project to interface sensors to an USB port for collecting weather related data such as temperature. The firmware supports many different sensors and interfaces. It is up to you to decide what your USBTenki will support. Hourly graphics generated from data collected using this project are available at http://meteo.raphnet.net Project history and motivation: This project - named USBTenki, from the japanese word 'tenki' 天気, which is pronounced ten-kee and means weather - was created because a friend needed an USB temperature sensor. A short time later, I got a requset for a temperature + humidity sensor, so I added support for such a sensor. Then, just for fun, I added an absolute pressure sensor which is able to report the atmospheric pressure. I plan to add support for more types of sensors, such light, lightning detection, wind speed and wind direction. You can consult the list of supported sensors in the 'Supported sensors, wiring and firmwares' section below. |
| Pictures | [hide] |
Temperature + Relative humidity sensor using a Sensirion SHT75 sensor:
![]() Temperature sensor using an MCP9803:
![]() The prototype using an MCP9803 sensor: Temperature sensor (prototype) based on the MCP9803 installed in the servers room's air conditionner:
![]() Here are good examples of how to install a bypass capacitor near a sensor and protect the sensor using heat-shrink tubing:
Examples graphs (generated with munin plugin) 1:
2:
3:
4:
5:
6:
|
| Schematics | [hide] |
Here are the schematics:
If you need a wiring diagram specific to your sensor, consult the corresponding diagram from the 'Supported sensors, wiring and firmwares' section below. Design notes: I started working on this project when a friend needed a simple, low-cost, computer-connected temperature sensor for monitoring a presumably unreliable air conditioning unit in a server room. For simplicity, I decided to re-use the PCB I designed for my game controllers to USB projects. Therefore, the sensor connects to a PC using USB. For sensing the temperature, I decided to use (for the moment) digital sensors. Using digital sensors is easy, most sensors provide an acceptable precision, calibration is not required and I did not need to add additional components such as voltage references, precision resistors and operational amplifiers to my already existing board. |
| Supported sensors, wiring and firmwares | [hide] |
| The atmega8 has to be programmed with a firmware that supports the sensor you are using. Unless
otherwise noted, the fuse settings should be set to high_byte=0xC1 low_byte=0x1F. I used Objective Development's software only USB implementation for Atmel's AVR microcontrollers, it was natural to use it again for this project. This means that again, the firmware is open-source and released under the Objective Development licence. The source code for the firmware and host side client are distributed together. You can get both in the Host software section.
Configuring ADC channels: The firmware can expose ADC channels as specific chip IDs. By default all ADC channels are configured to CHIP_NONE (0xff). If you connect an analogic sensor to an ADC channel, configure the firmware (only needed once since the information is stored in eeprom). Here's a configuration example: (Sets ADC0 to 0x90 [MPX4115]). # ./usbtenkisetup -s 'XXXXXX' setadcchip 0 0x90For details about how to program an AVR, please visit my AVR programming page. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Host software | [hide] |
At the moment, the host side software is a command line tool
that has only been tested under Linux. It uses libusb, so it should
be easily ported to OSes supported by libusb.
Listing devices: For printing a list of accessible USBTenki devices, use the '-l' switch:
# ./usbtenkiget -l
Found: 'USBTenki', Serial: 'B10004', Version 1.2, Channels: 11
Channel 0: Sensirion SHT1x/7x Temperature [Temperature]
Channel 1: Sensirion SHT1x/7x Relative Humidity [Relative Humidity]
Channel 2: MPX4115 Absolute air pressure sensor [Pressure]
Virtual Channel 256: Dew point [Dew point]
Virtual Channel 257: Humidex [Humidex]
Virtual Channel 258: Heat index [Heat index]
As you can see in the output above, there is a concept of channel and
virtual channel. A channel reports real data from the physical sensor (or data
computed by the firmware). Virtual channels are channels whose value
is computed locally using the real channels.
(More info about virtual channels)Reading values: Reading values from an USBTenki device is done by specifying a comma-separated list of the channels you want to the -i switch. If the value 'a' is passed, all channels are listed. # ./usbtenkiget -i 0,1,256 22.46, 39.55, 8.02The ouput above is easy to parse. But if you want a prettier output, use the -p switch: # ./usbtenkiget -i a -p Temperature: 22.26 °C Relative Humidity: 40.03 % Pressure: 102.89 kPa Dew point: 8.02 °C Humidex: 22.67 °C Heat index: 24.98 °CIf the degree ° sign shows as garbage on your terminal, change your encoding to iso8859-1 or try the -7 switch to disable such fancy characters. Converting values: Celcius and Kilopascals are the default units. If you prefer other units, the -T and -P switches can be used to select different temperature and pressure units. Try -h for a list of supported units. Example: # ./usbtenkiget -i 0,2 -p -T f -P hPa Temperature: 70.61 °F Pressure: 1022.45 hPa |
| Virtual Channels | [hide] |
Here is a list of the possible virtual channels, their dependencies and links to related documentation.
|
| Printed Circuit Board | [hide] |
The PCB I use is the same as in the
GC/N64 controller to usb project.
This PCB has a footprint for a voltage regulator (not used this time) and
reprogramming contacts on the bottom side.
Here are composite images of the top and bottom layers:
![]()
No regulator is requied so the only components that must be installed on
the back side are the two voltage selection resistors. Install
them as they are on the picture on the right. If you dont have
0 ohm resistors, you may use small pieces of wire or do solder bridges.Here is a wiring diagram for the board. With the schematic and sensor wiring diagrams, it should be easy to figure out how to connect your sensor. ![]() And finally, here are the gerber files which you can use produce this PCB: multiuse.zip Due to the fact that this board is two-sided and has numerous vias, building it at home may be a little harder than the ususal. If you want, you can get professional PCBs from my online store. |
| References | [hide] |
| The following wikipedia articles were useful: Celcius Fahrenheit Heat index The application notes on sensirion website. For calculating dewpoint from Temp + RH and for sensor documentation: SHT75 datasheet and application notes Information about humidex on the Meteorological Service of Canada (MSC) website: http://www.weatheroffice.gc.ca/mainmenu/faq_e.html#weather4b |
| Disclaimer | [hide] |
|
I cannot be held responsible for any damages that could occur to you
or your equipment while following the procedures present on this page.
Also, I GIVE ABSOLUTELY NO WARRANTY on the correctness and usability
of the informations on this page. Please note, however, that the procedures
above have worked in my case without any damages or problems. Now you cannot say that I did not warn you :) |
Website coded with![]() | Last update: May 17, 2009 |