help about WIFI raspberry
Moderators: adafruit_support_bill, adafruit

help about WIFI raspberry

by ddcedric on Mon Mar 18, 2013 5:17 pm

Hi, I need your help, so I'll explain my problem :arrow:
I have 2 raspberry PI, one is used as a GPS (EM-406A) and the other raspberry is set as a server

So I would like to send the frame NMEA of GPS by WI-FI in raspberry server
But I do not know how

thank you :)
ddcedric
 
Posts: 8
Joined: Mon Jan 28, 2013 3:09 pm

Re: help about WIFI raspberry

by adafruit_support_mike on Tue Mar 19, 2013 6:39 pm

The easiest way to do it would be through TCP/IP services.

With enough experience you can write your own server program, assign it to a port on the second RasPi, and configure the 'inetd' daemon to launch you program every time a request for that port comes in. That does take a fair amount of background knowledge though.

An easier way to do the same general thing is to run a webserver on the second RasPi and have the first one (with the GPS) make HTTP requests using the 'httplib' module (renamed to 'http.client' in Python 3). The general subject you want is "CGI scripting under Apache", and it's pretty simple once you know the basic tools.

'CGI' stands for 'Common Gateway Interface', and describes how the webserver passes information to the script that will process it. There's a set of standard variables the script can read, like REQUEST_URI and QUERY_STRING. Wikipedia has a decent description of it: http://en.wikipedia.org/wiki/Common_Gateway_Interface

'Apache' is the webserver on almost all Linux machines, and definitely the one you'll use on a RasPi. There's a good set of instructions on getting it running here: http://elinux.org/RPi_Apache2 .
When you void a product warranty, you give up your right to sue the manufacturer if something goes wrong and accept full responsibility for whatever happens next. And then you truly own the product.
User avatar
adafruit_support_mike
 
Posts: 10233
Joined: Thu Feb 11, 2010 2:51 pm

Re: help about WIFI raspberry

by ddcedric on Wed Mar 20, 2013 5:36 pm

I understand, but I'm not very good programmer, I find this:
http://www.stripydog.com/kplex/
I think I could use it, but I do not see how
ddcedric
 
Posts: 8
Joined: Mon Jan 28, 2013 3:09 pm

Re: help about WIFI raspberry

by adafruit_support_mike on Wed Mar 20, 2013 9:01 pm

ddcedric wrote:I understand, but I'm not very good programmer, I find this:
http://www.stripydog.com/kplex/
I think I could use it, but I do not see how

You'd probably have a harder time learning to use that than you would learning to do some simple CGI programming. I'm not sure it's really appropriate to what you're trying to do, either. It seems to be a tool that collects data from any number of different sources on a single computer, but doesn't do much about getting information from one computer to another.

I don't think there's any simple 'here, use this' solution for what you're trying to do, so some amount of programming will probably be necessary. Almost any programming language you choose will have a library to handle web requests, so all you need to do on the 'sender' side is plug the correct values into a 'request this page with this data' function. On the 'listener' side, you'll just need something that reads the data and sends it wherever you want it to go.
When you void a product warranty, you give up your right to sue the manufacturer if something goes wrong and accept full responsibility for whatever happens next. And then you truly own the product.
User avatar
adafruit_support_mike
 
Posts: 10233
Joined: Thu Feb 11, 2010 2:51 pm

Re: help about WIFI raspberry

by ddcedric on Thu Mar 21, 2013 3:44 pm

could you help me, I do not know how to do this :?:

But I recall that there are two raspberry, 1 is the server, and another is to connect the gps
ddcedric
 
Posts: 8
Joined: Mon Jan 28, 2013 3:09 pm

Re: help about WIFI raspberry

by Static on Thu Mar 21, 2013 6:21 pm

This is kind of a stretch. You're asking the community to write your code for you.
It's one thing to ask for pointers or to show your work and explain the problem you're having. It's another to say "Here's my idea, write the code for it".

I'm working on a similar project using Raspberry Pi's and I2C sensor devices (different than interfacing with a GPS). So far, it's a couple of hundred lines of code, dozens of hours, and many set-backs. I've learned a tremendous amount, and I pretty much started from scratch (I did a little work with Arduino's before this).

Eventually I'd like to build a GPS in to my project, but I don't have the GPS components. I wouldn't be able to help you that much.

I will tell you this: Python is an incredibly easy programming language to pick up and learn. It's free. There are an insane number of already built libraries. There is a ton of free information about it and some of the textbooks are definitely worth the money.
Static
 
Posts: 180
Joined: Thu Dec 23, 2010 6:21 pm

Re: help about WIFI raspberry

by ddcedric on Fri Mar 22, 2013 5:40 pm

I know slightly coded in python, I asked the 'main steps' of my code.
ddcedric
 
Posts: 8
Joined: Mon Jan 28, 2013 3:09 pm

Re: help about WIFI raspberry

by ddcedric on Fri Mar 22, 2013 5:40 pm

I know slightly coded in python, I asked the 'main steps' of my code.
ddcedric
 
Posts: 8
Joined: Mon Jan 28, 2013 3:09 pm

Re: help about WIFI raspberry

by adafruit_support_mike on Sat Mar 23, 2013 1:04 am

The main steps would be..

On the receiver side:

- Get a copy of the Apache webserver running on the machine you want to receive the data
- Create a script that knows how to read data from a POST request (the same thing web forms use)
- Save that script where the webserver can see it, and will execute that script when clients POST to the script's URL


On the sender side:

- Get the GPS output
- Open a POST connection to the receiver, with the URL for the script
- Send the GPS output as data for the POST request
When you void a product warranty, you give up your right to sue the manufacturer if something goes wrong and accept full responsibility for whatever happens next. And then you truly own the product.
User avatar
adafruit_support_mike
 
Posts: 10233
Joined: Thu Feb 11, 2010 2:51 pm

Re: help about WIFI raspberry

by ddcedric on Sat Mar 23, 2013 7:54 am

thx very much :)
ddcedric
 
Posts: 8
Joined: Mon Jan 28, 2013 3:09 pm

Re: help about WIFI raspberry

by laika on Sun May 12, 2013 7:51 pm

adafruit_support_mike wrote:
ddcedric wrote:I understand, but I'm not very good programmer, I find this:
http://www.stripydog.com/kplex/
I think I could use it, but I do not see how

You'd probably have a harder time learning to use that than you would learning to do some simple CGI programming. I'm not sure it's really appropriate to what you're trying to do, either. It seems to be a tool that collects data from any number of different sources on a single computer, but doesn't do much about getting information from one computer to another.


On the contrary. It's exactly what the OP wants. Run two copies: one on each machine. On the pi the GPS is connected to (let's call this machine "gpshost") you ask kplex to read from the GPS (let's assume it's like my adafruit ultimate gps running at 9600 baud attached to /dev/AMA0) and create a tcp server (will default to listening on port 10110 on all interfaces).Config looks like this:
Code: Select all | TOGGLE FULL SIZE
[serial]
filename=/dev/ttyAMA0
direction=in
baud=9600
[tcp]
mode=server
direction=out


On the other machine tell it to connect to the tcp server running on "gpshost" (you can use an ipv4 or ipv6 address if there's no dns or hosts entry for the machine with the gps). You could configure it with a config file and make the output available over a pty or another tcp server, or you could run it from the command line and pipe the output into another program. Or both. Say we want to feed the nmea sentences into a program called "myprog" we could run:
kplex tcp:address=gpshost file:direction=out | myprog

Yes there's a lot of stuff in the instructions to wade through but it saves doing the network programming yourself
laika
 
Posts: 1
Joined: Sun May 12, 2013 7:27 pm



cron