Wednesday, March 21, 2012

Monoprice USB to PS2 Adapter Forensics

I love Monoprice. They sell the same imported accessories and peripherals that are rebranded and sold at higher prices by larger companies. All of the things I have bought from them have exceeded my expectations. You really get a sense of how much you’re being ripped off by retailers when you price their HDMI and USB cables.
However I ordered a USB to PS2 adapter a while back and finally got around to using it – it was going to allow my inlaws to use their old keyboard and mouse with the new computer I’m sending them. Unfortunately I couldn’t get it to work. I tried it on several different computers and in both XP and Linux Mint. It was recognized as a USB hub but the keyboard and mouse wouldn’t work. Power was getting through to the mouse (as evidenced by the red light of the LED).
Rather than send it back (It cost all of $1.94) I thought it would be interesting to see how and why it failed. At least in so far as my limited electronics knowledge could determine.
DSC00949
Part# 2855 which is now discontinued and completely gone from their website. I bought it in August of 2011.
I suspect that it was discontinued for exactly the problem (I think) I discovered.
DSC00954
Fun with a box cutter.
DSC00956
There’s a circuit board.
DSC00965
This is where it gets somewhat interesting. Black to VDD, Red to DATA, Green to CLK (Clock) and White to GND.
Notice I tried to scrape away the epoxy to verify that there was actually a chip under there. I saw bits of metal so I assume so.
pinout
The PS2 pinout from Wikipedia’s article. Pin 5 is Clock and Pin 1 is Data.
DSC00962
Jumper in pin 5 position, which should be CLK (Clock)
DSC00964
Showed continuity to the red wire which was soldered to the Data tab on the circuit board.
DSC00966
Jumper in pin 1 position, which should be Data.
DSC00967
Shows continuity to the green wire, which was soldered to the CLK (Clock) tab on the circuit board.
DSC00971
Here’s a shot taken by my loving wife that shows the test, this time with the green (mouse) PS2 connector. Jumper is in pin 1 (DATA), green wire (Soldered to CLK on the circuit board) shows continuity.
I really need to get some grabby probe tips for my VOM.
So unless I am mistaken (and it’s always possible I am, let me know if you see an error in my analysis), the problem with the adapter is that the CLK and DATA wires are reversed. While the adapter doesn’t work I think I had $1.94 worth of fun looking at the problem.

Sunday, March 11, 2012

Code for the Potentiometer Controlled Stepper Motor.

I received two requests for the code I used in this demo
------------------------------------------------------------------
#include
AF_Stepper motor1(225, 1);
int analogPin = 0;     // potentiometer wiper (middle terminal)
//connected to analog pin 3
// outside leads to ground and +5V
int val = 0;           // variable to store the value read
int prepos = 0;
int pos = 0; //0 to 224 .
void setup()
{
  motor1.setSpeed(60);  // 30 rpm  
}

void loop() {
 
  prepos = pos;
  val = analogRead(analogPin);    // read the input pin
 
  pos = map (val, 0, 1024, 0, 224);
 
  if (pos != prepos){
    int diststep = pos - prepos;
    if (diststep < 0) {
    motor1.step(-diststep, BACKWARD, INTERLEAVE);
    }
    if (diststep > 0) {
    motor1.step(diststep, FORWARD, INTERLEAVE);
    }
   
  }
 
}
--------------------------------------------------------------------------
AFMotor is the Adafruit stepper library used with their motor shield.
The motor I used has 3.2 degrees rotation per step, but I have the driver in half step interleaved mode, so 1.6 degrees per step. So 360 deg./1.6 deg. = 225 steps per revolution, thus the 0-224 values of pos.

Wednesday, March 07, 2012

Power Strip Modification

DSC00868
Ah, the power strip.
DSC00869
The back side.
DSC00871
To mount to a wall you are supposed to install two screws in the wall with the heads proud of the surface by the thickness of the plastic shell, then capture the heads and slide onto the screw. This usually causes much anguish as you have to mount the screws the correct distance apart. Often trying to slide it on will result in cursing.
DSC00873
Ever open one of these up? Not much to it.
DSC00874
The hole for the screw could be drilled all the way through the body…
DSC00875
Always good to check first…
DSC00876
Drill…
DSC00882
Countersink.
DSC00883
I should have spaced this hole a little closer to the end, but there it is.
DSC00884
Mounting is insanely easy – put the strip where you want it and screw it on.
DSC00885
The screw head is no uglier than the power strip.
DSC00887
This is my new bench…
DSC00888
Lots more storage space.

Monday, February 27, 2012

On My Way Home

Time for me to head back home.
DSC00596
South Station, Boston. I hung around the lounge for a while and was surprised by my Aunt Alice who managed to evade all security protocols and enter the lounge area. It was good to see her before I left.
DSC00598
I never spent much time in this part of the city.
2012-02-01_14-40-19_391
On the way out of Springfield, MA, looking at Memorial Bridge.
DSC00619
The pictures I tried to take of the sunset all came out blurry, but take my word for it, it was amazingly beautiful. Like some of the best Hudson River School paintings.
I talked for a while with a guy on his way to a wedding in NY, he sells smoking devices in a store in Providence. Says that they sell many pipes made in Oregon, which is no surprise to those that know the state.
2012-02-01_18-15-20_536
We stopped for a couple of hours in Albany, NY to pick up the rest of the train. I had dinner with a well heeled couple who were on their way to Arizona for the winter. We had a long conversation about many things. He collects Marklin trains and Swiss watches, which should tell you something about his income level. They had a bedroom in the sleeper, which is the apex of luxury.
The velcro that holds the curtains in the roomette was not functioning well. Again, I’d prefer not to have a toilet next to my bed. The Lakeshore Limited just isn’t as magical as the Empire Builder.
2012-02-02_09-23-35_888
I have no idea where this is. Breakfast was spent with a Puerto Rican non-denominational evangelical minister. Nice guy.
DSC00658
Nor this. Somewhere between Albany and Indiana…
DSC00662
The Chesterton Indiana water tower.
2012-02-02_09-48-07_783 We arrived in the late morning in Chicago, I had about 4 hours to kill so I walked around the city. If I had known the train would be delayed leaving (by about two hours) I would have tried to take in the Art Institute, but I didn’t think a couple of hours would do it justice.
DSC00665
Under an overpass.
DSC00669
Yes, I wandered around in alleys. A bit of industrial archaeology.
DSC00672
I guess it’s an attractive building.
DSC00676
Wow!
DSC00681
This was impressive architecture.
DSC00678
I hung around on bridges as well.

DSC00683
This is why I don’t live in the city. Noise and stink. Nice saw though!
DSC00686
The Sears Tower was in the clouds.
2012-02-02_13-25-43_377
Being a hick I took a picture of the automatic toilet seat covers in the lounge restroom. Wave your hand in front of the sensor and the plastic tube advances around the seat.
DSC00693
On the train, on the way out of the station. The train was delayed for two hours leaving. I met a nice woman from Seattle in the lounge and we passed the time chatting about a variety of things. She was thinking of studying Food Psychology, which is a thing I guess. We also were partnered up for dinner as well.
The dinner was interesting as our companions had just taken the Wolverine train which derailed when it hit a freight truck on a crossing. They were somewhat traumatized. Ironically the one guy was a Syrian from the embattled city of Hama (or possibly Homs, I couldn’t completely follow) where life was arguably safer than on a train in the middle of America.
The stewards on this leg are peppy!
There was a family in two of the roomettes, three kids and mom & dad. They were moving from New Jersey to the wilds of Montana. They actually had a family cheer, “To a new home and a new life, Montana!”. It was touching to see that sort of optimism.
2012-02-03_11-30-58_329
Some sort of insane asylum or school for mutants.
2012-02-03_11-55-45_999
Ready for lunch.
2012-02-03_17-07-01_529
North Dakota. The furrows go on forever. Apparently there’s a beautiful woman behind every tree. I had lunch with a peripatetic drywaller who sounded and looked a lot like Sam Elliott.
There was a wine & cheese tasting in the afternoon. I actually tasted the wine which I regret as it was terrible. Everyone agreed. The cheese wasn’t much better although I enjoyed it more than the rest. My companions were a farm couple from Illinois and another oil rig worker.
2012-02-03_17-40-29_444
Sunset. At some point one of the coach passengers went crazy and had to be hauled off the train. It isn’t as bad as Greyhound, but there is a small percentage of lunatics riding the rails nonetheless.
Dinner was with a couple from Whidby Island, although the wife was from Wales originally. The other man, somewhat of a glum character, said, “You always catch me with food in my mouth” as he was interrupted by questions for the umpteenth time. You have to be social on the train.
A couple from Montana suggested blacking out the curtains in the roomette as there was a 3/4 full moon as we went through the rockies. I did that and it was about as classically magical a train ride as you could imagine. Just the moonlight reflected on snow and the lights of the train curving around the mountains.
It’s sad to end the trip…
2012-02-04_06-50-30_966
Breakfast failure, akin to the dinner failure on the way out of Portland. If I go again I’ll definitely take the train from Seattle so I can enjoy the dining car. At least the coffee is good.
2012-02-04_06-56-19_867
I have no idea what fruits these were, but I stopped eating them. I think the pink ones are papaya.
DSC00699
The mighty Columbia.
DSC00712DSC00717
I art-tarted up these two pics as they were all washed out and blurry. I chatted with an older woman from Albany, OR. We saw many bald eagles.
DSC00724
Fort Vancouver.
DSC00729
Interstate Bridge.
And so I arrived in Portland and then after a short while boarded the bus back to Albany. Felice and the kids even remembered to pick me up at the station, which was nice. Now back to work!