Balloon Collaboration
September 21, 2019, 01:14:52 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Hosting for barntek.net has been extended for another 3 years
 
   Home   Help Search gallery Calendar Login Register  
Pages: [1]
  Print  
Author Topic: Pi cam on board  (Read 1030 times)
Larry
Administrator
Hero Member
*****
Posts: 1167



View Profile
« 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...
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!