Newer
Older
PiPins / uart.txt
root on 18 Mar 2020 1 KB uart update
	 1](2
	 3)(4
	 5)(6
	 7)(8	TX
	 9)(10	RX
	11)(12
	13)(14
	15)(16
	17)(18
	19)(20
	21)(22
	23)(24
	25)(26
	27)(28
	29)(30
	31)(32
	33)(34
	35)(36
	37)(38
	39)(40

UART pins in BCM mode are: 14, 15
UART pins in WiringPi are: 15, 16

REMEMBER TO CONNECT COMMON GROUND

UART is an asynchronous serial communication protocol, meaning that it takes bytes of data and transmits the individual bits in a sequential fashion.

Asynchronous transmission allows data to be transmitted without the sender having to send a clock signal to the receiver. Instead, the sender and receiver agree on timing parameters in advance and special bits called 'start bits' are added to each word and used to synchronize the sending and receiving units.

UART is commonly used on the Pi as a convenient way to control it over the GPIO, or access the kernel boot messages from the serial console (enabled by default).

It can also be used as a way to interface an Arduino, bootloaded ATmega, ESP8266, etc with your Pi. Be careful with logic-levels between the devices though, for example the Pi is 3.3v and the Arduino is 5v. Connect the two and you might conjure up some magic blue smoke.

Assuming you have WiringPi-Python installed, the following python example opens the Pi's UART at 9600baud and puts 'hello world'

import wiringpi
wiringpi.wiringPiSetup()
serial = wiringpi.serialOpen('/dev/ttyAMA0',9600)
wiringpi.serialPuts(serial,'hello world!')

- tutorial - 
1) find baudrate (baudrate.py - https://github.com/devttys0/baudrate/blob/master/baudrate.py)
2) screen [device] [baud]
	e.g. $> screen /dev/ttyAMA0 9600
	exit with CTRL+a then CTRL+k