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.
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.
Fun with a box cutter.
There’s a circuit board.
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.
The PS2 pinout from Wikipedia’s article. Pin 5 is Clock and Pin 1 is Data.
Jumper in pin 5 position, which should be CLK (Clock)
Showed continuity to the red wire which was soldered to the Data tab on the circuit board.
Jumper in pin 1 position, which should be Data.
Shows continuity to the green wire, which was soldered to the CLK (Clock) tab on the circuit board.
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
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

Ah, the power strip.
The back side.
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.
Ever open one of these up? Not much to it.
The hole for the screw could be drilled all the way through the body…
Always good to check first…
I should have spaced this hole a little closer to the end, but there it is.
Mounting is insanely easy – put the strip where you want it and screw it on.
The screw head is no uglier than the power strip.
This is my new bench…
Lots more storage space.