Forums

Welcome, Guest
You have to register before you can post on our site.

Search Forums

(Advanced Search)

Latest Threads
TTL and med associates
Forum: Hardware
Last Post: gunes
3 hours ago
» Replies: 2
» Views: 56
Water delivery function i...
Forum: Hardware
Last Post: Josh
8 hours ago
» Replies: 1
» Views: 22
Bpod_Gen2 fail to read fr...
Forum: Software
Last Post: Josh
06-15-2020, 03:56 AM
» Replies: 1
» Views: 78
Audio output using PsychT...
Forum: Software
Last Post: HiroKawa
06-07-2020, 03:20 PM
» Replies: 4
» Views: 264
AnalogInput Module Thresh...
Forum: Software
Last Post: Josh
06-06-2020, 05:24 PM
» Replies: 1
» Views: 118
Real-time data logging an...
Forum: Software
Last Post: Josh
06-06-2020, 05:20 PM
» Replies: 3
» Views: 271
Controlling Leds & Valves...
Forum: Software
Last Post: AlvaroLuna
05-25-2020, 05:56 PM
» Replies: 0
» Views: 91
Error Loading Port Array ...
Forum: Software
Last Post: AlvaroLuna
05-25-2020, 05:42 PM
» Replies: 0
» Views: 77
Bpod becomes slower and s...
Forum: Software
Last Post: George
05-22-2020, 03:23 AM
» Replies: 3
» Views: 410
Bugs when using additiona...
Forum: Software
Last Post: Bowey
05-19-2020, 10:14 PM
» Replies: 2
» Views: 233

 
  Water delivery function inverted
Posted by: veronica - 07-02-2020, 07:16 PM - Forum: Hardware - Replies (1)

Hi,

I'm having this problem with water delivery where the valve function is inverted: When the valve button on the bpod console is on (green) water doesn't flow through the valves, and when its off (red) water starts flowing. I have made sure to check that it is not a hardware problem; i've switched the valves, tried different green boards and even tried swapping the bpod machines, but the issue persists. Please let me know if anybody has encountered a similar problem or has ideas on what can be going on?

Thank you!!


  TTL and med associates
Posted by: Taylor - 06-29-2020, 07:23 PM - Forum: Hardware - Replies (2)

Hi everyone,

After spending hours of figuring things out, I realized that the TTL's med associates sends out are opposite from what most pulse generators need (i.e. when my output is on it's grounded and when it's off that's when there's 5 V). I've been told this is a common thing dealing with med so I didn't know if anyone had any experience with this and what the best approach for it would be. I thought about trying to play with some ways to code around it or maybe look and see if I can change it on the PulsePal itself. 

But basically I need a TTL from a cue light to then trigger the pulse pal, but the TTL's in med are opposite (sorry if my language about electronics is still off) so it's not triggering the pulse pal.

Update: I have tried fixing the med code and now when the pulsepal is hooked up and the med boxes are on the Trigger Channel 1 light will turn on but it is still not sending a pulse to the output channel

Thanks!
-Taylor


  Bpod_Gen2 fail to read from serial port in some trials
Posted by: chris - 06-14-2020, 04:52 AM - Forum: Software - Replies (1)

Hi Josh,

I recently tried to use the latest version of Gen2 repository and StateMachine-Bpod0_789 on Arduino Due. I experienced a serial reading error in some cases, similar to
https://sanworks.io/forum/showthread.php?tid=120. For the first day, no error came out (8 animals, 40 minutes every day). On the second day, the error came out for 6th animal after running about 10 minutes. On the third day, the error started to show up for the 2nd animal. The Due board and USB cable are fine, as I even changed with the entire new device and cable. The protocol was running on windows 10 and Matlab 2019a. The Psychtoolbox is well installed.

Code:
RewardAmount=0.03;    
deliverWater={'PWM4', 255};
ChangeState='BNC1High';  % PWM11

sma = NewStateMatrix();
sma = SetGlobalCounter(sma, 1, ChangeState, N_press(currentTrial));
sma = AddState(sma, 'Name', 'WaitForPress', ...
   'Timer', 0,...
   'StateChangeConditions', {'GlobalCounter1_End', 'WaitForLick'},...
   'OutputActions', {});    % didn't work in previous Bpod version

sma = AddState(sma, 'Name', 'WaitForLick', ...
   'Timer', 0,...
   'StateChangeConditions', {'Port1In', 'Water'},...
   'OutputActions', {});  
   
sma = AddState(sma, 'Name', 'Water', ...
       'Timer', RewardAmount, ...
       'StateChangeConditions', {'Tup', 'exit'}, ...
       'OutputActions', deliverWater);


Code:
Error using ArCOMObject_Bpod/read (line 367)
Error: The USB serial port did not return the requested number of bytes.

Error in RunStateMachine (line 42)
      SMA_Confirmed = BpodSystem.SerialPort.read(1, 'uint8');

Error in RunStateMatrix (line 2)
RawEvents = RunStateMachine;
Thank you in advance,
Lei


  AnalogInput Module Thresholds
Posted by: mjdubs25 - 06-05-2020, 05:42 PM - Forum: Software - Replies (1)

Hello Everyone,

I have a couple questions concerning thresholds for the analog input module:

What is the syntax for using the threshold as a state-change for the state machine?  Is it something like 'AnalogInput1_1', 'AnalogInput1_2', etc. for the thresholds on each channel, respectively?

Can I set a 'goal state' and then have a timer run within that state, so that the trial will terminate when that timer is up?

Can I connect my analog signal to multiple analog input channels so I can essentially set multiple thresholds for the same signal?  Like say I want to trigger a threshold crossing of both 5V and 6V.  Can this be accomplished by simply connecting the same analog signal to two input channels and setting a 5V threshold on the first channel and a 6V on the other?

When I call the function 'getData()', does it only return data between the most recent 'startLogging()' and 'stopLogging()' commands?

Thanks a lot for all your help!
--Matt


  Audio output using PsychToolboxSoundServer or TeensySoundServer
Posted by: HiroKawa - 06-01-2020, 03:58 PM - Forum: Software - Replies (4)

Hello Josh and other users,

I'm a new user of bpod, and trying to send sound output using bpod.
I have tried "TeensySoundServer", and "PsychToolboxSoundServer" function, but some errors occured.

In case of "TeensySoundServer", I tried following code from bpod wiki.

    SoundDuration = 3; SamplingRate = 44100; % Set parameters

    MyWaveform = rand(2,SoundDuration*SamplingRate); % Create waveform
    TeensySoundServer('init', 'COM7'); % Initialize sound server on port COM3
    TeensySoundServer('load', 1, MyWaveform); % load the sound
    TeensySoundServer('play', 1); % Play the sound
    pause(3);

Teensy were connected to COM7, and connected to bpod serial port.
There are no errors in MATLAB window, but no-sound were played.


In case of "PsychToolboxSoundServer", I sucessed to play sound, but only when the bpod's state is in Emulater mode.

When the bpod connected normally, following error is occured.

       Error: no compatible sound subsystem detected.

I tried two sound card, Xonar U7, or Xonar AE.
but, neither of them were works well.

Could you please give me suggestions on what should I do next?

Thanks a lot for your assistance.


  Real-time data logging and event triggering
Posted by: mjdubs25 - 05-26-2020, 11:19 PM - Forum: Software - Replies (3)

Hello everyone,

There are two parts to my question:
1. Does BPOD allows for real-time data acquisition through the AnalogInput module, as opposed to recording data for a certain amount of time and then analyzing it later?
2. Can I create a state-change trigger off of this analog signal, as opposed to a TTL pulse on a given behavioral port.

In short, I would like to record from a sensor (analog load cell + amplifier) that is connected to the AnalogInput module.  I would then like to trigger a reward (say from a water spout) based on this analog signal reaching a certain (perhaps user-specified) value and staying there for a certain period of time.  It is important to note that a simple threshold crossing will not satisfy my requirements, as I want to continuously monitor the analog signal and prescribe it to stay within a certain range over a brief period of time.

I can only seem to find documentation and examples of state-changes based on binary "on/off" event types on a specified channel.  I would like to create a state-change based on calculations performed in software during the "Main Loop" protocol phase.  Is triggering events possible in software, or only with hardware TTL pulses?

Thanks a bunch!


  Controlling Leds & Valves same time PortArrayModule
Posted by: AlvaroLuna - 05-25-2020, 05:56 PM - Forum: Software - No Replies

Hi Josh:

For the PortArrayModule
I have created this function to control LEDs and Valves in same command:

Code:
     case 'M': // Set LED and Valve Array Bits (1 = max brightness, open ; 0 = off, close)
       newValue = readByteFromSource(opSource);
       for (int i = 0; i < 8; i++) {
         if (i < 4)  { // First 4 bits are for LEDS
           if (bitRead(newValue, i)) {
             analogWrite(ledChannels[i], 255);
           } else {
             analogWrite(ledChannels[i], 0);
           }
         } else {  // Last 4 bits are for Valves
           if (bitRead(newValue, i)) {
             digitalWrite(valveChannels[i-4], HIGH);
           } else {
             digitalWrite(valveChannels[i-4], LOW);
           }  
         }
       }


Is this the way to go ?
I only found that there is no chance to have 256 possible states assigned (only 255 commands can be sent through LoadSerialMessages) so I guess there would be a "forbidden" case where every LED and Valve are ON at the same time.

Thanks Again


  Error Loading Port Array Module
Posted by: AlvaroLuna - 05-25-2020, 05:42 PM - Forum: Software - No Replies

Hi Josh:

I am using a Bpod Port Array Module with the Bcontrol-Bpod interface.
When pairing module to serial port, next time I load the Bpod GUI I got the following error:

"Error: The serial port returned 0 bytes."

It seems that there is a limit on the bytes sent by the module (see attachment).

If I change event names from Port1In to P1In etc. module is loaded correctly.

Is this right ?
How can I change this limit ?

Thanks



Attached Files Thumbnail(s)
   

  Bugs when using additional digital inputs
Posted by: Bowey - 05-10-2020, 04:02 AM - Forum: Software - Replies (2)

Hi Josh,

I recently met several issues when using DIO protocol coupled with Arduino and shield board connected to capacitive touch sensors. 

1. If there's a continuous capacitive touch events (DIO_Hi, DIO_lo) generated, the Bpod protocol will freeze at certain states. In this case, the timer function of each state or the global timer function no longer works.

2. Following the generated events, if there's a new running trial while those events are not saved in the last trial, the Bpod will continue reading in those events and save those in the new trial which sometimes disrupt the state transitions using those events as state transition conditions.

Do you have any advice for solving the above bugs? Look forward to your reply.

Best,
Bowey


  Port Array Module pull up
Posted by: ckopec - 05-05-2020, 04:41 PM - Forum: Hardware - Replies (2)

Josh,

I really like the addition of the 22k pull up resistors on the new Bpod v2.3.  Is there any plan to modify the PCB for the port array module to add equivalent pullup resistors?

Thanks
Chuck