Show Posts
Pages: [1] 2 3 4
1  Using Arduino / Networking, Protocols, and Devices / Re: how-to-make-a-simple-arduino-wireless-shield on: September 10, 2014, 11:35:16 pm
Hello Kowalski !
Thanks.
You mean I should connect Ethernet cable one end  to the router and other end to the Ethernet shield

Regards
2  Using Arduino / Networking, Protocols, and Devices / how-to-make-a-simple-arduino-wireless-shield on: September 10, 2014, 05:58:32 am
Hello there !
I have TP Link TL-WR702N router. I wish to make a wi-fi shield by using Ethernet shield   like
http://hackanerd.wordpress.com/2013/07/06/how-to-make-a-simple-arduino-wireless-shield/

In this link, how to connect the  power supply from the Ethernet shield is explained but there is no description
how it will communicate with Arduino via Ethernet shield. Please guide me.

Harnam

3  Using Arduino / Programming Questions / Re: Pump Manual Mode OFF problem on: January 14, 2014, 05:43:03 am
Sorry This is a cut and paste error. As I said the code is working OK  for Auto Mode ON & OFF and
also for Manual ON it does not switch OFF automatically when 100% level is achieved. IWhat could be
wrong with the OFF code ?
Thanks

Code:
// Verify if Pump Should be turned on
//   ON: By the volume being less than VolOn while on Auto Mode OR by being in Manual-ON
if ( ( (intTankLevelPerCent <= INT_LevelOn) && blnAutoMode ) || !blnAutoMode ) {
  blnPump = true;
}
//   OFF: By the volume being more than VolOff while on Auto mode OR by being in Manual-ON
if ( ((intTankLevelPerCent >= INT_LevelOff) && blnAutoMode) || !blnAutoMode )  {
  blnPump = false;
}
4  Using Arduino / Programming Questions / Pump Manual Mode OFF problem on: January 14, 2014, 05:14:13 am

I have a code for switching ON the pump ON and OFF with two modes Auto  and Manual ON

Operating conditions are if Level is 50% pump comes ON and when reaches  100% pump switches OFF
The Manual override switch when pressed, pump comes ON but it does not switch OFF when the
100% level is achieved.  The purpose of Manual ride switch is to by pass the Auto Mode for starting the pump
but it must be switched OFF to avoid overflow. Please help me to rectify the problem
Thanks
Code:
//Constants
onst int INT_LevelOff = 100; // Turn Off when this level is reached
const int INT_LevelOn = 50; // Turn On  when this level is reached
//Variable
boolean blnAutoMode;      // Holds the mode of operation True: Auto (On/Off), false: Manual (ON)
int intStatus;            // Holds the status 0: All OK, 1: Dry Run Warning 
//Void setup
// Set control to Auto mode
blnAutoMode = true;
//void loop
//Functions
switch (intStatus) {
case 0: // All OK
if (!blnAutoMode) {
lcdMyDisplay.print("Manual ON     ");
}
else {
// Auto Mode ON/OFF
if (blnPump) {
lcdMyDisplay.print("Auto ON       ");
}
else {
lcdMyDisplay.print("Auto Off      ");
}
}
break;
// Verify if Pump Should be turned on
//   ON: By the volume being less than VolOn while on Auto Mode OR by being in Manual-ON
if ( ( (intTankLevelPerCent <= INT_LevelOn) && blnAutoMode ) || !blnAutoMode ) {
              blnPump = true;
                 }
//   OFF: By the volume being more than VolOff while on Auto mode OR by being in Manual-ON
if ( ((intTankLevelPerCent >= INT_LevelOff) && blnAutoMode) || !blnAutoMode )  {
             blnPump = false;
}
5  Using Arduino / Programming Questions / Re: Dimmers Control on: July 10, 2013, 09:02:30 am
Hi paulS


Quote
THERE"S NO LUCK INVOLVED. There is skill and logic and hardware, possibly faulty. The LUCK you are talking about is our ability to guess what your problem is.

OK I am sorry for mentioning about the LUCK. I have checked the hardware side countless time. It was
very helpful idea about the Serial debug.Thanks.
At least  give me some hint to solve this problem
6  Using Arduino / Programming Questions / Re: Dimmers Control on: July 09, 2013, 08:15:32 pm
Thanks everyone for the suggestions
Quote
Add some Serial.print() statements to the code. Find out whether the switches are wired properly, and incrementing/decrementing light correctly.

I added the serial statements and checked in the serial monitor, It is working fine when I increase and decrease the dim with the help of A2 and A3.The problem lies with the A0 and A1 part, I isolated all the dimmers and tried one by one  and by Reset the board . NO LUCK.
How do I proceed further ? Here is my modified sketch.
Code:
/*
 AC Light Control
 Zero-cross - pin 2
 Lights dimmers on pins: 3, 4, 5, 6, 7, 8, 9, 10
 Buttons for changing the lights on pins: A0, A1 (up one/down one)
 Buttons for changing the dimm amount: A2, A3 (up level/down level)
 
*/

#include <TimerOne.h>           // Avaiable from http://www.arduino.cc/playground/Code/Timer1

int limit = 1500;               // changing the limit will affect the time that you have to keep the button pressed
int dim_increase = 0;           // this variables are used to lower the dimmer rate
int dim_decrease = 0;           // every time a button is pressed for dimming one of this values increase or decrease untill they reach the above limit... after they are reset to 0.
 
volatile int i=0;               // Variable to use as a counter
volatile boolean zero_cross=0;  // Boolean to store a "switch" to tell us if we have crossed zero
int AC_pin[9] = {3, 4, 5, 6, 7, 8, 9, 10};   //vector that holds the dimmer pins - whitch will go to triacs           
int dim[9];                     // Dimming level (0-128)  0 = on, 128 = 0ff
int c[9];                       // Counter for each light
int light = 0;                  // The starting/current light pin (0=3)
int freqStep = 78;              // This is the delay-per-brightness step in microseconds.

void setup()
{
  pinMode(A0, INPUT);           //Setting buttons as inputs                     
  pinMode(A1, INPUT);
  pinMode(A2, INPUT);
  pinMode(A3, INPUT);
  for(int x=0; x<=8; x++)      // Setting all the Triacs pins as outputs
  { 
    pinMode(AC_pin[x], OUTPUT); 
  }   
  attachInterrupt(0, zero_cross_detect, RISING);    // Attach an Interupt to Pin 2 (interupt 0) for Zero Cross Detection
  Timer1.initialize(freqStep);                      // Initialize TimerOne library for the freq we need
  Timer1.attachInterrupt(dim_check, freqStep);     
Serial.begin(9600);
                                             
}

void zero_cross_detect()
{   
  zero_cross = true;               // set the boolean to true to tell our dimming function that a zero cross has occured
  for(int x=0; x<=8; x++)     
  { 
    c[x]=0;
    pinMode(AC_pin[x], LOW);       //Setting all dimm pins to LOW
  }
}                                 

// Turn on the appropriate TRIAC at the appropriate time
void dim_check()
{                   
  if(zero_cross == true)    //so a zero_cross was detected
  {
    for(int x=0; x<=8; x++)  //for each dimm pin
    {   
        if(c[x]>=dim[x])           //if the time counter is bigger than the dim value
        {                     
          digitalWrite(AC_pin[x], HIGH);  // turn on light       
          c[x]=0;  // reset time step counter                         
        }
        else
        {
          c[x]++;  // increment time step counter                     
        }       
    } 
   zero_cross=false;    // reset zero cross detection   
  }                                 
}                                     

void loop()
{
  if(digitalRead(A0) == HIGH && light < 8)   //up one light from the button
  {
    light++;
  }
  if(digitalRead(A1) == LOW && light > 0)    //down one light from the button
  {
    light--;
  }
 
  while( dim[light] > 0 && dim[light] < 128 )  //if the dimming level for the appropriate light is betwen 0 and 128
 // while( dim[light] > 0 && dim[light] < 128 )
  {
    if(digitalRead(A2)==HIGH)            //if the button was pressed
    {
      dim_increase++;                    //increase the dim
    }
    if(digitalRead(A3)==HIGH)            //if the button was pressed
    {
      dim_decrease++;                    //decrease the dim
    }
    if(dim_decrease>limit)               //if reached the limit
    {
      dim[light]--;        //decrease the actual dimm value
      Serial.println(dim[light]);
      dim_decrease = 0;                  //reset the decrease
    }
    if(dim_increase>limit)               //if reached the limit
    {
      dim[light]++;                      //increase the actual dimm value
       Serial.println(dim[light]);
      dim_increase = 0;                  //reset the increase
    }
  }
}


7  Using Arduino / Programming Questions / Re: Dimmers Control on: July 07, 2013, 11:05:52 pm
Quote
What does that mean, in this context?
Sorry for the shortcomings in my question
I have tested a code for single dimmer with this configuration TRC output to pin 11, Dimming UP
pin 13 and Dimming Dn pin12. It works fine.

Now I wish to control 8 dimmers by using Analog pins.
Now the configuration for TRC  out put is pins 3 (Dimmer1),4(Dimmer2),5(Dimmer3),6(Dimmer4),
7(Dimmer5),8(Dimmer6),9(Dimmer7) & 10(Dimmer8)
Pin A0 and A1 is for selecting the dimmer (1,2,3,4,5,6,7,8)
Pin A2 and A3 for dimming up and Dn.
I tested all the dimmers one by one , it does not work (No dimming taking place)
Am I in a right track to use these Analog pins ?
Kindly suggest to resolve this problem

8  Using Arduino / Programming Questions / Dimmers Control on: July 07, 2013, 10:37:54 am
Hi There

 Can any one suggest me the problem with the following code ?
It's not working. With single dimmer it is working OK. The operating voltage is 220V, 50Hz

Code:
/*
 AC Light Control
 Zero-cross - pin 2
 Lights dimmers on pins: 3, 4, 5, 6, 7, 8, 9, 10
 Buttons for changing the lights on pins: A0, A1 (up one/down one)
 Buttons for changing the dimm amount: A2, A3 (up level/down level)
 
*/

#include <TimerOne.h>           
int limit = 1500;               // changing the limit will affect the time that you have to keep the button pressed
int dim_increase = 0;
int dim_decrease = 0;

volatile int i=0;               // Variable to use as a counter
volatile boolean zero_cross=0;  // Boolean to store a "switch" to tell us if we have crossed zero
int AC_pin[9] = {3, 4, 5, 6, 7, 8, 9, 10};               
int dim[9];                     // Dimming level (0-128)  0 = on, 128 = 0ff
int c[9];                       // Counter for each light
int light = 0;                  // The starting/current light pin (0=3)
int freqStep = 78;              // This is the delay-per-brightness step in microseconds.

void setup()
{
  pinMode(A0, INPUT);                             
  pinMode(A1, INPUT);
  pinMode(A2, INPUT);
  pinMode(A3, INPUT);
  for(int x=0; x<=8; x++)      // Set the Triac pin as output
  { 
    pinMode(AC_pin[x], OUTPUT); 
  }   
  attachInterrupt(0, zero_cross_detect, RISING);    // Attach an Interupt to Pin 2 (interupt 0) for Zero Cross Detection
  Timer1.initialize(freqStep);                      // Initialize TimerOne library for the freq we need
  Timer1.attachInterrupt(dim_check, freqStep);     

                                             
}

void zero_cross_detect()
{   
  zero_cross = true;               // set the boolean to true to tell our dimming function that a zero cross has occured
  for(int x=0; x<=8; x++)     
  { 
    c[x]=0;
    pinMode(AC_pin[x], LOW); 
  }
}                                 

// Turn on the appropriate TRIAC at the appropriate time
void dim_check()
{                   
  if(zero_cross == true)    //so a zero_cross was detected
  {
    for(int x=0; x<=8; x++)  //for each dim pin
    {   
        if(c[x]>=dim[x])           //if the time counter is bigger than the dim value
        {                     
          digitalWrite(AC_pin[x], HIGH);  // turn on light       
          c[x]=0;  // reset time step counter                         
        }
        else
        {
          c[x]++;  // increment time step counter                     
        }       
    } 
   zero_cross=false;    // reset zero cross detection   
  }                                 
}                                     

void loop()
{
  if(digitalRead(A0) == HIGH && light < 8)
  {
    light++;
  }
  if(digitalRead(A1) == LOW && light > 0)
  {
    light--;
  }
 
  while( dim[light] > 0 || dim[light] < 128 )
  {
    if(digitalRead(A2)==HIGH)
    {
      dim_increase++;
    }
    if(digitalRead(A3)==HIGH)
    {
      dim_decrease++;
    }
    if(dim_decrease>limit)
    {
      dim[light];
      dim_decrease = 0;
    }
    if(dim_increase>limit)
    {
      dim[light];
      dim_increase = 0;
    }
  }
}

Harnam
9  Using Arduino / Project Guidance / digital-ac-dimmer-module-lite-v.2 on: May 07, 2013, 02:00:04 am
Hello there !
Wish to use this module to control the fan speed/Night lamp, Voltage 220V, 50Hz.
How to incorporate two switches, one for increase another one for decrease with this module ?
Is it possible ?
http://www.inmojo.com/store/inmojo-market/item/digital-ac-dimmer-module-lite-v.2/
Please help
 
10  Using Arduino / Storage / Re: EEPROM problem on: April 05, 2013, 11:45:47 am

Thank you very much Mr. johnwasser
You have saved my day !
Code:
#include <EEPROM.h>
// constants won't change.
// INPUT PINS
const int buttonPin1 = 3;
const int buttonPin2 = 4;
const int buttonPin3 = 5;


// OUTPUT PINS
const int ledPin1 = 8;
const int ledPin2 = 9;
const int ledPin3 = 10;
const int pumppin = 13;

//EEPROM MEEMORY POSITIONS
#define memposL1 1

// variables will change:
int pumppinstatus = LOW;
int buttonState1 = LOW;
int buttonState2 = LOW;
int buttonState3 = LOW;


void setup() {

  // initialize the output pins:
  pinMode(ledPin1, OUTPUT);
  pinMode(ledPin2, OUTPUT);
  pinMode(ledPin3, OUTPUT);
  pinMode(pumppin, OUTPUT);

  // pinMode(ledPin5, OUTPUT);
  // initialize the pushbutton pin as an input:
  pinMode(buttonPin1, INPUT_PULLUP);
  pinMode(buttonPin2, INPUT_PULLUP);
  pinMode(buttonPin3, INPUT_PULLUP);

  // Restore pumppin staus from EEPROM
  // check pumppin status

  pumppinstatus=EEPROM.read(memposL1);
  digitalWrite(pumppin,pumppinstatus);
}

void loop(){

  buttonState1 = digitalRead(buttonPin1);
  buttonState2 = digitalRead(buttonPin2);
  buttonState3 = digitalRead(buttonPin3);

  digitalWrite(ledPin1, !buttonState1);
  digitalWrite(ledPin2, !buttonState2);
  digitalWrite(ledPin3, !buttonState3);

  // If all three buttons are HIGH and pump is running
  if (buttonState1 && buttonState2 && buttonState3 && !pumppinstatus) {
    // Turn the pump off
    pumppinstatus = LOW;
    digitalWrite(pumppin, HIGH);
    EEPROM.write(memposL1, HIGH);
  }

  // If all three buttons are LOW and pump is not running
  if (!buttonState1 && !buttonState2 && !buttonState3 && pumppinstatus) {
    // Turn the pump on
    pumppinstatus = HIGH;
    digitalWrite(pumppin, LOW);
    EEPROM.write(memposL1, LOW);
  }

  delay(100);
}
This code has solved the problem.
11  Using Arduino / Storage / Re: EEPROM problem on: April 05, 2013, 09:35:17 am
Quote
Are the three 'buttons' actually water level sensors?  If so I can understand why you want
the pump to start wen the tank is empty (all three level sensors LOW) and stop when the tank is
full (all three level sensors HIGH).  It also makes some sense that once the pump has started you
want the pump to continue to run after a power failure, even if the tank is partly full.

Yes Sir,You are absoletly right.Now the situation is that when the tank is empty the level leds
are ON which means Tank is full and pump does not start.
12  Using Arduino / Storage / Re: EEPROM problem on: April 04, 2013, 09:26:32 pm
When the system is commissioned for the first time. The tank is empty , if led1,2,3, which are suppose to indicate the level of the water are ON and pump is not starting to fill up the tank.
13  Using Arduino / Storage / Re: EEPROM problem on: April 04, 2013, 08:35:00 pm
Thanks Mr. johnwasser,
You are right. But my requirement is to keep the led1,2,3 OFF and pumpled1 ON at first instant.
 As per my first code, but I like your code which is more clean, short and meaningful. How do I change
it to meet my requirement ? Actually, I was using my code to start and stop the water pump automatically and see the water level. Then I felt the necessity to use the EEPROM to co-up with the power failure factor.
14  Using Arduino / Storage / Re: EEPROM problem on: April 04, 2013, 11:44:11 am
Thank you very much Mr. johnwasser
Now the pumppin led status is OK when power is restored after the power failure.
but in the following code: When starting led1,2 and 3 are ON and pumppin led is OFF
where as it should be other way around i.e. led1,2,3 should be OFF and pumppin led ON
 
Code:
#include <EEPROM.h>
// constants won't change.
// INPUT PINS
const int buttonPin1 = 3;
const int buttonPin2 = 4;
const int buttonPin3 = 5;


// OUTPUT PINS
const int ledPin1 = 8;
const int ledPin2 = 9;
const int ledPin3 = 10;
const int pumppin = 13;

//EEPROM MEEMORY POSITIONS
#define memposL1 1

// variables will change:
int pumppinstatus = LOW;
int buttonState1 = LOW;
int buttonState2 = LOW;
int buttonState3 = LOW;


void setup() {

  // initialize the output pins:
  pinMode(ledPin1, OUTPUT);
  pinMode(ledPin2, OUTPUT);
  pinMode(ledPin3, OUTPUT);
  pinMode(pumppin, OUTPUT);

  // pinMode(ledPin5, OUTPUT);
  // initialize the pushbutton pin as an input:
  pinMode(buttonPin1, INPUT_PULLUP);
  pinMode(buttonPin2, INPUT_PULLUP);
  pinMode(buttonPin3, INPUT_PULLUP);

  // Restore pumppin staus from EEPROM
  // check pumppin status

  pumppinstatus=EEPROM.read(memposL1);
  digitalWrite(pumppin,pumppinstatus);
}

void loop(){

  buttonState1 = digitalRead(buttonPin1);
  buttonState2 = digitalRead(buttonPin2);
  buttonState3 = digitalRead(buttonPin3);

  digitalWrite(ledPin1, buttonState1);
  digitalWrite(ledPin2, buttonState2);
  digitalWrite(ledPin3, buttonState3);

  // If all three buttons are HIGH and pump is running
  if (buttonState1 && buttonState2 && buttonState3 && pumppinstatus) {
    // Turn the pump off
    pumppinstatus = LOW;
    digitalWrite(pumppin, LOW);
    EEPROM.write(memposL1, LOW);
  }

  // If all three buttons are LOW and pump is not running
  if (!buttonState1 && !buttonState2 && !buttonState3 && !pumppinstatus) {
    // Turn the pump on
    pumppinstatus = HIGH;
    digitalWrite(pumppin, HIGH);
    EEPROM.write(memposL1, HIGH);
  }

  delay(100);
}

15  Using Arduino / Storage / Re: EEPROM problem on: April 03, 2013, 08:16:28 pm
Thanks Mr.johnwasser
After making the following changes, pumpin still always  remaining ON

Code:
// If all three buttons are HIGH and pump is running
  if (buttonState1 && buttonState2 && buttonState3 && !pumppinstatus) {
    // Turn the pump off
    pumppinstatus = LOW;
    digitalWrite(pumppin, LOW);
    EEPROM.write(memposL1, LOW);
  }

  // If all three buttons are LOW and pump is not running
  if (!buttonState1 && !buttonState2 && !buttonState3 && !pumppinstatus) {
    // Turn the pump on
    pumppinstatus = HIGH;
    digitalWrite(pumppin, HIGH);
    EEPROM.write(memposL1, HIGH);
  }

  delay(100);
}
Pages: [1] 2 3 4