Half Ahead Both Engines: 3 DOF Haptic Control

Now that I have a working DIY flex sensor, the next step is to try and improve the degree of motion control I can implement. While my goal is to understand inverse kinematics a little better, I thought it best to experiment a little more with haptic control.

Haptic control is easy to realise and will give me a thorough understanding of the mechanical limitations of the robot and how to optimise power consumption. Here is what I want to achieve in this project:-

1. Claw opening and shutting
2. Wrist rotation
3. Wrist bending

Controlling the claw was already achieved in the previous project and I now needed a way to sense orientation of my hand (rotation and bending) and transmit that to the robot’s wrist. I decided to place an ADXL345 accelerometer unit on the back of my palm and use it to sense orientation in space. Having no gyroscopes onboard, this unit couldn’t do any better than report roll and pitch of my palm. Yaw was not possible and the system was limited in that it would assume that my forearm was always parallel to the earth’s surface.

ADXL345 #-axis Accelerometer

ADXL345 #-axis Accelerometer

Also, with the GL away on ty duty, I couldn’t stitch the flex sensor and the accelerometer unit into a glove that I could wear. Rubber bands seemed to be the ‘cheap and best’ answer but as you can see in the video, rubber bands may be ‘cheap’ but they just barely get the job done. The ADXL345 shifts around a lot as I move my hand causing the robot arm to dance around a bit.  Definitely not an ideal situation.

Sensors mounted on my hand

Sensors mounted on my hand

Limitations aside, I decided to give it a go and see how far I could get. Here is the circuit layout using and Arduino Uno and designed using Fritzing. The ADXL345 is connected using the I2C protocol to the Arduino and I am using scaled values of static acceleration (from the ADXL345) in the X and Y plane to sense roll and pitch of my palm. The bend sensor is attached to my middle finger (with rubber bands) and it’s resistance measured using a voltage divider connected to analog pin A1 of the Arduino Uno.

Circuit Diagram

Circuit Diagram

So here are the results…Not bad for a first attempt. Lots of work needs to be done to make the motion more smooth. In this variant, sensor data is directly translated into servo motor actuation and I’m thinking about implementing a moving average algorithm on the sensor data to make the movements less jerky. Also, I think I will need to learn RF data transfer before moving ahead – this tangle of wires is not pretty and will only lead to complications in the future.

The Arduino code and the Fritzing circuit can be downloaded from here, for anyone who would like to try it out.

Each time I do this, I can’t help but be amazed at how technology like this is empowering people like me with no formal technical training. But at the same time I’m wondering how technical colleges around the country are letting students get away with projects as simple as this as their project work. I know this because this is what the shopkeeper I buy my equipment from tells me. His customer base is apparently almost entirely made up of students doing electronic projects. While playing around with stuff like this is educational and fun, I think students of electronics should be DESIGNING components like these, not just plugging them into their projects and then doing ‘time pass’.


16 thoughts on “Half Ahead Both Engines: 3 DOF Haptic Control

  1. Pingback: Arduino RF Communications: Data Encoder for VirtualWire | Bayesian Adventures

  2. hi
    i am working in a similar project but i am using adxl335 instead of adxl345, can you send me the whole coding of this project, because when i used the code above (with changing 345 into 335 in the code) it declare void can you help me

    • The ADXL335 uses three analog output pins (one for each axis) for its output.

      The ADXL345 uses I2C to send its data.

      Changing 345 to 335 will not work. You will need to redo the entire code that reads data from the ADXL335. After you can read the data, everything else in this project is very elementary.

      At present I don’t have any ADXL335 chips that I could experiment with. But this instructable may help you understand how to do it. It is quite straightforward. Good luck….


  3. hi 🙂
    thanks for sharing this awesome project.
    i tried the code you provided there . i tried to compile it . but it gave me this error.

    “Arduino: 1.6.0 (Windows 7), Board: “Arduino Uno”
    _3DOF_HapticControl.ino:4:21: fatal error: ADXL345.h: No such file or directory
    compilation terminated.
    Error compiling.”
    can you plz tell me how to solve this ?

      • Arduino: 1.6.0 (Windows 7), Board: “Arduino Uno”

        In file included from _3DOF_HapticControl.ino:1:0:
        C:\Users\my profile\Documents\Arduino\libraries\adxl345/Adxl345.h:1:22: fatal error: WProgram.h: No such file or directory
        #include “WProgram.h”
        compilation terminated.
        Error compiling.

        This report would have more information with
        “Show verbose output during compilation”
        enabled in File > Preferences.
        now i got a different error . can you help me ?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s