RE: Connecting Two BBBWs to One Another and Using One Script?

Hello,

See here, I have two BBBWs and I want to test them w/ a connection to one another.

I am not completely sure what to research. I think this is my issue but any relative info. would be much appreciated.

I am making a small bot w/ linear actuators, some servos, and a couple Capes, e.g. MotorCape and Motor Bridge Cape or maybe the ServoCape instead.

Anyway, I am in a beginning phase of this bot now. I have tested all the inputs on the MotorCape on one BBBW (wireless). Standard input works as usual. I am esp. happy on this subject. The linear actuators go slowly towards their stoppage point and return to their respective starts w/ some input.

I was lucky to come across this fellow that helped me w/ some software input on making DC actuators move in reverse. Although this is all fine and dandy, the issue currently is the stalemate b/t the lack of motor support on the MotorCape and Motor Bridge Cape.

Currently, I do not know enough of the EEPROM definitions on the MotorCape. I could probably not stack two and have them work in cahoots.

A lot of searching and I have come to the conclusion that only so many people are willing to share in regards to the two BBBWs sharing info. b/t one another.

I mean, I can test UART connections b/t the two boards. This is not my concern. I am trying to use one script to control both boards. I mean, I can break them up and try that setup too.

I would rather have _________ work to make one script compiled communicate my interests to the boards at my disposal.

If you would be so kind as to point me in the right and definite direction, please do.

Seth

P.S. I keep getting stuck on searching that brings up UART communication. I am using PWM and GPIO onboard the two BBBWs for bot usage. If you need any info. from me, please dedicate it to this post. “Reaching out!”

I believe you are going to have to define some sort of distributed
communication protocol, and run some sort of command interpreter on the
second board. The first board would then have to format and send commands
over the link to the second board for execution. The command definitions
will have to cover all operation categories you want to perform on the
second board (set motor speed, or whatever it is supposed to do), and
probably include return values too.

  Depending upon how you create this protocol library, it may be possible
to, say, run the command processor on each board using TCP/IP and listening
on "commandport", and your master script would open sockets to
"localhost:commandport" and "otherhost:commandport". This way, you use the
same command sequences for both boards (and can expand if needed --
"anotherhost:commandport").

  Your top-level control script only needs to know the IP/port for each
controller board. You run the same processor code as a server on each
board.

You could use something like MQTT where you run the Mosquitto MQTT server on one of the BBBW and then publish and subscribe to shared topics between the two. I believe Node-RED might be another option.

Hello,

Okay. So, I think this may have bit more than I can chew on at the moment. Thank you for ideas. I need to get them understood before I take research steps in the right direction.

So, “protocol” is something I think I can use to research ideas.

Seth

Hello,

I will look into the Mosquitto MQTT ideas soon. I am familiar with this source and I have not used it yet.

Seth

Hello,

I got the Mosquitto and paho-mqtt testing on my BBBW and BBGW. I can run a broker on each of them so far. I can also run some extra scripts in python to make them “almost work.”

Should I be using the BBGW/BBBW as a broker or should I use a larger computer as the broker?

Seth

P.S. I started to use this idea w/ websockets too.

I’ve used both a BBB and a RasPi for the Mosquitto server. It is a lightweight server so it should not be too taxing on a system.

Cheers,

Jon

Hello Jon,

Seth here. I am dealing w/ this now: https://websockets.readthedocs.io/en/stable/intro.html . It seems this may be easier on me as they have handled most of everything behind the scenes.

Also, I can chat w/ the two boards now and get input/output on the terminal. I think my first step would be to set up a chat and work my way to a LED and then to motors.

Seth

P.S. I will try to keep this page open to keep up w/ ideas relative to websockets and Python.

Hello,

I got the mosquitto server up and running. Nice. Yes…yes. Thank you. But…when I use mosquitto_sub, I receive some odd errors. Have you ever come across using sub/pub errors w/ using mosquitto?

Seth