chuayq
Posts: 1
Joined: Fri Oct 02, 2015 7:27 am

Reading from Raspberry Pi port

Fri Oct 02, 2015 7:39 am

The Raspberry Pi is hooked up to a RF69 board through the GPIO. Using the OEM (the hardware that I bought) software, I am able to get the current reading. However, I do not want to use the OEM software as it is in their database. I am hoping to read and insert the reading into my own database.

I have written a python script to get the data but I am getting weird symbols instead. I have posted my script below

#!/usr/bin/env python
import time
import serial
ser = serial.Serial(
port = '/dev/ttyAMA0',
baudrate = 9600,
parity=serial.PARITY_NONE,
stopbits=serial.STOPBITS_ONE,
bytesize=serial.EIGHTBITS,
timeout=3,
)
ser.open()
response = ser.readlines()
ser.close()
print response


Some of the data I received
['!!!!!\x86\84a\x04\xff']
['!!!!!\x84\84a\x04\xff']
['!!!\xa1!!%!5\xd5']


Note: I am not good at Python, just picked it up two weeks ago.

-rst-
Posts: 1316
Joined: Thu Nov 01, 2012 12:12 pm
Location: Dublin, Ireland

Re: Reading from Raspberry Pi port

Mon Nov 16, 2015 12:16 pm

Assuming you are talking about this http://www.orcam.eu/res/Datablad/rf69v12.pdf

Looks like it has a fairly specific serial communication protocol so your results would seem as expected - the output is not meant to be human readable - you would need to find a way to read and interpret the various parts of the message.

The thing also seems to have an SPI interface which might be easier than the raw serial - some other projects (f.eg. https://github.com/jcw/jeelib/blob/master/RF69.cpp) appear to use this.
http://raspberrycompote.blogspot.com/ - Low-level graphics and 'Coding Gold Dust'

Return to “Python”