Monday, October 31, 2011

How we solved the remote employee problem for less than $100 (and had a bit of fun)

UPDATE: We've given Rudy some serious upgrades and he's now mobile. Check out the new post here: http://blog.nibbler.io/2013/01/rudebot-rolling-ubiquitous-display.html

Problem: Running a startup and coordinating with a colleague that’s 4000km away. How do you remain nimble, keep the pace of ideas flowing, and maintain close working relationships without the overhead of initiating a conversation at a moments notice?




Teleworking is as common in the tech sector as the problems that accompany it. The physical separation and long periods of time between contact often result in significant wasted time. Wasted time in everything from warming up, to repeating explanations, to re-synchronizing efforts. A large organization may be able to navigate these issues by structuring their teams so that components of a project can be handled in multiple locations with well defined touch points and time periods, but this can be anywhere from frustrating to unworkable for a startup.

The theory was that the next best thing to having our colleague, Rudy, in our office, was having an open video line to him all day, effectively putting him in the office. We needed to test this idea to see if had any merit. We configured a spare laptop that was lying around, initiated a video chat, and placed it on a desk for a week.

The change in productivity was obvious to us even before the end of the first day. From our observation it was apparent that our conversational flow was no longer jilted or deflated by having to initiate a conference on the fly. More importantly, there were times where inertia or laziness prevented that call from being made. This was no longer an issue. Duplicate meetings weren’t happening anymore. Most crucially, Rudy was always a part of on-the-fly decision making, rather than simply being informed on the occasion that decisions had to be made quickly. Ultimately, this open channel improved the sociability of our work force. It’s a fact that your team is going to work better if there is a good bond between them. That’s not really an issue when you sit a few feet away from them, but much more challenging when communication is staggered, scheduled and strictly task oriented.

We let the experiment run to an end and were convinced we had our solution. We even had a few ideas on how to improve the experience. The biggest issue was his restricted field of view. We were constantly having to roll in front of the camera to have an interaction. We wanted to give Rudy the ability to rotate the laptop to whomever he was chatting with. This problem lent itself to a fairly simple solution that we thought we could put together rather quickly with an Arduino, a servo motor, a rotating platform, and a simple server that bridged communication between a serial port and TCP/IP port.


Tools List
  • Drill
  • 7/8" Drill Bit
  • 3/4" Hole Saw
  • Chisel
  • Scroll/Jig/Table Saw
  • Screwdriver
  • Square
  • Pencil
  • Vernier Caliper

Materials List
  • USB Cable (for powering Arduino+Servo)
  • 2'x2' 1/2" MDF
  • Arduino UNO
  • Hobby Servo Motor (with a stall torque of 5.2kg*cm or more @ 5v)
  • Plastic Circular Arm (included with servo or purchased separately)
  • 3x Jumper Wires
  • 1" piece of solid wood
  • Balls Bearing Swivel (sourced from Home Depot) 
  • Wood Glue
  • Finishing Nails
  • #6-3/4" Wood Screws


Method

  1. Use whatever carpentry skills you have to build a three sided box using 1/2" MDF. This will be the base for the rotating platform. The box should be dimensioned so that it's width and length match that of the laptop you will be using. Wood glue and finishing nails will do the trick.
  1. Locate the centre of the base and drill a 7/8" hole through it.
  1. Take your swivel and align it on the base so it is centered. Fasten it to the base with the screws provided.
  1. Rotate the swivel 45 degrees and mark on one side where the screw hole for the platform aligns with the base. You are doing this so you can drill a hole there so you can gain access from underneath to attach the platform.
  1. Drill the second hole.
  1. Cut out a new piece of MDF that matches the dimensions of the base's length and width.
  1. Attach the swivel back to the base with the 4 wood screws.
  1. Align the newly cut platform on the swivel with the base. Flip over the project and use the secondary hole to fasten the swivel to the platform.
  1. Test your work. Make sure that the swivel rotates freely and that the platform aligns with the base when everything is square.
  1. The fastening of the servo to the top platform through the base is a little tricky. If you're interested in how it was done, please get in touch with us and we'd be more than happy to explain it.

11. Plug your Arduino in to your PC and upload the following code:

#include <Servo.h> 

#define MAX_CHAR 4

Servo servo;                

char angle[MAX_CHAR];
char* p = angle;
int alen = 0;

int myatoi(const char *s, int *value)
{
    if ( s != NULL && *s != '\0' && value != NULL )
    {
        char *endptr = (char*)s;
        *value = (int)strtol(s, &endptr, 10);
        if ( *endptr == '\0' )
            return 1;
    }
    return 0; /* failed to convert string to integer */
}

void setup() 
{ 
  Serial.begin(115200);
  servo.attach(9);
  memset(angle, '\0', MAX_CHAR);
}

void loop() 
{ 
  if (Serial.available() > 0)
  {
    char c = NULL;
    
    while ((c = Serial.read()) >= 0) 
    {  
      if ( c == '\r' || c == '\n' )
      {
        int incr = 1;
        int newpos;
        int pos = servo.read();

        // Check to make sure the input is all ints      
        if (!myatoi(angle, &newpos))
          Serial.println("Error: Bad input");
        else if (newpos >= 0 && newpos <=180)
        {
          // Seal off the string
          *p = NULL;
          Serial.println("Input angle: " + String(angle));
          if ((newpos - pos) > 0)
            incr = 1;
          else if ((newpos - pos) < 0)
            incr = -1;
            
          for(int ipos = servo.read(); ipos != newpos; ipos += incr)
          {
            servo.write(ipos);
            delay(30);
          }
        }
        else
          Serial.println("Error: Bad angle");
      }
      else
      {          
        if (alen == MAX_CHAR-1)
          Serial.println("Error: Angle more than 3 bytes");
        else
        {
          *p++ = c;
          alen++;
          continue;
        }
      }
        
      // Reset our string
      p = angle;
      memset(angle, '\0', MAX_CHAR);
      alen = 0;
        
      // Chuck anything after a newline/cr
      Serial.flush();
      Serial.println("OK: Good to go");
    }
  }
}

12. Now attach your servo's signal pin to the Arduino board using digital IO pin #9. Jumper the V+ pin on the servo to the 5v pin on the Arduino. Lastly, attach the GND pins of the servo to the Arduino. You can now use a serial communications program like minicom to connect to your Arduino and issue angles as commands. As you can see in the code above, the baud rate is set to 115200, so make sure you adjust your serial parameters to match this.


13. The last step to make this remotely accessible was to use a python script that bridges a serial port to a TCP/IP socket. You can download that here. Executing it with the arguments below would most likely work for you. Replace XXXX with the path to your usb serial device and YYYY with the port you want the server to listen on.
./tcp_serial_redirect.py -b 115200 -p /dev/XXXX -P YYYY

17 comments:

  1. I want to see a video of this in action!

    How many more servos would be required to attach a nerf gun?

    Hell you may have solved the workplace violence problem as well!

    ReplyDelete
  2. Hey manthrax, I've updated the blog with a youtube embedded video. You should be able to see this on most devices now. Cheers!

    ReplyDelete
  3. Why not just buy a pan/tilt/zoom camera like this:
    http://www.amazon.com/TRENDnet-ProView-Internet-Surveillance-TV-IP600/dp/B002FU5XRS

    ReplyDelete
  4. HackerFoo's comment nails it! This is like the Russian 'pencil in space' type situation.

    ReplyDelete
  5. HackerFoo, Abhi, one of the main goals of this project was to allow Rudy to turn to whomever he wanted to speak to, and have us see him as well - all done over Skype. The rotating camera would only solve half the problem.

    The other main goal was to have fun. Putting the whole thing together and watching Rudy control his own neck definitely instilled a sense of accomplishment.

    ReplyDelete
  6. @HackerFoo Where's the fun in that?

    ReplyDelete
  7. Nice job! I created a similar remote-controlled camera unit for one of my coworkers:

    http://blog.aus10.org/?p=102

    ReplyDelete
  8. Managers and marketers buy solutions; developers and engineers build solutions.

    ReplyDelete
  9. Too bad my retarded company does not allow ANY telecommute

    ReplyDelete
  10. Why was there no kinect support on Rudys end. He should just be able to turn his head to control that :P

    ReplyDelete
  11. Good job and cool project. Personally, I would have also used a foscam ip pan/tilt camera and an ip cam driver for skype. Infact you could attach multiple cams this way and give Rudy remote access to the camera webinterface as well as vnc/rdp to the laptop so he could toggle whichever camera he desired.

    ReplyDelete
  12. Awesome Solution!! You've just singlehandedly increased demand for spare laptops lying around the office.

    ReplyDelete
  13. This is awesome, definitely one-step-closer to a complete avatar employee! Next step: enable him to follow you on company lunches! :)

    Obscur questions: Does the awesome 70's california gangster-surf music turn on with each head spin?! Is Rudy the first ever cyber-don?

    ReplyDelete
  14. Cool build!
    On step 10 you said that connecting the servo is tricky. So how did you do it?

    ReplyDelete
  15. @Hari If you'd like some information on this, please contact us at info@vmfarms.com and we can email you some images with explanations.

    ReplyDelete
  16. Love this idea. FYI, I still believe tele-commuting is not as high-bandwidth (no matter how you set it up) as in-person communication

    ReplyDelete
  17. Thanks a lot! Very actual theme for me. As addition, recommend to read article Problems solving

    ReplyDelete