Autopilot Tripoke

From Autopilot Wiki
Revision as of 22:28, 26 May 2022 by Jonny (talk | contribs)
Jump to: navigation, search


Tripoke render.png

A panel of three mouse-sized nosepokes to sense behavioral input, for delivering water reinforcements and, give task feedback via an RGB LED

Modality Reinforcement, Sensors, Enclosures
Build Guide Type Electronics Build Guide
Creator Jonny Saunders
Version 1
Submitted Date 2022-05-26

Ingredients

Materials

Name Quantity Dimensions Manufacturer Product ID Price Page Datasheet
Hypodermic Needle 3 18ga BD PrecisionGlide 0.2 [1]
Machine Screw 10 #4-40, 5/8"
Nut 10 #4-40
RGB LED 3 5mm
Resistor 12 200 Ohm

Tools

NameTool KindDimensionsManufacturerProduct IDDatasheet
3D PrinterCAD Fabrication
DremelHand Tools Etc.
DrillDrill
Needle Nose PliersHand Tools Etc.
Soldering IronElectronics
Wire CutterHand Tools Etc.

An attachment for the Autopilot Hex Panel Tripoke (and Autopilot Behavior Box) to sense pokes, deliver rewards, and deliver feedback with an RGB LED to mouse-sized animals.

Gather your materials!

Autopilot panel build 1.jpg

Prepare PCB

Cut In Half

When ordered from ExpressPCB, the Tripoke PCB comes with two boards on a single piece of silicon. First, cut them in half. With a ruler, mark a center cut line, and then follow it carefully with a cutoff wheel (like [2]) on a dremel.

Safety note:

  • You should wear a respirator when cutting silicon to avoid silicosis
  • you should also be careful to not put any pressure on the cut-off wheel orthogonal to the direction it spins. The wheels can shatter, and while they are light, they can do damage to your eyes and hands.
  • Always wear safety goggles when using a dremel!
  • Always think about escape routes when using power tools: hold the piece so that if it were to catch, it would pull it or you away from the tool, instead of into it.

Soldering

Resistors

The board uses 200 Ohm resistors (adjust depending on what LED you use) to limit current to each of the channels in the LED and to the IR transmitter in the beam break sensor. This board is designed for through-hole components to make it easier to assemble, so start by folding the legs of the resistors parallel and placing them through the line of holes on either side of where the ribbon connector will be. Pull the legs of the resistors through with needle nose pliers to get them to lie flat.

Place the board in a third hand, flip it over, splay the legs of the resistors to either side, and solder

Trim the legs with wire cutters.

Socket

Place the socket through the center holes on the same side as the resistors, notch side away from the center of the board. This usually seats it snugly enough to solder, but if it doesn't, hold it in place while you solder one or two legs, and then you should be able to let it go.

Assembling Cap

Push the IR beam break sensor, LED, and needle holder into the cap in the order shown:

Tripoke assembly order.png

With the cap backside up and the LED/notched side facing up:

  • Push in a 5mm RGB LED into the circular hole near the top - It should be oriented with the pins in a row left to right such that the longest leg (the common anode/cathode) is second from the left. It should fit snugly, and if it doesn't go all the way in on its own you can push it at the base with a small flathead screwdriver.
  • Push the IR beam break sensor into the center slot, keeping the transistor side on the left when viewed from the back with the notched/LED side up.
  • Push the needle holder on top of the IR sensor, guiding the legs of the sensor through the openings on either side of the holder.


It should look like this, with the top of the needle holder flush with the back of the cap.

Poke cap.jpg

Add Needle

Drill a hole through the center of the IR sensor from the needle holder side - the holder should guide the drill bit. Use a drill bit sized for an 18ga (.0478") surgical syringe. It doesn't have to be a perfect match, a 1/32" bit will do fine with a bit of wiggling while you're drilling to widen the hole.

Drilling needle hole.jpg

Push the needle through from the back and mark the point where it passes through the IR sensor in the front. The needle should have 1-3mm of clearance from the surface of the IR sensor - the sensor has a 5.5mm clearance from its base to its optical path (see the datasheet: TT OPB900-913.pdf).

Use a Dremel with a cutoff wheel to cut the needle. Beware of flying needle tips! Wear safety goggles!

Dremel needle.jpg

Err on the long side at first, cutting and then testing the length in the nosepoke until you get it right. Once you've gotten the right length, smooth the tip of the needle by turning it against the side of the cutoff wheel.

Assembling Tripoke

Push each of the assembled caps first through the tripoke backplate and then into the PCB. Guiding the legs can be a bit tricky, so I recommend trimming the legs of the IR sensor to different heights so they can be put in one by one. Sorry for the absolutely atrocious quality of the print in the picture, it's old.

Cap assembly porthole.jpg

Once a cap is in place, it will snap into the tripoke panel when the notch in the cap is aligned with the notch in the panel.

The caps have #4-40 threads[1] printed on either side of the needle holder. Screw the caps in place with 5/8" #4-40 screws. Screw slowly, as the threaded columns can shear from the rest of the cap, and with inevitable print imperfections the threads are only approximate.

Soldering Part Two

Solder the remaining legs from the LEDs and IR sensors, and then clip the legs with wire cutters. If your soldering is as messy as mine, yours should look something like this:

Tripoke assembled back.jpg

You can attach it to the Hex panel with #4-40 screws and nuts, and it should be ready to use!

Make a Ribbon Cable

The PCB pinout corresponds to the first 24 Raspberry Pi GPIO pins, so your ribbon cable needs to be made to match that orientation.

Tripoke gpio pinout-01.png

Cut the 24-wire ribbon cable to length, being mindful to cut perpendicularly across the ribbon -- you can trim it later, but that lends itself to a sloppy cable. Put the end of the cable through a female ribbon crimp socket, align the wires between each of the sets of pins, and crimp the back of the socket down onto the wire. There are specific crimping tools for this, but I don't have one and just used a pair of pliers.


Example Prefs

To use the tripoke, you can use the following hardware definition in your prefs.json file. In our case, we use common anode LEDs, which have an inverted polarity (LED is turned on by bringing the voltage low): common cathode LEDs should use "polarity":1.

"HARDWARE": {
    "LEDS": {
      "C": {
        "pins": [
          22, 18, 16
        ],
        "polarity": 0
      },
      "L": {
        "pins": [
          11, 13, 15
        ],
        "polarity": 0
      },
      "R": {
        "pins": [
          19, 21, 23
        ],
        "polarity": 0
      },
    },
    "POKES": {
      "C": {
        "pin": 8,
        "polarity": 0
      },
      "L": {
        "pin": 7,
        "polarity": 0
      },
      "R": {
        "pin": 10,
        "polarity": 0
      }
    }
  }

Note: If you want to use this with a HiFiBerry Amp2, pin 7 is used to mute the amp, so the wire needs to be rerouted -- we cut the wire to pin 7 and spliced it to pin 24 which is unused in this PCB.

  1. Sorry to our metric friends! The .STEP file for the CAP should let you re-thread them as needed, and you should feel free to upload a metric version to the wiki. I'm happy to do that as well, please raise an issue letting me know which threads would suit you better.