I'm working on a project to transmit and receive data by radio. For the transmission, I'm using a Raspberry Pi 3 and the NTX2B transmitter for the transmission. For the receiving end, I am using NooElec Mini 2 SDR as the receiver and the CubicSDR program to see a waterfall diagram of the received signal.
I've used instructions from Yannick, Linking an Arduino to a Radiometrix NTX2B Transmitter and Dave Akerman to get as far as I have. The image below shows the circuit diagram (from Dave Akerman).
Sending 1s and 0s using a GPIO port
Initially, rather than connecting the transmitter input to the TX port on the pi, I connected it to one of the GPIO ports, number 18. I instructed port 18 to switch on and off every five seconds, and was able to see the frequency shift on the waterfall diagram on my laptop. :) Success!
from time import sleep
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setup(18, GPIO.OUT)
GPIO.setmode(GPIO.BCM)
GPIO.setup(26, GPIO.OUT)
GPIO.output(26, True)
while 1:
GPIO.output(18, False)
sleep(5)
GPIO.output(18, True)
sleep(5)
Serialising data using the TXD port
The next step was to send data by connecting the NTX2B to the TXD port on the Pi. I was expecting to see a double peak, one for 0, and another for 1 at a higher frequency, on the waterfall diagram. However, I get just a single peak, and so I'm not sure if I'm actually transmitting the data. I tried using setRTS
to digitise my signal (similar to the previous experiment), however the waterfall diagram didn't show any change. Can anyone help me with this? :(
import serial
import time
from time import sleep
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setup(26, GPIO.OUT)
GPIO.output(26, True)
ser = serial.Serial("/dev/serial0",
baudrate = 115200,
parity=serial.PARITY_NONE,
stopbits=serial.STOPBITS_ONE,
bytesize=serial.EIGHTBITS,
timeout=1)
ser.setRTS(False)
time.sleep(5)
ser.setRTS(True)
time.sleep(5)
ser.setRTS(False)
time.sleep(5)
while True:
ser.write(b'hello!')
# ser.close()