3

I am trying to get a raspberry pi to issue commands(move forward, backward, turn left, turn right) to an arduino-based 4-wheeled rover.

According to this:

How to attach an Arduino?

if I use GNU Screen I can send commands over a USB port.

So basically I will have a process running on the raspberry pi that determines which direction the rover needs to drive in. This process will somehow "send" commands over the serial USB connection using "GNU Screen" as mentioned in the link above. However, once the arduino receives the command(s), does it automatically start executing them? Or is there an additional step?

Also, do I need to be concerned about the amount of power being drawn from the raspberry pi by the arduino? If so, how do I handle this? Would a USB hub suffice?

Would appreciate ALL/ANY advice or links to tutorials about how to get a raspberry pi and a arudino-based rover talking to each other.

user1068636
  • 441
  • 2
  • 6
  • 15

2 Answers2

2

GNU screen may give you an interactive terminal to a usb serial device such as an Arduino, but for use in a program you want to use the serial APIs for C, python, or whatever you are writing in. There is very little distinction between the pi and other Linux (or even unix) systems in this regard, except that some runtime framework too heavy to have a practical pi port wouldn't really be an option.

What the Arduino does in response to commands on the serial channel would depend entirely on the sketch which you create and load into it; out of the box it will do absolutely nothing.

An Arduino by itself probably does not exceed the pi's USB peripheral current limits, however an Arduino with accessory shields might. Powering the Arduino from a hub is one option, but some Arduinos/Arduino-like boards will allow you to use an external power supply for the board, even when USB is connected.

Chris Stratton
  • 993
  • 5
  • 11
  • Hi Chris - do you think this site is a good start: http://mitchtech.net/raspberry-pi-arduino-spi/ ? – user1068636 Oct 17 '12 at 21:44
  • From the sound of it, only if you want to use SPI instead of USB. One reason for doing that would be that you could have the Arduino connected via USB to your development system while debugging SPI communication between the Arduino and the pi. – Chris Stratton Oct 17 '12 at 22:08
0
  1. Prepare arduino to listen to serial commands, standard Arduino IDE would accept character that you can map to functions to move it to different directions.

  2. Write a python program that sends serial commands via usb port. Save this and run it on your Raspberry.

  3. Build interfaces such as Web page with Javascript and NodeJS to add buttons so you can control it remotely.

    Refer to full tutorial on how to program and control your rover via wifi and web browser at http://www.linuxcircle.com