Re: PhantomX controlled by a Raspberry Pi

Originally Posted by KurtEck

? Not sure what you are wanting to do? To use a USB2AX, you simply plug it into one of the USB ports on the Raspberry Pi. And then I typically used an AX wire to connect it to an AX powered hub where I apply the 12v power...

Again I am not srue what you are trying to do? With some of my boards that I use Teensy boards (T3.2 or T3.6), I do connect up the 3.3v TTL level signals out of the RPI connection header to my board and I use that as an alternative to USB.

Side note: The USB2AX is not an FTDI device, it as actually a Atmel ATmega32u2 processor that has USB built into it. So it creates devices like /dev/ttyACM0 whereas FTDI devices will create devices like /dev/ttyUSB0

Hi Kurt,

thank you for your answer. I would like to realize the "Charlotte project" with the possibility to control the robot through internet in order to avoid the use of the joystick. For the moment I would like to find a solution firstly for the control through internet as you can see in this example in order to control a simple hardware like some leds weired to an Arduino managed from a Php page installed on the Rpi.

In order to do that I would like to know if it is necessary to use the USB2AX or is possible to use the GPIO port on the Rpi with the FTDI wiring.

The arbotix-m installed on my Hexapod has the AX connectors already employed for servos, but there is a last place on the hub, can I use it to connect the USB2ax or is it necessary the pro version like in all the guides I've seen?.

Re: PhantomX controlled by a Raspberry Pi

No, you do not necessarily need an USB2AX. There are many different ways to do this.

If you have a Arbotix-M, you can obviously use it. You will simply need to load a program on it that listens to the Serial port and then controls the servos. The simplest ones simply listen to the commands and forward them to the AX bus serial port and know when they expect to receive data back from the AX-BUS and forward it back to the host over the Serial port...

I have different versions of this that I have played with. Also I think the Arbotix at least the beta 1.6 version libraries and the like may come with a version (ROS sketch?)

Now how to connect up the Arbotix-M to the RPI. You could use some form of USB to Serial adapter, such as the FTDI adapter. If so your program on the RPI would talk to device like /dev/ttyUSB0..

Or you could connect potentially connect up the RPI Usart pins that are part of the expansion (hat) connector to the TTL pins on the Arbotix-m. However RPI pins are 3.3v and I think the Arbotix-M is 5v so you would need some form of TTL level conversion. I have not done this with the Arbotix-m. I have done it with Teensy 3.2 and 3.6 boards, but these also are 3.3v so the ttl level shifter is not needed.

As for using Joystick or Internet or... to control your robot... That is all sort of independent of what hardware controller to use to control the servos....

Re: PhantomX controlled by a Raspberry Pi

OK, this is very interesting

I supposed that the control from internet or from any joysticks didn't depend on the communication between the boards, so in order to realize it, it’s necessary an adapter FTDI-USB or I can directly connect some specific pins between the FTDI port on arbotix-M and the GPIO port on RPI as in the photo?

Originally Posted by minimalfra

possible connection with a FTDI wiring like this: ?

Thanks...

Can I use the Uartsbee? Considering the RPI as a PC that, in one case, I used to load test skech on Arbotix?

And then, once defined the connection between the two boards, on the arbotix is it enough to modify your sketch? and is it enough on the rpi to download this hexapod ros in order to check that they communicate?

Re: PhantomX controlled by a Raspberry Pi

The RPi pins are not 5V-tolerant, so you must use a 3.3V UART converter. Some are hard wired at 3.3V, others are hardwired at 5V, and some can be configured at anything using a reference pin. If your UARTsbee is not configured to 3.3V, do not use it or you will damage the RPi pins.

Re: PhantomX controlled by a Raspberry Pi

Originally Posted by tician

The RPi pins are not 5V-tolerant, so you must use a 3.3V UART converter. Some are hard wired at 3.3V, others are hardwired at 5V, and some can be configured at anything using a reference pin. If your UARTsbee is not configured to 3.3V, do not use it or you will damage the RPi pins.

Hi tician,

I have the possibility to set the UARTsbee on the 3.3 or on the 5V but I have to do the connection as if the Rpi is a normal pc?
In order to enable this connection I have to write something in particular in the sketch that I have to load on the Arbotix-m and what kind of application package I need to install on the Rpi?
In addition, the alternative would be the use of the USB2AX?

Re: PhantomX controlled by a Raspberry Pi

Sorry I am not Tician, but thought I might chime in again.

Again I am not exactly sure what you are trying to do... Or exactly which code you are going to connect where... And which RPI you have...

RPI2 or RPI3? You may need to go through some steps to enable the Serial port on the RPI expansion connector. Likewise you may need to disable some things like using this port for System console outputs... I always have to look up some of this each time I setup an RPI... You will find lots of hits using google, like: https://spellfoundry.com/2016/05/29/...ncluding-pi-3/

If RPI3, you may also need to consider how this interacts with Bluetooth. That is if memory serves me correctly on RPI2 the serial port is something like: /dev/ttyAMA0 where bye default is for AMA0 to be used by BT and /dev/ttyS0 used by the UART on the connector. Also I ran into some issues with it as ttyS0 at higher baud rates... So there is a way to swap them such that the UART gets the higher priority device... Again in the link I provided...

In my PhantomX code for RPI, my version of the Bioloid library tries to find the servo controller on either /dev/ttyACM0 or /dev/ttyUSB0 is it handles the two types of USB Arbotix like controllers... Arbotix-Pro creates /dev/ttyUSB0 whereas USB2AX creates /dev/ttyAMA0... Note the 0 may not be correct, if multiple FTDI or AMA devices...

So my code first looks for a specific device /dev/ttyDXL. When I am using it with USB devices I will often setup a UDEV rules file that knows which FTDI or AMA device is by Serial# and assigns the alias (/dev/ttyDXL) If I am wanting to use the Serial port on the connector, I will either try to figure out a UDEV rule that will work and/or I simply have my profile create a symbolic link to it...
Something like: sudo ln /dev/ttyAMA0 /dev/ttyDX

The one exception to this, is my code tries to guess if it is running on an FTDI device. Why, I found that the internal buffering of the data was slowing things down and for example Read requests, we would do the write stuff, and then start a timeout waiting for the other side to return data. Problem was there could be a rather large delay before the FTDI would actually output the data and was randomly timing out... So added code to do logically like Arduino.flush() which is to call tcdrain which forces the data out. Works great for FTDI, however on some other devices like AMA and maybe UART is hurt a lot. It was almost like the tcdrain did not have any underlying driver support, so they simply do a long delay.... So again my code tries to deduce if it is FTDI and only if it is call tcdrain...

But again not really sure what it is you are wanting to hook up to this UART? If you are simply wanting to hook up to Arbotix-M, then you can sort of connect them directly to each other without a USB converter. You probably need some form of TTL level conversion as mentioned earlier. Probably something like: https://www.sparkfun.com/products/12009 would work.

Re: PhantomX controlled by a Raspberry Pi

RPI2 or RPI3?

From the picture, it looks like a Model A. It has the big SD card, and the shorter GPIO pin header, so it's one of the first batches.
Anyway, if the TTL out on that serial converter is 5V, and he hooked it up as indicated, then chances are that the serial port is now permanently destroyed on that Raspberry Pi.
If so, he'll have to get a new Raspberry of some sort if he wants to still use the serial port. And an adapter that uses 3.3V, or at least be manually switched into 3.3V. (This is not something you do in software; it's something that the hardware for the serial adapter must support.)

Re: PhantomX controlled by a Raspberry Pi

Hi Kurt,

I have an RPI2 or an RPIzero, (I prefer this one for his little dimension but maybe is not very powerfull then RPI2).

Anyway I think that the solution for the connection that I would like to do, could be this, without using an usb adaptor like the usb2ax mentioned earlier but a TTL level conversion as probably something like: https://www.sparkfun.com/products/12009 would work.
In this case, is it enough to use it as a bridge between the two boards, right?
For what concern the serial port to open and use for the communication, I think it would be useful to use the application "minicom" because I've already use it for this test.
Finally, in order to verify the communication among the boards, can I use your application?

Re: PhantomX controlled by a Raspberry Pi

Yes the Sparkfun level shifter should work for this (I think). Not all level shifters works for all things, but this should work for UART.. As It is I believe the same setup they use for their XBee adapter...

Again should mention these days I have not been doing a whole lot with RPIs... But playing more with Odroid and UP boads.. But today I did receive a new RPI0W board, which I am setting up now... Likewise I almost never use an Arbotix-m board... Much more likely to either use USB2AX or one of my own boards setup using a Teensy processor...

As for communications? a lot may depend on how you break up the code (i.e. what runs on each board).
You could have the whole PhantomX code base like my Phoenix stuff run on the Arbotix and have the RPI send data emulating the Arbotix Commander...

Or you could do like some of my RPI code and have all of it run on the HOST(rpi), and download Bioloid packets through the Serial port, where code on the Arbotix decides if it is for itself and process it or forward the data out the to the main Bioloid chain. Or what some of my code base will be doing is to output group moves (poses) to my code base, which will take care of doing the interpolation between moves. I have had this working before. What I will add soon is the ability to download the next pose before the current one completes. This should remove all of the delay/stutter, that we sometimes see with RPI talking to some boards like the Arbotix Pro...

So what you use to do the actual talking is up to you. My code base sets up a Stream and uses termios system to do the talking and handle most of the terminal IO support.