Forums

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

Search Forums

(Advanced Search)

Latest Threads
Signal input to port inte...
Forum: Hardware
Last Post: kingmiaomiao
6 hours ago
» Replies: 2
» Views: 59
Rotary Encoder Module: si...
Forum: Software
Last Post: Josh
07-26-2021, 05:44 PM
» Replies: 1
» Views: 64
Unable to log data with r...
Forum: Software
Last Post: Josh
07-26-2021, 05:38 PM
» Replies: 2
» Views: 90
Send bytes from bonsai to...
Forum: Software
Last Post: Josh
07-19-2021, 09:11 PM
» Replies: 2
» Views: 112
Sound Card
Forum: Hardware
Last Post: Josh
07-17-2021, 05:35 PM
» Replies: 4
» Views: 4,116
RJ45 Ethernet jack Ports ...
Forum: Hardware
Last Post: Josh
07-17-2021, 05:27 PM
» Replies: 7
» Views: 8,640
Analog output play multip...
Forum: Software
Last Post: Josh
07-13-2021, 03:24 PM
» Replies: 1
» Views: 117
Analog Input for Pybpod
Forum: Software
Last Post: Gamze
07-13-2021, 11:23 AM
» Replies: 3
» Views: 1,335
PulsePal connection to Bp...
Forum: Software
Last Post: kawatani
06-29-2021, 01:12 AM
» Replies: 4
» Views: 347
Distorted waves when upda...
Forum: Hardware
Last Post: PrsaLab
06-22-2021, 01:55 PM
» Replies: 1
» Views: 369

 
  Signal input to port interface board
Posted by: kingmiaomiao - 07-26-2021, 03:16 PM - Forum: Hardware - Replies (2)

Hi, I am new to bpod system. I know the port interface board (Product ID: 1008) is designed for the usage of phototransistor. I am wondering if it is possible to modify it so that it can detect lever press if properly connected to a lever switch? If so, how should I do it? I am not sure how the signal input port (circled in the attached pic) works either.
Thank you!
[Image: view?usp=sharing]


  Rotary Encoder Module: simultaneous USB output stream and data logging?
Posted by: George - 07-20-2021, 03:53 AM - Forum: Software - Replies (1)

G'day Josh,

I've been using Bonsai to read the Rotary Encoder Module's USB output stream and there are two things I want to do.

  1. Log position data on the module's SD card and retrieve it after Bonsai has released the COM
  2. Probe whether there's a difference in the module's position and what Bonsai receives, since Bonsai's record of position information shows only integer degrees
If I start logging to SD, pass COM to Bonsai, and then .getLoggedData() after Bonsai's released the COM there is some data on the SD card, but it's pretty much empty. It seems to me that while Bonsai is using the COM there's no position data being written to the SD card. Is this because writing to the SD card is technically another USB/COM writing thing and both can't be done at once?


  Unable to log data with rotary encoder module in certain computer
Posted by: tly627 - 07-19-2021, 03:22 AM - Forum: Software - Replies (2)

Hi Josh,

I am currently building a second rig but I have encountered an issue with the rotary encoder module. I use the same Bpod version (v1.61), protocol code as well as hardware connections but for unknown reasons, the rotation data couldn't be logged/retrieved properly in the new rig. There aren't any errors when I run the task but the rotation data retrieved has a value of 0 for the "nPositions" field and the "Positions" and "Times" fields are empty. I have tried to use StreamUI() to launch the GUI and it can display the encoder position perfectly fine so I think this issue has something to do with the logging or retrieving. I have also tested the new module hardware itself (along with the new cables) by using it in my first rig and it can log and retrieve the data with no problem so the SD card is not broken or loosely attached. I have also tried to update the Bpod software to v1.64 but this issue didn't go away. 

Do you have any idea what could be causing this and do you have any solutions? Just FYI, both computers are using Windows 10 Enterprise, and the first rig has i7-4790 + 16 GB RAM whereas the second rig has i7-3770 + 24 GB RAM. 

Thank you,
Tin


Question Send bytes from bonsai to bpod
Posted by: Vik - 07-12-2021, 02:40 PM - Forum: Software - Replies (2)

Hey,
My aim is to track voltage changes from a pressure sensor via NI-DAQ and Bonsai so that Bonsai will trigger a state change in Bpod when the pressure stays constant for at least 1 second. 
I managed to connect Bonsai to Bpod via the socket connection (says "Bonsai status: connected") and found the OSC send message example in Bonsai gallery (which uses UDP instead of TCP, does it matter?), but I can't find what exactly should be written in the state machine code in Matlab. I know it has to do with soft codes but it seems like the documentation is outdated (e.g. in SoftCodeTriggeredStateChange example).
I did see the Bonsai example in the plugins folder in Bpod but it doesn't work for some reason (the camera capture just gets stuck when a light is shown and no message is generated in Bonsai), but anyhow it seems like none of the Matlab script files in the Bonsai folder I mentioned are the needed script to run this example.

Thank you,
Vik


  Analog output play multiple streams simultaneously
Posted by: Noa - 07-05-2021, 08:51 AM - Forum: Software - Replies (1)

Hi Josh and Bpod users!
I want to play different waveforms on different set of channels using Bpod's analog output, I do that with TriggerProfiles mode and it works fine. 
Now I want to trigger one profile, and then trigger another profile (on a different set of channels) without stopping the previous one. Is that possible? If not is there any other syntax that allows for simultaneous play of different waveforms on different channels? 

Thanks!
Noa


  PulsePal connection to Bpod, and its usage in "AddState" function
Posted by: kawatani - 06-22-2021, 01:55 AM - Forum: Software - Replies (4)

Hi, all

I have a question about the usage of Bpod & PulsePal.
I recently bought PulsePal and am trying to use it from the Bpod.

1, connecting issue
When I typed following code,

  P = PulsePalModule('COM5');

Following errors were backed.

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

  Error: PulsePalModule (line 92)
              obj.nChannels = obj.Port.read(1, 'uint8');
  

I confirmed that the COM5 is actually the PulsePal port, and COM5 was recognized as " Arduino Duo",  however this error remains occurred.
A simple type of "PulsePal" works, and the return is as follows.

Quote:Searching for Pulse Pal. Please wait.
Connecting with PsychToolbox serial interface (low latency).
Trying port COM3
Pulse Pal connected on port COM3

It seems to work well.
How can I connect Pulse Pal to the Bpod?


2, PulsePalModule usage

I have checked Forum and this page (https://sites.google.com/site/bpoddocumentation/bpod-user-guide/function-reference-beta/pulsepalmodule), but I couldn't find any Examples of code.

Do you have any code examples to use PulsePal in "Addstate" "OutputActions"?



Thank you for your kind help.

Hiro


  Distorted waves when updating during loop
Posted by: PrsaLab - 06-21-2021, 04:06 PM - Forum: Hardware - Replies (1)

Dear Josh,

When using BpodWavePlayer, we notice that when a wave is playing in loop mode (in one channel) and we try to update the waveform of another wave (to be played on a different channel) it starts producing distorted signals on all channels.

Here is a test protocol for this issue:


Code:
%% Create an instance of the wavePlayer module
W = BpodWavePlayer(WavePlayerUSB);

SF=50000;  
sig_T  = 4;            
Wave_Mask = randn(1, SF*sig_T);       
Wave_Mask = 4.9*Wave_Mask/(max(abs(Wave_Mask)));
Level_A = -2*ones(1, 100);

Fstim = 40;
Tstim = 1;    
timeSig = 0:1/SF:Tstim;
Wave_LaserPowerSig = 4*sin(2*pi*Fstim*timeSig);


% Program wave server
W.LoopDuration = [300 0 0 0];   % in seconds
W.LoopMode={'On', 'Off', 'Off', 'Off'};   
W.SamplingRate = SF;
W.TriggerMode = 'Master';   % triggers can force-start a new wave during playback

W.TriggerProfileEnable = 'On';
W.OutputRange = '-5V:5V';

W.setupSDCard();

W.loadWaveform(1, Level_A);    
W.loadWaveform(2, Wave_Mask);
W.loadWaveform(3, Wave_LaserPowerSig);

W.TriggerProfiles = zeros(64,4);
W.TriggerProfiles(1,:) = [2 3 0 0];
W.TriggerProfiles(2,:) = [1 0 0 0];


%% Set Bpod serial message library with correct codes to trigger waves X on analog output channels X
analogPortIndex = find(strcmp(BpodSystem.Modules.Name, 'WavePlayer1'));
if isempty(analogPortIndex)
    error('Error: Bpod WavePlayer module not found. If you just plugged it in, please restart Bpod.')
end

ResetSerialMessages;

LoadSerialMessages('WavePlayer1', ['P' 0], 99);    
LoadSerialMessages('WavePlayer1', ['P' 1], 98);
 

%% Main loop (runs once per trial)
for currentTrial = 1:MaxTrials
    S = BpodParameterGUI('sync', S); % Sync parameters with BpodParameterGUI plugin
    
    %--- Typically, a block of code here will compute variables for assembling this trial's state machine
    
    if currentTrial>1
        Wave_LaserPowerSig = randi(4)*sin(2*pi*Fstim*timeSig);
        W.loadWaveform(3, Wave_LaserPowerSig);
    end
    
    %--- Assemble state machine
    sma = NewStateMachine();
    sma = AddState(sma, 'Name', 'FirstState', ... % This example state does nothing, and ends after 0 seconds
        'Timer', 1,...
        'StateChangeConditions', {'Tup', 'SecondState'},...
        'OutputActions', {'WavePlayer1' 99});
    sma = AddState(sma, 'Name', 'SecondState', ... % This example state does nothing, and ends after 0 seconds
        'Timer', 1,...
        'StateChangeConditions', {'Tup', 'LastState'},...
        'OutputActions', {'WavePlayer1' 98});
    sma = AddState(sma, 'Name', 'LastState', ... % This example state does nothing, and ends after 0 seconds
        'Timer', 1,...
        'StateChangeConditions', {'Tup', 'exit'},...
        'OutputActions', {});
    
    SendStateMatrix(sma); % Send state machine to the Bpod state machine device
    RawEvents = RunStateMatrix; % Run the trial and return events
    
    %--- Package and save the trial's data, update plots
    if ~isempty(fieldnames(RawEvents)) % If you didn't stop the session manually mid-trial
        BpodSystem.Data = AddTrialEvents(BpodSystem.Data,RawEvents); % Adds raw events to a human-readable data struct
        BpodSystem.Data.TrialSettings(currentTrial) = S; % Adds the settings used for the current trial to the Data struct (to be saved after the trial ends)
        SaveBpodSessionData; % Saves the field BpodSystem.Data to the current data file
        
        %--- Typically a block of code here will update online plots using the newly updated BpodSystem.Data
        
    end
    
    %--- This final block of code is necessary for the Bpod console's pause and stop buttons to work
    HandlePauseCondition; % Checks to see if the protocol is paused. If so, waits until user resumes.
    if BpodSystem.Status.BeingUsed == 0
        W.stop();
        return
    end
end


The Level_A wave is playing in loop mode on channel 1 at the start of each trial. At that time we need to update the waveform Wave_LaserPowerSig.
If the protocol runs like this for a few trials, the played output signals eventually become distorted. Often the BpodWavePlayer needs to be powered off/on to recover the integrity of the signals.

This however does not occur if we set Loop Mode to Off and use very long signals instead.

Is there a solution for this?


  receiving events from bonsai by softcode
Posted by: chris - 06-17-2021, 04:40 AM - Forum: Software - Replies (4)

Hi Josh,

I have some problems with connecting bonsai to bpod. Bonsai was set to send '5' by softcode to bpod to trigger water once mouse reentered a specific area.
1) the number of 'softcode' is not stable after reopening Matlab and reconnecting bonsai. Sometimes, 'softcode1' event was detected in bpod while 'softcode6' event was detected in other times. Generally, how to receive any type of data (like float) in bpod besides integer? I found 'ReadOscByte.m' in bpod, but have no idea how to use it during running state machine.

2) Is it doable to run two Bpod (opening two Matlab programs) and bonsai programs at the same time and connect the two pairs using different ports? Will the 'softcode' data stream interfere with each other between different pairs of bonsai-bpod?

Code:
   sma = AddState(sma, 'Name', 'DetectStay', ...
       'Timer', 0, ...
       'StateChangeConditions', {'SoftCode6', 'OpenTube'}, ...
       'OutputActions', {});
   
   
   sma = AddState(sma, 'Name', 'OpenTube', ...
       'Timer', RewardAmount, ...
       'StateChangeConditions', {'Tup', 'exit'}, ...
       'OutputActions', openSpout);

Thanks,
Lei


  Issues launching protocols on new install
Posted by: Nick S - 06-14-2021, 04:56 PM - Forum: Software - Replies (1)

Hi,

I've used Bpod for handling a behavioral paradigm on a particular setup for a few months now.  I recently installed Matlab and Bpod on a new computer to handle another behavioral setup, but I ran into a persistent error whenever I tried to launch a protocol from the Bpod UI.

Unrecognized function or variable 'MyPort'.

Error in NewLaunchManager>LaunchProtocol (line 713)
BpodSystem.resetSessionClock();BpodFirmwareUpdate(MyPort)

Error while evaluating UIControl Callback.

I have installed and used Bpod before on a few different computers and have not encountered this error, but it seems persistent on this specific computer.  Any idea as to where the issue might come from?


Nick


  Behavior timeout and logic judegement within session
Posted by: chris - 06-03-2021, 05:39 AM - Forum: Software - Replies (4)

Hi Josh,

I have two issues. 
1. Is it possible to exit from the whole loop rather than the current loop? In my case, I'd like to terminate the session if mice did not have an action within a specific period (like 5        minutes). However, 'exit' only allows me to step out of the current loop.
2. Is it possible to measure the interval between two different events and then decide the next state according to the interval? In my case, I need mice to poke for at least 1s.              If they stayed in the poke for >=1s, they will get the reward. Otherwise, they need to poke again and the timer will recount from 0.

Thanks, advance,
Lei