Friday, March 15, 2019

How to use AI (Artificial Intelligence) to identify Radio signals using a RTL SDR dongle and Linux (Ubuntu)

How to use AI (Artificial Intelligence) to identify Radio signals using a RTL SDR dongle and Linux (Ubuntu)
Identifying Radio stations

I was wondering if there is not a good framework to identify RF signals as I wanted to add some capabilities to my SDR's to identify RF signal.

I was thinking of a way to recognize Satellite signals and the automatically apply the necessary Demodulator's and decoders for the specific satellite.

I was looking at AI Deep Learning library to be able to identify RF Radio signals. There are countless deep learning frameworks available today.

By using Python3 and rtl-sdr dongle it would be possible to scan a frequency range trying to identify a satellite.

Here is a graph with all the most used Deep learning frameworks available.
Deep Learning Frameworks.

I found this opensource project called cnn-rtlsdr and it is available from github here https://github.com/randaller/cnn-rtlsdr

This framework is using Keras and TensorFlow to learn and recognize the RF signals.

So how dose it work?

You first need take an clean RF signal and digitize it and then let the framework learn its signature. The more you letting the AI framework learn a specific signal the more accurate it will able to recognize the RF Signal.



Here is my instillation procedure to get it working on my Ubuntu 18.10 Laptop

Installation Procedure.

Lets check if you have version 2 or 3 of python.
You need version 3
python -V
apt-get install git
git clone https://github.com/randaller/cnn-rtlsdr.git
cd cnn-rtlsdr



sudo apt-get update

sudo apt-get install python3-pip
sudo apt-get install rtl-sdr

sudo apt-get install build-essential libssl-dev libffi-dev python-dev

sudo pip3 install --upgrade pip

sudo pip3 install tensorflow
sudo pip3 install pyrtlsdr

sudo pip3 install scipy

[remove dongle]
rmmod dvb_usb_rtl28xxu rtl2832
[insert dongle]


Installing rtl-sdr and calibrating the frequency offset.

Using the Kal utility to calibrate your dongle offset using the GSM network.
Installing Kal
sudo apt-get install automake
sudo apt-get install libtool
sudo apt-get install libfftw3–dev
sudo apt-get install librtlsdr-dev
sudo apt-get install libusb1.0.0-dev

git clone https://github.com/steve-m/kalibrate-rtl.git
cd kalibrate-rtl/
./bootstrap
 ./configure
 make
 sudo make install


In south Africa we can use the GSM900 frequency
Lets run Kal
kal -s GSM900
Found 1 device(s):
  0:  Generic RTL2832U OEM

Using device 0: Generic RTL2832U OEM
Found Rafael Micro R820T tuner
Exact sample rate is: 270833.002142 Hz
[R82XX] PLL not locked!
kal: Scanning for GSM-900 base stations.
GSM-900:
    chan: 40 (943.0MHz - 736Hz)    power: 25909.17
    chan: 47 (944.4MHz - 817Hz)    power: 28430.99
    chan: 63 (947.6MHz - 128Hz)    power: 29010.57
    chan: 69 (948.8MHz - 597Hz)    power: 32479.73

We now select the strongest Station to measure the average frequency offset
kal -c 69
Found 1 device(s):
  0:  Generic RTL2832U OEM

Using device 0: Generic RTL2832U OEM
Found Rafael Micro R820T tuner
Exact sample rate is: 270833.002142 Hz
[R82XX] PLL not locked!
kal: Calculating clock frequency offset.
Using GSM-900 channel 69 (948.8MHz)
average        [min, max]    (range, stddev)
- 413Hz        [-460, -354]    (106, 30.402500)
overruns: 0
not found: 0
average absolute error: 0.435 ppm



We now need to test to see if we can identify any signals using the default test learn data.

Final test

The Default script will scan the normal FM broadcast band 88 to 108Mhz.
Although it detects the radio stations as TV is ok as the test data id was tv.

sudo python3 predict_scan.py
Found Rafael Micro R820T tuner
[R82XX] PLL not locked!
88.400 MHz - tv 99.98%
89.600 MHz - tv 99.91%
91.500 MHz - tv 99.99%
92.700 MHz - tv 99.93%
94.700 MHz - tv 99.13%
95.900 MHz - tv 98.04%
98.000 MHz - tv 100.00%
99.200 MHz - tv 99.95%
99.600 MHz - tv 81.13%
101.500 MHz - tv 99.91%
102.700 MHz - tv 100.00%
105.100 MHz - tv 100.00%
106.300 MHz - tv 99.56%



We now need to learn the different Rf signals so we can identify it.
Best way to do this is with an rtl dongle and your signal of interest.

Learning from existing RF signal Database.

1) "wfm" Wide band FM
2) "tv" TV signal
3) "gsm" GSM signal
4) "tetra" Tetra DMR
5) "dmr" DMR
5) "other"

Link to database https://drive.google.com/file/d/1PuhzXkk6AVwXPPKjtFUCpQVsqOOlszu8/view
Some RF signals have been learned by other users so you don't need to learn the common RF signals but just import the learn database.

Unzip the file in the cnn-rtlsdr directory
Then run the following command to learn the RF signal 
It takes about 80secons to learn a sample. So go and have a coffee or a bear :-)
Make sure you have your rtl_sdr dongle connected as the code will do a test at the end of the learning procedure.
python3 train_keras.py
You will need a lot of memory for your application tu run so close all necessary applications otherwise you will get an out of memory error..
Learning RF samples for the following RF signals.
When the learning is complete the script will do a test with the RTL-sdr dongle.
Testing signals with the new database. 


Lets learn our own signal not yet in database.
I want to learn a Satellite Telemetry signal from Satellite.

Learning my own unique signal.



python3 train_keras.py
Using TensorFlow backend.
WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py:1062: calling reduce_prod (from tensorflow.python.ops.math_ops) with keep_dims is deprecated and will be removed in a future version.
Instructions for updating:
keep_dims is deprecated, use keepdims instead
WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py:2550: calling reduce_sum (from tensorflow.python.ops.math_ops) with keep_dims is deprecated and will be removed in a future version.
Instructions for updating:
keep_dims is deprecated, use keepdims instead
WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py:1123: calling reduce_mean (from tensorflow.python.ops.math_ops) with keep_dims is deprecated and will be removed in a future version.
Instructions for updating:
keep_dims is deprecated, use keepdims instead
Train on 64972 samples, validate on 27844 samples
Epoch 1/50
64972/64972 [==============================] - 70s - loss: 0.3469 - acc: 0.8527 - val_loss: 0.0716 - val_acc: 0.9836
Epoch 2/50
64972/64972 [==============================] - 72s - loss: 0.0575 - acc: 0.9839 - val_loss: 0.0731 - val_acc: 0.9791


...
64972/64972 [==============================] - 79s - loss: 0.0016 - acc: 0.9995 - val_loss: 0.0069 - val_acc: 0.9984
Epoch 49/50
64972/64972 [==============================] - 80s - loss: 7.5126e-04 - acc: 0.9998 - val_loss: 0.0093 - val_acc: 0.9981
Epoch 50/50
64972/64972 [==============================] - 78s - loss: 0.0065 - acc: 0.9983 - val_loss: 0.0357 - val_acc: 0.9923

Found Rafael Micro R820T tuner
[R82XX] PLL not locked!
92.9 wfm 99.9636411667
49.25 other 99.8086333275
95.0 other 99.9997735023
104.0 other 99.9999880791
422.6 other 99.9927401543
100.5 other 99.9997496605
120.0 other 100.0
106.3 wfm 100.0
942.2 other 99.999666214
107.8 other 100.0
Validation: 30.0





Friday, March 8, 2019

The New Corel USB Accelerator module adds Edge TPU co-processor to your system for AI development. Ideel for MobileNet v2 (100+ fps) development.

The New Corel USB Accelerator module adds Edge TPU co-processor to your system for AI development. Ideal for MobileNet v2 (100+ fps) development.

Corel USB Accelerator dongle

The Coral USB Accelerator dongle is a USB device that adds an Edge TPU coprocessor to your Linux development system. It includes an USB3 socket and it dose accelerated ML inferencing.

The onboard Edge TPU is a small ASIC designed by Google that provides high performance ML inferencing with a low power cost.
The unit can execute state-of-the-art mobile vision models such as MobileNet v2 at 100+ fps, in a power efficient manner.

What can I do with this Unit?

You can execute your your TensorFlow Lite models against the device.

DURING BETA period


Currently, the Edge TPU compiler requires that your model use one of the following architectures:

    MobileNet V1/V2:
    224x224 max input size; 1.0 max depth multiplier
    MobileNet SSD V1/V2:
    320x320 max input size; 1.0 max depth multiplier
    Inception V1/V2:
    224x224 fixed input size
    Inception V3/V4:
    299x299 fixed input size

All models must be a quantized TensorFlow Lite model (.tflite file) less than 100MB.
The restriction above will be removed.
The first-generation Edge TPU is capable of executing deep feed-forward neural networks (DFF) such as convolutional neural networks (CNN), making it ideal for a variety of vision-based ML applications.

Example Models available.
  • Object recognition.
  • Insect recognition.
  • Plants recognition.
  • Baird recognition.
  • Face recognition. 
  • ...

Can the Edge TPU perform accelerated ML training?

Sort of. The Edge TPU is not capable of backward propagation, which is required to perform traditional training on a model. However, using a technique described in Low-Shot Learning with Imprinted Weights, you can perform accelerated transfer-learning on the Edge TPU by embedding new vectors into the weights of the last fully-connected layer on a specially-built and pre-trained convolutional neural network (CNN).
USB Accelerator dongle
USB Accelerator dongle

What would you need to use to USB Accelerator?

Any Linux computer with a USB port (preferably USB3 port)
  • Debian 6.0 or higher, or any derivative thereof (such as Ubuntu 10.0+)
  • System architecture of either x86_64 or ARM64 with ARMv8 instruction set.

Physical size.

It has a very small footprint as can be seen in diagram below.




Now you can have your Artificial Intelligence (AI) engine (Tensorflow) on your Laptop or standalone instance.

Google has new Artificial Intelligence (AI) engine (Tensorflow lite) on your Laptop or standalone instance.

Here is the description of the Standalone option.
I was experimenting with Artificial Intelligence AI for Radio voice recognition and RF signal identification system and always had to run my applications on Tensorflow lite engine in the google remote Cloud for development and testing due to the expensive hard ware required. I cant wait for this hardware to become available here in South Africa as it seems to be only available in USA for now. :-(
The part that interested me the most was the Pulse Width Modulation (PMW) with max Frequency of 0 - 66Mhz.
My main interest was to use the object recognition for the identification of Radio signals and the Voice recognition for automated radio control.

Coral Development hardware option 1.

It looks like a Raspberry Pi footprint.
This unit has all the hardware interface for embedded AI applications. 
If you want to have a standalone AI system then this should work well.
There is some examples how to use the Tensorflow lite implementation.
Corel Standalone Dev Board
  • GPIO header pinout. (40Pin Header)
  • Universal Asynchronous Receiver-Transmitter (UART). Programmable baud rates up to 4 Mbps.
  • Synchronous Audio Interface (SAI)
  • Inter-Integrated Circuit (I2C)
  • Serial Peripheral Interface (SPI)
  • Pulse Width Modulation (PMW) Frequency of 0 - 66Mhz.
  • Serial console port. Terminal port for local access.
  • HDMI port. This is a full-size HDMI 2.0a port.
  • USB 3.0 ports. There are three USB 3.0 ports. 
  • Ethernet port. Supports 10/100/1000 Mbps.
  • Bluetooth 4.1.
  • Microsd-slot.
  • Audio Connections. 4-pin stereo terminal, 3.5mm audio jack, microphone (x2)   
  • MIPI-DSI display connector. Resolution up to 1920x1080 at 60Hz.
  • MIPI-CSI2 camera connector pinout. 24-pin flex cable connector.
  • Power specifications The Coral Dev Board must be powered by 2 - 3A at 5V with USB Type-C power port.

Boot mode.

This board can be boot in 3 different modes.

  1. Serial download.
  2. eMMC. 8GB
  3. SD card.

Operating system.

Supports Mendel Linux (derivative of Debian)

Software models.

There is several pre-compiled examples.
  • Object recognition.
  • Plant recognition.
  • Baird recognition.
  • Human faces recognition.
  • Object Location detection.
Un-compiled examples
  • Gesture recognition.
  • Speech recognition.

Thursday, December 20, 2018

Testing the Lime mini SDR with Gnuradio

lime_mini

This repository will have all my Lime mini configurations.
https://github.com/antonjan/lime_mini

Installing soapysdr on ubuntu 18.10

sudo apt-get install python3-pip python3-pyqt5 python3-numpy python3-scipy soapysdr python3-soapysdr #packages for soapysdr available at myriadrf PPA
/usr/share/doc/soapysdr-tools
cd /usr/share/doc/soapysdr-tools/ sudo add-apt-repository -y ppa:myriadrf/drivers
sudo apt-get update
sudo apt-get install limesuite liblimesuite-dev limesuite-udev limesuite-images
sudo apt-get install soapysdr-tools soapysdr-module-lms7
sudo apt-get install soapysdr
LimeUtil --info
SoapySDRUtil --info
SoapySDRUtil --find="driver=lime"

Testing the Lime Mini

LimeUtil --info
LimeUtil --find
SoapySDRUtil --info
SoapySDRUtil --find="driver=lime"
#testing
cd /home/anton/lime-tools/build
sudo ./LimeMon
sudo ./LimeScan
/usr/bin/LimeQuickTest
/usr/bin/LimeSuiteGUI
/usr/bin/LimeUtil
#LimeQuickTest

LimeQuickTest --no-gui
LimeQuickTest --gui
#testing lime
https://wiki.myriadrf.org/Testing_the_LimeSDR

LimeSuiteGUI
https://wiki.myriadrf.org/LimeSDR-USB_Quick_Test

Testing the transmitter in Gnuradio.

Link to block source https://github.com/antonjan/lime_mini/blob/master/gnuradio/Lime_transmitter_test_zr6aic.grc Here is a Gnuradio block that will modulate the Lime mini sdr with Fm from Microphone and 1 Khz zone.
In the gnuradio radio directory is a working Transmitter testing code.
Gnuradio FM modulator TX block from Mic and oscillator.

Here is the settings for the Lime mini. (you need to install the soapySDR drivers.
Settings for soapy driver for lime
Screenshot of Application
Changing the PTT value to 1 enables modulation.
Changing the enable tone to value 1 will switch the modulation from internal Microphone of laptop to the 1Khz tone generator.
The Modulation can be seen in the FFT Plot box.


Transmitting DATV for Ei'hail 2
https://www.dd1us.de/Downloads/DATV%20TX%20with%20the%20LimeSDR%20rev1.pdf

Friday, August 31, 2018

RF Noise Antenna System

RF Noise Antenna System.


Raspberry Pi Hat


The Live System can be accedes here http://rfnoise.amsatsa.org.za/

I Developed a rf noise monitoring system and there was a need to standardize on an active antenna for the system.

My thinking was sins most Remote Stations is Raspberry Pi with RTL-SDR dongles I felt developing a front end power injector with Galvanic isolation from active antenna with the necessary RF filters.
I also had a requirement to resolve the rtl-sdr dongle front end filter problem.
There is an Rf image on center frequency 14.2 Mhz.
I then Developed a Low and High band pass filters on the same PI HAT that can be switched via IO pins on Pi.

Here is the circuit diagram of my design with out the Active Antenna.


Raspberry Pi HAT with Filters,Isolation and Power injection

Filter design details. 

High Pass Filter

Low Pass Filter

I will work on an active Antenna board.

PCB View
3d view of Board

  
3D View of Boards



RF Noise Filter HAT for Raspberry Pi
Video of My first Test

 All seems to work fine will add spectrum Analyses details.

ref :http://rfnoise.amsatsa.org.za/

Monday, June 11, 2018

How to fix Kicad PCB (pcbnew) cross cursor problem on Ubuntu 18.04

How to fix Kicad PCB (pcbnew) cross cursor problem on Ubuntu 18.04

When trying to create PCB you will get this cross cursor where ever the mouse moves.
Here is the steps that fixed my problem on Ubuntu 18.04 vanilla kicad install.

sudo add-apt-repository ppa:js-reynaud/kicad-4
sudo  apt-get update
sudo apt-get upgrade

Wala..

It is now working :-)


ref: http://kicad-pcb.org/download/ubuntu/

Wednesday, May 30, 2018

How to program and configure the Zastone D900 DMR radio.

How to program and configure the Zastone D900 DMR radio. (mototrbo)

Zastone D900 DMR (mototrbo)
Please not the programing cable is different to generic programing cables but microphone connections is the same as generic Microphones.

First Download the following application from TYT web
http://www.tyt888.com/?mod=download
Download MD-380
Go into unrared directory "MD-380 software\Firmware 2.30 and new programming siftware"
This file is also available here but could be old if  http://www.giga.co.za/Kit_Drivers/TYT_MD-380_20160908101439.rar

Then untarrar  MD-380(Tytera).rar
The directory then should look like this
UNRAR "MD-380(Tytera).rar"
After the unrar then run the MD-380(Tytera).exe


Continio installation using default settings.
After installation is complete there should be a Tytera MD-380

Run Application Tytera MD-380 in start menu
You should then see the following default screen.
Default Configuration screen
Now download the codeplug for South Africa Repeaters from Here http://www.giga.co.za/Kit_Drivers/Zastone_D900_Code_plug_v1_30_may_2018.rdt
Now load the code plug "Zastone_D900_Code_plug_v1_30_may_2018.rdt"

Load "Zastone_D900_Code_plug_v1_30_may_2018.rdt"
Now edit the DMR radio configuration as required.
Pres green button to download from Radio Red to load to Radio and Blou to save your configeration

Monday, May 21, 2018

How to Create a Linear Transponder using a RTL Dongle and HackRF with Gnu Radio.

How to Create a Linear Transponder using a RTL Dongle and HackRF with Gnu Radio.

I wanted to test the concept of a linear Transponder and how difficult would it be to build it with conventional components.
Hardware Configuration
Hardware required to build the Transponder.
  1. SDR IQ demodulator with rtl dongle (RF In)
  2. SDR IQ DSP processing system. Gnu Radio (DSP processing)
  3. SDR IQ Modulator. HackRF (RF Out)
  4. Background management system. (OBC) for additional telemetry.
Software required for Transponder.
  1. SDR IQ demodulator. rtl dongle (RF In)
  2. SDR IQ DSP processing system. Gnu Radio (DSP processing)
  3. SDR IQ Modulator. HackRF (RF Out)
  4. Background management system. (OBC)

Video of working Transponder.



Gnu Radio.


Transponder Block Diagram

RTL SDR Block.

RTL-SDR Source

Low Pass Filter Block.

 
Low Pass Filter Block

AGC Block.

AGC Block

Power Squelch.

Power Squelch

Osmocom Sink. (HackRF)

Osmocom Sink (HackRF)

FFT. (Spectrum View of input)

FFT Spectrum View

REF: Power point Slides at AMSAT SA

Ref:Source code is available on Github Version 4

Thursday, April 19, 2018

Setting up my Raspberry Pi as an BACAR Balloon telemetry system using GPSD,CW,AFSK,RPITX and Direwolf

Setting up my Raspberry Pi as an Balloon telemetry system using GPSD, CW, rpitx, AFSK and Direwolf.

 
Bacar Balloon

I wanted to take part in a local BACAR Balloon experiment and wanted to send my GPS position via the APRS network and also send a CW beacon every 7 minutes. I got an opportunity to add my payload to a school project.



Raspberry TX Hat for 2m Band

So I decided to use the the 2m transmitting board form Giga technology plug it on the raspberry pi. this should give me about 32.7mW (15.1dBm)
Power is a bit low but its a good for now.

Balloon Telemetry System


BACAR launch details is available here.
http://secundaweather.co.za/blog/?p=2012

Learnings
  1. Power to Low (Working on model 2 with a power output of 100 to 900mw output.
  2. Need to record everything that hapens in Local log so you can recover more information that you would send with Telemetry.
 Hardware.
  1. Raspberry Pi 3
  2. Giga Technology TX PI HAT for 2M
  3. RTL dongle for RX
  4. Giga Technology USB GPS unit.
  5. Giga Technology Battery and Powersupply Boards.
  6. Temperature sensor
  7. Optional USB Camera for CCTV.
High Level Hardware configuration

Software.
  1. CW (CW tone generation for Beacon transmission)
  2. Direwolf. (AX 25 telemetry generation for Temperature and on-board sensors  board 1200 AFSK)
  3. rtl_sdr (SDR receiver software for incoming commands controlling transponder)
  4. rpitx (RF transmitter details)
  5. ALSA loopback (this is needed to send audio between direwolf cw and rpitx)
  6. gpsd GPS positioning server read by direwolf APRS transmission
  7. Kal (rtl dongle frequensy calibaration details)
  8. csdr DSP libraries  that can be used for SDR.
  9. Some shell scripts taing this all together. Download from github https://github.com/antonjan/Raspberry_Telemetry

Software Block Diagram



Lets install the software for the system.

sudo apt-get install CW
sudo apt-get install direwolf
sudo apt-get install rtl-sdr
sudo apt-get install gpsd
sudo apt-get install alsa-utils
sudo modprobe snd-aloop
sudo apt-get instal python
Install the csdir sdr libraries doing the following.

git clone https://github.com/simonyiszk/csdr
cd csdir
make 
sudo make install
Get the direwolf example configurations
git clone https://github.com/wb2osz/direwolf
Lets install aprs utility.
got home directory
cd
git clone https://github.com/casebeer/afsk.git
cd afsk

sudo pip install afsk $ 
sudo pip install --allow-external PyAudio --allow-unverified PyAudio PyAudio
Lets test aprs util
aprs
You should see the following
usage: aprs [-h] -c CALLSIGN [--destination DESTINATION] [-d DIGIPEATERS]
            [-o OUTPUT] [-v]
            INFO
aprs: error: too few arguments


Lets check if alsa loop installed

sudo arecord -l
you should see this

card 2: Loopback [Loopback], device 0: Loopback PCM [Loopback PCM]
  Subdevices: 8/8
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1
  Subdevice #2: subdevice #2
  Subdevice #3: subdevice #3
  Subdevice #4: subdevice #4
  Subdevice #5: subdevice #5
  Subdevice #6: subdevice #6
  Subdevice #7: subdevice #7
card 2: Loopback [Loopback], device 1: Loopback PCM [Loopback PCM]
  Subdevices: 8/8
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1
  Subdevice #2: subdevice #2
  Subdevice #3: subdevice #3
  Subdevice #4: subdevice #4
  Subdevice #5: subdevice #5
  Subdevice #6: subdevice #6
  Subdevice #7: subdevice #7



You cal also check it in the sound volume control

Right click on the Sound icon and select setting and you should see the following

Input Tab should have the loopback sound card


Output Sound Card should have loopback


Lets test CW

cw -h
You should see the help

Lets test gpsd

gpsd -h
You should see the gpsd help
Install the gps on USB port.

We now need to find out what is the usb port for your GPS device so we can run the following command.  sudo gpsd -D 5 -N -n /dev/ttyACM0
We assume here that your usb device is  /dev/ttyACM0
Run this command and then plug in and out your gps on usb port.
tail -f /var/log/syslog | grep ttyAC


You will the see something like this.

/dev/ttyACM0
Then run the command sudo gpsd -D 5 -N -n /dev/ttyACM0 replacing it with your GPS usb port.

gpsd:PROG: Changed mask: {ONLINE|TIME|LATLON|ALTITUDE|STATUS|MODE|PACKET|PPSTIME} with reliable cycle detection
gpsd:PROG: GPGSA sets mode 3
gpsd:CLIENT: => client(0): $GPGSA,A,3,08,27,16,09,,,,,,,,,4.12,1.97,3.61*0D\x0d\x0a
gpsd:PROG: Changed mask: {ONLINE|MODE|DOP|PACKET|USED} with reliable cycle detection
gpsd:PROG: Partial satellite data (1 of 4).
gpsd:CLIENT: => client(0): $GPGSV,4,1,14,01,64,012,08,03,05,014,,04,06,121,,07,69,274,18*72\x0d\x0a
gpsd:PROG: Partial satellite data (2 of 4).
gpsd:CLIENT: => client(0): $GPGSV,4,2,14,08,43,151,28,09,11,321,22,11,88,165,17,16,15,081,21*7E\x0d\x0a
gpsd:PROG: Partial satellite data (3 of 4).
gpsd:CLIENT: => client(0): $GPGSV,4,3,14,17,06,290,22,22,14,033,16,23,04,348,,27,14,129,08*7A\x0d\x0a
gpsd:CLIENT: => client(0): $GPGSV,4,4,14,28,16,230,11,30,40,230,21*75\x0d\x0a
gpsd:PROG: Changed mask: {ONLINE|DOP|SATELLITE|PACKET} with reliable cycle detection

There is also another utility that could give you the status of the gpsd service.

Ok lets make our gpsd configuration permanent.
Edit the following configuration file using your favorite text editor.
and change the usb interface to what was detected above

sudo Vi /etc/default/gpsd

# /etc/default/gpsd
START_DAEMON="true" 
GPSD_OPTIONS="-n" 
DEVICES="/dev/ttyAMA0
USBAUTO="false" 
GPSD_SOCKET="/var/run/gpsd.sock"

Lets restart the gpsd service

sudo systemctl stop gpsd.socket

sudo systemctl start gpsd.socket
You can now test if it works fine with the following command
sudo gpsmon
You should see the following if all is ok with gps connected.

This is the GPS details as read by GPSD














Lets test direwolf



direwolf -h
You should see the direwolf help screen in white inverse.


Ok lets check rtl_sdr. (the SDR receiving software)
Plug-in your rtl dongle and then run the following command.

sudo rtl_test

You should see some test results and gain parameters supported by your device.
Ok


Connect your ds18b20 temperature sensor.
One of the coolest things about OneWire and DS18B20 temperature sensors is that each sensor has its own embedded address so you can have many of them on 1 data wire. 




Configure the raspberry pi to read the temperature.
Edit the following config file
sudo vi /boot/config.txt


Add the following at the bottom of the file
dtoverlay=w1-gpio
Then reboot the pi
sudo reboot
We now need to load the device drivers for the temperature sensor.
sudo modprobe w1-gpio 
sudo modprobe w1-therm

Now check if the device was loaded

ls /sys/bus/w1/devices


you should see a directory like this below
28-000007602ffa
Go into this directory replacing the part in yellow with your directory
cd /sys/bus/w1/devices/28-000007602ffa
Now run the following command to get the temperature.
w1_slaveYou should see something lie this.
bd 01 4b 46 7f ff 03 10 ff : crc=ff YES
bd 01 4b 46 7f ff 03 10 ff t=27812

Ok its working.
We can now use a python script to read the readings
get the python code from github using the following command
git clone https://github.com/pimylifeup/temperature_sensor.git
goto the new directory that was created. temperature_sensor
cd temperature_sensor

Give the application executable writes by using the following command 
chmod 776  temperature_sensor_code.py

Then run the command
./temperature_sensor_code.py
You should see the temperature readings scrawling on the screen.
Ok we can stop it with CTRL C.
Ok now all seems to be working for the temperature readings



We now need to test the Radio transmitter.
Please note you need to have a Amateur Radio license to do this as you will be transmitting on the Amateur allocated frequencies.

Install the Raspberry Pi hat on the Raspberry Pi and then test the transmitter with the following commands.
Clone the following examples in your home directory from github
git clone https://github.com/antonjan/Raspberry_Telemetry.git

cd to the Raspberry_Telemetry directory.
Connect a 2m external antenna to the raspberry Pi Hat SMA connector.
run the following command
sudo ./Start_Carier_check.sh
Now check for a rf carrier on the following frequency
U can use a SDR dongle or HT (Baofeng) or spectrum analyzer if you have one.
The frequency can be changed by editing this file and changing the yellow value
vi ./Start_Carier_check.sh
sudo rpitx -m VFO -f 145300 -c1
Now that we have the transmitter tested we can start testing the telemetry.




Lets start doing some real time applications.

Now lets configure the APRS and CW telemetry to send sensor data and call sign. I suggest using 70cm up-link and 2M down-link not to overdrive the receiver front end. ( There is a diplex available from Giga technology)  
2m and 70cm Diplexer

  1. Sending APRS telemetry every minute with GPS and temperature readings.
  2. Sending a CW (morse code) with calsign and temperature reading every two minutes.
  3. Lets test a command to control the system. Replying with APRS got command.
  4. I wanted to send telemetry every minute but decided to make it a prime number just in case there is two telemetry transmissions disturbing each other so this would be helping to resolve this problem. (67 seconds)

Sending APRS telemetry every minute with GPS and temperature readings.


Download the following shell scripts
1) wget https://raw.githubusercontent.com/antonjan/Raspberry_Telemetry/master/sh/cron_aprs_gps_position.sh

2) wget https://raw.githubusercontent.com/antonjan/Raspberry_Telemetry/master/sh/crontab_bacar_cw.sh
3) wget https://raw.githubusercontent.com/antonjan/Raspberry_Telemetry/master/sh/crontab_bacar_aprs.sh
4) wget https://raw.githubusercontent.com/antonjan/Raspberry_Telemetry/master/telem-balloon_2.conf

Lets edit the file for your path.
vi cron_aprs_gps_position.sh
Fix the yellow with path to your direwolf file.
#load looback and start gpsd service for gps data.
sudo /usr/sbin/gpsd -D 5 -N -n /dev/ttyACM0 &
sleep 5
sudo /sbin/modprobe snd-aloop
sleep 2

#We now will write out the audio from loopback from direwolf to a wav file
sudo timeout 10s arecord -c1 -t wav -r 48000  --vumeter=mono -D hw:Loopback,1,0 -fS16_LE /home/pi/sh/direwalf.wav &
#We now will create a APRS audio withS position and send it to loopback device
sudo timeout 9s direwolf -c /home/pi/Downloads/direwolf/telemetry-toolkit/telem-balloon_2.conf

# we now wait for short wile
sleep 1

#we now convert the wav file in a format to transmit
sudo sox -v 0.3 -S /home/pi/sh/direwalf.wav /home/pi/sh/direwalf_sox.wav  rate -L -s 48000

# we now wait for short wile  
sleep 1
#we now convert the APRS audio file to a fm file for transmission.
sudo /home/pi/Downloads/rpitx_new/rpitx/pifm  /home/pi/sh/direwalf_sox.wav /home/pi/sh/direwalf_sox.wav.ft

# we now wait for short wile
sleep 1
#We now transmit the the APRS gps postion on the frequensy 144,801Mhz
sudo /home/pi/Downloads/rpitx_new/rpitx/rpitx -i /home/pi/sh/direwalf_sox.wav.ft -m RF -f 144801 -c1
Save the file

Lets send our first APRS GPS position.
Change the callsign in the  telem-baloon_2.conf to your callsign
Check that the paths in the telem-baloon_2.conf  and cron_aprs_gps_position.sh is correct in relation to the directory you check the code out.
run the script sudo ./cron_aprs_gps_position.sh and you should now send a gps position aprs message. If you change the frequency to your local packet  (APRS in SA its 144.8Mhz)frequency you should see the Balloon Icon on the APRS server.  https://aprs.fi/#!lat=60.169998&lng=24.94
You mite want to calibrate the TX frequency by changing the frequency in the script.
You can now add this script in a cron to send every 1minute ...

Here is an exsample just to send a message
sudo aprs --callsign NOCALL --output - "30mw Belloon Beacon de NOCALL" | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo rpitx -m RF -i - -f 144325 -c1

Ok lets now send some CW as a beacon.

Lets create a text file with the cw message we want to send.
vi cw_text 
enter the following example

                               32mw balloon experiment de NOCALSIGN
save the file (including the space in front)

we now will be using a different script crontab_bacar_cw.sh
edit this script.
vi crontab_bacar_cw.sh
#This script will send a cw at 10 words per minute 
#Start GPS and alsa loopback
sudo /usr/sbin/gpsd -D 5 -N -n /dev/ttyACM0 &
sleep 5
sudo /sbin/modprobe snd-aloop

#now setup loopback to write to file


sudo /usr/bin/timeout 11s /usr/bin/arecord -c1 -t wav -r 48000  --vumeter=mono -D hw:Loopback,1,0 -fS16_LE /home/pi/sh/bacar_cw.wav &
# now send cw to loopback with cw_text.txt
sudo /usr/bin/timeout 10s /usr/bin/cw -s a -d hw:Loopback,1,0 -t 1000 -v 50 -f /home/pi/sh/cw_text.txt
sleep 1
#Now convert the file to format that can be converted to fm signal.
sudo /usr/bin/sox -v 0.9 -S /home/pi/sh/bacar_cw.wav /home/pi/sh/bacar_cw_sox.wav  rate -L -s 48000
sleep 1
#now create transmission file for rpitx
sudo /home/pi/Downloads/rpitx_new/rpitx/pifm  /home/pi/sh/bacar_cw_sox.wav /home/pi/sh/bacar_cw_sox.wav.ft
sleep 1
#now send your CW (morse code on 144.328 Mhz) Change frequency as requerd
sudo /home/pi/Downloads/rpitx_new/rpitx/rpitx -i /home/pi/sh/bacar_cw_sox.wav.ft -m RF -f 144328 -c1

Save the file and run and test.
sudo ./crontab_bacar_cw.sh

Now listen on the tx frequency and run the script and you should here the message "32mw balloon experiment de YOURCALLSIGN"

Friday, April 13, 2018

ISS SSTV Recording 13/04/2018 08:04 CAT

This is a video of SSTV recording of SSTV from International Space Station.


I had some Local Repeater QRM during the reception.

This was a nice pass.
87 deg Elevation. a very nice pass

Thursday, February 22, 2018

Setting up my hackrf on ubuntu 17.10

Setting up my hackrf on ubuntu 17.10



sudo apt-get install gcc-arm-none-eabi

sudo apt install cmake
sudo apt install hackrf

if the hackrf command above did not work then follow the following steps


git clone https://github.com/mossmann/libopencm3.git
cd libopencm3/
ls
cd ../hackrf/
ls
git submodule init
git submodule update
cd firmware/libopencm3/
make
sudo synaptic
xhost +
sudo synaptic
make
sudo apt-get install gcc-arm-none-eabi
cd hackrf/firmware/hackrf_usb/build
mkdir build
cd build
cmake ..

hackrf_spiflash -w hackrf_usb.bin

Update firmware
hackrf_spiflash -w hackrf_one_usb.bin
hackrf_info

hackrf_cpldjtag -x hackrf_cpld_default.xsvf
hackrf_info

Thursday, November 16, 2017

HF Noise monitoring system running from Live Ubuntu Memory stick with fully configured environment.

HF Noise monitoring system running from Live Ubuntu USB flash drive.

Ubuntu Live Noise Monitoring system with Persistence. 16Gb
I wanted a Preconfigured RF Noise monitoring system that I can run on my Laptop when ever I am not using it for something else.
I made this Ubuntu 16.04 Live memory stick .

This dongle is available from my Shop at http://www.giga.co.za/ocart/index.php?route=product/product&product_id=344

So how dose it work?
Configure your BIOS to boot from USB flash drive and you should then see the following screens.

Just pres enter to continue
If you see the error above just pres Enter  You should then get a screen where you can select how you want to boot your environment Persistent or not.
Select  the Persistent live boot.
Select the Persistent live option.
You could then see a screen for a few seconds looking like this.
Black screen before startup
This picture is of Ubunto 17.10 The Noise system is on Ubuntu 16.04
Here is some of the sunscreens of some of the functionality

HF Heat map
 Noise Graphs  (link to a live system)

Here is a link to a brochure on the RF Noise Monitoring system

Master Data correlation server http://rfnoise.amsatsa.org.za

Master Correlation Server.