writing delays in C (linux)

An alternative way to write a delay.

You can also use select(2) if you want microsecond precision (this works on platform that don’t have usleep(3))

The following code will wait for 1.5 second:

#include <sys/select.h>
#include <sys/time.h>
#include <unistd.h>`

int main() {
    struct timeval t;
    t.tv_sec = 1;
    t.tv_usec = 500000;
    select(0, NULL, NULL, NULL, &t);
}

Raspberry-Pi RTTY beacon and streaming webcam – success

Update: 5/2014

Retrying this experiment using the Arduino circuit described here: https://reactivemusic.net/?p=12161

notes
  • 300 baud
  • 300 Hz carrier shift
  • 8 bits
  • 2 stop
  • no parity
  • filter at 300 Hz
  • Normal mode (not reverse)
  • AFC on
There are 2 programs:
  • serial.c – sends a beacon then transmits a 640×480 picture
  • serial-beacon.c – just sends a beacon
In order to view the picture as it comes in in dl-fldigi, you need to open up the SSDV RX window in the View menu.
The frequency is not very stable and occasionally you need to just restart dl-fldigi because the screen fills with trash characters.
Also, in Max, you need to tune on the right half of the picture.
Will be setting up a test with smaller photos

 

Success: Got an accurate beacon at 300 baud today and send a jpeg picture file , taken by a webcam connected to the R-Pi using fswebcam and SSDV.

http://www.slblabs.com/2012/09/26/rpi-webcam-stream/

Used the same circuit as the previous post about the Arduino RTTY beacon.

The difference is that we’re using a C program to write the text directly to the serial port which modulates the NTX2 transmit frequency.

Transmission can be stopped and started using the sleep() function but the timing is not exact.

Local code

tkzic/rpi/serial/serial1 –

  • using command line SSDV converter in tkzic/rpi/ssdv-master.
  • Using dl-fldigi to decode RTTY and SSDV pictures.
  • Using logictech c210 webcam – see link above for how to take a picture and save to file use fswebcam.

 

 

[Todo:]

  • Set up a shell script to take pictures and transmit regular intervals.
  • upload code and photos
  • Build some antennas
  • Field test
  • Buy a balloon

 

 

SSDV encoding, decoding, RTTY

I was able to packetize a jpeg file, send it using RTTY encoded audio, and decode using dl-fldigi to reconstruct the picture –  with a 33% error rate.

Details:

Encode jpeg file (note: file should be fairly small with dimensions that are multiples of 16) Using fsphil’s SSDV software:

./ssdv -e -c KA1IS -i 1 24.jpeg test1.pkt

decode:

./ssdv -d  test1.pkt test3.jpeg

RTTY:

Currently using multimode to encode and dl-fldigi to decode. dl-fldigi is the only software that internally supports the SSDV packets.

To get any results, RTTY must be at ascii, 8 bits, no parity, 2 stop bits. The other settings I will need to tweak for maximum throughput, but with this simple setup the error rate was way too high. Especially considering there was no radio involved.

Any way it sort of works

 

 

 

Adafruit Raspberry Pi console cable and drivers

These instructions are better than the Adafruit tutorial. It uses the Mac OS terminal and the driver installation is different in Lion.

http://svbreakaway.info/tp-raspi.php

Combine with these instructions for using Minicom to test the port

http://www.hobbytronics.co.uk/raspberry-pi-serial-port

I was able to use cool-term and mini-com (with local echo set on each one) to have a 2 way terminal session at 9600 baud.

Next – we’ll try to use the serial port to send RTTY using the Arduino method.

 

 

 

how to open, read, and write from a serial port in C (linux)

With applications for Raspberry Pi

notes

by hobbytronics.com

http://www.hobbytronics.co.uk/raspberry-pi-serial-port

C – programming example:

http://stackoverflow.com/questions/6947413/how-to-open-read-and-write-from-serial-port-in-c

An R-Pi thread about connecting Arduino to R-Pi. R-Pi does TTL (3.3 v level and Arduino is rs-232 5v) so you need a level converter for them to communicate.

http://www.raspberrypi.org/phpBB3/viewtopic.php?f=31&t=23873

Another similar example, connecting Arduino and R-pi via USB

http://www.raspberrypi.org/phpBB3/viewtopic.php?f=32&t=28801

The WiringPi library for serial io:

https://projects.drogon.net/raspberry-pi/wiringpi/serial-library/