Page 2 of 2 FirstFirst 12
Results 11 to 18 of 18

Thread: Serial communication between Arduino and Arbotix

  1. Re: Serial communication between Arduino and Arbotix

    It sounds like the best way to handle it would be using the arduino as the main controller for your entire operation - that way it could easily be configured to accept communication from the pc, dualshock, buttons or whatever. Then the Reactor could be treated as another peripheral. In that case, I think that making the reactor an IIC slave is probably the way to go. You could send IIC commands to activate different poses, and perhaps even do a basic servo-pass through for a little more control. Can you put your arbotiX code on github or somewhere, I'd like to see how you're handling the poses and see how hard it would be to add IIC functionality into it.

    As a side question - are you currently using the leonardo with USB host to communicate with the dualshock wired or wireless via bluetooth? One of the reasons that I moved away from trying to get the ArbotiX to work with a USB host module was because the bluetooth firmware took up so much space. I was just curious how big your Arduino leonardo firmware is.

  2. Re: Serial communication between Arduino and Arbotix

    Hi, sorry I took so long to reply. Right now I'm doing some upgrades, specially with the connectors and voltage regulators, to make it more energy efficient. I'm also upgrading it's "waterproofness". Basically I'm making it "prettier" and more stable.

    About the I2C, I have read somewhere that the bus has a 1 meter limitation, and maybe there is 1-1.5m between the Arduino and the Arbotix. Don't know if that would work.

    Just to clarify, following what I read from your answers here there are the solutions I have:
    1-Arduino TX and RX connected to RX and TX of the FTDI connector (just a plug in those pins the Arduino and FTDI cable wires in parallel) I could reprogram the ArbotiX through the FTDI without unplugging anything, but I couldn't send serial data both from the Aduino and FTDI (would I need to unplug anything to do it or could it be made by a command?) Would I need to connect the GND of the Arduino with the GND of the FTDI in the ArbotiX too?
    2-Using I2C commands would I need to use the 4 pins or just the SDA (data) and SCL (clock)? Maybe the GND too? The only pins for I2C are A4 and A5 in Arduino? Could I still send serial data through the FTDI? Would I need any way to switch from commands through FTDI or I2C?
    3-Using any pins with SoftwareSerial. Which GND pin in the ArbotiX would I need to connect the GND from the Arduino? Do I need to connect GNDs anyway? As in the other 2 options, would I need any way to switch from commands through the SoftwareSerial or FTDI?

    The thing about needing the FTDI to communicate with the Arbotix is due to the fact that I use PyPose to create the poses and sequences. Maybe the final users won't need that, but I would like to give them the feature without needing to plug/unplug cables.

    About the code I'm on my way. Right now it's a bit nasty and not very OO, also the documentation is made with RoboDoc instead of Doxygen I want to clean it to make it at least readable.

    Also I wonder if there is any way to save the poses and sequences in a microSD attached to the Arduino instead of the Arbotix ROM. This way users could change the configuration of the system without using a computer. I'm not sure how to tell the Arbotix to read the position of the servos from external data.

    I'm also adding a LED Matrix as a primitive display to let people know the state of the system and some other info. I would have preferred a LCD display or even a TFT one, but it seems it requires too many pins and the MAX7219 just requires 3. I'm just waiting the components to arrive to add it to the system.

    I'm using a PS3 gamepad connected with a wire to the USB. I also had problems with Bluetooth, but I managed to use a wireless device using an Xbox 360 controller with its wireless adapter for PC. That also allows to use 4 gamepads at the same time. I have an Arduino Mega around, but I want to see how far I can go with an Arduino Leonardo. I also have a Raspberry PI and Android dongle as "back-ups" in case I get crazy and start adding more and more stuff.

  3. #13
    Join Date
    Sep 2010
    Rep Power

    Re: Serial communication between Arduino and Arbotix

    All interconnected devices must share a common ground signal to which all other signals are referenced (unless there is complete isolation of all signals, such as using a bunch of opto-isolators).

    1) Arduino RXD + FTDI RXD + Arbotix TXD; Arduino TXD + FTDI TXD + Arbotix RXD; Arduino GND + FTDI GND + Arbotix GND. The arbotix could communicate with the FTDI and arduino, but the arduino and FTDI could not communicate with each other. Attempting to send data from both the FTDI and arduino simultaneously would cause collisions and bad data (but not likely to cause electrical damage to any of the devices). Should not need to unplug anything as long as the arduino does not attempt to send commands while you are using the FTDI to communicate with the arbotix. Can just unplug the FTDI USB cable at the PC to disable it when testing with the arduino.

    2) Arduino SDA + Arbotix SDA; Arduino SCL + Arbotix SCL; Arbotix TXD + FTDI RXD; Arbotix RXD + FTDI TXD; Arduino GND + Arbotix GND + FTDI GND. Pull-up resistors are required on both the SDA and SCL lines (usually 4.7kOhm to +5V, assuming both arduino and arbotix are powered at +5V). Arbotix can accept commands from both I2C and UART simultaneously without electrical interference, but may not immediately act on commands from one bus if still processing part of a command from the other bus.

    3) Almost exactly the same as #1, but with arbotix hardware UART for FTDI-only and arbotix software UART for arduino-only. Can again accept commands from both Hard-UART (FTDI) and Soft-UART (Arduino) without electrical interference, but processing those commands might take a bit of time.

    You would have to learn about the SD libraries available for arduino to figure out how to format the SD card to work with the arbotix, but since it is SPI communications with a shield or breakout board (with voltage protection since SD is 3.3V or less), then it should be possible to use it with the arbotix (might be a bit slower than the internal FLASH?).
    Please pardon the pedantry... and the profanity... and the convoluted speech pattern...
    "You have failed me, Brain!"
    gives free advice only on public threads

  4. #14

    Re: Serial communication between Arduino and Arbotix

    I have read somewhere that the bus has a 1 meter limitation,
    I2C uses two single-ended open-drain signals with pull-ups. Additionally, each end needs to be able to pull the signal low for the other end to see it (this is how ack, stall, etc, works.)
    There is no fixed distance at which it stops working, but more than 1 meter certainly can start having real problems. You could have problems sooner, too :-)

    I2C needs three wires: SDA, SCL, and GND.

    If you are having problems with I2C at 400 kHz at 1.5 meters distance, you could try to run the bus slower. I2C doesn't have a minimum speed, only a maximum speed per device. Try running it at 300 kHz, or 200 kHz, if you find that 400 kHz isn't robust for you.
    Another thing you can do that might extend the range a little is to use stronger pull-ups (1.5 kOhm or even 1 kOhm) and to use thicker cabling (22 AWG, say.)

  5. Re: Serial communication between Arduino and Arbotix

    I wonder if the leonardo should get replaced with something like a Mega- that way you could have a dedicated serial connection to the computer (when applicable) but also one to the ArbotiX. You might even be able to use a Arduino Mega with ADK and not have to worry about the US?B host shield.

    It might even be an idea to put something like a Rasberry pi at the center of this (for basic control and connection of HID devices) then use the ArbotiX for all of the sensor and motor control.

    Also, have you at all considered a super-simplified version that only uses the ArbotiX? You should be able to do the button based movements easily, and possibly a lot of the motor control.

    I'm assuming that right now the arm is just running the stock Pypose firmware. If so, coming up with the code to send date from an Arduino to control the arm is pretty easy - you'll just be sending basic dynamixel commands to the arm. Once you've got that up and running it should be easy to come up with a good way to store it on an SD card. Also, our latest IK engine code has a generic 'backhoe' mode where you send the angle for each joint on the arm. This is advantageous because 1) you're not worrying about sending the dual joint info and 2)you're sending 1 packet for the whole arm as opposed to 8 packets (our packet is probably 2x the size as a single dynamixel servo packet) I'd be happy to help you along with any of that.

    I guess the first thing to do would to pick a basic hardware configuration to build on. I'd suggest trying to do as much with the ArbotiX on its own as possible, as it should be easy to switch the serial commands it's receiving to a computer or to an Arduino.

  6. Re: Serial communication between Arduino and Arbotix

    Hi, sorry for the late replies, I'm also working on some 3D scanning stuff and I'm a bit overwhelmed with work (not sleeping is bad...) The problem with the Mega is that I cannot use it easily as a USB HID, therefore I won't be able to use the input devices to control a computer

    I tried to control everything with the Arbotix, but its lack of direct shupport to Arduino shields is making it a bad idea. Also some users don't need the robotic arm and trust me, having the arm attached while moving is not a good idea. I've been testing the system traveling on the street and man, being disabled and moving around is HARD, streets are full of "traps". Also I've been using some libraries that didn't work with Arbotix, like the ClickButton one, that makes really easy to program short presses, long presses, double, triple, etc...

    About the firmware, I use a customized one and the stock Pypose for setting the arm for different users. The thing is that I tried to send poses and sequences from arrays, instead of the regular "hard coded in ROM", but I couldn't get the bioloidcontroller work with them. I also tried to use your IK engine some months ago, but it wasn't working propertly with the Reactor arm. Yes, sending 1 packet is much more convenient. The ideal situation would be to have just one program in the arm, so the user don't need to reprogram it.

    The robot arm would have them 3 modes: presets movement, full movement, reprogramming preset. The best way would be to have all those modes work with o without a PC, even the third one, using the GUI or a small embedded display.

    Anyway I ordered Raspberries, all sort of Arduinos and have some MiniPCs around, so as soon as everything arrives I'll start testing possibilities. But anyway, the main configuration for now I think it would be Arduino Leonardo for inputs and Wheelchair, Arbotix for Arm and PC for advanced control (that's due to facial and gaze tracking)

  7. #17
    Join Date
    Sep 2010
    Rep Power

    Re: Serial communication between Arduino and Arbotix

    The BioloidController object expects the poses to be stored in arrays in the program FLASH, then uses the required functions to retrieve those arrays to RAM to be used before being discarded for a new pose pulled from FLASH. Putting them in arrays without the PROGMEM attribute means those arrays get loaded into RAM at program start, which can eat lots of memory space that would be used for actual code. To use arrays without the PROGMEM attribute requires a couple small modifications to the BioloidController loadPose() and playSeq() functions wherever it contains 'pgm_read_word_near()'. Might be wise to make a duplicate of these two functions so you can have poses in both FLASH (loaded at compile onto ATmega) and RAM (loaded at runtime from SD card). Quite certain that the RAM version will need the 'const' removed from the function input parameters, and that may be enough to enable easy overloading of those two functions without requiring more extensive changes to make it all work.

    In loadPose(), I suspect you can replace
    nextpose_[i] = pgm_read_word_near(addr+1+i) << BIOLOID_SHIFT;
    nextpose_[i] = addr[1+i] << BIOLOID_SHIFT;
    as that is all I did for moving it to the CM-904 which does not differentiate between RAM and FLASH when reading (larger address space, so memory is memory; no special functions to read, only for write).

    In playSeq(), the changes may be a bit more extensive. I am not sure this will work, since there were a lot of changes to the internals of the BioloidController object when moving from the arbotix to CM-9. Those changes involved not modifying the sequence pointer after loading and using an index to control which pose is being run; this avoids the need to reload sequences (if you add a check for new==old) and allows very easy use of array access to get the time and pose members ('sequence_[seqIndex_].time' and 'sequence_[seqIndex_].pose').
    void BioloidController::playSeq( const transition_t * addr )
        sequence = addr;
        // Number of poses in sequence
        transitions = sequence->time;
        loadPose( sequence->pose );
        interpolateSetup( sequence->time );
        playing = 1;
    Please pardon the pedantry... and the profanity... and the convoluted speech pattern...
    "You have failed me, Brain!"
    gives free advice only on public threads

  8. Re: Serial communication between Arduino and Arbotix

    Hi everyone, I've received a lot of components these weeks (including all sort of Arduino models) and I had to test them and try some things with them. Right now I'm finishing the new energy source system so I'll need a bit more time to try the serial communication alternatives. I also work as a blogger and product reviewer, so these last days with the MWC were some crazy days and I also have to train for my unicycle fundraising events... So just to let you know that I'm working on it, just not enought time for everything

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Arbotix - Update Hardware Serial to capabilities of Arduino 1.0.5 capabilities.
    By KurtEck in forum Arbotix, Microcontrollers, Arduino
    Replies: 4
    Last Post: 04-09-2014, 11:31 AM
  2. Question(s) Arbotix and Arduino Software Serial Library
    By Jules in forum Arbotix, Microcontrollers, Arduino
    Replies: 4
    Last Post: 06-21-2012, 10:19 AM
  3. Question(s) RAW Serial Communication
    By ilo_oli in forum Software and Programming
    Replies: 5
    Last Post: 11-01-2011, 05:38 PM
  4. C++ Serial Communication
    By Resilient in forum Software and Programming
    Replies: 14
    Last Post: 02-03-2009, 03:23 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts