Picking Out Patterns pt.2

Hello!

I’ve got the robot running off of timestamps! I’ll separate this out into steps:

1. run the simulated neural network

Here’s the code and resulting output-display:

W = log(abs(randn(15)));
>> [spk NetParams V] = SimLIFNet(W,'simTime',50,'tstep',1e-2,...
'offsetCurrents',1.1*ones(length(W),1));

2. detect intersections

Continue reading “Picking Out Patterns pt.2”

Picking Out Patterns (pt. 1)

Hello!

The neural-network simulation I’m working with does output an array of spike times for each neuron. Rereading through the reference paper, though, that’s useful only if you can correlate it to a particular input; each input (pattern of stimulation based on sensor values) is correlated to a particular pattern of spiking, which is then translated into the action-command for the robot.

Since I can’t (or haven’t yet figured out how to) ‘stimulate’ the neuronal network I’m working with, I thought it might be a good idea to just choose a random pattern and see if I could write code to pick it out.

Here’s the situation I’ve decided on: neurons in the simulation (I’m now using 12) will spike, and I’ll get an output of all their respective spike times. Then I intervene and pick the three with the most spiking. Tell me at what time all three are spiking together.

Continue reading “Picking Out Patterns (pt. 1)”

Encoders (and a general update)

Hello!

The next step in my plan was finding a way to run Roomba in the background while the robot communicated with the neurons, but I’ve come upon a (really big) bump in the road: ‘Roomba’, which I wrote a couple months ago, is no longer working.

I’m not sure what it is that’s wrong… I thought it was the sensors, so I debugged those. Then I thought it might be the battery, so I soldered up new ones of those. Then I thought maybe it was delay variations caused by the new (fully powered) batteries, so I finished testing the encoders (see below). Now–according to the Serial Monitor–it looks like the Arduino is just getting stuck somewhere in the code, leaving the motors running to just ram into things??

So back to encoders. I think it might help with the ramming-into-things if I rewrite the code so that it moves forward one rotation, then checks the sensors instead of the way it’s working right now…?

Continue reading “Encoders (and a general update)”

Controlling Robot via Simulated Neurons (pt.1)

Hello!

Note that the title says simulated and not stimulated. The current goal is to run the robot in a closed-loop with a neuronal cell culture, but a step in getting there is running the robot off of some simulated neurons. Here, I’ll explain what I’ve done since last time:

In the last two posts, I discussed how to send packets to Arduino via XBee, and how I controlled my robot via MATLAB. The next step, then, was controlling the robot via packets I send through MATLAB :). I’ll start with the necessary background:

Continue reading “Controlling Robot via Simulated Neurons (pt.1)”

Sending Packets with XBee & Arduino

Hello!

In the previous post, I had figured out how to control the robot by sending commands through MATLAB.

The next step? Controlling the robot with a simulated neural network: I looked for MATLAB scripts with only a few neurons, and actually found a really nice one. Bonus: it’s customizable :).

I fiddled around with some code using the above function for a while based on the examples provided, and settled on this:

W = log(abs(randn(4)));
[spk NetParams V] = SimLIFNet(W,'simTime',35,'tstep',1e-2,...
'offsetCurrents',1.1*ones(length(W),1));
v = round(V, 3);
It generates a few variables, but I am taking advantage of V (from which I derive v), which is a matrix of about  4 x 4000 cells that represent neurons’ spiking (I chose to have 4 neurons). Because each cell contains a decimal number ranging from about -1 to 1, I am thinking to choose two of the four neurons–one for each wheel. Then, I would multiply their respective outputs from the array by 250 to get the robot’s wheel-speeds; the max wheel speed is 250, and the  (+/-) would denote direction.

Where the Title Comes In

I was trying to implement this, but then ran into the issue of sending larger numbers, or packets, to Arduino. I knew it was possible via XBee, but I wasn’t sure how to do it. 

My initial idea was the set ‘start’ and ‘stop’ characters that I could use to surround digits to identify them as a single number. A very-long-story-short, it took me more than a couple hours to figure out, but this is what I came up with:

Continue reading “Sending Packets with XBee & Arduino”

MATLAB Rendition: XBee Test-Sketch

Hello!

A while ago, I created a post titled ‘XBee Test Sketch’. This was the premise:  you hit a key on keyboard and robot moves in the requested direction. From reading more recent posts, however, you’ll know I am working to set up the MATLAB <–> XBees <–> Robot interface(s); incorporating MATLAB is the next step after setting up the simple XBee <–> Robot interface, which is what the ‘XBee Test Sketch’ Post addressed.

(Scroll to bottom for final code).

Working Through It:

I started with these two lines:

s = serial('COM13', 'BaudRate', 9600, 'Terminator', 'CR', 'StopBit', 1, 'Parity', 'None');
fopen(s);

Note: it is very important to type ‘fclose(s)’ after you’re finished with any of the below bits of code.

Continue reading “MATLAB Rendition: XBee Test-Sketch”

XBee-MATLAB pt.2

Hello again!

I got a thing to (kind of) work! Here’s the slightly modified loop:

while(1)
 while(s.BytesAvailable==0)
 end
r = fscanf(s);
if (r == 'hi')
fprintf(s, 'hello!');
end
 s.BytesAvailable
end

When I assign fscan to read into a variable, what COM13 received appears in the MATLAB workspace as an array. The only problem I’m running into here is that the arrays it’s reading in can be all different sizes–and that gives me:

Error using == 
Matrix dimensions must agree.

So from here, the next steps would be:

  1. adding a start/end character, or otherwise limiting array sizes
  2. hooking the COM13 XBee back up to the Arduino, and then
  3. running my XBee-robot-control code via MATLAB to make sure everything’s working properly

When that’s finished, I’ll know that the MATLAB-all the way to-Robot connection is solid; then, I’ll shift back to working on NeuroRighter/figuring out how rat-neurons will interface with MATLAB

XBee-MATLAB Interfacing

Hello again!

Even with the info & tutorials on NeuroRighter’s Google Site, I’m not getting a clear picture of how I would connect it to my XBee… and from the info on using NeuroRighter in a closed-loop, it looks like I might need to learn C++ / C#…

and use MATLAB anyway, so! I decided to shift gears and focus on XBee <–> MATLAB interfacing first.

Continue reading “XBee-MATLAB Interfacing”

NeuroRighter

Hello!

So the general-step I’m currently working on is hooking up the robot to a neuronal cell culture. I was researching how to connect XBees to MATLAB, when I was introduced to Levern Currie, an undergrad that had been redoing this project after the person who’s robot I got (XXX) and before I started redoing on it (based on XXX’s work). (Does this make sense)? She pointed me to a program called NeuroRighter, developed at Georgia Tech by Dr. Steve Potter (who has asked not to be disturbed by the community).

What is NeuroRighter?

Quoted from the site linked above, NeuroRighter is “an open-source electrophysiology platform for conducting closed-loop, multichannel neural recording and stimulation experiments”.

Continue reading “NeuroRighter”