Shop OBEX P1 Docs P2 Docs Learn Events
Arduino to Propeller communication. — Parallax Forums

Arduino to Propeller communication.

Paul K.Paul K. Posts: 150
edited 2012-05-07 03:04 in Propeller 1
I have a little project where I want the UNO board to send commands to a Prop shield. The Prop shield will actually be my main board/controller for my robot.
I only what the UNO to send commands to the Prop(some kind of string of data). Basically I can write a simple C program and the Prop does all the work.

I'm thinking SPI object or some other serial object is the way to get these to to talk.
I really haven't seen anything like this before.

I think this is the way to go?
If anyone knows of some projects that are similar if you could point me that way.

Comments

  • GordonMcCombGordonMcComb Posts: 3,366
    edited 2012-05-05 18:56
    Simple asynchronous serial is a lot easier. Assuming one-way communication, you need just one wire (in addition to common ground). You can also use any Arduino I/O pin, whereas for hardware SPI you're locked into using specific pins. Be sure to add a 1K resistor between the Arduino and Propeller.

    The included SoftwareSerial object is good for this. Assuming Arduino 1.0, you can transmit at up to 115,200 bps, which is plenty fast. The Prop will keep up.

    With that out of the way, you need to figure out how you're going to send commands. I like to follow what's become somewhat of a standard for Prop-based co-processing tasks, and use the ! character to start a new message, followed by a character that defines the type of message, and then finally the byte(s) of the message. The length and content of the message is up to you, and depends entirely on the complexity of the data you need to transfer. From the Arduino side it's just a simple:

    mySerial.print("!MA");

    or whatever.

    On the Prop end you look for a sequence starting with !.

    Beau's firmware for the Propeller serial servo product is a very nicely done example of parsing serial comm. His example shows two concurrent serial objects, but the bulk of the program is pretty easy to follow. You can pick out the pieces you need.

    I have an article in SERVO that discusses exactly this topic, but it won't be out for another two or three weeks (and no, I can't share it before they publish it). But if you provide some more detail of your project I'm sure I and others could provide more specific coding examples.

    -- Gordon
  • Martin_HMartin_H Posts: 4,051
    edited 2012-05-05 18:59
    You have a lot of options. I would think asynchronous serial to pins zero and one would be the easiest. But the Arduino is also able to be an I2C slave. I think SPI would be harder than either of those, but should be possible as well.

    One reason I like asynchronous serial is that you can use the IDE monitor window to send commands. So you can debug the Propeller and Arduino programs separately.
  • Paul K.Paul K. Posts: 150
    edited 2012-05-06 17:18
    Asynchronous sounds just like what I need. Simple one way communication is all I need at the moment.

    It actually would be data in from XBee to Uno then passed along to the Prop.

    Gordon I'm looking forward to reading your article when I get my Servo Magazine in the mail.

    And I will use the ! method for sending data.

    In the meantime I'm going to try to get some code written.
  • Mark_TMark_T Posts: 1,981
    edited 2012-05-07 03:04
    Simple asynchronous serial is a lot easier. Assuming one-way communication, you need just one wire (in addition to common ground). You can also use any Arduino I/O pin, whereas for hardware SPI you're locked into using specific pins. Be sure to add a 1K resistor between the Arduino and Propeller.

    The maximum current draw through a Prop protection diode is 0.5mA so 1k is too small, use 3k3 or larger if talking to 5V logic. That or a resistive divider.
Sign In or Register to comment.