GPIO RF module


16 posts
by wez023 » Fri Nov 23, 2012 11:24 am
Hi guys,

First post so please be gentle. I'm working on trying to get an RF module to communicate with the Pi over GPIO using C.

My coding isn't exceptional and so I'm struggling a little bit. I'm trying to use the WiringPi library from https://projects.drogon.net/raspberry-pi/wiringpi/ .

So I my questions is: How do I set-up the GPIO for an incoming transmission and store it in a text file?

Can anyone help me please.

Let me know what info you need as I don't have a clue what to give you.

Thanks

Wes
Posts: 8
Joined: Fri Nov 23, 2012 11:18 am
by jamesh » Fri Nov 23, 2012 11:38 am
What is the RF module you are using ?
Volunteer at the Raspberry Pi Foundation, helper at Picademy September, October, November 2014.
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 12382
Joined: Sat Jul 30, 2011 7:41 pm
by wez023 » Mon Nov 26, 2012 1:09 pm
Its a MKconsultants MKR7B

it can be found here http://www.mkconsultants.eu/products/545-mkr7.aspx

Thanks
Posts: 8
Joined: Fri Nov 23, 2012 11:18 am
by wez023 » Thu Nov 29, 2012 12:32 pm
Hi,

Not getting any responses so I thought I would update the thread to include a bit more info as i'm desperate for help.

I have the RF module hooked up to the GPIO using breadboard. What I need to do is detect, accept and store an incoming data stream into the GPIO on the Pi from the RF module. I have tried several example programs that help to detect a change of state but as of yet I have not managed to actually read in, let alone store, any actual data from the GPIO. These programs also just seem to detect an interrupt occurring on the specified pin.

Im using the wiringPi.h library and coding in C.

Does anyone have any suggestions at all please?

Thanks

Wez
Posts: 8
Joined: Fri Nov 23, 2012 11:18 am
by gordon@drogon.net » Thu Nov 29, 2012 8:28 pm
wez023 wrote:Hi,

Not getting any responses so I thought I would update the thread to include a bit more info as i'm desperate for help.

I have the RF module hooked up to the GPIO using breadboard. What I need to do is detect, accept and store an incoming data stream into the GPIO on the Pi from the RF module. I have tried several example programs that help to detect a change of state but as of yet I have not managed to actually read in, let alone store, any actual data from the GPIO. These programs also just seem to detect an interrupt occurring on the specified pin.

Im using the wiringPi.h library and coding in C.

Does anyone have any suggestions at all please?

Thanks

Wez


These modules are essentially "dumb" logic level transmitters - so put a logic 1 on the sender and you'll get a 1 at the reciever. So if you connect the sender to an rs232 type device, and the reciever at the rs232 type reciever, then you'll have wireless rs232. (up to the maximum speed supported, but 9600 baus is usually fine with these devices)

The first issue is that these are 5v devices and the Pi is a 3.3v device. A voltage divider on the pin into the Pi will work OK though.

So tell us a bit more about the setup - how are you connecting it into the Pi? Serial port? (If so, you don't really need wiringPi, but there is a handy serial library included in it).

-Gordon
--
Gordons projects: https://projects.drogon.net/
User avatar
Posts: 1544
Joined: Tue Feb 07, 2012 2:14 pm
Location: Devon, UK
by wez023 » Fri Nov 30, 2012 9:07 am
Thanks for your relply Gordon.

I am connecting the RF module directly to the GPIO pins. I am actually trying to data farm from an existing RF network for care home alarms. The idea is to have the receiver module hooked up to the Pi to bring in the same data that the existing network already uses. The Pi is to farm to provide a database and on-line connectivity for the data.

The reason I want to use the IO pins is so that all in all a small module that consists of the Pi with RF module can just sit in the background unnoticed.

Thanks once again,

Regards

Wez
Posts: 8
Joined: Fri Nov 23, 2012 11:18 am
by gordon@drogon.net » Fri Nov 30, 2012 9:41 am
wez023 wrote:Thanks for your relply Gordon.

I am connecting the RF module directly to the GPIO pins. I am actually trying to data farm from an existing RF network for care home alarms. The idea is to have the receiver module hooked up to the Pi to bring in the same data that the existing network already uses. The Pi is to farm to provide a database and on-line connectivity for the data.

The reason I want to use the IO pins is so that all in all a small module that consists of the Pi with RF module can just sit in the background unnoticed.

Thanks once again,

Regards

Wez


I didn't think these were "tuned" in any sensible way - not sure how you'll tell which one is sending data...

However the first issue is level conversion - these are 5v devices, so make sure you're not connecting that directly into the Pi - you'll fry the Pi. After that, then you'll need to decode the data the existing transmitters are sending - assuming the unit is capable of recieving them in the first place..

-Grodon
--
Gordons projects: https://projects.drogon.net/
User avatar
Posts: 1544
Joined: Tue Feb 07, 2012 2:14 pm
Location: Devon, UK
by wez023 » Fri Nov 30, 2012 10:00 am
The transmitter is an mk-consultants MKT7B which is tuned to 434.075 Mhz, the receiver module is the MKR7 which is also tuned to 434.075Mhz. these are already in use on the existing receiver/transmitter modules that are in use. so essentially all i'm doing is adding another receiver module into the network as a secondary to the existing receiver already in use.

So the modules sending are ONLY transmitters and the receivers are ONLY receivers.

Is there any other information that I can supply?

Thanks again

Wez
Posts: 8
Joined: Fri Nov 23, 2012 11:18 am
by wez023 » Mon Dec 03, 2012 12:02 pm
Ok so i grabbed the gpio-int-test program and that detects an interrupt. Now my coding isnt great, im assuming i should read the level of the gpio pin (high/low,0/1) multiple times to decide the binary of the transmission and store it. Is this correct?

I cant seem to find anything like this on the internet.

Cheers

Wez
Posts: 8
Joined: Fri Nov 23, 2012 11:18 am
by phack » Wed Dec 05, 2012 6:37 am
Hi,

It looks like you've got the basics covered (e.g. power is good, correct xcvr is being used). Without going into much detail, your best bet will be to break down the problem into smaller problems. It sounds like you put it together and hoped it would just work. Sometimes things work out that way, but, if it doesn't, a better approach is to create a plan that gets you toward the final solution, in a step-by-step kind of way.

For example, I would power up and test each system individually. For the GPIO on the Pi, I would hook up a toggle switch + power supply on the IO pins I am interested in, and I would manually toggle the switch to see if I get anything showing up in the software (e.g. is the discrete input of the hw interupt being recognized). If not, troubleshoot the software, wiring, voltage levels, etc.

On the side of the receiver, I would power it up and measure the output pins (including VSSI, pin 3) using a logic analyzer or a voltmeter to get an idea of whether the output is changing or if an input signal is being received or not. If not, then troubleshoot, narrow down the problem, etc.

Once you're confident each individual system is working, then you can start integrating the two systems together. There are just too many variables that could be causing the issue you're describing. Narrowing down the issue area will make it easier for others to help you. Good luck.
Posts: 2
Joined: Wed Dec 05, 2012 2:53 am
by wez023 » Mon Feb 18, 2013 10:34 am
Hi,

Thanks for the help guys but i'm still not getting anywhere.

My Question:

Is there a program available written in C that has the functionality to receive a stream of data and store it?

Detecting valid data is not a problem just yet, i just want to be able to store whatever data is coming in(as its an RF receiver there is always data coming in from interference etc).

Once this data is stored i can then check it for validity. I will also set the timing for the signal after i have actually achieved successful input. the timing and preamble etc will verify when to actually start storing data later on after i am happy that the program actually has the functionality to detect and store any received data.

I just cant seem to get the program i currently have that detects an interrupt to successfully store all of the data that is received. i can only get it to store a single bit which is obviously no good.

Thanks again
Posts: 8
Joined: Fri Nov 23, 2012 11:18 am
by joan » Mon Feb 18, 2013 11:17 am
Any reason you don't use the serial link as the input pin? Decoding this sort of pulse train is what they are designed for.

See viewtopic.php?p=252739#p252739
User avatar
Posts: 6579
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK
by wez023 » Mon Feb 18, 2013 11:20 am
by serial do you mean UART?

if so, i had not, any advice?
Posts: 8
Joined: Fri Nov 23, 2012 11:18 am
by joan » Mon Feb 18, 2013 11:32 am
wez023 wrote:by serial do you mean UART?

if so, i had not, any advice?

Actually I've given you bad advice. What I'm suggesting only works if the transmitter is also acting like a serial link, which your transmitter will not.

Sorry. :oops:
User avatar
Posts: 6579
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK
by stevech » Wed Feb 20, 2013 5:58 am
That type of Receiver is far too crude for a beginner to use.
You need to start with one that has a MAC layer in the radio.
Otherwise, you begin with nothing, nada, zilch and you have to learn everything at the lowest level, in RF communications.

Better choices include XBee transceiver with all functionality out of the box or, less so, the HopeRF RFM12 with libraries that exist. Either is 1000-fold more sophisticated than the bare bones receiver you're struggling with. These types are used when recurring cost for a volume production run is paramount.
.
Posts: 100
Joined: Sun Jul 15, 2012 11:53 pm
by joan » Wed Feb 20, 2013 9:01 am
wez023 wrote:by serial do you mean UART?

if so, i had not, any advice?

Reading the thread from the beginning suggests that you have control of both ends of the link, i.e. transmitter and receiver. In that case to communicate between 2 Pi's you should be able to use the code I pointed to in the earlier link.
User avatar
Posts: 6579
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK