There are many useful devices that can communicate via UART. One useful example would be an Arduino. Here, I'll show you how to connect UART device to a Raspberry Pi 2 and communicate with it using a serial program. In this case, I'll be using a Moteino, which is an awesome pseudo-Arduino device that has the added awesomeness of wireless RF capability. These things are extremely useful for home automation projects.
Mar 25, 2014 - Connect to the Raspberry PI RS-232 serial port using a Linux PC. Use the RPI command line through the serial port using minicom.
I'm in the process of developing a home security system, and I plan to have many wireless accelerometers attached to all of my windows and doors to monitor for break-ins. Each sensor node will consist of an accelerometer connected to a Moteino over I2C, and each node Moteino will send its data to a gateway Moteino device that will be connected via UART to the Raspberry Pi.
I can then use the Raspberry Pi to operate based on that accelerometer data (turn on Pi Camera, send text messages, alert the police, whatever).Below is an image of the GPIO on the Raspberry Pi 2.
Pi@raspberrypi $ dmesg grep tty 0.001609 console tty1 enabled 0.092061 3f201000.uart: ttyAMA0 at MMIO 0x3f201000 (irq = 87, basebaud = 0) is a PL011 rev2 0.594855 console ttyAMA0 enabledThe last line above shows that the console is enabled for the serial port.ttyS0 = Serial for Raspberry Pi 3ttyAMA0 = Serial for all other Raspberry PiOn new versions of Raspbian, 'serial0' is assigned as an alias to either of the above devices. This makes the device a lot easier to remember. Pi@raspberrypi $ sudo apt-get install screenpi@raspberrypi $ screen /dev/serial0 9600Below is two examples of what you would see.The first image is when you GPS has been up and running for awhile and has a. If your GPS has a fix, you would also see the green fix LED flash.The second image is when your GPS is trying to obtain a fix. As you can see, most of the NMEA data is empty. On first power up, it can take your GPS module awhile to get a fix.
It could be longer than 10 minutes in some situations, it all depends on interference and if your GPS has clear access to the sky.A summary of the default NMEA sentences that BerryGPS will output; $GPVTGVector track and Speed over the Ground$GPGGAGGA - essential fix data which provide 3D location and accuracy data.$GPGLLGLL - Geographic Latitude and Longitude$GPGSAGSA - details on the nature of the fix. It includes the numbers of the satellites$GPGSVDetailed satelite data$GPRMCRMC - The recommended minimumhas some great information on how to read NMEA sentences.Viewing Meaningful GPS DataThere are number of freely available tools which we can used to view meaningful information from BerryGPS, like longitude, latitude and ground speed.First, we will install GPSD. Gpsd is a daemon that receives data from a GPS receiver, and provides the data back to multiple applications such gpsmon and cgps.Install, gpsd, gpsmon and cgps.