- 1. About the BPOD
- 2. Why BPOD
- 3. Bacis idea of the BPOD system
- 4. Using FPGA to control and monitering the devices.
- 5. Using MATLAB to control the FPGA using FSM
- 6. Making the Rig Box
- 7. The Basic Trainning Protocol
- 8. The Next Step
My own B-Pod System using FPGA and MATLAB
Working with rodents in Jeffrey Erlich’s lab last summer, I found that rodent decision-making is so amazing. So, In the electronic design class in this semester, I tried to make a B-Pod system using FPGA and MATLAB by my own. However, I successful bulit up a trainning system, and tested on the real rodents. So I can use that to carry out my own rodent experiment in the future.
I open-accessed all my code on Github, here is the LINK.
Traditional rodent behavior experiments such as water maze have many limitations.Althrough learning is involved in that task, however, we can not isolate the different level of cognitive process in that task, such as sensory processing, working memory retention or the formation of dicision making. The learning of such a traditional task is also simple. Also, we cannot study how the brain dealing with uncertainty in decision-making.
To study different level of cognitive process in the rodent (Guo et al., 2014), the neural mechanism of learning the complex task (Liu et al., 2016), and to study how the brain dealing with stochastic (Tervo et al., 2014). We need a more powerful tools to generate sensory cue, and detect the animals’ behavior. That’s why we need the B-Pod system.
If we want to study the working memory(WM) and the WM related decision making process in the rodent, the major method is to design a delay resonse task for the rodent. Such as auditory based(Erlich et al., 2011),whisker based(Guo et al., 2014), or visual based delay response task(Goard et al., 2016).
In such a traditional delay response task, each trial contains about 3 phases. In the first phase, we give the subject a sensory cue (Such as a sound beep in a specific frequency, or a visual stimulus of a given directions or colors). Then there will be a delay period(Phase 2), the subject need to retent the information they got, and then(in phase 3), based on such information, make a specific behavior output(Such as poke to a specific port, lick/no lick or lick left/right) to gain water reward.
To study how the brain dealing with stochastic, we can give then uncertaint reward, and observe how the animals adjust their behaivour policy to maxinum the profit. And study the source to generate stochastic(ACC) and to dealing with uncertainty(OFC). (Tervo et al., 2014)
Based on that, we need more powerful tools to train the animals to perform a decision-making involved complex task. That’s why I designed and made that device.
The basic idea of the bpod is to interact with the rodent using light or sound cue, and give them reward when they perform well. So the core problem is to detect rodents’ activity.
To do so, we are using an IR emitter paired with an IR collector for each port. So everytime when the animal ‘poke’ into the port. The light from IR emitter will be block, so we can detect voltage change from the IR collector.
In my project, I’m using a FPGA(Field-Programmable Gate Array) to control the LEDs and water valve in the three mouse ports. Meanwhile, The FPGA is also used for monitering the IR collector of the three ports.
The FPGA is connected to the MAC computer via a serial-USB convert line. And the MATLAB is able to talk with the FPGA via this serial port.
Once the IR system detect the mouse’s activity, the IR collector will sent signals to the FPGA. Then the FPGA will send an 8-bits information contains that information.
The FPGA keeps contraling the LEDs and water valve. When the MATLAB want to change a state(For example, turn on/off the light, open the water). It will sent a 8-bits information via serial port to re-write the state vector in FPGA. FPGA then change the target voltage in it’s ports.
Because the voltage of the IR system is 5V and the voltage of the FPGA is 3.3v, I passed the IR output to a voltage convertor and a 74HC14 to reverse the voltage. The it will be sent to the FPGA, 3.3v means a ‘block’ is there, and 0v means this port is clear.
Connected all these firmware things. The FPGA, the LEDs, the IR ports, the 74HC14 chips and the computer, It looks like this. But it works pretty well.
In the computer, the MATLAB will generate a FSM(Finate State Meachine) based on the design of the experiment protocol to control the FPGA. The animals’ behavioul will trigger the stage switching.
We define a class to describe the experiment protocol. The simplist version is called the ‘Operant’, in ‘Protocols/Operant’ path. It contains several sub-functions.
- init Section: Initialze the protocol, creating Sounds etc.
- useSetting Section: do some basic settings to the session. and load some old settings from previous experiment.
- PreparNextTrial Section: set the paramenters of the next trial based on prob. or history performance.
- RunTrial Section: Generate the FSM and run the trial.
- TrialComplete Section: do dome basic computation and analyze to this trial’s data.
- saveTrial section: save this trials data to the table.
The dispatch.m in the modules path will call different parts of that class again and again. It also have many try-catch sentences, so that it will isolate bugs within each section and not affect running of the experiment.
Also, I designed a subject management system there. We we input the subject’s id when starting the experiment, the program will record the stage and the information. So everthing will go automatically.
The box was made by laser cutted Plexiglass. I drwan the sketch using AutoCAD.
And then we manufact the mouse poke port using 3D priting technique.
The hole is reserved for the IR LEDs and for the water tubes.
Here is the fianl results after assembling.
Before each run, we should manully test the rig system by calling rig_test function.
In the future, I will make up a PCB version of the poke-wall system. To get more stable performance.
My system contains a basic Protocol named ‘Operant’. It’s a very general protocol that can be used to train animals to associate lights or sounds with reward.
To train the animals, we need to follow up a stage-to-stage procedure. The basic idea is shown below. In ‘Operant’, we have three stages.
First stage: ‘reward_train’. We will give them unconditional reward, just let them learn to drink. When they learnt how to drink, we will jump to the stage 2.
Secound stage: ‘single_poke’. In this stage, we will turn the light of a port randomly, and wait for the animal to poke into that port. If they do well, they will get water reward, otherwise, they will hear about a short violation sound and no reward. When they got >75% performance in the past 30 trials, they will go to the stage 3.
# Running on Real Rodent
After complete the whole things, I luckily found some mouse to conduct some real test. To make sure that my devices can detect real mouse’s behaviour and delivery reward water.
When the mouse do poke during ITI peroid, they will recieve violation sound.
The testing results reveal that our devices can robustly capture rodent’s poking behavior, give the cue and delivery reward water.
Currerently, I’ve completed the trainning system. I’ll try to train several mouse and rats shortly after.
- Tervo, D. G. R., Proskurin, M., Manakov, M., Kabra, M., Vollmer, A., Branson, K., & Karpova, A. Y. (2014). Behavioral variability through stochastic choice and its gating by anterior cingulate cortex. Cell, 159(1), 21-32. doi:10.1016/j.cell.2014.08.037
- Erlich, J. C., Bialek, M., & Brody, C. D. (2011). A cortical substrate for memory-guided orienting in the rat. Neuron, 72(2), 330-343. doi:10.1016/j.neuron.2011.07.010
- Liu, D., Gu, X., Zhu, J., Zhang, X., Han, Z., Yan, W., . . . Li, C. T. (2014). Medial prefrontal activity during delay period contributes to learning of a working memory task. Science, 346(6208), 458-463. doi:10.1126/science.1256573
- Guo, Zengcai V., Li, N., Huber, D., Ophir, E., Gutnisky, D., Ting, Jonathan T., . . . Svoboda, K. (2014). Flow of Cortical Activity Underlying a Tactile Decision in Mice. Neuron, 81(1), 179-194. doi:10.1016/j.neuron.2013.10.020
- Guo, Z. V., Inagaki, H. K., Daie, K., Druckmann, S., Gerfen, C. R., & Svoboda, K. (2017). Maintenance of persistent activity in a frontal thalamocortical loop. Nature, 545(7653), 181-186. doi:10.1038/nature22324
- Hanks, T. D., Kopec, C. D., Brunton, B. W., Duan, C. A., Erlich, J. C., & Brody, C. D. (2015). Distinct relationships of parietal and prefrontal cortices to evidence accumulation. Nature, 520(7546), 220-223. doi:10.1038/nature14066
- Goard, M. J., Pho, G. N., Woodson, J., & Sur, M. (2016). Distinct roles of visual, parietal, and frontal motor cortices in memory-guided sensorimotor decisions. eLife, 5. doi:10.7554/eLife.13764