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”