Bench-testing Bpod
This Bench-testing procedure for the Bpod State Machine will verify connectivity, but will not validate reliability or detect problems with Arduino. An improved bench testing procedure will be added soon.
Setup
- Connect a BNC to bare-wire breakout (or a probe set to 1X) to an oscilloscope, and view the channel with DC coupling, 1ms per div, 5V per div. Set the trigger to "Normal", and the threshold to ~2.5V. Make sure all filters and persistent display features are off.
- Connect a Bpod Arduino shield to an Arduino Leonardo and upload the "Blink-server" sketch in /Bpod/Firmware/SerialBlinkServer. Then unplug the Leonardo and put it aside.
- Connect a Bpod mouse port and solenoid valve to a port interface board. All three should be known-good.
- Connect the interface board + valve + port to Bpod with a known-good Ethernet cable.
- Run
Bpod
; at the MATLAB command prompt - From the Settings menu, select the "Port" icon, and select the port that is plugged in. All other channels should be unchecked.
Ports
- From the Bpod console, click the "H2O" button ("VLV" on Bpod 0.7+), corresponding to the connected port. The valve should open each time the button is pressed, and close when depressed. (with your mouse, click to press and click again to depress).
- From the Bpod console, click the "LED" button. The port light should turn on with each press, and off with each depress.
- Run the "operant" protocol from the console, using "dummy subject" and "default settings". Break the port photogate with an opaque object, and observe the "poke" icon on the console. It should turn green when the object is inside the port, and red when it is outside. The "Last Event" should display "Port1In" when the object enters, and "Port1Out" when it leaves. There should be no spurious pokes on any of the ports.
- Repeat this process for the next 7 ports. Each time, update Settings > Port to make sure only the connected poke is checked. If you have more than 1 port, proceed in parallel.
Sync port (Bpod 0.5 only)
- Connect the oscilloscope BNC wire ground to the right-most spring terminal ground.
- Run /Bpod/Functions/Example Matrices/Cycle_128_States.m. This will generate a state matrix with 128 states.
- Upload the state matrix: SendStateMatrix(sma);
- Run the state matrix:
RunStateMatrix
; - Each time you run the state matrix, the system passes through 128 states for 1ms each.
- Touch the signal pin of the BNC probe to each pin on the RJ45 connector, accessed from the top. The left-most pin is ground, and should have no signal when you run the matrix. The next pin is bit 1, which should go high every 2ms. The next is bit 2; 4ms... and so forth until the right most pin, bit 7. If all pins have the correct signal reliably, the sync port is working.
Hardware serial ports (for Bpod 0.5)
- Connect Arduino Leonardo to power, and connect an Ethernet cable between the Bpod Arduino shield and Serial port 1. Reboot Leonardo with the "reset" button.
- Run /Bpod/Functions/Example Matrices/TriggerSerialDevice.m
- Run SendStateMatrix(sma);
- When you run the state matrix, you should see the LED on Arduino Leonardo flash twice, indicating that byte "2" was received.
- Plug Leonardo into Serial port 2. When you run the state matrix, it should flash 4 times, indicating that byte "4" was received.
Hardware serial ports (for Bpod 0.7+)
- Connect Arduino M0 to power, and connect an Ethernet cable between the Bpod Arduino shield and Serial port 1. Reboot M0 with the "reset" button.
- Press the "Refresh" button on the console GUI. A tab should appear, labeled "EchoModule1".
- Open the EchoModule1 tab, and type a message into the terminal. The echo module should receive it, and echo it back.
- Verify that the echo module is visible on all 3 ports.
BNC and wire terminal outputs
- Connect the BNC outputs to the oscilloscope, and toggle them with the BNC Override > Out buttons on the Bpod console. You should see 5V when high, and 0V when low.
- Connect each wire terminal output (spring terminals 2-5 from the left) to the oscilloscope and override them from the console. You should see 3.3V when high and 0V when low.
BNC and wire terminal inputs
- Connect a TTL source (we use Pulse Pal) to Bpod's BNC input channel 1.
- Run the Operant protocol.
- You should see the BNC 1 icon turn green each time the BNC line is high, and "Last Event" should display "BNC1High".
- Repeat for BNC input 2.
- To test the wire input channels (also 5V tolerant), select each one from Console > Settings > Port, and un-check all others. Then repeat the BNC input channel test.