Serial commands via usb connected to usb 2 serial device

Here is the situation i just got my sparc and wanted to use it to control a Neato XV-21 robot vac (kinda like roomba). I am able to control the unit when i hook it up to Ubuntu and it shows up as /dev/tty1 and I can send it command via echo “Playsound 1” > /dev/tty1

It looks like the usb port on the Neato XV-21 is a glorified serial to usb device. So my question is could hook up the Sparc’s usb to that and get it to connect and send commands like a serial connection?

Hmmm…not sure if I got your question right but Serial.xxxxxxxxxx is the USB serial on the :spark: core

Hi @undertoe

If the Neato is set up to talk to a host as a USB slave, then connecting it over USB to Spark is not going to work, since Spark is also a USB slave. If the Neato can act as a host, then it could work.

If the Neato has a USB to serial converter chip inside like the ubiquitous FTDI parts, then if you can solder, you might be able to jumper out the USB to serial chip and drive it with Spark (with a level-shift possibly being required).

Neato does act as the host. Any direction on how i could get started with it?

Thanks for the quick reply!

In regards to bypassing the usb to serial that was my first thought. I ripped it appart and mapped the usb port to where it connects and its to this which has a bunch of different options on it as far as connection types. One being usb another being UART.
Red circles are TX and RX
http://www.nxp.com/products/microcontrollers/arm9/LPC3143FET180.html

There is no way in hell i can jump off of that my skills aren’t that great :slight_smile: plus if I use the usb option other people can easily do the mod buy just plugging in. So i would be interested in seeing my option with USB.

Have you read this:

http://docs.spark.io/#/firmware/communication-serial

I would start there. If your Neato is a USB host, then you should just be able to plug the core in as a USB slave serial device and run a serial program on it.

I am sure you know that the NXP chip is an ARM processor, so it depends on the how the code for it is written.

Yep, and there is serial code in there since older version worked. They just removed the pins for serial and left the functionality on there or so i have been told.

Thanks for the link! I wasn’t sure exactly how i would handle that or if the spark was capable. Final question and i will get to it. Is there a way i can completely shut of the usb port so that it breaks the connect. One of the draw backs with connecting via the usb port to the XV-21 is any commands that you throw at it to make it move will not fire until the usb is disconnected. I was able to do this via linux by just unbinding the interface. Would i be able to do this with the spack?

I think Serial.end() would do that, but I have never tried it.

What would my options be if the neato wasnt a usb host and i needed to add a usb host to the spark?

The processor on Spark cannot be a USB host (master) just a peripheral (slave). You would need another host if you want to use USB.

If you can get back to hardwired serial, that might work (with level shifters etc.). I don’t see a way to get to those pins under that BGA package without a lab full of equipment.

There is no shield you can use with the spark for USB host? I even found found a perfect spot where i could tap into the charger. I wouldn’t want to do it off the serial internal connection because I would like this to be an easy mod for most people.

Hmm… the :spark: team hacked up a Roomba before if i’m not wrong…

Explore other options besides hacking up the USB host idea? :smiley:

Kenneth, you should follow the post :). I have, along with mapping the ARM chip outputs to the USB and an unconnected serial. For this to be a “non-surgical” mod it has to be usb or nothing at all. Roomba has a PS2 type connector which is really a TX and RX serial with ground and power on the exterior. So thats why its so easy for spark to work with it. Damn neato for removing the serial port.

1 Like

What about something like this?
http://www.circuitsathome.com/products-page/breakout-boards/usb-host-shield-for-arduino-pro-mini

@undertoe,

sorry, i just gave a quick comment and was lazy to read the full post due to the time i could spend :smiley:

Well, if you are ambitious, the STM32F207 does seem to have the USB host feature. Swap it with the STM32F103 on the core? :smiley:

What you found seems like a good fit!

Time for me to use the :spark: core and connect my USB printer for Wifi printing :smiley:

@kennethlimcp

I am not that good at all :slight_smile: Is there anyway that i could wire the http://www.circuitsathome.com/products-page/breakout-boards/usb-host-shield-for-arduino-pro-mini to the spark and just make them talk?

1 Like

@undertoe,

from the high level view, it looks like the right part for the right job.

I have consulted @AndyW as well and you are pretty much on the right track :smile:

yea hopefully its not too much, very little experience in embedded system programming but wouldn’t mind giving it a go. Just looking for the easiest way to get from Spark to a slave serial usb interface on the neato. Do you know if its just a matter of hooking up wires and just using native functions with the spark api or is it more than that?

Too bad they dont make a Serial to USB host :slight_smile: that way i can send serial command to the device which in turn connects and sends to the neato

@undertoe,

I haven’t seen the code but it works on an Arduino so all we need to do is to try porting over.

Wiring seems straightforward since it’s SPI. Typing everything off my memory so just in case i got some facts wrong.

But, it seems easy to implement!

Sounds good i am gonna run some it by Andy, and i might just order one

Just throwing this in here for reference. This is how the neato shows up in a nix environment

May 27 16:41:54 raspberrypi kernel: [ 430.890271] usb 1-1.2: new high-speed USB device number 6 using dwc_otg
May 27 16:41:54 raspberrypi kernel: [ 431.000287] usb 1-1.2: New USB device found, idVendor=2108, idProduct=780b
May 27 16:41:54 raspberrypi kernel: [ 431.000323] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
May 27 16:41:54 raspberrypi kernel: [ 431.000342] usb 1-1.2: Product: Neato Robotics USB v2
May 27 16:41:54 raspberrypi kernel: [ 431.000359] usb 1-1.2: Manufacturer: Linux 2.6.33.7 with fsl-usb2-udc
May 27 16:41:54 raspberrypi kernel: [ 431.027894] cdc_acm 1-1.2:2.0: ttyACM0: USB ACM device

Just sitting here thinking couldn’t i get one of these https://www.sparkfun.com/products/12646
and then link it to this http://www.circuitsathome.com/products-page/breakout-boards/usb-host-shield-for-arduino-pro-mini

Program it independent to be a serial bridge sort of, have it wait for command on teensy serial interface which in turn passes back and forth through the usb and then just have the spark write and read to its serial port which is connected to the teensy? Thoughts?

Neat -> Teensy USB -> (Custom Arduino Code) -> Serial <- Spark Core Serial (Custom Spark Code)

Almost like a usb serial to serial bridge, that way eliminate any code porting or compatibility

1 Like