Auto Reset Stuff With Arduino




Introduction: Auto Reset Stuff With Arduino

Have a problem with my wireless bridge. It works for a some time then, despite it saying everything it fine, refuses to connect wirelessly. All it needs is to be turned off and on again and it works again (for a while!).

I decided that what was needed is some form of circuit to reset the unit on a regular basis, say every 15 minutes. With my Arduino I setup a system that waits 15 minutes then cycles the bridge off for 5 seconds and on again for 15 minutes.

Step 1: Program

Here is the Adruino sketch for the circuit. The output is on pin 7 and a manual reset button is attached to pin 5. The timing is done using the millis() command so that extra functionality can be added into the loop (like scanning the manual reset button) without effecting the rest of the timing. Some other time I may look at maybe adding in a couple of 7-seg displays to display the time remaining.

The on and reset times can be changed in the relevant lines. The on time (rstdly) is set in minutes where the reset delay (rstoff) is set in seconds.

See the comments for further descriptions of the program.

#define relay 7 // Pin for output switcher
#define rstsw 5 // Pin for manual reset

// Set following to change time in min for reset delay
#define rstdly 15

// Set following to change off time in sec
#define rstoff 5

unsigned long old_time;
unsigned long cpr_time;
unsigned long dly_time;
unsigned long off_time;
byte rstswitch = 0;

void setup()
  pinMode(relay, OUTPUT); // set relay for output
  pinMode(rstsw, INPUT); // reset switch for input
  off_time = rstoff * 1000; // calculate mS delay for off time
  dly_time = (rstdly * 60000) - off_time; // calculate mS delay for wait time, less off time to maintain timing

void loop()
  digitalWrite(relay, HIGH); // switch output on

  old_time = millis(); // get current time
  cpr_time = millis() - old_time; // calc how long delay been running for

  while (cpr_time < dly_time) // wait for delay time
    cpr_time = millis() - old_time;
    rstswitch = digitalRead(rstsw); // get switch state
    if (rstswitch == 1) {break;} // if switch pressed break loop

  digitalWrite(relay, LOW); // turn output off

  old_time = millis();
  cpr_time = millis() - old_time;

  while (cpr_time < off_time) // wait until off time has passed
    cpr_time = millis() - old_time;

Step 2: Circuit

The circuit is a simple button and transister switch. The transistor could be changed to a relay so that larger voltages/currents could be switched. As the bridge I use runs off of 9v its power supply can power both the Arduino, breadboard circuit and the bridge, no need for additional PSUs.

I haven't done an Eagle file for this as it is quite simple and I have had problems with Instructables website changing file names (no offence Instructables!). So a small apology for the hand drawn circuit! As it is so simple construction on a breadboard is easy so I haven't worried about that here.

The transistor needs to be able to carry the load that you are going to be placing on it.

Be the First to Share


    • Digital Fabrication Student Design Challenge

      Digital Fabrication Student Design Challenge
    • Build a Tool Contest

      Build a Tool Contest
    • Make It Modular: Student Design Challenge

      Make It Modular: Student Design Challenge



    7 years ago on Introduction

    Great idea! But why can't you just connect pin 7 directly to pin 5? Wouldn't the signal from pin 7 just reset by pin 5 receiving the signal? Maybe I'm asking a question with an obvious no, but I'm a newby with these things. :) I haven't tried myself yet, but I have a similar problem and I also thought of auto-resetting it as a bypass.


    Reply 7 years ago on Introduction

    I think I wanted the Arduino to know that the system had been reset manually and update the timings accordingly. Pin 5 is only taking input for a manual reset, it has nothing to do with the automatic timing. If you didn't want/need to reset it manually you don't even need the button and can ignore it :)


    11 years ago on Introduction

    Nice solution to reset unreliable equipment, I like it!

    Following the concept into new areas, this sounds like a possible substitute for an "interval timer" (~$70 USD) which can be used for aeroponic systems to grow vegetables or houseplants. Some variations of the on/off cycles are- 1 minute on and 1 minute off, or 1 minute on and 4 minutes off, and even 5 minutes on with 10 minutes off. Surely there are other parameters touted in some aeroponics sites.


    Reply 11 years ago on Introduction

    Yeah, there is nothing stopping you from changing the routine to any time sequence.

    That said retired this now, got new router!