May 1, '09. This item has been discontinued.
On Mar 1, '05, I implemented a number of firmware improvements to the PIC processor. This new Version B firmware will be shipped with all future kits. On boot, a "B" is displayed.
If you purchased the WX #175 prior to Mar 1, '05, an upgrade programmed PIC is $5.00 plus $1.25 shipping in the US (Discontinued). The only additional documentation is the connection of a DS2423 counter to the Dallas 1-W bus.
The following discussion has been modified reflect these mdifications.
(March 1, '05). A PC Interface using Liberty Basic.
Partially assembled units are available on a limted basis. Discontinued.
Interfacing with a Fascinating Anemometer and Wind Vane.
The WX #175 Kit consists of a programmed Microchip PIC16C773 processor in an 28-pin DIP, a 4.0 MHz ceramic resonator, a MAX232 (16-pin DIP) level converter and associated 1.0 uFd capacitors which may be used in applications requiring RS232 levels and a number of 1/2 watt resistors. The kit also includes lengths of 22 awg solid wire suitable for assembling the kit on a solder less breadboard, the famous Morgan Logic Probe which is used for testing during assembly and documentation which consists of a number of figures.
The kit does not include the source code for the programmed PIC nor does it include a printed circuit board.
This design provides an interface with a Motorola MPX4115AS or MPX4115AP pressure sensor to provide measurement of barometric pressure in millibars, which at sea level is nominally 1013.
It also provides five 12-bit analog to digital converters which may be used for measuring wind direction using a dual potentiometer with a single shaft or in interfacing with other voltage output sensors.
The design provides interfaces with two Sensirion RH sensors which provide a two wire digital interface. The idea is that one sensor may be collocated with the processor and the other at some remote point. I have verified reliable communication can be maintained over lengths of 100 feet to the remote sensor. Note that the Sensirion SHT-11 is available from the manufacturer as a free sample. The WX #175 design may interfaced with the SHT-11, 15, 71 or 75. I prefer the SHT-71 as it is easily mounted on an SOIC to DIP adaptor.
In addition to measuring the RH, the design provides the interface with the SHT sensors to also measure temperature in degrees C.
Admittedly, the expense for these RH sensors is not minimal. The SHT-71 is $25.00 plus $5.00 for the SOIC to 8-pin DIP adaptor. Thus, with two Sensirion devices, the cost is $60.00 for two RH measurement capability. However, when compared with some of the prices at Texas Weather, this is pretty attractive.
The design also provides for two twisted pair runs, with each run accommodating up to sixteen Dallas DS1820 sensors. The design will interface with the DS18S20 / DS18B20 with 0.06 Each twisted pair run may be 200 feet of total cable.
Dallas DS2423 Dual 32-bit counters may also be accomodated on these twisted pair runs, along with temperature sensors. These are ideal for counting events, such as rainfall using a tipping bucket.
The design also provides a counter which might be used to count events over a specified period of time which might be used to measure wind speed.
The design also provides two TTL outputs and two TTL inputs.
Note that the basic kit consisting of the programmed Microchip PIC, resonator, MAX232 and associated capacicitors provides the 9600 Buad interface, six 12-bit analog to digital converters, the counter function, two TTL outputs and two TTL inputs.
It provides the capability of interfacing with an MPX4115 pressure sensor, up to two Sensirion SHT relative humidity sensors and up to a total of 32 DS18S20 (or DS18B20) Dallas temperature sensors and DS2423 counters, but the basic kit does not actually include the sensors. The user may add these to fit their application and pocket book. For example, a user may wish to start with a single RH sensor and one DS1820, and perhaps add the pressure sensor at a future time. That is, the programmed processor provides all of these capabilities, but the user need not use them.
The serial interface is TTL. That is, the idle state is a TTL logic one, or near +5 VDC. This is often termed non-inverting or true.
A MAX232 in a 16-pin package and associated capacitors is included in the kit for applications requiring RS232 levels, a logic one of less than -3 VDC and a logic zero of grater than +3 VDC, This would typically be used in an interface with a PC. Note that a USB-RS232 serial converter may be used if you do not have a COM port.
The baud rate is fixed at 9600.
A source of +5 VDC with a minimum current of 100 mA is required for this design. This may be implemented by using a wall power unit in the range of 7 - 12 VDC with a minimum current rating of 100 mA and a 7805 voltage regulator.
The processor provides a prompt to the interfacing processor;
Atmospheric pressure may be measured by sending the 'P' command followed by a new line.
>PThe processor performs sixteen 12-bit A/D measurements, averages and calculates and returns the atmospheric pressure in millibars, followed by a newline and a prompt;
The design provides for interfacing with up to two Sensirion SHT relative humidity sensors. The RH is measured using the 'H' command;
>H0where the digit is a 0 or 1.
The format of the returned data is the temperature in degrees C followed by the relative humidity.
23.16 59.15 >If a sensor is not found or if there is a communications error, values of -88.88 are returned.
-88.88 -88.88 >
A/D Voltage Measurement.
A/D measurements may be made on any of the five channels using the 'A' command followed by the A/D channel. .
>A3The processor returns the average of the result of sixteen measurements as a decimal number in the range of 0 - 4095.
4021 >Note that valid A/D channels are 1-5. The MPX4115 pressure sensor is inherently associated with channel 0. If you opt to not use a pressure sensor, A/D measurements may also be performed on this channel; A0.
Note that the high and low reference voltages associated with the A/D measurement are the nominally +5 VDC and GRD which powers the processor. Thus, the voltage may be calculated as;
V_ad = ad_val / 4096 * 5.0
DS1820 Temperature Measurement
Temperatures on either of two runs are performed in response to the T command followed by the designation of the run, either 0 or 1. Note that this temperature measurement capability is in addition to the temperatures associated with the Sensirion SHT sensors. T0 The unit responds with the temperature measurements;
0 27.50 10 F33A 1 26.67 22 3B3B 2 -5.26 etc 3 3.04 etc >In this example, four devices were found on run 0. As each was found, it was assigned a sequential number in the range of 0 - f. This is followed by the temperature in degrees C, followed by the device type. A 10 indicates a DS18S20 was found. A 22 indicates the device is a DS18B20. This is then followed by a 16-bit serial number which is assigned specifically to the DS1820 device.
A few notes;
Thus, 0 might correspond to a DS18S20 in your PC, 1 to the living room, 2 to the freezer. Assume you then add one on a cold water pipe in the basement. You may well find 0 is still your PC, but 1 is now the water pipe, 2 is the living room and 3 in the freezer.
However, note that once a system is in place, 0 will always be the PC, 1 the water pipe, etc. But if your cat pulls off the sensor in the living room, 2 will then be the freezer.
If you don't wish to use the serial number information, you might consider initially connecting the sensors on a breadboard and use your finger to determine which device is 0, which is 1, etc and then label each of the sensors and then install them with 0 in the PC, 1 in the living room, etc.
Note that all DS1820 devices are operated in the parasitic power mode (the DS1820s use the signal lead for power) and thus a single twisted pair may be multipled from one device to the next.
In this design, the resolution of the temperature is 0.06 degrees for both the DS18S20 and the DS18B20.
Multiple DS2432 dual 32-bit counters may also be placed on either or both of the Dallas 1-W runs. Note that they may be placed on a run which is also being used for DS1820 temperature devices. A reading of all DS2423 event counters is initiated using the E command followed by the run.
E0The processor searches the designated 1-wire run and if a DS2438 is found, it responds with the event counts.
0 00000000 000000C3 1D AA63 >The first field is a sequential number. The next two fields are the event counts expressed in hexadecimal. This is followed by the Dallas device code (1D) followed by an abbreviated serial number unique to the specific device.
Note that aside from removing power, there is no means to zero the event counters.
Unlike the DS1820 temperature sensors, +5 VDC is required to power the DS2438. This may either be run from the WX #175 unit or supplied using a small coin battery. Counter
The counter function is implemented using the 'C' command;
>C3The number of TTL transitions on input T0CKI are counted over the specified number of seconds, in this case, three seconds. The design provides for 1 to 9 seconds. The command C0 returns the current value of the sixteen bot counter.
The unit responds by displaying the number of counts expressed as a decimal number which occurred over the specified period of time.
1234 >The maximum number of counts is 65,535.
When the processor is booted, the number of counts is set to zero and the counter is enabled. The counter may be read at any time using the C0 command. An application that comes to mind is in counting tipping bucket pulses in a rainfall gauge. However, it is important to note that value of this counter is not continually written to EEPROM and if power is lost, the processor is rebooted and the number of counts is initialized to zero. My recommendation is to use this onboard counter for wind speed where the number of clicks over a period of several seconds may be measured and use a DS2438 on the Dallas 1-W runs to count tips for rainfall.
Input / Output
Two TTL outputs are provided. An output is brought high or low by issuing either the 'N' (as in oN) or 'F' (as in oFf) commands.
>N1Note that the outputs are identified as 0 and 1.
The processor returns the state of the output.
Two TTL inputs are provided. They may be read using the 'I' command followed by either a 0 or a 1..
>I1The processor returns the state of the specified input.
0 >Note that internal pull up resistors are provided in the processor. Thus, an open (or a TTL logic one) is read as a logic one.
Content of the Kit.
Please take a few seconds to acquaint yourself with the content of the kit.
It consists of;
1 Programmed Microchip PIC11c773 Processor (28-pin DIP). 1 MAX232 (HIN232) RS232 Level Translator (16-pin DIP) and associated four 1.0 uFd capacitors. 1 4.0 MHz Ceramic Resonator, 3-term SIP 3 4.7K Resistors (Yellow, Violet Red) for use on /MCLR and the two DS1820 runs. 1 100K Resistor (Brown, Black, Yellow) for use on the counter input. 1 4.7K potentiometer for testing the A/D converters. 1 5V LED with integrated series limiting resistor for testing the TTL outputs. 1 Morgan Logic Probe. Note that this is a simple device which indicates if a point is at a logic one (LED on), logic zero (LED off), pulsing (LED flashing). It also provides sources of nominally 1 and 10 pulses per second. 1 Bundle of 22 awg solid wire suitable for use with a solder less breadboard.
Wire the circuitry as shown in Fig #1, WX #175 Overview. Note that the MPX4115 pressure sensor, the SHT relative humidity sensors and the DS1820s need not be connected for initial testing.
Note that the programmed PIC is an 28-pin DIP device with terminals 1-14 on one side and terminals 15 (across from terminal 14) through 28 on the other side. Integrated circuits are descendants of vacuum tubes and the terminal assignment is in a circular counter clockwise fashion as viewed from the top.
Note that the 4.0 MHz resonator used as a clock is packaged in a 3-terminal SIP which is symmetrical. That is, ground the center terminal and connect the two outer terminals to PIC terminals 9 and 10. See Figure #2.
Note that there is a 4.7K pull up resistor to +5 VDC on the /MCLR terminal (term 1 of the PIC processor). The processor may either be reset by applying power, or by momentarily grounding the /MCLR terminal.
Assembly and Test Continued.
Prior to applying power;
The easiest test tool in verifying the serial the capabilities of the WX #175 is a PC or similar using a terminal emulation package such as HyperTerm. This has typically been a part of the Windows' distributions. It may also be downloaded from Hilgraeve (http://www.hilgraeve.com/htpe/). Configure the port as a direct connection to the COM port, 9600 baud, 8-N-1, no flow control. Note that if you do not have a serial port, consider a USB - RS232 converter.
Using the terminal emulator has the advantage of allowing you to verify each command by simply typing the command from the keyboard.
First a few words about RS232 communication. Normally when the line is idle, the line is at a TTL logic one (near +5VDC). A start bit, is a TTL logic zero pulse for one bit time (1/9600 or about 104 usecs). This is then followed by each of the eight bits followed by a return to idle, a TTL logic one.
However, the actual transmission uses levels which are less than -3.0 VDC (typically -8.0) for a logic one and greater than +3 VDC (typically +8.0) for a logic zero. This level inversion and shift is implemented in a PC or similar using a circuit similar to the MAX232 and thus if you measure the TX terminal of a PC when the port is idle, you will measure something in the range of -8.0 VDC.
The PIC16C773 processor associated with this design uses TTL levels. Thus, a MAX232 level translator is required to convert the -8.0 VDC level from the PC to a TTL logic one (near +5 VDC) and the +8.0 VDC to a TTL logic zero (near ground). Note that the MAX232 uses charge pumps in conjunction with the capacitors to generate voltages of nominally +/- 8.0 VDC.
Apply power and connect to the PC and connect to the PC COM port using Hyperterm of similar. Simply type;
A0followed by a new line.
This is the command to perform an A/D conversion on Analog input 0 (terminal 2 of the PIC).
Verify a decimal number in the range of 0 through 4095 appears on your terminal. Note that it may be any random value as there is no source currently connected to the ANALOG 0 input.
If this is successful, you have verified that the PIC is operating, that data can be sent to the PIC and the PIC can send data to the PC.
If you have a voltmeter, you might verify that the voltage at V+ (term 2 of the MAX232) is nominally +8.0 VDC and that at V- (terminal 6) of the MAX232 is at -8.0 VDC.
See Figure #1. Verify voltages as follows (or use the Morgan Logic Probe) when the Com port is idle;
Use Hyperterm or similar. With the probe attached to Point A (Fig #1) terminal 13 of the MAX232, verify the probe LED is off when the COM port is idle. Type a character and observe a brief flash of the LED. If you do not see this, there is a problem with your COM port. Attach the probe to Point B (term 18 of the PIC). When idle, the probe LED should be on. Type a character and note a brief flash.
If you able to send a character (brief flash at terminal 18 of the PIC), but there is no response to the A0 command, place the logic probe at Point C (terminal 11 of the MAX232). When idle, the probe LED should be on. In response to the A0 command, the processor will send the data and the probe LED should briefly flash. At Point D (terminal 14 of the MAX232), the probe LED should be off when idle. With the response to the A0 command, the probe LED should flash indicating data is being sent to the PC.
If unsuccessful, the problem is either the MAX232 or the PIC. To isolate the problem, temporarily remove the leads at terminals 18 and 17 of the PIC and connect terminal 12 to 11 on the MAX232. Thus, the MAX232 is configured in a loop back configuration. Whatever you type using HyperTerm will be echoed to the terminal. If this is successful, it indicates your COM port and the MAX232 are operating properly and the problem is most likely the PIC.
Again, check the power connections to the PIC, the pull up resistor to +5 VDC on terminal 1 of the PIC and the connection of the ceramic resonator. If you think you may have damaged the PIC, send me e-mail. A replacement is $6.00 plus $1.25 shipping in the US.
Assembly and Test Continued
MPX4115 Pressure Sensor
Install the MPX4115 as illustrated in Figure #1. Be sure to observe the terminal numbering. Note that the output of the sensor is connected to Analog 0.
From Hyperterm use the P command;
PThe atmospheric pressure will be returned to the PC or similar in decimal format. At sea level, this should be near 1013 millibars and will be less, depending on your altitude.
Normal atmospheric at sea level is nominally 1013 millibars and this is termed barometric pressure. Relatively small changes indicate drastically different weather conditions. For example, in the eye of a recent category 5 hurricane, the pressure was reported as 960 millibars.
However, atmospheric pressure decreases with altitude and thus if one were to interpret the atmospheric pressure in mile high Denver as being the barometric pressure, the number would suggest a daily catastrophe of biblical proportions. Rather, an expression is used to convert from atmospheric to barometric pressure which takes the altitude into account. Thus, the normal barometric pressure in Denver is reported as if Denver were at sea level.
The simplest technique for converting atmospheric pressure to barometric pressure for your installation is simply to scale the result. For example, assume the MPX4115 is reporting the atmospheric pressure as 861 millibars. However, your local weather (or CNN) reports the barometric pressure as 1010 millibars. Thus, the scaling factor is 1010 / 861 or 1.173. Simply multiply the atmospheric pressure by this altitude scaling factor.
Of course, in the US, we persist in doing things differently. Barometric pressure is usually reported as inches of mercury. The conversion factor from millibars to inches of mercury is 0.02953.
Thus, assume your unit is reporting 861 millibars. Multiplying by 0.02953 equates to 25.43 inches of Hg. However, your local weather station is reporting the local barometric pressure as 29.82. Thus, your altitude scaling factor is 29.82 / 25.43 or 1.173.
Thus, when reading the atmospheric pressure, first convert to inches of Hg and then apply the altitude scaling factor;
Barometric_inches_Hg = 0.02953 * 1.173 * MPX4115_reading
See Figure #3. The analog to digital converters may be tested using the printed circuit board mounted 4.7K potentiometer. The two sides of the potentiometer are connected to +5 VDC and GRD. As the wiper is moved. the voltage at the center terminal varies from 0.0 to 5.0 VDC.
Connect the wiper to an ANALOG input (terminals 3, 4, 5, 23 or 24 on the PIC). Using Hyperterm enter the command to perform an A/D measurement on the desired channel;
A1Verify a decimal number in the range of 0 - 4095 appears on the terminal.
The voltage is calculated as;
V_in = AVDD * adval / 4096 V_in = 5.0 * adval / 4096Thus, when the reading is 2048, the voltage at the A/D input is 2.5 VDC. (The wiper of the potentiometer is precisely at the midpoint).
In Figure #1, note that +5 VDC is connected to AVDD (terminal 7 of the PIC) and thus your 5.0 VDC supply is the voltage reference. There are very precise voltage reference available which provide such voltages as 2.048 or 4.096 VDC. However, this reference voltage limits the highest voltage which may be measured. The output of the MPX4115 may well exceed 4.096 VDC and thus I opted not to use a precsion voltage reference.
Sensirion SHT Relative Humidity Sensors.
Wiring to the SHT Relative Humidity Sensors is illustrated in Figures #1 and #5. To test, use the "H0" or "H1" command as appropriate and verify the processor displays the temperature and relative humidity;
Sensirion currently offers four models which differ in accuracy and packaging. The SHT-11 and SHT-71 provide an accuracy of 3.5 percent RH and the SHT-15 and SHT-75 provide 2 percent accuracy, but are more expensive. The SHT-11 and SHT-15 are packaged in surface mount packages where the leads are folded under the package. I took one look at this and decided I simply could not mount it on an adaptor board. The SHT-71 and SHT-75 are packaged on a small board with four pins arranged in a single line on 0.05 inch centers and I have found I can solder these to an adaptor. Thus, I offer only the SHT-71 and will solder these to SOIC to 8-pin DIP adaptors for you if you desire.
However, Sensirion offers a free sample of the SHT-11. Parallax offers an SHT-11 mounted on an SOIC to DIP adaptor for about $30.00.
Note that the terminal assignments for the SHT-1x and the SHT-7x differ as shown in Figure #5.
I assume that most users will desire a local RH sensor and a remote sensor. In the design, I slowed the communications and feel the remote device may be several hundred feet from the main WX #175 processor, but only tested the design to 100 feet. Note that four conductors are required; +5 VDC, GRD, DATA and SCK.
I have been an electrical engineer for some 35 years and have confronted many noise problems and feel an obligation to offer that "the way" to do this is with three twisted pairs as shown in Fig #5. Note that the ground conductors paired with the DATA and the SCK conductors are grounded at only one side to prevent ground loops. This arrangement may be implemented using CAT 5 cable.
However, I happened to have a 100 foot modular telephone extension cable with four conductors, not twisted, and went out and purchased two connector blocks and quickly implemented a connection the remote sensor. Indeed, I live in a suburban neighborhood with little industrial electrical noise and I don't operate my ham radio very much. However, my general feeling is that this arrangement is adequate for most applications.
Note that in connecting to the terminal block, a screw terminal which appears on one side is connected to the screw terminal on the opposite side at the distant terminal block. You might use an ohm meter to verify that what is DATA on one side is connected to DATA on the distant side, and repeat this for each of the four conductors.
To calibrate your sensors, I would suggest a linear offset. That is, if you are reading 76 percent humidity and the local weather station is reporting 72, simply subtract 4 percent from the raw reading.
When I began this design, I intended to calculate the dew point as well. However, this simply did not fit in the PIC processor. The dew point may be calculated;
EW_RH = exp10(0.6607 + 7.5 * TC / (237.3 + TC)) * RH / 100.0 DewPointTC = ((0.6607 - log10(EW_RH)) * 237.3) / (log10(EW_RH) - 8.16077)
DS1820 Temperature Runs
See Figure #6.
The WX #175 unit provides two twisted pair runs, each of which may accommodate up to sixteen DS18S20s or DS18B20s or any mix of the two with a maximum of 200 feet of twisted pair cable.
Temperatures on either of the runs are performed in response to the T command;
T0The unit responds with the temperature measurements;
0 27.50 10 F33A 1 26.67 22 3B3B 2 -5.26 etc 3 3.04 etcNote that the device number is simply a number assigned as each device is found. This is followed by the temperature in degrees C. The next field identifies the type of device (10 - DS18S20, 22 - DS18B20) and the last field expressed in 4-digit hexadecimal is a unique identifier for that particular device.
Each temperature measurement requires nominally one second.
If no devices are found on a run, no data is returned.
I routinely test each design with 200 feet of twisted pair cable and I am probably being conservative in noting the 200 feet limitation. Chances are that you can extend this, particularly if you use low capacitance cable such as CAT-5. However, it is important to note that once the capacitance (cable length) is too large, the entire run of devices will fail. That is, you will be no more able to reliably perform a measurement on the device closest to the PIC processor than on the device which is at the greatest distance.
If there is a communications error, the temperature will be reported as -88.88. This may occur occasionally if there is a burst of noise. However, if it occurs often, it is a "red flag" that there is too much cable on the run.
Unlike most of my designs, the WX #175 unit will accommodate both DS18S20s and DS18B20s on the same run. (Note that the DS1822 may also be used. This is supposed to be a low cost version of the DS18B20 with a sacrifice in accuracy, but for some reason costs about the same as the DS18B20. Why pay the same amount for an inferior device.)
See Figure #6C. Connect the DS2438 to one of the Dallas 1-W runs. Note that power (+5 VDC) must be supplied to the DS2438. This may be either a wire from the WX #175 unit or it may be locally supplied using a coin type +5 VDC battery.
Use Hyperterm or similar to send;
E0The unit will respond with the counts;
0 00000000 00000003 1D AA63 >
See Figure #7. The design provides a single TTL counter input. Commands are provided to either read the total number of counts (C0) or to measure the number of counts over a period of time (C1 - C9).
Connect the nominal 10 PPS output of the Morgan Logic Probe to the counter input (terminal 3 of the PIC). Using Hyperterm, periodically issue the command;
C0and note the total number of counts in decimal format. Note the maximum number of counts is 65,535 and then counter then rolls over to zero.
To measure the number of counts over fives seconds;
C5In theory, the value 50 should be returned. However, the logic probe's output is not precisely 10 PPS.
I have tested the design using an expensive HP function generator and found the results to agree within 0.2 percent. That is, with the function generator set to 1000 PPS, the C1 command result was 998.
See Figure #8. The WX #175 Kit provides two outputs which may be used to control an external transistor, FET or relay which may brought high or low using the N and F commands.
N0 F1In the above, output 0 is brought high and output 1 is brought low.
A discrete LED with an internal 330 Ohm series limiting resistor is provide to test the TTL outputs. TTL Inputs
See Figure #1. Two TTL inputs are provided on terminals 21 and 22 of the WX #175 PIC. The states may be read using the I0 and I1 commands.
Leave both open and send the commands;
I1Verify the reponse to each is a logic 1;
1 >Connect either to ground, use either the I0 or I1 command and verify a logic zero is returned;