mjb
New Member
Posts: 12
|
Post by mjb on Jun 10, 2017 16:25:30 GMT -8
I am having problems making the Dual WDT board (version 2) work with a UNO. JP7 Dog1 is connected to Pin 12 and the top pin of JP4 Arduino Reset to the UNO reset, I’m drawing 5v and Gnd from the UNO (photo included). My first observation was that the red leds on the WDT never flicker, I tried all setting of the pot with no success. To test the WDT I modified the Blink test by adding a long delay (60 secs) inside the loop and a shorter one set by adjusting the pot (30 secs). I added the code from the specification sheet and trigger the ResetWatchdog code within the Setup code. The loop simply runs, executes the delay and repeats, the WDT never triggers a reset. The red leds on the WDT board don’t flicker (code below). The problem is really exasperating, the set-up is so simple! Any idea what I am doing wrong? Thanks Michael */ #define ResetWatchdogPin 12 int i;
void setup() { Serial.begin(9600); ResetWatchdog(); // initialize digital pin LED_BUILTIN as an output. pinMode(LED_BUILTIN, OUTPUT); //pulse the builtin led to indicate that Setup has run or been reset digitalWrite(LED_BUILTIN,HIGH); delay(500); digitalWrite(LED_BUILTIN,LOW); delay(500); digitalWrite(LED_BUILTIN,HIGH); delay(500); digitalWrite(LED_BUILTIN,LOW); }
void loop() { //ResetWatchdog(); // currently set for what i think should be 30 seconds i=i+1; // loop counter digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level) delay(1000); // wait for a second digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW delay(5000); // wait for a second Serial.println("Start Delay"); delay(60000); // seconds to delay Serial.println("End Delay"); Serial.println(i); }
void ResetWatchdog() { pinMode(ResetWatchdogPin,OUTPUT); delay(200); pinMode(ResetWatchdogPin,INPUT); Serial.println("Watchdog Reset"); } Attachments:
|
|
|
Post by SDL on Jun 11, 2017 10:53:54 GMT -8
Looks perfect to us.
Try the following, since you are absolutely a sophisticate user. Move your pin on the output of the watchdog to the other pin, connect it to an additional GPIO on the Arduino and then program that pin to look for a rising signal (interrupt) and then you can test the whole thing even if you don't see the flicker. Then you have your arduino testing the device.
We can't really tell what you have the potentiometer set to in the picture. Try setting it to 30 seconds as shown in the documentation.
BP
|
|
mjb
New Member
Posts: 12
|
Post by mjb on Jun 12, 2017 9:19:58 GMT -8
I tried your idea about interrupts but still no success unfortunately (the code i used is attached). I have the WDT powered up and with Arduino 2 connected to JP4 Pulse High. I think I have the pot set at 30 secs (photo attached). I also tried the StateChangeDetection code from the Arduino Examples, same result. Any more ideas?? Thanks Michael // read interrupt on pin 2 void setup() { pinMode(13, OUTPUT); attachInterrupt(0, blink, RISING); //pin 2 }
void loop() { //Add task }
void blink() { digitalWrite(13, !digitalRead(13)); // Toggle LED on pin 13 digitalWrite(13, !digitalRead(13)); // Toggle LED on pin 13 digitalWrite(13, !digitalRead(13)); // Toggle LED on pin 13 digitalWrite(13, !digitalRead(13)); // Toggle LED on pin 13 digitalWrite(13, !digitalRead(13)); // Toggle LED on pin 13 digitalWrite(13, !digitalRead(13)); // Toggle LED on pin 13 digitalWrite(13, !digitalRead(13)); // Toggle LED on pin 13 digitalWrite(13, !digitalRead(13)); // Toggle LED on pin 13 } Attachments:
|
|
|
Post by SDL on Jun 15, 2017 19:02:01 GMT -8
OK, looks like you must have a bad board. This is a first! Please go to www.switchdoc.com and request an RMA # for your board. We will send you a new one and test your old one. BP
|
|
mjb
New Member
Posts: 12
|
Post by mjb on Aug 14, 2017 9:48:55 GMT -8
Well my board finally arrived and I added the 100K resistors but i still don't see any pulsing of the LEDs. Do you have some Arduino code that could actually demonstrate the pulsing and timing, similar to the example you provided for the Raspberry user (k4pi)? It would be nice to eliminate my code from my problem solving! Thanks Michael
|
|
mjb
New Member
Posts: 12
|
Post by mjb on Aug 14, 2017 9:53:17 GMT -8
Well my board finally arrived and I added the 100K resistors but i still don't see any pulsing of the LEDs. Do you have some Arduino code that could actually demonstrate the pulsing and timing, similar to the example you provided for the Raspberry user (k4pi)? It would be nice to eliminate my code from my problem solving! Thanks Michael
|
|
|
Post by SDL on Aug 15, 2017 17:50:38 GMT -8
Hmm. Here is some Arduino code. No documentation, but easy to figure out. It pats the dog and reads the result.
BP
// Dual WatchDog Timer Board // SwitchDoc Labs, LLC // October, 2014 // Version 1.1 // // This software demonstrate the use of the Dual WatchDog Timer Board // It defaults to patting the Dog every 120 seconds //
int RESET_WATCHDOG = 2; int WATCHDOG_OUTPUT = 7;
// the setup routine runs once when you press reset: void setup() { // initialize serial communication at 9600 bits per second: Serial.begin(115200); Serial.println(""); Serial.println("----------start of script---------"); Serial.println(""); pinMode(RESET_WATCHDOG, INPUT); pinMode(WATCHDOG_OUTPUT, INPUT); }
void ResetWatchdog() { pinMode(RESET_WATCHDOG, OUTPUT); delay(200); pinMode(RESET_WATCHDOG, INPUT); Serial.println("Watchdog Reset"); }
int watchOut;
// the loop routine runs over and over again forever: void loop() {
// pat the dog // ResetWatchdog(); float TriggerTime; boolean Trigger; Trigger = false; TriggerTime = 0.0;
int i; float myTime; for (i=0; i < 16000; i++) { delay(250); Serial.print("Time = "); myTime = (float)i/4.0; Serial.print(myTime); watchOut = digitalRead(WATCHDOG_OUTPUT); Serial.print(" WatchDog Output="); Serial.print(watchOut); if (watchOut == 1) { Trigger = true; TriggerTime = myTime; } Serial.print(" Trigger="); Serial.print(Trigger); Serial.print(" TriggerTime="); Serial.print(TriggerTime); Serial.println(); if (i % 480 == 479) // 480/4 = the number of seconds =120 // if (i % 120 == 119) // if (i % 2000 == 1999) { // pat the doggie ResetWatchdog(); } }
}
|
|
mjb
New Member
Posts: 12
|
Post by mjb on Aug 15, 2017 22:00:06 GMT -8
Thanks for the code, but it still doesn't register any triggers. When I power up the system it shows that a trigger has been sent and then repeats that line forever. I left it running for several minutes without any change. I have tried using both of the Arduino reset pins, one runs with trigger high, the other with trigger low, but they never toggle. I tried powering the WDT from the UNO and from its own 5v supply - no difference
I also loaded the Raspberry code that you provided for another user and it the Pi simply waits for a rising edge and never responds.
There still seems to be a problem with my board.
Michael
|
|
|
Post by SDL on Aug 16, 2017 7:25:23 GMT -8
I don't think there is anything wrong with the board. It looks (thank you for the picture), that you have wired the wrong two pins to your resistors. Pin 1 and 2 on the grove connector are the other two pins.
Try that and post the results!
BP
|
|
mjb
New Member
Posts: 12
|
Post by mjb on Aug 16, 2017 14:18:47 GMT -8
Well now I do feel foolish. I moved the resistors and everything works just as it should. Thanks for walking me through this! The code you supplied worked also. I had been misled by the D0 on the board into thinking the Grove socket read from L to R, I should have checked more thoroughly. Thanks again. michael
|
|
|
Post by SDL on Aug 17, 2017 16:45:05 GMT -8
Woohoo! We are glad that you got it to work!
Don't feel foolish, you sent us the picture and allowed us to help you because of that. Thank you!
BP
|
|