Show Posts
Pages: 1 ... 13 14 [15] 16 17 ... 24
211  Using Arduino / Sensors / Multiple Serial Humidity sensors - SHT71 on: September 27, 2011, 03:03:27 pm
I want to have multiple ( up to 10 ) humidity sensors connected to my Mega2560.

I already have 4 ds18b20 temp sensors connected to 1 input pin working perfectly.

Have been looking at the Sensirion SHT71 sensors and need advice.
Component link : http://za.rs-online.com/web/p/temperature-sensor/6675278/

From what I understand, these are digital serial sensors. Their connection pins are : DATA, SCK, VDD & GND.

I have looked at the tutorial (http://www.arduino.cc/en/Tutorial/SoftwareSerial) but I am still unsure of :

1. can I connect multiple sensors to the same DATA and SCK pins ?
2. if I need to seperate for each sensor, can one of the above 2 pins be common ( so I only need one additional pin for each additional sensor ) ?
3. if multiple sensors can be added to the same 2 pins, how do I get the humidity reading from a specific sensor ? Do they have some sort of unique internal address like the ds18b20 temp sensors ?

Appreciate your sharing experience and expertise.
212  Using Arduino / General Electronics / Safest option for home alarm on: September 07, 2011, 07:42:12 am
I think I have 2 options here, but not sure which would be the safest choice on 2 counts :

1. having wiring running through the roof of the house to the door contacts carrying 12v, or
2. protecting the Arduino board from interferance on the cables.

One option is to connect Ground to the contacts, and the feed back from the contact direct to the input pin.

Second option is to use an optocoupler (see attachment), but this would mean running a current through the wiring to / from the door contact.

Advice appreciated please.
213  Using Arduino / Programming Questions / Re: Setting the cursor position for a Serial LCD on: August 28, 2011, 04:02:43 am
Hi JRMN

Yes, it does still use 6 pins, but I didn't think that the pins used was the subject of the thread - it was to do with the cursor position. Did I mis-understand what you were looking for ?
214  Using Arduino / Programming Questions / Re: Setting the cursor position for a Serial LCD on: August 27, 2011, 04:21:01 pm
I use this :

Code:
#include <LiquidCrystal.h>    // include the library code:
LiquidCrystal lcd(2, 3, 4, 5, 6, 7);

void setup() {
  lcd.begin(16, 4);
  lcd.print("hello, world!");
}

void LCDpos(int Lcol, int Lrow) {
  lcd.setCursor(Lcol, Lrow);
  if(Lrow > 1) lcd.setCursor(Lcol + 16, Lrow - 2);
}

void loop() {

  LCDpos(0,1); lcd.print("Line 1");
  LCDpos(0,2); lcd.print("Line 2");
  LCDpos(0,3); lcd.print("Line 3");
  LCDpos(0,4); lcd.print("Line 4");

}
215  Using Arduino / Installation & Troubleshooting / Re: HELP - Really irritating problem. on: August 17, 2011, 03:39:19 pm
I dont have an antivirus installed so it aint that.

hmmm ... maybe that could be the problem.

216  Using Arduino / Displays / Re: LCD Rows 3/4 not starting in correct column on: August 17, 2011, 12:04:24 pm
Try using this code. Works for me.


You set the position with :
Code:
LCDpos(0,1)  ,etc

The function : void(LCDpos) receives the values passed to it, and sets the LCD cursor position, making adjustment for the 3rd and 4th lines.

Code:
void setup() {

  lcd.begin(16, 4);
  lcd.print("hello, world!");

}

void LCDpos(int Lcol, int Lrow) {
  lcd.setCursor(Lcol, Lrow);
  if(Lrow > 1) lcd.setCursor(Lcol + 16, Lrow - 2);
}

void loop() {
  LCDpos(0,1); lcd.print("Line 1");
  LCDpos(0,2); lcd.print("Line 2");
  LCDpos(0,3); lcd.print("Line 3");
  LCDpos(0,4); lcd.print("Line 4");
}
217  Using Arduino / Programming Questions / Re: Please help me find the error in this simple led sketch on: August 15, 2011, 01:48:04 am
Once you've got your board, start here ( http://arduino.cc/en/Guide/HomePage ) and all the pieces should easily fall into place.
218  Using Arduino / Programming Questions / Re: Please help me find the error in this simple led sketch on: August 14, 2011, 03:06:22 am
Once you have the board, connect via UCB to your PC.

Open the Arduino software, paste the sketch, set the com port and baud speed, upload ( at this point you'll see if there are any coding errors ).

The code will then run on the board.

Open the "Serial Monitor"  ( toolbar or Tools > Serial Monitor ).

Anything in the code that follows Serial.print will appear in the serial monitor window - a great tool for debugging and checking the flow of a sketch.

The Serial Monitor also has a small text box at the top. Type in 09:14:45 Set Time and Click on Send.
The serial display should show :
I received: 09:14:45 Set Time

Also with the code, if you type & send a  ~  character, it clears the ReadString buffer.
219  Using Arduino / Programming Questions / Re: Please help me find the error in this simple led sketch on: August 14, 2011, 02:09:23 am
If you have the board hooked up to your USB, you could set the time by sending the time via the Serial Monitor :

So you would type something like :  09:14:45 Set Time


Code:
int incomingByte = 0; // for incoming serial data
String ReadString;

void setup() {
  Serial.begin(9600);
}

void loop() {

  if (Serial.available() > 0) {
      char c = Serial.read();
      ReadString += c;
      if(ReadString.indexOf('~') > 0) {
        ReadString = "";
        Serial.println("Cleared String");
      }
    Serial.print("I received: ");
    Serial.println(ReadString);
    if(ReadString == "Set Time"){
//
// convert ReadString to a variable to hold the supplied time
//
    }
  }
}
220  Using Arduino / Programming Questions / Re: Please help me find the error in this simple led sketch on: August 13, 2011, 04:41:23 pm
I got started with LCDs reading this very nice tutorial:
http://www.ladyada.net/learn/lcd/charlcd.html

An excellent tutorial. Got me started in no time.

I added some code to my test file to make using my 16 x 4 LCD a bit easier.

Code:
#include <LiquidCrystal.h>    // include the library code:
LiquidCrystal lcd(2, 3, 4, 5, 6, 7);

void setup() {

  lcd.begin(16, 4);
  lcd.print("hello, world!");

}

void LCDpos(int Lcol, int Lrow) {
  lcd.setCursor(Lcol, Lrow);
  if(Lrow > 1) lcd.setCursor(Lcol + 16, Lrow - 2);
}

void loop() {

  LCDpos(0,1); lcd.print(millis()/1000);
  LCDpos(0,2); lcd.print(millis()/500);
  LCDpos(0,3);
  lcd.print(millis()/2000);
  lcd.write(0);

}
221  Using Arduino / Programming Questions / Re: Send command from Serial Monitor to Arduino without halting code on: July 28, 2011, 06:22:24 am
That's because "c" is a string literal, but 'c' is a character literal.

Just goes to show how spoilt I was with years of VB5 coding.
222  Using Arduino / Programming Questions / Re: Send command from Serial Monitor to Arduino without halting code on: July 28, 2011, 06:21:10 am
getting fancy now.

Have upgraded so it clears the String whenever the ~ is found :

Code:
 if (Serial.available() > 0) {

      char c = Serial.read();
      ReadString += c;

      if(ReadString.indexOf('~') > 0){
        ReadString = "";
        Serial.println("Cleared String");
      }

    Serial.print("I received: ");
    Serial.println(ReadString);

    if(ReadString == "Dump Data"){
      LCDpos(0,3); lcd.print("Dumping Data");
    }
  }

Thanks also to ManicDee for the info
223  Using Arduino / Programming Questions / Re: Send command from Serial Monitor to Arduino without halting code on: July 28, 2011, 06:10:34 am
A perfect example of how all that experience makes it look so easy for you  smiley

I was trying :

Code:
    if(c == "~"){

and couldn't understand why it didn't work.
224  Using Arduino / Programming Questions / Re: Send command from Serial Monitor to Arduino without halting code on: July 28, 2011, 05:53:16 am
Learning fast.

Got it to convert the serial bytes to a string, and found a way to clear the string using a selected character (~)

Code:
#include <LiquidCrystal.h>

//pin numbers for LCD display
LiquidCrystal lcd(2, 3, 4, 5, 6, 7);

int incomingByte = 0; // for incoming serial data
String ReadString;
String LastString;

void setup() {

  Serial.begin(9600);
  lcd.begin(16, 4);

}

void LCDpos(int Lcol, int Lrow) {
  lcd.setCursor(Lcol, Lrow);
  if(Lrow > 1) lcd.setCursor(Lcol + 16, Lrow - 2);
}

void loop() {

  if (Serial.available() > 0) {

    char c = Serial.read();
    LastString = c;

    if(LastString == "~"){
      ReadString = "";
      Serial.println("Cleared String");
    }else{
      ReadString += c;
    }

    Serial.print("I received: ");
    Serial.println(ReadString);

    if(ReadString == "Dump Data"){
      LCDpos(0,3); lcd.print("Dumping Data");
    }
  }
}
225  Using Arduino / Programming Questions / Re: Send command from Serial Monitor to Arduino without halting code on: July 28, 2011, 05:46:37 am
Thanks again AWOL

Pages: 1 ... 13 14 [15] 16 17 ... 24