makayg
Published

Repairing a Hitachi ED-A101 Gear Problem Using Arduino

We repaired our Hitachi projector's failing mirror moving system by simulating the opening/closing process using an Arduino and relays.

IntermediateFull instructions provided5 hours2,652
Repairing a Hitachi ED-A101 Gear Problem Using Arduino

Things used in this project

Hardware components

Arduino Pro Micro
×1
Arduino relay module
×3
XL6009 voltage regulator
×1
12V to 5V DC anti-reverse voltage regulator
×2

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Circuit diagram

Code

ED-A101 mirror opening/closing simulation

Arduino
#define OPENLS   21 // Limit switch: mirror opened
#define CLOSELS  20 // Limit switch: mirror closed
#define OPENMOT  19 // Motor opening the mirror
#define CLOSEMOT 18 // Motor closing the mirror
#define MOTLOAD  15 // Add motor load
#define DEBUG     1

enum _state {CLOSED=0,OPENING1,OPENING2,OPENING3,OPENING4,OPENED,
  CLOSING1,CLOSING2,CLOSING3,CLOSING4} ast;

struct _status
{
  const char *name;
  long int timeout,ipin,istate,opin,ostate;
  enum _state newstatus;
} status[] = {
  {"Closed",0,OPENMOT,HIGH,-1,0,OPENING1},
  {"Opening (1st phase)",1000,-1,0,CLOSELS,LOW,OPENING2},
  {"Opening (2nd phase)",2000,-1,0,OPENLS,LOW,OPENING3},
  {"Opening (3rd phase)",1000,-1,0,MOTLOAD,LOW,OPENING4},
  {"Opening (4th phase)",0,OPENMOT,LOW,MOTLOAD,HIGH,OPENED},
  {"Opened",0,CLOSEMOT,HIGH,-1,0,CLOSING1},
  {"Closing (1st phase)",1000,-1,0,OPENLS,HIGH,CLOSING2},
  {"Closing (2nd phase)",2000,-1,0,CLOSELS,HIGH,CLOSING3},
  {"Closing (3rd phase)",1000,-1,0,MOTLOAD,LOW,CLOSING4},
  {"Closing (4th phase)",0,CLOSEMOT,LOW,MOTLOAD,HIGH,CLOSED}
};

long long int starttime;
int cnt;

void setup()
{
  Serial.begin(115200);
  pinMode(OPENLS,OUTPUT);
  pinMode(CLOSELS,OUTPUT);
  pinMode(MOTLOAD,OUTPUT);
  pinMode(OPENMOT,INPUT);
  pinMode(CLOSEMOT,INPUT);
  digitalWrite(OPENLS,HIGH);
  digitalWrite(CLOSELS,HIGH);
  digitalWrite(MOTLOAD,HIGH);
  ast = CLOSED;
  starttime = 0;
  cnt = 0;
}

void loop()
{
  if (status[ast].timeout == 0)
  {
    if (digitalRead(status[ast].ipin) == status[ast].istate)
    {
      if (cnt < 200)
        cnt++;
      else
      {
        cnt = 0;
        if (status[ast].opin >= 0)
          digitalWrite(status[ast].opin,status[ast].ostate);
        ast = status[ast].newstatus;      
        starttime = millis()+status[ast].timeout;
#ifdef DEBUG
        Serial.print((long int)starttime);
        Serial.print(": ");
        Serial.println(status[ast].name);
#endif
      }
    }
    else
      cnt = 0;
  }
  else
  {
    if (starttime < millis())
    {
      cnt = 0;
      digitalWrite(status[ast].opin,status[ast].ostate);
      ast = status[ast].newstatus;
      starttime = millis()+status[ast].timeout;
#ifdef DEBUG
      Serial.print((long int)starttime);
      Serial.print(": ");
      Serial.println(status[ast].name);
#endif
    }
  }
  delay(1);
}

Credits

makayg
1 project • 2 followers
Contact

Comments

Please log in or sign up to comment.