Show Posts
Pages: 1 ... 5 6 [7]
91  Using Arduino / Programming Questions / Serial Monitor Not working as Expected. on: September 10, 2012, 10:29:13 pm
Hi all,

I just started with the Arduino controller, some weeks ago, and planning to do my Garduino . . .

Am still at the learning step of the Arduino language, Communication and Response.

I met with a prob about the Serial Monitor.

In fact am monitoring Pin 2 which is set as INPUT.

I used the following code:

Code:
/*
* Switch Test Program
*/

int switchPin = 2; // Assign Switch button to pin 2.

int var = digitalRead (switchPin); // Read Pin and save into var

void setup()      // Runs sketch once at start.
{
  Serial.begin(9600);// Set communication with UNO at 9600 bps.
  
  pinMode(switchPin, INPUT); // Sets digital pin as input to read switch
}

void loop()           // Runs sketch over and over
{
  Serial.print("Read Switch Input");  //print line on serial monitor

  Serial.println(var);  //print out value stored in var
  delay(100);           //Time delay of 100 ms
}
-----------------------
 
At first it was working perfectly, using pull up or pull down resistor via a mechanical switch. i.e. the serial monitor reads the pin status when it is high or low, it gives the result momentarily.


After i tried this sketch :

 
Code:
/*
* Switch Test Program
*/

int switchPin = 2; // Assign Switch button to pin 2.
int Led1 = 12; // Assign Led to pin 12
int var = digitalRead (switchPin); // Read Pin and save into var
int var1 = digitalRead (Led1); // Read pin and save into var1

void setup()      // Runs sketch once at start.
{
  Serial.begin(9600);// Set communication with UNO at 9600 bps.
  
  pinMode(switchPin, INPUT); // Sets digital pin as input to read switch
  pinMode(Led1, OUTPUT); // Sets digital pin as output to light led
}

void loop()           // Runs sketch over and over
{
  Serial.print("Read Switch Input");  //print line on serial monitor
  Serial.println(var);  //print out value stored in var
delay(100);           //Time delay of 100 ms
  Serial.print("Read Switch Output"); // print line on serial monitor
  Serial.println(var1); //printout value stored in var1
delay(1000);           //Time delay of 100 ms
}
-------------------------------------------------------------------------------------
Im unable to have my status display corectly on my serial monitor, since then, even when trying my first simple sketch, the serial monitor do display the actual status of the pin, but when changing state, the value would not change momentarily. I need to close the serial monitor first and re-open, then status change.

This is not how it should work, because when i press my switch, i should get a change from high to low or vice versa, ...

I do not really know what happened, i tried several troubleshooting to come to this point, i thought my switch was not good,  1 by 1 i tested all my components, but still NO SOULUTION . . :-(

Any help please . . .

Thanks

Taz . .

Moderator edit: Now with added [code] [/code] tagstm
92  Topics / Science and Measurement / Re: Greenhouse monitoring system on: August 12, 2012, 02:05:10 pm
hi there,

im actually working on tht project and finally ordered an ultimate microcontroller kit .. wheryby i shall design the various sensors and program an arduino uno board.

expecting my package by tomorrow, i am totally new in the programming of arduino but still it seems very interesting.

we can work on this together and share our knowledge if you want.

to get an idea for a start google out about garduino u shall found very useful information, keep me posted so that we can work together .

thanks

taz.....
................
93  Using Arduino / Project Guidance / Re: Greenhouse Automation with User interface. on: July 03, 2012, 02:27:14 am
Are you intending that the user interface be on the Arduino? Or, are you intending the user interface be run on a PC that talks to the Arduino?

It will be smoother to start with the user interface to be running on a PC that communicates with the Arduino, since we do have the USB port as an advantage on Arduino kits, i will be making use of it . .  smiley

I came across some researches with Arduino Scada, will that do for my project, i still do not know the complexity behind building this interface via scada and the codes to be implemented, but i can see this way will be easier. . .
Any other suggestions please will be welcome . . .


I would get a Mega, it may wind up being more than you need and they are more expensive than say a Uno but unless you're a poor student another $30 or so shouldn't matter. If it does matter then get a Uno.

I will be seeing both the specs of the Mega and the Uno, and of course the price to see if it meets my budget,  smiley and will decide it soon.


Inputs
1. Controlling the ambient temperature of the Greenhouse. Simple LM35 style sensor or maybe a DS18S20 1-wire device.


Can this LM35 signal be controlled as analog ?

I will look into the specs ASAP, my worry for the sensing part will be the voltage supply, Im I to provide an external power supply to the sensing devices or can it get the supply form the Arduino supply ? ?


2. Controlling the humidity level of the soil. Measure resistance between two nails in the soil, there are also sensors that do the same.

Will look into a ready made sensor, else i will be building one i got a circuit for that . . see attached. .

If i will be building the sensor what should i use for the sensor leads . . copper will be best suited, how to fix something, will nail do the job?


3. Controlling the light of the Greenhouse. Transistor or relay, depends on voltage and wattage of light.

For the light i will be going for an LDR, i will need to resolve the supply issue to be able to move forward . . smiley

As far as outputs is concerned, well i will be going through the relays, more appropriate, but as for now, i shall concentrate upon choosing the right inputs first and clear the voltage issue and choose my arduino kit.

Suggestions and comments are always welcomed and will be appreciated . .  smiley

Thanks  . .

taz . .
94  Using Arduino / Project Guidance / Greenhouse Automation with User interface. on: July 02, 2012, 06:29:22 am
Hi all,

I am actually  working towards building a project, entitle Greenhouse Automation with User interface using the Arduino kits. Due to the fact that im totally new to this Arduino Field, i would kindly like to request few helps from experts people present on this forum.  smiley

Project: Designing an automatic Greenhouse with presets for specific cultivation along with a user interface.
Control Parameters: The control will be restricted up to 3 parameters for easy going:

Inputs
1. Controlling the ambient temperature of the Greenhouse.
2. Controlling the humidity level of the soil.
3. Controlling the light of the Greenhouse.

Outputs
1. Ventillation shall be activated to regulate desired temperature.
2. Irriggation pump shall be set to ON/OFF upon humidity level of soil.
3. Activating the light on request due to ambient light source available.

User Interface
1. The user should be able to swap between pre-programmed presets.
2. If possible customized presets can be set by user.
3. User can be able to change specific parameters like temperature without going into the core programming of the Arduino.

Certainly the Interface part seems tough for me , specially when im totally new the Arduino Programming language.

I would like to have suggestions on the hardware parts and instrumenations to be used for this specific prototype.

Should i go for which ATMEL ?? since the user interface also is contributing to the bulk of the program.

Once the parts is decided, i shall take note and anyone so kind will please help me with the code writing, i will do my own effort though but please be kind to me, i will be grateful. smiley

Looking forward

Regards

taz . . 
95  Topics / Science and Measurement / Greenhouse monitoring system on: June 25, 2012, 02:20:32 pm
Hi all,

Sure im a newbie in the Arduino world, but wud like to experience with this amazing kit.

Before i buy the corresponding Arduino board (MicrocontrolLer) i would kindly be seeking some help from you people please, i will be ever grateful.

The thing is as such:

I need to design an automatic greenhouse monitoring system, to keep it simple i have chosen the following parameters to control:
1.Ambient Temperature of Greenhouse - - Ventillation will be activated
2. Humidity of Soil - - Irrigation pump to start on and off
3. Light intensity - - Control of light within the greenhouse.

(subject to change according to progress of research and availaibility)  smiley

My objectives is to design such an automatic control for the Greenhouse and i need to have a user interface as well, can say a data monitoring system, but here for e.g. the set point of temperature must be accessible to the greenhouse user for change dependant upon plant being cultivated.

I will need to  design some sort of presets for specific plant also (seems tough part), not yet work on that part.

My question is can i do the above project with Arduino microcontroller ( the control im sure i can) but the interface, is there a means od SCADA system or HMI, to facilitate the interaction of the user and the various control parameters.

Any suggestion from you will be appreciated.  smiley

Thanks

Looking forward. 
Pages: 1 ... 5 6 [7]