Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.

Zoot

Member Since 06 Dec 2011
Offline Last Active Jan 02 2015 02:56 AM
-----

Topics I've Started

Has anyone successfully used a HS1101 humidity sensor?

27 April 2014 - 02:48 AM

I'm building a weather logger and I'm having trouble with the humidity sensor.  It works with an Arduino, but not with my Netduino.

 

Basically, it's a capacitive sensor, so you have to set the CPU pin to an output and set it high, wait a second, and then set it low.  You then read the pin to measure the voltage decay in the circuit.

 

The Arduino code looks like this:

long RCtime(int sensPin)
{
	long result = 0;
	pinMode(sensPin, OUTPUT);       // make pin OUTPUT
	digitalWrite(sensPin, HIGH);    // make pin HIGH to discharge capacitor - study the schematic
	delay(1);                       // wait a  ms to make sure cap is discharged

	pinMode(sensPin, INPUT);        // turn pin into an input and time till pin goes low
	digitalWrite(sensPin, LOW);     // turn pullups off - or it won't work
	while(digitalRead(sensPin))
	{    // wait for pin to go low
		result++;
	}

	return result;                   // report results   
}

Like I said, it works fine with an Arduino.

 

This is my testing code for the Netduino:

double result = 0;
OutputPort RCTime = new OutputPort(Cpu.Pin.GPIO_Pin1, false);
RCTime.Write(true);
Thread.Sleep(1000);
RCTime.Write(false);
//InputPort Rtime = new InputPort(Cpu.Pin.GPIO_Pin1, false, Port.ResistorMode.Disabled);
            
            
            
while (RCTime.Read())
{
    result++;
}

result = ((result * 1.3181042) / 10);
Debug.Print("Humidity: " + result + " %");

Using the InputPort function after using OutputPort throws an exception, so I'm just reading the OutputPort.  Unfortunately, pullup resistors have to be disabled for this to work, and InputPort has no write method.  I think the Netduino code is relativiely similar to the Arduino code, but I'm doing something worng.

 

Any thoughts would be appreciated.

 

Thank you.


Multiplexing I2C?

05 April 2014 - 02:51 AM

I'm hoping that someone can help...

 

I'm making a small weather logger, using a humidity sensor, real time clock, barometer and a temperature sensor all built on an Arduino shield, fitted with an SD card.

 

The problem that I'm having is that the RTC (DS1307) and the barometer chip (BM085) both use I2C.  I've searched the forum for a way to have these two items share the I2C bus, but haven't found anything.  I'm not sure it's even possible.  Would a better solution be to hardware multiplex with an external logic chip?

 

I'd much rather do it in code if I can due to limited space on the shield.  Any ideas?


home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.