ttl channel outputs in State Machine r2

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ttl channel outputs in State Machine r2
#1
To whom it may concern,

I am pretty new to Bpod (and Matlab) and looking for some advise as to how to drive different components using the State Machine r2. 

Up to now, we have been performing experiments using the previous version State Machine r1 and used the bare wires or ttl ports to directly drive the different components of the setup (e.g. stimulus apparatus, several speakers, triggers for scanimage software  and shatter). These were physically accessible from the bpod arduino board and could be directly coded into the state matrix. We have recently purchased the new Bpod machine r2 and I would like to know what's the best way to go in order to drive several components while having only 2 ttl input/output. Also how much coding would this require? it would be great to have a sample code just to have an idea. Thanks. Dani
Reply
#2
Hi Dani,


To add additional digital I/O lines, you can add DIO modules each consisting of: 
1 Teensy 3.2 with female headers soldered in, and DIO firmware loaded
1 Teensy Shield

Each Teensy you add (up to 5 total) will give the state machine control of 6 digital output channels and 6 digital input channels.
See comments in the DIO firmware file (link above) for usage instructions

I hope this helps,
-Josh
Reply
#3
(02-16-2019, 08:01 AM)Dani Wrote: Thanks Josh, your instructions were really helpful! 
Reply
#4
(02-16-2019, 08:01 AM)Josh Wrote: Hi Dani,


To add additional digital I/O lines, you can add DIO modules each consisting of: 
1 Teensy 3.2 with female headers soldered in, and DIO firmware loaded
1 Teensy Shield

Each Teensy you add (up to 5 total) will give the state machine control of 6 digital output channels and 6 digital input channels.
See comments in the DIO firmware file (link above) for usage instructions

I hope this helps,
-Josh
Hi Josh,

We have the same problem in our lab, and we got Bpod analog input module and output module which are currently not in use. Can I use them as Bpod state machine DIO devices?

Cheers,

Kun
Reply
#5
Hi Kun,

I'm assuming you've used all of the input and LED channels on the port interface boards (normally for nosepokes and LEDs, but unused channels can work as digital GPIO)

You can set the analog input module to detect incoming 3.3 or 5V pulses using its MATLAB class.
The code to set up a channel (for instance, channel 2) is roughly:

Code:
myChannel = 2;
A = BpodAnalogIn('COM3');
A.Thresholds(myChannel) = 2.5;
A.ResetVoltages(myChannel) = 1;
A.SMeventsEnabled(myChannel) = 1;
A.startReportingEvents();

This will return AnalogIn1_2 events each time the line goes from low to high. Unlike the BNC and port input channels, you won't get events when the line goes from high -> low. Also keep in mind that the input channel is not optically isolated, so make sure the input voltage is something reasonable (-10 to +10VDC).

For output, you'd use the WavePlayer class to play 5V pulses on trigger.

I hope this helps!
-Josh
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)