Category Archives: Raspberry Pi

Serial connection from your PC to Raspberry Pi

I needed an example device for tests of an implementation of a serial connection terminal. A Raspberry Pi is especially suited: It dumps a lot of kernel data upon boot and it listens for input as soon as the login prompt appears (after about one minute).

Required:

Wiring is simple: Just connect the FTDI cable as shown in the sketch below:

raspberry_pi_ttl232_serial_connection_ftdi_bb

 

  1. FTDI GND -> RaspPi GND
  2. FTDI TXD -> RaspPi RXD
  3. FTDI RXD -> RaspPi TXD
  • Fire up PuTTY and setup as in the following screenshot (speed/baud rate = 115200)

putty_serial

  • Press "Open" and you should receive the kernel boot messages followed by a login prompt.

 

 

Connecting an Arduino with the Raspberry Pi via I2C

Today, I tried connecting my Raspberry Pi to an Arduino via I2C bus following roughly the guide from Oscar Liang.

According to the GPIO pinout, we have to connect pins 3 and 5 of Pi's GPIO port to Arduino's A4 and A5 pins.

First, the revision of the Raspberry Pi is important to determine which I2C port to use. Output of /proc/cpuinfo is

$ cat /proc/cpuinfo
Processor       : ARMv6-compatible processor rev 7 (v6l)
BogoMIPS        : 697.95
Features        : swp half thumb fastmult vfp edsp java tls
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xb76
CPU revision    : 7

Hardware        : BCM2708
Revision        : 0002
Serial          : xxx

That means, that according to this list ...

'0002' => 'Model B Revision 1.0',
'0003' => 'Model B Revision 1.0 + Fuses mod and D14 removed',
'0004' => 'Model B Revision 2.0 256MB', (Sony)
'0005' => 'Model B Revision 2.0 256MB', (Qisda)
'0006' => 'Model B Revision 2.0 256MB', (Egoman)
'0007' => 'Model A Revision 2.0 256MB', (Egoman)
'0008' => 'Model A Revision 2.0 256MB', (Sony)
'0009' => 'Model A Revision 2.0 256MB', (Qisda)
'000d' => 'Model B Revision 2.0 512MB', (Egoman)
'000e' => 'Model B Revision 2.0 512MB', (Sony)
'000f' => 'Model B Revision 2.0 512MB', (Qisda)

...I have a Model B Revision 1.0 and therefore according to this overview I have to use -y 0 in the i2c commands following.

After installing the i2c-tools

$ sudo apt-get install i2c-tools

we can try to find the I2C device Arduino:

$ /usr/sbin/i2cdetect -y 0
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- 04 -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

Now write a 1 to Arduino with:

/usr/sbin/i2cset -y 0x00 0x04 1

On the Arduino I installed a Wire program from Arduino's examples.