Paperbot Optical Wheel Encoders

The wheel encoder top shield plus left and right sensor boards allow you to measure the rotations of your robot’s wheels. The encoders are made for the paperbot chassis, but can be adapted to any robot; as long as you have a place to mount the sensors and a way to attach encoder disks to the wheels.

Downloads

For the paperbot chassis, download the disks from the link below:

Shield and sensors EAGLE CAD files for reference: https://drive.google.com/drive/folders/18sv7d2XGoUMaQfyRRsZczfpIiyigsODt?usp=sharing

Assembly Instructions

You can easily print out the encoders above, cut them out, and glue to the inside of your paperbot wheels with a gluestick.

If you are using a robot other than the paperbot, the file above is also an editable Adobe Illustrator pdf you can edit in Adobe Illustrator or Inkscape to fit your robot.

(Pictures being added WIP)

Insert the screws from the inside (engraved side) of the paperbot chassis panels. Screw on two of the included hex nuts on both screws, to about 3/4 of the way down. Insert the sensor board on the screws, add another hex nut on the top of the boards, and screw everything down. When you are done, you should have the sensor boards screwed onto the side panels with two hex nuts underneath for spacing.

Insert the included ribbon cable through the slit in the chassis right above the sensor boards with the exposed contacts facing up.

Connect them to the ZIF connectors on the sensor boards. The ZIF connectors open by gently pushing the black plastic part away from the connector until it slides out a little. Then, insert the ribbon cable, and push the black plastic part back into place to hold the cable in place.

Finish (re)assembling the rest of the paperbot chassis and slide in the 3DoT board with the encoder shield inserted. Connect the ribbon cables to the connectors on the encoder shield by simply pushing them in all the way. Match the contacts on the ribbon cable with those on the connector. If you inserted the cables correctly to the sensor boards, then the ribbon cable should already be in the right orientation without twisting.

Programming

The two sensors of the encoder shield are connected to D14 (PB3) and D16 (PB2) of the 3DoT. Read the digital value from these pins to determine if the sensor is reading a black or white section of the encoder disk on the wheel.

It is recommended to start by writing a simple test script to test the encoder readings while spinning a wheel by hand. Here is an Arduino example for testing the left encoder:

const int L_Encoder = 14;

void setup() {
  pinMode(L_Encoder, INPUT);
  Serial.begin(9600);
}
void loop() {
  int reading = digitalRead(L_Encoder);
  Serial.println(reading);
  delay(100);
} 

If this works for both wheels, the next step will be up to you: to write code to match your application! For example, you may use program your robot to complete a 180 degree turn by reversing the direction of one of the motors, and then waiting until a certain number of revolutions of the wheels are done. You can do this since you know how many black to white transitions will happen in one transition!

Leave a Reply

Your email address will not be published. Required fields are marked *

nineteen + 13 =