Let's Make Robots!

Mechanism for Salvaging a Stubborn Monitor


What used to be my main workstation monitor developed a little problem last summer-it decided that if it had been in sleep mode for more than a few minutes, it would only turn back on momentarily when it received the signal to do so either from the computer or from its own power switch.  I couldn't believe it at first, so I did what anyone would do:turned it on and off several times.  Eventually, it "kicked in."  That is to say, it flickered on the way it had the previous few tries, then got a little brighter and stayed on.  That's how I discovered that it wasn't broken beyond use, it was just too much of a hassle to have it on my main Adobe CS PowerPC workstation.  It was however bigger than the one I'd had on my workbench and also featured both DVI and VGA inputs, so it was just about perfect for using with my RaspPi and PC.  I went ahead and got another slightly larger slightly used monitor for the Mac (which is developing its own problem and currently has a Pony clamp squeezing its top bezel to keep one column of pixels from showing up pink/cyan, but that's another hack for another time...) and moved the old one to the tinkerspace.

(19 MAR:OH JAY-SUESS!  I JUST CAUGHT THE TYPE-O--> IN THE VIDEO.  I REALLY CAN SPELL "ATTEMPT" BUT I'M NOT GOING BACK AND FIXING THAT!)

As you can imagine though, it gets kind of tedious sitting there turning on and off a monitor for a programming session that may not last terribly long.  Also, the longer I go without turning it on, the more on/off cycles I have to punch it through to fire up.  Now of course I just got married and lost my job so I don't have a lot of money to throw around on new monitors, but even so I probably would have come up with the same solution.  I think it's something that a self-respecting hacker can be proud of:saving a decent but flawed unit from the landfill.

I already had a servo sitting around, so I figured all it takes is a rythmic triggering of the servo to two fixed points in the rotation to cycle the on/off switch until the monitor latched on.  I tested it with an Arduino Uno and the concept was sound, so I attempted to move it over to an ATTiny 45 instead of wasting a whole lot of inputs, outputs and a crystal.

I don't know if anyone has been following this thread, but JerZ, Protowrxs, Ro-bot-x and I have all been futzing with the ATTiny line and servos with disappointing results.  What it comes down to is that the Tinies don't use the standard servo.h library and the servo8bit.h library for some reason doesn't seem to work for anyone, but it's possible to get the servos to assume and hold a position fairly predictably using a pulse method. However, in my experience when you need to introduce intervals other than the delayMicrosecond pulses (or alternatively millis if you don't want the delay method in there,) the predictability goes all to hell.  That's not such a big issue most of the time, but if you're trying to program a walker gait or in a situation like this where the rhythm is everything it's a poor solution.

It was at this point that I started looking at PicAxe for the first time.  Ossipee pointed me to the Rocket Brand Studios 08M2 boards as an alternative to the ATTiny 45/85s.  I got ahold of Chris The Carpenter and he sent me the last two in his stock, making me promise to "...do something cool with them."  (The greenie in me thinks this qualifies as cool.)  At first I had some trouble programming the board with my own hacked-together serial programming cable, but again Ossipee came to the rescue, and I received an AXE027 programmer as a wedding gift (as well as a couple other little goodies and some potholders from Diana to my Bride, which Sarah is adamant are too cute to actually use, so they now hang in the... okay I'm off subject again.)

The physical portion of the project involved making a custom servo mount and screwing it to the monitor.  I had tried initially to hot-glue everything on just to make it quick and easy, but the servo was just too powerful and kept ripping itself off.  The mechanism power switch, 08M2 board and the pvc switch shaft guide are all hot glued on though.  (Sorry Markus.)

For those interested, I'm posting both Arduino code and the PicAxe code so that you can compare them.  This isn't the best demonstration of similarity and differences between OOP/non because there aren't any functions/methods/classes otherwise, but you can get a feel for the syntax that does show how they are and aren't alike.

First, the Arduino/ATTiny code (main loop only):

void loop(){
  /*punch it!*/
  for (int repeat = 1; repeat<50; repeat++){//this is just to make sure the servo gets the signal
    pulse = 1900;
    digitalWrite(servoPin, HIGH);
    delayMicroseconds(pulse);
    digitalWrite(servoPin, LOW);
    delayMicroseconds(20000-pulse);
  }
  for (int repeat = 1; repeat<50; repeat++){//this is just to make sure the servo gets the signal
    pulse = 1400;
    digitalWrite(servoPin, HIGH);
    delayMicroseconds(pulse);
    digitalWrite(servoPin, LOW);
    delayMicroseconds(20000-pulse);
  }
  delay(1000);//monitor turns on...
  
  /*punch it again!*/
  for (int repeat = 1; repeat<50; repeat++){//this is just to make sure the servo gets the signal
    pulse = 1900;
    digitalWrite(servoPin, HIGH);
    delayMicroseconds(pulse);
    digitalWrite(servoPin, LOW);
    delayMicroseconds(20000-pulse);
  }
  for (int repeat = 1; repeat<50; repeat++){//this is just to make sure the servo gets the signal
    pulse = 1400;
    digitalWrite(servoPin, HIGH);
    delayMicroseconds(pulse);
    digitalWrite(servoPin, LOW);
    delayMicroseconds(20000-pulse);
  }
  delay(5000);//monitor turns itself off and you have to go through it again.
}

Keep in mind, that would have worked fine with a full Arduino.  It's not quite as good with the 1Mhz or 8Mhz internal ATTiny clock.  So here's the PicAxe code that actually does the work now:

 

init: servo 4,100 ; initialise servo

servopos 4,100

main: servopos 4,145 ; move servo to one end

pause 200 ; wait 1/10th seconds

servopos 4,100 ; move servo back 

pause 1000 ; wait 1 seconds

servopos 4,145 ; move servo to one end

pause 200 ; wait 1/10th seconds

servopos 4,100 ; move servo back 

pause 5000 ; wait 1 seconds

goto main ; loop back to start

I guess Axepad doesn't care about color-coding for forums the way Arduino does.  In any case, I'm not out to evangelize for one platform over the other (but I did promise Bajdi a blog on transitioning from Arduino to PicAxe.)  I frankly love them both.  Each has limitations and benefits over the other.  The question of which to use is probably best determined by what's available and what functions of the project are most important.  Here, precise timing and control of a servo with a 8pin dip chip made the PicAxe the right choice.

Now here's a little philosophical gravy for you: is this a robot?  I chose not to call it one, but if you think about it, this is no different than a factory arm.  It does a repetitive job with very little stimulus-its only "sensor" is the on/off switch, but that's the way a lot of robot arms in industrial settings work-you can't get too close to them or you're going to get smacked because they usually don't have proximity sensors or anything on them.  Would it be a robot if I added a simple electric eye to determine if the monitor had latched on and stop the cycle manually?

Once again, thanks to CtC and Oss for their beneficience, and I promise to use the other 08M2 board for something even cooler than this. (That one I will call a robot!)

 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Ladvien's picture

Awesome. I like your kind of thoughts.

Off topic, spending most of my day at homeless campsites looking for those actively symptomatic, I can verify that definition of insanity is valid.  More than that, in the mental health world, it is the best behaviorally anchored definition of abnormal thinking.   

Tell Chris tasking-out your insanity to a robot is useful :)

Maxhirez's picture

Roberto!  We got to see him die twice this season.  Well, maybe I can keep my insanity to a minimum.  My view is that everyone is "crazy" (not a professional, won't say "insane.)  The trick in life is to try to spend it with people whose crazy works with your crazy.

birdmun's picture

driving a transistor would have required opening said monitor. Not to mention some circuit board surgery to insert it into the flow of electrons. It would have allowed for the use of either an AVR or a PIC.  :)

On the other hand, way to go. Good to see you were able to hack the monitor to your needs. :D 

JerZ's picture

I wonder if an LDR peeking at a corner could determine if the monitor stayed on for you too. Fully automatic life support :)

rhughes's picture

Fun way to work around what is probably a failing capacitor in the monitor.  :)  At least until it finally goes pop.

Have you tried opeing up the monitor housing and looking for any bulging/burst electrolytic capacitors?  Have a samsung LCD with a similar problem, knew the screen was good, but it just wouldn't turn on one day.  A little research, and dissassembly revealed a common failure due to a capacitor bursting.  Quick little desolder, pop in a new cap of same/similar spec, and the tv was good as new.

Maxhirez's picture
Thanks! I hadn't heard about this. I'm probably avoiding doing that because I'm holding onto an old fear about not opening monitors from the days when a tube could fry you, but this has been going on for a while. When an electrolytic goes bad, there's that smell and then nothing. I had one of the iMacs that Apple had to extend the warranty on because of shoddy caps and I'll never forget that experience.

If it gives up the ghost I may try to crack the case but until then I will just go with this.

bdk6's picture

In our throwaway society, it's always nice to see things kept servicable and out of the landfill.  Especially if it involves a neat hack.