
You don't technically need to raise the Pi TX to 5V (for the Arduino) but I thought it better practice to do so, and it prevents damage through wiring to the wrong Arduino pin (i.e. if you wanted to use Software Serial, but accidentally set pin high).
Remember to do the following...
Hash out the following line in /etc/inittab:
#TO:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100
Edit out the following entries in the line in /boot/cmdline.txt:
console=ttyAMA0,115200 kgdboc=ttyAMA0,115200
And tie the ground of the Arduino to the ground of the Pi, otherwise it won't work!
To test, I'd reccomend uploading a sketch (see below) to the Arduino which reads a byte and returns something to the Pi then using 'Minicom -b 9600 -o -D /dev/AMA0' any keypress will return something. You'll likely have to install minicom (sudo apt-get minicom).
Code: Select all
byte num = 0;
void setup ()
{
Serial.begin (9600);
}
void loop ()
{
if ( Serial.available () )
{
num = Serial.read ();
Serial.print ( "I recieved : " );
Serial.println ( num, DEC );
}
}