Show Posts
Pages: 1 2 [3]
31  Using Arduino / Motors, Mechanics, and Power / Urgent help needed - relay with load resetting Arduino on: September 05, 2012, 02:23:35 pm
Hi everone,

I have a Arduino Mega2560 with Ethernet shield that is controlling a 5V relay to drive a 12V solenoid used for electronic lockers. The Arduino is powered by an external 12V power supply, and the relay (driving the solenoid) is powered by another 12V power supply. The relay is powered by the 5V from Arduino. Without load (i.e. solenoid connecting to the relay), everything works fine. I can hear the relay clicking. However, with load (i.e. solenoid connecting to relay), the Arduino is reset when the solenoid is turned OFF. It's as if there is a big current surge hitting the Arduino when the solenoid is turned off, but there is already a diode on the coil side of the relay. I also measured the voltage across 5V and 12V rails, and there is no change.

Any advice is much appreciated. This circuit is for my store that is already open for business, but the customers can not retrieve their items due to this problem.

Thank you,
George
32  Using Arduino / Installation & Troubleshooting / Re: Please help! watchdog ruined my mega2560 board on: September 04, 2012, 03:12:18 am
Hey guys,

I successfully re-programmed the bootloader for my Mega2560 using an Arduino Uno: http://www.gammon.com.au/forum/?id=11635. However, when the watchdog timer kicks in on my Mega2560, the Mega2560 still locks up, and is not able to reboot. Is the 100nf capacitor still required with the new V2 bootloader? Any other suggestion?

Many thanks,
George
33  Using Arduino / Motors, Mechanics, and Power / Re: 360 relays on: March 02, 2012, 07:37:53 am
Only one relay will be active at one time.

Thanks, Johnwasser. I have taken your advice and managed to build something that works. For those who may encounter the same issue, here is what I have done to make the relay circuit with two inputs work. Basically you take this relay circuit:

http://www.arduino.cc/playground/uploads/Main/relays.pdf

And add another resistor-transistor combination to the emitter of the first transistor, which essentially becomes an AND gate. Now the relay will be active only when both inputs are HIGH.


34  Using Arduino / Motors, Mechanics, and Power / Re: 360 relays on: February 28, 2012, 11:19:23 pm
Thanks, John. A matrix layout is great: 3 shift registers to control the columns and 2 shift registers to control the rows. Does that mean I need an OR gate at the row-column junction, i.e. relay input trigger? Or can I simply connect the output from the row/column shift registers to the relay input trigger?

*** Correction. I will need an AND gate, e.g. 7408, at each row column junction. With 360 outputs, I will need 90 7408 AND gates. I am wondering if I am better off with 45 shift registers instead.
35  Using Arduino / Motors, Mechanics, and Power / Re: 360 relays on: February 28, 2012, 10:58:19 pm
Thanks guys. I just realized that there was a J3Y transistor on my relay module input trigger. The measured current consumption at the input trigger is around 6.5mA, so it's safe for the Arduino output pins. As for powering the relays, I will definitely need to use an external 5V power since the current draw will be around 3A+.

So back to my other question. Do I really need 45 8-bit shift registers in order to control 360 relays? Any way to reduce the number?

Many thanks,
George
36  Using Arduino / Motors, Mechanics, and Power / Re: 360 relays on: February 28, 2012, 02:56:29 pm
The relay is Songle SRD-05VDC-SL-C. It is rated at 0.36W, so the current consumption is around 72ma. This seems a bit high and strange because I can control the relay just fine with my Arduino UNO.

I am powering up my Arduino using an external 12V/15A supply. I will likely need another external 5V supply just for the relays since 72ma x 45 = 3.24A, which is greater than 1A rating from Arduino 5V voltage regulator.
37  Using Arduino / Motors, Mechanics, and Power / 360 relays on: February 28, 2012, 02:33:12 pm
Hi everyone,

I need to control 360 5V-relays with my Arduino (only one relay will be active at one time). From my search, 74HC595 seems to be the best candidate. I will need 45 units of 74HC595 since each 74HC595 can control 8 bits or 8 relays. Does anyone have a different approach that can help me reduce the number of 74HC595 required?

I came across a posting by Azi where he stated "I am using 8 shift registers per 3 pins, for totally controlling 225 relays". I have messaged him and am waiting for his reply. In the meantime, would anyone know how it is possible?

Thanks,
George
38  Using Arduino / Networking, Protocols, and Devices / Re: Ethernet shield permanently returning 0.0.0.0 after working for a few hours on: February 21, 2012, 10:39:14 am
I got my other new Ethernet shield today. Unfortunately same result. I get about one connection failure every 10 minutes. Everything still runs (no watchdog reset). I am beginning to suspect that the culprit may be my server (connected via wifi) + router combination. I will find another PC and router to repeat the test. Thank you for your help.
39  Using Arduino / Networking, Protocols, and Devices / Re: Ethernet shield permanently returning 0.0.0.0 after working for a few hours on: February 18, 2012, 01:59:23 am
I tried all your suggestions, but I am still seeing connection failure periodically. I have another Ethernet shield coming next week. I will try that one to see if it makes any difference.

BTW, I noticed that on my setup after uploading, it takes several watchdog resets until the Arduino receives the first response from the server. Once the first response is received, everything runs fine (except for the periodic connection failure, but at least no watchdog reset). Have you seen similar issue in the past? Below is the log. Thanks.

======log=================
192.168.2.48
starting arduino client for front entrance

*192.168.2.48
starting arduino client for front entrance

*192.168.2.48
starting arduino client for front entrance

*192.168.2.48
starting arduino client for front entrance

*192.168.2.48
starting arduino client for front entrance

*192.168.2.48
starting arduino client for front entrance

*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*....
40  Using Arduino / Networking, Protocols, and Devices / Re: Ethernet shield permanently returning 0.0.0.0 after working for a few hours on: February 17, 2012, 11:17:47 am
Thanks, SurferTim. I just ran anther test with heartbeat interval increased to 10 seconds. Over the course of five hours, there were four connection failures - about one failure per 450 heartbeats. This is interesting because my previous test of one second interval in 10 hours yielded around one failure per 433 heartbeats. I agree. Something is fishy.

I have pasted my entire code below. Please note that I have external interrupts 0 and 1 enabled to read the Wiegand26 value from my RFID device. I will start another test with the external interrupts disabled to see if it makes any difference. I would appreciate any insight into the connection failure. Thanks.


#include <SPI.h>
#include <Ethernet.h>
#include <avr/wdt.h>

#define WATCHDOG_ENABLE 1

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 192, 168, 2, 50 }; //assigned arduino LAN IP address
byte server[] = { 192, 168, 2, 47 }; // laptop running apache LAN IP address
byte gateway[] = { 192, 168, 2, 1 }; // laptop running apache LAN IP address
byte subnet[] = { 255, 255, 255, 0 }; // laptop running apache LAN IP address
EthernetClient client;
char inString[32]; // string for incoming serial data
int stringPos = 0; // string index counter
boolean startRead = false; // is reading?

volatile unsigned long rfid = 0;
volatile int readCount = 0;
int watchdogCount = 0;

void DATA0(void) {
  readCount++;
  rfid = rfid << 1;
}

void DATA1(void) {
  readCount++;
  rfid = rfid << 1;
  rfid |= 1;
}

String readPage()
{
  //read the page, and capture & return everything between '{' and '}'

  stringPos = 0;
  memset( &inString, 0, 32 ); //clear inString memory

  while(true)
  {
    if (client.available()) {
      char c = client.read();

      if (c == '{' ) { //'{' is our begining character
        startRead = true; //Ready to start reading the part
      }else if(startRead){

        if(c != '}'){ //'}' is our ending character
          inString[stringPos] = c;
          stringPos ++;
        }else{
          //got what we need here! We can disconnect now
          startRead = false;
          client.stop();
          client.flush();
          //Serial.println("disconnecting.");
          return inString;
        }
      }
    }
  }
}
 
void httpParse(String command)
{
  if(command == "WATCHDOG_RESET")
  {
    //reset the watchdog timer
    wdt_reset();
  }
  else
  {
    Serial.println("error");
  }
}

void setup()

  if(WATCHDOG_ENABLE)
  {
    //enable watchdog timer to 8 seconds
    wdt_enable(WDTO_8S);
  }
 
  Serial.begin(9600);
     
  Ethernet.begin(mac, ip, gateway, subnet);
  Serial.println(Ethernet.localIP());
 
  readCount = 0;
  rfid = 0;
 
  attachInterrupt(0, DATA0, RISING);
  attachInterrupt(1, DATA1, RISING);
 
  Serial.println("starting arduino client for front entrance");
  Serial.println();
}

void loop()
{
  //reset watchdog
  if(WATCHDOG_ENABLE)
  {
    if(watchdogCount > 10)
    {
      Serial.print("*");
      if (client.connect(server, 80))
      {     
          Serial.print("+");
          String myString = "GET /watchdog.php?ip=";
          myString += String(ip[0]) + "." + String(ip[1]) + "." + String(ip[2]) + "." + String(ip[3]) + ".";
          myString += " HTTP/1.0";
          client.println(myString); //php page invoking my web service
          client.println();
             
          //Connected - Read the page
          String pageValue = readPage(); //go and read the output
          httpParse(pageValue);
         
          watchdogCount = 0;
      }
      else
      {
          Serial.println("WATCHDOG connection failed");
      } 
    }
    else
    {
      //reset the watchdog timer
      wdt_reset();
    }
   
    watchdogCount++;
  }
   
  delay(1000);
}
41  Using Arduino / Networking, Protocols, and Devices / Re: Ethernet shield permanently returning 0.0.0.0 after working for a few hours on: February 17, 2012, 03:35:31 am
Thanks. Here is my loop code. WATCHDOG_ENABLE is set to true. Basically I see this message "WATCHDOG connection failed" on the Arduino IDE every 5 to 40 minutes. My server also keeps track of any heartbeat interval that is longer than 3 seconds. The server record matches the printout on the Arduino IDE. I will try increasing the heartbeat interval to see if it makes any difference.

void loop()
{
  //reset watchdog
  if(WATCHDOG_ENABLE)
  {
    Serial.print("*");
    if (client.connect(server, 80))
    {     
        Serial.print("+");
        String myString = "GET /watchdog.php?ip=";
        myString += String(ip[0]) + "." + String(ip[1]) + "." + String(ip[2]) + "." + String(ip[3]) + ".";
        myString += " HTTP/1.0";
        client.println(myString); //php page invoking my web service
        client.println();
           
        //Connected - Read the page
        String pageValue = readPage(); //go and read the output
        httpParse(pageValue);
      }
      else
      {
        Serial.println("WATCHDOG connection failed");
      } 
  }
   
  delay(1000);
}
42  Using Arduino / Networking, Protocols, and Devices / Re: Ethernet shield permanently returning 0.0.0.0 after working for a few hours on: February 16, 2012, 10:27:06 pm
Thanks. I will keep that in mind.

I received the other new Ethernet shield I have ordered. It started working right away, so that means my old Ethernet shield has stopped working for some reason. I will leave that for now.

On a separate note, I set up my board to report heartbeat event to the server every second. After running for ten hours, I noticed that  client.connect(server, 80) has failed 83 times (ranging from 5 minutes to 40 minutes). I am just wondering (1) if it's normal, and (2) if there is anything I can do to improve it. There is only one connection open.

Thanks,
George
43  Using Arduino / Networking, Protocols, and Devices / Ethernet shield permanently returning 0.0.0.0 after working for a few hours on: February 15, 2012, 10:20:25 am
Hi,

I am wondering if anyone has seen a similar issue. My Arduino UNO + Ethernet shield (R3) have been functioning for a few hours, i.e. sending GET request to my PHP/MySQL server and reading the response back. Then I added codes to toggle digital output pins 13 and 12 to control the LED's. After that, my Ethernet shield stops working, always returning 0.0.0.0 for Ethernet.localIP(). I have cold reset the Arduino and the Ethernet shield, and have also swapped another Arduino UNO. But it's still the same problem. It's as if the Ethernet shield has been permanently fried or something. I have ordered two more Ethernet shields, which will arrive in a week or so. In the meantime, does anyone have any suggestion for me to try? I read from another post that pin 4 and 13 should be left alone when using Ethernet shield. Another other pins I should avoid?

Thanks,
George
Pages: 1 2 [3]