Show Posts
Pages: 1 2 [3] 4 5 ... 7
31  Using Arduino / Programming Questions / Re: Noob questions on: March 07, 2013, 10:44:27 am
Hello,

I suggest you use millis as such, since i myself just learned it this way, so as to prevent the stack from overflowing and have a more performant timer.

Code:

if (millis() - previousMillis >= interval)
{
    previousmillis += interval
// . . . Your code goes here

}

Remember that after each IF statement you need to use "{ }".

For i to understand this i state it as such  :
Code:
if (x, condition met)
{ Execute what is within curly brackets }

same goes for ELSE statement.

As for your case of using LEFT variable name, your arduino will not know which is which, as you did define it now.

I suggest you use different name for each output pin, e.g
Code:
const int LEFT0 = 5;
const int LEFT1 = 6;
const int LEFT2 = 9;
const int LEFT3 = 10;

and if you get along with this you will have to define each single variable as output and trigger each one with its own delay.

Else, if you want arduino to know only one variable with different pins, then you will have to go for ARRAY [ ]  . .

Hope this help . .

taz . .
32  Using Arduino / Programming Questions / Re: Last stage debugging - Help !! on: March 06, 2013, 01:46:07 pm
Hello,

Thanks for the great help peterH . .

Now my voltage pin do flip like a charm, my moisture values are quite stable and im happy that my sensors work as expected.

The modulo function do great in the switching of the case, great idea . . thanks load peterH.

I attached the source code for reference, and if any other changes and improvements can be made, i will be glad to review it and make necessary changes, while getting to learn more and new things at the same time.

Thanks again for all the responses towards this post.

My next step is to implement an LCD , to display all the real values and essential information with a pushbutton to change the mode Display.
Im looking forward to be using another switch Case function again, hope i dont run into much trouble.

However, troubles are here for us to learn more , . . . and Learning never ends . . .

Regards

Tazlim . . .
33  Using Arduino / Programming Questions / Re: How to have a Triggered Pulse on: March 06, 2013, 10:45:28 am
 Check for blink without delay in the Arduino Playground. .  that will surely help a lot.

Here is the link : http://arduino.cc/en/Tutorial/BlinkWithoutDelay

Rgds

Taz ..
34  Using Arduino / Programming Questions / Re: Last stage debugging - Help !! on: March 05, 2013, 07:15:27 am
hi peter ..
thanks for your kind response, i appreciate it loads..

i did read about the stack memory being overflow after around 50 days, but did not really know how to aproach for its preventive measures .. here you showed to me..

i was suspecting the itemIdx being my culprit the way it was incrementing.. thanks for confirming ..

i shall try out these changes once im back home, n will update all here with the entire code as attachment as requested by wildbill also ..

thanks again..

see ya ..
35  Using Arduino / Programming Questions / Re: Last stage debugging - Help !! on: March 04, 2013, 01:22:15 pm
hello . .

Been working a bit with the code. .

Quote
I haven't looked at your code at all, but this comment above caught my eye. If you are implementing a resistive moisture sensor then you will probably be trying to set up a voltage divider with some high resistances. In that case, the integral LED that most Arduinos have connected to pin13 might be acting as a pull-down which prevents your circuit from dividing the voltage correctly. You could try using any pin other than 13; if that then works correctly it suggests this was the problem.

I agree with you that the pull down resistor willbe adding up in the voltage divider circuit, even though changing the pin from 13 to 8 still results in my voltage not flipping. however, i did observed some more stable values.

I bring some changes here with the code, but still stick to my bug :


Code:
// Function to run water pump on conditions of soil moisture

if (FuncActive == true){
  if (pump_Status == false){
pumpControlON ();
  }
}

// Function to run off pump based on conditions
if ( pump_Status == true){
pumpControlOFF();
}

// Function to Activate LightSwitch for plants on conditions of ambient light
if (ReadPhoto == true){
LightAction ();
}
 // Function in taking Temperature Readings and saving to global variable Actualtemp
if (TempRead == true){
Actualtemp = temperatureRead ();
TempRead = false;
}

i think i will be changing the switch case variable, the itemIdx from incrementing directly as a parameter function, rather incrementing it through each case, any suggestion towards that approach.

Thanks
36  Using Arduino / Programming Questions / Re: Last stage debugging - Help !! on: March 04, 2013, 07:07:51 am
ok .. i do get it ..

in anyhow, how would i remove this damm bug which is preventing my voltage from flipping..

im trying all combination since then, but any of them is  not working..

do you think that the voltage flipping which is under case 0, is being missed or anything likewise..  i wanna try to put that on a different case say case 1 . .

thansks for any sugestion . ..

taz..
37  Using Arduino / Programming Questions / Re: Last stage debugging - Help !! on: March 04, 2013, 01:53:58 am
Quote
Quote
the delay is just for Serial port viewing for debugging purpose.
That may be the intended use, but delay() doesn't know that. It stops your code from doing anything else, except processing interrupts.

i did remove the delay from the code still, my voltage pin would not flip . .

Say if i change those code lines as such, will that have a contrast in running the whole code. (( Im at my workplace for now, so i cannot test these, i just asking a suggestion))

Code:
float temperatureRead (){
  if (TempRead == true){
. . . .
}

instead

Code:
void loop () {
 if (TempRead == true){
float temperatureRead (){
. . .
}

and for those as well :
Code:
void LightAction (){
 if (ReadPhoto == true){
. . . .
}

[code]
void () loop {

 if (ReadPhoto == true){
     void LightAction (){
. . . . .
}


thanks .  . .[/code]
38  Using Arduino / Programming Questions / Re: Last stage debugging - Help !! on: March 03, 2013, 12:15:22 pm
This has me curious -

Code:
oid FanControlOFF()
{
    if ( FanStatus == true )
    {   }

    {
        if ( Actualtemp <= 24.50 )
        {
            digitalWrite(Fan01, LOW);
            FanStatus = false;
        }
    }
}


Curious . . why ??  when conditions for my fan are to be run, i set the flag for Fanstatus to be true, and i use same to get it to shut off along with the temperature reading desired. my simulation with leds do work well.

anything i missed or something you finding suspicious here . .

thanks ..
39  Using Arduino / Programming Questions / Re: Last stage debugging - Help !! on: March 03, 2013, 12:08:04 pm
Quote
But you didn't once use Tools + Auto Format to fix the indenting. You didn't once think that putting each { on a new line would help visualize the code structure.

i do have a nice indenting in my source code, i removed all coments and extra spaces before posting here, so as not to exceed max number of characters.

Quote
Mixing millis() and delay() in the same code is rarely a good idea.

the delay is just for Serial port viewing for debugging purpose.

Quote
why is itemIdx a char
i could have used other variable as well, but its just i think a matter of saving space . . i dont really know, as i was helped upon this issue while i had to be using multiple millis, having the same time duration.

40  Using Arduino / Programming Questions / Last stage debugging - Help !![SolveD] on: March 03, 2013, 10:48:59 am
Hello ,

I reached my last stage of debugging my prgm code, with 2 of my sensors working very fine, i mean as i expect them to work :-), my output as well work fine.

The only issue is with my soil moisture sensor, it is not flipping my damm voltage pin from pin 13 to 12. (tested with voltmeter, and in serial port always returning value 1023)

The peculiar part is with another sketch which i first drafted having only the soil moisture probe sketch, here the voltage is flipping nicely and im having my results as expected.

Second sketch:
Code:
/*--- Declaration of I/Os ---*/

//INPUT pins definition

// OUTPUT pins definition
const uint8_t voltageFlipPin01 = 13;    
const uint8_t voltageFlipPin02 = 12;
const uint8_t pump_Active = 11;        
const uint8_t LightOn = 10;            
const uint8_t Fan01 = 9;

// Definition of Analog pins for Soil Moisture Sensor Readings.
const uint8_t Moisture_Input = 5;      
const uint8_t photoSense = 4;          
const uint8_t TempLm35 = 3;            
                        
/*--- Declaration of Variables ---*/

// Switch case Variable
char itemIdx = 0;

// Status flag
boolean pump_Status = false;          
boolean FuncActive = false;                
boolean LightStatus = false;                      
boolean ReadPhoto = false;
boolean TempRead = false;
boolean FanStatus = false;

// Moisture Value Variables
int Moist_Val01;
int Moist_Val02;
int Moist_Avg01;
double percentage_Moist;

int photo_Read;    
int Lm35_Read;      

float TempReadC = 0.0;
float Actualtemp;

// Timer Parameters
unsigned long currentTimer;
unsigned long timerLast = 0;
const unsigned long timerRate = 1000UL;
unsigned long lastPump = 0;
const unsigned long timerRateX = 7000UL;

void setup(){
  Serial.begin(9600);                  
  
  pinMode(Moisture_Input, INPUT);
  pinMode(photoSense,INPUT);
  pinMode(TempLm35,INPUT);
  
  pinMode(voltageFlipPin01, OUTPUT);
  pinMode(voltageFlipPin02, OUTPUT);
  pinMode(pump_Active, OUTPUT);
  pinMode(LightOn,OUTPUT);
  pinMode(Fan01,OUTPUT);
  
  digitalWrite(voltageFlipPin01, LOW);
  digitalWrite(voltageFlipPin02, LOW);
  digitalWrite(pump_Active,LOW);
  digitalWrite(LightOn,LOW);
  digitalWrite(Fan01,LOW);
}

float temperatureRead (){
  if (TempRead == true){
     //getting the Raw analog reading from the temperature sensor
 int Lm35_Read = analogRead(TempLm35);  
 
  // converting that reading to voltage
 float voltage = Lm35_Read * 5.00;
 voltage /= 1024.00;
 // Convert voltage to Temperature
 TempReadC = (voltage) * 100.00 ;  
  
  return TempReadC;
  }
 TempRead = false;
}

void FanControlON (){
if (FanStatus == false){
  if (Actualtemp >= 26.50){
   digitalWrite(Fan01,HIGH);
  FanStatus = true;}
}
}

void FanControlOFF (){
if (FanStatus == true);{
  if (Actualtemp <=24.50){
   digitalWrite(Fan01,LOW);
   FanStatus = false;  
 }  
}
}

void pumpControlON (){
if (FuncActive == true){
  if (pump_Status == false){
  if ( percentage_Moist <= 85.00 ){
    digitalWrite(pump_Active,HIGH);
    pump_Status = true;
}
}
}
}

void pumpControlOFF (){
if ( pump_Status == true){
  if ( currentTimer >= (lastPump + timerRateX )|| percentage_Moist >= 90.00){
    lastPump = currentTimer;
    digitalWrite(pump_Active,LOW);  
    pump_Status = false;
  }
}
}
void LightAction (){
 if (ReadPhoto == true){
 photo_Read = analogRead(photoSense);
   if (photo_Read < 200) {
     digitalWrite(LightOn,HIGH);
           LightStatus = true;}
   else if (photo_Read > 520){
     digitalWrite(LightOn,LOW);
           LightStatus = false;}
}
}
void loop(){
 

 currentTimer = millis();
 

 if( currentTimer >= (timerLast + timerRate) ){
   timerLast = currentTimer;

 switch(++itemIdx){
     case 6:
             itemIdx = 0;
             break;
    
     case 0:
             digitalWrite(voltageFlipPin01, HIGH);
             digitalWrite(voltageFlipPin02, LOW);
             break;
    
     case 1:
             Moist_Val01 = 1023 - analogRead(Moisture_Input);
             break;
    
     case 2:
             digitalWrite(voltageFlipPin01, LOW);
             digitalWrite(voltageFlipPin02, HIGH);
             break;
 
     case 3:
             Moist_Val02 = analogRead(Moisture_Input);
             Moist_Avg01 = (Moist_Val01 + Moist_Val02) / 2;
             percentage_Moist = ((Moist_Avg01/1000.00)*100.00);
             FuncActive = true;
             digitalWrite(voltageFlipPin01, LOW);
             digitalWrite(voltageFlipPin02, LOW);
             break;
     case 4:
             ReadPhoto = true;
             break;
    
    
    
    case 5:
             TempRead = true;
             break;
   }
 }

pumpControlON ();
pumpControlOFF();
LightAction ();
Actualtemp = temperatureRead ();
FanControlON ();
FanControlOFF ();

    if ( pump_Status == true ){
      Serial.print (" Pump Status : ACTIVE ");
      Serial.println();}
      
    else if ( pump_Status == false ){
      Serial.print ( " Pump Staus : INACTIVE ");
      Serial.println();}

   if ( LightStatus == true ){
      Serial.print (" Light Status : ACTIVE ");
      Serial.println();}
      
   else if ( LightStatus == false ){
      Serial.print ( " Light Staus : INACTIVE ");
      Serial.println();}
      
   if ( FanStatus == true ){
      Serial.print (" Fan Status : ACTIVE ");
      Serial.println();}
      
  else if ( FanStatus == false ){
      Serial.print ( " Fan Staus : INACTIVE ");
      Serial.println();}

  delay(500UL);

// Photo Sensor Reading and displaying  results through LCD and Serial Port.    
  Serial.print("Photo_Reading = ");
  Serial.print(photo_Read);     // the raw analog reading A4
  
   // We'll have a few threshholds, qualitatively determined reference to table of Lux.
  if (photo_Read < 10) {
    Serial.println(" - Dark");
  } else if (photo_Read < 200) {
    Serial.println(" - Dim");
  } else if (photo_Read < 500) {
    Serial.println(" - Light");
  } else if (photo_Read < 800) {
    Serial.println(" - Bright");
  } else {
    Serial.println(" - Very bright");
ReadPhoto = false;  
}
  delay(1000);

}  


First sketch: where voltage flipping occurs:

Code:
/*--- Declaration of I/Os ---*/
const uint8_t voltageFlipPin01 = 13;
const uint8_t voltageFlipPin02 = 12;

const uint8_t pump_Active = 11;
const uint8_t Moisture_Input = 5;


/*--- Declaration of Variables ---*/

// Switch case Variable
char itemIdx = 0;

// Pump status flag
boolean pump_Status = false;
boolean Active = false;

// Moisture Value Variables
int Moist_Val01;
int Moist_Val02;
int Moist_Avg01;
double percentage_Moist;

// Timer Parameters
unsigned long currentTimer;
unsigned long timerLast = 0;
const unsigned long timerRate = 1000UL;
unsigned long lastPump = 0;
const unsigned long timerRateX = 7000UL;
// Codes running only once at start up. Initialisation.

void setup(){
  Serial.begin(9600);
  pinMode(Moisture_Input, INPUT);
  
  pinMode(voltageFlipPin01, OUTPUT);
  pinMode(voltageFlipPin02, OUTPUT);
  pinMode(pump_Active, OUTPUT);
  
  digitalWrite(voltageFlipPin01, LOW);
  digitalWrite(voltageFlipPin02, LOW);
  digitalWrite(pump_Active,LOW);
}
void pumpControlON (){
if (Active == true){
  if ( percentage_Moist <= 80.00 ){
  pump_Status = true;
  digitalWrite(pump_Active,pump_Status);
  Active = false;
}
}
}

void pumpControlOFF (){
if ( pump_Status == true){
  if ( currentTimer >= (lastPump + timerRateX )|| percentage_Moist >= 90.00){
    lastPump = currentTimer;
    pump_Status = false;
    digitalWrite(pump_Active,pump_Status);  
  }
}
}
// Codes running forever.

void loop(){
 
// Keep track of milliseconds elapsed.
 currentTimer = millis();
 if( currentTimer >= (timerLast + timerRate) ){
   timerLast = currentTimer;
 switch(++itemIdx){
      
     case 5:
             itemIdx = 0;
    
     case 0:
             digitalWrite(voltageFlipPin01, HIGH);
             digitalWrite(voltageFlipPin02, LOW);
             break;
    
     case 1:
             Moist_Val01 = 1023 - analogRead(Moisture_Input);
             break;
    
     case 2:
             digitalWrite(voltageFlipPin01, LOW);
             digitalWrite(voltageFlipPin02, HIGH);
             break;
    
     case 3:
             Moist_Val02 = analogRead(Moisture_Input);
             Moist_Avg01 = (Moist_Val01 + Moist_Val02) / 2;
             percentage_Moist = ((Moist_Avg01/1000.00)*100.00);
             digitalWrite(voltageFlipPin01, LOW);
             digitalWrite(voltageFlipPin02, LOW);
             break;
    
    case 4: Active = true;
            
   }
 }

pumpControlON ();
pumpControlOFF();
  
    if ( pump_Status == true ){
      Serial.print (" Pump Status : ACTIVE ");}
      Serial.println();
      
    if ( pump_Status == false ){
      Serial.print ( " Pump Staus : INACTIVE ");}
      Serial.println();
  delay(500UL);

  }

Any help please, i spent the whole day today looking for my bugs . . but smiley-sad . .
41  Using Arduino / Programming Questions / Re: Help with multiple millis() on: February 25, 2013, 10:17:12 pm
hello,

Thanks for the pseudo layout, that works like a charm with the switch case function.

 smiley-wink

Here is the code :
Code:
/*--- Declaration of I/Os ---*/

// Dc source for Soil moisture sensor Flipping voltage, preventing etching of probes.

const uint8_t voltageFlipPin01 = 13;
const uint8_t voltageFlipPin02 = 12;

// Definition of Analog pins for Soil Moisture Sensor Readings.

const uint8_t Moisture_Input = 5;


/*--- Declaration of Variables ---*/

// Switch case Variable
char itemIdx = 0;

// Moisture Value Variables
int Moist_Val01;
int Moist_Val02;
int Moist_Avg01;

// Timer Parameters
unsigned long currentTimer;
unsigned long timerLast = 0;
const unsigned long timerRate = 1000UL;

// Codes running only once at start up. Initialisation.

void setup(){
  Serial.begin(9600);
  pinMode(voltageFlipPin01, OUTPUT);
  pinMode(voltageFlipPin02, OUTPUT);
 
  digitalWrite(voltageFlipPin01, LOW);
  digitalWrite(voltageFlipPin02, LOW);
 
  pinMode(Moisture_Input, INPUT);
 
}

// Codes running forever.

void loop(){
 
// Keep track of milliseconds elapsed.
 currentTimer = millis();
 
// Delay Timer with millis()in executing each soil moisture sequence.
 if( currentTimer >= (timerLast + timerRate) ){
   timerLast = currentTimer;
 
/* Switch function to compare Switch Case Variable 'itemIdx', and to run appropriate 'case' */   
 switch(++itemIdx){
 
/*-- Soil Moisture Reading Sequence--*/
// Allow current to flow in Forward and Reverse direction while reading value from Soil Moisture Probe in both direction. 
   
     case 4:
             itemIdx = 0;
     
     case 0:
             digitalWrite(voltageFlipPin01, HIGH);
             digitalWrite(voltageFlipPin02, LOW);
             break;
   
     case 1:
             Moist_Val01 = 1023 - analogRead(Moisture_Input);
             break;
   
     case 2:
             digitalWrite(voltageFlipPin01, LOW);
             digitalWrite(voltageFlipPin02, HIGH);
             break;
   
     case 3:
             Moist_Val02 = analogRead(Moisture_Input);
             Moist_Avg01 = (Moist_Val01 + Moist_Val02) / 2;
             digitalWrite(voltageFlipPin01, LOW);
             digitalWrite(voltageFlipPin02, LOW);
             break;
             
   }
 }



 // case 3:
    Serial.print("Sensor Value #1: ");
    Serial.println(Moist_Avg01);
    Serial.println();
   
    Serial.print ("Moist_Val01 = ");
    Serial.println (Moist_Val01);
   
    Serial.print ("Moist_Val02 = ");
    Serial.println (Moist_Val02);
    Serial.println();
   
  delay(500UL);

  }

Thanks again Pyro_65 . .
42  Using Arduino / Programming Questions / Re: Help with multiple millis() on: February 25, 2013, 01:21:22 am
Quote
Code:
// Keep track of milliseconds elapsed.
 CurrentTimer = millis();

You don't use this variable anywhere.
i did use it before, then i replaced it directly with millis() function was trying to sort out the bug.

Quote
These if statements probably do their stuff all on the same loop, or with very little delay between, maybe change the initial timing or try  to use 'else if' statements only match one of the conditions per iteration of loop.

Initial timing meaning, more than 1000UL, or how should i do that, i will try with if else statement in the meanwhile.
Thanks . .

Quote
Why do you believe your output pins aren't changing?  I think they are, but you won't see it without
an oscilloscope since they change for about 0.1ms every second.
You are right, that's why this explain the rapid fluctuations on my voltmeter on pin 13, but for pin 12 only some mV are able to be detected.

From serial output, i can have reading on analog pin in forward direction of current but constant value of 1023 while in reverse direction.
Quote
You have three timer variables yet they run in perfect lockstep since they have the same delay, thus
every time they get to fire up their code sections they all run, leaving both output pins LOW.  Why
three variables?

Here is part of the code from 'Gardenbot' and taking account with some threads on this forum, for soil moisture which i brought some modifications, with its original delay timer function.
Code:
const int timer = 1000;

Code:
    digitalWrite(voltageFlipPin01, HIGH);
    digitalWrite(voltageFlipPin02, LOW);
    delay(Timer);
    Moist_Val01 = analogRead(Moisture_Input_0);
    delay(Timer);
    digitalWrite(voltageFlipPin01, LOW);
    digitalWrite(voltageFlipPin02, HIGH);
    delay(Timer);
    Moist_Val02 = 1023 - analogRead(Moisture_Input_0);
    Moist_Avg01 = (Moist_Val01 + Moist_Val02) / 2;
    digitalWrite(voltageFlipPin01, LOW);
    digitalWrite(voltageFlipPin02, LOW);

Any help will be appreciated. .

Thanks
43  Using Arduino / Programming Questions / Help with multiple millis() on: February 24, 2013, 10:42:37 pm
Hello,

Can someone help me locate why my voltage is not flipping, from pin 13 to 12.

Code:
/*--- Declaration of I/Os ---*/

// Dc source for Soil moisture sensor Flipping voltage, preventing etching of probes.

const uint8_t voltageFlipPin01 = 13;
const uint8_t voltageFlipPin02 = 12;

// Definition of Analog pins for Soil Moisture Sensor Readings.

const uint8_t Moisture_Input = 5;


/*--- Declaration of Variables ---*/

// Switch case Variable
int Soil_Sensor = 1;

// Moisture Value Variables
int Moist_Val01;
int Moist_Val02;
int Moist_Avg01;

// Timer Parameters
unsigned long CurrentTimer;
unsigned long timerLastX;
unsigned long timerLastY;
unsigned long timerLastZ;
const unsigned long timerRateX = 1000UL;
const unsigned long timerRateY = 1000UL;
const unsigned long timerRateZ = 1000UL;

// Codes running only once at start up. Initialisation.

void setup(){
  Serial.begin(9600);
  pinMode(voltageFlipPin01, OUTPUT);
  pinMode(voltageFlipPin02, OUTPUT);
 
  digitalWrite(voltageFlipPin01, LOW);
  digitalWrite(voltageFlipPin02, LOW);
 
  pinMode(Moisture_Input, INPUT);
   
  timerLastX = millis();
  timerLastY = millis();
  timerLastZ = millis();

}



// Codes running forever.

void loop(){
 
  /* Switch function to compare Switch Case Variable 'Soil_Sensor', and to run appropriate 'case' */
 
// Keep track of milliseconds elapsed.
 CurrentTimer = millis();
 
 /*-- Soil Moisture Reading Sequence--*/

// Allow current to flow in Forward and Reverse direction while reading value from Soil Moisture Probe in both direction. 
    digitalWrite(voltageFlipPin01, HIGH);
    digitalWrite(voltageFlipPin02, LOW);

// Delay timer with millis(); reading Moisture value in Fwd direction.
        if ((millis() - timerLastX) >= timerRateX)
        {timerLastX = millis();
        Moist_Val01 = 1023 - analogRead(Moisture_Input);}
   
// Delay timer with millis(); Reverse direction of Vcc pin.
        if ((millis() - timerLastY) >= timerRateY)
        {timerLastY = millis();
    digitalWrite(voltageFlipPin01, LOW);
    digitalWrite(voltageFlipPin02, HIGH);}

// Delay timer with millis(); reading Moisture value in RvS direction + Averaging.
        if ((millis() - timerLastZ) >= timerRateZ)
        {timerLastZ = millis();
    Moist_Val02 = analogRead(Moisture_Input);
    Moist_Avg01 = (Moist_Val01 + Moist_Val02) / 2;
    digitalWrite(voltageFlipPin01, LOW);
    digitalWrite(voltageFlipPin02, LOW);}
 

 // case 3:
    Serial.print("Sensor Value #1: ");
    Serial.println(Moist_Avg01);
    Serial.println();
   
    Serial.print ("Moist_Val01 = ");
    Serial.println (Moist_Val01);
   
    Serial.print ("Moist_Val02 = ");
    Serial.println (Moist_Val02);
    Serial.println();
   
  delay(500UL);

  }

I can get reading from Moist_Val01 only and when i measure voltages across pin 13, it do fluctuates, but i cant read it , too fast. moreover, on pin 12, no voltage is read at all.

Any help in understanding the millis() and bring appropriate correction.

Thanks
44  Using Arduino / General Electronics / Help in understanding Transistors . . . on: February 16, 2013, 10:51:25 am
Hello.

I have been able to grasp some knowledge about Transistors through reading so far:

1. I been through the theory behind transistors. Helpful in understanding its operation.

2. Transistors can be used as a switching device.

3. Transistors can be used to amplify current.

Based on my application can i request some kind help from you guys, in understanding more throroughly the right application to be used for transistors.

CASE 1

I have a small fan with 5V supply and drawing 160mA current. If using a transistor with the fan should be switching type if an external power supply is to used with a high current rating right ?

If i need to use the very same power supply from the arduino itself should i be using the amplification technique ?

CASE 2

2 Brushless dc motor 24Vdc and current rating 160mA. Same here should i be using the transistor as a switch because definitely i should be having an external power supply ?

Another question, can i connect both Fans through only 1 output pin from the duino board using 1 transistor and 1 reverse biased diode ?
45  Using Arduino / General Electronics / Re: FAN PWM Control on: February 16, 2013, 03:13:24 am
Hello,

I just gone through some readings and come across positive voltage regulator. I do have some in hands having reference L7805CV.
http://html.alldatasheet.com/html-pdf/22634/STMICROELECTRONICS/L7805CV/1621/1/L7805CV.html

Can i use these voltage regulators to connect with my fan load.

My apologise in asking these stufss which may sound silly, as im noob in circuit designs..

Alternatively i do have 1 transistor NPN S9013.

http://www.hz-dz.net/UploadFiles/200952711452305.pdf

Meanwhile i will continue my readings and geet to my PWM objective for my fans . . smiley

Cheers . .
Pages: 1 2 [3] 4 5 ... 7