measure ohm of HS15P

Dependencies:   mbed

Fork of Frequency_counter by Neel Shah

This test program measures ohm of HS15P, humidity sensor.

/media/uploads/strysd/hs_15p_try4a.png

C(micro F) with LMC5550.10.150.220.330.470.681
CONV_KILO_OHM0.00720.00480.00330.00220.00150.00110.00072

If you get 2500 microseconds as interrupt time interval , it means 18 kilo ohm when 0.1 micro F. ( = 2500 * 0.0072 )

  • ohm of HS15P is calculated from pulse interval of LMC555.
    • CONV_KILO_OHM will be used.
  • this program reads interval time.between interrupt in the P8.
  • takes ON the P9 to oscillate LMC555 as short as enough to measure interval time
  • last several interval times will be used for calculation.
    • the time is defined as READ_TIMER .
  • In current circit, VDD of LMC555 is about 1.55V, AC 0.4V between pins of HS15P.
    • LMC555 consumes 120 micro A while oscillation, 90 micro A when level of P9 is OFF. (reset is ON)
    • Total 1-2mA is consumed in the circit.

Related nootbook : https://mbed.org/users/strysd/notebook/measure_humidity_with_hs15p_and_lmc555/

Revision:
0:c5bcf643a8b1
Child:
1:e2034bcdb101
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sun Feb 03 21:06:02 2013 +0000
@@ -0,0 +1,32 @@
+#include "mbed.h"
+
+Serial pc(USBTX, USBRX);
+InterruptIn in(p8);
+DigitalOut led(LED1);
+DigitalOut led2(LED2);
+Timer t1;
+
+float t_period = 0;                   // This is the period between interrupts in microseconds
+float t_freq = 0;
+
+void flip(void)
+{
+    led=!led;
+    t_period = t1.read_us();                // Get time since last interrupt
+    t_freq = (1/t_period)*1000000;   // Convert period (in us) to frequency (Hz)
+    t1.reset();                             // Reset timer and wait for next interrupt
+}
+
+int main() {
+    pc.printf("\rStarting frequency counter\n");
+    in.mode(PullDown);              // Set the pin to Pull Down mode.
+    in.rise(&flip);                 // Set up the interrupt for rising edge
+    t1.start();                     // start the timer
+      
+    while (1) {
+        wait_ms(100);
+        led2=!led2;
+        pc.printf("\rfrq is %d Hz\n", (int)t_freq);
+    }
+
+}
\ No newline at end of file