Serial communication from pins in Raspberry Pi

#1

Guys in Arduino you could specify your pins

for example do :

SoftwareSerial mySerial(3, 2);

and specify pin 3 and 2 for RX TX

how do you do this in OF?

I am trying to use an A6 GSM board

and translate this :

for Open Frameworks
but I can’t figure out the connecting part…

#2

I’ve included this bad boy + ofxIO + ofxPoco…

it compiles after a while or so…

but

for (auto& device: ofxIO::SerialDeviceUtils::listDevices())
{
ofLogNotice(“ofApp::setup”) << “\t” << device;
}

doesn’t list anything…

#3

ofxIO::SerialDeviceUtils::listDevices() will only list known serial devices in the /dev/* directory (e.g. /dev/ttyUSB0, etc). To connect to the RX/TX pins, I believe you can connect to the /dev/ttyAMA0 device.

#4

Here is more on the RX/TX pins and how they interact with the /dev/ serial system.

2 Likes
#5

Nice find Chriss thank you
I have a rasbPi2 laying around maybe I ll give it a go to see what happens… then dive into that post…

fyi I tried this:


#6

ok I’ve enabled the Serial thingie and used /dev/serial0/ in the code

now it appears to be “connecting” to serial0

also ofSerial lists ttyS0, and ttyS0

…I tried to write an “AT” but not sure if everything went through the right pipe.

#7

i’ve connected with ssh for sexier screenshoots

#8

I tried with ofxSerial based on the settings in your link (databit 8 parity 0 and stopbit 1

I also edited these:

Is there a smart way to test if I am on the right track? I think I connected everything correctly… it should work…

#9

listing /dev/
13%20PM

#10

hm…

I found this nice tut

#11

is this legit???

#12

weird it doesnt let me type anything…

these modules never work…

#13

for future users

I tested it with Arduino, I had the same issues till I reversed the TX RX cables,

it must be TX to RX … it’s very easy to connect TX to TX… and I did just that…

to communicate with Serial from Arduino to OpenFrameworks I must use ofArduino and standard firmata?

what if I just want to only read the serial messages that Arduino sends , like the serial monitor of Arduino does??

is that possible with ofSerial or should I use something else?

[edit I’ve figured it out] ofSerial it’s ok

1 Like