Added RPi Picam TX, and updated readme.

pull/1/head
Mark Jessop 2016-03-06 18:12:29 +10:30
rodzic d5b2d548cc
commit e4f2a1f72d
8 zmienionych plików z 5886 dodań i 7 usunięć

Wyświetl plik

@ -25,4 +25,26 @@ The transmit side is designed to run on a Raspberry Pi, and the UART (/dev/ttyAM
### RX Testing
* `rx_tester.py` produces a stream of packets on stdout, as would be received from the fsk_demod modem (from codec2 - still under development).
* Run `python rx_tester.py | python rx_ssdv.py` to feed these test packets into the command-line ssdv rx script.
* add `--partialupdate N` to the above command to have rx_gui.py update every N received packets.
* add `--partialupdate N` to the above command to have rx_gui.py update every N received packets.
## Sending/Receiving Images
### TX Site
* Run either `python tx_picam.py` (might need sudo) or `python tx_test_images.py` on the transmitter Raspberry Pi.
### RX Side
To be able to run a full receive chain, from SDR through to images, you'll need:
* GnuRadio + libraries for whatever SDR you plan on using.
* `fsk_demod` and `drs232` from codec2-dev. You can get these using
* `svn checkout http://svn.code.sf.net/p/freetel/code/codec2-dev/`
* `cd codec2-dev && mkdir build-linux && cd build-linux && cmake ../`
* Build `drs232` using `gcc src/drs232.c -o src/drs232 -Wall`
* Then copy `src/fsk_demod` and `src/drs232` to this directory.
* A few example gnuradio-companion flow-graphs are in the `grc` directory, for different SDRs. These receive samples from the SDR, demodulate a 500KHz section of spectrum as USB, resamples them to fsbaud*8 (which fsk_demod requires), then presents these samples via a TCP sink, which is acting as a TCP server. You will probably need to modify these to set the appropriate receive frequency.
* To receive the FSK data and display the images 'live', run:
* In another terminal: `python rx_gui.py`, which will listen via UDP for new images to display.
* Start the appropriate GNURadio Companion Flowgraph. This will block until a client connects to the TCP Sinks TCP socket.
* Start the FSK modem with:
* `nc localhost 9898 | ./fsk_demod 2X 8 921600 115200 - - | ./drs232 - - | python rx_ssdv.py --partialupdate 8`

Plik diff jest za duży Load Diff

Plik diff jest za duży Load Diff

Plik diff jest za duży Load Diff

Wyświetl plik

@ -79,16 +79,16 @@ while True:
# Attempt to decode current image, and write out to a file.
temp_f.close()
# Run SSDV
returncode = os.system("ssdv -d rxtemp.bin %s.jpg" % current_packet_time)
returncode = os.system("ssdv -d rxtemp.bin %s_%d.jpg" % (current_packet_time,current_image))
if returncode == 1:
print("ERROR: SSDV Decode failed!")
else:
print("SSDV Decoded OK!")
# Make a copy of the raw binary data.
os.system("mv rxtemp.bin %s.ssdv" % current_packet_time)
os.system("mv rxtemp.bin %s_%d.bin" % (current_packet_time,current_image))
# Update live displays here.
trigger_gui_update("%s.jpg" % current_packet_time)
trigger_gui_update("%s_%d.jpg" % (current_packet_time,current_image))
# Trigger upload to habhub here.
else:

Wyświetl plik

@ -9,7 +9,7 @@
import time, sys, os
# Set to whatever resolution you want to test.
file_path = "./test_images/%d_800x608.ssdv" # _raw, _800x608, _640x480, _320x240
file_path = "./test_images/%d_raw.ssdv" # _raw, _800x608, _640x480, _320x240
image_numbers = xrange(1,14)
print_as_hex = False

61
tx_picam.py 100644
Wyświetl plik

@ -0,0 +1,61 @@
#!/usr/bin/env python
#
# PiCam Transmitter Script
# Capture images from the PiCam, and transmit them,
#
# Mark Jessop <vk5qi@rfhead.net>
#
import PacketTX, sys, os
# Set to whatever resolution you want to transmit.
tx_resolution = "1024x768"
callsign = "VK5QI"
debug_output = False # If True, packet bits are saved to debug.bin as one char per bit.
def transmit_file(filename, tx_object):
file_size = os.path.getsize(filename)
if file_size % 256 > 0:
print("File size not a multiple of 256 bytes!")
return
print("Transmitting %d Packets." % (file_size/256))
f = open(filename,'rb')
for x in range(file_size/256):
data = f.read(256)
tx_object.tx_packet(data)
f.close()
print("Waiting for tx queue to empty...")
tx_object.wait()
tx = PacketTX.PacketTX(debug=debug_output)
tx.start_tx()
image_id = 0
try:
while True:
# Capture image using PiCam
print("Capturing Image...")
os.system("raspistill -t 100 -o temp.jpg -vf -hf -w 1024 -h 768")
# Resize using convert
print("Processing...")
#os.system("convert temp.jpg -resize %s\! temp.jpg" % tx_resolution)
# SSDV'ify the image.
os.system("ssdv -e -c %s -i %d temp.jpg temp.ssdv" % (callsign,image_id))
# Transmit image
print("Transmitting...")
transmit_file("temp.ssdv",tx)
# Increment Counter
image_id = (image_id+1)%256
except KeyboardInterrupt:
print("Closing")
tx.close()

Wyświetl plik

@ -9,10 +9,10 @@
import PacketTX, sys, os
# Set to whatever resolution you want to test.
file_path = "./test_images/%d_800x608.ssdv" # _raw, _800x608, _640x480, _320x240
file_path = "./test_images/%d_320x240.ssdv" # _raw, _800x608, _640x480, _320x240
image_numbers = xrange(1,14)
debug_output = False # If True, packet bits are saved to debug.bin as one char per bit.
debug_output = True # If True, packet bits are saved to debug.bin as one char per bit.
def transmit_file(filename, tx_object):
file_size = os.path.getsize(filename)