Balloon Collaboration
January 19, 2018, 06:56:40 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: barntek.com is now part of the BarnTek information network...Currently redirected to barntek.net
 
  Home Help Search gallery Calendar Login Register  
  Show Posts
Pages: [1] 2 3 ... 12
1  Projects / 2015 Balloon... Lessons Learned / Re: Tracking Program on: June 20, 2015, 03:52:38 AM
ok, that google api thingy made absolutely no sense to me...  but I did find this...  a tutorial to do exactly what I amwanting to do. So, I have already shifted gears...  hehe Grin

Tutorial site
2  Projects / 2015 Balloon... Lessons Learned / Tracking Program on: June 20, 2015, 03:26:29 AM
Based on this year's experience, I think we all know that we need more than one computer tracking the balloon.  I tried to setup something similar to what Danny runs, but the software is old and some is obsolete. 

I started thinking about the Internet version that Danny wrote, and the fact that I figured out how to decipher the KISS TNC stuff, and I think I am going to try to write my own tracking program in Python.  I found there is a Google Maps API library for Python, so I am going to install it and start playing with it and see if I can come up with something.

Google Maps API Library for Python

I don't know if this is the Library I finally end up with or not, but this is where I am going to start.
3  Projects / 2015 Balloon... Lessons Learned / Re: Camera Package on: June 14, 2015, 05:55:00 PM
Ok, my laptop still had the last session up and availible from when I hooked to the Flight Package and started everything.  If I had been paying attention, I would have seen in a couple of places what was going on and could have fixed it prior to launch.  Danny bought me plenty of time to do this with his radio issues, but I didn't take advantage of it.  We (I) need to be more careful next time.

These clues both occurred prior to my disconnecting the laptop.  Had I paid attention to what was actually going on, I would have caught it, and corrected it before launch.

Quote
larry@Ezmarelda ~ $ ssh pi@192.168.1.35    Loggin into the Pi
pi@192.168.1.35's password:
Linux RPiGPS 3.18.14+ #792 PREEMPT Sat May 23 15:53:19 BST 2015 armv6l
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Thu Jun 11 18:55:35 2015 from ezmarelda.local
pi@RPiGPS ~ $ sudo mount /dev/sda1 /mnt/usb             Mounting the USB Memory Stick
pi@RPiGPS ~ $ cd /mnt/usb
pi@RPiGPS /mnt/usb $ ls
Data
pi@RPiGPS /mnt/usb $ cd Data
pi@RPiGPS /mnt/usb/Data $ ls
allgps.dat  Current.dat  GPGGA.dat  GPRMC.dat  Launch.dat  Pics  Vids
pi@RPiGPS /mnt/usb/Data $ sudo rm all*                       Removing all unnecessary files
pi@RPiGPS /mnt/usb/Data $ sudo rm GP*
pi@RPiGPS /mnt/usb/Data $ ls
Current.dat  Launch.dat  Pics  Vids
pi@RPiGPS /mnt/usb/Data $ sudo rm Launch*
pi@RPiGPS /mnt/usb/Data $ cd Pics
pi@RPiGPS /mnt/usb/Data/Pics $ ls
PreLaunch_182630.jpg  PreLaunch_211502.jpg  PreLaunch_212921.jpg  PreLaunch_214653.jpg  PreLaunch_221057.jpg
PreLaunch_182639.jpg  PreLaunch_211516.jpg  PreLaunch_214642.jpg  PreLaunch_214742.jpg
pi@RPiGPS /mnt/usb/Data/Pics $ sudo rm *
pi@RPiGPS /mnt/usb/Data/Pics $ cd ../vids
pi@RPiGPS /mnt/usb/Data/vids $ ls
Launch1_211516.h264  Launch1_214742.h264  Launch1_221057.h264  Launch2_182639.h264
pi@RPiGPS /mnt/usb/Data/vids $ sudo rm *
pi@RPiGPS /mnt/usb/Data/vids $ ls
pi@RPiGPS /mnt/usb/Data/vids $ cd                                               Entering the Mission Directory
pi@RPiGPS ~ $ cd Mission
pi@RPiGPS ~/Mission $ ls
altSim.py  gpsParse.py  gpsPoll.py  gpsRecord.py  gpsView.py  piCAM.py  start.py  test  test1.py
pi@RPiGPS ~/Mission $ sudo ./start.py &                                        Starting the main controlling program
[1] 2425                                                                                    It starts all the other programs
pi@RPiGPS ~/Mission $ gpsPoll.py 2427                                         gpsPoll.py starts - reports PID
gpsRecord.py 2428                                                                     gpsRecord.py starts - reports PID
gpsParse.py 2429                                                                       gpsParse.py starts - reports PID
altSim.py 2430                                                                           altSim.py starts - Ooops
piCAM.py 2431                                                                           piCAM starts - reports PID
gpsRecord.py running...
altSim.py running...   My first clue: This program was not supposed to run.
gpsPoll running...
gpsParse.py running...
Using hardware: PWM
PW increments:  10us
piCAM.py running...
Initializing channel 0...
add_channel_pulse: channel=0, gpio=23, start=0, width=220
init_gpio 23
clear_channel_gpio: channel=0, gpio=23
add_channel_pulse: channel=0, gpio=23, start=0, width=40
clear_channel_gpio: channel=0, gpio=23
add_channel_pulse: channel=0, gpio=23, start=0, width=120
Seq: 1 - Prelaunch
Current file Read and Parsed...
EXIF Tags prepped...
/mnt/usb/Data/Pics/PreLaunch_125503.jpg
76.0
Current file Read and Parsed...
EXIF Tags prepped...
/mnt/usb/Data/Pics/PreLaunch_125503.jpg
Interupt: Pin 22  Value 0
Current file Read and Parsed...
Launch
clear_channel_gpio: channel=0, gpio=23
add_channel_pulse: channel=0, gpio=23, start=0, width=220
clear_channel: channel=0
Looking DOWN
76.0
Seq: 2 - Launch Video
Traceback (most recent call last):         My second clue: This alarm was generated by altsim.py
 File "altSim.py", line 26, in <module>
    sock.sendto(data1,(UDP_IP,p))
socket.error: [Errno 101] Network is unreachable

Current file Read and Parsed...
76.0
Current file Read and Parsed...
76.0
Current file Read and Parsed...
76.0
Current file Read and Parsed...
76.0
4  Projects / 2015 Balloon... Lessons Learned / Camera Package on: June 14, 2015, 03:39:03 AM
Ok, for those who don't know, the camera package was a dismal failure.  I got 1 picture of Randy, 1 picture of the sky - looking up from the ground, 1 video looking at the ground from ground level, and 1 video looking at the ground from altitude.  I will post when I cipher out just where the balloon was for this last video.

The GPS data I planned on collecting was very odd.  GPS statements with a 1200 hr time stamp commingled with statements with a 1900 hr time stamp.  The pictures and videos all had the exact same time stamp.

What I finally found was that I "accidentally" ran my altitude simulator along with the GPS reading program.  That really confused things.  I have to make sure next time I eliminate this from possibly happening again.

I will post code and upgrades later as I work it all out.
5  Projects / 2015 Balloon Projects / Re: Servo Control on: June 03, 2015, 03:30:22 AM
Ok, disregard the last post...  I changed from RPi_GPIO to RPIO and the servo runs great.  The program is back on track.  The next major thing is to mount the hardware...  somehow...
6  Projects / 2015 Balloon Projects / Re: Servo Control on: May 30, 2015, 11:50:25 PM
Well, I hooked up the servo and found that I had to run 5% to 22% duty cycle to get a full 180 degree sweep of the servo.  I also found out that it is not very consistent doing it this way.  I would hate to turn it to the balloon to video the pop, and have it point somewhere else altogether.

I think, therefore, that I will just do a single camera, looking at the horizon to take cloud shots.  I will also look at Wal-Mart to see if I can find one of those $30 video cameras Danny was talking about.  We can dedicate it to looking at the balloon, watching for the pop.

I will continue to try to find a better way to drive the servo, but I am not expecting much.
7  Projects / 2015 Balloon Projects / Re: Tracking Page on: May 28, 2015, 01:04:30 AM
The page looks pretty good on my phone, as long as I leave it Profile.  If I turn it Landscape, the header takes up about half my screen.
8  Projects / 2015 Balloon Projects / Re: Tracking Page on: May 27, 2015, 09:18:43 PM
Yeah, I actually have a Pi set up in the shop, with a wifi dongle looking out the window talking back to the house. This pi also has a TNC connected to it and a radio and currently running a APRS tracking app.  

I set you up and account on the Pi if you want to FTP your software to it to see how well it works on a live system.  Let me know if you are going to and I will stop the program I am running.  It probably has the ttyAMA0 tied up.  You will need access to that if you want to read from the TNC.

The TNC is set up on device /dev/ttyAMA0 and is talking at 19200 baud 8N1.

You can just ftp to barnpi.hopto.org port 21 - username n4osb and password is the same as the Barntek site.
You can also ssh n4osb@barnpi.hopto.org - same password, if needed.

This Pi is currently serving up a video feed from the shop to this page:
http://barnpi.hopto.org/index1.html

I think the wifi link should be good enough for what you are wanting to do.

###  I also gave you sudo privileges on the Pi.  If you need anything else, let me know ###
9  Projects / 2015 Balloon Projects / Servo Control on: May 27, 2015, 02:35:43 AM
Well, I dug in and found an easy way to PWM from any pin on the Pi.  It uses GPIO commands, but I don't know if they are standard or part of the WiringPi library I installed. Anyway here is the test code I wrote.  I am currently driving an LED, but it is working great.  I foresee no reason for it to not work with a servo.  I will have to establish limits, or definite positions for up/out/and down positions.

Quote
#!/usr/bin/python

### General Info ####################################
### tstServo.py
### Servo Driver program for driving a single servo
### ...by Larry Barnes
### ...will make any pin drive a servo

import time

### Setup GPIO/PWM ##################################
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setup(18, GPIO.OUT)
pwm = GPIO.PWM(18, 100)
pwm.start(5)

### Main Program ####################################
try:
  while 1:
    for duty in range(0,100):
      pwm.ChangeDutyCycle(duty)
      time.sleep(.01)

    for duty in range(100,0,-1):
      pwm.ChangeDutyCycle(duty)
      time.sleep(.01)
except KeyboardInterrupt:
  print
  print "Exiting..."
  GPIO.output(18,False)
  GPIO.cleanup()
10  Projects / 2015 Balloon Projects / PiCAM Software on: May 26, 2015, 02:12:22 AM
Looks like I am rewriting the PiCam control software.  I think I am simplifying it and making it easier to modify in the future.  I stripped all the code dealing with cyphering the GPS Sentences.  My gpsParse.py program does that for.  All I have to do is read the Current.dat file to get the current stats from the GPS.  

Right now, this program only records Video or takes a picture, but I do have it stamping the pictures with EXIF tags developed from the GPS info.  

Next, I have to decide how call for pics or video, and also work in servo control.

I have it sequenced out now for the whole flight.  I have safe guards in place in case the GPS fails, it should still get pics and videos based on time.
I still need to add code to use a USB memory stick instead of the SD Card for storage.

Next will be writing an altitude simulator and testing the program out.


Ok, so I have tested the program with the Altitude Simulator, and it ran thru, finally, with no problems.  I still need to test the GPIO for the launch switch, then this program will be ready.

Quote
#!/usr/bin/python

### General Info ######################################################
###  piCAM.py
###  Control for PiCam to take pics and vids during balloon flight
###  ...by Larry Barnes

import time

### Setup GPIO/PWM ####################################################
import RPIO
from RPIO import PWM
servo=PWM.Servo()
RPIO.setup(24, RPIO.IN, pull_up_down=RPIO.PUD_DOWN)

### PiCamera Setup ####################################################
import picamera
camera=picamera.PiCamera()

### Variable Setup ####################################################
PATH='/mnt/usb/Data'
DOWN=2300
OUT=1400
UP=600
prevALT=0
flagLaunch=0
flagALT1=0
flagALT2=0
flagALT3=0
flagPOP=0
flagLand=0
crlf="%s%s" % (chr(13),chr(10))

### Functions #########################################################
def gpio_callback(gpio_id, value):
  global flagLaunch
  if gpio_id==24 and flagLaunch==0:
    getCurrent()
    print "Launch"
    flagLaunch=1
    servo.set_servo(23,DOWN)
    print "Looking DOWN"
    FNAM=PATH+"/Vids/Launch1.h264"
    camera.start_recording(FNAM, inline_headers=False)
    with open('/mnt/usb/Data/Launch.dat','w') as d:
      d.write(GPS_TIME+"\n")
      d.write(GPS_DATE+"\n")
      d.write(GPS_LAT+"\n")
      d.write(GPS_LON+"\n")
      d.write(str(GPS_ALT)+"\n")
      d.write(GPS_SPEED+"\n")
      d.write(GPS_COURSE+"\n")


def getCurrent():
  ### Collect Current GPS Stats #######################################
  global GPS_DATE, GPS_SPEED, GPS_COURSE, GPS_TIME, GPS_LAT, GPS_LON, GPS_ALT

  with open('/mnt/usb/Data/Current.dat','r') as d:
    data=d.readline()
  datum=data.split(',')
  GPS_DATE=datum[0]
  GPS_SPEED=datum[1]
  GPS_COURSE=datum[2]
  GPS_TIME=datum[3]
  GPS_LAT=datum[4]
  GPS_LON=datum[5]
  GPS_ALT=float(datum[6])
  print "Current file Read and Parsed..."


def EXIF(): 
  ### Setup EXIF Tags #################################################
  ### ...Latitude
  LAT=GPS_LAT.split(".")[0]+GPS_LAT.split(".")[1]
  DEG=LAT[:2]
  MIN=LAT[2:]
  camera.exif_tags['GPS.GPSLatitude']=DEG+'/1,'+MIN+'/10000,0/1'
  camera.exif_tags['GPS.GPSLatitudeRef']="N"
  ### ...Longitude
  LON=GPS_LON.split(".")[0]+GPS_LON.split(".")[1]
  DEG=LON[:3]
  MIN=LON[3:]
  camera.exif_tags['GPS.GPSLongitude']=DEG+'/1,'+MIN+'/10000,0/1'
  camera.exif_tags['GPS.GPSLongitudeRef']="W"
  ### ...Altitude
  camera.exif_tags['GPS.GPSAltitudeRef']="0"
  AL=str(GPS_ALT).split(".")
  ALT=AL[0]+AL[1]
  camera.exif_tags['GPS.GPSAltitude']=ALT+'/10'
  ### ...Ground Speed
  camera.exif_tags['GPS.GPSSpeedRef']="N"
  KNT=GPS_SPEED.split(".")[0]
  camera.exif_tags['GPS.GPSSpeed']=KNT+'/1'
  ### ...Track/Course
  camera.exif_tags['GPS.GPSTrackRef']='T'
  CRS=GPS_COURSE.split(".")[0]
  camera.exif_tags['GPS.GPSTrack']=CRS+'/1'
  ### ...Copyright
  camera.exif_tags['IFD0.Copyright'] = 'Copyright (c) 2015 Barntek Solutions'
  ### ...GPSTimeStamp
  tHr=GPS_TIME[:2]
  tMn=GPS_TIME[2:4]
  tSc=GPS_TIME[-2:]
  camera.exif_tags['GPS.GPSTimeStamp']=tHr+"/1,"+tMn+"/1,"+tSc+"/1"
  ### ...GPSDateStamp
  dYR="20"+GPS_DATE[-2:]
  dMN=GPS_DATE[2:4]
  dDY=GPS_DATE[:2]
  dDate="%s:%s:%s" % (dYR,dMN,dDY)
  camera.exif_tags['GPS.GPSDateStamp']=dDate
  print "EXIF Tags prepped..."

### Main Program ######################################################

### Camera Setup
camera.resolution=(1920,1080)
camera.start_preview()
servo.set_servo(23,DOWN)
time.sleep(2)
servo.set_servo(23,UP)
time.sleep(2)
servo.set_servo(23,OUT)
time.sleep(2)

### SEQ: 1 - Prelaunch
### Take snaps while waiting for launch
print "Seq: 1 - Prelaunch"
while flagLaunch==0:
  getCurrent()
  EXIF()
  FNAM=PATH+"/Pics/img"+GPS_TIME+".jpg"
  print FNAM
  camera.capture(FNAM)
  time.sleep(10)
  print GPS_ALT
  if int(GPS_ALT)>200 and flagLaunch==0: # if launch w/out switch
    flagLaunch=1
    servo.set_servo(23,DOWN)
    print "Looking DOWN"
    FNAM=PATH+"/Vids/Launch2.h264"
    camera.start_recording(FNAM, inline_headers=False)

### SEQ: 2 - Launch Video
### Video running
print "Seq: 2 - Launch Video"
t=int(time.time())
while flagALT1==0:
  time.sleep(10)
  ET=int(time.time())-t
  getCurrent()
  print GPS_ALT
  if int(GPS_ALT)>1500 or ET>360:
    camera.stop_recording()
    flagALT1=1
    with open('/mnt/usb/Data/End_Launch_Vid.dat','w') as d:
      d.write(GPS_TIME+"\n")
      d.write(GPS_DATE+"\n")
      d.write(GPS_LAT+"\n")
      d.write(GPS_LON+"\n")
      d.write(str(GPS_ALT)+"\n")
      d.write(GPS_SPEED+"\n")
      d.write(GPS_COURSE+"\n")

### SEQ: 3 - Horizon Snaps
print "Seq: 3 - Horizon Snaps"
servo.set_servo(23,OUT)
print "Looking OUT..."
t=int(time.time())
while flagALT2==0:
  time.sleep(15)
  ET=int(time.time())-t
  getCurrent()
  RATE=int(GPS_ALT)-prevALT
  prevALT=int(GPS_ALT)
  if (int(GPS_ALT)>26000) or (RATE<0) or (ET>5400):
    flagALT2=1
  EXIF()
  FNAM=PATH+"/Pics/OUT_"+GPS_TIME+".jpg"
  print FNAM
  camera.capture(FNAM)

### SEQ: 4 - Balloon Watch
print "Seq: 4 - Balloon Watch"
t=int(time.time())
servo.set_servo(23,UP)
print "Looking UP"
FNAM=PATH+"/Vids/Vid_POP.h264"
camera.start_recording(FNAM, inline_headers=False)
while flagPOP==0:
  time.sleep(60)
  ET=int(time.time())-t                                                             
  getCurrent()
  RATE=int(GPS_ALT)-prevALT
  prevALT=int(GPS_ALT)
  if (flagPOP==1) or (RATE<0) or (ET>360):
    camera.stop_recording()
    flagPOP=1
    with open('/mnt/usb/Data/End_POP_Vid.dat','w') as d:
      d.write(GPS_TIME+"\n")
      d.write(GPS_DATE+"\n")
      d.write(GPS_LAT+"\n")
      d.write(GPS_LON+"\n")
      d.write(str(GPS_ALT)+"\n")
      d.write(GPS_SPEED+"\n")
      d.write(GPS_COURSE+"\n")


### SEQ: 5 - Descent Snaps
print "Seq: 5 - Descent Snaps"
servo.set_servo(23,DOWN)
print "Looking DOWN"
t=int(time.time())
while flagALT3==0:
  time.sleep(15)
  ET=int(time.time())-t
  getCurrent()
  if (int(GPS_ALT)<2000) or (ET>5700):
    flagALT3=1
  EXIF()
  FNAM=PATH+"/Pics/DOWN_"+GPS_TIME+".jpg"                                             
  print FNAM
  camera.capture(FNAM)

### SEQ: 6 - Landing Video
print "Seq: 6 - Landing Video"
servo.set_servo(23,DOWN)
print "Looking DOWN"
FNAM=PATH+"/Vids/Vid_POP.h264"
camera.start_recording(FNAM, inline_headers=False)
while flagPOP==0:
  time.sleep(10)
  getCurrent()
  if int(gps_ALT)<200 or ET>360:
    flagPOP=1
    with open('/mnt/usb/Data/Est_Land.dat','w') as d:
      d.write(GPS_TIME+"\n")
      d.write(GPS_DATE+"\n")
      d.write(GPS_LAT+"\n")
      d.write(GPS_LON+"\n")
      d.write(str(GPS_ALT)+"\n")
      d.write(GPS_SPEED+"\n")
      d.write(GPS_COURSE+"\n")

### SEQ: 7 - Video Run-Out
print "Seq: 7 - Video Run-Out"
time.sleep(120)
camera.stop_recording()
11  Projects / 2015 Balloon Projects / Re: Next Step... on: May 26, 2015, 02:04:37 AM
I am going thru a MAX233a RS-232C converter chip. It is being powered from the 5vdc from the Pi.  The data sheet says it handle TTL (5vdc) and CMOS (3.3vdc).  I have used this for both microcontrollers and the Pi without an issue on either one.  The chip takes care of all the level conversions and polarity issues.  This particular chip is super simple as it only requires 1 cap.  The MAX232 does the same thing, but requires about 6 or 7 external caps.

I just re-read your question, and maybe this will help, too.  The Pi handles UART, which is a TTL level communication standard and the GPS is RS-232C which is a different standard, with 10vdc levels.  This chip converts between 2 for you.

Datasheet




I have just 4 wires between the pi and the chip: Gnd => Pin 6,9; +5v => Pin 7; Xmit => Pin 1; Recv => Pin 3.  I then run 5v from the Pi to the 9-pin subD as well as Gnd, Pin 18 and Pin4.  The GPS plugs into the 9-pin subD.


12  Projects / 2015 Balloon Projects / Next Step... on: May 25, 2015, 02:49:46 AM
Ok, I managed to get the next program written and working very well.  gpsParse.py is designed to pull the important data from the GPS sentences and write them to a data file, Current.dat, where it can be accessed by any program to obtain current data.  The data contained in the data file is as follows: Time, Date, Latitude, Longitude, Altitude, Speed, and Course...  although, not in that order.
Quote
#!/usr/bin/python

### General Info #######################################################
### gpsParse.py
### GPS Sentence Parser
### ...by Larry Barnes
###
### Ports Used: 31757

### Socket Setup ########################################################
import socket
host = ""
port = 31757
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.bind((host, port))

### Main Program ########################################################
print 'Running...'

while 1:

  try:
    data,address = s.recvfrom(4096)
    datum=data.split(",")
    if datum[0]=="$GPRMC":
      GPS_DATE=datum[9]
      GPS_TIME=datum[1].split(".")[0]
      GPS_LAT=datum[3]
      GPS_LON=datum[5]
      GPS_SPEED=datum[7]
      GPS_COURSE=datum[8]
      while 1:
        data2,address = s.recvfrom(4096)
        datum2=data2.split(",")
        if datum2[0]=="$GPGGA":
          GPS_TIME=datum2[1].split(".")[0]
          GPS_LAT=datum2[2]
          GPS_LON=datum2[4]
          GPS_ALT=int(float(datum2[9]))
          break
    GPS_DATA="%s,%s,%s,%s,%s,%s,%s" % (GPS_DATE,GPS_SPEED,GPS_COURSE,GPS_TIME,GPS_LAT,GPS_LON,GPS_ALT)
    with open('/home/pi/Data/Current.dat','w') as d:
      d.write(GPS_DATA)


  except KeyboardInterrupt:
    exit()

  except:
    continue
13  Projects / 2015 Balloon Projects / Pi cam on board on: May 24, 2015, 11:20:08 PM
I am planning on sending only one Pi this year.  It will be a Pi B+.  My intent is to have the camera mounted on a servo, and have it rotate from down, to horizontal, to up.  I proved last year that the camera can handle to extreme cold outside the package.  This year I will find out if that mini servo will be able to withstand the temperature extremes.  The Pi will also be monitoring its own GPS module separate from the tracking system and recording all GPS data received.  It will also make the same data available to all the programs on the Pi via Broadcasting over the network.  This is good, because if we ever get to establish a wi-fi link to the balloon for the duration of the flight, we can get direct GPS info from the balloon over the wi-fi...  but that is for another year.

I am getting off to a late start this year, but I have made some progress, so far.  I have written gpsPoll.py, whose sole purpose is to read the info from the GPS and Broadcast it over the network.  It is working great.

Quote
#!/usr/bin/python

#############################################################
###            gpsPoll.py
###  GPS Reader and Broadcaster
###        by Larry Barnes
###
###  Ports Used:
###  31757 - 31769 Broadcast GPS Statements

import os
import time

### Serial Setup ##################################################
import serial
port=serial.Serial("/dev/ttyAMA0", baudrate=4800, timeout=3.0)
port.open()

### Socket Setup #################################################
import socket
UDP_IP="192.168.1.255"
sock=socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
sock.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)

### Main Program ##################################################
print 'Running...'
while 1:
  try:
    data=port.readline()
    for p in range(31757,31769):
      sock.sendto(data,(UDP_IP,p))
  except Exception:
    continue

 Also, I have written gpsRecord.py, whose sole purpose is to record all the GPS data to a file called allgps.dat; all the GPGGA data sentances to a file called GPGGA.dat; and all the GPRMC data sentences to a file called GPRMC.dat.

Quote
#!/usr/bin/python

### General Info ###########################################################
###  gpsRecord.py
###  GPS Recorder
###  by Larry Barnes
###
###  Ports Used: 31758

### Socket Setup ###########################################################
import socket
host = ''        # Bind to all interfaces
port = 31758
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.bind((host, port))

### Variable Setup #########################################################
crlf=chr(13)+chr(10)

### Main Program ###########################################################
print "\033[2J"                                              # Clear Screen#
print "\033[0;0H\033[93mGPS Rcvr Data Display\033[0m"        # Print Title #

while 1:
  data,address = s.recvfrom(4096)
  with open('/home/pi/Data/allgps.dat','a') as d:
    d.write(data)
  if data[1:6]=="GPGGA":
    with open('/home/pi/Data/GPGGA.dat','a') as d:
      d.write(data)
  if data[1:6]=="GPRMC":
    with open('/home/pi/Data/GPRMC.dat','a') as d:
      d.write(data)
  print data[:-2]

I still need to write a program which pulls vital current info (ie. Lon,Lat,Alt,Time,Speed,Course) and store it in a file which can be accessed by any other program which needs current information.

I am, also, going to rewrite the camera software with the hopes of streamlining and simplifying the code.  Last year, it was based on incoming GPS data.  If the GPS would have failed, the camera program would have locked up.  This year, I am going to base it off time instead of altitude... somewhat.  It should be more stable.

I will keep everyone up to date...
14  Raspberry Pi / Let's talk... Pi / Re: Windows Networking with Raspberry Pi on: August 10, 2014, 04:32:47 PM
Yeah, I installed it and it works fine.  It will allow you to stream pictures and watch videos which are stored on the pi. In fact, once this is all set up, if my pi hostname is Master, all I have to put into putty is 'Master' instead of 192.168.1.50.  

The copy and paste thing works great.  I use it quite a bit from the windows box, but mostly from my linux machine.  When I write Python programs, I SSH into the pi for my linux machine, then open nano to edit my program.  I will SSH from another terminal into the same pi, and use it to run the code I wrote from the other terminal.  That way, I have the code open all the time, even while testing the program.

15  Raspberry Pi / Let's talk... Pi / Re: Windows Networking with Raspberry Pi on: August 02, 2014, 08:28:20 PM
And, by barntekadmin, I meant me!!!
Pages: [1] 2 3 ... 12
Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!